I create this trigger:

CREATE OR REPLACE TRIGGER pr_test
BEFORE insert ON AM
FOR EACH ROW
BEGIN
select name
into :new.name
from AS
where AS_ID=:new.AS_ID;
END pr_test;

It run correctly if I insert a new value with a new AS_ID

col AS_ID is not a primary key but is a foreign key on AS
in AM primary key is AM_ID
when I insert a new record in AM without AS_ID I get:
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "PR_TEST", line 2
ORA-04088: error during execution of trigger 'PR_TEST'

I'd like to create a trigger that when I insert a new record in AM (also without AS_ID) It verify the value in col NAME of AS and insert this value in col name of AM.
i.e. if AS_id is not set (null) I get AS_id from table AS and I get name from AS automatically

How can I modify it??

Thanks Raf