Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: string > 255 bytes through dynamic pl/sql
On Sun, 23 May 1999 20:26:21 +0100, "tim moger" <tmoger_at_proweb.co.uk> wrote:
>does anyone know how to parse and execute a string more than 255 characters
>long through dynamic pl/sql
>
>I am trying to insert into a large table (about 50 columns) and the string
>is becoming rather long.
>
dbms_sql will parse strings up to 32K. If you go beyond that limit then you can break your statement up using
procedure parse(c in integer, statement in varchar2s,
lb in integer, ub in integer, lfflg in boolean, language_flag in integer); -- Parse the given statement in the given cursor. The statement is not in -- one piece but resides in little pieces in the PL/SQL table "statement". -- Conceptually what happens is that the SQL string is put together as -- follows: -- String := statement(lb) || statement(lb + 1) || ... || statement(ub); -- Then a regular parse follows. -- If "lfflg" is TRUE then a newline is inserted after each piece.
eg.
SQL> desc t
Name Null? Type ------------------------------- -------- ---- ID NUMBER VAL VARCHAR2(100)
SQL> declare
2 l_stmt dbms_sql.varchar2s; 3 l_cursor number; 4 l_status number;
6 l_stmt(1) := 'insert into t ( '; 7 l_stmt(2) := 'id,'; 8 l_stmt(3) := 'val ) '; 9 l_stmt(4) := 'values '; 10 l_stmt(5) := '( 1, ''chris'' )';11
SQL> select * from t;
ID VAL
---------- -------------------- 1 chris
hope this helps.
chris.
--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.
![]() |
![]() |