Invalid Trigger

I exported my HTML DB application from development to production. When I did everything looks to be working properly. But when I go to add a new record I get this error:
ORA-04098: trigger 'PTL_APPS.BI_ACTIVITY' is invalid and failed re-validation
This is the information for the invalid trigger
Trigger Details
Schema: PTL_APPS
Trigger Name: BI_ACTIVITY
Trigger Type: BEFORE EACH ROW
Triggering Event: INSERT
Table Schema: PTL_APPS
Base Object Type: TABLE
Table Name: ACTIVITY
Column Name: (null)
Referencing Names: REFERENCING NEW AS NEW OLD AS OLD
When Clause: (null)
Status: ENABLED
Description: bi_activity before insert on activity for each row
Action Type: PL/SQL
Trigger Body
begin
for c1 in (
select ACTIVITY_SEQ.nextval next_val
from dual
) loop
:new.ACTIVITY_ID := c1.next_val;
end loop;
end;
What is the best way to fix this?

ORA-04098: trigger 'string.string' is invalid and failed re-validation<br>
Cause: A trigger was attempted to be retrieved for execution and was found to be invalid. This also means that compilation/authorization failed for the trigger.<br>
Action: Options are to resolve the compilation/authorization errors, disable the trigger, or drop the trigger.<br><br>
I am sure it's something simple, but I just don't see it.<br><br>
chet

