Re: Datatype mismatch ??

From: Dario Bilic <dario_at_plusplus.hr>
Date: Fri, 4 May 2001 10:16:18 +0200
Message-ID: <9cto4e$hfq$1_at_as121.tel.hr>


Hi!

Your statement has invalid syntax.

Suppose your tables are created using the following statements (notice the field order!):
  CREATE TABLE bom_dummy_ref_desgs( n NUMBER, d DATE );   CREATE TABLE bom_unique_ref_desgs( d DATE, n NUMBER );

This statement would produce an error (even if the tables are empty):

  INSERT INTO bom_dummy_ref_desgs SELECT * FROM bom_unique_ref_desgs

                                        *
  ERROR at line 1:
  ORA-00932: inconsistent datatypes

This is happening because of the field order in tables. To avoid this of happening, always use
INSERT INTO destinationName(fld1,fld2,....) SELECT fld1, fld2, ... FROM sourceTable;

Correct way to do it is:
  INSERT INTO bom_dummy_ref_desgs(n,d) SELECT n,d FROM bom_unique_ref_desgs;

Or have the fields in your source and dest tables ordered so that the datatypes match.

Dario

"Fred Zimmerman" <fredz_at_silversoftware.com> wrote in message news:3af1b79a.256072392_at_news.ne.mediaone.net...
> I have a PL-SQL script that has a statement like the following:
>
> insert into bom_dummy_ref_desgs from
> select * from bom_unique_ref_desgs
>
> I get an error stating: Datatype mismatch on field UPDATE_DATE of
> type Date.
>
> My ? is how could an invalid date value have been allowed on insert
> to the source table (I did not populate this table, I'm only querying
> it).
>
> Is there a good solution to allowing the good records to go into the
> target table bypassing the invalid data value record in the source
> table?
>
> Thanks,
>
> zimmerman_fred_at_emc.com
> fredz_at_silversoftware.com
Received on Fri May 04 2001 - 10:16:18 CEST

Original text of this message