Hi Tom
I'm trying to determine if its best to write this logic in SQL or should I write a PLSQL block.
My example:
I've two tables, one is main table which will have thousands of records and another is the report table which will have around 6000 records.
If few demographic field values changes in the main table for any of those 6000 records then those should be reported.
Table1 :
create table MAIN_CLIENT
(
ID NUMBER(9,0),
FRST_NME VARCHAR2(15 BYTE) NOT NULL ENABLE,
MDD_NME VARCHAR2(15 BYTE),
LST_NME VARCHAR2(20 BYTE) NOT NULL ENABLE
);
Table 2:
create table MAIN_RPT
(
ID NUMBER(9,0),
FRST_NME VARCHAR2(15 BYTE) NOT NULL ENABLE,
MDD_NME VARCHAR2(15 BYTE),
LST_NME VARCHAR2(20 BYTE) NOT NULL ENABLE
);
Insert into MAIN_CLIENT values (101,'MIKE','A','SMITH');
Insert into MAIN_RPT values (101,'MIKE','A','SMITH');
The main table got updated after we inserted records in the report table
Update MAIN_CLIENT set frst_nme = 'TIM' where id = 101;
My question:
I've PLSQL block which updates report table but I also need to check for existing values in the report table if its got upadated in the main table.
How to compare both the tables for changed values and query the record with new values.
Frst_NME, MDD_NME and LST_NME can be changed.
We can write PLSQL block but checking if its easier and efficient to do in SQL, Please suggest.
Thanks
P