Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

TO_TIMESTAMP_TZ

TO_TIMESTAMP_TZ

Converts a string to Timestamp with Time Zone value. The function returns Timestamp with Time Zone data type. You use the TO_TIMESTAMP_TZ format strings to specify the format of the source strings.

Syntax

TO_TIMESTAMP_TZ (
String
, [
format
] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
String
Required
Must be a string data type. Passes the values you want to convert to Timestamp with Time Zone. You can enter any valid transformation expression.
The string must be a character string.
format
Optional
Enter a valid TO_TIMESTAMP_TZ format string. The format string must match the parts of the string argument. For example, if you pass the string 'Mar 15 1997 12:43:10AM ASIA/CALCUTTA', you must use the format string 'MON DD YYYY HH12:MI:SSAM TZR'.
If you do not specify the format string, the function uses the default date time format in the Run Configurations dialog.

Return Value

Returns a timestamp with time zone data type.
NULL if the input is a null value.
If the value passed to the function contains data that is not valid for a timestamp with time zone value, the Data Integration Service marks the row as an error row or fails the mapping.
Example
INPUT VALUE
RETURN VALUE
‘1947-08-05 10:45:00.221111000 AM America/Los_Angeles’, 'YYYY-MM-DD HH:MI:SS.NS AM TZR'
Returns a timestamp with time zone data type with the following data:
‘1947-08-05 10:45:00.221111000 AM AMERICA/LOS_ANGELES’
‘1947-08-05 10:45:00.221111000 AM America/Los_Angeles’, 'YYYY-MM-DD HH:MI:SS.NS AM'
Returns a timestamp with time zone data type even without specifying time zone region in the time zone region format:
‘1947-08-05 10:45:00.221111000 AM AMERICA/LOS_ANGELES'
‘1947-08-05 10:45:00.221111000 AM America/Los_Angeles’
Returns a timestamp with time zone data type even without specifying timestamp with time zone format.
'1947-08-05 10:45:00.221111000 AM AMERICA/LOS_ANGELES'
Default date time format at the Run Configurations dialog is used when the format is not specified at the function level.
Default date time format:
'YYYY-MM-DD HH:MI:SS.NS AM TZR'
‘1947-08-05 10:45:00.221111000 AM America/Los_Angeles’, ’MM-DD-YYYY HH:MI:SS.NS AM'
If a timestamp with time zone data does not match the given format, the following error appears:
Process row failed for function [TO_TIMESTAMP_TZ]: Failed to convert the string to timestamp with time zone value. Verify that the specified date format string is valid. Verify that the timestamp with time zone string used in the first argument is compatible with the specified date format.

0 COMMENTS

We’d like to hear from you!