Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    8

    Unanswered: Stored Procedure Retreive

    Hello,

    I need an help with retrving results from a stored procedure, I need to correct the syntax which I am not able to get through

    Given below are 3 commads, here 1) and 2) works fine, my problem is I need 3) to work fine too.

    1) create table emp1 (empno int,SALARY int) (works fine)
    2) CREATE PROCEDURE UPDATE_SALARY_10 (IN EMPLOYEE_NUMBER int,IN RATE int) LANGUAGE SQL MODIFIES SQL DATA UPDATE EMP1 SET SALARY = SALARY * RATE WHERE EMPNO = EMPLOYEE_NUMBER (works fine)
    3) CREATE PROCEDURE dd (OUT result int) LANGUAGE SQL CONTAINS SQL select empno from emp1 (gives 104 error)

    Can someone please help me here, I know its a syntax error but I am not able to get through it.

    Thank you
    Ashok

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by ASHOKJOSE
    CREATE PROCEDURE dd (OUT result int)
    LANGUAGE SQL CONTAINS SQL select empno from emp1
    Try the following instead:
    Code:
    CREATE PROCEDURE dd (OUT result int)
    LANGUAGE SQL READS SQL DATA select empno into result from emp1
    Also make sure that you don't get a -811 at runtime! (In this particular example, the table emp1 should have exactly one row.)
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  3. #3
    Join Date
    Jun 2007
    Posts
    8

    Smile Stored Procedure Retreive

    Thank you very much Peter, it helped
    This is the command I used and it helped

    CREATE PROCEDURE dd (OUT result int) LANGUAGE SQL READS SQL DATA select empno into result from emp1 where empno=1

Posting Permissions

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