I am trying to display values from oracle to client appln.
I have a database field called STRNAME, datatype is varchar2(255), contains few hundreds of records. I have written a procedure to display the name,

Name: Proc 1

create or replace procedure test(aNum out varchar2) AS
cursor sample_cursor is select strname from sample1 ;

sample_rec sample1.strname%TYPE;
total varchar2(4000);
BEGIN
open sample_cursor;
fetch sample_cursor into total;
loop
fetch sample_cursor into sample_rec;
exit when sample_cursor%notfound;
total := total || '+' || sample_rec;
end loop;
aNum := total;
close sample_cursor;
END;

Name: test1.sql PL/SQL to execute the above proc

set serveroutput on
declare
aNum varchar2(4000);

begin
test(aNum);
dbms_output.put_line(aNum);
end;

My output is,
when i execute the test1.sql i got the following errors,

declare
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.DBMS_OUTPUT", line 64
ORA-06512: at line 6

I do now know where exactly the problem is. The data can be combination of chars and spl chars. I have doubt like is it related to string buffer is insuffient.

I am looking for your great help.

thanks

Padu