Hello Tom
First, thanks for all the help and advice you provide to the Oracle world.
I have a procedure which takes IN parameter as a complex object (Ex. Array Starts with Product Events which contains Engines(object) which in turn contains parts(object) and goes on with more levels). I started writing the procedure code as below.
MERGE INTO prod_evnt pe
USING (SELECT * FROM TABLE(CAST(pi_tbl_evnt AS t_tbl_evnt))) o
ON (pe.prod_evnt_id = o.evnt_id)
WHEN NOT MATCHED THEN
INSERT
/* Columns are shuffled (not as per DB column order) and maintained as per the screen */
(
prod_evnt_dt,
prod_evnt_stat_cd,
prod_evnt_id... and so on
INSERT
INTO
prod_evnt_doc
(
prod_evnt_id,
doc_seq_num,
data_source_nm,
doc_txt
)
SELECT o.evnt_id,
1,
NULL,
NULL
FROM TABLE(CAST(pi_tbl_evnt AS t_tbl_evnt)) o,
TABLE(o.evnt_rpt_doc) erd
As there are many tables say 40 to be inserted and updated, the same IN object has been CAST in the above fashion that many times. But I somewhere get a gut feel if this should be changed into a single loop which in turn loops the inside level arrays and make insert into tables. Could you please provide your valuable thoughts so that I would proceed in the right direction.