Re: Insert Into-why doesn't it work?

From: Michael Kuznetsov <mvk_at_servocomp.ru>
Date: 30 Apr 2003 07:32:20 -0700
Message-ID: <1543a3e7.0304300632.614e3fa4_at_posting.google.com>


monicaroman_at_yahoo.com (Monica Roman) wrote in message news:<9eb77af5.0304290812.49235b7f_at_posting.google.com>...
> Hello,
> I received help on SQLLDR from this group a few weeks ago and now I
> need help with the insert into statement.
> I have 2 tables that have the exact same structure:
>
> Name Type
> ------------------------------- ------------
> FIELD1 DATE
> FIELD2 VARCHAR2(30)
> FIELD3 VARCHAR2(25)
> FIELD4 CLOB
>
> I need to:
>
> INSERT INTO Table1
> SELECT * FROM Table2
> WHERE Field1 like '28-APR-03%';
>
> But it doesn't work! why? It should be so simple!!
> I read a lot of the archived messages on the subject but couldn't find
> my answer. Apparently it has to do with the LOB field, does it? Please
> help?
>
> Thank you so much!
>
> Monica

Hi Monica,

As I understand from your example
WHERE Field1 like '28-APR-03%'

You try to select all rows with date 28 April 2003 with any time. For example: 28-APR-03 09:15am
28-APR-03 11:00pm
etc.
Correct?

For this is better to use trim() function: WHERE trim(Field1) = to_date('28-APR-03'); (may be to_date() needs format mask on your database)

You also can use like compare like this: Where to_char(Field1, 'dd-MON-yy') = '28-APR-03' But trim will work faster.

Regards,
Michael
Brainbench MVP for Oracle Programming
http://www.brainbench.com Received on Wed Apr 30 2003 - 16:32:20 CEST

Original text of this message