DBINFO Options

The DBINFO function is actually a set of functions that return different types of information about the database. To invoke each function, specify its option as the quoted-string argument after the DBINFO keyword. You can use any DBINFO option anywhere within SQL statements and within UDRs.

The following table shows the categories of database and database server information that HCL OneDB™ can retrieve with valid DBINFO options.
  • The Arguments column shows the parentheses-delimited argument list of each valid DBINFO option.
  • The Information Returned column shows the type of database information that the Arguments option retrieves.
  • The Topic column shows where you can find more information about the Arguments option.
Arguments Information Returned Topic
('dbhostname') The host name of the database server to which a client application is connected Using the 'dbhostname' Option
('dbname') The identifier of the database to which a client application is connected Using the 'dbname' Option
('dbspace' tblspace_num) The name of a dbspace corresponding to a tblspace number Using the ('dbspace', tblspace_num) Option
('get_tz') The time zone of the session, $TZ, as specified as a string by the client. Using the 'get_tz' Option
('serial8') The last SERIAL8 value inserted in a table Using the 'serial8' and 'bigserial' options
('bigserial') The last BIGSERIAL value inserted in a table Using the 'serial8' and 'bigserial' options
('onedb', 'parameter') Type of the database server and its release version to which the client application is connected. (The call to DBINFO fails with an error if no parameter specifies a format for the version information.) Using the 'onedb' Option
('sessionid') The session ID number of the current session Using the 'sessionid' Option
('cdrsession') Whether a thread is performing an Enterprise Replication operation Using the 'cdrsession' option
('sqlca.sqlerrd1') The last SERIAL value inserted in a table Using the 'sqlca.sqlerrd1' Option
('sqlca.sqlerrd2') The number of rows processed by SELECT, INSERT, DELETE, UPDATE, EXECUTE PROCEDURE, and EXECUTE FUNCTION statements Using the 'sqlca.sqlerrd2' Option
('utc_current') The current UTC time value (as an integer number of seconds since 1970-01-01 00:00:00+00:00) when the SQL statement began to execute. Using the 'utc_current' Option
('utc_to_datetime', table.column) The DATETIME value corresponding to a specified integer column containing a UTC time value (as an integer number of seconds since 1970-01-01 00:00:00+00:00). Using the 'utc_to_datetime' Option
('utc_to_datetime', utc_value) The DATETIME value corresponding to a specified UTC time value (as an integer number of seconds since 1970-01-01 00:00:00+00:00). Using the 'utc_to_datetime' Option