Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: bind variables for date used in query?
Why not make the bind variable a date instead. That is a date data type
then no conversion on the server needed.
Jim
"Carsten Jacobs" <carsten.jacobs_at_web.de> wrote in message
news:a407do$1artvs$1_at_ID-21443.news.dfncis.de...
> Hi,
>
> if found the following problem while using bind variables in an sqlscript
> (no PL/SQL):
>
> var startdate STRING;
> var startdate := '21.01.2002 00:00:00';
>
> -- this works
> select :startdate from dual;
>
> -- this doesn't work ( Error: ORA-01858: complaining about a non numeric
> char where a numeric char was expected)
> select to_date(:startdate, 'dd.mm.yyyy hh24:mi:ss') from dual;
>
> -- this works because of cutting the first char
> select to_date(substr(:startdate,2), 'dd.mm.yyyy hh24:mi:ss') from dual;
>
>
> The thing is, that the bind var 'startdate' contains a ' as the first
> character.
>
> Does anybody know why this ' is in the variable?
>
> Thanks
> Carsten
>
>
>
Received on Fri Feb 08 2002 - 08:47:14 CST
![]() |
![]() |