10.14.4 Exceptions

When an error in the ODBC layer occurs, predicates in library(odbc) throw error/2 exceptions. Both arguments of the error/2 exception are the same and can have the following forms:

odbc_error(data_conversion, Goal)
Thrown in case of a error when converting to or from a SICStus data type from or to an ODBC data type.
odbc_error(unsupported_datatype, Goal)
Thrown when an SQL data type is unsupported when converting to or from a SICStus data type from or to an ODBC data type.
odbc_error(unknown_datatype, Goal)
Thrown when an unknown SQL data type is found when converting to or from a SICStus data type from or to an ODBC data type.
odbc_error(type_error, Goal)
Thrown when the Prolog data is of a type incompatible with the SQL data type when converting from a SICStus data type to an ODBC data type.
odbc_error(native_code, Goal)
Thrown in case of a error in the native code of library(odbc).
odbc_error(invalid_handle(handle_type, InvalidHandle, ReturnCode, Goal))
Thrown when an invalid handle type is specified.
odbc_error(invalid_handle('HandleType'-HandleType, 'Handle'-Handle), Goal)
Thrown when an invalid handle is specified.
odbc_error(invalid_handle(result_set, ResultSet), Goal)
Thrown when a Result Set handle is invalid.
odbc_error(unknown_connection_option(Options, Goal))
Thrown when an unknown option was given when calling odbc_db_open/[3,4,5].
odbc_error(internal_error, Goal)
Thrown when an internal error occurs in library(odbc). Please report this to SICStus Support.
odbc_error(diag(ReturnCode, Recs, Goal))
Thrown when an error occurs in the ODBC layer, e.g. a SQL syntax error. Recs is bound to the diagnostic records reported from ODBC.

Send feedback on this subject.