Home » RDBMS Server » Performance Tuning » MULTI TABLE INSERT USING BULK COLLECT (Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production)
MULTI TABLE INSERT USING BULK COLLECT [message #645454] |
Mon, 07 December 2015 04:37  |
 |
ramanaapps
Messages: 27 Registered: April 2013 Location: HYDERABAD
|
Junior Member |
|
|
HI Team,
I have to insert data into two tables with same sequence value.
Below is my anonymous block please suggest me.
DECLARE
CURSOR cr_boa_info
IS
SELECT ACCOUNT,
BOA_DATE,
AMOUNT,
CHECK_NUMBER
FROM SB_CE_BOA_ITI01A_STG
WHERE PROCESS_CODE='ERROR';
type boa_type
IS
TABLE OF cr_boa_info%rowtype INDEX BY binary_integer;
boa_rec boa_type;
BEGIN
OPEN cr_boa_info;
LOOP
FETCH cr_boa_info bulk collect INTO boa_rec;
EXIT
WHEN boa_rec.count = 0;
FOR ALL i IN boa_rec.first..boa_rec.count
INSERT
INTO CE_STATEMENT_HEADERS_INT
(
STATEMENT_NUMBER,
BANK_ACCOUNT_NUM,
STATEMENT_DATE
)
VALUES
(
SB_CE_ITI_01A_SEQ.nextval,
boa_rec(i).ACCOUNT,
boa_rec(i).BOA_DATE
)
INSERT
INTO CE_STATEMENT_LINES_INTERFACE
(
STATEMENT_NUMBER,
BANK_ACCOUNT_NUM,
TRX_DATE,
AMOUNT,
ATTRIBUTE1
)
VALUES
(
SB_CE_ITI_01A_SEQ.nextval,
boa_rec(i).ACCOUNT,
boa_rec(i).BOA_DATE,
boa_rec(i).AMOUNT,
boa_rec(i).CHECK_NUMBER
);
END LOOP;
COMMIT;
CLOSE cr_boa_info;
END;
/
I have to pass same sequence number to statement_number column in both the tables.
Please modify the above block and help me.
Thanks in Advance..
Ramana.
[Updated on: Mon, 07 December 2015 04:39] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Mon Jun 02 16:15:34 CDT 2025
|