Re: TO_CHAR can't convert a date to be inserted.

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: 1997/06/03
Message-ID: <5n1i7q$c2m_at_info.csufresno.edu>#1/1


In article <3392EB19.2830_at_wohl.slh.wisc.edu>, Mir <mq_at_wohl.slh.wisc.edu> wrote:
>One of our developers is having problem inserting a record into a
>table that has a TO_CHAR() conversion. However, if he hard-codes the
>date into the insert(), it works.
>
>Example:
>
>var1 := TO_CHAR(:form_date_field, format);
>insert into table (....)
> values(var1,....)
>
>This does not work!

Var1 is obviously a char or varchar2 item, and you are trying to pass it to a date column, which you cannot. Instead try:

Declare
  Dat1 date;
Begin
  Dat1 := :form_date_field;
  insert into table (....) values (dat1,...); End;

Or better yet, just do:
  Insert into table (....) values (:form_date_field,....);

Steve Cosner Received on Tue Jun 03 1997 - 00:00:00 CEST

Original text of this message