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

what will the variable contain when SQL code -811 is issued?


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

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Wed Jan 09, 2008 2:44 pm
Reply with quote

Hi All,

In our application, a query returns two rows. So we get SQL code -811.

My question is,
The SELECT INTO variable will contian the value of first row or second row?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 09, 2008 3:30 pm
Reply with quote

before vsn 8, the host variable will be populated with an undetermined result row. Could be the first or the second.

vsn 8 nolonger populates the host variable when issuing a -811.


from vsn 7 you can say 'Fetch first row only', which will avoid the -811. Again, you don't know which one.

If your where clause stipulates a value for the column, then both rows (more than one result row) will contain the same value. If you don't have a where clause for the results column, then you need to add a where clause.
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Thu Jan 10, 2008 3:38 pm
Reply with quote

Hi,

I have tested the -811 condition.It is populating the value in the second row. However this value is not used most of the times and may not be consistent during all the runs.

Syam
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Thu Jan 10, 2008 3:38 pm
Reply with quote

And i am using DB2 Version 8.1

Syam
Back to top
View user's profile Send private message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Thu Jan 10, 2008 8:42 pm
Reply with quote

In another case the returned rows were 5. In that the values are populated undetermined. In that I am not able say any concrete row number being populated.

I am trying to find the version of my DB2..
Can I find it anywhere within my scope of job or something?or Do i need to check with the DB support group?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jan 10, 2008 8:51 pm
Reply with quote

your pre-compiler listing will tell you the db2 version.
Back to top
View user's profile Send private message
Munish Singla

New User


Joined: 18 Jul 2007
Posts: 21
Location: kolkata

PostPosted: Fri Jan 11, 2008 12:58 am
Reply with quote

It will contain second row.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jan 11, 2008 1:02 am
Reply with quote

ANYBODY THAT DEPENDS ON DATA FROM AN OPERATION THAT ENDS WITH A ERROR CODE IS ASKING FOR TROUBLE!
Back to top
View user's profile Send private message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Fri Jan 11, 2008 10:48 am
Reply with quote

It seems, it usually fetches second row only icon_sad.gif

I am able to find my DB2 version from the FOOTPRINT option in Endevor Tool.
My DB2 version is 7.1
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Variable Output file name DFSORT/ICETOOL 8
Search our Forums:

Back to Top