View previous topic :: View next topic
|
Author |
Message |
kaleelahamed
New User
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
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 |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
And i am using DB2 Version 8.1
Syam |
|
Back to top |
|
|
kaleelahamed
New User
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
your pre-compiler listing will tell you the db2 version. |
|
Back to top |
|
|
Munish Singla
New User
Joined: 18 Jul 2007 Posts: 21 Location: kolkata
|
|
|
|
It will contain second row. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
ANYBODY THAT DEPENDS ON DATA FROM AN OPERATION THAT ENDS WITH A ERROR CODE IS ASKING FOR TROUBLE! |
|
Back to top |
|
|
kaleelahamed
New User
Joined: 08 Jun 2006 Posts: 45 Location: Trumbull, CT
|
|
|
|
It seems, it usually fetches second row only
I am able to find my DB2 version from the FOOTPRINT option in Endevor Tool.
My DB2 version is 7.1 |
|
Back to top |
|
|
|