Oracle 12c CLOB data type is not working as expected -



Oracle 12c CLOB data type is not working as expected -

i have oracle 12c procedure create or replace procedure logincheck(sqlqry in clob) c integer; n integer; rc sys_refcursor; stmt clob:= to_clob('begin ' || sqlqry || '; end;'); begin c := sys.dbms_sql.open_cursor; sys.dbms_sql.parse(c,stmt ,dbms_sql.native); n := sys.dbms_sql.execute(c); sys.dbms_sql.get_next_result(c,rc); sys.dbms_sql.return_result(rc); exception when no_data_found null; when others raise; end logincheck;

i phone call procedure in anonymous block (download xml info here: link)

declare stmt clob := 'inwardpkg.machineinward_validating(xmldoc => xmltype.createxml(paste xml link))'; --the parameter value xml can download above link begin logincheck(sqlqry => stmt); end;

but getting error pls-00172: string literal long.

if cut down xml size 40-50 elements remove elements. works fine.

in first line declare stmt clob := 'inwardpkg.machineinward_validating... defining clob. since using string literal define clob, facing limits of string literals (see oracle 12c documenation).

to solve problem have build clob step step, using dbms_lob package , appending strings not longer 4000 bytes until clob complete.

the basic idea:

class="lang-sql prettyprint-override">declare c clob := to_clob('first 4000 bytes'); v varchar2(4000); begin v := 'next 4000 bytes'; dbms_lob.writeappend(c, length(v), v); -- more writeappend calls until c finish dbms_output.put_line('clob-length: ' || dbms_lob.getlength(c)); end;

oracle clob oracle12c

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -