As far as I can tell: 1) this does not belong in the WHERE clause 2) the entire DECODE function could simply be replaced by (date1 > date2)
Consider the following example: In case you don't know, DUAL is a table that has one column and one row. The column's name is "dummy" and the value of the row is "X". SQL> select dummy from dual DUMMY ----- X 1 row selected. SQL> SELECT CASE WHEN dummy = 'X' AND SYSDATE + 1 > SYSDATE THEN 'A' WHEN dummy = 'X' THEN 'B' ELSE 'R' END result FROM dual RESULT ------ A 1 row selected. SQL> SELECT CASE WHEN dummy = 'X' AND SYSDATE > SYSDATE THEN 'A' WHEN dummy = 'X' THEN 'B' ELSE 'R' END result FROM dual RESULT ------ B 1 row selected. On Mon, Feb 24, 2014 at 6:59 AM, Sagar Thakkar <saagar.thak...@gmail.com>wrote: > HI can some explain the case function below specially the DECODE (SIGN > (TO_DATE (:P_CHK_RECD_TO, 'DD/MM/RRRR') - > (TO_DATE('10/02/2014','DD/MM/RRRR'))), 1, 'A') = 'A' > > WHERE CASE > WHEN Y.DOC_STATUS = 'R' AND DECODE (SIGN (TO_DATE > (:P_CHK_RECD_TO, 'DD/MM/RRRR') - (TO_DATE('10/02/2014','DD/MM/RRRR'))), 1, > 'A') = 'A' > THEN > 'A' > WHEN Y.DOC_STATUS = 'A' > THEN > 'A' > ELSE > 'R' > END = 'A' > > On Friday, August 12, 2011 3:45:41 AM UTC+3, JK wrote: >> >> The decode always returns the date format in DD-MMM-YY format whereas I >> want it to return in MM/DD/YYYY format. >> >> select decode(to_date(to_char(SYSDATE,'YYYYMM'),'YYYYMM'),' >> 000000',null,to_date(to_char(SYSDATE,'YYYYMM'),'YYYYMM')) from dual. >> >> As of now, when I type this I do not have a proper SQL editor to test the >> syntax. Hence it may not be correct. However, I could run the decode query >> in TOAD at my work and that is when I saw it is returning in DD-MMM-YY >> format. I hope you got some idea as to what my requirement is. Looking >> forward to your help. >> >> >> Thanks in advance. >> > -- > -- > You received this message because you are subscribed to the Google > Groups "Oracle PL/SQL" group. > To post to this group, send email to Oracle-PLSQL@googlegroups.com > To unsubscribe from this group, send email to > oracle-plsql-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/Oracle-PLSQL?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "Oracle PL/SQL" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to oracle-plsql+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en --- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To unsubscribe from this group and stop receiving emails from it, send an email to oracle-plsql+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.