Problem in after create  trigger

hi all,
i tried to track the creation of all objects in scott user. so from one dba user
i wrote a After Create trigger for scott schema(schema level trigger) like this,
create trigger create_log after create on scott.schema
begin
insert into create_log_t values(login_user,sysdate,dictionary_obj_type,dictionary_obj_name);
end;
trigger has been successfully created.After that i tried to create some objects in scott schema,but i could not. it gives me this error,
SQL> create table dd(d number);
create table dd(d number)
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00984: column not allowed here
ORA-06512: at line 2
can anyone help me to come out from this problem.
thanks in advance!
kathir

What is LOGIN_USER? Did you mean USER?
Cheers, APC

Similar Messages

  • Use of "DBA_OBJECTS" in "AFTER CREATE" Trigger

    Hi,
    We would like to store some extra information about our objects we have in the database. To do so we tought of the idea of creating a 'documenting' table containing an object_id that references to the object_id from the view dba_views.
    Now we want to automatically create a new record in our documenting table when a new object is created, in the first stage this should only contain the object_id
    To accomplish this we are using an 'AFTER CREATE' trigger, but when this trigger fires and the code searches for the new object_id in dba_objects, it does not return any records and generates an error. Likely because when the trigger is executed, the view is not yet updated?
    create or replace
    TRIGGER TRG_TEST
    AFTER CREATE ON SCOTT.SCHEMA
    DECLARE
    tmp VARCHAR2(50);
    BEGIN
    dbms_output.put_line(ora_dict_obj_name);
    select object_id
    into tmp
    from dba_objects
    where object_name = ora_dict_obj_name;
    dbms_output.put_line(tmp);
    END;
    Error report:
    ORA-04088: Fout bij uitvoering van trigger 'SCOTT.TRG_TEST'.
    ORA-01403: Geen gegevens gevonden.
    ORA-06512: in regel 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    It's in dutch, so I'll have a go at translating:
    Error report:
    ORA-04088: Exception while executing trigger 'SCOTT.TRG_TEST'.
    ORA-01403: No data found
    ORA-06512: in rule 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    Does anyone have an idea of how I can accomplish what I'm trying to do here.. Or maybe something I'm doing wrong?
    Thanks in advance!
    Davy

    What is "ora_dict_obj_name" defined as?
    Another option might be to setup a DBMS_SCHEDULER job to run the following insert
    firstly though, create the following table ;
    create document_table as (select * from dba_objects where rownum < 1)and then setup a DBMS_SCHEDULER job to run the following:
    begin
      insert into document_table
      (select dbo.*
       from   dba_objects    dbo
             ,document_Table dtb
       where  dbo.Object_ID = dtb.Object_ID(+)
       and    dtb.Object_ID is null);
       commit;
       exception
        when others then
          rollback;
          -- log a message somewhere with the error, i.e. SQLERRM
    end;
    /Note, I specified all columns, but you'll probably specify explicitly which column you require, in which case the CREATE table would change as well.
    Then you won't have a need for any trigger, and can better manage when you want your documentation to be updated.
    Another option might be to use COMMENT, which can be used on tables, views, materialized views, but won't cover all objects
    to the extent you might want.
    SQL> desc emp2
    Name                                                                                                  
    EMPNO                                                                                                 
    JOB                                                                                                   
    START_DATE                                                                                            
    SAL                                                                                                   
    DEPT                                                                                                  
    END_DATE                                                                                              
    SQL> comment on column emp2.sal is 'Existing Salary of employee as paid at most recent month end';

  • Problems with After Report trigger Updating using User-defined functions

    Hi,
    I have a report which uses SQL to select data that uses a user-defined stored function in the WHERE clause.
    I use the same SQL in the After Report trigger with and UPDATE statement to flag all records selected as being run.
    Data is being selected by the report no problem, but the records are not being updated. In a test, If I remove the conditions using the user functions, the records update as expected. In Live conditions I must have these conditions in the script.
    I originally tried putting the UPDATE in a formual column, but that would not fire on records where that page was not paged through (or paged to end) in the Runtime Previewer.
    Can anyone advise?

    In case anyone is interested.
    The issue was that the stored functions have roles assigned for security.
    PL/SQL for After Report doesn't seem to recognise the roles having been assigned for the report, so the implicit cursor update/select I had wouldn't work.
    I changed the SELECT into an explicit CURSOR and introduced a FOR LOOP, keeping the UPDATE as an implicit statement.
    I know see this was more of a PL/SQL issues than a report one, but such is life. So if anyone feels the urge to move it to the PL/SQL forum, then feel free!!
    Have a problem free afternoon. :-)

  • Windows 7 Install Problems. After creating USB drive black screen!

    So when I use boot camp I create the thumb drive and it downloads the updated drivers and then I create the partition on my single partition.
    Once the partition is made boot camp reboots the computer and it goes to a black screen and I can see the thumb drive light loading for a second and then it sits at a black screen and does nothing.
    If I reboot again and hold alt it days "boot failure" and to under a bootable drive.
    If I create the partition myself and then use boot camp to create the thumb drive then manual boot holding the alt key it shows windows partition and then I boot into windows and it shows the logo for windows and then goes to a blank screen with a cursor and nothing happens.
    I am using the ISO of the original DVD.
    Any help would be greatly appreciated!

    You might want to visit the Boot Camp forum where the Boot Camp gurus hang out. https://discussions.apple.com/community/windows_software/boot_camp

  • After Update Trigger issue

    Hello,
    I am having a problem with after update trigger. I have created an after update trigger in Oracle that would call a procedure to run an Oracle report. The problem is that when the report is run, the table is not updated yet. So the table passes old values to the report. Is there any way I can take care of this issue? How do I make sure the table is updated before running the report? I tried delaying the report by using dbms_job package. I didn't have any success with that. Probably I am doing something wrong. This is the code I used
    dbms_job.submit( job => l_job, what => 'SendPDFReport(:new.query_id,serviceid,:new.site_id);', next_date => sysdate+3/24*60 );
    Thanks
    Oracle database User

    It is working. I used the same code,but I was using parameters inside the single quote, so it was taking the parameter value as :new.query_id instead of 12345.
    I made changes
    from
    dbms_job.submit( job => l_job, what => 'SendPDF(:new.query_id,serviceid,:new.site_id);', next_date => sysdate);
    to
    dbms_job.submit( job => l_job, what => 'SendPDF('||:new.query_id||','||serviceid||','||:new.site_id||');', next_date => sysdate);
    Thanks for all your help.

  • DSO activation problem after creating the secondary indexes

    Hi,
        I am facing the problem with DSO activation after creating the secondary indexes.
    •  Compared with Info Cubes there is no functionality available which allows dropping and recreating a secondary index before/after the data activation.
    As a workaround I can write a simple report which drops and creates the indexes on database level.
    By using a process chain, we can simply insert the drop index report before data activation and the create index report after the data activation process.
    Can any body help me step by step procedure or Material to write the programs for delete index and create index reports on DSO object?..
    Thanks in advance for your help.
    Thanks & Regards,
    Bala

    hi,
    in BI if you are using the dso for reporting then you can simply chk the settings of dso for SID generation.
    no need to create the indexes or delete it.
    if the dso is not used for report then no need to use indexes.
    Ramesh

  • Problem in PDF after creating from Indesign CS3 (transparancy)

    Hi all,
    Please give me a solution ASAP, its most urgent.
    We have used two color in one image, the color color is pantone.
    First we have selected the one pantone in image and in background another color. After creating PS using Prinergy and Distilling.
    I am not getting the result, the PDF which I have creating, the image contain only the main color not the background color, if I use the the "Advance - "Output Privew I am getting the result in PDF, what would be the problem, I have used "High Resolution" in Transparancy, still I am not getting the result.
    Please respond ASAP.
    Shaji

    Are you colours defined as spots.? If you do not need spot colours in your job, then change them to process in the swatches panel.
    Otherwise you will need to configure the RIP honour the overprints.

  • Network Problem After Creating Database

    Hi,
    We install Oracle 11g on Windows 2008 server. Everything is working fine till the installation of Oracle software. After creating the database when we restart server the network cable shows a unplug for 20 miniutes.
    If we disable all the Oracle service than everything goes fine.
    Please Suggest.
    Thanks and Regards
    Sarfaraz Zomberkar

    This is an interesting problem. Please provide a little more information.
    * When you state Oracle 11g, exactly which release version: 11.1.0.6, 11.1.0.7, 11.2.0.1, or 11.2.0.2 - did you install the 32 bit Database software or the 64 bit Database software?
    * Which options were selected during the installation, and did you tell the installer to create a database during the installation?
    * Exactly which Windows 2008 server version: R1 or R2 - and is the operating system 32 bit or 64 bit?
    * How much memory is in the Windows server?
    * How many network cables are connected between the server and a network switch(es) - you will probably need to look at the back of the server to determine this answer?
    * What are the exact names of the Oracle services that you had to shut down - most likely, the Startup Type of those services are set to "Automatic"
    * Have the appropriate network person take a look at the log of errors on the network switch that is connected to the server - there is a chance that the network switch sensed a problem, such as excessive transmission errors, and shut down the network port to prevent a broadcast storm or a similar problem.
    * Have the appropriate person check the Windows event logs. Do those logs identify the reason why the network port went down?
    Charles Hooper
    Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
    http://hoopercharles.wordpress.com/
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • I create trigger but not display massage after insert in oracle 10g

    I create trigger but not display massage after insert in oracle 10g
    **CREATE OR REPLACE TRIGGER TableName**
    **AFTER INSERT OR DELETE OR UPDATE ON test**
    **BEGIN**
    **if inserting then**
    **dbms_output.put('Message');**
    **end if;**
    **END;**

    What user interface are you using?
    If the tool doesn't support the SQL*Plus syntax (set serveroutput on), it probably has an option somewhere to enable DBMS Output. Not even knowing what tool you're using, it's impossible for us to guess where that option might be configured.
    As others have suggested, using DBMS Output to test code is less than ideal because you're dependent on the application you're using to display it to you and not every application can or will do that. If you want to use DBMS_Output, you may need to switch to a different GUI (SQL Developer or SQL*Plus are both free utilities from Oracle). Otherwise, you'd probably be better off having the trigger do something that you can subsequently query (i.e. write a row to a log table).
    Justin

  • Problem after creating a Photo Book

    After creating a 100 Pages Hardcover Book, I can't buy it, because Iphoto opens a window, saying that not all pages are filled with photos. verity I try, it goes back to one page, but this page is perfectly filled like all the others, no missing photos or empty frames at all.
    ried to change photos and layout, with no result. Cant buy this book.
    What can I do? I don't want to create a whole new Book

    You may have still a placeholder photo as the backdrop for your pictures.  Check the page layout, if it is using an image background. Then you need to change the background or add background picture:
    If you used the Golden Gate Bridge background, drag a photo to the background.

  • Problem in writing 'After Report trigger'

    Hi All,
    Iam trying to insert values into database table after running the report.
    but the values are not inserted into the table.
    Here is the code in 'After Report trigger'
    function AfterReport return boolean is
    begin
    insert into reports_log values('poorders',user,sysdate,'Y');
    commit;
    return (TRUE);
    end;
    Thanks in Advance

    Tested one of my reports and found:
    the After Report Trigger does not fire (to insert a table) in Report Builder (6i) but it fires when it's invoked from Apex.
    It you run your report in Froms or Apex or...., try over there.

  • After Update Trigger executes twice when single row is uptd thro proc

    We have the below trigger in our db. When a single record is updated using a procedure the trigger is executed twice and it inserts two records in other table.
    But when i issue an update statement using any sql client tool it is executing only once and inserts only one record in other table.
    Can any one please help me to find the reason?
    Trigger:*
    create or replace TRIGGER CX_HEADER_ESCL_T1 AFTER UPDATE OF STATUS ON CX_HEADER
    FOR EACH ROW
    DECLARE
    "b1-CTRIYJ" boolean := FALSE;
    BEGIN
    IF UPDATING('STATUS') AND(:NEW.status = 'SUCCESS') THEN
    "b1-CTRIYJ" := TRUE;
    END IF;
    IF "b1-CTRIYJ" = TRUE THEN
    INSERT
    INTO siebel.s_escl_req(req_id, created, bt_row_id, rule_id, tbl_name, created_by, group_id)
    VALUES('11111111', CURRENT_DATE, :NEW.row_id, '1-CTRIYJ', 'CX_HEADER', :NEW.last_upd_by, '1-2CU3');
    "b1-CTRIYJ" := FALSE;
    END IF;
    END;
    Procedure:
    CREATE OR REPLACE
    PROCEDURE CLOSE_BATCH
    (ChildRecordCount IN NUMBER, HeaderId IN VARCHAR2, CompletionStatus OUT VARCHAR2) AS
    CafeChildCount NUMBER;
    BEGIN
    select count(*) into CafeChildCount from SIEBEL.CX_CHILD where HEADER_ID=HeaderId;
    IF ChildRecordCount = CafeChildCount THEN
    update SIEBEL.CX_HEADER set STATUS ='SUCCESS', MODIFICATION_NUM = MODIFICATION_NUM+1 where HEADER_ID=HeaderId;
    CompletionStatus := 'SUCCESS';
    ELSE
    update SIEBEL.CX_CHILD set STATUS='FAILED' where HEADER_ID=HeaderId;
    update SIEBEL.CX_HEADER set STATUS='FAILED' where HEADER_ID=HeaderId;
    CompletionStatus := 'FAILED';
    END IF;
    commit;
    /*CompletionStatus := 'SUCCESS';*/
    EXCEPTION
    WHEN OTHERS THEN
    CompletionStatus := SQLCODE;
    rollback;
    END;

    Your problem seems not be related to the trigger restart issue I have already mentioned because you are using a AFTER UPDATE trigger and not a BEFORE UPDATE trigger:
    >
    BEFORE Triggers Fired Multiple Times
    If an UPDATE or DELETE statement detects a conflict with a concurrent UPDATE, then Oracle Database performs a transparent ROLLBACK to SAVEPOINT and restarts the update. This can occur many times before the statement completes successfully. Each time the statement is restarted, the BEFORE statement trigger is fired again. The rollback to savepoint does not undo changes to any package variables referenced in the trigger. Your package should include a counter variable to detect this situation.
    >
    If you are sure that you update a single row and that your trigger fires twice and if you can easiily reproduce the issue, I recommend that you contact Oracle Support and create a Service Request for your issue that could be an Oracle bug.

  • DELETE  in After report trigger

    Please help us resolve the following problem in a 6i report.
    The report had an After report trigger to delete the records from the same table used in the driver query. The report is launched thru a url to create a pdf file. The PDF is generated correctly for some users but for many others the PDF is generated with no data. When the delete statement is commented out, everybody get the PDF with data. All users have the same Acrobat Reader and IE version.
    Any idea why this is happening ?
    Appreciate your help
    Thanks

    Navneeth, Dmytro
    Thanks for your replies
    The report is for generating some sort of certificates ( in pdf format) from a staging table. If the certificate is issued, the record is to be deleted. So the report is different in each run.
    The real issue is the report behavior is not consistent from one machine to another. For the same set of data in the staging table for PC1 the PDF is generated and processed records are deleted. But in PC2 records are processed, records are deleted but the PDF has no data.
    We tried to use a global temp. table, didn't help either.
    In the before report trigger
    insert into gt_table select * from staging_table
    commit
    Report query modified to get data from gt_table
    After report trigger deletes records from staging_table
    The PDF data is seen in PC1 but not in PC2
    When the after report trigger is commented out, PDF launched in both machines contain data.
    There are many reports which generates PDF file without a delete trigger and they all work well.
    Is this problem happening because the records are getting deleted before pdf is launched? Or any type of browser (IE) or Acrobat reader settings required ?
    The deletes can be handled in the front end application after launching the report url but preferred to keep it in the reports to avoid deleting records in case there's a problem with report server and records are not processed.
    Thanks you for your help

  • After Insert Trigger with DML on the subject table?

    I am trying to set up e-mail notifications, so I created a procedure, which accepts the argument of an id. In the procedure, it queries the table and sends out mail based on the result set. (in the trigger, I pass in the value of :NEW.id). The procedure then queries the table for that row id.
    First, for the after update I was getting the error:
    ORA-04091: table is mutating, trigger/function may not see it ORA-06512
    So, I was advised to do in the declare block: pragma autonomous_transaction; I did that, and that solved the problem there. SO I did the same in the after insert trigger, but then I get the error:
    ORA-00060: deadlock detected while waiting for resource ORA-06512
    I asked our DBA and he said you are not able to query the table of which the trigger is a subject of. I thought it would be possible since its After insert or update?
    Can anyone offer any suggestions ? :)
    Thanks,
    Trent

    Any reason why it would work in an after update trigger then?
    So, I was advised to do in the declare block: pragma autonomous_transaction; I did that, and that solved the problem therePRAGMA AUTONOMOUS_TRANSACTION "bends" the restriction against SQL against base table.
    It is the equivalent to tap dancing across a mine field.
    You might get the desired results most of the time or you might get a tasty surprise when you least expect it.
    What happens to your application in the future, if/when the UPDATE has a ROLLBACK issued & PRAGMA AUTONOMOUS_TRANSACTION has successfully completed?
    Inquiring minds would like to know the answer.

  • How can I access the same table within AFTER UPDATE trigger?  mutating

    I'm trying to have processing done within a before or after update trigger.
    reduced what I want to do down to a select within the trigger.
    create or replace TRIGGER "AU_TABLE_A"
    after update on "TABLE_A"
    for each row
    declare
    l_res_status NUMBER:=0;
    l_count NUMBER:=0;
    begin
    SELECT COUNT(*) INTO l_count
    FROM TABLE_A
    WHERE ID = :NEW.ID AND STATUS_ID = 9;
    end;
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1,
         ORA-04091: table TABLE_A is mutating, trigger/function may not see it
         ORA-06512: at "BHRS.BU_MR_RES_APPR", line 13
         ORA-04088: error during execution of trigger 'BHRS.BU_MR_RES_APPR',
         update TABLE_A set "ID" = :b1, "STATUS_ID" = :b2, "COMMENTS" = :b3
         where "ID" = :p_pk_col
    IS THERE A WAY AROUND IT?
    Thank you, Bill

    The very common approach to workaround mutating table problem is passing the table state through the package variables. I.e. - you create a package with one global variable ( say l_count). Then you need
    1) a trigger before update for statement - here you counts your rows and set the package variable accordingly.
    2) a trigger after update for each row - here you read the rowcount from a package variable and do your actual work
    3) a trigger after update for statement - here you reset your package variable.
    This approach uses the fact, that mutating table problem occurs only with triggers for each row and the order of execution of different trigger types.
    However, counting records in every update statement (whereas not so worse although as doing this for each row within an update) may consume a lot of resources, so, possibly , you can rethink your business needs/approach.
    Best regards
    Maxim

Maybe you are looking for