Functions used in INSERT statement
500213Dec 1 2007 — edited Dec 2 2007i 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.