If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > data loading issue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-10, 11:58
abhi_n123 abhi_n123 is offline
Registered User
 
Join Date: Sep 2010
Posts: 1
Question data loading issue

Hi All,

Please let me know what is the best way to implement the below conditions:

i have data in staging table(60lak records & more) and have to insert the data into target table only if all the 1st col records(numeric) in staging table r having +ve values.
else -ve values need to be inserted into error table. Also if any -ve values are present then all records/data must be deleted from target table(or data shouldnt be loaded into target table).
what is the best way to do this so tat the performace is not effected...
Reply With Quote
  #2 (permalink)  
Old 09-13-10, 11:20
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
If this is a daily process and the staging table is identical in terms of setup as the live table, you could use something like Oracle partitions. By creating the staging table with partitions of positive and negative values we can simply move the staging partition of positive values into the live table.

If there are negative values you can truncate the staging table. This is the most efficient way of removing the records.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #3 (permalink)  
Old 09-13-10, 15:38
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
I don't know how data gets into the staging table, but if it is loaded from a file system (using SQL*Loader), then perhaps you could also consider NOT loading data into a staging table at all, but using the file as an external table. If that's the case, a simple procedure could do the rest.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On