Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2013
    Posts
    1

    Unanswered: stored procedure in DB2 5.3

    hello,

    i have a job to do and to be honest I don't know much about stored procedures in DB2. It's my first time writing SP and I have a problem that for You could be funny.
    I searched google and found nothing about it. And becouse I'm not going to write any more SP I don't want to buy a book and learn it.

    Please help me or just give an example how to solve a problem.

    My program needs to call a stored procedure that will insert a row into table and then update another table.
    it looks like this:

    Code:
    CREATE PROCEDURE lib1.INSERTPILNE ( IN SALESORDER DECIMAL(7, 0))
    SPECIFIC lib1.INSERTPILNE
    	LANGUAGE SQL
    
    
    
    UPDATE lib2.SRBSOH SET OHSTXC = '' WHERE OHORNO = SALESORDER;
    insert into qgpl.pilne values (SALESORDER, 'CNP', '');
    error:
    Code:
    insert into qgpl.pilne values (SALESORDER, 'CNP', '')
    
    [SQL0206] Column SALESORDER not in specified tables.
    it works only when I choose only one of the statement: update or insert. I don't know how to execute both

    I tried to create two procedures and call first in the second and still nothing.
    I also tried: add "begin" and "end".
    I saw some examples but none of them wants to work in my DB2
    To insert procedure to the database I use IBM data studio.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Are you using DB2 for iSeries? Please state the details of your environment.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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