Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Single Quotes Issue??

577178May 28 2008 — edited May 28 2008
Hi,

Bit of a strange one - hopefully there is a really simple answer that I will kick myself over….!

I have a query which references a partioned table. When the following condition is added, the query references the intended partion - evident by looking at the explain plan:

and e.dac_end_date >= '20080401'
(VARCHAR2 (8 Byte))

However, I want to automate my script. When I use a variant of the Sysdate function (detailed below) and execute the query, the explain plan indicates that Oracle is doing a full table scan….. Not good!!

e.dac_end_date >= to_char(add_months(sysdate,-1),'YYYYMM')||'01'

I'm guessing this may have something to do with single quotes… I have done a forum trawl, and tried some of the suggestions (char(39)||, three quotes surrounding the 'YYYYMM', concatenating single quotes around the format mask etc) - but I either get an error message, or the query just bombs out after a few seconds.

Anyone have any ideas or suggestions??

Any help greatly appreciated….

Cheers in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2008
Added on May 28 2008
5 comments
552 views