Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Assign date value to date variable
Thanks so much.
In article <8uf7dt$jat$1_at_nnrp1.deja.com>,
sybrandb_at_my-deja.com wrote:
> In article <8uf5ut$i3s$1_at_nnrp1.deja.com>,
> genenatalie_at_my-deja.com wrote:
> > I'm new Oracle and trying to assign a value to a date variable and
then
> > print this value out as follows;
> >
> > declare d1 DATE;
> > d1 := TO_DATE('01062000',"MMDDYYYY");
> > begin
> > dbms_output.put_line (to_char(d1, 'mm/dd/yyyy'));
> > end;
> >
> > and get error ORA-06550, how do I do something as seemingly simple
as
> > this?
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> You have an assignment statement within your declaration section. This
> is incorrect. You are also using " around the format mask instead ' .
> This is also incorrect.
> Your code should either read:
>
> declare d1 DATE := TO_DATE('01062000','MMDDYYYY');
> begin
> dbms_output.put_line (to_char(d1, 'mm/dd/yyyy'));
> end;
>
> or
>
> declare d1 DATE ;
> begin
> d1 := TO_DATE('01062000','MMDDYYYY');
> dbms_output.put_line (to_char(d1, 'mm/dd/yyyy'));
> end;
>
> Please read the manuals carefully.
>
> Hth,
>
> --
> Sybrand Bakker, Oracle DBA
>
> All standard disclaimers apply
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Nov 10 2000 - 08:41:48 CST