What is the default size of a varchar2 input to Oracle stored procedure, and can it be changed?

Gern Blanston picture Gern Blanston · Jan 13, 2011 · Viewed 49.7k times · Source

I have a stored procedure in Oracle Database 10g where my input is a varchar2 but I'm having issues getting it to run when the input string is long (not sure of exact length maybe > 8000).

My thought is the 'intext varchar2' (as below) is by default is too small. In other cases where I need a longer string I might define a varchar2 as "intext2 VARCHAR2(32767);" I tried to define the size similarly in the code below but my syntax is incorrect.

create or replace PROCEDURE TESTPROC ( intext IN VARCHAR2

) AS ....

What is the (default) size of the intext varchar2?

Can that size be defined (increased)?

thanks

Answer

Justin Cave picture Justin Cave · Jan 13, 2011

You cannot specify a size for a VARCHAR2 parameter to a procedure.

The procedure should happily accept strings up to 32k in size (the maximum size of a VARCHAR2 in PL/SQL). If it were a function that was being called from SQL rather than PL/SQL, the limit would be 4k because the maximum size of a VARCHAR2 in SQL is only 4k.