Clear_record in on-insert trigger

Hi, I have a situation where if a user presses a button, enters some details then saves, a database package is called, it does some processing and returns a value. However if the value returned is say 'dont-insert', I want a message displayed. Then when the user presses ok the block should be cleared of the inputted values.
At the moment I have the logic in the on-insert query on my block. It doesn't allow me to use clear_record in here because of the type of trigger it is. I was wondering if anyone has an alternative solution to this?
So I'm basically looking for logic to:
1. check the value returned from the database package
2. if it says don't insert, display a message
3 clear the changes entered by the user.
thanks,
Ian

A when-button-pressed trigger might work, but that would miss the situation where the user presses the commit keyboard key.
The right way would be to put the process (t+o call the db procedure, issue the message and clear the record+) into a form procedure. That procedure should then be called from the key-commit trigger.
If you want a button, too, then its when-button-pressed trigger should ONLY do a Do_Key('COMMIT_FORM'); That command will cause it to run the key-commit trigger. If you don't want to create a procedure, you could put all the code into the key-commit trigger, as Slava Natapov suggested.

Similar Messages

  • Error from Pre-Insert Trigger

    I am using the following code in Pre-insert trigger
    purpose is that all the record which do not click by mouse (check box)
    should be cleared on the screen when commit/save.
    declare
    begin
    go_block('Bl');
    first_record;
    loop
    if :kcheck is null then
    clear_record;
    else
    Exit When :System.Last_Record = 'TRUE';
    Next_Record;
    end if;
    end loop;
    end;
    it is showing error FRM-40737
    illegal restiricted procedure NEXT_RECORD in pre-insert trigger
    when I used this code in when button press trigger it is working.????
    Message was edited by:
    Kami

    Navigation is not allowed in this kind of triggers.
    PRE-INSERT is used to, for instance, put values on non NULL column in the current record.
    If you want to navigate in the records, choose another trigger, like KEY-COMMIT for example.
    Francois

  • Using Database Change Notification instead of After Insert Trigger

    Hello guys! I have an after insert trigger that calls a procedure, which in turn is doing an update or insert on another table. Due to mutating table errors I declared the trigger and procedure as autonomously transactional. The problem is, that old values of my main tables are inserted into the subtable since the after insert/update trigger is fired before the commit.
    My question is how can I solve that and how could I use the change notification package to call my procedure? I now that this notification is only started after a DML/DDL action has been commited on a table.
    If you could show me how to carry out the following code with a Database Change Notification I'd be delighted. Furthermore I need to know if it suffices to set up this notification only once or for each client seperately?
    Many thanks for your help and expertise!
    Regards,
    Sebastian
    declare
    cnumber number (6);
    begin
    select count(*) into cnumber from (
    select case when (select date_datum
        from
          (select f.date_datum,
            row_number() over (order by f.objectid desc) rn
          from borki.fangzahlen f
          where lng_falle      = :new.lng_falle
          and int_fallennummer = :new.int_fallennummer
          and lng_schaedling   = :new.lng_schaedling
          and date_datum       > '31.03.2010'
        where rn=1) < (select date_datum
        from
          (select f.date_datum,
            row_number() over (order by f.objectid desc) rn
          from borki.fangzahlen f
          where lng_falle      = :new.lng_falle
          and int_fallennummer = :new.int_fallennummer
          and lng_schaedling   = :new.lng_schaedling
          and date_datum       > '31.03.2010'
        where rn=2) then 1 end as action from borki.fangzahlen
            where lng_falle      = :new.lng_falle
            and int_fallennummer = :new.int_fallennummer
            and lng_schaedling   = :new.lng_schaedling
            and date_datum       > '31.03.2010') where action = 1;
    if cnumber != 0 then
    delete from borki.tbl_test where lng_falle = :new.lng_falle
    and int_fallennummer = :new.int_fallennummer
    and lng_schaedling   = :new.lng_schaedling
    and date_datum       > '31.03.2010';
    commit;     
    pr_fangzahlen_tw_sync_sk(:new.lng_falle, :new.int_fallennummer, :new.lng_schaedling);

    It looks like you have an error in line 37 of your code. Once you fix that the problem should be resolved.

  • Dynamic IF statement in PL/SQL on-insert trigger in Forms 6.0

    I would like to build a dynamic IF statement for the on-insert trigger in a form... Users are restricted to which "projects" they are allowed to enter into the database. These restrictions are based on a security table. The same restrictions are used to build the dynamic where clause that limits which previously inserted records the users can see when they are in the form. Since the restrictions are identical, I want to use the same logic that I use to build a where clause to build a dynamic If statement instead... If the statement is true, the user can insert the record. If its false, they can't.
    I'm trying to this as follows:
    declare
    big_if varchar2(10000) :=' ';
    begin
    if :global.admin='YES'
    then
    insert_record;
    else
    declare
    cursor cur1 is
    select paren1, field, comparison_operator, value, paren2, and_or
    from rcdb.user_project_assign2
    where user_id = user;
    c1_rec cur1%ROWTYPE;
    begin
    for c1_rec in cur1 loop
    big_if:= big_if &#0124; &#0124; c1_rec.paren1 &#0124; &#0124; ':tbl_main_data.' &#0124; &#0124;c1_rec.field &#0124; &#0124;c1_rec.comparison_operator &#0124; &#0124; '''' &#0124; &#0124; c1_rec.value &#0124; &#0124; '''' &#0124; &#0124; c1_rec.paren2 &#0124; &#0124; ' '&#0124; &#0124; c1_rec.and_or &#0124; &#0124; ' ';
    end loop;
    end;
    if big_if
    then
    insert_record;
    else message('You are not allowed to insert this record');
    end if;
    end if;
    end;
    The problem is in the line
    IF big_if
    big_if is the variable that holds the text to my if statement (hense dynamic If statement) but I can't get the code to allow me to use that variable.
    Can anyone do this?
    null

    That code was great, but forms isn't allowing me to use the dbms_sql so I have to make a procedure out of forms and call it from the form. Both my form code and the procedure are compiling, but I"m still getting an error when the result is coming back to the form...
    the code in the form is:
    declare
    big_if varchar2(10000) :=' ';
    result varchar2(5) :=' ';
    check_state varchar2(2):=:tbl_main_data.state_abr;
    check_region varchar2(3):=:tbl_main_data.region_abr;
    check_program varchar2(25):=:tbl_main_data.program;
    begin
    if :global.admin='YES'
    then
    insert_record;
    else
    declare
    cursor cur1 is
    select paren1, field, comparison_operator, value, paren2, and_or
    from rcdb.user_project_assign2
    where user_id = user;
    c1_rec cur1%ROWTYPE;
    begin
    for c1_rec in cur1 loop
    big_if:= big_if &#0124; &#0124; c1_rec.paren1;
    if c1_rec.field = 'state_abr' then
    big_if:=big_if &#0124; &#0124; 'check_state' &#0124; &#0124;c1_rec.comparison_operator &#0124; &#0124; '''' &#0124; &#0124; c1_rec.value &#0124; &#0124; '''' &#0124; &#0124; c1_rec.paren2 &#0124; &#0124; ' '&#0124; &#0124; c1_rec.and_or &#0124; &#0124; ' ';
    elsif c1_rec.field = 'region_abr' then
    big_if:=big_if &#0124; &#0124; 'check_region' &#0124; &#0124;c1_rec.comparison_operator &#0124; &#0124; '''' &#0124; &#0124; c1_rec.value &#0124; &#0124; '''' &#0124; &#0124; c1_rec.paren2 &#0124; &#0124; ' '&#0124; &#0124; c1_rec.and_or &#0124; &#0124; ' ';
    elsif c1_rec.field = 'program' then
    big_if:=big_if &#0124; &#0124; 'check_program' &#0124; &#0124;c1_rec.comparison_operator &#0124; &#0124; '''' &#0124; &#0124; c1_rec.value &#0124; &#0124; '''' &#0124; &#0124; c1_rec.paren2 &#0124; &#0124; ' '&#0124; &#0124; c1_rec.and_or &#0124; &#0124; ' ';
    end if;
    end loop;
    end;
    message(big_if); pause;
    message(check_state); pause;
    message(check_region); pause;
    message(check_program); pause;
    rcdb.check_if(big_if,result,check_state,check_region,check_program);
    message('resulte = &#0124; &#0124;result&#0124; &#0124;');
    if result = 'TRUE' then insert_record;
    else
    message ('you cant enter');
    end if;
    end if;
    end;
    AND THE CODE IN THE PROCEDURE IS....
    create or replace procedure check_if (
    big_if in varchar2,
    result out varchar2,
    check_state in varchar2,
    check_region in varchar2,
    check_program in varchar2
    IS
    v_indx binary_integer := 0;
    v_sql_syntax varchar2(32767);
    root_cursor number;
    ignore integer;
    your_if_statement VARCHAR2(32767);
    v_check VARCHAR2(5);
    BEGIN
    your_if_statement := ' if '&#0124; &#0124;big_if&#0124; &#0124;' then :v_check := ''TRUE''; end if;';
    v_sql_syntax := 'begin '&#0124; &#0124;your_if_statement&#0124; &#0124;' end;';
    root_cursor := dbms_sql.open_cursor;
    v_sql_syntax := replace(replace(REPLACE(v_sql_syntax,chr(10),' '),chr(13),' '),chr(9),' ');
    dbms_sql.parse(root_cursor,v_sql_syntax,dbms_sql.v7);
    dbms_sql.bind_variable( root_cursor, ':v_check',v_check,5);
    ignore := dbms_sql.execute(root_cursor);
    dbms_sql.variable_value(root_cursor, ':v_check', v_check);
    if v_check = 'TRUE' then result:='TRUE';
    else
    result:='FALSE';
    end if;
    dbms_sql.close_cursor(root_cursor);
    END check_if;
    DO YOU KNOW WHATS WRONG?

  • Before or After insert trigger on HR_API_TRANSACTION_VALUES

    I am on the termination page of SSHR and after entering the details when clcked on 'Next' the validations built in before / after insert trigger of HR_API_TRANSACTION_VALUES does not retrieve the data and the error 'No data found' is displayed.
    We do not have AME approval. When clicked on 'Next' it goes to the review page. When I do a select on the HR_API_TRANSACTION_VALUES the data do exists but the validation does not work.
    We have Oracle HRMS 11i with database as 11g.
    Please give a resolution at the earliest.

    you can use
    hr_transaction_api.set_varchar2_value
    or
    hr_transaction_api.set_number_value
    based on what type of value that you want to update

  • Error in after insert trigger

    Hello all,
    I have a question about after insert trigger. Will be new row inserted and commited if after insert trigger returns error? Thank you.
    regards,
    Miha

    What is the error that u r facing?
    there could multiple reasons for that. Basically, u can't put commit in the trigger (unless it is an autonomous transaction). Share the pseudo-code of u r triiger, so that , problem can be identified.
    Cheers,
    Ram Kanala

  • Parent - Child Table Insert Trigger

    Hello,
    I need some help with an Insert Trigger. I want to Insert some field data from 'Table A' to 'Table B' based on a PK and FK. Does anyone have any sample code?
    <code>
    Table A
    SEQ_NO --PK
    FIELD A
    FIELD B
    FIELD C
    Table B
    FK_SEQ_NO
    FIELD B
    FIELD C
    <code>
    When data is saved in 'Table A' I need to populate the 'FK_SEQ_NO' based on the saved value from 'Table A' 'SEQ_NO' along with the FIELD B and FIELD C values saved to Table B.
    Any help is really appreciated, thanks.

    Hi,
    How about this:
    create or replace TRIGGER rmdb_work_packages_biudr_trg
    BEFORE INSERT OR UPDATE OR DELETE ON rmdb_work_packages
    FOR EACH ROW
    DECLARE
      l_module_name          CONSTANT VARCHAR2(100) :=  'tpsdev.rmdb_work_packages_biudr_trg';
    BEGIN
      IF INSERTING THEN
        -- generate a PK sequence if not already set
        IF :new.work_package_id IS NULL THEN
          SELECT rmdb_work_packages_seq.NEXTVAL
          INTO :new.work_package_id
          FROM dual;
        END IF;
        -- populate audit columns
        :NEW.created_by := NVL(v('APP_USER'),user);
        :NEW.creation_date := SYSDATE;
      END IF;
      IF INSERTING OR UPDATING THEN
        IF :new.business_sign_off_flag IS NULL THEN
          -- set the business_sign_off_flag = 'N' if it is null
          :new.business_sign_off_flag := 'N';
        END IF;
        IF :new.at_risk_flag IS NULL THEN
          -- set the at_risk_flag = 'N' if it is null
          :new.at_risk_flag := 'N';
        END IF;
        IF :new.resource_required_flag IS NULL THEN
          -- set the resource_required_flag = 'Y' if it is null
          :new.resource_required_flag := 'N';
        END IF;
        IF :new.contains_patches_flag IS NULL THEN
          -- set the contains_patches_flag = 'Y' if it is null
          :new.contains_patches_flag := 'N';
        END IF;
        -- populate audit columns
        :NEW.last_updated_by := NVL(v('APP_USER'),user);
        :NEW.last_update_date := SYSDATE;
      END IF;
      IF INSERTING THEN
        INSERT INTO RMDB_WP_HISTORY
        WORK_PACKAGE_ID,
        PROJECT_ID,
        SERVICE_ID,
        RELEASE_ID,
        NAME,
        DESCRIPTION,
        COMMENTS,
        WP_TYPE_CODE,
        RESOURCE_REQUIRED_FLAG,
        WP_STATUS_CODE,
        CHANGE_PROBABILITY_CODE,
        CHANGE_IMPACT_CODE,
        APP_USER_ID_OWNER,
        APP_USER_ID_DEPUTY,
        WP_PRIORITY_CODE,
        PRIORITY_JUSTIFICATION,
        REQUIRED_LIVE_DATE,
        BUSINESS_SIGN_OFF_FLAG,
        AT_RISK_FLAG,
        CONTAINS_PATCHES_FLAG,
        PM_REFERENCE,
        MARVAL_NUMBER,
        RCD_NOTES,
        CREATED_BY,
        CREATION_DATE,
        LAST_UPDATED_BY,
        LAST_UPDATE_DATE
        VALUES
       :NEW.WORK_PACKAGE_ID,
       :NEW.PROJECT_ID,
       :NEW.SERVICE_ID,
       :NEW.RELEASE_ID,
       :NEW.NAME,
       :NEW.DESCRIPTION,
       :NEW.COMMENTS,
       :NEW.WP_TYPE_CODE,
       :NEW.RESOURCE_REQUIRED_FLAG,
       :NEW.WP_STATUS_CODE,
       :NEW.CHANGE_PROBABILITY_CODE,
       :NEW.CHANGE_IMPACT_CODE,
       :NEW.APP_USER_ID_OWNER,
       :NEW.APP_USER_ID_DEPUTY,
       :NEW.WP_PRIORITY_CODE,
       :NEW.PRIORITY_JUSTIFICATION,
       :NEW.REQUIRED_LIVE_DATE,
       :NEW.BUSINESS_SIGN_OFF_FLAG,
       :NEW.AT_RISK_FLAG,
       :NEW.CONTAINS_PATCHES_FLAG,
       :NEW.PM_REFERENCE,
       :NEW.MARVAL_NUMBER,
       :NEW.RCD_NOTES,
       :NEW.CREATED_BY,
       :NEW.CREATION_DATE,
       :NEW.LAST_UPDATED_BY,
       :NEW.LAST_UPDATE_DATE  
      END IF;
      IF UPDATING THEN
        INSERT INTO RMDB_WP_HISTORY
        WORK_PACKAGE_ID,
        PROJECT_ID,
        SERVICE_ID,
        RELEASE_ID,
        NAME,
        DESCRIPTION,
        COMMENTS,
        WP_TYPE_CODE,
        RESOURCE_REQUIRED_FLAG,
        WP_STATUS_CODE,
        CHANGE_PROBABILITY_CODE,
        CHANGE_IMPACT_CODE,
        APP_USER_ID_OWNER,
        APP_USER_ID_DEPUTY,
        WP_PRIORITY_CODE,
        PRIORITY_JUSTIFICATION,
        REQUIRED_LIVE_DATE,
        BUSINESS_SIGN_OFF_FLAG,
        AT_RISK_FLAG,
        CONTAINS_PATCHES_FLAG,
        PM_REFERENCE,
        MARVAL_NUMBER,
        RCD_NOTES,
        CREATED_BY,
        CREATION_DATE,
        LAST_UPDATED_BY,
        LAST_UPDATE_DATE
        VALUES
        :NEW.WORK_PACKAGE_ID,
        :NEW.PROJECT_ID,
        :NEW.SERVICE_ID,
        :NEW.RELEASE_ID,
        :NEW.NAME,
        :NEW.DESCRIPTION,
        :NEW.COMMENTS,
        :NEW.WP_TYPE_CODE,
        :NEW.RESOURCE_REQUIRED_FLAG,
        :NEW.WP_STATUS_CODE,
        :NEW.CHANGE_PROBABILITY_CODE,
        :NEW.CHANGE_IMPACT_CODE,
        :NEW.APP_USER_ID_OWNER,
        :NEW.APP_USER_ID_DEPUTY,
        :NEW.WP_PRIORITY_CODE,
        :NEW.PRIORITY_JUSTIFICATION,
        :NEW.REQUIRED_LIVE_DATE,
        :NEW.BUSINESS_SIGN_OFF_FLAG,
        :NEW.AT_RISK_FLAG,
        :NEW.CONTAINS_PATCHES_FLAG,
        :NEW.PM_REFERENCE,
        :NEW.MARVAL_NUMBER,
        :NEW.RCD_NOTES,
        :NEW.CREATED_BY,
        :NEW.CREATION_DATE,
        :NEW.LAST_UPDATED_BY,
        :NEW.LAST_UPDATE_DATE
      END IF;
      IF DELETING THEN
        DELETE FROM RMDB_WP_HISTORY
        WHERE WORK_PACKAGE_ID = :NEW.WORK_PACKAGE_ID;
      END IF;
    END rmdb_work_packages_biudr_trg; There is also a trigger on the child table:
    create or replace TRIGGER RMDB_WP_HISTORY_BIUDR_TRG
    BEFORE INSERT OR UPDATE OR DELETE ON RMDB_WP_HISTORY
    FOR EACH ROW
    BEGIN
      IF INSERTING THEN
        -- generate a PK sequence if not already set
        IF :new.WP_HISTORY_ID    IS NULL THEN
           SELECT RMDB_WP_HISTORY_SEQ.NEXTVAL
           INTO :new.WP_HISTORY_ID
           FROM dual;
        END IF;
      END IF;
    END RMDB_WP_HISTORY_BIUDR_TRG; Does that help?
    Regards,
    Martin

  • Calling of Stored Procedure in After Insert Trigger

    Can I call a Stored Procedure in After Insert Trigger ?
    Please send a sample code (good example) of After Insert Trigger.
    Thanks.

    Kishore,
    I have two table WLCS_ORDER, WLCS_ORDER_LINE
    WLCS_ORDER - It holds order header information like
    ORDER_ID
    CUSTOMER_ID
    TRANSACTION_ID
    STATUS
    ORDER_DATE
    SHIPPING_METHOD
    SHIPPING_AMOUNT
    SHIPPING_CURRENCY
    PRICE_AMOUNT
    PRICE_CURRENCY
    SHIPPING_GEOCODE
    SHIPPING_STREET1
    SHIPPING_STREET2
    SHIPPING_CITY
    SHIPPING_STATE
    SHIPPING_COUNTRY
    SHIPPING_POBOX
    SHIPPING_COUNTY
    SHIPPING_POSTAL_CODE
    SHIPPING_POSTAL_CODE_TYPE
    SPECIAL_INSTRUCTIONS
    SPLITTING_PREFERENCE
    ORDER_SUBTOTAL
    WLCS_ORDER_LINE - It holds all order lines information like
    ORDER_LINE_ID
    QUANTITY
    PRODUCT_ID
    TAX_AMOUNT
    TAX_CURRENCY
    SHIPPING_AMOUNT
    SHIPPING_CURRENCY
    UNIT_PRICE_AMOUNT
    UNIT_PRICE_CURRENCY
    MSRP_AMOUNT
    MSRP_CURRENCY
    DESCRIPTION
    ORDER_ID
    TOTAL_LINE_AMOUNT
    Relation between WLCS_ORDER, WLCS_ORDER_LINE is one to many.
    For each WLCS_ORDER row, one or more order lines will insert into WLCS_ORDER_LINE table.
    For each new row in WLCS_ORDER table, I have to update the following columns in both the tables with my maths.
    WLCS_ORDER
    shipping_amount
    price_amount
    order_subtotal
    WLCS_ORDER_LINE
    shipping_amount
    I thought I can do this in after insert trigger, But if it is not possible, Please give the best way to fulfill this requirement.
    I appreciate your help.
    Have a great day.
    Srinivas

  • Problem with forms6i using Pre-Insert Trigger

    I created a block level pre-insert trigger to do some validations and when I save the first time with wrong data it is working fine and popping up alerts that I defined but if I press save the second time it is saving even though the data is wrong.
    This is in Applications 11.5.10 using all the property classes and running on the server.
    I created exact replica of the form(no applications, property classes
    just basic form but with same functionality) and ran it on my local machine it is working fine. It is giving error till the data is fixed.
    Anybody know why?
    Thanks in advance

    It did not work. It is still doing the samething. Actually it is popping up my alerts but saving the record first time itself. Is there any way I can tell it not to save if the data is wrong. My code is below it basically pops up the alerts but doesn't tell anywhere not to save it.
    Thanks
    VJ
    declare
         v_amount number;
         alert_id      ALERT := Find_Alert('amount_from');
         alert_id1 ALERT := Find_Alert('amount_to');
         dummy_var NUMBER;
    begin
         select max(ssibe_amount_to) into v_amount from ssibe_orderappr_tab where
              ssibe_account_number = :ssibe_orderappr.ssibe_account_number;
              if :ssibe_orderappr.ssibe_amount_from <= v_amount
              then
                   Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, 'Amount_From should be greater than '|| v_amount);
                   dummy_var := Show_Alert(alert_id);
              else
                   IF (:SSIBE_ORDERAPPR.SSIBE_AMOUNT_TO <= :SSIBE_ORDERAPPR.SSIBE_AMOUNT_FROM)
                   THEN
                   dummy_var := Show_Alert(alert_id1);
                   end if;
              end if;
    end;

  • Pre-insert trigger is not firing after post built-in

    Hi,
    I have a 10g form in which Post built-in is used in When-button-pressed Trigger. After the post command I am checking some condition,by using the same record which I have posted.But it is not working.
    I have also put the message in the pre-insert trigger but the message is not displaying.
    But the same form iis working fine in form 6i, as I have migrated the forms from form 6i to 10g.

    Yes, In that block there are other items also. I have made the required property no for all the items.
    what exactly we have is
    (if x=y then)on some condition check
    POST;
    After that, form have a select statement in which it is selecting the same row which is being posted above.
    if the select statement gives count of row zero
    raise form_trigger_failure is fired.
    and in the pre-insert trigger form is assigning a value to a block item.

  • Query in the Insert Trigger not taking :new reference

    I am writing an insert trigger on " iby_ext_bank_accounts" table to track the Bank account changes for a Supplier and Site. During the trigger I am Using a query to get the values for Supplier and sites related to the bank account.
    I use a reference :new.ext_bank_account_id and the query return nothing. So during the triiger I cannot capture the supplier info. '
    I am sure there is a value for :new.ext_bank_account_id because it is inserted into my custom tracking table. But in the query it is not passing.
    Everything is woking during the update
    Any one has any Suggestions. The Environment is Oracle apps R12 - Table : iby_ext_bank_accounts
    Thanks for help
    George Thomas
    Here is the query in the trigger
    party_supp.party_id supplier_id
    ,party_supp.party_name supplier_name
    , aps.segment1 supplier_number
    , ass.vendor_site_id Site_id
    , ass.vendor_site_code site_code
    , party_bank.party_name bank_name
    , branch_prof.bank_or_branch_number bank_number
    , party_branch.party_name branch_name
    , party_branch.party_id branch_id
    , branch_prof.bank_or_branch_number branch_number
    FROM ar.hz_parties party_supp
    , ap.ap_suppliers aps
    , ar.hz_party_sites site_supp
    , ap.ap_supplier_sites_all ass
    , iby.iby_external_payees_all iep
    , iby.iby_pmt_instr_uses_all ipi
    , ar.hz_parties party_bank
    , ar.hz_parties party_branch
    , ar.hz_organization_profiles bank_prof
    , ar.hz_organization_profiles branch_prof
    WHERE party_supp.party_id = aps.party_id
    AND party_supp.party_id = site_supp.party_id
    AND site_supp.party_site_id = ass.party_site_id
    AND ass.vendor_id = aps.vendor_id
    AND iep.payee_party_id = party_supp.party_id
    AND iep.party_site_id = site_supp.party_site_id
    AND iep.supplier_site_id = ass.vendor_site_id
    AND iep.ext_payee_id = ipi.ext_pmt_party_id
    AND ipi.instrument_id = 1041--:new.ext_bank_account_id
    AND :new.bank_id = party_bank.party_id
    AND :new.branch_id = party_branch.party_id
    AND party_branch.party_id = branch_prof.party_id
    AND party_bank.party_id = bank_prof.party_id ;

    There is absolutely no reason that you would need to resort to adding an SP to your database. This can be done directly within the CR command. Just make sure you have the parameters added to the parameter list in the command itself.
    If the query will run in SSMS it will run id a CR command. Just remember, CR will do a direct swap the parameter value withing the SQL code. For example...
    The value of {?Parameter1} is "Hat", and you command reads like this...
    SELECT
    Column1,
    Column2,
    Column3
    FROM ProductsTable
    WHERE ProductName = '{?Parameter1}'
    CR will pass the following SQL to the server
    SELECT
    Column1,
    Column2,
    Column3
    FROM ProductsTable
    WHERE ProductName = 'Hat'
    If you write your SQL like this...
    SELECT
    Column1,
    Column2,
    Column3
    FROM ProductsTable
    WHERE ProductName = {?Parameter1}
    It will fail because it's trying to pass this...
    SELECT
    Column1,
    Column2,
    Column3
    FROM ProductsTable
    WHERE ProductName = Hat
    and text values need to wrapped in single quotes...
    HTH,
    Jason

  • INSERTstatement is not working if there is a before insert trigger

    INSERTstatement is not working if there is a before insert trigger on that table. That trigger contains an insert to another table which having the main table reference.
    Let us say, for example there a table named 'EMP_DEPT' and there is a before insert trigger on this table.
    In this trigger inserting a record in to another table named 'AUDIT_EMP' and in this table using EMP_Dept primary key as foreign key.
    Table EMP_DEPT is having the below columns:
    EMP_DEPT_SYS_ID
    EMP_DEPT_NO
    DEP_NAME etc..
    Table AUDIT_EMP is having the below columns:
    AUDIT_EMP_SYS_ID
    EMP_DEPT_SYS_ID
    AUDIT_NO etc..
    the code in the trigger is
    INSERT INTO audit_emp
    (audit_emp_sys_id, emp_dept_sys_id, audit_no
    VALUES (audit_emp.NEXTVAL, :new EMP_DEPT_SYS_ID, '1101'
    Now when you execute the insert query like:
    INSERT INTO emp_dept
    (emp_dept_sys_id, emp_dept_no, dep_name
    VALUES (EMP_DEPT.nextval, 1001, 'Dep-1'
    It is giving the error saying 'Integrity constraint error, parent key not found' from the trigger.
    But, when you modify the above insert query like the below then it is working.
    INSERT INTO emp_dept
    (emp_dept_sys_id, emp_dept_no, dep_name
    SELECT EMP_DEPT.nextval, 1001, 'Dep-1'
    FROM DUAL;
    I am using Oracle 10g.
    Why the insert into values is not working. Is there any commit transaction sequence change? Any idea please?
    Edited by: user6475632 on Sep 16, 2009 7:08 AM

    Obviously the code you posted can not work.
    You are inserting the detail record (the audit record) before the master record, where it should have been after. IMO, you should fire the trigger AFTER INSERT for each row.
    If that still doesn't work, you need to change the foreign key constraint into a deferred constraint, which is evaluated at commit, instead of immediately. The SQL reference manual has further info on this.
    'Oracle 10g' is considered a marketing label here, not a -4 digit- version.
    Sybrand Bakker
    Senior Oracle DBA

  • Execution of ddl statement  in post-insert trigger

    hi,
    I'm working on headstart 6.5. I wants to execute a DDL statement in post-insert-trigger.The problem is this trigger is executed in between pre-commit and post-forms-commit.In pre-commit the transaction is opened with a insert statement that is inserting "open" in field status which is having a deffered check constraint QMS_NEED_TO_CLOSE_TRANSACTION.In post-forms-commit it will check whether the transaction is open if yes will check the business rule will delete the data that was inserted into qms_transaction in pre-commit trigger and will close the transaction .
         In between if i execute a DDl statement a commit will be performed on the insert statement written in pre-commit trigger.This will violate the check-constraint and we will get the error qms_need_to_close_transaction violated.
         My business logic wants this statement to be executed at the post-insert trigger on the block.Is this possible??
         Does anyone have face the same problem?Whts the workaround for the same?

    Hello,
    You could use the execute_query after the commit_form called, by exeample in a KEY-COMMIT trigger.
    KEY-COMMIT trigger
      Commit_Form ;
      Go_block( 'master_block' ) ;
      Execute_Query ;Francois

  • Using sequence in insert trigger?

    Hi all,
    I'm new to this forum, and for that matter, any forums related to computers.
    I would appreciate it if anyone would give me some hinters.
    I created a table with an ID column of type "Number." And I want to populate that column with a sequence number everytime I insert into that table.
    I have a sequence named "sequence1_account."
    Below is my insert trigger code:
    create TRIGGER system.trigger1_account
    BEFORE INSERT ON system.table_account
    for each row
    BEGIN
    :new.id := sequence1_account.NextVal;
    END;
    Note:
    user is "system"
    table is "table_account"
    The error that I get when I try to compile this is
    PLS-00357: Table,View Or Sequence reference 'SEQUENCE1_ACCOUNT.NEXTVAL' not allowed in this context
    So, does that mean I cannot use a sequence in a trigger?
    Thanks in advance!
    in His love,
    HS

    Hello,
    Hoping for some help with sequence triggers as well.
    CREATE TRIGGER "SCALS"."TRIGGER_CALL_NUM"
    BEFORE INSERT ON "CALLLOG" FOR EACH ROW
    BEGIN
    select num_callers.NextVal into : new.callernumber from dual;
    END;
    Problem is that the trigger status is invalid ??
    The error I get is in German (German installation)
    Zeilen-# = 0 Spalten-# = 0 Fehlertext = PLS-00801: internal error [ph2csql_strdef_to_diana:bind]
    Zeilen-# = 2 Spalten-# = 57 Fehlertext = PL/SQL: ORA-06544: PL/SQL: internal error, arguments: [ph2csql_strdef_to_diana:bind], [], [], [], [], [], [], []
    Zeilen-# = 2 Spalten-# = 1 Fehlertext = PL/SQL: SQL Statement ignored
    But perhaps something looks familiar???

  • Errors with post-insert trigger

    I had a POST-INSERT TRIGGER here.but i encountered some problems.can someone help me with the errors?
    begin
         insert into user_acct
         userid_n, user_m, coy_c, contact_n, emp_n,
         work_loc_c, curr_passwd_t, prt_f, indv_pc_f, pc_deploy_c,      
         ext_email_addr_t, other_na_sys_t, status_c, status_rmk_t, upd_d)
         values
         (:user_acct.userid_n, :user_acct.user_m, :user_acct.coy_c, :user_acct.contact_n, :user_acct.emp_n,
         :user_acct.work_loc_c, :user_acct.curr_passwd_t, :user_acct.prt_f, :user_acct.indv_pc_f, :user_acct.pc_deploy_c,                
         :user_acct.ext_email_addr_t, :user_acct.other_na_sys_t, :user_acct.status_c, :user_acct.status_rmk_t,                
         :user_acct.upd_d);
         exception
              when others then
                   clear_message;
                   Message('Insertion of Applicant Particulars failed');
                   SYNCHRONIZE;
                   RAISE Form_Trigger_failure;
    end;
    begin
    insert into user_acct_na_detl
         na_sys_c)
         values
         (:na_sys_cd.na_sys_c);
         exception
              when others then
                   clear_message;
                   Message('Insertion of Non-Application failed');
                   SYNCHRONIZE;
                   RAISE Form_Trigger_failure;
    end;
              when others then
                   null;      
    end;     
    the error:
    Error 103 at line 31, column 3
    Encountered the symbol 'WHEN' when expecting one if the following:
    begin declare end exception exit for goto if loop mod null
    pragma raise return select update while <an identifier>
    <a double-quoted delimited-identifier><a bind variable><<
    close current delete fetch lock insert open rollback
    savepoint set sql commit<a single-quoted SQL string>
    The symbol "exception"was substituted for "WHEN" to continue
    Error 103 at line 2, column 1
    Encountered the symbol "END"

    i delete the "END" already but when i compile again, i encountered some error again.
    Error 370 at line 27, column
    OTHERS handler must be last among the exception handlers of a block
    Error 0 at line 1, column 1
    Statement ignored

Maybe you are looking for

  • IT0009-Payment method 'Cash'

    In IT0009(Bank details) if we set the payment method 'blank' which is for cash payment,system is asking for fiilling up the bank a/c and bank key number.It's something which is not supporting the functionality. I am sure there much be some config tab

  • HELP! opening a file allowed in the project

    Hi, I'd like to create and program a UI textfield in which the user writes the name of a .pdf file (there are different pdf files allowed in the project), so that the app decides which of this files opens. The textfield will have to fill the: URLForR

  • Can previously bought apps be re-installed without being charged again on my account?

    I upgraded my IPad to IOS5, did the back-up and synced files from iTunes back to my IPad. However, just this morning, I noticed that some of my previously installed apps (Talking Animals) weren't saved on the iTunes Library or any other location wher

  • SSO with WindowsAD and SAP Auth

    Hi,       we have heterogenous systems. We have reports based on oracle database and sapBW. currently we are using windows AD authentication for SSO to Oracle Database. but is it possible to use WindowsAD for oracle and SAP authentication for SAP BW?

  • Restart session from Failover point

    Hi, ODI process loading 10 million rows from Oracle to Oracle (same instance). Process failed half way after 2 hour. Anyone build any framework to restart from failed point? Can we save 2 hours? Regards