Create synonym in System trigger

How would i create a synonym in a system trigger?
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;
/

i just want to know can we create a synonym or use any ddl command in a trriger body.We are not allowed to issue COMMITs inside a trigger. Triggers are fired as part of a transaction. Because a COMMIT marks the end of a transaction and the commencement of a new transaction, allowing them to be fored inside a trigger would really break the ACIDity of the database.
If you really want to do this (and I would argue whether it's a sound approach) you will have to code an autonomous transaction in the trigger body. .
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/

Similar Messages

  • Createing system trigger

    Hi,
    I need to create a trigger to grant the select role and create synonym to that table which will fires after table is created.
    SQL> CREATE OR REPLACE TRIGGER ddl_create_alter
    2 AFTER CREATE or ALTER ON SCHEMA
    3 BEGIN
    4 IF ora_dict_obj_type ='TABLE' THEN
    5 Execute immediate 'grant select on ' ||ora_dict_obj_name||' to SYSTEM';
    6 EXECUTE IMMEDIATE 'create or replace synonym SYSTEM.'||ora_dict_obj_name||' for SYSTEM'||'.'|| ora_dict_obj_name;
    7 END IF;
    8 END;
    9 /
    Trigger created.
    SQL> create table test(v char(2));
    create table test(v char(2))
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-30511: invalid DDL operation in system triggers
    ORA-06512: at line 3
    Please can any one help me out how to overcome from this error
    Edited by: 847356 on Mar 25, 2011 4:49 AM

    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:663613799256
    http://asktom.oracle.com/pls/asktom/f?p=100:11:4431232071443862::::P11_QUESTION_ID:646423863863
    create or replace trigger t1_trigger
    after CREATE on sunil.schema
    declare
    l_str varchar2(255);
    l_job number;
    begin
    if ( ora_dict_obj_type = 'TABLE' )
    then
    l_str := 'execute immediate "grant select on ' ||
    ora_dict_obj_name ||
    ' to hr";';
    dbms_job.submit( l_job, replace(l_str,'"','''') );
    end if;
    end;
    Thanks,
    Sunil

  • System.trigger node when using set_tree_selection

    I use set_tree_selection on a search through on the nodes.
    But this does not set the :SYSTEM.TRIGGER_NODE property like i thought. Is this correct?
    i.e. if i mouse click the node it is correct. If i search for a node a programmatically find the tree node trigger_node is not selected.
    If this is correct, is there anyway to set system.trigger_node.

    In my example I do a search for a node.
    If the node is on a particular level it needs to have different options. I then use system.trigger_node to find the depth.
    I assume ill need to create a parameter to store the system.trigger/set tree node value and use the parameter rather than system.trigger_node

  • Synonym in forms trigger

    hello gurus
    i am using forms to query from a table for the schema (i.e."A").
    For various reasons, i had to move this table to another schema (i.e. "B") and create a synonym for A (with grants from B).
    I reasonly thought.. why shouldn't it work now?
    in pl/sql a procedure of schema "A" with the name of the synonym instead the table, is valid; on Forms, with the same code, while compiling from the same schema "A", it seems that the object doesn't exist..
    anyone has yet experienced it?
    best regards
    claudio

    So, you created synonym in user A which is accessing the table from B. And you dropped the table from A.yes, i dropped the table from A and i am using it from B
    So, how you are using in PL/SQL procedure i mean how you are using in sql statement with reference of schema? Did you refresh the forms session? And how >you are using in forms? i just use the synonym instead the table name in procedure blocks inside a forms trigger like this
    declare v_app varchar2(1);
    begin
    select 'x'
    into v_app
    from <table>
    where rownum<2
    end;
    compiling (also after closing and reopening the forms editor), it doesn't recognize the object.-..
    i can use the same code in a pure pl/sql procedure and it works..

  • System trigger error

    Hi Guys,
    I have created system trigger as follows
    ONLOGON
    declare
    s_date number(2);
    p_count number(10);
    BEGIN
    select to_char(sysdate,'DD') into s_date from dual;
    if s_date in (1,7,14,21,28) then
    select count(*) into p_count from t_bug;
    if p_count >20000 then
    --delete t_bug;
    --delete t_err_audits;
    execute immediate 'truncate table t_bug';
    execute immediate 'truncate table t_err_audits';
    end if;
    end if;
    COMMIT;
    END;
    While logon on date 21-AUG-09 system hangs and giving errors
    *** SESSION ID:(38.44) 2009-08-21 14:51:36.234
    Skipped error 604 during the execution of JBP_WEST.ON_LOGON_DELETE
    *** 2009-08-21 14:51:36.343
    ksedmp: internal or fatal error
    ORA-00604: error occurred at recursive SQL level 1
    ORA-30511: invalid DDL operation in system triggers
    ORA-06512: at line 11
    What is wrong here. Guide me to correct the problem.
    Arvind2
    Edited by: Arvind2 on Aug 21, 2009 3:19 AM

    Arvind2
    Apparently you didn't look up the error message
    ORA-30511: invalid DDL operation in system triggers
    In the online documentation.
    Most people posting here sadly refuse to look up any error message.
    Please tell me, when you look at your own code, what part of this error message you don't understand?
    It is quite self-explanatory!!!!
    'Kindly do the needful' and don't ask for clarification of the obvious.
    There is also no reason why you couldn't run this as an independent PL/SQL job.
    Sybrand Bakker
    Senior Oracle DBA

  • Create synonym everytime a new table/record is created

    Hi
    Is there a way of specifying within the peoplecode/Application designer to ensure that a synonym is created everytime a table/record object is created atleast for the Oracle database.
    I am looking for a solution within the peoplecode/Application designer since currently we are hand-coding it from outside using shell scripts and sql*plus.
    Thanks
    Cyril
    PS: sorry for the repeat post..the other was wrong

    Since I don't see what was wrong there, I'll repeat my answer from the other :
    "You should create a trigger on schema level (most probably on SYSADM).
    In that trigger (BEFORE CREATE), create a job (to be execute immediately, without recurrence), that job will call a procedure with the object name in input parameter. The procedure will grant and create synonym with in dynamic sql for that object."
    That said, why do you want to manage it in Peoplesoft, tables are hosted by Oracle, when something is changed in AppDesigner, you should rebuild this object, the rebuild will affect the Oracle object, then the trigger can be fired.
    Nicolas.

  • How do I create an archive system for a blog created with a custom app?

    I had to create a blog using a custom app, because I needed an image to show up in the list view (a feature I can't believe does not exist in the blog module). Anyways, I am wondering how can I create an archive system? Do I need to create categories for each month/year and then classify the post each time we create one. Then manually create links each month to pages that filters listing by that category? This is the system I tried, but I was wondering if there was a better way.
    Also, I would like to have a sidebar that shows all the authors/contributors of the blogs and have a count under their photo that shows how many blogs they have contributed to, and have this update dynamically each time they create a new post. I was wondering if a data source tag is the way to do this but I don't have enough information on how the data source tag even works, to really know how to do this.
    I have searched google for hours, and even signed up for BC gurus tutorials with no real luck. I thought BC gurus was going to have the answer but it wasn't quite detailed enough. Any help would be much appreciated. Thanks!

    You can use classifications but there is no auto feature to archive like that on web apps.
    In terms of the blog, Like I have said to everyone that has posted about blog preview images:
    http://www.prettypollution.com.au/business-catalyst-blog
    Just one example of an image at the start of the blog post rendering out, not hard at all.

  • Create SAP Source System Failed

    Hi all,
    We are using NetWeaver 2004s BI and try to connect to ECC 5.0. I tried to create SAP source system but got error message saying "RFC user logon failed". When I check RFC destination in ECC 5.0 for BI, the test connection is ok, but the remote logon will pop up another logon screen asking for id and password. I am pretty sure that the id and password in RFC destination is correct. The RFC destination in BI is ok. Can you help me out with this? Thanks a lot in advance.

    Hi,
    Check the Default Logon <b>Client</b> for ECC 5.0
    and verifiy that the User is in the Same Client
    Each RFC destination has a mapped user for specific Client..Check the Client and User in the same client
    regards
    Happy Tony
    Message was edited by: Happy Tony

  • ? how do I create a 'Search' system without being linked to a server ?

    Hello,
    I have a project which I am trying to make simple and would like your help.
    I need to create a 'navigation system' which at the moment is a series of Flash .swf files uploaded to a Dreamweaver HTML page.
    Now I need to get them working together like a 'tag' or a search system, but I don't want to get a server involved.
    Is it possible to create something that operates like a website but without being linked to a server?
    I'm already greatful

    you can populate your data into an html table or xml syntax and then use srpy to create a search without the need for a database.
    Herre's an example. View and study source code to create your own.
    http://labs.adobe.com/technologies/spry/samples/data_region/SuggestSample.html
    http://labs.adobe.com/technologies/spry/samples/autosuggest/SuggestSample.html

  • Problem in Creating a JDBC System - SQL Server

    Hi All
    I failed in creating a JDBC System(SQL Server).  I am using SAP EP 7.0 SP 9.  I tried to create the JDBC system with the following properties:
    I am listing them Category wise:
    Connection Properties:
    1. Connection Timeout: 300
    2. Connection URL: jdbc:sap.sqlserver://<server name> : <port name>; DatabaseName=master
    3. Driver Class Name: com.sap.portals.jdbc.sqlserver.SQLServerDriver
    4. Validate Connection: Yes
    UserManagement Properties:
    5. User Mapping Type: admin;user
    Please help me out in making this work. And let me know if any changes to incorporated.
    Regards,
    Vijay.

    Hi vijay,
    I have tried this thing sometime back. But when i create a JDBC system, I never give the <b>Connection Timeout</b> and change the<b> Validate Connection</b> from No to Yes. I just give the <b>Connection URL</b> and the <b>Driver Class Name</b> in the Connection Properties dropdown.
    Try making these changes and check whether the user mapping is done correctly. Also check whether the Connection URL and the Driver Class Name are correct or not. Have a look at the following link:
    <a href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/VC/JDBC%2bConnection%2bSetup">https://www.sdn.sap.com/irj/sdn/wiki?path=/display/VC/JDBC%2bConnection%2bSetup</a>
    Let me know if this works.
    Bye
    Ankur
    Reward points if it helps!!

  • Problem in creating a JDBC System on VC7.1 portal ( CE7.1 SP3)

    I have a problem in creating a JDBC System on VC7.1 portal (CE7.1 SP3)
    I get the following error:
    Test Details:
    The test consists of the following steps:
    1. Retrieve the default alias of the system
    2. Check the connection to the back-end application using the connector defined in this system object
    Results
    Default alias retrieved successfully
    Connection failed. Make sure user mapping is set correctly and all connection properties are correct.
    Could you please let me know if there are any guides on SAP Library; I was not able to find any documentation nor any threads discussing this on VC7.1
    Although, I saw this thread Can Visual Composer talk to/connect to any Database?..
    which says that VC7.1 can connect to SAP backend
    and web services only, and there is no direct connection to the db.
    Help needed please.

    Hi Dharmi
    Here is a quote of Dafna's post in [another thread in this forum|Re: Copy VC controls]
    CE7.1.1 will be released at September 2008 for ramp-up customers.
    There are many improvements and new capabilities in the new release of Visual Composer for CE7.1.1. Among the new features you can find:
    The missing features from Visual Composer 7.0 (Html view, portal Eventing support (EPCM), JDBC, Undo/Redo, and more..)
    Many layout & modeling improvements
    Additional ALV table functionality - export to Excel, switch to chart, configure ALV behavior at design time
    Integration of Visual Composer in Eclipse - additional entry point to the Visual Composer models from the NWDS. This integration provides the option to add a WD component (in case of missing functionality in Visual Composer), as a black box component to the Visual Composer model. Right-clicking the component will open the Web Dynpro perspective for creating/modifying the component.
    Regards,
       Shai

  • Task Manager Not loading Properly. Giving Error No more threads can be created in the System.NAPStatus UI and Some other Task related Errors

    I have a problem with the Task Scheduler. It is not opening properly it is giving Error Message box at this time i am unable to post. The Tasks Scheduler is starts with a error alert "No more threads can be created in the System.NAPStatus UI".
     I am unable to view the history of the tasks schecduled.It is giving message as 
    "The user account does not have permission to Access the Task History."
    How to fix it. It is frustrating as can't able to track my Tasks and Create new Tasks. Any Suggestions helpful.
    Thanks in Advance.
    RehaanKhan. M

    Hi,
    Thanks for your post.
    Please check event viewer if there are some error logs?
    Meanwhile, there is a similar thread has been discussed:
    Receiving error about "no more threads"
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/9a9e22e4-d947-4d19-b06c-aaadda624dbc/receiving-error-about-no-more-threads?forum=winservergen
    Regards.
    Vivian Wang

  • Problems in creating a application system

    RME-00011: Operation 'open' on ACTIVITY has failed
    RME-00011: Operation 'INS' on ci_application_systems has failed
    These are the errors i get when i try and create a application system. Can some plz tell me what to do exactly. Iam all confused.
    Thanks

    It doesnt work, because i deleted the ' while chaning the caption to currency....
    OK here is my original Text....
    chart:
    <Graph graphType="PIE">
    <Title text="" visible="true" horizontalAlignment="CENTER"/>
    <LocalGridData rowCount="{count(xdoxslt:group(DATA/query_DATA/ROW, 'POS_EURO_TXT'))}" colCount="1">
    <RowLabels>
    <xsl:for-each-group select="DATA/query_DATA/ROW" group-by="POS_EURO_TXT">
    <xsl:sort select="POS_EURO_TXT"/>
    <Label><xsl:value-of select="current-group()/POS_EURO_TXT"/></Label>
    </xsl:for-each-group>
    </RowLabels>
    <DataValues>
    <xsl:for-each-group select="DATA/query_DATA/ROW" group-by="POS_EURO_TXT">
    <xsl:sort select="POS_EURO_TXT"/>
    <RowData>
    <Cell><xsl:value-of select="sum(current-group()/NET)"/></Cell>
    </RowData>
    </xsl:for-each-group> </DataValues>
    </LocalGridData>
    </Graph>
    <DATA>
    <query_DATA><ROW>
    <KUNGRUPPE>ABC</KUNGRUPPE>
    <POS_EURO_TXT>USD</POS_EURO_TXT>
    <NET>7785763.25</NET>
    </ROW><ROW>
    <KUNGRUPPE>ABC</KUNGRUPPE>
    <POS_EURO_TXT>EURO</POS_EURO_TXT>
    <NET>15242332211.9</NET>
    </ROW><ROW>
    <KUNGRUPPE>XXX</KUNGRUPPE>
    <POS_EURO_TXT>EURO</POS_EURO_TXT>
    <NET>7894268.84</NET>
    </ROW></query_DATA>
    </DATA>
    Greetings

  • Windows 7 Ultimate isn't installing on my iMac. Setup was unable to create a new system partition or locate an existing system partition

    I have a 21.5" iMac (Late 2012) running OS X Mavericks. I'm trying to install Windows 7 Ultimate via Bootcamp but whenever i get to the setup part it goes wrong
    These are the steps I followed
    I selected all the options since I didn't have the drivers or an install disk
    it copied the Windows 7 iso image, downloaded the support software, and saved the support software to the flash drive (8GB)
    I selected a partition size - I gave windows roughly 100GB
    and I let it install
    Right now I'm at the part where it says " where do you want to install windows? I selected the bootcamp partition and formatted it. It now says
    "Setup was unable to create a new system partition or locate an existing system partition. See the Setup log files for more information"
    WHAT DO I DO?

    I had to read the apple instructions several times before they started to make sense.  I burned my iso onto a DVD and had the required USB for support software.  Are you trying to use the single USB method?
    This article has a lot of info on the single usb method

  • Boot Camp - Setup was unable to create a new system partition....from Windows install

    Hi folks.  So I ran the boot camp wizard and made a USB install key for windows from that.  I boot to it and everything works until I get to the install.  I format the Boot Camp partition as indicated in the walkthrough and then I get "Setup was unable to create a new system partition or locate an existing system partition.  See the Setup log files for more information." from the Windows installer.  What do I do?   Thanks.              

    just to add to the mix. . . i just got a new macbook retina.
    Originally used a USB flash drive. Hit the same barrier described here.
    Spent a few hours with drive unplugging / replugging silliness. No progress. Went back into OSX to attempt using an external DVD drive. There is no option for that in Bootcamp assistant now - must use USB.
    Grabbed a different USB stick and started again. This time I used the other USB port on the macbook (the one on the left). Everything worked fine this time!?
    You still have to go into "advanced options" and hit "format" when you get to the partition screen.
    Moral of the story: different stick, different port. Sounds random. If that doesn't work, try changing your socks and putting on a hat.
    Good luck!

Maybe you are looking for

  • HT1296 How do I transfer data from one ipad to another one?

    I have the orginal ipad and my husband bought me the retina one this weekend. I need to transfer the data on it to the new one. Also how do I transfer the ownershlip of one to another as we were going to give one of the older ones we have to my grand

  • Using iPod as a disk (and only a disk)

    I've got an iPod 4G, connected to Leopard. I want to use this as an ordinary external usb drive. I'm positive I've done this before (used to to beta test Leopard actually). Anyway, I'm having some trouble doing it again. In Disk Utility I've selected

  • Can't Find Photo Filesere

    I have a mac book pro with Iphoto 6.06 on it. I have about 4,000 photos that I have loaded to Iphoto. However, I cannot find the underlying photos in Finder. Also, interestingly, if I go to the hard drive there seems to be about 25 gigabytes that are

  • Cannot find role SAP_SDCCN_ALL in satellite system

    Hi,    I cannot find the role SAP_SDCCN_ALL in satellite system. The sattelite system is R3 4.7 PI 2003_1_470, PI_Basis 2003_1_620. Did anyone of you encounter the same problem?. Regards Anil

  • Sap workflow tutorial issue

    Hi, Looks like someone else has had the same issue recently (see Work flow in error when executed with a user decision.) but that question was marked as answered so am reposting my response here... Hi, I believe the orginal poster is following the wo