first of the year

Related Topics

Back to Audit Commission

Back to Home Page

  

"Shawn" spedwa...@qwest.net

I have the below script.  Every year we change the date (dpdate) in it manually so it reflects the beginning of the current year.
I just haven't been able to figure it out.  Any suggestions would be greatly appreciated.
select  decode(pull_level,'G','UNWRAPPED','S','WRAPPED') x, ga_id,         prov_company,sum(amount) gloss from    std_invopt,event,acctg_txn_acty where   acctg_txn_acty.ev_id = event.id         and std_invopt.id = acctg_txn_acty.sdio_Id         and trunc(dpdate) >= '01-JAN-04' GROUP   BY decode(pull_level,'G','UNWRAPPED','S','WRAPPED'),ga_id,prov_company / Thanks

Sybrand Bakker gooidit...@sybrandb.demon.nl

Sybrand Bakker, Senior Oracle DBA

Scott Mattes Sc...@TheMattesFamily.ws

But if run on any other day of the year problems could ensue, right?
Maybe something like to_date( to_char( Sysdate, 'yyyy' ) || '/01/01', 'yyyy/mm/dd' ) That way you always get Jan 1st of the current year.

"Niall Litchfield" n-litchfi...@audit-commission.gov.uk

Wrong SQL> select sysdate from dual; SYSDATE
---------
07-JAN-04 SQL> select trunc(sysdate,'YEAR') from dual; TRUNC(SYS
---------
01-JAN-04 SQL>
--
Niall Litchfield Oracle DBA Audit Commission UK

"Niall Litchfield" n-litchfi...@audit-commission.gov.uk

though SQL> select trunc(sysdate,'YEAR') from dual; TRUNC(SYSDATE,'YEAR')
-------------------------
08 Thoul Ki'Dah      1424 might suprise the application designer from time to time.
--
Niall Litchfield Oracle DBA Audit Commission UK
--
Niall Litchfield Oracle DBA Audit Commission UK ...

Turkbear joh...@dot.spamfree.com

Yep..Sometimes  we forget that not all calendars are the same..

 To Top