SQL>
SQL>
SQL> CREATE TABLE myClob
2 (id NUMBER PRIMARY KEY,
3 clob_data CLOB);
Table created.
SQL>
SQL> INSERT INTO myClob VALUES (101,null);
1 row created.
SQL>
SQL> declare
2
3 clob_pointer CLOB;
4
5 v_buf VARCHAR2(1000);
6
7 Amount BINARY_INTEGER :=1000;
8
9 Position INTEGER :=1;
10 BEGIN
11 v_buf :=rpad('A',1000,'A');
12
13 insert into myClob values (1,EMPTY_CLOB());
14
15 SELECT clob_data INTO clob_pointer FROM myClob WHERE id = 1 FOR UPDATE;
16
17 DBMS_LOB.OPEN (clob_pointer,DBMS_LOB.LOB_READWRITE);
18
19 FOR i IN 1..500 LOOP
20
21 DBMS_LOB.WRITE (clob_pointer,Amount,Position,v_buf);
22
23 Position :=Position +Amount;
24
25 END LOOP;
26
27 DBMS_LOB.CLOSE (clob_pointer);
28 END;
29 /
PL/SQL procedure successfully completed.
SQL>
SQL> drop table myClob;
Table dropped.
|