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 has the following form odbc_error(Detail, Goal), where Goal is some goal where the error occurred, and Detail gives more information about the error. The Detail term can have the following form:

data_conversion
Thrown in case of a error when converting to or from a SICStus data type from or to an ODBC data type.
unsupported_datatype
Thrown when an SQL data type is unsupported when converting to or from a SICStus data type from or to an ODBC data type.
unknown_datatype
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.
type_error
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.
native_code
Thrown in case of a error in the native code of library(odbc).
invalid_handle(handle_type, InvalidHandle, ReturnCode)
Thrown when an invalid handle type is specified.
invalid_handle('HandleType'-HandleType, 'Handle'-Handle)
Thrown when an invalid handle is specified.
invalid_handle(result_set, ResultSet)
Thrown when a Result Set handle is invalid.
unknown_connection_option(Options)
Thrown when an unknown option was given when calling odbc_db_open/[3,4,5].
internal_error
Thrown when an internal error occurs in library(odbc). Please report this to SICStus Support.
diag(ReturnCode, Recs)
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.
out_of_memory
Thrown when some operation runs out of memory.
there may be other Details and new Details may be added in the future.

Send feedback on this subject.