Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Search in IBM i 7.

IBM i / Change version


7.4 /
Feedback Product list

Built-in global variables


This chapter contains semantic descriptions, rules, and
examples of the use of the built-in
global variables.

Built-in global variables are provided with the database manager


and are used in SQL
statements to retrieve scalar values associated
with the variables.

As an example, the ROUTINE_TYPE global variable can be referenced


in an SQL statement to
retrieve the current routine type.

The authorization ID of any statement that retrieves the value of the global variable is
required
to have the READ privilege on the global variable and the USAGE privilege on the
schema containing
the global variable.

Example
To access the global variable CLIENT_HOST,
run the following query:

SELECT SYSIBM.CLIENT_HOST

FROM SYSIBM.SYSDUMMY1

The query returns the host


name of the current client.

hotellnx93

– CLIENT_HOST
This global variable contains the host name of the current client, as returned by the system.
– CLIENT_IPADDR

This global variable contains the IP address of the current client, as returned by the system.
– CLIENT_PORT

This global variable contains the port number used by the current client to communicate with
the server.
– JOB_NAME

This global variable contains the name of the current job.


– PACKAGE_NAME

Search in IBM i 7.4


This global variable contains the name of the package currently being used for a DRDA
connection.
– PACKAGE_SCHEMA

This global variable contains the schema name of the package currently being used for a
DRDA connection.
– PACKAGE_VERSION

This global variable contains the version identifier of the package currently being used for a
DRDA connection.
– PROCESS_ID

This global variable contains the process ID of the current job.


– ROUTINE_SCHEMA
This global variable contains the schema name of the currently executing routine.
– ROUTINE_SPECIFIC_NAME

This global variable contains the name of the currently executing routine.
– ROUTINE_TYPE

This global variable contains the type of the currently executing routine.
– SERVER_MODE_JOB_NAME

This global variable contains the name of the job that established the SQL server mode
connection.
– THREAD_ID

This global variable contains the thread ID of the current thread.

Parent topic:
Db2 for i SQL reference

Tell us what you think

Was this topic helpful?

Yes No

© Copyright IBM Corporation 2002,


SearchEnglish
in IBM i 7.4

Contact IBM

Privacy

Terms of use

Accessibility

Cookie Preferences

You might also like