Similar Messages

  • How can i creat a trigger    error  invalid trigger specification

    i have a stored procedure which i want it to be triggered when an insertion is done on table A
    and that stored procedure accepts values from the insertion performed in table A
    and inserts into Table B by either updating the table or insertion into Table B
    how can i achieve this
    OK fine i have a table called Table A
    i want a trigger that can accept values such as
    create or replace trigger UpdateMyDoc  after insert on  Table A
    for each row
    accoutntno varchar2,
    ID varchar2
    As
    cnt number;
    Begin
    update Table B value (accoutntno ,ID ); commit;
    end ;
    is the above possible if it is then i get this  [1]: (Error): ORA-04079: invalid trigger specification
    any help
    Edited by: kama021 on Aug 13, 2009 2:24 AM

    Stop right there, Kama.
    update Table B value (accoutntno ,ID ); commit;Do not go any further on triggers, until you at least know how to write an UPDATE
    Or is it INSERT
    Once you have that in place, carry on by reading a bit about Transactions
    Regards
    Peter

  • Invalid trigger type error

    I am new to Oracle and need some help with the following:
    I was given scripts to create tablespaces, role, user, tables, indexes, sequences, triggers and synonyms.
    Those scripts were created and tested under Oracle version 7.0 and 8.0. I am using Oracle Enterpise Edition ver. 8i. and was told that should be OK.
    Anyway, I was successful with executing all but one of the scripts. This script triggers.sql produces an error, which reads: "Trigger created with compilation
    errors" if run via SQL Plus utility like
    @c:\triggers.sql.If I type(or cut and paste) the trigger I recieve an error "invalid trigger type".
    Here is the SQl statement:
    create trigger WALLSADMIN.TI_STATES
    BEFORE INSERT or UPDATE
    on WALLSADMIN.States
    for each row
    BEGIN
    IF
    INSERTING THEN
    SELECT state_seq.NEXTVAL INTO :new.state_id FROM DUAL;
    ELSIF UPDATING THEN
    :new.state_id:= :old.state_id;
    END IF;
    END;
    create trigger WALLSADMIN.TI_PROJECT
    BEFORE INSERT or UPDATE
    on WALLSADMIN.Project
    for each row
    BEGIN
    IF
    INSERTING THEN
    SELECT project_seq.NEXTVAL INTO :new.project_id FROM
    DUAL;
    ELSIF UPDATING THEN
    :new.project_id:= :old.project_id;
    END IF;
    END;
    create trigger WALLSADMIN.TI_WORKSPACES
    BEFORE INSERT or UPDATE
    on WALLSADMIN.WorkSpaces
    for each row
    BEGIN
    IF
    INSERTING THEN
    SELECT workspace_seq.NEXTVAL INTO :new.workspace_id
    FROM DUAL;
    ELSIF UPDATING THEN
    :new.workspace_id:= :old.workspace_id;
    END IF;
    END;
    In this script WALLSADMIN is the user I previously
    successfully created, tables in the statement were
    also successfully created.
    Note, i was told to run the script with Wallsadmin
    credentials. If I do so, however, I recieve 'insufficient
    priveledges'. If run under system account, I recieve errors
    already described, so it maybe permissions
    problem as well.
    here is my role script:
    /* Grant appropriate privileges to the
    ROLE */
    GRANT "CONNECT" TO "WALLSAKB";
    GRANT CREATE TABLE TO "WALLSAKB";
    GRANT DROP ANY TABLE TO "WALLSAKB";
    GRANT EXECUTE ANY PROCEDURE TO "WALLSAKB";
    GRANT INSERT ANY TABLE TO "WALLSAKB";
    GRANT SELECT ANY TABLE TO "WALLSAKB";
    GRANT SELECT ANY SEQUENCE TO "WALLSAKB";
    GRANT UPDATE ANY TABLE TO "WALLSAKB";
    and user create script:
    CREATE USER "WALLSADMIN" IDENTIFIED BY "password"
    DEFAULT TABLESPACE "WALLSAKB" TEMPORARY
    TABLESPACE "WALLSTMP"
    PROFILE DEFAULT;
    GRANT "CONNECT" TO "WALLSADMIN";
    GRANT "WALLSAKB" TO "WALLSADMIN";
    GRANT UNLIMITED TABLESPACE TO "WALLSADMIN";
    /* Enable all ROLES that are assigned to user
    WALLSADMIN */
    ALTER USER "WALLSADMIN" DEFAULT ROLE ALL;
    Thanks in advance.

    could you tell the error by type "SHOW ERRORS" at sqlplus

  • Invalid trigger on 7.7.06.09

    I have migrate a database from SAPDB 7.4.03.32 to MaxDB 7.7.06.09 and have a problem with following trigger:
    CREATE TRIGGER T_TREE_DELETE FOR S_TREE AFTER DELETE EXECUTE (
        IF PARENT <> -1
        THEN DELETE FROM DBA.S_ENTITY WHERE ETYID IN (SELECT DBA.S_ENTITY.ETYID FROM DBA.S_ENTITY,DBA.S_TREE WHERE (PARENT = :OLD.ETYID) AND (DBA.S_ENTITY.ETYID = DBA.S_TREE.ETYID));
        IF PARENT = -1
        THEN UPDATE DBA.S_TREE SET PARENT = -1 WHERE PARENT = :OLD.ETYID; DELETE FROM DBA.S_TREE WHERE PARENT = -1;
        UPDATE DBA.S_TREE SET NODEORDER = NODEORDER-1 WHERE (PARENT = :OLD.INTERNALUSE) AND (NODEORDER >= :OLD.NODEORDER) AND (TREETYPE = :OLD.TREETYPE) AND (ETYID <> :OLD.ETYID);
    When I try to delete an entry in the table S_ENTITY (S_TREE has a foreign key to S_ENTITY with the option cascade) with our application I get this error:
    ERROR: SQLException: [-8037]: TRIGGER T_TREE_DELETE is invalid (rc -9206)
    For a test I deleted the last part of the trigger "UPDATE DBA.S_TRE ...." and now it works, so I guess this is the part which make trouble.
    Here is a part of the kernel trace log:
    REQUEST: ascii, normal_swap, 70400-ODB     (2 segments, len: 176)
    (20.4290  page 20)
       parse SEGMENT 1   (1 part, len: 96)
             session_sqlmode, user_cmd
       command PART   (1 argument, size: 126440)
             buf(38): 'delete from s_entity where (ETYID = ?)'
       dbs SEGMENT 2   (1 part, len: 80, offset: 96)
             session_sqlmode, user_cmd
       command PART   (1 argument, size: 126344, segm_offset: 96)
             buf(22): 'CLOSE "JDBC_CURSOR_12"'
    >b02get  key(28):
             FFFF0000 00000047 00410001 0053005F 0045004E 00540049 00540059
    b02get  root                59552; *** key_not_found ***
    >b02get  key(28):
             00000000 00000002 00410001 0053005F 0045004E 00540049 00540059
    b02get  root                59552; *** key_not_found ***
    >b02get  key(28):
             FFFF0000 0000000A 00410001 0053005F 0045004E 00540049 00540059
    b02get  root                59552; ok
    >b02get  key(20): 00000000 0000043C 00060001 FFFF0000 00000047
    b02get  root                44664; ok
    >b02get  key(12): 00000000 0000043C 00660001
    b02get  root                59552; ok
    >b02get  key(12): 00000000 0000043C 00670001
    b02get  root                59552; ok
    >b02get  key(12): 00000000 0000043C 00140001
    b02get  root                44664; ok
    >b02get  key(12): 00000000 000003B6 00670001
    b02get  root                59552; ok
    >b02get  key(12): 00000000 000003B6 00150001
    b02get  root                44664; ok
    >b02get  key(12): 00000000 000003B6 0008FE01
    b02get  root                44664; ok
    REQUEST: unicode, full_swap, 62000-XCI     (1 segment, len: 0)
    (20.6789  page 20)
       dbs SEGMENT 1   (1 part, len: 1216)
             internal, user_cmd
             scrollable on
       command PART   (1 argument, size: 8104)
             buf(1158):
             ' C R E A T E   T R I G G E R   T _ T R E E _ D E L E T E   F '
             'O R   S _ T R E E   A F T E R   D E L E T E   E X E C U'
    >b07cadd key(12): 0F000000 20202020 00B10001
    b07cadd root                89384; ok
    >b07cadd key(138):
             00000000 00000000 00B5004A 00440042 0043005F 00430055 00520053
             004F0052 005F0031 00320020 00200020 00200020 00200020 00200020
             00200020
    b07cadd root                89384; ok
    >b07cadd key(12): 0F000000 20202020 00B20000
    b07cadd root                89384; ok
    >b07cadd key(12): 0F000000 20202020 00C10000
    b07cadd root                89384; ok
    >b07cadd key(13): 0F000000 20202020 00C10000 01
    b07cadd root                89384; ok
    >b02get  key(24): FFFF0000 0000000A 00410001 0053005F 00540052 00450045
    b02get  root                59552; ok
    >b02get  key(12): 00000000 000003B6 00150003
    b02get  root                44664; ok
    >b02get  key(12): 00000000 000003B6 00150005
    b02get  root                44664; ok
    >b02logadd key(76):
               00000000 00000004 00B70001 00540045 004D0050 00200020
               00200020 00200020 00200020 00200020 00200020 00200020
               00200020 00200020 00200020
    >b01t_create    Temp; fileTfnNo: 0; ttfnTempLog
                    session: 0; fid: 553648128
                    fn: 1A00 80000000000002F6 000000000021
    b01t_create root            59697; ok
    >b07cadd key(4): 00000001
    b07cadd root                59697; ok
    b02logadd root              89384; ok
    >b02logadd key(12): FFFD0000 10000000 00B10001
    >b07cadd key(4): 00000002
    b07cadd root                59697; ok
    b02logadd root              89384; ok
    >b02logadd key(12): 00000000 00018EC9 00010001
    b02logadd root              44664; ok
    >b02kb_repl key(12): 00000000 000003B6 00780001
    b02kb_repl root             59552; *** key_not_found ***
    >b02logadd key(12): 00000000 000003B6 00780001
    b02logadd root              59552; ok
    >b02kb_repl key(12): 00000000 000003B6 00780101
    b02kb_repl root             59552; *** key_not_found ***
    >b02logadd key(12): 00000000 000003B6 00780101
    b02logadd root              59552; ok
    >b02kb_del key(12): 00000000 000003B6 00180001
    b02kb_del root              44664; ok
    >b02kb_del key(13): 00000000 000003B6 00180001 01
    b02kb_del root              44664; ok
    >b02kb_del key(13): 00000000 000003B6 00180001 02
    b02kb_del root              44664; *** key_not_found ***
    >b02logadd key(12): 00000000 000003B6 00180001
    b02logadd root              44664; ok
    >b02logadd key(13): 00000000 000003B6 00180001 01
    b02logadd root              44664; ok
    >b02kb_del key(76):
               00000000 00000004 00B70001 00540045 004D0050 00200020
               00200020 00200020 00200020 00200020 00200020 00200020
               00200020 00200020 00200020
    >b07cadd key(4): 00000003
    b07cadd root                59697; ok
    b02kb_del root              89384; ok
    >b02first_ql StartKey(8): FFFD0000 10000000
                 zero Stop Key
    b02first_ql root            89384; ok
    >b07cadd key(4): 00000004
    b07cadd root                59697; ok
    >b02del  key(12): FFFD0000 10000000 00B10001
    b02del  root                89384; ok
    >b02next_qual StartKey(12): FFFD0000 10000000 00B10001
                  zero Stop Key
    b02next_qual root           89384; *** no_next_record ***
    >b02kb_repl key(12): 00000000 000003B6 00150001
    b02kb_repl root             44664; ok
    >b01t_create    Temp; fileTfnNo: 0; ttfnPars
                    session: 0; fid: 100663296
                    fn: 1A00 80000000000002F7 000000000006
    b01t_create root            74585; ok
    >b01t_reset     Temp; fileTfnNo: 0; ttfnNone
                    session: 0; fid: 0
                    fn: 1A00 0000000000000000 000000000000
    >b01t_create    Temp; fileTfnNo: 0; ttfnNone
                    session: 0; fid: 0
                    fn: 1A00 80000000000002F8 000000000000
    b01t_create root            89473; ok
    b01t_reset root             89473; ok
    >b02get  key(12): 00000000 000003B6 00080101
    b02get  root                44664; ok
    RECEIVE: unicode, full_swap, 70706-XCI     (1 segment, len: 0)
    (21.4926  page 21)
       parse SEGMENT 1   (2 parts, len: 400)
             internal, user_cmd
             scrollable on
       command PART   (1 argument, size: 16296)
             buf(318):
             ' D E L E T E   F R O M   D B A . S _ E N T I T Y   W H E R E '
             '  E T Y I D   I N   ( S E L E C T   D B A . S _ E N T I'
       appl_param_desc PART   (1 argument, size: 15960)
              1.  fixed(38)
    REQUEST: unicode, full_swap, 70706-XCI     (1 segment, len: 0)
    (21.5226  page 21)
       parse SEGMENT 1   (2 parts, len: 400)
             internal, user_cmd
             scrollable on
       command PART   (1 argument, size: 16296)
             buf(318):
             ' D E L E T E   F R O M   D B A . S _ E N T I T Y   W H E R E '
             '  E T Y I D   I N   ( S E L E C T   D B A . S _ E N T I'
       appl_param_desc PART   (1 argument, size: 15960)
              1.  fixed(38)
    opmsg: AK CACHE 00000000000000000081FFFF0000000000000000
    RECEIVE: unicode, full_swap, 70706-XCI     (1 segment, len: 312)
    (21.5610  page 21)
       *** -9206 / RETURN SEGMENT 1   (1 part, len: 312)
             delete_fc, errpos: 159, sqlstate: ''S9206'
       errortext PART   (1 argument, size: 16296)
             buf(256):
             ' S y s t e m   e r r o r :   A K   D u p l i c a t e   c a t '
             'a l o g   i n f o r m a t i o n : 0 0 0 0 0 0 0 0 0 0 0'
    >b01destroy     Temp; fileTfnNo: 0; ttfnPars
                    session: 0; fid: 100663296
                    fn: 1A00 80000000000002F7 000000000006
    b01destroy root             74585; ok
    >b01destroy     Temp; fileTfnNo: 0; ttfnUsage
                    session: 0; fid: 167772160
                    fn: 1A00 80000000000002F8 00000000000A
    b01destroy root             89473; ok
    >b07cadd key(12): FF00002C 010A0020 00890000
    b07cadd root                89384; ok
    >b01t_create    Temp; fileTfnNo: 0; ttfnCacheRollback
                    session: 0; fid: 520093696
                    fn: 1A00 80000000000002F9 00000000001F
    b01t_create root           104361; ok
    >b07cadd key(12): FF00002C 010A0020 00890000
    b07cadd root               104361; ok
    >b02prev key(4): FFFFFFFF
    b02prev root                59697; *** key_not_found ***
    >b07cadd key(12): FFFD0000 10000000 00B10001
    b07cadd root                89384; ok
    >b07cdel key(4): 00000004
    b07cdel root                59697; ok
    >b02prev key(4): 00000004
    b02prev root                59697; *** key_not_found ***
    >b07cadd key(76):
             00000000 00000004 00B70001 00540045 004D0050 00200020 00200020
             00200020 00200020 00200020 00200020 00200020 00200020 00200020
             00200020
    b07cadd root                89384; ok
    >b07cdel key(4): 00000003
    b07cdel root                59697; ok
    >b02prev key(4): 00000003
    b02prev root                59697; *** key_not_found ***
    >b07cdel key(12): FFFD0000 10000000 00B10001
    b07cdel root                89384; ok
    >b07cdel key(4): 00000002
    b07cdel root                59697; ok
    >b02prev key(4): 00000002
    b02prev root                59697; *** key_not_found ***
    >b07cdel key(76):
             00000000 00000004 00B70001 00540045 004D0050 00200020 00200020
             00200020 00200020 00200020 00200020 00200020 00200020 00200020
             00200020
    b07cdel root                89384; ok
    >b07cdel key(4): 00000001
    b07cdel root                59697; ok
    >b02prev key(4): 00000001
    b02prev root                59697; *** no_prev_record ***
    >b02get  key(12): 00000000 000003B6 00150001
    b02get  root                44664; ok
    >b02repl key(12): 00000000 000003B6 00150001
    b02repl root                44664; ok
    >b02get  key(13): 00000000 000003B6 00180001 01
    b02get  root                44664; ok
    >b02del  key(13): 00000000 000003B6 00180001 01
    b02del  root                44664; ok
    >b02get  key(12): 00000000 000003B6 00180001
    b02get  root                44664; ok
    >b02del  key(12): 00000000 000003B6 00180001
    b02del  root                44664; ok
    >b02add  key(13): 00000000 000003B6 00180001 01
    b02add  root                44664; ok
    >b02add  key(12): 00000000 000003B6 00180001
    b02add  root                44664; ok
    >b02get  key(12): 00000000 000003B6 00780101
    b02get  root                59552; ok
    >b02del  key(12): 00000000 000003B6 00780101
    b02del  root                59552; ok
    >b02get  key(12): 00000000 000003B6 00780001
    b02get  root                59552; ok
    >b02del  key(12): 00000000 000003B6 00780001
    b02del  root                59552; ok
    >b02get  key(12): 00000000 00018EC9 00010001
    b02get  root                44664; ok
    >b02del  key(12): 00000000 00018EC9 00010001
    b02del  root                44664; ok
    >b07cnext zero key
    b07cnext root              104361; *** key_not_found ***
    >b07cdel key(12): FF00002C 010A0020 00890000
    b07cdel root                89384; ok
    opmsg: AK CACHE 00000000000000000081FFFF0000000000000000
    RECEIVE: unicode, full_swap, 62000-XCI     (1 segment, len: 312)
    (22.2148  page 22)
       *** -9206 / RETURN SEGMENT 1   (1 part, len: 312)
             create_trigger_fc, errpos: 253, sqlstate: ''S9206'
       errortext PART   (1 argument, size: 8104)
             buf(256):
             ' S y s t e m   e r r o r :   A K   D u p l i c a t e   c a t '
             'a l o g   i n f o r m a t i o n : 0 0 0 0 0 0 0 0 0 0 0'
    ===== T2 =====Logwr    ================================22.2499  page 22
    *b15write log ---------------> 416; pno log 1:      274
    *b15write log ---------------> 417; pno log 1:      274
    I guess the database try to create the trigger again, but why? What goes wrong here?
    Can someone help me out with the trigger? The trigger worked fine in SAPDB 7.4.06.09.
    Thanks,
    Thomas

    I still have a question about the trigger.
    We have migrated a database from SAPDB 7.4.3 to 7.7 which already contains different trigger.
    The Migration process is following:
    I made a backup with the old database
    On the new database I run these commands
    dbmcli -d <dbname> -u dbm,<password> medium_put completeF "<backup-file>" FILE DATA 0 8 YES
    dbmcli -d <dbname> -u dbm,<password> db_admin
    dbmcli -d <dbname> -u dbm,<password> db_activate dba,<password>
    dbmcli -d <dbname> -u dbm,<password> -uUTL -i "recover.param"
    dbmcli -d <dbname> -u dbm,<password> db_online
    // After 'db_online' we will get an error that the WebDAV tables are invalid
    // So we will delete all WebDAV table because we don't need it
    dbmcli -d <dbname> -u dbm,<password> -uSQL dba,<password> -i "drop_webdav.param"
    dbmcli -d <dbname> -u dbm,<password> load_systab -u dba,<password> -ud domain
    dbmcli -d <dbname> -u dbm,<password> sql_recreateindex
    dbmcli -d <dbname> -u dbm,<password> medium_delete completeF
    file "drop_webdav.param":
    sql_execute DROP TABLE WEBDAV_CONTAINER
    sql_execute DROP TABLE WEBDAV_INODE
    sql_execute DROP TABLE WEBDAV_NAME_SPACE
    sql_execute DROP TABLE WEBDAV_PROPERTY
    sql_execute DROP TABLE WEBDAV_PROPERTY_MANAGEMENT
    file "recover.param":
    db_admin
    db_connect
    db_activate recover completeF data
    When we try to delete an entry in one table the delete trigger reports:
    [12:38:33] [DeleteUserReqHandler::handleRequest] ERROR: SQLException: [-8037]: TRIGGER T_DELETE_USER is invalid (rc -9206)
    [12:38:33] [DeleteUserReqHandler::handleRequest] ERROR: SQLState:     I8037
    [12:38:33] [DeleteUserReqHandler::handleRequest] ERROR: VendorError:  -8037
    This is the trigger, but the problem is with other triggers too:
    CREATE TRIGGER T_DELETE_USER FOR S_USER AFTER DELETE EXECUTE(
           DELETE FROM DBA.S_GROUP WHERE :OLD.USRID = GRPID AND :OLD.USERNAME = NAME;
    Is there an easy way to update the triggers during the migration process like load_systab? Or is there a command to convert the triggers so the MaxDB 7.7 can handle it? Because on MaxDB 7.7 they works correct.
    Thanks for your help.
    Best regards, Thomas

  • (Error): ORA-04079: invalid trigger specification

    i was creating a trigger and i had the above error message
    that code below shows how i created my trigger
    CREATE OR REPLACE TRIGGER TG_GL_GET_MAXIMUM_DATE
    AFTER INSERT ON TABLE Al
    FOR EACH ROW
    strsen VARCHAR2,
    strage VARCHAR2,
    numcurcode VARCHAR2,
    stracctno VARCHAR2,
    dt_date DATE
    as
    strmessg VARCHAR2 (50);
    num_cnt NUMBER;
    dtmax_date DATE;
    begin
    here i perform an update and insert here
    end ;
    what could be the problem

    The problem is twofold
    - You didn't read the documentation when creating the trigger, so you didn't know a trigger isn't a procedure and doesn't accept parameters
    - When you got this error, you didn't read the online error manual, in order to resolve it.
    You are kindly requested to do your own research prior to posting, and to avoid asking syntax questions and other questions for which you can easily find the answer yourself in the searchable documentation
    at http://tahiti.oracle.com
    Sybrand Bakker
    Senior Oracle DBA

  • Ora-04079 invalid trigger specification

    create or replace trigger ddllog_trigger
    after ddl on scott.schema
    is
    v_user varchar2(1000);
    v_loginip varchar2(1000);
    v_sqltext v$sqltext_with_newlines%type;
    v_sid v$session.sid%type;
    v_objname user_objects.object_name%type;
    v_objtype user_objects.object_type%type;
    v_ddlcommand v$session.command%type;
    v_event varchar2(20);
    v_num number;
    v_errmsg varchar2(1000);
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
    v_ip := sys_context('userenv', 'ip');
    v_errmsg:='Your machine not authenticate to perofrm DDL';
    If v_ip = '10.91.104.1'
    then
    /*session variables */
    v_user := sys_context('user_env', 'session_user');
    v_sid := sys_context('userenv', 'sid');
    v_objname := ora_dict_obj_name;
    v_objtype := ora_dict_obj_type;
    v_ddlcommand := ora_sysevent;
    /*session variables */
    /*for building the entire sql text*/
    v_num := ora_sql_txt(sql_text);
    FOR i IN 1 .. n LOOP
    v_sqltext := := v_sqltext := || sql_text(i);
    END LOOP;
    /*for building the entire sql text*/
    /*insert into log*/
    insert into ddl_log
    (LOGINUSER,
    LOGINMC,
    SQLTEXT,
    OBJECTNAME ,
    OBJECTTYPE ,
    DDLCOMMAND )
    values
    (v_user,
    v_ip,
    v_sqltext,
    v_objname,
    v_objtype,
    v_ddlcommand);
    COMMIT;
    /*insert into log*/
    else
    raise_application_error(-20101,v_errmsg);
    end;

    - v_ip vaiable declaration is missing.
    - "end if" is missing before end.
    Below is the script of Your Trigger after above all problems been fixed:
    create or replace trigger ddllog_trigger
    after ddl on schema
    declare
    v_ip varchar2(100);
    v_user varchar2(1000);
    v_loginip varchar2(1000);
    v_sqltext v$sqltext_with_newlines%type;
    v_sid v$session.sid%type;
    v_objname user_objects.object_name%type;
    v_objtype user_objects.object_type%type;
    v_ddlcommand v$session.command%type;
    v_event varchar2(20);
    v_num number;
    v_errmsg varchar2(1000);
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
    v_ip := sys_context('userenv', 'ip');
    v_errmsg:='Your machine not authenticate to perofrm DDL';
    If v_ip = '10.91.104.1'             
    then
    /*session variables */
    v_user := sys_context('user_env', 'session_user');
    v_sid := sys_context('userenv', 'sid');
    v_objname := ora_dict_obj_name;
    v_objtype := ora_dict_obj_type;
    v_ddlcommand := ora_sysevent;
    /*session variables */
    /*for building the entire sql text*/
    v_num := ora_sql_txt(sql_text);
    FOR i IN 1 .. n LOOP
    v_sqltext := v_sqltext || sql_text(i);
    END LOOP;
    /*for building the entire sql text*/
    /*insert into log*/
    insert into ddl_log
    (LOGINUSER,
    LOGINMC,
    SQLTEXT,
    OBJECTNAME ,
    OBJECTTYPE ,
    DDLCOMMAND )
    values
    (v_user,
    v_ip,
    v_sqltext,
    v_objname,
    v_objtype,
    v_ddlcommand);
    COMMIT;
    /*insert into log*/
    else
    raise_application_error(-20101,v_errmsg);
    end if;
    end;Note: Still the trigger script is not completly error free as I can't compile it to check for the rest of errors..     
    Regards,
    Dipali..

  • Error in creating a trigger

    i am creating a trigger i am getting an error
    create or replace TRIGGER INS_Discharge
    AFTER INSERT
    ON Discharge
    FOR EACH ROW
    AS
    declare
    vr_DischargeType INT ;
    vr_Visit_ID INT ;
    vr_Discharge_Date DATE;
    vr_VisitDate DATE;
    vr_AdmTime varchar(5) ;
    vr_TransferID INT ;
    vr_BedID AS INT ;
    BEGIN
    select :NEW.DischargeType into vr_DischargeType
    from dual;
    select :NEW.Discharge_Date into vr_Discharge_Date
    from dual;
    select :NEW.VisitDate into vr_VisitDate
    from dual;
    SELECT VisitDate into vr_VisitDate FROM Visit WHERE Visit_ID = vr_Visit_ID ;
    UPDATE Visit SET DischargeType = vr_DischargeType, DischargeDate = vr_Discharge_Date
    WHERE Visit_ID = vr_Visit_ID ;
    SELECT MAX(Transfer_ID)into vr_TransferID FROM BedSchedule WHERE VisitID = vr_Visit_ID ;
    IF vr_DischargeType = 2 then
    SELECT Bed_ID into vr_BedID FROM BedSchedule WHERE Transfer_ID = vr_TransferID ;
    UPDATE Bed_Mst SET Bed_Status_ID = 1 WHERE Bed_ID = vr_BedID ;
    :NEW.Bed_ID :=vr_BedID;
    end if;
    END ;
    Error report:
    ORA-04079: invalid trigger specification
    04079. 00000 - "invalid trigger specification"
    *Cause:    The create TRIGGER statement is invalid.
    *Action:   Check the statement for correct syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    i have done you said .... i have oracle version 10g
    create or replace TRIGGER trUPD_Discharge
    AFTER UPDATE
    ON Discharge
    for each row
    AS
    declare
    vr_DischargeType INT ;
    vr_Discharge_Date DATE;
    vr_Visit_ID INT ;
    vr_CancelStatus INt;
    BEGIN
    /*select :NEW.DischargeType into vr_DischargeType from dual;
    select :NEW.Visit_ID into vr_Visit_ID from dual;
    select :NEW.Discharge_Date into vr_Discharge_Date from dual;
    select nvl((select :NEW.CancelStatus from dual),0)
    into vr_CancelStatus from dual;
    If vr_CancelStatus = 0 then
    UPDATE Visit SET DischargeType = :NEW.DischargeType,
    DischargeDate =:NEW.Discharge_Date WHERE Visit_ID = :NEW.Visit_ID ;
    end if;
    END;
    but still getting same error
    Error report:
    ORA-04079: invalid trigger specification
    04079. 00000 - "invalid trigger specification"
    *Cause:    The create TRIGGER statement is invalid.
    *Action:   Check the statement for correct syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Trigger creation - Help Required

    Hi,
    New to pl/sql and would like some help in trying to achieve the following.
    I have 2 tables with one being a history table. When someone insert into the first table not the history table. I'd like to create a trigger that will retrieve the last entry for the given id in the history table, then manipulate it to have the same values that have been inserted into the main table, which will result in an insert statement being executed on the history table.
    I've created 2 small test table with
    create table cs1 (name varchar2(6), age number(3), ins_date date);
    create table cs2 (name varchar2(6), age number(3));
    What I'd like to trigger to looks like
    create or replace trigger cs_trig
    after insert on cs2
    begin
    insert into cs1 (name,age.ins_date)
    values (col_value_of_cs2.name, col_values_of_cs2.age, sysdate);
    end;
    I'm unsure as to how to populate the name and age variable.
    This is my first attempt. Sorry if it simple.
    Thanks
    Caron

    Hi Andrew,
    Thanks for your help. Could you explain what and are? As I've tried to the create and I'm receiving errors.
    SQL> create or replace trigger cs_trig
    2 after insert on cs2 fro each row
    3 begin
    4 insert into cs1 (name,age.ins_date)
    5 values (:NEW.name, (:NEW..age, sysdate);
    6 end;
    7 /
    after insert on cs2 fro each row
    ERROR at line 2:
    ORA-04079: invalid trigger specification

  • Error in trigger while importing schema

    I am getting the below error while importing a schema back to a database..
    ORA-39083: Object type TRIGGER failed to create with error:
    ORA-04072: invalid trigger type
    Failing sql is:
    BEGIN DBMS_DDL.SET_TRIGGER_FIRING_PROPERTY('"pula"','"Trigger1"',FALSE) ; END;
    ORA-39083: Object type TRIGGER failed to create with error:
    I have checked the status of the trigger and everything id fine...
    Please help..!!

    Rajesh,
    Please go through this Wiki chapter on CoA import using DTW and you should be able to understand this better
    https://wiki.sdn.sap.com/wiki/display/B1/SAPBusinessOne...ToGo-10.DataTransfer+Workbench
    Suda

  • Extract trigger DDL from 8i database

    Hi All,
    We are in process of migrating our 8i database's to 11g. for some reason , we excluded triggers while import. now , I need to get all the ddl's from 8i database.
    I think , dbms_metatadata is not there in 8i. using the following script did not help , as it does not append owner to trigger name. this script was taken from Mr Kyte book
    select
    'create or replace trigger ''' ||
    trigger_name || '''' || chr(10)||
    decode( substr( trigger_type, 1, 1 ),
    'A', 'AFTER', 'B', 'BEFORE', 'I', 'INSTEAD OF' ) ||
    chr(10) ||
    triggering_event || chr(10) ||
    'ON ''' || table_owner || '''.''' ||
    table_name || '' || chr(10) ||
    decode( instr( trigger_type, 'EACH ROW' ), 0, null,
    'FOR EACH ROW' ) || chr(10) ,
    trigger_body
    from dba_triggersRegards

    Thanks solomon, but , it still need some correction , I guess..
    create or replace trigger 'UFP"."UFP_TW_COST_AIUDR'
    AFTER
    INSERT OR UPDATE OR DELETE
    ON 'UFP'.'UFP_TGT_WKSHT_COST
    FOR EACH ROW
    DECLARE
       action_flag UFP.UFP_TGT_WKSHT_COST_AUDIT.ACTION%TYPE;
    BEGIN
       IF DELETING THEN
          insert into UFP.UFP_TGT_WKSHT_COST_AUDIT
             (PROJNO, REVNO, LINE_NUMBER, OPTION_NUMBER, COST, SKU_NUMBER, USERID,
             TIMESTAMP, ACTION)
             values
             (:old.PROJNO, :old.REVNO, :old.LINE_NUMBER, :old.OPTION_NUMBER, :old.COST, :old.SKU_NUMBER, USER,
             SYSDATE, 'DEL');
       ELSE
          IF INSERTING THEN
             action_flag := 'INS';
          ELSE
             action_flag := 'UPD';
          END IF;
          insert into UFP.UFP_TGT_WKSHT_COST_AUDIT
             (PROJNO, REVNO, LINE_NUMBER, OPTION_NUMBER, COST, SKU_NUMBER, USERID,
             TIMESTAMP, ACTION)
             values
             (:new.PROJNO, :new.REVNO, :new.LINE_NUMBER, :new.OPTION_NUMBER, :new.COST, :new.SKU_NUMBER, USER,
             SYSDATE, action_flag);
       END IF;
    END;
    create or replace trigger 'UFP"."UFP_TW_COST_AIUDR'
    ERROR at line 1:
    ORA-04070: invalid trigger name

  • Log Table History With Trigger

    Hello,
    I'm trying to log all changes on a table in a second table with a trigger.
    This is my code:
    CREATE OR REPLACE
    TRIGGER TRG_INS_ROTOKOLL
    AFTER INSERT ON vertraege
    FOR EACH ROW
    REFERENCING OLD AS alt NEW AS neu
    BEGIN
    INSERT INTO vertraege_protokoll SELECT * FROM vertraege vt WHERE vt.id = :NEW.id;
    END;
    Does anybody know why I get an "invalid trigger" - error (ORA-04079)?
    Does anybody know a better method to solve this problem?
    Thanks in advance -
    Timo Paschke

    There is nothing wrong
    REFERENCING OLD AS alt NEW AS neu
    but the FOR EACH ROW must be placed at the
    end.
    CREATE OR REPLACE TRIGGER TRG_INS_ROTOKOLL
    AFTER INSERT ON emp REFERENCING OLD AS alt NEW AS neu
    FOR EACH ROW
    BEGIN
    END;
    ** Then you will encounter trigger mutation , because
    your are selecting from the same table.
    instead you can directly insert data into your new
    table with your :neu values
    insert into vertraege_protokoll values (
    :neu.<colname>,:neu.<colname>,:neu.<colname>,..);
    -S.KTo me ?
    REFERENCING OLD AS alt NEW AS neu,
    will cause problems as he is using :NEW in the trigger body.
    After noting that I found the trigger is completely wrong.So recommended to read docs..

  • DAQmx trigger AO from AI signal (error -200265)?

    Here's my problem:
    I have a PXI-6115 i/o card and I'm observing a waveform on ai0.  When the waveform reaches a threshold, I want to generate a waveform on ao0.  I tried looking at the example, "Cont Gen Voltage Wfm-Int Clk-Analog Start.vi," using ai0 as the trigger source but I get error 200265 (using an invalid trigger source).  I realized that the channel should be in the task if I want to use it as a trigger, but I can't add an AI channel to an AO task, so I'm kind of stuck.
    I've attached part of the code that I'm trying to use.  Any advice would be greatly appreciated!
    Attachments:
    trigger_ao_from_ai.vi ‏50 KB

    If your timing between Analog In and Analog Out is not critical, you could just use software triggering.  Get your AO setup with Start Trigger set to None.  Don't run it yet.  Get your AI setup to read 1 sample.  In a loop, put the AI read function.  Each loop iteration should return one reading.  When the reading goes below the threshold, call the AO Write function to send an output. 
    The trick is to not continuously call the AO write whenever the AI input is below the threshold, or it will be called on each loop iteration as long as the AI reading is below the threshold.  You can use a shift register to hold a boolean flag.  Drag down the shift register on the left side to create a previous state terminal.  Send the threshold compare output to the shift register.  On the left, you read both shift registers.  Trigger the AO when the top terminal is True and the bottom terminal is False (using AND and NOT).  This will trigger only once because on the next iteration, both will be True.  The threshold compare will have to go to False and then True again before the next trigger will occur.
    - tbob
    Inventor of the WORM Global

  • Trigger appeared with strange name

    Oracle 11g
    Suddenly we get this error when updating a certain table:
    ORA-04098: trigger 'AM_DEV.BIN$our4yawU287gQBMKOxY2NA==$0' is invalid and failed re-validation
    I see this trigger listed in user_triggers, but deleting fails:
    SQL> drop trigger 'BIN$our4yawU287gQBMKOxY2NA==$0' ;
    drop trigger 'BIN$our4yawU287gQBMKOxY2NA==$0'
    ERROR at line 1:
    ORA-04070: invalid trigger name
    I see similar named triggers on other tables too.
    What are they, and how do I get rid of them?

    xerces8 wrote:
    Thanks.
    I tried single quotes first and got an error.
    I guess I have to learn more about quoting...If you have database objects created without double quotes then they are automatically converted to UPPERCASE when stored in the data dictionary...
    SQL> select table_name from user_tables where table_name like 'F%';
    no rows selected
    SQL> create table fred (x number);
    Table created.
    SQL> select table_name from user_tables where table_name like 'F%';
    TABLE_NAME
    FREDIf you have objects created with double quotes then the case of the name is preserved...
    SQL> create table "Fred" (x number);
    Table created.
    SQL> select table_name from user_tables where table_name like 'F%';
    TABLE_NAME
    Fred
    FREDThus if I try and drop the table without double quotes it will default to the object in UPPERCASE...
    SQL> drop table fred;
    Table dropped.
    SQL> select table_name from user_tables where table_name like 'F%';
    TABLE_NAME
    FredAgain if I try and drop the other table without double quotes it won't find it because it's assuming UPPERCASE...
    SQL> drop table Fred;
    drop table Fred
    ERROR at line 1:
    ORA-00942: table or view does not existwhereas the database object is case specific, so we need double quotes to get it exactly right...
    SQL> drop table "Fred";
    Table dropped.
    SQL> select table_name from user_tables where table_name like 'F%';
    no rows selected
    SQL>Of course if you specify double quotes when creating it, but you specify the name in UPPERCASE anyway...
    SQL> create table "FRED" (x number);
    Table created.
    SQL> select table_name from user_tables where table_name like 'F%';
    TABLE_NAME
    FRED... then you don't need double quotes to drop it because UPPERCASE is already assumed...
    SQL> drop table FRED;
    Table dropped.
    SQL> select table_name from user_tables where table_name like 'F%';
    no rows selectedIt is always better to create your database objects without using double quotes, especially if you use anything but UPPERCASE, because if it contains any lower case letters then any developers trying to access those tables need to know the case of the object and always need to specify it in double quotes. It's a pain in the @rse, so best avoided.
    Of course we can't help that Oracle uses mixed case for internal reasons, such as dropped objects in the recyclebin.

  • 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. :(

  • Iotech DaqBook 260 - Labview trigger channel

    Iotech Daqbook 260 with Labview 7.0 using latest iotech drivers and labview vi's. I'm using a trigger setup similar to the "Daq device main unit advanced analog input example". Data aquires if I use an immediate trigger but as soon as I choose a hardware trigger it comes up with error code 137 (daqAdvArm: Invalid Trigger channel) with all channels 0 to 48. With the immediate trigger, data gets stored in the array output with the first column being the first selected channel. I'm using a dbk45 in the first channel of the daqbook, followed by 2 dbk80's.
    Thanks for your time and help, any other info needed please let me know.

    Hi,
    You should contact Iotech on this error because I am assuming they are the ones that developed these drivers to interface with LabVIEW. There is no way for us to diagnose this problem because we did not develop their drivers. You could always switch to our hardware which was developed to work seamlessly with LabVIEW. Have a Great Day!
    George

Maybe you are looking for

  • Driver program for FORM16

    Hi all, I am seaching for Driver program for FORM16 SMART FORM .There is one driver program for sap script , for smart form J_1IEWT_CERT IS there any driver program  . Can any one please guide me how to proceed? thanks in advance. Regards, suresh.

  • Get back to mac os 10.5.2

    Okay, so I have an iBook G4 12in 1.33 ghz. A few months ago I had installed leopard, but realized that I still needed os 9, so I went back to Tiger (with classic support) a few weeks ago. Today, I no longer needed that app, so looking forward to bein

  • Problem with Simple Transformation

    Hi to all I am working with ST, and have the following issue: I have a highly nested xml structure, and, when I execute a abap program with a myself ST, only the last one data is passed to internal tables. I want to know: how can I do to get that all

  • How do you get Grab to activate.  When I click on it nothing happens; the icon simply rests in the dock..

    Perhaps it is a flaw in my software, but when I seek to take a picture of the screen, I access Grab through the untilities folder.  Instead of giving me options, the Grab logo simply goes onto my dock and rests there.  Clicking on it produces nothing

  • How to display BIRT report on Tomcat server

    Hi, I am using BIRT to generates the report, i am having a BIRT file called Customers.rptdesign that i want to execute on Tomcat server, but not able to execute. On eclipse brouser its running very well and displaying reports in brouser but not in To