Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Executing scripts immediate

robheinenJul 4 2012 — edited Jul 4 2012
Goodmorning,

For our application I created a script that generate create ( or replace ) statements. These staments are then executed using the execute immediate statement. However when a statement is larger than 32000 odd characters my variable - varchar2(32000) - can't contain the statement any more. Obviously, trying to declare a bigger varchar2 results in an error.

I tried using a clob. When I dbms_output a dbms_lob.substr( column_name, 255, 1 ) I get the first 255 characters in my script. when I then execute the following:

declare

c_clob clob;
g_length pls_integer;

begin
c_clob := 'create table frut_table( frut varchar2(45) )';
g_length := length( c_clob );
dbms_output.put_line( g_length );
execute immediate dbms_lob.substr( c_clob, g_length, 1 );
end;

it creates the requested table. When next I try the same using my large script I get an error:

ORA-06535: statement string in EXECUTE IMMEDIATE is NULL or 0 length/create_sa_table_functions

Is there - again - a limitation on the length of my script? If so, how can I then execute my script?

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2012
Added on Jul 4 2012
10 comments
2,854 views