SQL>
SQL> create global temporary table myTable
2 ( id int primary key,
3 c_lob clob,
4 b_lob blob
5 )
6 /
Table created.
SQL>
SQL> create sequence myTable_seq;
Sequence created.
SQL>
SQL> create or replace function to_clob( p_cname in varchar2,p_tname in varchar2,p_rowid in rowid ) return clob
2 as
3 l_clob clob;
4 l_id int;
5 begin
6 select myTable_seq.nextval into l_id from dual;
7 execute immediate 'insert into myTable (id,c_lob) select :id, to_lob( ' || p_cname || ' )
8 from ' || p_tname || ' where rowid = :rid ' using IN l_id, IN p_rowid;
9
10 select c_lob into l_clob from myTable where id = l_id ;
11
12 return l_clob;
13 end;
14 /
Function created.
SQL>
SQL>
SQL> drop table myTable;
Table dropped.
SQL>
SQL> drop sequence myTable_seq;
Sequence dropped.