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 > Data Access, Manipulation & Batch Languages > ANSI SQL > Triggers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-05-03, 17:30
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
Triggers

I want to import data into an Oracle table from SQL Server. I need to do this once a week for a certain table. I need the Oracle table to be truncated before the new data from the new week is inserted. I already have a trigger on the Oracle table to not let nulls in from a certain field. Can I make another trigger that will truncate the table? And how can I be sure that the truncate trigger will fire before the delete_nulls trigger?
Thanks.
Reply With Quote
  #2 (permalink)  
Old 11-06-03, 05:50
cvandemaele cvandemaele is offline
Registered User
 
Join Date: Oct 2003
Location: Switzerland
Posts: 140
How do you plan to transfer the data ? (SQLLoader, DTS, transparent gateway, ...)

What would be the event that will fire the trigger that should truncate the Oracle table ?
Reply With Quote
  #3 (permalink)  
Old 11-06-03, 09:33
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
I will do it with the DTS. I have a trigger in Oracle already to truncate the table, but I also do not want certain rows to go into the table during the data migration.
Thanks
Reply With Quote
  #4 (permalink)  
Old 11-06-03, 09:57
cvandemaele cvandemaele is offline
Registered User
 
Join Date: Oct 2003
Location: Switzerland
Posts: 140
I'm not sure I got it right, but :

1. I gues your delete_null trigger is a INSTEAD OF INSERT trigger fired from your Oracle table, is that right ?

2. I don't think you will be able to create a trigger fired from this very same Oracle table (on what event ?) that truncates itself.

I'm afraid I simply don't get it. Sorry.
Reply With Quote
  #5 (permalink)  
Old 11-07-03, 16:20
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
I have a table in SQL Server. I want to transfer this table to Oracle. In my SQL Server table there are values with null that I don't want in the Oracle table. The problem is, that when I transfer the table to Oracle, the data thats in the Oracle table from another data transfer is still there. I want to truncate the Oracle table and then transfer the data from SQL Server to the empty Oracle table, but without the lines with the null values. Is this a better explanation?
Thanks.
Reply With Quote
  #6 (permalink)  
Old 04-20-04, 16:45
nb_mitch nb_mitch is offline
Registered User
 
Join Date: Apr 2004
Location: Celebration, Fl
Posts: 1
Since you are using a DTS package, why not use SQL to select only the rows from the SQL Server you want to insert? You could also use a Truncate or Delete task first and forget about the Oracle triggers.
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