Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Converting Date to char inPL/SQL?
> I'd like to convert a date variable to a char/varchar2 variable.
> Here's what I tried:
>
> datumold DATE;
> cDatumold VARCHAR2;
>
> cDatumold = TO_CHAR(datumold,'DD.MM.YYYY');
>
> I also tried without a mask:
> cDatumold = TO_CHAR(datumold);
>
> what's wrong here?
If this is your actual code, you need to use the assignment operator, which is := rather than = (that's an evaluation operator)
so change this
> datumold DATE;
> cDatumold VARCHAR2(10); -- as someone suggested
>
> cDatumold = TO_CHAR(datumold,'DD.MM.YYYY');
to
datumold DATE;
cDatumold VARCHAR2(10); -- as someone suggested
cDatumold := TO_CHAR(datumold,'DD.MM.YYYY');
Cheers!
Nick Grossan
Received on Wed Mar 17 1999 - 13:14:30 CST