Sunday, 15 April 2012

sql - DB2 Stored Procedure parameter "is not valid in the context where it is used" -



sql - DB2 Stored Procedure parameter "is not valid in the context where it is used" -

i trying create next stored procedure:

-- <scriptoptions statementseparator="@"/> -- <scriptoptions errors="off" platform390="off"/> @ drop specific procedure depclh.gettransactionsummarybydaterange@ create procedure depclh.gettransactionsummarybydaterange (in p_dchdsb_id integer,in p_startdate varchar(50),in p_enddate varchar(50)) specific depclh.gettransactionsummarybydaterange language sql result set 1@ begin declare c_output cursor homecoming select sub.dchdsb_id facilityid, sub.dchdsb_code facilitycode, sub.name facilityname, sum(dep.amount) "totalamount", count(*) "transactioncount" depclh.deposit_subscriber sub inner bring together depclh.deposit dep on dep.dchdsb_id=sub.dchdsb_id sub.dchdsb_id=p_dchdsb_id , dep.created_ts between p_startdate , p_enddate grouping sub.dchdsb_id,sub.dchdsb_code,sub.name read only; open c_output; end @ grant execute on specific procedure depclh.gettransactionsummarybydaterange public @ commit @

i receive next error:

db21034e command processed sql statement because not valid command line processor command. during sql processing returned: sql0206n "p_dchdsb_id" not valid in context used. line number=3. sqlstate=42703

typo found in code. give thanks eye!

-- <scriptoptions statementseparator="@"/> -- <scriptoptions errors="off" platform390="off"/> @ drop specific procedure depclh.gettransactionsummarybydaterange@ create procedure depclh.gettransactionsummarybydaterange (in p_dchdsb_id integer,in p_startdate varchar(50),in p_enddate varchar(50)) specific depclh.gettransactionsummarybydaterange language sql result set 1 begin declare c_output cursor homecoming select sub.dchdsb_id facilityid, sub.dchdsb_code facilitycode, sub.name facilityname, sum(dep.amount) "totalamount", count(*) "transactioncount" depclh.deposit_subscriber sub inner bring together depclh.deposit dep on dep.dchdsb_id=sub.dchdsb_id sub.dchdsb_id=p_dchdsb_id , dep.created_ts between p_startdate , p_enddate grouping sub.dchdsb_id,sub.dchdsb_code,sub.name read only; open c_output; end @ grant execute on specific procedure depclh.gettransactionsummarybydaterange public @ commit @

sql db2

No comments:

Post a Comment