fgl_driver_error() returns a CHAR(n) datatype value, which represents the last error received from the database interface.
DATABASE cms
MAIN
DEFINE sql_stmt VARCHAR(255)
DEFINE driver_error, native_error VARCHAR(255)
LET sql_stmt = "Invalid SQL statement"
WHENEVER ERROR CONTINUE
PREPARE p1 FROM sql_stmt
DECLARE c1 CURSOR FOR p1
OPEN c1
WHENEVER ERROR STOP
LET driver_error = fgl_driver_error()
LET native_error = fgl_native_error()
DISPLAY "Driver error: "
DISPLAY driver_error
DISPLAY ""
DISPLAY "Native error: "
DISPLAY native_error
CALL fgl_winmessage("Exit","Press any key to close this demo application","info")
END MAIN