Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: accept that is century-compliant
hf wrote:
>
> How do I make the following century compliant?
> My email is: hessel_at_fdp.co.za
>
> accept dt prompt "Enter date (dd-mon-yyyy): "
> select count(*) from file1 where tr_date >= '&dt'
1)Either you set the default date format to be the format you expect,
which can be done either at the database level by setting in your
parameter file (the so-called init.ora file)
nls_date_format = 'DD-MON-YYYY'
or at the session level by executing
alter session set nls_date_format = 'DD-MON-YYYY'
2)Or, and this is certainly what I would do (never rely on implicit date
format!) you just specify the format in your query :
select count(*) from file1 where tr_date >= to_date('&dt','DD-MON-YYYY')
--
Regards,
Stéphane Faroult
Oriole Corporation