Hi Guys,
Can you give me some examples for Incremental load in PL/SQL for Datawarehouse projects.
Regards,
Balu
5 13955
Hi
orabalu
Welcome to TSDN.
You have reached the right place for knowledge shairing.
Here you will find a vast resource of related topics and code.
Feel free to post more doubts/questions in the forum.
But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.
It will help Experts in the forum in solving/underestanding your problem in a better way.
Please follow the posting guidelines in every new post/reply.
Please specify your post/question clearly.
Dont expect others to guess and solve your problem.
Regards
Debasis
Hi,
There are some better and effective way to achieve Incremental Data Load using PL/SQL (if you have control over your sources)...
# Create the similar schema as in Source (that means if source has 100 tables that is going to be used to populate target, create similar table structures in this replica schema...you should add some audit columns into this new replica schema like: DML_Flag, Processed_Flag. ..etc.)
# This replica schema can be kept near by your data warehouse schema.
# Create After Insert/After Update Triggers on all the source tables, this will not affect your source system performance.
# This After Insert/After Update Triggers will push all the newly inserted record and updated record to the Replica Schema.
# Mark DML_Flag as 'I' for Insert records; 'U' for updated records; 'D' for deleted records (it can be a soft delete).
# Now based on the DML_Flag, take the record from this Replica Schema one-by-one.
# First take Insert records then Update and Delete etc.
# Update 'Processed_Flag ' column to 'P' ('P' for processed) for corresponding table of Replica Schema simultaneously.
# You can do the Error Handling and Erroneous Data Handling here (if required I can discuss the error_log and erroneous data log mechanism as well using PL/SQL in a separate session)
# Please note that if you are doing error handling and erroneous data handling here, then you should mark even erroneous records too as 'P-Processed'. It is given that you fix the error, based on your error_log, directly into the Source system.....
Hope it certaily help you.
Thanks and Regards,
Ranjeet
Hi Balu,
You can use merge statement where u can put a Flag for new updated or inserted records and maintain track of updated records using trigger in history table.
Warm regards,
Tabla
Dear Tabla,
Could you please elaborate that how can you use merge for incremental data load... it will be really of great help if you can give one example that how to use the suggested update or insert flag while using merge...
thanks and rgds,
ranjeet
Hi balu,
Kindly find the example.
In step 1) Create tables --> the target table for incremental load(MERGE_TEST ) and one for history(MERGE_T EST_HIS)
Step 2) Create trigger to store data which will updat in next day load but already present in table.
step 3) In this cursor will have current data to be loaded. The merge statement will check whether the part_id from cursor is available or not if yes it will update the changes in MERGE_TEST tables and maintains history in MERGE_TEST_HIS table. If the current cursor is totally new then it will insert the as it is. The flag = Y in MERGE_TEST table will indicate that this records are updated and and trans_Date will give on which day load these records are updated.
step 4) select * from merge_Test; will give you total records with current history from the loading has started.
select * from MERGE_TEST_HIS will give the OLD value of updated records with trans_Date on which these records are loaded in MERGE_TEST.
/******step 1)************* *************** ***/
CREATE TABLE MERGE_TEST
as
select /*+parallel(a 10)*/PART_ID, DATE_OF_BIRTH, SURNAME , sysdate trans_Date
From cp_partners a
where part_id > 3623099 and part_id < 3623200
alter table MERGE_TEST add flag varchar2(10);
create table MERGE_TEST_his as select * from MERGE_TEST where 1=2
/******step 2)************* *************** ***/
create or replace trigger merge_Test_trig
AFTER update or delete on merge_test for each row
begin
if (:old.part_Id = :new.part_id) or (:old.DATE_OF_B IRTH <> :new.DATE_OF_BI RTH) or (:old.SURNAME <> :new.SURNAME)
then
insert into merge_test_his
values (:old.part_Id ,:old.DATE_OF_B IRTH ,:old.SURNAME,n ull,sysdate);
else
null;
end if;
end;
/******step 3)************* *************** ***/
declare
cursor c1 is
select a.PART_ID, sysdate DATE_OF_BIRTH, a.SURNAME
from (select *
From cp_partners
where (part_id > 3623099 and part_id < 3623200)
or (part_id > 3623200 and part_id < 3623300)) a,(select * from MERGE_TEST) b
where a.part_id = b.part_id (+) ;
begin
for z in c1 loop
merge into MERGE_TEST
using dual
on (part_id =z.part_id)
when matched then
update
set DATE_OF_BIRTH = z.date_of_birth ,flag = 'Y',trans_Date = sysdate+1
when not matched then
insert (PART_ID, DATE_OF_BIRTH, SURNAME,trans_D ate)
values (z.PART_ID, z.DATE_OF_BIRTH , z.SURNAME, sysdate+1);
end loop;
end;
/******step 4)************* *************** ***/
select * from merge_Test;
select * from merge_test_his;
Regards
Tabla
Sign in to post your reply or Sign up for a free account.
Similar topics | |
by: g pavlov |
last post by:
W3C recommendations notwithstanding (see
http://w3.org/TR/html401/appendix/notes.html#notes-tables) I can't
seem to persuade either of the leading browsers to do true incremental
table loading. Neither responds to COL/COLGROUP tags.
I have a very large data table which is being generated in
J/ECMA/JavaScript dynamically. I want to give the user some top rows
while the bottom rows are still loading. Without true incremental
table...
|
by: Xela |
last post by:
Hi
I am facing the following problem. I load a fact table with around 25
millons lines, and 7 indexes. I load it with 3 million line subsets. I am on
a quadriprocessor Solaris machine. The loading phase seems quite efficient
and seems to be well parallelized. But the build phase is long and seems to
use only one processor. Very low IO wait occurs during this phase. Is there
something can I do to fasten this process? I guess that if the 4...
|
by: apple |
last post by:
UDB v8 fp 6a on AIX 5.1.0.0
Below is a manual incremental recover from compressed backup datasets.
With external compress backup datasets, can it be coded to do an
automatic incremental recover? The manual incremental recover works
just fine, but having trouble getting the automatic incremental recover
to work. Thanks for your help
# INCREMENTAL BACKUP
|
by: Willem |
last post by:
Based on MK's TSI_SOON (http://www.trigeminal.com/)I've created a
nifty little procedure that - whenever you compact you db you get an
incremental backup copy.
Given that you have a table with version information you get
incremental backups on a per-version basis.
SEE CODE BELOW
Basic idea is: start TSISOON with the options:
1. "compact this db"
|
by: Thorsten Ottosen |
last post by:
Dear all,
I work on a major system written in C# in visual studio 2003.
Our solution has 10+ projects and all projects are compiled with
/incremental.
In a C++ world, non-incremental builds aren't used for development...it
would simply take too
long to compile an update. So we would naturally expect that incremental
| | |
by: Alex Shturm |
last post by:
Hi,
I am trying to activate incremental link using VC7 (.NET 2003) on a pretty big
project (executable size is more than 100Mb, and it gets linked from several
dozen of libraries and object files of different sizes - from less than 1Mb to
tens of MBs).
The problem is that option /incremental:yes does not have any effect on the
link time. I observe that the linker removes existing executable and re-links
it from scratch.
|
by: Joel Matthew |
last post by:
My boss was asking about incremental backups.
I was scratching my head, thinking that the transaction log and a backup
policy (script) for each record set (sorry about the archaic terminology)
was the usual solution. But there is a some resistance against writing
more code, so I'm wondering what the current state of affairs with
postgresql in regards to incremental backup would be.
A quick search of the lists produced the following:
|
by: Raj |
last post by:
How can we do an online restore of a tablespace using the incremental
backup's? we are on a partitioned database...
Also, how could we use backup copy made by the load (using the copy to
option in load) to revover the tablespace?
Thanks,
Raj
|
by: mwelsh1118 |
last post by:
Why doesn't C# allow incremental compilation like Java?
Specifically, in Java I can compile single .java files in isolation.
The resulting individual .class files can be grouped into .jar files.
In C#, there appears to be no analog. I have to compile all my .cs
files into a single .dll.
This has serious drawbacks in terms of compilation. With Eclipse, I
change a file and only that file is re-compiled. With Visual Studio, I
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| | |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| | |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |