SQL> create table test(a number(20), b clob);
Table created.
SQL> insert into test values(1, 'sdsdf');
1 row created.
SQL> commit;
Commit complete.
SQL> declare
2 d clob;
3 begin
4 insert into test(a,b)
5 values(2,EMPTY_CLOB());
6 select b into d from test where a = 2 for update;
7 d := 'sdf';
8 update test set b = d where a = 2;
9 commit;
10 end;
11 /
d := 'sdf';
*
ERROR at line 7:
ORA-06550: line 7, column 6:
PLS-00382: expression is of wrong type
ORA-06550: line 7, column 1:
PL/SQL: Statement ignored
SQL> declare
2 d CLOB;
3 BEGIN
4 INSERT INTO TEST (a, b)
5 VALUES(2, EMPTY_CLOB())
6 RETURNING b INTO d;
7
8 d := 'sdf';
9
10 COMMIT;
11 END;
12 /
d := 'sdf';
*
ERROR at line 8:
ORA-06550: line 8, column 6:
PLS-00382: expression is of wrong type
ORA-06550: line 8, column 1:
PL/SQL: Statement ignored
SQL>
What am I doing wrong ?? I'm using Oracle 8.1.5 & 8.1.7
declare
d clob;
text varchar2(32767);
len integer;
begin
text:=rpad('-',32767,'-');
len:=length(text);
insert into test(a,b)
values(2,EMPTY_CLOB()) returning b INTO d;
dbms_lob.write(d,len,1,text);
commit;
end;
/
The d variable is of the CLOB type, it's a LOB locator and the direct update with a char value is not possible.
Bookmarks