Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    UK
    Posts
    52

    Unanswered: Update BLOB column data

    Dear All,

    I have a table which has a BLOB data type column. It holds some text content.

    I want to replace some characters within this text content for a selective set of rows.

    How can I achieve this?

    Thanks
    GP

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    May be use some DBMS_LOB functions?

  3. #3
    Join Date
    Jan 2004
    Location
    UK
    Posts
    52
    SET serveroutput ON;

    DECLARE
    v_start_pos INTEGER;
    v_blob BLOB;

    p_new_value VARCHAR2(10);
    p_id INTEGER;
    BEGIN
    p_new_value := 'new_data'; -- New data
    p_id := 8; -- For output_data_id in t_blob_data
    v_start_pos := 37; -- Position within the BLOB where 'new_data' is to be placed

    SELECT me.output_data
    INTO v_blob
    FROM t_blob_data me
    WHERE output_data_id = p_id FOR UPDATE;

    DBMS_LOB.WRITE (v_blob, length(p_new_value), v_start_pos, utl_raw.cast_to_raw (p_new_value) );
    COMMIT;
    END
    ;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •