Trigger Compilation Error

Good day all. I have been trying to get this trigger to work for the past three hours but to no avail. I would greatly appreciate some assistance with the two errors generated from the trigger compilation please.
the code is:
CREATE TABLE "User"
(     "userId" NUMBER NOT NULL ENABLE,
     "userName" VARCHAR2(20) NOT NULL ENABLE,
     "password" VARCHAR2(20) NOT NULL ENABLE,
     "fName" VARCHAR2(30) NOT NULL ENABLE,
     "lName" VARCHAR2(30) NOT NULL ENABLE,
     "dob" Date NOT NULL ENABLE,
     "dateCreated" DATE NOT NULL ENABLE,
     "userType" VARCHAR2(20) NOT NULL ENABLE,
     CONSTRAINT "USER_PK" PRIMARY KEY ("userId") ENABLE,
     CONSTRAINT "uSER_FK1" FOREIGN KEY ("userType")
          REFERENCES "UserTypeLookUp" ("userType") ENABLE)
CREATE SEQUENCE "User_SEQ" MINVALUE 1 MAXVALUE 9999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE
CREATE OR REPLACE TRIGGER "BI_User"
before insert on "User"
for each row
begin
select "User_SEQ".nextval into :NEW.userId from dual
end;
ALTER TRIGGER "BI_User" ENABLE;
the error when i compile the trigger is;
Line Position Text
2 35 PLS-00049: bad bind variable 'NEW.USERID'
4 1 PLS-00103: Encountered the symbol "/" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with
When i try to do and insert on the table i get this error;
ORA-04098: trigger 'CSR.BI_User' is invalid and failed re-validation
     Error     Unable to process row of table User.
OK

First close your SELECT with ";"

