Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: trunc sysdate help please
"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
![]() |
![]() |