Can We Create a Synonym On Trigger?

Answer Posted / avinash

I have created a trriger on CREATE,in which i m giving
execute immediate command for creating a synonym and using
dbms_job.submit .
it is not giving any error but its not creating any synonym
on the table...
code:

create or replace trigger bdesai.DR_CRA
after CREATE OR DROP on bdesai.schema
declare
l_str varchar2(255);
l_str1 varchar2(255);
l_job number;
begin
CASE ORA_SYSEVENT
WHEN 'CREATE' THEN
if (ora_dict_obj_type = 'TABLE') then
l_str := 'execute immediate "grant select on bdesai.'
||ora_dict_obj_name ||' to eqhub_developer";';
l_str1 := 'execute immediate "create or replace synonym
eqhub_developer'||'.'||ora_dict_obj_name ||' for
bdesai'||'.'||ora_dict_obj_name||'";';
DBMS_OUTPUT.PUT_LINE(replace(l_str,'"',''''));
DBMS_OUTPUT.PUT_LINE(replace(l_str1,'"',''''));
dbms_job.submit( l_job, replace(l_str,'"','''') );
dbms_job.submit( l_job, replace(l_str1,'"','''') );

END IF;
WHEN 'DROP' THEN
if ( ora_dict_obj_type = 'TABLE') then
l_str := 'execute immediate "revoke select on bdesai.'
||ora_dict_obj_name ||' from eqhub_developer";';
l_str1 := 'execute immediate "drop synonym
eqhub_developer'||'.'||ora_dict_obj_name||'";';
DBMS_OUTPUT.PUT_LINE(replace(l_str,'"',''''));
DBMS_OUTPUT.PUT_LINE(replace(l_str1,'"',''''));
dbms_job.submit( l_job, replace(l_str,'"','''') );
dbms_job.submit( l_job, replace(l_str1,'"','''') );
END IF;
END CASE;

end;
/

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

where to define interorganization transaction charges and what are the different options?

1949


List the various types of value set.

620


Do you know where we can check the status of po?

637


can we get profile values in report without using user exists is it possible how?

2316


List the types of flexfield?

605






Can you define an erp system?

675


What do you understand by a set of books?

645


In support project one ticket alloted which steps follows manualy tell me ?

2221


In oracle application how do you debug or trace errors?

639


What do you understand by soa?

689


Hi  Friends this is preetham, i am  searching for job on oracle apps(technical) i put 3 years fake exp, so any one  please could you help me for realtime interview  questions and 9739782164 this is my no srpsrp777@gmail.Com please guys please provide your no for contact i have a doubts i want to clarify

1565


what are the balancing segments in AR?

1647


What is count(*) from po_vendors(any table)?

639


Do you know what is applysys in oracle application database schema, what is apps?

674


How to retry multiple errored workflow processes? What is the access level in workflow used for? How do you define start and end functions in workflow? How does they differ from normal functions? Give me some workflow tables? What is the difference between a function and notification in workflow? I have sent two different notifications to two different users and I want to wait till both they are approved to send 3rd notification. How can you achieve it? What is item type and item key in workflow? How do you use attribute values in workflow messages? How do you use lookups in workflow? What are roles in workflow and how they are used? How do you download or upload a workflow from a server? What are steps to customize the workflow? What functions can you perform from workflow administrator responsibility? To send an email to the user workflow notification is the only way or is there any other ways to send it? Give me some workflow standard procedures? How can you run/start/kickoff workflow? What is wf_engine package used for? How many processes can each workflow contain? What is Runnable option in workflow? At what level it exists? What are different types of attributes in workflow? How do you reassign a notification? What is process in workflow? How can you send direct oracle form link through workflow notifications? How can you send a notification to multiple users? Can you change the list dynamically? Can you send html code in workflow notification? I have sent two different notifications to two different users and I want to wait till atleast one is approved to send 3rd notification. How can you achieve it?

4308