Problem:
Customer is converting from Net Express using Oracle Pro*COBOL for embedded SQL processing to Visual COBOL for Visual Studio managed code using OpenESQL and ADO.
Their application does an embedded SQL select that may return more than one row. In the past, (Oracle Pro*COBOL) they coded for that possibility by looking for an SQLCODE of -2112.
However, under OpenESQL they are now getting a SQLCODE of 1 instead. How can they check for this condition?
Resolution:
OpenESQL returns ANSI standard return values.
The rules state that for a condition where multiple rows are returned in a singleton select then SQLCODE will = 1 which indicates that a warning has occurred and that the program should check the individual SQLWARN fields in the SQLCA structure to determine which warning occurred.
In the case of multiple rows being returned for a singleton select SQLWARN4 should contain a "W".
It is also possible to get a SQLCODE -811 returned for this condition if you compile your application using the SQL(CHECKSINGLETON) directive.
Otherwise you will get the 1.
#VisualCOBOL
#StudioEnterpriseEdition
#EnterpriseDeveloper
#COBOL
#Enterprise
#MFDS
#netexpress