Re: [PL/SQL] Re: Using decode with dates

2014-02-25 Thread Ashish Barot
In this condition, if doc status is "R" and parameter date minus 10feb2014 is positive figure then doc status will be considered as authorised "A" Regards, Ashish On 24-Feb-2014 11:35 PM, "Sagar Thakkar" wrote: > HI can some explain the case function below specially the DECODE (SIGN > (TO_DATE (

Re: [PL/SQL] Re: Using decode with dates

2014-02-24 Thread Michael Moore
Amending what I said earlier, having this in the WHERE clause is not a problem. WHERE CASE WHEN Y.DOC_STATUS = 'R' AND DECODE (SIGN (TO_DATE (:P_CHK_RECD_TO, 'DD/MM/') - (TO_DATE('10/02/2014','DD/MM/'))), 1, 'A') = 'A' THEN

[PL/SQL] Re: Using decode with dates

2014-02-24 Thread ddf
On Monday, February 24, 2014 7:59:00 AM UTC-7, Sagar Thakkar wrote: > > HI can some explain the case function below specially the DECODE (SIGN > (TO_DATE (:P_CHK_RECD_TO, 'DD/MM/') - > (TO_DATE('10/02/2014','DD/MM/'))), 1, 'A') = 'A' > > WHERE CASE > WHEN Y.DOC_S

Re: [PL/SQL] Re: Using decode with dates

2014-02-24 Thread Michael Moore
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 ro

[PL/SQL] Re: Using decode with dates

2014-02-24 Thread Sagar Thakkar
HI can some explain the case function below specially the DECODE (SIGN (TO_DATE (:P_CHK_RECD_TO, 'DD/MM/') - (TO_DATE('10/02/2014','DD/MM/'))), 1, 'A') = 'A' WHERE CASE WHEN Y.DOC_STATUS = 'R' AND DECODE (SIGN (TO_DATE (:P_CHK_RECD_TO, 'DD/MM/') - (TO_DATE('1

Re: [PL/SQL] Re: Using decode with dates

2011-08-12 Thread Michael Moore
Hi Jyothi, Yes, a variable, (or table column) with a datatype of DATE can not be zeros. The key concept here is DATATYPE, not 'type', not 'data type', but 'datatype'. These are all different things. regards, Mike On Fri, Aug 12, 2011 at 7:27 AM, JK wrote: > This problem is resolved. > > On l

[PL/SQL] Re: Using decode with dates

2011-08-12 Thread JK
This problem is resolved. On loading into the actual table with the DATE type column resolves the format issue. Thanks. On Aug 12, 9:19 am, JK wrote: > I am just using SYSDATE as an example only since SYSDATE can never be > '00'. In my case I have the following syntax to retrieve from a >

[PL/SQL] Re: Using decode with dates

2011-08-12 Thread JK
I am just using SYSDATE as an example only since SYSDATE can never be '00'. In my case I have the following syntax to retrieve from a table: SQL> select decode(bill_begin_date,'00',null,TO_DATE (bill_begin_date, 'MM')) from TEMP_DETERMINATION; DECODE(BI - 01-JUL-10 01-

[PL/SQL] Re: Using decode with dates

2011-08-12 Thread JK
I tested it and this is the correct syntax and it returns 01-AUG-11. SQL> select decode(to_date(to_char(SYSDATE,'MM'),'MM'),'00',null,to_date(to_char(SYSDATE ,'MM'),'MM')) from dual; DECODE(TO - 01-AUG-11 SQL> On Aug 11, 9:25 pm, Michael Moore wrote: > If you are g