Ok, the way that I am inserting into this table (the one with the sequence - it is named REQUEST) is: If a field in another table (named INV) is changed then I want to insert a record into the REQUEST table. Basically an Audit Table. Therefore, I do not have the REQUEST table on my form. I was just going to insert the records into the REQUEST table (which I am not sure I can do this). Maybe I should paste my code........
begin
select inv.qty into old_qty from inv where inv.item = :inv.item;
if old_qty <> new_qty and new_qty <> 0 THEN
select req_id.nextval into seq from dual;
new_id := seq;
new_cust := :control.cust;
new_add1 := :control.addr1;
new_add2 := :control.addr2;
new_city := :control.city;
new_state := :control.state;
new_zip := :control.zip;
new_item_type := :inv.item_type;
new_comment := :control.req_comment;
new_item := :inv.item;
INSERT INTO REQUEST (req_id,cust, addr1, addr2, city, state, zip, item_type,item, date_req, qty, req_comment)
values (seq,new_cust, new_add1, new_add2,
new_city, new_state, new_zip, new_item_type, new_item,
sysdate, new_qty, new_comment);
end if;
end;
All the variables have been declared also. I also tried doing the maximum(my sequence name). I am getting the same error still. Maybe because I'm not sure I can use an ON-INSERT trigger.
Thank you!