Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle VARCHAR limit as a procedure out parameter

I have a stored procedure written under Oracle 11g and one of my out parameters is a string (i.e. of type VARCHAR).

I use this parameter to return a concatenated list of numbers separated by ;. This list can be of any size and I do not know the size in advance.

My question is does VARCHAR will be enough or does it have a size limit (which will cause me troubles of course). If not what should I use for this case ?

Thanks

like image 603
giorashc Avatar asked Dec 21 '25 11:12

giorashc


2 Answers

A VARCHAR2 in PL/SQL may contain 32,767 characters. (Note that this is different to a VARCHAR2 column on the database, which has a maximum length of 4,000 characters)

Also, you say above that you're using VARCHAR. Oracle recommends that you use VARCHAR2, not VARCHAR.

like image 108
cagcowboy Avatar answered Dec 23 '25 00:12

cagcowboy


Why don't you use a suitable datatype like array of number instead of trying to encode a complex structure in a string?

like image 38
jarnbjo Avatar answered Dec 23 '25 01:12

jarnbjo