I'm new to PL/SQL, looking for help!
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: I'm new to PL/SQL, looking for help!

  1. #1
    Join Date
    May 2001
    Posts
    11
    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

  2. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    DBMS_OUTPUT.PUT_LINE(a) can print only 255 characters per line.
    Try check it :

    begin
    test(aNum);
    dbms_output.put_line(substr(aNum,1,255));
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width