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 > Inserting into (table with trigger)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-15-03, 11:55
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
Inserting into (table with trigger)

Hey,

I need to insert data into a table that has a trigger constarint on it, there are 100 + rows of which the trigger raises an exception on < 10 of them. The problem is that no row is being inserted.

insert into t.value1, t.value2
select a.value2, a.value2
from temp a

trigger is on table t.
Reply With Quote
  #2 (permalink)  
Old 10-22-03, 15:57
dbmadcap dbmadcap is offline
Registered User
 
Join Date: May 2003
Posts: 87
You could write a pl/sql cursor to loop thru each row and insert into the table. Something like this:

Code:
begin
  for c_rec in (select value2 from temp) loop
    begin
      insert into t(value1, value2)
        values(c_rec.value2, c_rec.value2);
    exception
      when others then
        dbms_output.put_line('error:');
    end;
  end loop;
end;
/
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