|
-
Ok, I think your trigger is created for the INSERT event of the table AM, but you're trying to make a SELECT from the same AM table in the body of this trigger. As you know, a TRIGGER has the posibility to change the information of a table where it is created for and you're trying to read data from the same table.
Just let know to Oracle the values of the table AM before you have the possibility to change the data by using AUTONOMOUS_TRANSACTION pragma.
According with Oracle documentation,
"The AUTONOMOUS_TRANSACTION pragma instructs the PL/SQL compiler to mark a routine as autonomous (independent). An autonomous transaction is an independent transaction started by another transaction, the main transaction. Autonomous transactions let you suspend the main transaction, do SQL operations, commit or roll back those operations, then resume the main transaction."
So, you can use the PL/SQL pragma autonomous_transaction clausule like:
CREATE OR REPLACE TRIGGER pr_test
after insert ON AM
FOR EACH ROW
declare
pragma autonomous_transaction;
appo_pr varchar2(64):= null;
BEGIN
select name
into appo_pr
from AS
where AS_ID=:new.AS_ID;
insert into RM (name) values (appo_pr);
END pr_test;
Good Look!
Regards.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|