EXCEPTION
WHEN OTHERS
THEN
RAISE;
END;
what is the meaning or purpose of that??? The *ONLY THING* that does is hide the actual line number that cause the error. It adds nothing of value, it only detracts from your ability to diagnose anything. ugh. I'll never get it, why??? why do people do this?? anyone - why?
why no version information? It is relevant. I believe you are in 10g (where no such API exists, not with clobs) and not in 11g (where such functionality is supported)
and why doesn't your code even compile?? test_tb in the create table, test in the code. cursorid in the declare, v_cursorid in the body. ugh - why don't people take even the briefest of moments to *test things out*.
ops$tkyte%ORA11GR2> CREATE TABLE test (a NUMBER(10));
Table created.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> DECLARE
2 string1 clob := 'update test set a = 1 where 1 = 1 ';
3 string2 VARCHAR2 (1000) := 'OR exists (select * from dual where ''my long sub query'' = ''my long sub query'') ';
4 v_cursorid INTEGER;
5 BEGIN
6 for i in 1 .. 1000
7 loop
8 string1 := string1 || string2;
9 end loop;
10
11 DBMS_OUTPUT.put_line ('length of query is ' || LENGTH (string1));
12 v_cursorid := DBMS_SQL.open_cursor;
13 DBMS_SQL.parse (v_cursorid, string1, DBMS_SQL.v7);
14 end;
15 /
length of query is 79034
PL/SQL procedure successfully completed.
versus
ops$tkyte%ORA10GR2> CREATE TABLE test (a NUMBER(10));
Table created.
ops$tkyte%ORA10GR2>
ops$tkyte%ORA10GR2> DECLARE
2 string1 clob := 'update test set a = 1 where 1 = 1 ';
3 string2 VARCHAR2 (1000) := 'OR exists (select * from dual where ''my long sub query'' = ''my long sub query'') ';
4 v_cursorid INTEGER;
5 BEGIN
6 for i in 1 .. 1000
7 loop
8 string1 := string1 || string2;
9 end loop;
10
11 DBMS_OUTPUT.put_line ('length of query is ' || LENGTH (string1));
12 v_cursorid := DBMS_SQL.open_cursor;
13 DBMS_SQL.parse (v_cursorid, string1, DBMS_SQL.v7);
14 end;
15 /
length of query is 79034
DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 13
So, you are using 10g and as written many times before - 10g has a strict limit of 32k - period. You can use the overloaded parse routine that takes a table of 32k strings to overcome this - and that is all.
the api you claim to be using (the one with a clob input) does not exist in your release of the database)