Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 09:02 AM
Raquel
Guest
 
Posts: n/a
Default 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.

  #2  
Old November 12th, 2005, 09:02 AM
Raquel
Guest
 
Posts: n/a
Default Re: SQL SP ....

Oops forgot the WITH RETURN clause in the cursor declaration. That solved
it.

Thanks.
Raquel.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.