View previous topic :: View next topic
|
Author |
Message |
Albina
New User
Joined: 25 Aug 2006 Posts: 2
|
|
|
|
Consider that I have coded the following query in my Cobol Program:
SELECT MAX(SEQ_NO)
INTO :HOSTVARIABLESEQNO
FROM TABLE1
WHERE ID = 123
AND NAME = ABC
AND DATE = 20070827
AND CODE = 1
Note : The host variable 'HOSTVARIABLESEQNO' does not contain a NULL indicator.
Consider that TABLE1 has the following data.
ID NAME CODE DATE SEQ_NO
123 ABC 1 20070825 10
123 ABC 2 20070827 11
Now when this query is run, it whould return an SQLCODE -305.
Please do confirm whether there is a possiblity for this query to return an SQLCODE 100, when where clause fails.. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Craig Mullins, DB2 Dev Guide 4th, & 5th Edition wrote: |
The result of any column function (except the COUNT and COUNT_BIG functions) can be null. COUNT and COUNT_BIG always return a numeric result.
Columns functions will not return a SQLCODE of +100 if the predicate specified in the WHERE clause finds no data. Instead, a null is returned.
|
|
|
Back to top |
|
|
Albina
New User
Joined: 25 Aug 2006 Posts: 2
|
|
|
|
Hi Dick,
Thanks alot for confirming that the posted query cannot return SQL CODE 100.
Regards,
Albina |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if you add a null-ind-var, that will preclude a -305, but
a Column function will never give you an SQLCODE +100. |
|
Back to top |
|
|
|