Re: Insert Question

From: Ed Prochak <edprochak_at_gmail.com>
Date: Tue, 8 Apr 2008 12:01:52 -0700 (PDT)
Message-ID: <9c89485f-3956-4f42-91f8-4a0359a72fb1@m71g2000hse.googlegroups.com>


On Apr 8, 2:20 pm, Mtek <m..._at_mtekusa.com> wrote:
> Hi,
>
> Say I have an external table with 4 columns like this. (Actual tables
> have more than 100 columns).
>
> C1
> C2
> C3
> C4
>
> And the actual table is exactly the same. The easiest thing to do is
> to do a INSERT...SELECT.
>
> However, say that I need to call a function on the first column to
> retrieve / convert a lookup value. How can I now do a INSERT /
> SELECT.
>
> I have 12 tables like this, and I do not want to create 12
> triggers......
>
> Does anyone have any suggestions?
>
> Thank you,
>
> John.

Well the triggers are likely easier than listing all the columns with a function on 12 out of 100 columns.
INSERT INTO realtable (c1,c2,c3,...c99,c100) select c1,c2,c3,c4funct(c4),...c99funct(c99),c100 from exttable ;

Would you rather write the above 12 times or 12 triggers?   Ed Received on Tue Apr 08 2008 - 14:01:52 CDT

Original text of this message