Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2014
    Posts
    294

    Unanswered: DBMS_OUTPUT.PUT_LINE (c) IN DB2

    Hi,

    I have written one small procedure.I trying to print that out put as from the docs I found that to print the result we have to use
    call DBMS_OUTPUT.PUT_LINE (c);

    this is my procedure,

    create procedure print (in a INTEGER,in b integer,out c integer)
    begin
    set c= a*b;
    call DBMS_OUTPUT.PUT_LINE (c);
    end

    output:
    status:
    Run: VENKATASD.PRINT(INTEGER, INTEGER, INTEGER)

    {call VENKATASD.PRINT(?,?,?)}

    Run of routine completed successfully.
    Query execution time => 97 ms

    unable to display the result from my code. Kindly let me know how to print my result

  2. #2
    Join Date
    Jul 2014
    Posts
    294

    DBMS_OUTPUT.PUT_LINE (c) IN DB2

    Hi Experts,

    Please don't ignore this post as a small thing. I request you to kindly help me with this basic. As I am very much new to these native procedures.

    Thanks in advance

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    we are looking with great attention at your code... please be patient.. your entry has been recorded with priority 1
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  4. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    try this from the command line:
    Code:
    db2 connect to mydb
    db2 set serveroutput on
    db2 "call VENKATASD.PRINT(2, 3, ?)"
    Regards,
    Mark.

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Maybe if you read the documentation thoroughly, you might be able to figure this out. Looking at the page:

    IBM Knowledge Center

    Look at the examples.

    It even references this:

    SET SERVEROUTPUT command

    My test run:

    Code:
    [db2inst1@Myserver ixf]$ db2 connect to MyDB
    
       Database Connection Information
    
     Database server        = DB2/LINUXX8664 10.1.2
     SQL authorization ID   = DB2INST1
     Local database alias   = MYDB
    
    [db2inst1@Myserver ixf]$ db2 "call dbms_output.put_line('Hello there')"
    
      Return Status = 0
    [db2inst1@Myserver ixf]$ db2 set serveroutput on
    DB20000I  The SET SERVEROUTPUT command completed successfully.
    [db2inst1@Myserver ixf]$ db2 "call dbms_output.put_line('Hello there everyone')"
    
      Return Status = 0
    
    Hello there everyone
    [db2inst1@Myserver ixf]$ db2 disconnect all
    DB20000I  The SQL DISCONNECT command completed successfully.
    Now I do not know if wrapping into a Stored Procedure will net the same results.

    Andy

  6. #6
    Join Date
    Jul 2014
    Posts
    294

    DBMS_OUTPUT.PUT_LINE (c) IN DB2

    Thank you for all your responses.
    I can view the result from my command prompt.
    Can any one help me to view the output , when i am running my procedures through IBM data studio.
    I mean how to SET SERVEROUTPUT ON in IBM DATA STUDIO.

    Thanks in advance...

  7. #7
    Join Date
    Mar 2006
    Location
    Bogota, Colombia
    Posts
    21

    dbms_output.put_line only works in terminal

    Hi,

    That option only works when executed in a terminal like the db2clp (db2cmd.exe or any shell in Linux).

    In data studio or similar applications do not work there, because they do not have standard output. The only thing they show is the result set, and the returned code from the routines.

    The documentation is not very clear there, but when they talk about a "buffer" seems like the standard output, but it is not. A similar thing happens the with get_line procedure
    Probably they work in CLP*Plus, but I have not tested.
    Last edited by angoca; 08-06-14 at 17:42.
    AngocA

  8. #8
    Join Date
    Jul 2014
    Posts
    294

    dbms_output.put_line only works in terminal

    Thanks for the clarification. Even I can't find the any clear solution for this.

Tags for this Thread

Posting Permissions

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