Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Assign date value to date variable

Re: Assign date value to date variable

From: <sybrandb_at_my-deja.com>
Date: Thu, 09 Nov 2000 22:11:16 GMT
Message-ID: <8uf7dt$jat$1@nnrp1.deja.com>

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 Thu Nov 09 2000 - 16:11:16 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US