TO_DATE
Example:
TO_DATE(:SUBMISSIONDATE,'MM/DD/YYYY')
:SUBMISSIONDATE -- This is an input to the sql query which comes from java layer.
Tutorial Link
TO_CHAR
If we want to convert a date or number to string then we use to_char
Tutorial Link
How to compare 2 dates ?
TO_DATE(TO_CHAR(RD.SUBMISSIONDATE,'MM/DD/YYYY'),'MM/DD/YYYY') LIKE TO_DATE(:SUBMISSIONDATE,'MM/DD/YYYY'))
RD.SUBMISSIONDATE will return a timestamp (which includes hours, minutes and seconds). So first we convert a timestamp to a string date with the specified format and pass it to to_date as input, then we compare this date with other date using LIKE keyword.
For Greater than and Less than we can use regular symbols like < and >
AND TBU_NEW.LASTMODDATE > TBU_OLD.LASTMODDATE
We can also use equal to operator to compare dates
RD.MAXIMUMMATURITYDATE =RD_ADT.MAXIMUMMATURITYDATE
TO_NUMBER
Tutorial Link
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment