DB2存储过程在C程序中返回多行Cursor

时间:2012-07-24 12:11:54

标签: c db2

我想在DB2中编写一个存储过程,它将有一个表的游标,然后它会将整个游标行发送到C程序?

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

CREATE PROCEDURE GETNAMESET ( IN CNUM INTEGER )
RESULT SET 1
LANGUAGE SQL
BEGIN    
--Take the inputted customer number, CNUM and
--return the record(s) for that customer from the
--customer table via SQL result set(s)
  DECLARE C1 CURSOR FOR
    SELECT * FROM CUSTTABLE WHERE CUSTNUM = CNUM;
  OPEN C1;
  SET RESULT SETS CURSOR C1;
END;