Db/2 – Special Registers

Background

When Applications communicate with Db/2 an avenue is obviously opened up.  That avenue is populated with data to facilitate communication.

Special Registers

A special register is a storage area that is defined for an application process by the database manager. It is used to store information that can be referenced in SQL statements.

Code

SQL


 /*
 * Special Registers
 *
 */
SELECT

            CURRENT CLIENT_APPLNAME
                AS "appl"

          , CURRENT USER
                AS "user"

          , CURRENT CLIENT_WRKSTNNAME
                AS "wrkstn"       

          , CURRENT DATE
                AS "date"

          , CURRENT TIME
                AS "time"

          , CURRENT TIMESTAMP
                AS "timestamp"

          , CURRENT TIMEZONE
                AS "timezone"

          , CURRENT QUERY OPTIMIZATION
				AS "queryOptimization"        

          , CURRENT SCHEMA
                AS "schema"

          , CURRENT SERVER
                AS "db"

          , CURRENT LOCALE LC_TIME
                AS "locale Time"

FROM    SYSIBM.SYSDUMMY1

Output

specialRegisters.20181015.1126AM

References

  1. IBM
    • Home > IBM Big SQL 5.0.1 > IBM SQL reference > Language elements
      • Special registers

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s