I'm hoping some PL/SQL guru will take pity on me and help me with this translation.
I'm not a SQL guru but what little I do know has been mostly Microsoft-SQL server / Access queries.
I'm trying to translate a complex PL/SQL query.
The line I'm having trouble with is:
...
AND to_DATE(Decodes(sign(to_Number(to_Char(Res_Date,'YYYYMMDD'))-20021229),-1,decodes(sign(to_number(to_char(Close_date,'YYYYMMDD'))-20021228),1,to_char(nvl(res_date,close_date),'YYYYMMDD'),to_Char(Close_date,'YYYYMMDD')), to_char(close_date,'YYYYMMDD')),'YYYYMMDD')
Between Pay_start_date and Pay_end_date
AND
Pay_year || Pay_period_num > = '200501'
Ok I'm just wondering if someone can just help me lay this one out command by command.. I know how to use to_char but I guess I'm not getting how the to_number works, and why the saved date format is negative?
Any help is appreciated.
- L
I'm not a SQL guru but what little I do know has been mostly Microsoft-SQL server / Access queries.
I'm trying to translate a complex PL/SQL query.
The line I'm having trouble with is:
...
AND to_DATE(Decodes(sign(to_Number(to_Char(Res_Date,'YYYYMMDD'))-20021229),-1,decodes(sign(to_number(to_char(Close_date,'YYYYMMDD'))-20021228),1,to_char(nvl(res_date,close_date),'YYYYMMDD'),to_Char(Close_date,'YYYYMMDD')), to_char(close_date,'YYYYMMDD')),'YYYYMMDD')
Between Pay_start_date and Pay_end_date
AND
Pay_year || Pay_period_num > = '200501'
Ok I'm just wondering if someone can just help me lay this one out command by command.. I know how to use to_char but I guess I'm not getting how the to_number works, and why the saved date format is negative?
Any help is appreciated.
- L