date format [message #563174] |
Thu, 09 August 2012 05:27 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/fcc3aa4f6bf1216d7843b8a707820e3e?s=64&d=mm&r=g) |
oraclehi
Messages: 41 Registered: July 2012 Location: India
|
Member |
|
|
qry:= 'to_date(debtodt, 'dd-mon-yy')< sysdate';
or
qry:= 'debtodt < to_char(sysdate, 'dd-mm-yyyy');
or
qry:= 'to_date(debtodt, 'dd-mon-yy')< to_date(sysdate, 'dd-mm-yy')'
all these are showing error in oracle form.
in database
debtodt is in char format , calculating from-- TO_CHAR(add_months(b.FRMDT,b.period)-1,'dd-mm-yyyy')
and also in oracle form it is char,thats why i am changing it either debtodt into date format or sysdate into char format. but it is showing error as: encountered the symbol "DD" when expecting one of these.................
the same query
select * from debar_reg_vu where to_date(debtodt, 'dd-mm-yyyy')<sysdate;
running correctly in database server.
|
|
|
Re: date format [message #563181 is a reply to message #563174] |
Thu, 09 August 2012 06:18 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
cookiemonster
Messages: 13964 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
That'd be because the quotes put the date format outside the string.
try:
qry:= 'to_date(debtodt, ''dd-mon-yy'')< sysdate';
What you have is dynamic sql. To put a single quote in a dynamic sql string you need to use two quotes together.
|
|
|