Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    india
    Posts
    23

    Question Unanswered: Long Raw field insertion and selecting

    Hi,
    Can anybody give me some tips on how to do the following
    1> Create copy of a table that has a long raw column
    2> How to select a long raw column.
    3> How to insert into a long raw field by selecting from a long raw field in another table.

    Please help!

  2. #2
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    CREATE TABLE owner.table1
    ( INVOICE_id VARCHAR2(15) NOT NULL,
    type CHAR(1) NOT NULL,
    bits LONG RAW )

    -----------
    EXAMPLE OF INSERTING FROM ANOTHER TABLE (ASSUME TABLE2 LOOKS LIKE TABLE1).

    DECLARE
    V_INVOICE_id VARCHAR2(15);
    v_TYPE CHAR(1);
    v_BITS LONG RAW;
    v_error number;

    CURSOR GET_ROW IS
    SELECT
    INVOICE_ID,
    TYPE,
    BITS
    FROM TABLE2;

    BEGIN

    OPEN GET_ROW;
    FETCH GET_ROW INTO
    v_INVOICE_ID,
    v_TYPE,
    v_BITS;
    LOOP
    EXIT WHEN GET_ROW%NOTFOUND;

    begin
    insert into TABLE1 (INVOICE_id,type,bits )
    values (v_INVOICE_ID
    ,V_TYPE
    ,v_BITS);
    exception when others then
    ERROR_ROUTINES....
    end;

    -------------------------------------------

    To look at the data ...
    Look at sys.utl_raw routines like cast_to_varchar2 , substr , etc ...

    HTH
    Gregg

Posting Permissions

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