Forms update vs. database trigger

Hi,
I learn oracle forms using sample schema HR.
This schema has a trigger "update_job_history" that fires AFTER UPDATE OF "job_id", "department_id" ON "employees"....
Now,( in forms) when I want to update just employee's salary trigger fires.
Forms obviously take all items as being updated as I read from the beginning of error message:
UPDATE EMPLOYEES SET EMPLOYEE_ID=:1,FIRST_NAME=:2,LAST_NAME=:3,EMAIL=:4,PHONE_NUMBER=:5,HIRE_DATE=:6,JOB_ID=:7,SALARY=:8,COMMISSION_PCT=:9,MANAGER_ID=:10,DEPARTMENT_ID=:11 WHERE ROWID=:12 etc.
(This error appears only If I update the same employee the second time - that's when a unique key in job_history table gets violated...)
My question is How can I update only certain items so the triggers fires only when I do update "job_id" or "department_id"
Is it an issue I should take care of in -pre/on-update triggers?
Thanks in advance for any suggestion on how to go about this.

Hello,
Yah, this will surely help. Sorry for my previous post. I was thinking in terms of PL/SQL, but just consults the forms and it a should work fine.
Set Update Changed Columns Only to Yes in the following circumstances:
To save on network traffic, if you know an operator will primarily update only one or two columns.
To avoid re-sending large items that are not updated, such as images or LONGs.
To fire database triggers on changed columns only. For example, if you implement a security scheme with a database trigger that fires when a column has been updated and writes the userid of the person performing the update to a table.

Similar Messages

  • Primary Key - Generated by database TRIGGER

    Hi,
    I have a form with a block that is attached to a table. So far, nothing fancy :-)
    The Primary is generated with an ORACLE SEQUENCE. That is done at the TABLE level with a DATABASE trigger.
    So in the form, the primary field is not populated.
    Works fine. But if the user wants to UPDATE the forms content, right after they did an INITIAL commit, THEY CAN'T !!!!!!!!!!!
    How can I code this in the form?
    Is there a way to syncronize (populate) the primary key in the form with it's table content?
    If so, how do I query the table if I don't have the primary key value ?
    Thanks for ANY advise,
    Marc.

    Another solution is to use both a database trigger and a PRE-INSERT trigger in Forms.
    The database trigger should be something like
    CREATE TRIGGER INS_TABLENAME BEFORE INSERT ON TABLENAME
    FOR EACH ROW WHEN (new.ID IS NULL)
    BEGIN
    SELECT TABLENAME_SEQ.nextval INTO :new.ID FROM DUAL;
    END;
    and the PRE-INSERT trigger should be something like:
    SELECT TABLENAME_SEQ.nextval INTO :blockname.ID FROM DUAL;
    This way one solves the problem of DML RETURNING VALUE not working in Forms with Oracle version > 8 (does it work on version 8 as it is said to be? - i have not tested it anyway) and the use of other applications (SQL*Plus, JAVA, etc) without writing any code.

  • STORED PROCEDURE & DATABASE TRIGGER

    제품 : FORMS
    작성날짜 : 1995-11-07
    * STORED PROCEDURE
    1. Oracle Forms 4.5에서는 PL/SQL Code를 Server-Side에 저장하거나 Forms 내 Trigger, Procedure로 갖을 수도 있다.
    다음과 같은 경우 Procedure를 Database Server에 저장하는 방법을 선택하는
    것이 좋다.
    - Procedure가 Standard한 기능을 제공하여 다른 Tool이 공유할 수 있을 때.
    - Procedure가 중요한 DML 기능을 가질 경우.
    - Oracle Forms 4.5에서는 PL/SQL의 Version을 1.1까지 지원하므로, PL/SQL
    Version 2.X 의 기능이 필요한 경우.
    2. Stored Procedure의 제한사항
    (1) Server가 7.0 이상이어야 한다.
    (2) Pass되는 Variable은 2000 Byte이하이어야 한다.
    - 2000이 넘으면 Truncate가 되고, PL/SQL에서 Value_Error Exception이
    발생한다.
    (3) Menu PL/SQL에서는 Stored Procedure와 Function을 부를 수 없다.
    (4) Stored Subprogram의 정의가 바뀐 경우, Forms를 다시 Server와 Connect
    하기 전에는 영향을 주지 않는다.
    3. Oracle 7 Server 에서 제공하는 Standard Package들
    - dbms_alert
    - dbms_ddl
    - dbms_describe
    - dbms_lock
    - dbms_mail
    - dbms_output
    - dbms_pipe
    - dbms_session
    - dbms_snapshot
    - dbms_standard
    - dbms_transaction
    - dbms_utility
    < Oracle7 Developers Guide 참조>
    4. Calling Stored Procedures
    (1) Database Procedure는 Server-Side PL/SQL Engine에 의해 실행되도록
    Design된 PL/SQL Block이다.
    (2) Stored Procedure를 Call하기 위해서는 EXECUTE Privilege가 필요하다.
    (3) Server-Side Procedure와 Forms에서의 PL/SQL의 중요한 차이점은
    Server-Side 에서는 Forms의 Bind Variable (:Block_Name.Item_Name 등)
    을 인식하지 못한다는 것이다.
    (4) Parameter/Return이 가능한 Data Type
    - VARCHAR2 : Maximum of Varchar2(2000)
    - NUMBER
    - DATE
    - BOOLEAN
    제한사항
    - TABLE%ROWTYPE, TABLE.COLUMN%ROWTYPE으로 정의된 것은 Reference가
    안된다.
    - Unsupported Parameter나 Return Value를 사용하면 다음의 Error가
    발생한다.
    * PL/SQL error 313 at line xxx, column yyy 'PROCNAME'
    not declared in this scope.
    * PL/SQL error 201 at line xxx, column yyy identifier 'FUNCTNAME'
    must be declared.
    (5) Formal Parameter의 Default Value
    - Defulat Value는 제공하지 않는다.
    - User가 임의로 줄 수 있다.
    - Procedure Private_Test(a in VARCHAR2 := 'Hello' b in
    VARCHAR2 := 'There') IS
    BEGIN
    Dbms_Output.Put_Line(a);
    Dbms_Output.Put_Line(b);
    END;
    (6) 다른 User의 Stored Subprogram이나 Remote Database를 Call하려면
    - User Name이나 Database Link명을 숨기기 위하여 Synonym을 생성하여야
    한다.
    - CREATE SYNONYM lib_hr_syn FOR libowner.lib_hr;
    - Program에서 Call할 때에는 ss_num ;= lib_hr_syn.get_ssn(:EMP.EMPNO);
    5. PL/SQL Compiler가 해당 Procedure를 찾는 순서
    (1) Current PL/SQL Block 내에 정의되어 있는가?
    (2) Standard PL/SQL Command인가?
    (3) Oracle Forms 내의 Built-in Procedure 혹은 Function인가?
    (4) User_Named Procedure 혹은 Function인가?
    (5) Server-side에 정의된 DBMS_STANDARD Package인가?
    (6) Current user가 Server-Side의 어떤 Procedure나 Function을 Access
    하는가?
    * 이상의 질문에 대하여 전부 'NO'라는 대답이 나오면 Compiler는 다음과 같은
    Error Message를 준다.
    - PL/SQL error 313 at line xxx, column yyy 'PROCNAME' not declared in
    this scope.
    - PL/SQL error 201 at line xxx, column yyy identifier 'FUNCTNAME'
    must be declared.
    * DATABASE TRIGGER
    1. Database Trigger는 Forms에서의 Trigger와 개념적으로 거의 동일하다.
    차이점은 Trigger가 Fire되는 원인을 제공하는 사건과 후속코드가 실행되는
    장소가 틀린 것이다.
    2. Database Trigger는 Table과 연관된 PL/SQL Block들이다. Table에 대한
    UPDATE, INSERT, DELETE 등의 행위에 의해 Fire된다.
    3. Error 발생 시에는 RAISE_APPLICATION_ERROR Built-In Procedure를 사용하
    여 Error를 표시한다.
    RAISE_APPLICATION_ERROR Procedure에서는 Error Number가 20000 - 20999의
    Range를 가진다.
    4. Creating & Editing Database Triggers
    아래와 같은 적절한 권한이 주어진다면 Forms Designer Mode에서 Database
    Trigger를 직접 Create, Edit, Compile, Browse 할 수 있다.
    - Execute Privilege, Create Privilege, Compile Privilege,
    Drop Privilege
    * Create하려면
    - Navigator에서 Database Objects와 Table Nodes를 Expand한다.
    - 원하는 Table을 선택하고 Expand한다.
    - Triggers Nodes를 선택하고 Menu Bar의 Navigator*Create를 선택한다.
    - Database Trigger Editor에서 작성, compile한다.
    * Edit 하려면
    - Navigator에서 Database Objects와 Table Nodes를 Expand한다.
    - 원하는 Table을 선택하고 Expand한다.
    - 원하는 Trigger에서 Double-Click하면 Editor가 나타난다.
    - Database Trigger Editor에서 변경, compile한다.

    not possible via forms
    you can debug it on SQL Developer by using manual INSERT Updates commands

  • Re: send message from the database trigger(URGENT)

    Hi,
    I am using forms 6.0 and oracle 8.0. My question is I am calling a stored procedure in the BEFORE UPDATE TRIGGER on database. This trigger will be fired and update another table(table B) when user update any record in the forms based on different table (table A).
    I want to pass the message to the forms from the database trigger when records gets updated in the database e.g. (10 records are updated). Since I am not calling my database procedure from the forms, rather it is being called from the database trigger, How can i display message to the forms.
    Thanks all your help in advance.

    Thanks Parker for ur reply but that subprogram raise_application_error only works if there is an error in the store procedure. But in my case there is no error, I just need to pass a message saying that e.g. "12 rows updated". How can I pass this message from the database trigger to the forms application.
    Thanks

  • Multiple Rows Update / Refresh Toplink Query when database trigger involved

    Hi everybody!
    I have two easy troubles for you; the platform is the same as the SRDemo Toplink version.
    1.     Multiple Rows Update: I want to update with mergeEntity method, multiple rows for an isolated table; that method receives a parameter that I try to bind with the iterator "dataProvider" but it only merges the first row, not all, any other combination returns an error.
    What I want to do is to have a form (like tabular forms in Apex) that lets me update multiple rows in a single page. ¿May anyone tell me how to do it?
    2.     Refresh Toplink Named Query: I have a list on a page with two columns. From another page, a button does an action that fires a database trigger that updates one of the columns on the list´s page. When I go back to the list, it is not updated; however, the CacheResults´s property is set to false on the iterator.
    Thanks in advance,
    Alejandro T

    I didn't use it (yet), but - you might take a look. You'll find a [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html]Timer plug-in on this page. It is a dynamic action which allows you to periodically fire other dynamic actions in the browser. For example use the timer to refresh a region every five minutes. You can perform any dynamic action you want using this infrastructure.So I was thinking: you might use it to run a dynamic action which would check whether something changed in that table (I suppose you'll know the way) (for example, a database trigger might set a flag in some table, timestamp or similar), and - if you find that something really changed - refresh the page.
    As I said, I never used it so that's pure theory. Someone else might know better, though.

  • Could the Database Trigger get a forms variable value

    Hi All
    We have an ERP which connect all users of the system with a single schema (Database user name), We create a record for each user in the ERP itself to specify the privillages for each user
    I would like to make a database trigger to Audit a table , by storing the user name, action (Insert,delete,update) on an audit table.
    The problem is the user name i want to store is not the schema name, but it's stored in a database table and read in a global variable.
    Can i get the user name (which stored in the global variable) in the database trigger ???
    Thanks
    Mostafa Abolaynain

    If this global variable lives inside Forms (which the title of your post seems to indicate), then no.
    A database trigger can only reference "stuff" that lives inside the database session at the database server, not "stuff" that lives inside the proces at the client device.
    You should ask your ERP vendor: there might very well be something (eg. a variable inside a database package) that you can use.

  • Form Navigation problem while firing Database trigger

    Hi,
    A Database trigger is made to fire when a field is updated via forms and the trigger will give an error if the user is not authorized to modify the data. Everything is working fine and the trigger gives an error as palnned. After the error is thrown, we are unable to navigate between the forms and in addition we are uanble to perform any sort of actions like querying, deleting and cancelling. On Occasion we get errors like I/O buffer error and the errors keep on changing for every update. Plz help me to resolve the issue.
    RgDs,
    M KVG

    In addition to the Error Message you are getting, it would be helpful to know which version of Oracle Forms you are using and how your application is deployed (Client/Server or Web). If you app is web deployed, then also include the Java Runtime Environment version and your web browser and version.
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Commit of master-detail view with database trigger on update

    [ADF Jdev11 question]
    My case is the following:
    I have master form, with detail table attatched to it (using view link).
    On update of master table, there is a database trigger which makes changes in the detail table.
    As commit action commits both of the tables, as a result, I get the following exception:
    "Another user has changed the row with primary key oracle.jbo.Key[000000002017 ]. "
    Do you have any suggestions how can I fix this? Is there a way I can refresh the detail table just after the commit of the master table?
    Marking the updated attributes with "refresh after update" doesn't help at all.

    This trigger is on update of the master table and that is what it does:
    BEGIN
    UPDATE detail_table
    SET smolotpr = :NEW.molotpr,
    smolpol = :NEW.molpol,
    spoluch = :NEW.poluch,
    sotpr = :NEW.otpr,
    SMAKET = :NEW.MAKET,
    sdata_period = :NEW.data_period
    WHERE doknom = :NEW.doknom;
    END;
    Setting the updated attributes "Refresh after update+insert" to true doesn't help at all (maybe because they are in another table)!
    I will be very grateful if you give me any ideas, advice or give the complete solution!

  • Debug Stored procedure or database trigger by 10g Forms

    Hi,
    I want to debug my table level trigger (On update for each row), I am updating this table by forms. When I debug this form I am unable to watch the database debug.
    Please help me regarding database trigger/function/procedures by debugging forms.

    not possible via forms
    you can debug it on SQL Developer by using manual INSERT Updates commands

  • Calling form .fmx or report .rep from database trigger. (URGENT PL.)

    can we call an form (.fmx) or a report (.rep) from a database trigger. that is when there is some insertion in the table i want to call a report which will take the parameters from the table changed.
    regards
    vishal

    JDeveloper and ADF

  • Oracle form based on a view - need to return a value after database trigger

    We have a form based on a view calling database trigger to insert data.
    I need to display a message of the record ID inserted on the form.
    The values to be displayed are ID field.

    Hi,
    if you use process of Automatic Row Processing (DML), you have an option *"Return Key Into Item"*.
    This will return your primary key into item, and then you can display this item as a result.
    Regards,
    Aljaz

  • Database trigger causes error in Form

    I have a database trigger on the per_performance_reviews table. When I try to save a performance review record from the forms I get the following error:
    FRM-40403: A calling form has unapplied changes. Save not allowed.
    Any suggestions???
    Here is my trigger:
    CREATE OR REPLACE TRIGGER APPS.XXPER_UPDATE_PERF_REVIEW
    BEFORE INSERT ON HR.PER_PERFORMANCE_REVIEWS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    l_hire_date DATE;
    l_next_review_Date DATE;
    l_event_type VARCHAR2(40);
    BEGIN
    select papf.START_DATE, pe.type
    into l_hire_date, l_event_type
    from per_all_people_f papf, per_performance_reviews ppr, per_events pe
    where ppr.performance_review_id = :NEW.performance_review_id
    and papf.person_id = ppr.person_id
    and pe.event_id = ppr.event_id
    and sysdate between papf.effective_start_date and papf.effective_end_date;
    l_next_review_date := l_hire_date + (365 * 2);
    IF l_event_type = 'APPRAISAL' THEN
    :NEW.NEXT_PERF_REVIEW_DATE := l_next_review_date;
    END IF;
    END XXPER_UPDATE_PERF_REVIEW;

    There is a forms forum here too.
    However this error message
    FRM-40403: A calling form has unapplied changes. Save not allowed.
    implies that you opend your current form without posting/commiting in the previous form. This is not allowed. Your changes never even touched the database.

  • How to send error message to forms from Database Trigger

    Hi, Please help me to send error message to forms from Database Trigger?
    RgDs,
    Madesh.R.M

    You are correct, the On-Error trigger is a Forms trigger. However, if your Form is going to display the error generated by the database stored procedure or trigger - you might not see the database error in your Form unless you check the DBMS_ERROR_CODE in the On-Error trigger and manually display the Error Code and associated Text. I've see this happen with a co-worker. The Form she was working on was based on a table with an Before-Insert trigger. Because she was not explicitely handling the error from the Before-Insert trigger in the Forms On-Error trigger, her Form appeared to halt for no reason at all. Once she added code to the On-Error trigger in the Form to handle the DBMS_ERROR_CODE, she discovered the trigger was producing an error and was able to show the error to the user in the On-Error trigger.
    I understand the desire to keep as much as possbile in the database, but with that comes some extra coding in your Forms to handle this. This extra coding could easily be placed in a Forms Library, attached to a Form and called in the On-Error trigger. Your code could look like this:
    DECLARE
       /*This example assumes you have an Alert defined
          in your Form called: 'ERROR' */  
       al_id    ALERT;
       al_text  VARCHAR2(200);  /* Max text of a Forms Alert message*/
       al_btn   NUMBER;
    BEGIN
    IF DBMS_ERROR_CODE != 0 THEN
       /* Error code is ORA-00000 Normal Successful completion
           So only handle non-zero errors  */
       al_text := DBMS_ERROR_CODE||':'||DBMS_ERROR_TEXT;
       al_id := Find_Alert('ERROR');
       set_alert_property(al_id, alert_message_text, al_text);
       al_btn := show_alert(al_id);
    END IF;
    END;Your original question was "How to send error message to forms from Database Trigger?" The answer is you don't because Forms already gets the database error code and database message through the Forms DBMS_ERROR_CODE and DBMS_ERROR_TEXT functions. Look these up in the Forms help and it should clear things up for you.
    Craig...
    Edited by: CraigB on Jun 14, 2010 4:49 PM
    Edited by: CraigB on Jun 14, 2010 4:49 PM
    Edited by: CraigB on Jun 14, 2010 4:50 PM
    Edited by: CraigB on Jun 14, 2010 4:51 PM
    Edited by: CraigB on Jun 14, 2010 4:51 PM

  • Trigger only one process task on Process form update

    Hello,
    I'd like to trigger a single process task (a single time) when one or several attributes are updated in a process form.
    any idea how to do that?
    what I don't want to do :)
    - call the same process task on "firstname update" AND on "lastname update" => this process task would be launched twice on a single process form update/save
    thanks in advance for your help

    Create a task with the form name like such:
    UD_ADUSRLX Updated
    This task will trigger any time a value(s) are updated on the form. You will get only a single task, and not individual. But if you add this task, you don't get the option of the other tasks triggering individually.
    -Kevin

  • Database trigger cannot read the updating table

    I want to create a database trigger :
    after insert or update on EMP
    for each row
    begin
    select sum(EMP.salary) from EMP WHERE .....
    end;
    However, I got an error is that I cannot read the updating table if the trigger is 'for each row'. Can anyone help me to to this?
    More, I must use 'for each row' trigger for this case.
    null

    I think the SQL statement should be
    strSQL = "SELECT * FROM MaterialLotJobJoint WHERE JobID=" & _
    tempvars!JobID & " AND MatLotID=" & tempvars!MatLotID
    This assumes thatJobID and MatLotID are number fields.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

Maybe you are looking for

  • Ethernet Won't Connect after 10.5.6 Upgrade

    After doing the upgrade to 10.5.6 on my MacBook Pro, the ethernet port no longer seems to work. The Network preferences panel claims that the cable for Ethernet is not plugged in when it certainly is and works just fine with other computers (Mac and

  • Screen not blanking properly (Backlight doesn't turn off)

    I've been facing a weird problem lately. Whenever I leave my laptop on for a while when I'm logged on in X (I use KDE), the screen turns off after 10 minutes. All well and good. But whenever the laptop idle when logged on to a virtual console, after

  • Change SC from SRM

    Hi Guys, We usually change SC from Web Version , i follow the same thing as of today. I want to know how to change the SC from SRM backend... i mean from SRM Server any T-code for this Rg sameer

  • Vendor Evaluation Scoring methods E & F

    Dear Folks, In the vendor evaluation, I see two scoring methods: E       Determination of Price Variance from Invoice Documents F     Determination of Quantity Variance from Invoice Documents Can anyone advice me how these two scoring methods works?

  • How do you drawlines in java 1.3.1?

    I want to make a applet and drawlines with a xstart, ystart, xend, yend varibles, I know how to declare instantiate and initialize the varibles, but what method from which package and class in java 1.3.1 do I use? and one last question, should I use