Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2012
    Posts
    9

    Unanswered: How to print the output?

    Suppose we are using this statement

    Select ename into V_name from emp where empno=1;

    How to print v_name????

    P.S : v_name is local variable.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    are you using stored procedure ?
    there are some functions like dbms_output that can help
    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

  3. #3
    Join Date
    Jul 2012
    Posts
    9
    No....
    I am just using a anonymous block.

  4. #4
    Join Date
    Jun 2012
    Posts
    12
    Variables in SQL??? - DB2 Database

    See if that helps you. I have been thinking of doing something similar. But, I have not yet tried to figure it out yet.

  5. #5
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    For db2 v9.7 on Linux, Unix, Windows

    Code:
    --#SET TERMINATOR @
    set serveroutput on
    @
    begin 
       declare v_name varchar(128);
       select lastname into v_name from employee where empno=10;
       call dbms_output.put_line(v_name);
    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
  •