By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,227 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,227 IT Pros & Developers. It's quick & easy.

SQL SP ....

P: n/a
Why is this simple SQL SP not returning any results? It is running fine
(gives RC=0) but just not returning the result set.

CREATE PROCEDURE SQLSP9
(
IN PWORKDEPT CHAR(3)
, OUT v_sqlcode INTEGER
, OUT v_sqlstate CHAR(5)
)
DYNAMIC RESULT SETS 1
LANGUAGE SQL
BEGIN
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
DECLARE V_DUMMY CHAR(1);
DECLARE C1 CURSOR FOR SELECT FIRSTNME FROM db2admin.EMPLOYEE WHERE
WORKDEPT = PWORKDEPT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SET V_SQLCODE = SQLCODE;
SET V_SQLSTATE = SQLSTATE;
END;
OPEN C1;
END
@

TIA
Raquel.

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Oops forgot the WITH RETURN clause in the cursor declaration. That solved
it.

Thanks.
Raquel.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.