|
I am new to using embedded SQL, and am trying to learn it in baby steps.
I did get my first program with embedded RPG to work fine. It retrieves a
single value from a database record in a physical file.
Compiled, works fine as long as the record is found.
If the record is not found I get error: SQLSTT = 58004 SQLCOD = -901
Is it normal to get these when no record is retrieved by the SQL
And I just need to monitor for them and program accordingly?
It will be normal that the record may not exist and I do have specific code
for no record found conditions.
I just want to make sure I am handling this type of error correctly.
My test Code snipet:
C eval W$SQLCmd = 'Values ( Select '+ P$FLDNM
C + ' from ' + P$FILNM
C + ' Where ' + W$KEYFLD + '=?'
C + ') into ?'
*
C/exec SQL
C+ Prepare W$MYSTMT from :W$SQLCmd
C/End-Exec
*
C/exec SQL
C+ execute W$MYSTMT Using :P$KEYVALUE, :P$RTNVALUE
C/End-Exec
*
C eval W$WrkDsp = 'SQLSTT = ' + SQLSTT
C + ' SQLCOD = '
C + %char(SQLCOD)
C W$Wrkdsp dsply
Thanks
John
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.