| SQL adaptation guide For Genero db 3.6x, 3.8x / Data manipulation | |
This table shows the native Genero db errors and the corresponding Informix SQL error returned in SQLCA.SQLCODE:
Genero db SQLCA.SQLERRD[2] |
Informix SQLCA.SQLCODE |
Error description (SQLERRMESSAGE) |
|---|---|---|
| -1 | -201 | syntax error |
| -3 | -206 | table not found |
| -4 | -201 | syntax error |
| -6 | -217 | column not found |
| -17 | -743 | object exists |
| -24 | -201 | syntax error |
| -35 | -236 | cols/vals mismatch |
| -10014 | -213 | SQL interrupted |
| -30004 | -263 | Cannot wait on another session. |
| -30005 | -213 | SQL interrupted |
| -60001 | -268 | Uniqueness constraint violation. |
| -80002 | -387 | no connect permission |
Here is the list of known errors the Genero db database driver can return:
| SQLCA.SQLERRD[2] | SQLERRMESSAGE | Reason |
|---|---|---|
| -213 | Query canceled | Long running query interrupted by user |
| -254 | Too many or too few host variables given. | PREPARE s FROM "insert into t values (?,?)" EXECUTE s USING x,y,z (z is too many) |
| -255 | Not in transaction. | OPEN insert cursor without BEGIN WORK |
| -284 | A subquery has not returned exactly one row. | SELECT * INTO ... FROM tab, returns more than one row |
| -400 | Fetch attempted on unopened cursor. | FETCH on cursor not opened |
| -404 | The cursor or statement is not available. | OPEN cursor after a FREE |
| -410 | Prepare statement failed or was not executed. | EXECUTE a statement where PREPARE has failed |
| -413 | Insert attempted on unopened cursor. | PUT on insert cursor not opened |
| -481 | Invalid statement name or statement was not prepared. | EXECUTE a statement without PREPARE |
| -482 | Invalid operation on a non-SCROLL cursor. | FETCH LAST/PREV/... on non SCROLL cursor |
| -526 | Updates are not allowed on a scroll cursor. | SELECT FOR UPDATE with SCROLL cursor |
| -535 | Already in transaction. | BEGIN WORK x2 |
| -6370 | Unsupported SQL feature. | CREATE DATABASE, SET CONNECTION DORMANT, CREATE PROCEDURE FROM, DATABASE IN EXCLUSIVE MODE, CONNECT TO @server, ... |
When this SQL error occurs, you can check the native SQL error in the SQLCA.SQLERRD[2] register.
When this SQL error occurs, you should set the FGLSQLDEBUG environment variable to get more details about the internal error.
MAIN
WHENEVER ERROR CONTINUE
CONNECT TO dsn_connectstring IF STATUS <> 0 THEN
DISPLAY "ERROR: Connection to the database failed."
DISPLAY SQLCA.SQLCODE, ": ",
SQLCA.SQLERRD[2], "-",
SQLERRMESSAGE
EXIT PROGRAM 1
END IF
WHENEVER ERROR STOP
END MAIN