Copies a portion of a string into a string variable.
EXTRACT {dst_txt_var|date_var} FROM {{src_txt_lit|_var|_col}|{src_date_var|_col}} {start_num_lit|_var}{length_num_lit|_var}
Text or date variable into which the extracted string is placed.
{src_txt_lit|_var|_col}|{src_date_var|_col}
Text or date variable, column, or literal from which to extract the string.
Starting location of the string.
You must specify the starting location of the string as an offset from the beginning of the string and its length. An offset of zero (0) begins at the left-most character; an offset of 1 begins one character beyond that, and so on.
If the source is a date variable or column, it is converted to a string before the extraction according to the following rules:
For DATETIME columns and Production Reporting DATE variables, Production Reporting uses SQR_DB_DATE_FORMAT. If not set, Production Reporting uses the first database-dependent format in Table 61, Default Formats by Database.
For DATE columns, Production Reporting uses the format specified by SQR_DB_DATE_ONLY_FORMAT. If not set, Production Reporting uses the format in Table 62, DATE Column Formats.
For TIME columns, Production Reporting uses the format specified by SQR_DB_TIME_ONLY_FORMAT. If not set, Production Reporting uses the format in Table 63, TIME Column Formats.
If the destination is a date variable, the string extracted from the source must be in one of the following formats:
One of the database-dependent formats (see Table 61, Default Formats by Database)
The database-independent format 'SYYYYMMDD[HH24[MI[SS[NNNNNN]]]]'.
extract $state from $record 45 2 extract $foo from “Oracle Rocks” 0 4 ! $foo=’Oracle’ extract $zip_four from &zip 5 4 extract $rec from $tape_block #loc #rec_len
The substr function described in Table 52, Miscellaneous Functions under LET