Similar Messages

  • Trigger compile errors

    Need some direction. I have a user table defined that I would like to track any change in the Active column. when this occurs, I want a trigger to fire on after update to the BPF.Users table. The trigger will insert into the user_audit_log table. There is a sequence defined for that table as well. Here is the trigger:
    CREATE OR REPLACE TRIGGER user_update
    AFTER UPDATE OF active ON BPF.users
    FOR EACH ROW
    when (new.Name <> NULL)
    DECLARE
         currentuser CHAR(6);
         timenow DATE;
    BEGIN
    SELECT USER INTO currentuser from DUAL;
    timenow := SYSDATE;
    INSERT INTO BPF.user_audit_log
    VALUES (user_audit_seq.NEXTVAL, currentuser,:New.Name, timenow, 'Active Status Change');
    END;
    The user_audit_log table is define:
    CREATE TABLE BPF.user_audit_log
    (uaID NUMBER(38) PRIMARY KEY,
    uacuruser VARCHAR2(20),
    uachguser VARCHAR2(20),
    uadate DATE,
    uamsg VARCHAR2(1000)
    Now for the weird part, when I create the trigger, it has compile errors but does not say what they are. I can create the trigger without the insert statement and it compiles fine. I have no idea what is wrong with it. Can anyone give me some direction? Thanks so much!

    Thank you for your help. It has to do with the NVARCHAR2 definition. The character values have to be in this format, n'value', in order for it to insert. Now I just have to figure out how to do that. But here is the table definition.
    SQL> describe BPF.Users
    Name Null? Type
    USER_ID NOT NULL NUMBER(10)
    NAME NOT NULL NVARCHAR2(100)
    FULL_NAME NVARCHAR2(100)
    EMAIL NVARCHAR2(400)
    ACTIVE NOT NULL NUMBER(1)
    PREFERENCES NVARCHAR2(4000)
    DEFAULT_BU_ID NOT NULL NUMBER(10)
    WF_USER_ID NUMBER(10)
    DEFAULT_SECURITY_PROFILE_ID NOT NULL NUMBER(10)
    SYSTEM NOT NULL NUMBER(1)
    REPORTSTO_USER_ID NUMBER(10)
    DEFAULT_FA_ID NOT NULL NUMBER(10)
    USER_ATTR_1 NVARCHAR2(1000)
    USER_ATTR_2 NVARCHAR2(1000)
    USER_ATTR_3 NVARCHAR2(1000)
    USER_ATTR_4 NVARCHAR2(1000)
    USER_ATTR_5 NVARCHAR2(1000)
    USER_ATTR_6 NVARCHAR2(1000)
    USER_ATTR_7 NVARCHAR2(1000)
    USER_ATTR_8 NVARCHAR2(1000)
    USER_ATTR_9 NVARCHAR2(1000)
    USER_ATTR_10 NVARCHAR2(1000)
    ORIGINAL_EMAIL NVARCHAR2(200)
    DEFAULT_PASSWORD NVARCHAR2(40)

  • Capture sql_test ||Trigger compilation errors.

    Thanks Liu Fan.
    I use the sql statement you gave me,it works well on sqlplus, but while put into trigger and have warning message:
    Warning: Trigger created with compilation errors.
    following is code snippet:
    create or replace trigger test_trg
    after UPDATE or DELETE or INSERT on emp
    declare
    this_sql_text varchar2(800);
    CURSOR c1 is
    select b.sql_text from v$session a, v$sqltext_with_newlines b where a.sql_address = b.address
    and a.audsid = (select userenv('SESSIONID') from dual)
    and a.sql_hash_value =b.hash_value
    order by b.piece;
    rec c1%ROWTYPE;
    begin
    open c1;
    loop
    fetch c1 into rec;
    exit when c1%NOTFOUND;
    this_sql_text := this_sql_text &#0124; &#0124; rec.sql_text;
    end loop;
    close c1;
    insert into change_audit (changeDate, mysql_text) values (sysdate,this_sql_text);
    end;
    Does Anyone have a clue why this is happening? Any help will be greatly appreciated.
    null

    I create the same trigger as yours to test. But it failed in compiling because the v$session view cannot be resolved. Then try to wrap the sql statement in dynamic sql. Then compilation is successful and cannot resolve the view during execution.
    My suggestion is that if you can do a test in your system schema to see if the view can be resolved. Following the the test script:
    (You can call this proc in your trigger.)
    PROCEDURE TEST_TRACESQL AS
    PRAGMA AUTONOMOUS_TRANSACTION;
    TYPE TestType IS REF CURSOR;
    test_cv TestType;
    sql_stmt VARCHAR2(200);
    sql_text VARCHAR2(2000);
    tmp_text VARCHAR2(200);
    BEGIN
    sql_stmt := 'select b.sql_text ' &#0124; &#0124;
    'from sys_session a, sys_sqltext b ' &#0124; &#0124;
    'where a.sql_address = b.address ' &#0124; &#0124;
    'and a.audsid = (select userenv(''SESSIONID'') from dual) ' &#0124; &#0124;
    'and a.sql_hash_value = b.hash_value';
    DBMS_OUTPUT.PUT_LINE(SQL_STMT);
    OPEN test_cv FOR sql_stmt;
    LOOP
    FETCH test_cv INTO tmp_text;
    EXIT WHEN test_cv%NOTFOUND;
    sql_text := sql_text &#0124; &#0124; tmp_text;
    END LOOP;
    CLOSE test_cv;
    INSERT INTO test_sql (sqltext) values(sql_text);
    COMMIT;
    END;
    null

  • Trigger Compilation Errors after Full Import with Datapump

    Hello All,
    We did a full import with Oracle Datapump, and encountered some errors related to triggers:
    ORA-39082: Object type TRIGGER:"CONVERT3"."CUBCNVT_AUDIT_RESET" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CUBCNVT_AUDIT_RESET" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CUBCNVT_AUDIT" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CUBCNVT_AUDIT" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CURCNVT_AUDIT_RESET" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CURCNVT_AUDIT_RESET" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CURCNVT_AUDIT" created with compilation warnings
    ORA-39082: Object type TRIGGER:"CONVERT3"."CURCNVT_AUDIT" created with compilation warningsWe are wondering if there is some bug with the datapump on oracle 10.2.0.2. What caused such errors and how to resolve this trigger issue?
    Thanks!

    Hello,
    Show errors / at the end of the trigger and see if any of the dependent objects is missing resulting in error at compilation.
    Also you can try manually fixing the issue
    CREATE OR REPLACE TRIGGER table1_trg
       AFTER INSERT
       ON TABLE1    REFERENCING NEW AS new OLD AS old
       FOR EACH ROW
    DECLARE
       tmpvar   NUMBER;
    BEGIN
    Trigger code
    EXCEPTION
       WHEN OTHERS
       THEN
          -- Consider logging the error and then re-raise
          RAISE;
    END table1_trg;
    SHOW ERRORS;Regards

  • Trigger compilation errors in 11g

    Using 11g Win 2008 Server 64 bit. I'm trying to create a trigger that willl automatically calculate the total cost of an item from the quantity required multiplied by unit cost. The trigger is used to overide user input if the toal cost of an item is left blank. I've tried variations to the following syntax and would appreciate advice on the right syntax to use. Many thanks, J
    CREATE OR REPLACE TRIGGER prodreq_qtycalc
    AFTER INSERT ON PRODUCT_REQUIREMENTS
    FOR EACH ROW
    BEGIN
    IF :OLD.TOTALCOST IS NULL
    THEN UPDATE PRODUCT_REQUIREMENTS
    SET :NEW.TOTALCOST = (UNITCOST * QTYNEEDED);
    END;

    Jay wrote:
    Using 11g Win 2008 Server 64 bit. I'm trying to create a trigger that willl automatically calculate the total cost of an item from the quantity required multiplied by unit cost. The trigger is used to overide user input if the toal cost of an item is left blank. I've tried variations to the following syntax and would appreciate advice on the right syntax to use. Many thanks, J
    CREATE OR REPLACE TRIGGER prodreq_qtycalc
    AFTER INSERT ON PRODUCT_REQUIREMENTS
    FOR EACH ROW
    BEGIN
    IF :OLD.TOTALCOST IS NULL
    THEN UPDATE PRODUCT_REQUIREMENTS
    SET :NEW.TOTALCOST = (UNITCOST * QTYNEEDED);
    END;As a general rule it is a BAD design to store computed value in row.
    what if either UNITCOST or QTYNEEDED is NULL?
      1  CREATE OR replace TRIGGER prodreq_qtycalc
      2    before INSERT ON product_requirements
      3    FOR each ROW
      4    WHEN (old.totalcost IS NULL)
      5  DECLARE
      6  BEGIN
      7      :NEW.totalcost := ( :old.unitcost * :old.qtyneeded );
      8* END prodreq_qtycalc;
    SQL> /
    Trigger created.

  • Db link in trigger causes compilation error

    Using Forms 10.1.2.0.2
    Post-Query trigger
    BEGIN
    SELECT item_desc
    INTO :block1.item_desc
    FROM items@database100
    WHERE item_code = :block1.item_code;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    item_code := 'No description for this item';
    END;
    Compilation error
    Error 201: Identifier 'items@database100' must be declared.
    The select statement works in Toad and Sqlplus, but giving me compilation errors in Forms 10g.
    So is this a bug? If yes, is there a patch?
    Can somebody please post a link to a metalink where this problem is discussed/solved?
    Thanks in advance.

    Well, yeah, that had been considered as a work-around.
    However, at this point, the decision is still to use the db link, and we are still trying to figure out how to make it work.
    Edited by: vanilla.villain on May 21, 2009 11:20 AM

  • Compilation error in  AFTER INSERT TRIGGER

    I am getting a compilation error with this code. How can I make this work?
    CREATE OR REPLACE TRIGGER LIMS.u_tu_background_priority
        AFTER INSERT
        ON BACKGROUND
         FOR EACH ROW
    BEGIN
        IF instr(:new.parameter,'S') = 1 THEN
            UPDATE lims.background
            SET priority = 3
              WHERE background_id = :new.background_id
        END IF ;       
    END ;
    /

    TABLE background
    Name                                      Null?    Type                       
    BACKGROUND_ID                             NOT NULL NUMBER(16)                 
    PRIORITY                                           NUMBER                     
    SESSION_ID                                         NUMBER(16)                 
    SCHEDULE_ID                                        NUMBER(16)                 
    WORKSTATION_ID                                     NUMBER(16)                 
    WORKSTATION_GROUP_ID                               NUMBER(16)                 
    PARAMETER                                          VARCHAR2(4000)             
    ACTIVE                                             CHAR(1)                    
    BACKGROUND_TASK_TYPE_ID                            NUMBER(16)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Pls906 compiler error for on_logon trigger

    Hello,
    I wrote a PL/SQL program for on_logon trigger. But it has compiler error(no message file, ora-06540 error and pls906 error). The program is as follow:
    DECLARE un VARCHAR2(80);
    pw VARCHAR2(80);
    cn VARCHAR2(80);
    BEGIN
    /* ** Bring up the logon screen */
    Logon_Screen;
    /*** Get the username, password and connect string. */
    un=Get_application_property(username);
    pw=Get_application_property(password);
    cn=get_application_property(connect_string);
    /*** Log the user onto the database */
    IF cn IS NOT NULL THEN
    LOGON(un,pw&#0124; &#0124;'@'&#0124; &#0124;cn);
    ELSE
    LOGON(un,pw);
    END IF;
    END;
    Any help is appreciated
    null

    I tried following
    ================================================================
    SQL> create or replace trigger after_logon_audit
    2 AFTER LOGON ON DATABASE
    3 WHEN (USER not in ('SYS','SYSTEM')
    4 BEGIN
    5 INSERT INTO LOGON_AUDIT
    6 (log_time,log_user,LOG_IPADDR,LOG_TERMINAL,LOG_MACHINE,LOG_SESSIONID,LOG_OSUSER)
    7 ( select SYSDATE, USER, SYS_CONTEXT('USERENV','IP_ADDRESS'), SYS_CONTEXT('USERENV','TERMINAL'),
    8 a.machine, SYS_CONTEXT('USERENV','SESSIONID'), a.OSUSER
    9 from V$SESSION a, dual
    10 where
    11 SYS_CONTEXT('USERENV','SESSIONID') = a.AUDSID
    12 and SYS_CONTEXT('USERENV','SESSION_USERID') = USER#);
    13 COMMIT;
    14 RAISE_APPLICATION_ERROR(-20002,'The DB is unavailable');
    15 END;
    16
    17 /
    ===============================================================
    but got the following error message.
    ========================
    AFTER LOGON ON DATABASE
    ERROR at line 2:
    ORA-04072: invalid trigger type
    ========================
    Problem still persists. :(

  • Compilation error while generating the form in linux

    Hello everyone,
    I am using Oracle Designer ver10.1.2.4 in windows to generate the forms with standard object library ofgwebol.olb and template form ofgwebt.fmb. form (with both .fmb and .fmx files) are generated without errors. Also when I open the forms in separately they compiles without errors. But when I copy the same .fmb file into linux enviroment and compile it using frmcmp.sh userid=user/password@database module_type=form compile_all=yes module=form_name it gives following errors.
    $> frmcmp.sh userid=odin/odin@ontw10g module_ty
    pe=form compile_all=yes module=LOGIN_SCHERM
    Forms 10.1 (Form Compiler) Version 10.1.2.0.2 (Production)
    Forms 10.1 (Form Compiler): Release - Production
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.0 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE 10.1.0.4.0 Production
    FRM-18108: Failed to load the following objects.
    Source Module:ofgwebol.olb
    Source Object: CGSO$CHAR_DO
    Source Module:ofgwebol.olb
    Source Object: CGSO$CHAR_DO
    Source Module:ofgwebol.olb
    Source Object: CGSO$BLOCK
    Source Module:ofgwebol.olb
    Source Object: CGSO$CANVAS
    Source Module:ofgwebol.olb
    Source Object: CGSO$WINDOW
    Compiling function CGTE$CHECK_CONSTRAINT_VIO...
    No compilation errors.
    Compiling procedure CGTE$INLOGGEN_ERRORS...
    No compilation errors.
    L/SQL ERROR 0 at line 17, column 3
    Statement ignored
    PL/SQL ERROR 201 at line 36, column 3
    identifier 'CGNV$.NAV_CLOSE_FORMS' must be declared
    PL/SQL ERROR 0 at line 36, column 3
    Statement ignored
    PL/SQL ERROR 201 at line 37, column 3
    identifier 'CGNV$.NAV_OPENING_WND' must be declared
    PL/SQL ERROR 0 at line 37, column 3
    Statement ignored
    Compiling KEY-HELP trigger on form...
    No compilation errors.
    Compiling WHEN-WINDOW-ACTIVATED trigger on form...
    Compilation error on WHEN-WINDOW-ACTIVATED trigger on form:
    PL/SQL ERROR 201 at line 6, column 8
    identifier 'CGNV$GET_ITEM_WINDOW' must be declared
    PL/SQL ERROR 0 at line 4, column 3
    Statement ignored
    Compiling POST-TEXT-ITEM trigger on form...
    Compilation error on POST-TEXT-ITEM trigger on form:
    PL/SQL ERROR 201 at line 4, column 3
    identifier 'CGNV$.STORE_WND_ITEM' must be declared
    PL/SQL ERROR 0 at line 4, column 3
    Statement ignored
    Compiling WHEN-WINDOW-CLOSED trigger on form...
    Compilation error on WHEN-WINDOW-CLOSED trigger on form:
    PL/SQL ERROR 201 at line 5, column 3
    identifier 'CGNV$.TERMINATE_WINDOW' must be declared
    PL/SQL ERROR 0 at line 5, column 3
    Statement ignored
    Compiling WHEN-FORM-NAVIGATE trigger on form...
    Compilation error on WHEN-FORM-NAVIGATE trigger on form:
    PL/SQL ERROR 201 at line 3, column 3
    identifier 'CGNV$.REMOVE_CHILD_FORM' must be declared
    PL/SQL ERROR 0 at line 3, column 3
    Statement ignored
    Compiling KEY-EXIT trigger on form...
    Compilation error on KEY-EXIT trigger on form:
    PL/SQL ERROR 201 at line 5, column 3
    identifier 'CGNV$.NAV_ENTER_QUERY' must be declared
    PL/SQL ERROR 0 at line 5, column 3
    Statement ignored
    PL/SQL ERROR 201 at line 9, column 5
    identifier 'CGNV$.CLOSE_ALL_WINDOWS' must be declared
    PL/SQL ERROR 0 at line 9, column 5
    Statement ignored
    Compiling KEY-CLRFRM trigger on form...
    No compilation errors.
    Compiling ON-ERROR trigger on INLOGGEN data block...
    No compilation errors.
    Compiling KEY-PREV-ITEM trigger on AGB_ID item in INLOGGEN data block...
    Compilation error on KEY-PREV-ITEM trigger on AGB_ID item in INLOGGEN data block
    PL/SQL ERROR 201 at line 4, column 3
    identifier 'CGNV$GO_PREV_ITEM' must be declared
    PL/SQL ERROR 0 at line 4, column 3
    Statement ignored
    Compiling KEY-NEXT-ITEM trigger on AGB_NAAM item in INLOGGEN data block...
    Compilation error on KEY-NEXT-ITEM trigger on AGB_NAAM item in INLOGGEN data blo
    ck:
    PL/SQL ERROR 201 at line 4, column 3
    identifier 'CGNV$GO_NEXT_ITEM' must be declared
    PL/SQL ERROR 0 at line 4, column 3
    Statement ignored
    Compilation errors have occurred.
    Form not created
    I think some standard library are missing in Linux environment. But I do not know the name of them and neither I can find. Please suggest the what need to be done to resolve the problem. The reason I am compiling the form in Linux is that I can run the form in windows because of corrupted installation of OC4j.
    Thanking you all much in advance.
    Edited by: Deepank on Dec 2, 2008 1:49 AM

    Deepank-
    When generating forms from Designer, Designer attaches libraries - like ofgmes.pll, ofgnavl.pll, etc. You will need to copy these libraries to the same directory where your forms reside on your Linux box. To find out what libraries ate attached to your form, open it on your windows PC after generating it from Designer and you will see the attached libraries. Also, watch out for the case-sensitivity of Linux. If you have the Designer libraries on your linux box and you still get errors, try changing the case of the names of the libraries.
    Hope this helps,
    Dan

  • "success with compilation error" ?

    Hopefully someone can shed light on this. Here is the sample code...
    SQL> create or replace procedure pr_TEST
    2 as
    3 begin
    4 execute immediate 'create or replace trigger tr_test after insert or update or delete on test
    for each row declare v_row test%rowtype; v_col1 varchar(32); v_col2 varchar(32); v_work varchar(32)
    ; begin insert into test values (v_col1, v_col2) ;end; /';
    5
    6 end;
    7 /
    Procedure created.
    SQL> exec pr_test;
    ERROR:
    ORA-24344: success with compilation error
    ORA-06512: at "ROOT.PR_TEST", line 4
    ORA-06512: at line 1
    Have you ever heard of an ORA-24344 ? Any suggestions on what to correct ?
    thx in advance,
    RP.

    You don't want the slash at the end of the string:
    sql>create or replace procedure pr_test
      2  as
      3  begin
      4   execute immediate 'create or replace trigger tr_test after insert or update or delete on test
      5  for each row declare v_row test%rowtype; v_col1 varchar(32); v_col2 varchar(32); v_work varchar
    (32);
      6   begin insert into test values (v_col1, v_col2) ;end;';  -- no slash here at end
      7  end;
      8  /
    Procedure created.

  • ORA-24344: Success with compilation error.

    Hi, i got the following error notification mail when the DB job [runs only once in a day at 1 AM] tries to execute the following procedure.
    The mail reads like this ----
    "Condition Raised in: toll_partitions.recompile_invalid_objects
    Short Desc: ORA-24344
    Long Desc: ORA-24344: Success with compilation error.
    Cause: Trigger creation did not successfully complete.
    Solution: Check trigger status for all triggers created in this schema and find out which error caused the failure by querying the user_errors table for the named trigger and Trigger type.
    --- end of mail ----
    === This is the procedure =====
    PROCEDURE recompile_invalid_objects IS
    -- Declare variables
    v_ins_str VARCHAR2(2000);
    cursor_handle NUMBER;
    execute_feedback NUMBER;
    v_unix_str VARCHAR2(200);
         v_object_cnt NUMBER := 0;
         -- Declare cursor objects
         CURSOR curs_obj IS
    SELECT decode( OBJECT_TYPE, 'PACKAGE BODY',
    'ALTER PACKAGE ' || OWNER||'.'||OBJECT_NAME || ' COMPILE BODY',
    'ALTER ' || OBJECT_TYPE || ' ' || OWNER||'.'||OBJECT_NAME || ' COMPILE' )
                   "COMP_OBJECT"
    FROM dba_objects
    WHERE STATUS = 'INVALID'
    AND OBJECT_TYPE IN ( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE',
              'TRIGGER', 'VIEW' )
    AND OWNER = USER
              AND OBJECT_NAME NOT LIKE 'TOAD_PROFILER'
    ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
    BEGIN
         -- Set Package/Procedure Name for email notification.
         vFacility := cProcName || '.recompile_invalid_objects';
    -- Select invalid object count
    BEGIN
         SELECT count(*)
              INTO v_object_cnt
              FROM dba_objects
    WHERE STATUS = 'INVALID'
    AND OBJECT_TYPE IN ( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE',
              'TRIGGER', 'VIEW' )
    AND OWNER = USER
                   AND OBJECT_NAME NOT LIKE 'TOAD_PROFILER'
    ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
              -- Recompile invalid objects
              IF v_object_cnt > 0 THEN
              FOR i in curs_obj
                   LOOP
                   v_ins_str := i.COMP_OBJECT;
                        cursor_handle := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(cursor_handle,
         v_ins_str,
                   DBMS_SQL.V7);
    execute_feedback := DBMS_SQL.EXECUTE(cursor_handle);          
    DBMS_SQL.CLOSE_CURSOR(cursor_handle);
    COMMIT;
                   END LOOP;
              END IF;
    END;
    EXCEPTION
         WHEN OTHERS THEN
         -- Log error condition and generate email notification if needed.
    toll_handle.error_condition(vFacility, toll_handle.get_ora_desc(sqlerrm),vErrorID);
         END recompile_invalid_objects;
    ==== end of procedure ====
    I got '0' count when I ran the invalid object count to see the invalid objects. I ran the following code ..and it gave me 0 value.
    SELECT count(*)
              FROM dba_objects
    WHERE STATUS = 'INVALID'
    AND OBJECT_TYPE IN ( 'PACKAGE BODY', 'PACKAGE', 'FUNCTION', 'PROCEDURE',
              'TRIGGER', 'VIEW' )
    AND OWNER = USER
                   AND OBJECT_NAME NOT LIKE 'TOAD_PROFILER'
    ORDER BY OWNER, OBJECT_TYPE, OBJECT_NAME;
    --- end of query ---
    The count 0 means, there are no invalid objects. But it throws daily the same error notification mail at 1 AM[the time job runs]. I compiled the procedure and it reports no errors. I checked the status of the triggers and all are valid and enabled. Please suggest me. Any help in this regard will be of great help to me. Thanks in advance...

    Just some hints. I'm not sure if they help solving your problem.
    1) Don't COMMIT inside a cursor.
    2) Instead of DBMS_SQL you could use DBMS_DDL.ALTER_COMPILE, also see here: http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_ddl2.htm#1000604
    3) Check if there are other jobs running during the recompile. Maybe you run into some conflicts.
    4) Output the statement that creates the error. It looks like you could try to put this into your exception handler: toll_handle.error_condition(vFacility, v_ins_str,vErrorID);

  • Trigger compile with after migrated from 8i to 10g

    Hi All,
    We try to migrate a 8i database to 10g by using the exp and imp. All tables and data are already migrated by imp. During the imp, there are errors said the trigger compile with errors.
    When login to the em to check, I found these 2 errors.
    Line # = 2 Column # = 1 Error Text = PL/SQL: SQL Statement ignored
    Line # = 2 Column # = 60 Error Text = PL/SQL: ORA-00942: table or view does not exist
    My trigger is a very simple one:
    BEGIN
    Select TB_COUNTER_SEQ.NEXTVAL INTO :NEW.INCREMENT_NUM FROM DUAL;
    END;
    And I'm sure the "TB_COUNER_SEQ" is there.
    Do I need to change anything on the trigger when migrating from 8i?
    In fact, besides this trigger, all other trigger imp to this schema are having the same error. The schema in the 10g is a newly created one, is there any special right I need to create grant to this new user?
    Thanks a lot.
    Mike

    Hi, Mike,
    user3211655 wrote:
    Hi All,
    We try to migrate a 8i database to 10g by using the exp and imp. All tables and data are already migrated by imp. During the imp, there are errors said the trigger compile with errors.
    When login to the em to check, I found these 2 errors.
    Line # = 2 Column # = 1 Error Text = PL/SQL: SQL Statement ignored
    Line # = 2 Column # = 60 Error Text = PL/SQL: ORA-00942: table or view does not exist
    My trigger is a very simple one:
    BEGIN
    Select TB_COUNTER_SEQ.NEXTVAL INTO :NEW.INCREMENT_NUM FROM DUAL;
    END;
    And I'm sure the "TB_COUNER_SEQ" is there.
    Do I need to change anything on the trigger when migrating from 8i?
    In fact, besides this trigger, all other trigger imp to this schema are having the same error. The schema in the 10g is a newly created one, is there any special right I need to create grant to this new user?Grant the necessary privileges on the tables (and any other objects used, like sequences) directly to the owner of the triggers. Privileges granted to a role don't count in AUTHID OWNER stored procedures; the privileges have to be granted to the owner of the stored procedure (or to PUBLIC).
    It the error is occurring at position 60, then it looks like you don't have privileges on dual. Login as SYS and
    GRANT SELECT ON dual TO PUBLIC;You may need synonyms (perhaps public synonyms) for the objects, too.

  • "ORA-24344: success with compilation error" in beginDDL

    Hello,
    I'm facing a really strange problem. When i try to use dbms_wm.beginDDL in one of my versioned tables, i get the error:
    ORA-24344: success with compilation error
    ORA-06512: "WMSYS.LT", line 12178
    ORA-06512: line 2
    I just get the error if i run the procedure from SQLPlus.
    Using PLSQL Developer, for example, I get a normal execution but the LTS table it's not created and the state of the table stays 'VERSIONED'.
    I used this procedure other times in the past and there were no problems.
    Trying to identify the cause of the error, i've tried:
    (1) - run dbms_wm.beginDDL for all the other tables - No Problem
    (2) - verifiy if there were invalid objects - All valid
    (3) - verify the error tables for more details (user_, dba_, user_wm_vt_) - No entries
    (4) - generate a trace file, to search for abnormal executions - Apparently nothing really strange (but obviously I don't know what was supposed to happen)
    Any possible reasons for this to happen?
    Any ideas?
    Some help would be welcome.
    Best regards,
    Pedro Lourenço

    Hi Noel,
    I just found the problem...
    I have a trigger defined on the table that uses a synonym for another user table.
    That synomym was dropped, so the trigger was invalid.
    I didn't notice the problem because the trigger was disabled, so the WM$ procedure wasn't being generated, and there were no "visible errors".
    Recreating the synomyn, the problem was solved.
    Thanks for your help!
    Regards,
    Pedro Lourenço

  • (SD 1.5.4.59.40) Compilation with coment - success with compilation error

    Hi!
    If I run this script:
    create table t(n number);
    create or replace
    TRIGGER t1
    -- Coment wiсh work!
    BEFORE UPDATE ON t
    REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
    DECLARE
    past_due EXCEPTION;
    begin
    if 1 = 1 then
    raise_application_error(-20001, 'First trigger!' , TRUE);
    end if;
    end t1;
    +/+
    create or replace
    -- Coment with error
    TRIGGER t2
    BEFORE UPDATE ON t
    REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
    DECLARE
    past_due EXCEPTION;
    begin
    if 1 <> 1 then
    raise_application_error(-20001, 'Second trigger!' , TRUE);
    end if;
    end;
    +/+
    Result:
    +SQL Command: create or replace --+
    Failed: ORA-24344: success with compilation error
    +24344. 00000 - "success with compilation error"+
    *Cause:    A sql/plsql compilation error occurred.+
    *Action:   Return OCI_SUCCESS_WITH_INFO along with the error code+
    anonymous block completed
    trigger text in SLD Developer:
    create or replace TRIGGER t2
    BEFORE UPDATE ON t
    REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
    DECLARE
    past_due EXCEPTION

    It looks to me like there is a bug in the logic that determines if the current statement is SQL (terminated by ";") or PL/SQL (terminated by "/") - putting the comment before the object type you are creating is causing SQL Developer to assume it is SQL and it stops the statement at the first ";".
    The same thing happens if you try to create a package with a comment between the "create or replace" and the "package", for example:
    create or replace
    -- comment
    package xxx_pkg
    i number;
    j number;
    end;
    /creates a package with the following source, executing as a statement (so long as the cursor is between the create and the first ";"):
    package xxx_pkg
    i numbertheFurryOne

  • Wierd SQL Select Compile Error

    Hello.
    When I do my SQL like this:
    SQL SELECT cus_surname as "Surname",
    cus_forename as
    "FirstName",
    cus_telephone as
    "Telephone",
    cus_address as
    "Address1",
    cus_line1 as
    "Address2",
    cus_line2 as
    "Address3",
    cus_town as
    "Address4",
    cus_city as
    "Address5",
    cus_postcode as
    "Address6"
    INTO :lCustomer
    FROM msp_customers
    WHERE cus_serial = :lRefCustomer.Serial
    on session SessionToUse;
    I get this compile error:
    The read-only virtual attribute
    FoundationClasses.FoundationBusinessObject.IsNew can't be passed as an
    OUTPUT or an INPUT OUTPUT parameter.
    Yet if I remove the "as" from the SQL Select syntax it works, with no
    compile errors.
    Why? I don't understand why they are different!
    Tim Sawyer
    PanCredit
    Leeds, UK.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    I added a DBMS_OUTPUT.put_line(l_wrap) in keith codes
    and run out put wrapped test codes in sqlplus and can see wrapped test procedure.
    create or replace procedure test wrapped
    a000000
    b2
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    7
    11d 124
    ohyVALi7ang26ROCF0CZ3wLg6ngwgy7Q2SdqfC/p+D6E39xrRLEK0/eVVEVSORSTWoZXk1gi
    JT9nTrV3IXmGVbi5uMlIl+0C/WV9wPlFL5z37QfcEOYUdmLx8iwul2hEvDehUX0jLfiltHqx
    MhAgy16zDvWPfv5uE4HrlBvRAYoDmETXR7r10x/uyQyUxDw4sVyq6Ndh4GSFw9zp801nKSN1
    P0GOB03CtlcnrqAjQhASJKrP4sXW74oOyr373DBBP/CLndRTT0TZ1HvWVzAgL5C++Dl6PNyQ
    But I got compiled errors as
    Compilation errors for PROCEDURE SYS.TEST
    Error: PLS-00103: Encountered the symbol "ASWALLET_OPEN" when expecting one of the following:
    ( ; is with authid as cluster compress order using compiled
    wrapped external deterministic parallel_enable pipelined
    result_cache
    The symbol "is" was substituted for "ASWALLET_OPEN" to continue.
    Line: 1
    Text: create or replace procedure test wrapped
    Error: PLS-00103: Encountered the symbol "=" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table long double ref
    char time timestamp interval date binary national character
    nchar
    The symbol "<an identifier>" was substituted for "=" to continue.
    Line: 1
    Text: create or replace procedure test wrapped
    Error: PLS-00103: Encountered the symbol "=" when expecting one of the following:
    constant exception <an identifier>
    <a double-quoted delimited-identifier> table long double ref
    char time timestamp interval date binary national character
    nchar
    Line: 1
    Text: create or replace procedure test wrapped
    .Bot trigger and procedure works well before wrapped.
    I use oracle 11g2 at window 2003.
    Thanks
    newdba

Maybe you are looking for