Calling a trigger

how to call a trigger within a procedure

Hi,
The difference between a trigger and any stored procedure/function is triggers are event based which means the code included in the trigger is exceuted when the event occurs where a stored procedure/function is to provide code reusability. So if you want to execute a piece of code whenever something happens implicitly use a trigger but if you want to execute a piece of code explicitly please use a procedure/function either individually or as part of a package.

Similar Messages

  • How to call or not call a Trigger in same table based on condition?

    Hi
    How to call or not call a Trigger in below situations..
    If a table contains a record of same value i.e,
    [i[u]]ID
    1
    1
    3
    In above ID 1 is repeated for two times.
    In this situations i don't want to call a trigger..
    But, the value ID is for 3, now i want to fire a trigger.
    Based on this i want to delete in another table.
    How can I check it?
    Thanks

    Thanks for ur reply..
    The below is my scnario..
    I am having two table
    employee
    Id empcol
    101 111
    101 222
    102 444
    Department
    id deptcol
    101 457
    101 678
    102 543
    The above is my table structure no one column is PK, so i m not able create FK.
    When I am deleting from employee where id =101 and empcol=111,
    the above record is deleted.
    At present I am using After Update Trigger..
    So trigger is called and delete the id 101 in Department table.
    In my scenario i can't delete a record in Department table
    bcoz i am having id morethan 101 in employee table.
    If employee table contains one ID like 102 the Trigger should works.
    How can I check the condition After delete on employee table it contains morethan same employee id?
    The below is my Trigger..
    CREATE OR REPLACE TRIGGER CALL_TRIGGER
    AFTER DELETE ON Employee
    FOR EACH ROW
    DECLARE
    count_id pls_integer;
    BEGIN
    SELECT COUNT(*) INTO count_id from Employee WHERE ID <>:new.ID;
    IF( count_id >1) THEN
    DELETE FROM Depratment where ID=:old.ID;
    END IF;
    END;
    I am geting an error ORA-04091 table is mutuating, trigger cannot seen it.
    I had tried with package and package body also.. But no luck.
    Thanks

  • Java function call from Trigger in Oracle

    Moderator edit:
    This post was branched from an eleven-year-old long dead thread
    Java function call from Trigger in Oracle
    @ user 861498,
    For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
    Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
    {end of edit, what follows is their posting}
    I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
    My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
    Trigger:
    CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
    IS LANGUAGE JAVA
    NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
    Java:
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
    // Required class libraries.
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import com.ekahau.common.sdk.*;
    import com.ekahau.engine.sdk.*;
    // Define class.
    public class ThrowAnError {
    // Connect and verify new insert would be a duplicate.
    public static void contactTrigger(Integer memberID) throws Exception {
    String badgeId;
    // Create a Java 5 and Oracle 11g connection.
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    // Create a prepared statement that accepts binding a number.
    PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
    "FROM Users " +
    "WHERE \"User\" = ? ");
    // Bind the local variable to the statement placeholder.
    ps.setInt(1, memberID);
    // Execute query and check if there is a second value.
    ResultSet rs = ps.executeQuery();
    while (rs.next()) {
    badgeId = rs.getString("Note");
    // Clean up resources.
    rs.close();
    ps.close();
    conn.close();
    // davids badge is 105463705637
    EConnection mEngineConnection = new econnection("10.25.10.5",8550);
    mEngineConnection.setUserCredentials("choff", "badge00");
    mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
    mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
    Edited by: rukbat on May 31, 2011 1:12 PM

    To followup on the posting:
    Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
    Having figured that out on my own, I minified my code to just run the one line of code:
    // Required class libraries.
      import java.sql.*;
      import oracle.jdbc.driver.*;
      import com.ekahau.common.sdk.*;
      import com.ekahau.engine.sdk.*;
      // Define class.
      public class ThrowAnError {
         public static void testEkahau(Integer memberID) throws Exception {
         try {
              EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
         } catch (Throwable e) {
              System.out.println("got an error");
              e.printStackTrace();
    }So, after the following:
    SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
    and the following as the user
    SQL> set serveroutput on
    SQL> exec dbms_java.set_output(10000);
    I run the procedure and receive the following message.
    SQL> call java_contact_t4(801);
    got an error
    java.lang.NoClassDefFoundError
         at ThrowAnError.testEkahau(ThrowAnError:13)
    Call completed.
    NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
    Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
    c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
    arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
    creating : resource META-INF/MANIFEST.MF
    loading : resource META-INF/MANIFEST.MF
    creating : class com/ekahau/common/sdk/EConnection
    loading : class com/ekahau/common/sdk/EConnection
    creating : class com/ekahau/common/sdk/EErrorCodes
    loading : class com/ekahau/common/sdk/EErrorCodes
    skipping : resource META-INF/MANIFEST.MF
    resolving: class com/ekahau/common/sdk/EConnection
    skipping : class com/ekahau/common/sdk/EErrorCodes
    skipping : class com/ekahau/common/sdk/EException
    skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
    skipping : class com/ekahau/common/sdk/EMsg
    skipping : class com/ekahau/common/sdk/EMsgEncoder
    skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
    skipping : class com/ekahau/common/sdk/EMsgProperty
    resolving: class com/ekahau/engine/sdk/impl/LocationImpl
    skipping : class com/ekahau/engine/sdk/status/IStatusListener
    skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
    Classes Loaded: 114
    Resources Loaded: 1
    Sources Loaded: 0
    Published Interfaces: 0
    Classes generated: 0
    Classes skipped: 0
    Synonyms Created: 0
    Errors: 0
    .... with no explanation.
    Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
    How do i get it to resolve the entire jar file?
    Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:26 AM

  • Oracle 10g key combination to call form trigger

    Hi everyone,
    I need to fire the KEY-DUPREC trigger as I click on the key combination Shift+P therefore; I added the following line of code in the frmweb.res file.
    80 : 1 : "Shift+P" : 64 : "Duplicate Record"
    It worked iff no error was raised. So, if I have a raise form trigger failure in the KEY-DUPREC trigger, a capital P will appear in the text field that called the trigger.
    Can you please suggest a solution for preventing the capital P from appearing in the text field if a raise trigger failure existed in the KEY-DUPREC.
    Thanks in advance
    Lana

    I don't know if there is a solution, but it sounds to me like a very bad idea to use Shift-P for duplicate_record. This means that you will never be able to input a capital letter P in any text field.

  • External Procedure call from Trigger

    I'd like to call an external C Procedure from
    an Oracle Trigger.
    In trying to get an example to work, after setting up the listener and tnsnames.ora for external procedures, the following SQL*Plus command behaves strangely:
    CREATE LIBRARY TTest as "c:\winnt\system32\TTrigger.dll";
    After entering this, the command line prompts for more data as if the command was not terminated. Tried single quotes, double quotes, forward slash, backward slash...
    What is wrong with this command?
    Thanks

    hi,
    COuld you send me the configuration parameters for listner and TNSNAMES? I am working so hard to set it up but getting stuck and I am sure that I am missing some configuration set up.
    Please could you mail your tnsname a nd listner files to bellow shown address?
    [email protected] ?
    Thanks in advance
    Suresh

  • Package is invalid state when called in Trigger

    Hi All,
    We have a trigger in which we are calling procedure(which is created in some package). Every time the trigger is called it returned an error
    'Package is in INVALID State".We tried to clean the app pool and that error went away but now it started coming again.
    Please help as we have been struggling hard for this .
    Database is ORA 10g.
    Please let me know if there are any other questions.
    Thanks in Advance !!!
    Regards

    My question is
    Why do you post 'My car doesn't work, please help me' instead of specifying exactly (with source code) what went wrong?
    Now you are asking people to rub up their broken crystal ball!
    Sybrand Bakker
    Senior Oracle DBA

  • Max no of calls - Busy Trigger

    Hi,
    I don't know if this is a standard settings or not?
    When I put 6 to maximum nr and 2 to Busy trigger & when I am on the call and somebody trying to call me he receive busy and the call is remaining on
    missed calls.
    But when  I put 6 to maximum nr and 1 to Busy trigger & when I am on the call and somebody trying to call me he receive busy and the call is not remaining on missed calls
    What I want is when some body is on the call and he receive a second call, the person who trying to call to receive busy and the call to remain in missed calls.
    I have CallM 8.6

    I have configured it some time with AndPhone (http://andtek.com/communications-products-calllist.html).
    The Busy Call is forwarded to an CTI-RP which is controlled by andphone. Andphone evaluates the forwarding party and then forwards the call to a busy extension (e.g. an dial-peer on an h.323 gateway where busy signal is configured).
    I'm sure there are other 3rd party solutions.

  • How to call a trigger when a transaction is rolled back

    Situation:
    Using a trigger to propogate changes from an Oracle8 DB to a remote non-Oracle database ( it may not even be a rational database etc.). The trigger is connecting to a external procedure to send the change to the remote "database" - all updates are to be replicated - inserts, deletes etc.
    Problem:
    If an update transaction is aborted in the Oracle database, after the trigger has been called but before the transaction is committed. The transaction is rolled back successfully in the Oracle database, but nothing happens to the remote "database". Therefore there is now an data inconsistency !
    How can I ensure that the transaction rollback occurs in the remote database as well ? There is no transaction monitor between the two databases. Can I get the trigger to be called again ?
    Any ideas, suggestions ??
    Many thanks in advance,
    ismon

    Hi;
    You may use costum trigger which can be run after AP_CHECKS_ALL table has record
    Regard
    Helios

  • Handle/call Database trigger from bean(programatically) in ADF

    Hi All,
    I want to call/invoke a database trigger (from bean) programatically. I am using adf(11.1.1.5).
    Help needed.
    Thanks,
    NJ
    Edited by: 892586 on 20 Oct, 2011 11:28 PM

    Hi,
    Check followings will helpful
    Re: Need to call DB func on create in ADF BC
    http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcrules.htm#sthref308

  • How to call partial trigger on JSFF component from separate managed bean?

    Guys and Gals,
    Using JDev 11.1.1.2.0. Looked on the forums and google. Initial results aren't so great.
    Is it possible to call a PPR on a JSFF component from a separate managed bean? It seems calling the FacesContext in this instance calls the root JSPX, which only contains one child: the RichDocument.
          UIComponent component =
             FacesContext.getCurrentInstance().getViewRoot().findComponent("pc1:table1");
          if (component != null)
             AdfFacesContext context = AdfFacesContext.getCurrentInstance();
             context.addPartialTarget(component);
          System.out.println(FacesContext.getCurrentInstance().getViewRoot().getChildCount());Returns 1 :(
    Ideas for a workaround?
    Edited by: LovettWB on Nov 17, 2010 3:39 AM
    Edited by: LovettWB on Nov 17, 2010 4:11 AM
    Edited by: LovettWB on Nov 17, 2010 4:12 AM

    Thanks! Joonas, you've been a great help.
    The code on the page you referenced was close, but the code on a page referenced in the user comments was even better:
    http://www.jroller.com/mert/entry/how_to_find_a_uicomponent
    My region is located in a facet, which the page you posted doesn't quite cover, but the page above fixed that. Here's the fix below:
    In Managed Bean
          // search for the region ID (or task flow) in the base page
          UIComponent base = jsfUtils.findComponentInRoot("dynamicRegion");
          // now find component ID from within that region
          UIComponent partTable = jsfUtils.findComponent(base, "partTable");
          // call PPR on your found component
          AdfFacesContext.getCurrentInstance().addPartialTarget(partTable);In JSFUtils utility class
       // used to locate region.  Could also find any component
       // located in the base ViewRoot()
       public static UIComponent findComponentInRoot(String id) {
        UIComponent component = null;
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null) {
          UIComponent root = facesContext.getViewRoot();
          component = findComponent(root, id);
        return component;
        // Recursive method which finds your component within JSFF
        // regardless of facet or other UIComponents which may have children
    public static UIComponent findComponent(UIComponent base, String id) {
        if (id.equals(base.getId()))
          return base;
        UIComponent kid = null;
        UIComponent result = null;
        Iterator kids = base.getFacetsAndChildren();
        while (kids.hasNext() && (result == null)) {
          kid = (UIComponent) kids.next();
          if (id.equals(kid.getId())) {
            result = kid;
            break;
          result = findComponent(kid, id);
          if (result != null) {
            break;
        return result;
    }Good stuff to know!

  • Is it possible to call a  Oracle  Trigger from a Java Application

    Hi
    Please let me know if is it possible to call a Trigger from a Java/J2EE Application .
    Thanks

    A trigger is NEVER explicitly called, from any environment.
    It is implicitly called when you invoke the operation that it's a trigger for.
    Whether you're using Java or anything else to invoke that operation makes no difference whatsoever.

  • Help with trigger

    Dear All,
    I have a trigger that works fine when the value is updated by a user but when the value is updated by another trigger it does not seem to work.
    When i log in and update the value in sqlplus it works fine but when I update a value in another table which then calls a trigger which then updates that value in the main table the trigger does not fire.
    This is the scenario. We have a table called payments. When we run a process it sets some values in this payment table.
    When this value is set in the payments table it fires a trigger which then updates the invoice table (paid_date) based on some value in the payments table.
    Now when this value in the invoices table is set by the trigger it is meant to call another trigger which should recognise this new value but this does not hapen.
    however if i go in manually and update the invoice table, the trigger fires.
    Any help will be appreciated.
    Below is the trigger that does not seem to fire.
    I have also included the trigger which sets this value
    create or replace
    TRIGGER INVOICE_PAID before
    UPDATE OF "PAID_DATE" ON "INVOICES" FOR EACH ROW
    DECLARE
    -- check if the invoice.mco_transfer_status has been updated to R
    -- if it has then insert records into the relevant tables
    -- Start the Insert based on the update of invoices.mco_transfer_status
    fa_cnt PLS_INTEGER;
    ecode VARCHAR2(100);
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    -- do updates based on update of invoices.transfer_status column
    IF :NEW.PAID_DATE IS NOT NULL AND :OLD.PAID_DATE IS NULL
    THEN
    :NEW.MCO_TRANSFER_STATUS := 'R';
    :NEW.TRANSFER_STATUS:='R';
    :NEW.RECONCILED_STATUS:='R';
    INSERT INTO EMCO_INVOICE_STAGE (emco_document_number,invoice_id,raised_date,paid_date,pnr_reference,booking_date,
    gross,currency,forename,surname)
    SELECT :NEW.EMCO_DOCUMENT_NUMBER,:NEW.INVOICE_ID,:NEW.RAISED_DATE,:NEW.PAID_DATE,BK.PNR_REFERENCE,BK.BOOKING_DATE,:NEW.GROSS,
    :NEW.CURRENCY,PX.FORENAME,PX.SURNAME
    FROM BOOKINGS BK, PAX PX
    WHERE BK.BOOKING_ID=:NEW.BOOKING_ID
    AND PX.BOOKING_ID=:NEW.BOOKING_ID AND
    PX.PAX_SEQ=(SELECT MIN(px2.pax_seq) FROM PAX px2 WHERE booking_id=:NEW.BOOKING_ID AND px2.status <>'X' AND px2.pax_type='A' );
    -- Insert into PAYMENTS_STAGE table
    INSERT INTO PAYMENTS_STAGE (EMCO_DOCUMENT_NUMBER, PAYMENT_ID, INVOICE_ID, PAYMENT_DATE,PAYMENT_TYPE,AMOUNT,
    CURRENCY,CARD_NUMBER,TRANSACTIONID)
    SELECT :NEW.EMCO_DOCUMENT_NUMBER,PAYMENT_ID,INVOICE_ID,PAYMENT_DATE,PAYMENT_TYPE,AMOUNT,CURRENCY,CC.CARD_NUMBER,TRANSACTIONID
    FROM PAYMENTS PA, CREDIT_CARDS CC
    WHERE PA.INVOICE_ID=:NEW.INVOICE_ID
    AND CC.CARD_ID = PA.CARD_ID;
    :NEW.MCO_TRANSFER_STATUS:='C';
    SELECT COUNT(*) INTO fa_cnt FROM INVOICE_DETAILS WHERE
    invoice_id=:NEW.INVOICE_ID AND CHARGE_TYPE='FA';
    IF fa_cnt > 0
    THEN :NEW.TICKETING_STATUS:='R';
    ELSE
    :NEW.TICKETING_STATUS:='N';
    :NEW.EXCHANGED_DATE := :NEW.PAID_DATE;
    END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    ecode := SQLCODE|| ' '||SQLERRM ;
    dbms_output.put_line(thisproc || ' - ' || ecode);
    v_value := thisproc || ' - ' || ecode;
    INSERT INTO DOCUMENT_STATUS_STAGE (EMCO_DOCUMENT_NUMBER, STATUS,STATUS_DATE)
    VALUES (:NEW.EMCO_DOCUMENT_NUMBER,v_value,SYSDATE);
    :NEW.MCO_TRANSFER_STATUS := 'F';
    END INVOICE_PAID;
    TRIGGER "CAM_OWNER"."CHECK_INVOICE_PAID_IN_FULL" AFTER
    UPDATE OF "PAYMENT_STATUS" ON "CAM_OWNER"."PAYMENTS"
    DECLARE
    -- check if all the payments for that invoice have been received (completed)
    -- if they are complete then sum all the payments for that invoice and compare to gross value on invoices
    v_invoice_amount NUMBER;
    v_gross_amount NUMBER;
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    -- Changed as requested by nicola on 12/09/05 IF :NEW.PAYMENT_COMPLETE is not null
    --IF :NEW.PAYMENT_STATUS='C' AND :NEW.PAYMENT_STATUS <> :OLD.PAYMENT_STATUS
    --THEN
    CHECK_INVOICE_PAID_IN_FULL_PRO;
    --END IF;
    END CHECK_INVOICE_PAID_IN_FULL;
    and this is the procedure that is called
    PROCEDURE "CHECK_INVOICE_PAID_IN_FULL_PRO" IS
    -- check if all the payments for that invoice have been received (completed)
    -- if they are complete then sum all the payments for that invoice and compare to gross value on invoices
    v_invoice_amount NUMBER(20);
    v_gross_amount NUMBER(20);
    thisproc CONSTANT VARCHAR2(80) := 'trap_errmesg for mco_transfer_status';
    v_value VARCHAR2(150);
    BEGIN
    -- We will sum all the payments for that invoice that have a value in payment_complete
    --select sum(amount) into v_invoice_amount from payments where payment_complete is not null and invoice_id=:NEW.INVOICE_ID;
    FOR x IN (SELECT invoice_id FROM PAYMENTS_TEMP) LOOP
    SELECT NVL(SUM(amount),0) INTO v_invoice_amount FROM PAYMENTS
    WHERE payment_status ='C' AND invoice_id=X.INVOICE_ID;
    SELECT NVL(gross,0) INTO v_gross_amount FROM INVOICES WHERE
    invoice_id =X.INVOICE_ID;
    -- We will also get the gross amount for the invoice to compare to the sum of the payments
    IF v_invoice_amount = v_gross_amount
    THEN
    UPDATE INVOICES SET paid_date=SYSDATE
    WHERE invoice_id=X.INVOICE_ID;
    END IF;
    END LOOP;
    END CHECK_INVOICE_PAID_IN_FULL_PRO;

    The following demonstration is a direct response to your original question, in case you want to stick with that method of scheduling your index rebuilds through a trigger. In order to do ddl like alter index you will need to use dynamic sql like execute immediate. Since you can't rebuild the index before the insert or update has been committed, you will need to use dbms_job.submit to schedule the rebuild. In the following example, the index rebuild will be done as soon as the insert or update has been committed.
    scott@ORA92> CREATE TABLE cc_contenidos (cvalor CLOB)
      2  /
    Table created.
    scott@ORA92> CREATE INDEX cont ON cc_contenidos (cvalor) INDEXTYPE IS ctxsys.context
      2  /
    Index created.
    scott@ORA92> SELECT last_ddl_time FROM user_objects WHERE object_name = 'CONT'
      2  /
    LAST_DDL_TIME
    24-JAN-2005 21:10:13
    scott@ORA92> CREATE OR REPLACE PROCEDURE alter_index_cont
      2  AS
      3  BEGIN
      4    EXECUTE IMMEDIATE 'ALTER INDEX cont REBUILD ONLINE PARAMETERS (''sync memory 45M'')';
      5  END;
      6  /
    Procedure created.
    scott@ORA92> SHOW ERRORS
    No errors.
    scott@ORA92> CREATE OR REPLACE TRIGGER actualiza
      2    AFTER DELETE OR INSERT OR UPDATE on cc_contenidos
      3  DECLARE
      4    v_job NUMBER;
      5  BEGIN
      6    DBMS_JOB.SUBMIT (v_job, 'alter_index_cont;', SYSDATE);
      7  END actualiza;
      8  /
    Trigger created.
    scott@ORA92> SHOW ERRORS
    No errors.
    scott@ORA92> INSERT INTO cc_contenidos (cvalor) VALUES ('test 1')
      2  /
    1 row created.
    scott@ORA92> INSERT INTO cc_contenidos (cvalor) VALUES ('test 2')
      2  /
    1 row created.
    scott@ORA92> COMMIT
      2  /
    Commit complete.
    scott@ORA92> EXECUTE DBMS_LOCK.SLEEP (15)
    PL/SQL procedure successfully completed.
    scott@ORA92> SELECT last_ddl_time FROM user_objects WHERE object_name = 'CONT'
      2  /
    LAST_DDL_TIME
    24-JAN-2005 21:10:17
    scott@ORA92> SELECT * FROM cc_contenidos WHERE CONTAINS (cvalor, 'test') > 0
      2  /
    CVALOR
    test 2
    test 1
    scott@ORA92>

  • Using a JIT call with stock transport scheduling agreement

    Hi,
    I have a requirement to send forecast schedules for a stock transport scheduling agreement from procuring plant to producing plant. Production would be done in producing plant against these forecast schedules. Producing plant would only ship against a JIT call (pull trigger) from procuring plant and not against a forecast schedule line. Is there a way in standard SAP to achieve this?
    Thanks,
    Krishna

    I don't think so.
    You need to transfer the production forecast as demand plan in the production plant. Have a MTS planning strategy (like 10), then manufacturing is triggered by this demand plan, and goods are stocked in the production plant, waiting for the pull call from the sales plant.
    Don't forget to take care of the consumption of demand with STO (I think there's a note on this).

  • How to assign value in Statement level trigger?

    The below is my package body with trigger code..
    CREATE OR REPLACE PACKAGE BODY trigger_api AS
    TYPE t_change_rec IS RECORD (
    id tab1.id%TYPE,
    action tab1_audit.action%TYPE
    TYPE t_change_tab IS TABLE OF t_change_rec;
    g_change_tab t_change_tab := t_change_tab();
    PROCEDURE tab1_row_change (p_id IN tab1.id%TYPE,
    p_action IN VARCHAR2) IS
    BEGIN
    g_change_tab.extend;
    g_change_tab(g_change_tab.last).id := p_id;
    g_change_tab(g_change_tab.last).action := p_action;
    END tab1_row_change;
    PROCEDURE tab1_statement_change IS
    l_count NUMBER(10);
    BEGIN
    -- FOR i IN g_change_tab.first .. g_change_tab.last LOOP
    SELECT COUNT(*)
    INTO l_count
    FROM tab1;
    delete from tab1_audit where id=p_id;
    else
    dbms_output.put_line('Inside Else'||l_count);
    end if;
    -- END LOOP;
    -- g_change_tab.delete;
    END tab1_statement_change;
    END trigger_api;
    Trigger
    CREATE OR REPLACE TRIGGER tab1_asiu_trg
    -- AFTER INSERT OR UPDATE ON tab1
    AFTER DELETE ON tab1
    BEGIN
    trigger_api.tab1_statement_change;
    END;
    Calling Trgger
    Delete from tab1 where id='100';
    In the above package body which contains delete query, in that query i have to pass the value '100' i,e what are values i am giving in the (Delete from tab1 where id='100';) query.
    It shows error p_id Invalid Identifier..
    Thanks

    This wouldn't be related to your other threads would it by any chance?
    Re: How to call or not call a Trigger in same table based on condition?
    Re: Is it possible to use SELECT statement in TRIGGER?
    Can't you just stick to one thread to deal with your issue rather than asking it several times in different ways?
    You'll just cause confusion and frustrate people who are trying to help.

  • BPM start event(start condition) doesn't support ejb function call?

    Hi all,
    An id is included in the ws call to trigger the bpm flow,
    I have developed a ejb function, which is doing a simple check whether the process for the specific id is called before or not.
    I have a simple table in bpm java server which records the id used before.
    the ejb is called in the start condition, my desired behavior is: if the ejb returns true, no process should be triggered.
    but the thing is, my flow is not getting triggered once I put the ejb call in the start condition.(ejb is called, as i can see new id record inserted into my db table)
    I cannot even debug the process.
    I can debug the process if that ejb call is removed from the start condition.
    my server is 7.31 sp8
    Best regards,
    Jun

    Thanks for confirming Jun Wu.... always comforting to see even the experts can stuff it up from time to time... and very glad you were able to fix it!

Maybe you are looking for