471,887 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

SQL SP ....

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
1 1218
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.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.