Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Functions used in INSERT statement

500213Dec 1 2007 — edited Dec 2 2007
i created 10 functions,eg, get_value(p_code, p_date). Each function only runs a very simple SELECT sql to retrieve the value from an individual mapping table based on 2 parameters input.

I want to transform the records from TABLE_B to TABLE_A for 2 million records as follows:

INSERT INTO TABLE_A
(EVENT_DATE
A_FIELD_01_CDE,
A_FIELD_01_VAL,
A_FIELD_02_CDE,
A_FIELD_02_VAL,
...
A_FIELD_10_CDE,
A_FIELD_10_VAL)
SELECT sysdate,
B_FIELD_01_CDE,
get_value(B_FIELD_01_CDE, sysdate),
B_FIELD_02_CDE,
get_value(B_FIELD_02_CDE, sysdate),
...
B_FIELD_10_CDE,
get_value(B_FIELD_10_CDE, sysdate)
FROM TABLE_B

Is this a good way to do so? Or I should write in another approach, eg, UPDATE each field one by one?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 30 2007
Added on Dec 1 2007
9 comments
807 views