2.1 TO_CHAR:
The TO_CHAR function converts numeric values and dates to text strings. It is available in the Designer and the Workflow Manager.
TO_CHAR (date [, format ] )
We can use Conversion functions with DATE functions in order to do some calculations.
The following composite expression converts the string DATE_PROMISED to date, adds 1 to it and then converts the same to text string with the format YYYYMMDD.
TO_CHAR(ADD_TO_DATE(TO_DATE(DATE_PROMISED),'DD',1),'YYYYMMDD')
Test functions can also be used with Conversion functions.
The following expression uses IS_DATE along with TO_CHAR.
IS_DATE(TO_CHAR(DATE_PROMISED,'YYYYMMDD'))
* TO_CHAR returns NULL if invalid Date is passed to the function.
2.2 TO_DATE:
The TO_DATE function converts a character string to a date datatype in the same format as the character string. It is available in the Designer and the Workflow Manager.
TO_DATE( string [, format ] )
Example : The following expression returns date values for the strings in the DATE_PROMISED port. TO_DATE always returns a date and time. If we pass a string that does not have a time value, the date returned always includes the time 00:00:00 . If we execute a session in the twentieth century, the century will be 19. The current year on the machine running the Informatica Server is 1998:
The format of the string must exactly be the format given in the TO_DATE function.
* TO_DATE function fails if invalid date entries are given. To avoid this we must use IS_DATE function to check if the string has a valid date to be converted.
2.3 TO_DECIMAL:
The TO_DECIMAL function converts any value (except binary) to a decimal. It is available in the Designer.
TO_DECIMAL( value [, scale ] )
We can also use two conversion functions together in a single expression.
The following expression uses the functions TO_DECIMAL and TO_CHAR.
TO_DECIMAL(TO_CHAR(DATE_PROMISED,'YYYYMMDD'))
2.4 TO_FLOAT:
The TO_FLOAT function converts any value (except binary) to a double-precision floating point number (the Double datatype). It is available in the Designer and the Workflow Manager.
TO_FLOAT( value )
2.5 TO_INTEGER:
The TO_INTEGER function converts any value (except binary) to an integer by rounding the decimal portion of a value. It is available in the Designer and the Workflow Manager.
TO_INTEGER( value )
No comments:
Post a Comment