IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Clarification regarding SYSIBM.SYSDUMMY1 usage


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Thu Dec 02, 2010 11:37 am
Reply with quote

Hi ,

I came across a query that looks something like below , but i dont know the actual purpose of this , can anyone please explain .

EXEC SQL
DECLARE xxxxxx CURSOR
WITH RETURN
FOR
SELECT -1
FROM SYSIBM.SYSDUMMY1
END-EXEC.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Dec 02, 2010 8:43 pm
Reply with quote

Hello,

Without more information, no one here will know the purpose of this query or why it is within a cursor.

The SELECT will return a -1. . .
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Thu Dec 02, 2010 9:46 pm
Reply with quote

dick scherrer wrote:
Hello,

Without more information, no one here will know the purpose of this query or why it is within a cursor.

The SELECT will return a -1. . .


sorry i myself don't know the query , some one sent me the question and i posted , the person was more interested in what will that with return option do , followed by a -1.
i will see if i can get more info from the person
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Dec 03, 2010 4:45 pm
Reply with quote

"with return" is used in stored procedures to create result sets.
for a more detailed answer, start reading about stored procedures and result sets.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 03, 2010 7:59 pm
Reply with quote

Hello,

One of my clients insists that every query used in MS-SqlServer be placed in a stored procedure. I've not run into this on the mainframe, but it seems to be somewhat common with SqlServer. Might this be the case here also?

I'm probably missing something, but i'm not clear on why the cursor or the "with return".

I suspect there is more not posted code that does this selectively. . . icon_confused.gif
Back to top
View user's profile Send private message
avik1983

New User


Joined: 11 Mar 2010
Posts: 5
Location: Chennai

PostPosted: Fri Dec 10, 2010 3:22 pm
Reply with quote

I hope this is a pure existence check without any condition writen . So it should always return -1

The output row count will be always 1, so i couldn't understand the usage of cursor.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts JCL and TAPE drives: how to maximize ... JCL & VSAM 9
No new posts Discrepancy b/w SYSIBM tables and BMC... DB2 0
Search our Forums:

Back to Top