Save value to long-type column and raw-type column : long « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> create table long_table
  2  ( id         int primary key,
  3    data       long
  4  )
  5  /

Table created.

SQL>
SQL> create table long_raw_table
  2  ( id        int primary key,
  3    data      long raw
  4  )
  5  /

Table created.

SQL> declare
  2      l_tmp    long := 'Hello World';
  3      l_raw   long raw;
  4  begin
  5      while( length(l_tmp) < 32000 )
  6      loop
  7          l_tmp := l_tmp || ' Hello World';
  8      end loop;
  9
 10      insert into long_table ( id, data ) values ( 1, l_tmp );
 11
 12      l_raw := utl_raw.cast_to_raw( l_tmp );
 13
 14      insert into long_raw_table ( id, data ) values ( 1, l_raw );
 15
 16      dbms_output.put_line( 'created long with length = ' || length(l_tmp) );
 17  end;
 18  /
created long with length = 32003

PL/SQL procedure successfully completed.

SQL>
SQL> drop table long_table;

Table dropped.

SQL> drop table long_raw_table;

Table dropped.








21.43.long
21.43.1.Save value to long-type column and raw-type column