Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: trunc sysdate help please

Re: trunc sysdate help please

From: Alan Mills <Alan.Mills_at_nospamservices.fujitsu.com>
Date: Tue, 5 Nov 2002 09:36:09 -0000
Message-ID: <aq83ef$4fl$1@news.icl.se>

"Steve" <hunt.s_at_blueyonder.co.uk> wrote in message news:B0Kx9.7817$xF.1535_at_news-binary.blueyonder.co.uk...
> I am trying to trunc sysdate in the following code but keep getting
errors.
> Obviously I am using the wrong syntax or the like. Could someone please
give
> me some guidance on this. I need to do this to force the date and believe
> that this is the way to do it.
>
>
> SET PAUSE ON;
> SPOOL Steve.lst
>
> SELECT Music.TypeCode, COUNT(LineId) Number_Of_Hires
> FROM HireContracts,HireContractLines,Music
> WHERE HireContractLines.ContractId=HireContracts.ContractId
> AND HireContractLines.MusicId=Music.MusicId
> AND HireStart BETWEEN LAST_DAY(ADD_MONTHS(SYSDATE),-3))+1
> AND LAST_DAY(ADD_MONTHS(SYSDATE),-1))
> GROUP BY Music.TypeCode;
>
> SPOOL OFF;
>
>
> Thanks in advance
>
> Steve
>
> Mailto: Hunt.s_at_blueyonder.co.uk
>

Hmm, not clear what your problem is. You started talking about an error to TRUNC the date but your SQL makes no use of the TRUNC builtin?????

However, in your SQL, shouldn't calls to ADD_MONTHS have two parameters. You only have one. Also you have the wrong number of parentheses. Each test closes three backets but only two are opened. Received on Tue Nov 05 2002 - 03:36:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US