使用 'get_tz' 选项

'get_tz' 选项返回展示当前会话的时区的 $TZ 字符串。

下列示例在 stores_demo 数据库的 cust_calls 表的查询中使用 'get_tz' 选项:
EXEC SQL select first call_dtime, dbinfo('get_tz')
        from cust_calls where customer_num = 106;

此示例返回会话时区的字符串值以及 customer_num 值为 106cust_calls 表中的第一个 call_dtime 值。