Search code examples
sqloracle-databasestored-proceduresnvarchar

oracle stored procedure error on large nvarchar2 value return


We have wrote an oracle function that returns nvarchar2 . it works fine when it return small value like 'hello'. However it return "ORA-06502 : character string buffer too small" error when the nvarchar2 goes long (about 3000 character). is there a limit in the size of function's return value?

we use the function like this:

SELECT sampleFunction('sampleArg') FROM DUAL;

Solution

  • I solved the problem by changing function's return type from NVARCHAR2 to CLOB.