Update trigger syntax for multiple collumn update

Hi
I would like to create an update trigger that updates 3 collumns in another table.
This works for one collumn:
CREATE OR REPLACE TRIGGER DBNAME.Update_EVENT
BEFORE UPDATE
ON DBNAME.DB_EVENTS
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
BEGIN
UPDATE DB_EVENT_LOG ELOG
SET
COMPLETION_EVENT = :NEW.COMPLETION_EVENT
     WHERE :OLD.RECORD_ID = ELOG.RECORD_ID ;
EXCEPTION
WHEN OTHERS THEN
-- log the error and re-raise
RAISE;
END ;
but this does not work for multiple collumns:
CREATE OR REPLACE TRIGGER DBNAME.Update_EVENT
BEFORE UPDATE
ON DBNAME.DB_EVENTS
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
BEGIN
UPDATE DB_EVENT_LOG ELOG
SET
(COMPLETION_EVENT
, COMPLETION_DT_TM
, COMPLETED_BY)
=
(:NEW.COMPLETION_EVENT
, :NEW.COMPLETION_DT_TM
, :NEW.COMPLETED_BY)
     WHERE :OLD.RECORD_ID = ELOG.RECORD_ID ;
EXCEPTION
WHEN OTHERS THEN
-- log the error and re-raise
RAISE;
END ;
What am i doing wrong?

Try selecting from DUAL:
SQL> CREATE TABLE emp_test AS SELECT * FROM emp
Table created.
SQL> CREATE OR REPLACE TRIGGER emp_trg
   AFTER UPDATE
   ON emp
   FOR EACH ROW
BEGIN
   UPDATE emp_test
      SET (sal, comm) = (SELECT :NEW.sal,
                                :NEW.comm
                           FROM DUAL)
    WHERE empno = :NEW.empno;
END;
Trigger created.
SQL> UPDATE emp
   SET sal = 5000,
       comm = 5000
WHERE empno = 7369
1 row updated.
SQL> SELECT empno,
       sal,
       comm
  FROM emp_test
WHERE empno = 7369
     EMPNO        SAL       COMM
      7369       5000       5000

