Before trigger

How i can reference to variable that i´m inserting into database?
I want create "before trigger" which check if inserting date isn´t bigger than sysdate.
Thanks

This assumes a table name T and a column named date_column. It raises an error if the supplied date is in the future.
create or replace trigger t_trg
  before insert on t
  for each row
begin
  if :new.date_column > sysdate then
    raise_application_error(-20000, 'Invalid date');
  end if;
end;
/

Similar Messages

  • I need to pass null as a default value for a parameter in Before Trigger

    Hi All,
    I am using Before trigger function in calculation tab which has some set of parameters.So, I accept some parameters which are passed to this Before Trigger function and need these parameters default value as null.
    To be clear I want to set the Default value for a parameter in workbook to be NULL and pass the same to the calling Function.
    please help me.
    Thanks in advance

    Hi All,
    I am using Before trigger function in calculation tab which has some set of parameters.So, I accept some parameters which are passed to this Before Trigger function and need these parameters default value as null.
    To be clear I want to set the Default value for a parameter in workbook to be NULL and pass the same to the calling Function.
    please help me.
    Thanks in advance

  • Before Trigger in Discoverer 10.1.2

    Hi,
    Can any one help me how to build before trigger report in Discoverer. there is a function which internally calling a procedure which has parameters like process_id,organization_name,Gre,start_date,end_date. This process_id will be generated based on a sequence. So, how to pass value for the process_id parameter from Desktop Edition.
    example:-
    function a(process_id ,start_date,end_date..etc)
    procedure(process_id ,start_date,end_date..etc)
    insert into temp_table values(process_id,start_date,end_date,etc);
    end function a;
    In Desktop we created a workbook worksheet we called this function in calculation tab.It has to insert some rows into temp_table and we will create second sheet on this temp_table.
    The problem we are facing is we are not able to pass sequence.nextvalue as default value for a parameter. Please suggest.
    Thanks inadvance,
    Ch.Hanuman Prasad

    Hi,
    There is no before report trigger. You may be able to use a logon trigger.
    It sounds as though you may want to investigate using database contexts as session parameters which can be set by a workbook or at logon and remain for the duration of the DIscoverer session. Look at these posts for more details:
    Re: Passing multiple parameters into Custom Folder...
    Re: Parameters in SubQuery
    Re: Passing Parameters to a discoverer folder using Note 282249.1
    Rod West

  • Avoid insertion by before trigger

    Hi all!
    I want to avoid an insertion to a table based on certain conditions.
    So I thought I could use a BEFORE trigger. Unfortunately, I don't find a way to avoid it. I can declare a trigger, fetch the conditional information, but whats the command to avoid it?
    Maybe I simply overread it, so if someone could give me a hint, I would be very thankful.
    regards, Alex

    Raise an error

  • Using a sequence inside BEFORE TRIGGER

    Hi all,
    I just created a testtable and a sequence to use as a primary key column value for that table.
    I tried to create a BEFORE INSERT trigger on that table and in the trigger i tried to set up the primary key column value using the sequence
    but while compiling i am getting the error "Error(9,30): PLS-00357: Table,View Or Sequence reference 'SEQ_OF_TESTTABLE.NEXTVAL' not allowed in this context"
    My Version:Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    All the objects created with the same user. I would appraciate any help, thanks all
    EDIT
    I solved the problem using the below
    create or replace
    TRIGGER Bef_Ins_On_Testtable
    BEFORE INSERT ON TestTable
    FOR EACH ROW
    declare
    ntemp_id INT;
    BEGIN
    SELECT SEQ_OF_TESTTABLE.NEXTVAL INTO ntemp_id FROM DUAL ;
    DBMS_OUTPUT.PUT_LINE('İNSERTED');
    :NEW.VSURNAME := 'HAKKİ' ;
    :NEW.NID := ntemp_id;
    END;But i wonder why i can use the sequence(just as seqeunce_name.NEXTVAL) in INSERT statement and why cant in trigger?
    Edited by: user9371286 on 31.Tem.2010 04:15
    Edited by: user9371286 on 31.Tem.2010 04:21
    Edited by: user9371286 on 31.Tem.2010 04:27

    Please post your trigger code and your database version ( the result of: select * from v$version; ).
    Put it between tags, so your example will stay formatted.
    (see: http://forums.oracle.com/forums/help.jspa for more examples regarding tags)
    "PLS-00357: Table,View Or Sequence reference "string" not allowed in this context
        Cause: A reference to database table, view, or sequence was found in an inappropriate context. Such references can appear only in SQL statements or (excluding sequences) in %TYPE and %ROWTYPE declarations. Some valid examples follow: SELECT ename, emp.deptno, dname INTO my_ename, my_deptno, my_dept .FROM emp, dept WHERE emp.deptno = dept.deptno; DECLARE last_name emp.ename%TYPE; dept_rec dept%ROWTYPE;
        Action: Remove or relocate the illegal reference."
    +http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/plsus.htm#sthref13592+
    You can find examples of triggers referring to sequences here, by doing a search on this forum or:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_triggers.htm#ABC1032282                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Oracle Reports with PL/SQL package in before Trigger

    I have an oracle report which is set to run as a concurrent program in Oracle Apps. My before report trigger calls a pl/sql package. I am debating using errbuf and retcode, since I have not defined the pl/sql package as a concurrent program. But if I do add errbuf and retcode to the pl/sql package parameters, how do I call them in the trigger.
    function BeforeReport return boolean is
    begin
    delete from XXDK_SAMS2_MEAN_RATIO;
    delete from XXDK_SALES_RATIO_TOTALS;
    commit;
    XXDK_SAMS2_SALES_RATIO_RPT_PKG.INSERT_SALES*(:errbuf, :retcode*, :neighborhood, :salefrom, :saleto, :verfrom, :verto, :tax,
    :deed1, :deed2, :deed3, :tran1, :tran2, :tran3, :accnttype);
    return (TRUE);
    end;
    And do I add errbuf and ret code as paramters in the registered setup?

    Hi,
    please see if the code in these documents help.
    Note: 73492.1 - Creating a PL/SQL Concurrent Program in Oracle Applications
    Note: 221542.1 - Sample Code for FND_SUBMIT and FND_REQUEST API's
    Regards,
    Hussein

  • How to acquire and read data before trigger?

    Hi, all:  
             I want to acquire a impluse signal, and the data when the signal begins is very important to me. So, I want to using a digStart trigger to acquire it, but then i'll lose what i want, maybe i can acquire it continuously, and use the trigger to start read the buffer after a delay(in order to wait the signal end), i don't know if there is any ANSI C functions I can use to do it in this way. I am using PCI6220, DAQmx9.02 and ANSI C.   If anyone have some info on this please let me know. thinks.

    Hi Cris Brown:
                   From your application,I suggest that you can use DAQmxCfgDigEdgeRefTrig function; define  pretrigger samples fitting for your application.
    Try it. Best Regard!

  • BEFORE UPDATE Trigger

    Hi,
    I'm looking for a solution to find out which columns are set in the update-statement inside a before update trigger. Can someone give me a hint?!
    What I want to do:
    I want to ensure that an update-statement for a special table always include attribute "XXX". To declare this attribute as "not null" is useless, because it is set correctly at insert. To compare the new value against the old value in a before update trigger isn't possible because the new value can be the same as the old value.
    I'm using Oracle 8i.

    There is no need to use two triggers and a temporary table where a simple insert from the before trigger will do the job.
    You can just insert the :old.column values straigth into a history table within the before update trigger though I would prefer to use an after update trigger. Nevertheless, both the insert into history and the update will be part of one transaction so the two action will commit or rollback together:
    UT1 > create or replace trigger marktest_bu
    2 before update on marktest
    3 for each row
    4 begin
    5 insert into marktest_hist
    6 values (:old.fld1, :old.fld2, :old.fld3, :old.fld4);
    7 end;
    8 /
    Trigger created.
    UT1 > select * from marktest_hist;
    no rows selected
    UT1 > update marktest set fld1 = 'trigtest2'
    2 where fld1 = 'trigtest';
    1 row updated.
    UT1 > select * from marktest_hist;
    FLD1 FLD2 FLD3 FLD4
    trigtest 9 28-MAY-04 trigtest
    IMHO -- Mark D Powell --

  • Trigger time before or after

    i did find any real difference between after and before trigger for example
    1 create or replace trigger moh after insert on emp
    2 begin if to_char(sysdate,'DY') in('SAT') then
    3
    4 raise_application_error(-20500,'test');
    5 end if;
    6* end;
    SQL> /
    Trigger created.
    1 create or replace trigger moh before insert on emp
    2 begin if to_char(sysdate,'DY') in('SAT') then
    3
    4 raise_application_error(-20500,'test');
    5 end if;
    6* end;
    SQL> /
    Trigger created.
    In the two triggers the insert is prevented if the day is saturday if i use before insert or if i use after insert, so what is the difference then????

    SQL> create trigger test_emp
      2  before insert on emp
      3  for each row
      4  begin
      5    :new.ename := upper(:new.ename) ;
      6  end ;
      7  /
    Trigger created.
    SQL> create trigger test_emp_after
      2  after insert on emp
      3  for each row
      4  begin
      5    :new.ename := upper(:new.ename) ;
      6  end ;
      7  /
    create trigger test_emp_after
    ERROR at line 1:
    ORA-04084: cannot change NEW values for this trigger type
    SQL>

  • Difference between before and after trigger

        Is there any difference between these two trigger  .
        If its there , then please tell when we should use before trigger and after trigger
       thanx
       young bro
       

    BEFORE Triggers
    BEFORE triggers run the trigger action before the triggering statement is run. This type of trigger is commonly used in the following situations:
    When the trigger action determines whether the triggering statement should be allowed to complete. Using a BEFORE trigger for this purpose, you can eliminate unnecessary processing of the triggering statement and its eventual rollback in cases where an exception is raised in the trigger action.
    To derive specific column values before completing a triggering INSERT or UPDATE statement.
    AFTER Triggers
    AFTER triggers run the trigger action after the triggering statement is run.
    Trigger Type Combinations
    Using the options listed previously, you can create four types of row and statement triggers:
    BEFORE statement trigger
    Before executing the triggering statement, the trigger action is run.
    BEFORE row trigger
    Before modifying each row affected by the triggering statement and before checking appropriate integrity constraints, the trigger action is run, if the trigger restriction was not violated.
    AFTER statement trigger
    After executing the triggering statement and applying any deferred integrity constraints, the trigger action is run.
    AFTER row trigger
    After modifying each row affected by the triggering statement and possibly applying appropriate integrity constraints, the trigger action is run for the current row provided the trigger restriction was not violated. Unlike BEFORE row triggers, AFTER row triggers lock rows.
    You can have multiple triggers of the same type for the same statement for any given table. For example, you can have two BEFORE statement triggers for UPDATE statements on the employees table. Multiple triggers of the same type permit modular installation of applications that have triggers on the same tables. Also, Oracle materialized view logs use AFTER row triggers, so you can design your own AFTER row trigger in addition to the Oracle-defined AFTER row trigger.
    You can create as many triggers of the preceding different types as you need for each type of DML statement, (INSERT, UPDATE, or DELETE).
    S

  • How to get the ROWID in a Trigger?

    On Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit when I try below script I always get the same Rowid as "AAAAAAAAAAAAAAAAAA". Is this normal?
    Thank you.
    create table testrowid (a number );
    create or replace trigger testrowidbins
    before insert on testrowid for each row
    begin
    dbms_output.put_line( 'Rowid:= ' || :new.rowid );
    end;
    set serveroutput on
    insert into testrowid values( 1 );
    insert into testrowid values( 2 );
    insert into testrowid values( 3 );
    rollback ;
    insert into testrowid values( 1 );
    insert into testrowid values( 2 );
    insert into testrowid values( 3 );
    commit ;
    insert into testrowid values( 1 );
    insert into testrowid values( 2 );
    insert into testrowid values( 3 );
    rollback ;

    Well, it was more of a rhetorical question.
    Rowid is the physical location of a row in a table. During the execution of a BEFORE trigger, the row has not yet been placed in the table hence the 'AAAAA' rowid.
    During your AFTER trigger, the row exists in the table and therefore has a normal rowid.

  • Creating a BC4J EO Based on Stored Proc w/DB assigned PK using Seq/Trigge

    BC4J Code-o-philes;
    Using Steven Muench article "Creating a BC4J Entity Object Based on Stored Procedures" (HOWTO: Basing BC4J Entity on Stored Procedure as a starting point, I would like to modify that example to use a Stored Procedure where the Primary Keys of the Department Table are assigned by a DB Sequence/Before trigger. I already have the stored procedure and sequence/trigger working fine in SQL*Plus.
    The assumption I have is that code below needs to be modified, but I'm not sure exactly what need to be done to retreive the DB assigned PK.
    Lastly, I think that JDeveloper should be doing this automatically, maybe next release?
    Bill G...
    void handleStoredProcInsert() {
    CallableStatement st = null;
    try {
    String stmt = "BEGIN hr.do_insert(?,?,?); END;";
    DBTransaction tr = getDBTransaction();
    st = tr.createCallableStatement(stmt,1);
    /* st.setLong(1,getDepartmentId().longValue()); */
    st.registerOutParameter(3,Types.NUMERIC);
    if (getDepartmentName() != null) {
    st.setString(1,getDepartmentName());
    else {
    st.setNull(1,Types.VARCHAR);
    if (getLocationId() != null) {
    st.setLong(2,getLocationId().longValue());
    else {
    st.setNull(2,Types.VARCHAR);
    int rows = st.executeUpdate();
    Long newId = new Long(st.getLong(3));
    populateAttributeAsChanged(DEPARTMENTID, new DBSequence(newId));
    catch (SQLException s) {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}

    ARGHHHHHHHHHHHHHH!
    I've change the line
    st.setLong(1,getDepartmentId().longValue());
    to
    st.setLong(1,getSequenceNumber().longValue());
    And I'm still getting Error(303,20): method getSequenceNumber not found in class stproc.DepartmentsImpl.
    even though i've imported "oracle.jbo.domain.DBSequence;"
    The code below is taken from the BC4J StoredProc sample and is what I want to modify to get it working with DB/Triggers.
    BG...
    package stproc;
    import java.math.BigDecimal;
    import java.lang.Math;
    import java.sql.CallableStatement;
    import java.sql.SQLException;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.Key;
    import oracle.jbo.RowInconsistentException;
    import oracle.jbo.RowIterator;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.AttributeDefImpl;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.EntityDefImpl;
    import oracle.jbo.server.EntityImpl;
    import oracle.jbo.server.TransactionEvent;
    import oracle.jbo.AlreadyLockedException;
    import oracle.jbo.domain.DBSequence;
    // --- File generated by Oracle Business Components for Java.
    public class DepartmentsImpl extends EntityImpl
    protected static final int DEPARTMENTID = 0;
    protected static final int DEPARTMENTNAME = 1;
    protected static final int LOCATIONID = 2;
    private static EntityDefImpl mDefinitionObject;
    * This is the default constructor (do not remove)
    public DepartmentsImpl()
    * Retrieves the definition object for this instance class.
    public static synchronized EntityDefImpl getDefinitionObject()
    if (mDefinitionObject == null)
    mDefinitionObject = (EntityDefImpl)EntityDefImpl.findDefObject("stproc.Departments");
    return mDefinitionObject;
    * Gets the attribute value for DepartmentId, using the alias name DepartmentId
    public DBSequence getDepartmentId()
    return (DBSequence)getAttributeInternal(DEPARTMENTID);
    * Sets <code>value</code> as the attribute value for DepartmentId
    public void setDepartmentId(DBSequence value)
    setAttributeInternal(DEPARTMENTID, value);
    * Gets the attribute value for DepartmentName, using the alias name DepartmentName
    public String getDepartmentName()
    return (String)getAttributeInternal(DEPARTMENTNAME);
    * Sets <code>value</code> as the attribute value for DepartmentName
    public void setDepartmentName(String value)
    setAttributeInternal(DEPARTMENTNAME, value);
    * Gets the attribute value for LocationId, using the alias name LocationId
    public Number getLocationId()
    return (Number)getAttributeInternal(LOCATIONID);
    * Sets <code>value</code> as the attribute value for LocationId
    public void setLocationId(Number value)
    setAttributeInternal(LOCATIONID, value);
    // Generated method. Do not modify.
    protected Object getAttrInvokeAccessor(int index, AttributeDefImpl attrDef) throws Exception
    switch (index)
    case DEPARTMENTID:
    return getDepartmentId();
    case DEPARTMENTNAME:
    return getDepartmentName();
    case LOCATIONID:
    return getLocationId();
    default:
    return super.getAttrInvokeAccessor(index, attrDef);
    // Generated method. Do not modify.
    protected void setAttrInvokeAccessor(int index, Object value, AttributeDefImpl attrDef) throws Exception
    switch (index)
    case DEPARTMENTID:
    setDepartmentId((DBSequence)value);
    return;
    case DEPARTMENTNAME:
    setDepartmentName((String)value);
    return;
    case LOCATIONID:
    setLocationId((Number)value);
    return;
    default:
    super.setAttrInvokeAccessor(index, value, attrDef);
    return;
    protected void doSelect(boolean lock) {
    if (lock) {
    this.handleStoredProcLock();
    else {
    this.handleStoredProcSelect();
    public void doDML(int operation, TransactionEvent e) {
    switch (operation) {
    case DML_INSERT: {
    handleStoredProcInsert();
    break;
    case DML_UPDATE: {
    handleStoredProcUpdate();
    break;
    case DML_DELETE: {
    handleStoredProcDelete();
    break;
    void handleStoredProcSelect() {
    CallableStatement st = null;
    try {
    String stmt = "BEGIN hr.do_select(?,?,?); END;";
    DBTransaction tr = getDBTransaction();
    st = tr.createCallableStatement(stmt,1);
    /* st.setLong(1,getDepartmentId().longValue()); */
    st.registerOutParameter(2,Types.VARCHAR);
    st.registerOutParameter(3,Types.NUMERIC);
    int rows = st.executeUpdate();
    populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
    populateAttribute(LOCATIONID,st.getBigDecimal(3),true,false);
    catch (SQLException s) {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}
    void handleStoredProcDelete() {
    CallableStatement st = null;
    try {
    String stmt = "BEGIN hr.do_delete(?); END;";
    DBTransaction tr = getDBTransaction();
    st = tr.createCallableStatement(stmt,1);
    /* st.setLong(1,getDepartmentId().longValue()); */ // bg mod
    st.registerOutParameter(1,Types.NUMERIC); // bg add
    int rows = st.executeUpdate();
    catch (SQLException s) {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}
    void handleStoredProcInsert() {
    CallableStatement st = null;
    try {
    String stmt = "BEGIN hr.do_insert(?,?,?); END;";
    DBTransaction tr = getDBTransaction();
    st = tr.createCallableStatement(stmt,1);
    /* st.setLong(1,getDepartmentId().longValue()); */ // bg mod
    st.registerOutParameter(3,Types.NUMERIC);
    if (getDepartmentName() != null) {
    st.setString(1,getDepartmentName());
    else {
    st.setNull(1,Types.VARCHAR);
    if (getLocationId() != null) {
    st.setLong(2,getLocationId().longValue());
    else {
    st.setNull(2,Types.VARCHAR);
    int rows = st.executeUpdate();
    Long newId = new Long(st.getLong(3));
    populateAttributeAsChanged(DEPARTMENTID, new DBSequence(newId));
    catch (SQLException s) {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}
    void handleStoredProcUpdate() {
    CallableStatement st = null;
    try {
    String stmt = "BEGIN hr.do_update(?,?,?); END;";
    DBTransaction tr = getDBTransaction();
    st = tr.createCallableStatement(stmt,1);
    /* st.setLong(1,getDepartmentId().longValue()); */ // bg mod
    /* dbSeqVal.getSequenceNumber().longValue() */
    st.setLong(1,getSequenceNumber().longValue());
    if (getDepartmentName() != null) {
    st.setString(2,getDepartmentName());
    else {
    st.setNull(2,Types.VARCHAR);
    if (getLocationId() != null) {
    st.setLong(3,getLocationId().longValue());
    else {
    st.setNull(3,Types.VARCHAR);
    int rows = st.executeUpdate();
    catch (SQLException s) {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}
    void handleStoredProcLock() {
    CallableStatement st = null;
    try {
    String stmt = "BEGIN hr.do_lock(?,?,?); END;";
    DBTransaction tr = getDBTransaction();
    st = tr.createCallableStatement(stmt,1);
    /* st.setLong(1,getDepartmentId().longValue()); */ // bg mod
    st.registerOutParameter(2,Types.VARCHAR);
    st.registerOutParameter(3,Types.NUMERIC);
    int rows = st.executeUpdate();
    String newDname = st.getString(2);
    BigDecimal newLoc = st.getBigDecimal(3);
    // Compare the old values to the current values to
    // detect if row has changed.
    compareOldAttrTo(DEPARTMENTNAME,newDname);
    compareOldAttrTo(LOCATIONID,newLoc);
    catch (SQLException s) {
    if (Math.abs(s.getErrorCode())==54) {
    throw new AlreadyLockedException(s);
    else {
    throw new JboException(s);
    finally {
    try {
    if (st != null) st.close();
    catch (SQLException s) { /* ignore */}
    void compareOldAttrTo(int slot, Object newVal) {
    if ((getPostedAttribute(slot) == null && newVal != null) ||
    (getPostedAttribute(slot) != null && newVal == null) ||
    (getPostedAttribute(slot) != null && newVal != null &&
    !getPostedAttribute(slot).equals(newVal))) {
    throw new RowInconsistentException(createPrimaryKey(getDepartmentId()));
    * Creates a Key object based on given key constituents
    public static Key createPrimaryKey(DBSequence departmentId)
    return new Key(new Object[] {departmentId});
    }

  • Before and after triggers

    just can somebody clarify
    when we say
    create or replace trigger tn before/after insert/update/delete for each row/statement
    i just want to know what i can do with a before trigger which i cannot do with a after trigger and viceversa

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by sushant prabhu:
    i just want to know what i can do with a before trigger which i cannot do with a after trigger and viceversa<HR></BLOCKQUOTE>
    Before row triggers can modify column values (:new.column := value) before the row is originally written to disk. I don't think after row triggers can modify :new values. Before row triggers can't see the row's rowid, at least not for inserts, but after row triggers always can.
    Statement triggers can modify the triggering table, but row triggers can't. Statement triggers can't tell what rows are touched, but row triggers are called once per row touched and can see :old and :new values for that row.
    null

  • Inserting Records In A Trigger

    Greetings,
    I have a table which has a trigger that calls a stored procedure
    to insert additional records into the same table. One trigger
    is set after each row for insert/update/delete . The before
    trigger calls another proc to populate a global pl/sql table for
    the insert in the after trigger. All is okay except for the
    insert of the additional record. The original record which
    invoked the trigger sequence is sucessfully created, but the
    addition record that the triggers create does not.
    I Encounter an error on the insert withing a proc called by the
    after trigger:
    -4091: ORA-04091: table SPINTEK.ST_LGEN_RELATION is mutating,
    trigger/function may not see it.
    How can I create a record in a table via an after trigger while
    another record is also being inserted?
    Cheers and Happy Holidays.
    Marcel Sammut
    [email protected]

    You can't.
    Just think about it for a minute - if you have a trigger that
    fires after an INSERT, and that trigger attempts to perform
    another INSERT on the same table, then when what would prevent
    an infinite cascade of INSERTs from occurring?
    That's why you can't perform DML on a table in (or from) a
    trigger on the same table.

  • Capturing value in after insert or update row level trigger

    Hi Experts,
    I'm working on EBS 11.5.10 and database 11g. I have trigger-A on wip_discrete_jobs table and trigger-B on wip_requirement_operations table.When ever i create discrete job, it inserts record in both wip_discrete_jobs and wip_requirement_operations.
    Note:2 tables are like master-child relation.
    Trigger-A: After Insert.Row Level trigger on wip_discrete_jobs
    Trigger-B:After Insert,Row Level trigger on wip_requirement_operations
    In Trigger A:
    I'm capturing wip_entity_id and holding in global variable.
    package.variable:=:new.wip_entity_id
    In Trigger B:
    I'm using the above global variable.
    Issue: Let's say i have create discrete job,it's wip_entity_id is 27, but the global variable is holding the previous wip_entity_id(26),not current value.It looks like before trigger A event is complete, trigger B is also in process, i think this could be the reason it's not storing the current wip_entity_id in the global variable.
    I need your help how to have the current value in the global variable so that i can use that in the trigger B.
    Awaiting response at the earliest.
    Thanks

    798616 wrote:
    Hi Experts,
    I'm working on EBS 11.5.10 and database 11g. I have trigger-A on wip_discrete_jobs table and trigger-B on wip_requirement_operations table.When ever i create discrete job, it inserts record in both wip_discrete_jobs and wip_requirement_operations.
    Note:2 tables are like master-child relation.
    Trigger-A: After Insert.Row Level trigger on wip_discrete_jobs
    Trigger-B:After Insert,Row Level trigger on wip_requirement_operations
    In Trigger A:
    I'm capturing wip_entity_id and holding in global variable.
    package.variable:=:new.wip_entity_id
    In Trigger B:
    I'm using the above global variable.
    Issue: Let's say i have create discrete job,it's wip_entity_id is 27, but the global variable is holding the previous wip_entity_id(26),not current value.It looks like before trigger A event is complete, trigger B is also in process, i think this could be the reason it's not storing the current wip_entity_id in the global variable.
    I need your help how to have the current value in the global variable so that i can use that in the trigger B.
    Awaiting response at the earliest.
    ThanksMy head hurts just thinking about how this is being implemented.
    What's stopping you from creating a nice and simple procedure to perform all this magic?
    Continue with the global/trigger magic at your own peril, as you can hopefully already see ... nothing good will come from it.
    Cheers,

Maybe you are looking for

  • HT201300 2.2 hz mac pro i7 15" whats the most  ram i can load ie x2 8mb

    hi . can i install x2 8mb ddr ram into a 2011 mac book pro ?

  • Blackberry user ID

    I have a problem with my blackberry ID. I know my username and password are correct , but when I downloaded the new bbm that required the blackberry id information, everytime I type the correct information a message appears saying (Please enter the u

  • Sudden latency! No change of buffer size or hardware. What give?

    I'm trying to record a song and there's latency. I was recording two nights ago and everything was fine. The only thing that's happened between now and then is I unplugged my gear and replugged it today. The buffer size is set to 256 (and always has

  • Elements 11 problem with Saving to Version Set

    I have upgraded toElements 11 but when i go to save a file to " save in version set with original" it will not let me, as the  tick box is blanked out?

  • How to truncate sysdate

    hello friends I created a table called log as follows create table log(logid number,login_date date); insert into log values(101,sysdate); after 10 mins i created a cursor as follows.. declare uname varchar2(30); logdate date; cursor name_c is select