Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007
    Posts
    72

    Unanswered: stored procedure error

    Hi guys !

    i am creating a stored procedure

    create procedure sp_date_param (IN inp_date,col_value varchar(50),tbl_name varchar(50)
    LANGUAGE SQL
    begin
    select count(*) from tbl_name where col_value='inp_date'

    end
    o/s is aix 5.3 and db2 8.2.3 creating it via command editor !
    logic is that i want to give the name of the table in my datastage job and this tbl_name table doesnot exist which i will be passing through my datastaje job .

    please tell me what wrong am i doing ? what is the error why cant i parameterised the value in the procedure .
    i tried the same with db2 workbench .but its not parsing as it is not taking date value

    will appreciate a quick reply !!
    thank you very much
    oracle10gsingh !!

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    First please read the manual on the correct syntax for the CREATE PROCEDURE statement. Your parameter list is not declared properly for one. Second, this question gets asked a lot. You need to use dynamic sql. Look into PREPARE and EXECUTE statements. Also search this forum as this question has been answered many times.

    Andy

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Also, what should be done with the result of the query? You don't consume it...
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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