Similar Messages

  • Syntax for multiple stoplist devices

    Hi
    I want to stop monitoring certain disk devices on my server. I know there is a file under /etc/opt/SUNWsrsvp called event_pvr_config.cfg. In this file there is a tag called event.device.stoplist. My question is what is the syntax for entering multiple devices? I tried putting multiple tags but it does not looking like it is working because I am still seeing messages going to the /var/adm/messages file.
    Thanks

    A possibilty might be to add code to create a virtual package for graphical-su .
    Here's an example of how this could work in pseudo-code :
    package_backintime_detect_graphical_su_dummy()
    _gksu_installed = false; kdesu_installed = false;
    If gksu is present then _gksu_installed = true ;
    if kdesu is present then _kdesu_installed = true;
    If _gksu_installed OR _kdesu_installed then provides = backintime_graphical_su
    Add a depend on backintime_graphical_su to the gui program and some comments to clarify how to build.

  • PLACEHOLDER Syntax for multiple Input Variables

    Hi,
    I am trying to pass multiple paramter values (not multi-value) it works when the first parameter is passed but does not work when I add the second parameter value. I need to pass 4 different paramters and the statement is below..
    The placeholder sysntax works with hard coded values or only one PARAMETER is passed.... as below...(For clarity I aligned the placeholder syntax....
    FROM "_SYS_BIC"."ZXXXXXX/ZSTAR_OT"
    ('PLACEHOLDER' = ('$$IP_TOMNTH$$', '201302'),
    'PLACEHOLDER' = ('$$IP_FRMNTH$$', '201301'),
    'PLACEHOLDER' = ('$$IP_KOSTL$$', '3001D,3004D'),
    'PLACEHOLDER' = ('$$IP_BUKRS$$', '1000'))
    It works as below. (when one of placeholder is provided a @Prompt as below
    FROM "_SYS_BIC"."ZXXXXXX/ZSTAR_OT" ('PLACEHOLDER' = ('$$IP_TOMNTH$$', @Prompt(P_TOMNTH)), 'PLACEHOLDER' = ('$$IP_FRMNTH$$', '201301'), 'PLACEHOLDER' = ('$$IP_KOSTL$$', '3001D,3004D'), 'PLACEHOLDER' = ('$$IP_BUKRS$$', '1000')))
    when I add the second parameter I get an error
    FROM "_SYS_BIC"."ZXXXXXX/ZSTAR_OT" ('PLACEHOLDER' = ('$$IP_TOMNTH$$', @Prompt(P_TOMNTH)), 'PLACEHOLDER' = ('$$IP_FRMNTH$$', @Prompt(P_FRMNTH)), 'PLACEHOLDER' = ('$$IP_KOSTL$$', '3001D,3004D'), 'PLACEHOLDER' = ('$$IP_BUKRS$$', @Prompt(P_COMP_CODE)))
    the error is
    Substitution failed: No value supplied for Parameter "P_FRMNTH". (QTJ 00520)
    Any idea why this is happening.....
    Thank you,
    Arthur.

    I found an issue and fixed it. It is a simple fix within Data Foundation where the paremeters are defined, just change the Parameter text to be different and it validates fine.
    Thank you for all those who viewd this post and try to help you.
    Arthur.

  • Apex 4 ldap configuration string syntax for multiple ou

    I created a working string cn=%LDAP_USER%, ou=employee, o=Toronto.
    I have another organization unit called non-employee.
    I have checked the Oracle Forums and google for syntax that would be compatible to authentication schemes in shared components of APEX.
    "(&(uid=%LDAP_USER%)(|(ou:dn:=employee)(ou:dn:=non-employee)))" and every variation that I could think of for an OR operation between ou. I even tried ou=* without success.
    What worked for one organization unit was uid=%LDAP_USER%, ou=employee, o=Toronto.
    uid=%LDAP_USER%, ((ou=employee) | (ou=non-employee)), o=Toronto and every variation there of did not work. I would like to union the two groups.
    Otherwise, it means copying the same application so that each would have a connection string. This is inefficient.
    I do not control the LDAP server so I cannot create an ou=everyone group.
    In summary, looking for a LDAP connection string syntax to union more than one ou.

    Hi, I've solved my problem. Seems that the pair of quotes around the DN is unnecessary and causing me the agony.
    Thanks!

  • Update trigger syntax

    Hi
    I would like to create an update trigger that updates 3 collumns in another table.
    This works for one collumn:
    CREATE OR REPLACE TRIGGER DBNAME.Update_EVENT
    BEFORE UPDATE
    ON DBNAME.DB_EVENTS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    BEGIN
    UPDATE DB_EVENT_LOG
    SET
    COMPLETION_EVENT = :NEW.COMPLETION_EVENT
         WHERE RECORD_ID = :OLD.RECORD_ID ;
    EXCEPTION
    WHEN OTHERS THEN
    -- log the error and re-raise
    RAISE;
    END ;
    but this does not work for multiple collumns:
    CREATE OR REPLACE TRIGGER DBNAME.Update_EVENT
    BEFORE UPDATE
    ON DBNAME.DB_EVENTS
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    BEGIN
    UPDATE DB_EVENT_LOG
    SET
    (COMPLETION_EVENT
    , COMPLETION_DT_TM
    , COMPLETED_BY)
    =
    (:NEW.COMPLETION_EVENT
    , :NEW.COMPLETION_DT_TM
    , :NEW.COMPLETED_BY)
         WHERE RECORD_ID = :OLD.RECORD_ID ;
    EXCEPTION
    WHEN OTHERS THEN
    -- log the error and re-raise
    RAISE;
    END ;
    What am i doing wrong?

    Your update statement isn't correct, it should look like:
    UPDATE DB_EVENT_LOG
    SET
    COMPLETION_EVENT = :NEW.COMPLETION_EVENT,
    COMPLETION_DT_TM = :NEW.COMPLETION_DT_TM,
    COMPLETED_BY = :NEW.COMPLETED_BY
    WHERE RECORD_ID = :OLD.RECORD_ID ;

  • Fixing this TRIGGER Syntax

    I am practicing Triggers in SQL Server 2012.  Please help me correct this Trigger Syntax for this practice question below.
     Build a trigger on the emp table after insert that adds a record into the emp_History table and marks IsActive column to 1
    CREATE TRIGGER trgAfterInsert ON [dbo].[emp_triggers] 
    FOR INSERT
    AS
    declare @empid int;
    declare @empname varchar(100);
           declare @isactive int;
    select @empid=i.empid from inserted i;
    select @empname=i.empname from inserted i;
    set   @isactive= 1;
    insert into emphistory
               (empid, empname) 
    values(@empid, @empname, @isactive) ;
    PRINT 'AFTER INSERT trigger fired.'

    Your trigger does not work if an insert statement inserts multiple rows into your emp_triggers table.  Never write triggers that only work correctly when 1 row is inserted, updated, or deleted by one command.  You want
    CREATE TRIGGER trgAfterInsert ON [dbo].[emp_triggers]
    FOR INSERT
    AS
    insert into emphistory
    (empid, empname, isactive)
    select empid, empname, 1 from inserted ;
    which will work correctly no matter how many rows (0, 1, or many) are inserted by one INSERT command.
    Tom

  • Syntax for update descriptor description file?

    I'm looking to update my AIR app and I have that working. But what is the syntax for the description in the update descriptor file? How can I add a description that has multiple lines??
    Kyle

    Hi Kyle,
    Are you referring to the updater framework?  You should be able to do this using simple line breaks.
    http://www.adobe.com/devnet/air/articles/air_update_framework.html
    Chris

  • How do I update grouping or description for multiple items?

    As the question implies, I would like to update information in the Grouping and Description fields for multiple items as a way to keep things organized. What I have discovered is that there are some quirks in the new Get Info window that were not in past implementations, which are completely inexplicable and nonsensical to me.
    For instance, when you open the Get Info window for an item that has no information in, for instance, the Grouping field, you will not see a Grouping input field, as in this screenshot. The Grouping field should be where the bottom arrow is. Notice also that the Description field is available. I will get back to that in a minute.
    If you manually double-click into the Grouping field on the main iTunes screen, you can enter the information there. Then, when you open the Get Info window, ta-dah! The field magically reappears, as in the screenshot below.
    The trouble comes when you want to edit this field for multiple tracks. If you select multiple tracks, and they do not all have the Grouping field already populated, the field does not appear. What this means is that you are forced to manually enter the information for every track! This is completely unacceptable when you need to edit information for, as in my case, 122 tracks. The following image shows the Get Info window that appears after selecting two items, one with the Grouping field manually populated, and one with no info in the Grouping field.
    Not only has the Grouping field disappeared, but the Description field, as well. Thanks, Apple, but I think I can decide for myself whether or not to populate these fields for multiple items. Let's get 'em back, huh?
    SO… does anyone know of any valid method for accomplishing this task? Without manually entering the same information in hundreds of fields? This is the future; computers are supposed to do these monotonous tasks for us, aren't they?
    Oh, please don't suggest Option-clicking to open the older, better, Get Info window, as Apple has decided that we should not have that option any longer. We apparently have to organize our music their way. Think different!

    The Add Field button was in the editors of 12.0.1 (where the new-style editors had a very "half-finished" feel)  - it is not there in 12.1.  Apple have determined which metadata fields should be available for each kind of media, with no option for the user to modify this.  In Apple's own words: "Get Info has been completely redesigned in iTunes 12 to focus your attention only on what’s necessary for the selected item."
    The only options are:
    temporarily change the media kind (Options tab) to one that includes the field you want to add values to, enter those values, and then change the media kind back again
    make the relevant fields visible in an appropriate list view and edit values there - the big limitation being that you can only do this one item at a time
    I can see - to a degree - why Apple may have made some limitations so that metadata elements are available based on their relevance to different media kinds.  However, one of the issues mentioned above seems like a bug - if a single audiobook file can have a Description tab, I see no reason at all for that not to be available for multiple items of the same kind.
    If not already done so, report these issues and dissatisfaction with the "new" metadata editors in 12.1 (and the absence of a "back door" for the old-style ones) using Apple's iTunes feedback page.

  • Help: 10.0.1 update for multiple languanges is the same file as for Tier 1 languages.

    I'm trying to deploy the 10.0.1 update to my corporation. I need the multiple language update. When I go to the Downloads site for Adobe Reader, the update for multiple languages languages is the exact same file as the update for Tier 1 languages. I've called (yes, and actually held on long enough to speak to someone) twice asking for clarification on the files. The first time I was told this would be escalated to the web team and to call back. Over a week later no change to the files on the download site so I had to call in again and go through the same painful process to get the person on the phone to understand the problem. Has anyone already gone through this and determined whether that update is Tier 1 or multiple languages? Thank you very much.

    http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows
    You need to select an appropriate Patch (Tier1 through Tier4) for the Reader(s) installed on you system(s)

  • Same PIR updation for multiple vendors

    Hi,
    How to update the PIR for multiple vendors at a time whenever there is change in price.
    Thanks,
    Kiran Bodla

    Hi,
    Use the Info update tick in the P.O.
    Raj

  • UPDATE command syntax for mulitple checkbox update

    Hi,
    I intend update the checkboxes by id in bulk.
    My table is below. I want to update the selected form_id
    checkboxe and their
    values accordingly. That, I click the checkboxes (containin
    form_id
    information) of 1, 3, and 6; and I check their respective
    fields for column
    check01 and check02.
    form_id check01 check02
    1 1 0
    2 0 1
    3 0 0
    4 1 1
    5 1 1
    6 1 0
    I am using below code for deleting. I can do insert into. But
    I could not
    figure out the correct syntax for UPDATE command similar to
    below example.
    Sample for deleting:
    DELETE FROM ADS
    WHERE AD_ID IN (varCheckBox)
    Thank you
    Hakan

    Check here for SQL UPDATE syntax..
    http://www.w3schools.com/sql/sql_update.asp
    Regards,
    ..Trent Pastrana
    www.fourlevel.com
    "Hakan834" <[email protected]> wrote in message
    news:e9tdd8$ppk$[email protected]..
    > Hi,
    >
    > I intend update the checkboxes by id in bulk.
    >
    > My table is below. I want to update the selected form_id
    checkboxe and
    > their values accordingly. That, I click the checkboxes
    (containin form_id
    > information) of 1, 3, and 6; and I check their
    respective fields for
    > column check01 and check02.
    >
    > form_id check01 check02
    > 1 1 0
    > 2 0 1
    > 3 0 0
    > 4 1 1
    > 5 1 1
    > 6 1 0
    >
    > I am using below code for deleting. I can do insert
    into. But I could not
    > figure out the correct syntax for UPDATE command similar
    to below example.
    >
    > Sample for deleting:
    > DELETE FROM ADS
    > WHERE AD_ID IN (varCheckBox)
    >
    >
    > Thank you
    >
    > Hakan
    >

  • Updation of FOC item for multiple customers at a time

    Freinds,
    I have an issue regarding Free Goods item updation using T code - VBN1.  Normally we are updating an FOC item with the main line item along with quantity(exclusive or inclusive) for a particular period. The same process will repeat for each customer code using the T code.  My question is, whether there is any option to update the same set of FOC item for multiple set of customers at a time, instead of entering one by one for each customers.  Please help me out in this.  Thanks.

    If this is going to be a regular exercise, then you need to consider to add one more combination of Customer / Material based on which, you can create LSMW and make use of it regularly.  This is straight and simple approach to achieve the desired result.  On the other hand, if you dont want to touch your existing configuration, then you have to copy the standard program SAPMV13N, create a BDC, add input parameters as you wish and upload.
    G. Lakshmipathi

  • Is it possible to run one ud script to update parms for multiple servers...

    Is it possible to run one ud script to update certain parameters in mib for multiple
    servers by giving multiple occurrences of the parameter and server id. I tried
    a ud script as follows and it seem to update the parameter for only the first
    server.
    SRVCNM .MIB
    TA_CLASS T_SERVER
    TA_OPERATION SET
    TA_SRVID 101
    TA_SRVID 102
    TA_SRVID 103
    TA_CLOPT -A -r -e srv1.err --
    TA_CLOPT -A -r -e srv2.err --
    TA_CLOPT -A -r -e srv3.err --

    From the ud's output, it looks like it used only one occurrence of the fields that
    I provided.
    "james mathew" <[email protected]> wrote:
    >
    Is it possible to run one ud script to update certain parameters in mib
    for multiple
    servers by giving multiple occurrences of the parameter and server id.
    I tried
    a ud script as follows and it seem to update the parameter for only the
    first
    server.
    SRVCNM .MIB
    TA_CLASS T_SERVER
    TA_OPERATION SET
    TA_SRVID 101
    TA_SRVID 102
    TA_SRVID 103
    TA_CLOPT -A -r -e srv1.err --
    TA_CLOPT -A -r -e srv2.err --
    TA_CLOPT -A -r -e srv3.err --

  • Single concurrent program for multiple operating units

    HI
    I am working on XML/BI publisher to generate AR invoice reports.
    We have single rdf report using which rtf templates are generated.
    There are 10 operating units (10 ORG_ID's) and 10 rtf templates, one for each operating unit. There are 4 different responsibilities for each ORG_ID
    Eg: ORG_ID's = 11, 12, 13, 14..........etc
    Eg: Responsibility = xx, yy, zz...........etc
    I want to register a single concurrent program. When a user submits a request from "XX" responsibility, then the template associated with that org_id should be generated. Whichever responsibility the user is accessing from, that particular template must be shown as output.
    How can i register one concurrent program for multiple operating units.
    Thanks!
    Edited by: 994628 on Mar 18, 2013 4:39 PM
    Edited by: 994628 on Mar 18, 2013 4:42 PM

    >
    There are 10 operating units (10 ORG_ID's) and 10 rtf templates, one for each operating unit. There are 4 different responsibilities for each ORG_ID
    Eg: ORG_ID's = 11, 12, 13, 14..........etc
    Eg: Responsibility = xx, yy, zz...........etc
    I want to register a single concurrent program. When a user submits a request from "XX" responsibility, then the template associated with that org_id should be generated. Whichever responsibility the user is accessing from, that particular template must be shown as output.
    >
    interesting case for 10 OE set 10 template
    what is purpose? for each OE different requirements for layout?
    BTW
    if each Responsibility associated with one org_id then
    - you can get current org_id when you run concurrent program
    - create main template (will be #11) with condition like
    <?choose:?>
    <?when: ORG_ID=11?>
    <?import:xdo://FND.XX11_SUB.en.00/?>
    <?call:TEMPLATE11?>
    <?end when?>
    <?when: ORG_ID=12?>
    <?import:xdo://FND.XX12_SUB.en.00/?>
    <?call:TEMPLATE12?>
    <?end when?>
    <?otherwise:?>
    <?import:xdo://FND.XX21_SUB.en.00/?>
    <?call:TEMPLATE21?>
    <?end otherwise?>
    <?end choose?>so based on org_id will be import of needed subtemplate
    - re-register your "10 rtf templates" as subtemplates
    another way is substitution of template for concurrent then it running
    in before_report trigger set needed template
    l_conc_request_id := fnd_global.conc_request_id;
        if ORG_ID = 11 then
          UPDATE fnd_conc_pp_actions t
             SET t.argument2 = 'XX11'
           where t.concurrent_request_id = l_conc_request_id
             and t.action_type = 6;
      if ORG_ID = 21 then
          UPDATE fnd_conc_pp_actions t
             SET t.argument2 = 'XX21'
           where t.concurrent_request_id = l_conc_request_id
             and t.action_type = 6;

  • Syntax for a Formula in VC 7.0

    Hi
    Could you please help me with the Syntax for the formula for a
    Field Default value.
    In VC 7.0 for my model i created a Global List for Products.
    In the Variables form i had a Combo Box
    Now my requirment is to include a Formula for Default Value from the entry list
    Could you please update me with the syntax i can use
    The Default Value i need is (Product1 and Product 2 ) from the created Global product list
    I am trying from Entry list
    'Product1' ; 'Product2'
    It is showing syntax error
    Thanks in advance

    Hi
    You have to use the following expression "Product1;Product2" (Expression which you said is wrong). You have to enter 'Technical Name' for product 1 & 2 in that expression. Also make sure the variable which you are using for this combo box, accepts multiple values. The variable should be of 'Interval' or 'Multiple single options' type.
    If still you are getting error, then tell the exact error message you are getting.
    Regards
    Sandeep

Maybe you are looking for

  • Purchase of this item is currently not available. This item is being modified. Please try again later.

    Apple Support: I have tried to purchase albums by Muse dated 2003 and earlier from the iTunes Store in Denmark. For all of  these I am getting the response: "Purchase of this item is currently not available. This item is being modified. Please try ag

  • LabVIEW System Engineer: Albuquerque NM

    PrimeCore Systems is looking for self motivated software engineers for developing LabVIEW automated test and data acquisition systems. Candidates must be able to manage and lead their own projects and communicate with customers. Strong software skill

  • How to stop the screen from side swiping

    hi its fustrating sometimes when I'm on the computer and the screen screen swipes to the next page. How can i stop this from happening.? Plz.

  • USER MASTER GETDETAIL

    I want to wright interface acc. to BAPI_USER_GET_DETAIL for that i want to create a structure with fields " PSAID,JOBCODE,STATUS,DIVISIONID,DIVISONNAME " can u plz tell me where can i get i mean in which tables or structures the above fields for USER

  • How do we split editing and enconding between multiple PC's?

    We've been using a single Win PC for editing and encoding our videos but when editing, the encoding stops and we would like to find a way to split these two tasks between two computer. So, one for editing, one for encoding. Now, we send a project to