The DBINFO function

You can call the DBINFO function in a SELECT statement to find any of the following information:
  • The name of a dbspace corresponding to a tblspace number or expression
  • The last SERIAL, SERIAL8 or BIGSERIAL value inserted into a table
  • The number of rows processed by the SELECT, INSERT, DELETE, UPDATE, MERGE, EXECUTE FUNCTION, EXECUTE PROCEDURE, or EXECUTE ROUTINE statement
  • The session ID of the current session
  • The name of the current database to which the session is connected
  • Whether an INSERT, UPDATE, or DELETE statement is being performed as part of a replicated transaction.
  • The name of the host computer on which the database server runs
  • The type of operating system and the word length of the host computer
  • The local time zone and the current date and time in Coordinated Universal Time (UTC) format
  • The DATETIME value corresponding to a specified integer column or to a specified UTC time value (as an integer number of seconds since 1970-01-01 00:00:00+00:00)
  • The exact version of the database server to which a client application is connected, or a specified component of the full version string.

You can use the DBINFO function anywhere within SQL statements and within SPL routines.

The following query shows how you might use the DBINFO function to find out the name of the host computer on which the database server runs.
Figure 1: Query
SELECT FIRST 1 DBINFO('dbhostname') FROM systables;
Figure 2: Query result
(constant)

lyceum
Without the FIRST 1 clause to restrict the values in the tabid, the host name of the computer on which the database server runs would be repeated for each row of the systables table. The following query shows how you might use the DBINFO function to find out the complete version number and the type of the current database server.
Figure 3: Query
SELECT FIRST 1 DBINFO('version','full') FROM systables;

For more information about how to use the DBINFO function to find information about your current database server, database session, or database, see the HCL OneDB™ Guide to SQL: Syntax.