Help with creation of trigger

Have to create trigger for DML statements on a table for certain columns, BUT any insertions,deletions and update must be recorded onto another schema table which also uses the sys_context() function.
herewith the table that is already created
SQL> desc oradba.oprfile_audit
Name                                      Null?    Type
OLD_OF_OPID                                        VARCHAR2(8)
OLD_OF_DEFQUE                                      VARCHAR2(20)
NEW_OF_OPID                                        VARCHAR2(8)
NEW_OF_DEFQUE                                      VARCHAR2(20)
SYS_TYPE                                           CHAR(1)
SYS_CLIENT_IDENTIFIER                              VARCHAR2(64)
SYS_OS_USER                                        VARCHAR2(64)
SYS_HOST                                           VARCHAR2(64)
SYS_IP_ADDRESS                                     VARCHAR2(64)
SYS_TERMINAL                                       VARCHAR2(64)
SYS_MODULE                                         VARCHAR2(64)
SYS_DATE                                           DATEHerewith my trigger I tried creating:
CREATE OR REPLACE TRIGGER MAC.oprfile_trg
BEFORE DELETE OR INSERT OR UPDATE
OF OF_OPID
  ,OF_DEFQUE
ON MAC.OPRFILE
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
DECLAREThe problem I have is where to put the insert into statement, and to declare the values to be inserted
ANY HELP WILL BE MUCH APPRECIATED

Hi,
just had a quick test. I have removed the owner to create in my own schema in my local database.
Also I did not know the structure of OPRFILE table and I made some assumptions.
Check below
CREATE TABLE OPRFILE (
OF_OPID                                        VARCHAR2(8),
OF_DEFQUE                                      VARCHAR2(20),
SYS_TYPE                                           CHAR(1),
SYS_CLIENT_IDENTIFIER                              VARCHAR2(64),
SYS_OS_USER                                        VARCHAR2(64),
SYS_HOST                                           VARCHAR2(64),
SYS_IP_ADDRESS                                     VARCHAR2(64),
SYS_TERMINAL                                       VARCHAR2(64),
SYS_MODULE                                         VARCHAR2(64),
SYS_DATE                                           DATE
CREATE TABLE OPRFILE_AUDIT (
OLD_OF_OPID                                        VARCHAR2(8),
OLD_OF_DEFQUE                                      VARCHAR2(20),
NEW_OF_OPID                                        VARCHAR2(8),
NEW_OF_DEFQUE                                      VARCHAR2(20),
SYS_TYPE                                           CHAR(1),
SYS_CLIENT_IDENTIFIER                              VARCHAR2(64),
SYS_OS_USER                                        VARCHAR2(64),
SYS_HOST                                           VARCHAR2(64),
SYS_IP_ADDRESS                                     VARCHAR2(64),
SYS_TERMINAL                                       VARCHAR2(64),
SYS_MODULE                                         VARCHAR2(64),
SYS_DATE                                           DATE
-- Keep the trigger simple, why repeating 3 times insert?
CREATE OR REPLACE TRIGGER oprfile_trg
   BEFORE INSERT OR UPDATE OR DELETE OF of_opid, of_defque
   ON oprfile
   REFERENCING NEW AS new OLD AS old
   FOR EACH ROW
DECLARE
   v_sys_type     CHAR (1);
BEGIN
   IF INSERTING
   THEN
      v_sys_type := 'A';
   ELSIF UPDATING
   THEN
      v_sys_type := 'C';
   ELSIF DELETING
   THEN
      v_sys_type := 'D';
   END IF;
   INSERT INTO oprfile_audit (old_of_opid, old_of_defque, new_of_opid
                , new_of_defque, sys_type, sys_client_identifier
                , sys_os_user, sys_host, sys_ip_address
                , sys_terminal, sys_module, sys_date)
        VALUES (:old.of_opid, :old.of_defque
              , :new.of_opid, :new.of_defque
              , v_sys_type, SYS_CONTEXT ('USERENV', 'CLIENT_IDENTIFIER')
              , SYS_CONTEXT ('USERENV', 'OS_USER'), SYS_CONTEXT ('USERENV', 'HOST')
              , SYS_CONTEXT ('USERENV', 'IP_ADDRESS'), SYS_CONTEXT ('USERENV', 'TERMINAL')
              , SYS_CONTEXT ('USERENV', 'MODULE'), SYSDATE);
EXCEPTION
   WHEN OTHERS
   THEN
      -- Consider logging the error and then re-raise
      RAISE;
END oprfile_trg;
-- Testing ....
INSERT INTO oprfile (of_opid, of_defque)
     VALUES ('OF_OPID1', 'OF_DEFQUE1');
INSERT INTO oprfile (of_opid, of_defque)
     VALUES ('OF_OPID2', 'OF_DEFQUE2');
INSERT INTO oprfile (of_opid, of_defque)
     VALUES ('OF_OPID3', 'OF_DEFQUE3');
UPDATE oprfile
   SET of_defque = 'OF_DEFQUE99'
WHERE of_opid = 'OF_OPID1';
DELETE oprfile
WHERE of_opid = 'OF_OPID2';
COMMIT;
-- output
SELECT * FROM oprfile_audit;
OLD_OF_OPID OLD_OF_DEFQUE        NEW_OF_OPID NEW_OF_DEFQUE        SYS_TYPE SYS_CLIENT_IDENTIFIER SYS_OS_USER       SYS_HOST         SYS_IP_ADDRESS SYS_TERMINAL SYS_MODULE    SYS_DATE           
                                 OF_OPID1    OF_DEFQUE1           A                              TGDFAAL4          U187662          127.0.0.1      U187662      TOAD 10.5.1.3 14/06/2012 15:41:07
                                 OF_OPID2    OF_DEFQUE2           A                              TGDFAAL4          U187662          127.0.0.1      U187662      TOAD 10.5.1.3 14/06/2012 15:41:08
                                 OF_OPID3    OF_DEFQUE3           A                              TGDFAAL4          U187662          127.0.0.1      U187662      TOAD 10.5.1.3 14/06/2012 15:41:08
OF_OPID1    OF_DEFQUE1           OF_OPID1    OF_DEFQUE99          C                              TGDFAAL4          U187662          127.0.0.1      U187662      TOAD 10.5.1.3 14/06/2012 15:41:08
OF_OPID2    OF_DEFQUE2                                            D                              TGDFAAL4          U187662          127.0.0.1      U187662      TOAD 10.5.1.3 14/06/2012 15:41:08
{code}
Regards.
Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Help with create a trigger

    hello all
    i have a 4 tables and i would like to create a trigger in a tables
    CREATE TABLE CLIENT_INFO
    ( CLIENT_NO     VARCHAR2(10) CONSTRAINT CLIENT_INFO_CNO_PK PRIMARY KEY,
      CLIENT_NAME   VARCHAR2(50) NOT NULL,
      ORDERS_AMOUNT NUMBER(7)
    CREATE TABLE STOCK_INFO
    ( ITEM_NO              VARCHAR2(10) ,
      ITEM_DESCRIPTION     VARCHAR2(100),
      SELLING_PRICE        NUMBER(6),
      QTY_IN_HAND          NUMBER(6)    NOT NULL,
      CONSTRAINT ITEM_NUM_SPRICE_PK PRIMARY KEY (ITEM_NO , SELLING_PRICE)
    CREATE TABLE ORDER_INFO
    ( ORDER_NO     VARCHAR2(10) CONSTRAINT ORDER_INFO_ONO_PK PRIMARY KEY,
      CLIENT_NO    VARCHAR2(10),
      ORDER_DATE   DATE,
      ORDER_AMOUNT NUMBER(6),
      CONSTRAINT ORDER_INFO_CNO_FK  FOREIGN KEY (CLIENT_NO) REFERENCES CLIENT_INFO (CLIENT_NO)
    CREATE TABLE ORDER_LINES
    ( ORDER_NO       VARCHAR2(10),
      ITEM_NO        VARCHAR2(10),
      LINE_QTY       NUMBER(6),
      SELLING_PRICE  NUMBER(6),
      TOTAL_PRICE    NUMBER(6)
    ALTER TABLE ORDER_LINES
    ADD  CONSTRAINT ORDER_LINES_ONO_FK FOREIGN KEY (ORDER_NO) REFERENCES ORDER_INFO (ORDER_NO);
    ALTER TABLE ORDER_LINES
    ADD  CONSTRAINT ORDER_LINES_INO_FK FOREIGN KEY (ITEM_NO) REFERENCES STOCK_INFO (ITEM_NO);i would like to create this trigger
    1-order_amount in table 3 due to any (insert,update or delete ) in total_price in table 4
    2-orders_amount in table 1 due to any (insert,update or delete ) in order_amount in table 3
    i would like to ask another quotations r this relations in good for tables
    thank's all

    >
    plz i need a help to create a trigger
    >
    Using a trigger won't solve your problem. You are trying to use child table triggers to maintain parent table information.
    There is no transaction control to ensure that the parent table will be updated with the correct information.
    One process could update child record 1 while another process is updating child record two. Each process will see a different total if they try to compute the sum of all child records since the first process will see the 'old' value for the child record that the second process is updating and the second process will the 'old' value for the child record that the first process is updating.
    So the last process to commit could store the wrong total in the parent record withoug an exception ever being raised.
    See Conflicting Writes in Read Committed Transactions in the Database Concepts doc
    http://docs.oracle.com/cd/E14072_01/server.112/e10713/consist.htm
    >
    some one ask me this quotation in interview
    and im told him i can't understand this structure for database he said just do it
    >
    And I would tell them that using a trigger is not the right way to accomplish that since it could invalidate the data concurrency and data consistency of the tables.
    Sometimes you just have to tell people NO.

  • HELP with Creation of Pricing Report

    Guys
    I need help with the creation of the following Pricing report.
    Sales Org - Page header
    Dchl         - Page Header
    Customer - Page Header
    Payment terms (for above customer) - page header
    Incoterms (for above customer) - page header
    material group - group header
    material - item level
    cond type - item level
    It is the items marked with * above that i am struggling with.
    without those two fields all works ok,
    I have had several attempts, but still cannot get what i require.
    - Have created new several condition tables, used several condition tables in the pricing report, used more than 1 condition table in the pricing report - still no luck.
    Is it possible to create what is required ?
    Many thanks for your help
    Thanks
    Tony
    Hydro Polymers

    Yes _ i know it is transaction V/ld    - V/la to create
    I want to know if it is possible to create the report i am after

  • Can anyone help with a custom trigger?

    Hi - I know this is a tough one and appreciate anyone's help!
    I'm trying to create a custom trigger that confirms 2 fields belong to the same record. If they do, proceed with insert transaction.
    I have gone through the tutorial (from the old Interakt Discussion Board tutorial at http://www.interaktonline.com/Documentation/MXKollection/075000_tutorialdiscussionboard.h tm) on how to create a custom trigger that checks to see whether a duplicate message and subject exist in the table and if so, stop the insert. I have this working fine, using my own table and fields.
    Can anyone help me to change the script here to confirm that both fields belong to the same record? Here is what I have right now:
    $query = "SELECT * FROM dan_camptrans_login_familyid_confirmid WHERE family_id = ".KT_escapeForSql($tNG->getColumnValue("family_id"),$tNG->getColumnType("family_id"))." AND confirm_id = ".KT_escapeForSql($tNG->getColumnValue("familyconfirm_id"),$tNG->getColumnType("familycon firm_id"));
    $result = $tNG->connection->Execute($query);
    if(!$result) {
    $error = new tNG_error("Could not access database!",array(),array());
    return $error;
    } else {
    if($numberOfRecords = $result->recordCount()) {
    $uniqueFailed = new tNG_error("There is already a message with the same subject and content!",array(),array());
    return $uniqueFailed;
    } else {
    return NULL;
    Any help would be SUPER appreciated!
    Dan

    Thank you very much Shane for responding.
    Right now, if I fill out the form and enter any numbers in the family_id and familyconfirm_id fields that are currently NOT in the dan_camptrans_login_familyid_confirmid table, the form submits fine. If however, both fields already exist within the same record, the error is returned.
    I guess what I am looking for is the opposite. When the form is submitted, the table dan_camptrans_login_familyid_confirmid is checked. If both field entries are not within the same record, return the error.
    Basically, I am sending out a user ID and confirmation number via mail to users. When they register they need to enter in both of these numbers and only if they match the records will the registration proceed.
    The main recordset/form that this custom trigger is attached to is one for my user registration table. This custom trigger and associated table is only to confirm the user registering has the correct information to register.
    Thanks again - I hope that I am explaining this clearly.
    Dan

  • Help With creating a trigger

    Hello All!
    I am writing regarding a trigger I must create. I have a table that has roughly 10 columns. I must insert rows into a 'history' table when any column in the parent table is updated or, of course if there is an insert on the parent table. Is there a way to specify multiple columns in the triggering statement (i.e., UPDATE OF parts_on_hand ON inventory) to insert rows into the child table if any of the columns is updated? I am very new with triggers, and am hoping that someone might be able to offer any suggestions, or maybe sample code if available just to help start me out.
    Thanks in advance!
    Julie

    If you do not include a specific column(s), then the trigger will fire on an update to any column. So, for your case:
    create or replace trigger t_trigger
    before insert or update on t
    for each row
    begin
      insert into t_history values (:new.c1, :new.c2, ...);
    end;
    /

  • Help with wii button trigger

    I'm fairly new to action script and struggling to get a
    wiimote to trigger a flash scene.
    Need the scene to be triggered by the IR and B button
    together.
    I currently have this piece of script which triggers the
    scene but only through the IR.
    if (bButtonPressed)(myWiimote.ir.x1 >=0.1);
    gotoAndStop(10);
    Can anyone help me please.
    Cheers
    Tom

    I suggest you move the procedure call from the button's pl/sql block to an explicitly defined WHEN-BUTTON-PRESSED event. Then Designer will not generate any message handling, so you can write your own.
    In your WHEN-BUTTON-PRESSED code block, put something like...
    BEGIN
    procedure_name;
    IF NOT form_success THEN
    qms$errors.show_message('XXX-00016',p_param0='procedure_name');
    END IF;
    END;
    For more information on qms$errors.show_message, see the Headstart User Guide, pg 16-6 through 16-7.
    On another subject, you reported about a month ago with using qms$menu_call_form. I was wondering if you were able to reproduce this problem with the Headstart Demo Application, or have any more information about when it happens. If so, can you email me at [email protected]
    Regards,
    Lauri

  • Need help with INSTEAD OF trigger on view

    Hi,
    I am trying to use INSTEAD OF on a view because I will be updating the calling table in my trigger, which will cause mutation. 
    I need to update attribute7 of another record based on the new attribute7 of the current record (record being updated in the form).  Below is my script.  My problem is it does not perform the update. 
    create or replace view xxont_oe_order_lines_vw as select * from oe_order_lines_all;
    CREATE OR REPLACE TRIGGER APPS.xxont_sync_ard
    instead of insert or update on xxont_oe_order_lines_vw
    referencing
    new as new
    old as old
    for each row
    begin
       update oe_order_lines_all
           set attribute7 = :new.attribute7
       where attribute18 = to_char(:new.header_id)
          and attribute17 = to_char(:new.line_id)
          and flow_status_code <> 'CANCELLED' ;      
      /*exception
      when others then
         null ;
      end ;*/        
    end ;

    Always make your code developer friendly. Do extensive code instrumentation. At lease you can do this.
    create or replace trigger apps.xxont_sync_ard
    instead of insert or update on xxont_oe_order_lines_vw
    referencing
    new as new
    old as old
    for each row
    declare
       zero_update exception;
    begin
       update oe_order_lines_all
          set attribute7 = :new.attribute7
        where attribute18 = to_char(:new.header_id)
          and attribute17 = to_char(:new.line_id)
          and flow_status_code <> 'CANCELLED' ;
       if sql%rowcount = 0 then
         raise zero_update;
       end if;
    exception
      when zero_update then
         raise_application_error
               -20001
             , 'OE_ORDER_LINES_ALL: 0 rows updated attribute18 = "'
               || attribute18
               || '" attribute17 = "'
               || to_char(:new.line_id)
               || '"'
    end ;
    This will help you raise error when the update does not update any row. This is just an example, make sure if this is what your requirement wants if you want to implement it. If you don't want to raise error then you can just log it in a log table or log file.

  • Need help with creation of Payment Cycles

    We need you to determine a way to sum up the Measure "Prod Matl - Std" into Payment Cycles of the 5th, 10th, 15th, 20th, 25th and 30th of each month. Company only pays suppliers on the Payment Cycles indicated above.
    General Rules:                                                  
         Days:          Paid on:          Example:                         
         1 - 5          Day 5          2008-08-01 through 2008-08-05 are all paid on 2008-08-05                         
         6 - 10          Day 10          2008-08-06 through 2008-08-10 are all paid on 2008-08-10                         
         11 - 15          Day 15          and so on…                         
         16 - 20          Day 20          and so on…                         
         21 - 25          Day 25          and so on…                         
         26 - 30          Day 30          and so on…                         
    Exceptions to Rules:                                                  
                   Paid on Day:          Example:                         
    1.)     31st of any month          Day 5 of the following month          2008-08-31 is paid on 2008-09-05                         
    2.)     Since the month of February only has 28 or 29 days, payment for the 26th-28th of Feb will occur on Feb 28th. If it is a leap year and February has 29 days, then the payment for the 26th-29th will occur on Feb 29th.                                             
    Comments:                                                  
    Please feel free to add new measures, UDAs and any formulas necessary to accomplish the objective.

    The best advice I can give is to mock it up on a spreadsheet as follows:
    Columns: Time periods, highlight all periods (columns) that are payment cycle end dates.
    Rows: Item 1 = Amount Due, Item 2 = Amount Paid, Item 3 = Due This Cycle
    Now, all you need is to take each column and on the highlighted columns and put a formula into the Item 3 line that takes the sum of amounts paid and subtracts it from the sum of amounts due. These can run from the beginning or just back to the previous highlighted column.
    Once you have it mocked up, the formulas can be converted and members added to support it. You'll also need to get the people that make the payments to book the items, etc..., but that might already be part of the bigger picture.
    You will need to fine tune the results for roll-ups. You can either use time balance last members or create a member to store the current due/current paid elements as a running total. These are all style points though -- the bottom line is that if you can't model the process in excel or code it in essbase, you need to bring a good consulting organization in. It wouldn't take long for them to help, and I can recommend a couple in particular, but without knowing a lot more about your outline and constraints it would be very difficult to point to any one direction with certainty.

  • Help with Mutating Error / Trigger / APEX_MAIL.SEND

    Hello:
    I am trying to get the apex_mail.send function working when a user submits a new record. I've taken the code from the canned Issue Tracker application code and tried to retrofit it to my tables. However I keep receiving a mutating error on line 11 (line 11 bolded below):
    -- Create a trigger that will send notification after
    -- the submission of each new idea on the IDEAS table.
    create or replace trigger IDEAS_EMAIL
    AFTER
    insert or update on IDEAS
    for each row
    begin
    IF (INSERTING AND :new.manager_name IS NOT NULL)
    OR
    (UPDATING AND (:old.manager_name IS NULL OR :new.manager_name != :old.manager_name) AND :new.manager_name IS NOT NULL) THEN
    FOR c1 IN
    (SELECT fname, lname, email
    FROM ideas_users
    WHERE fname||' '||lname = :new.manager_name)
    LOOP
    IF c1.email IS NOT NULL THEN
    FOR c2 IN
    (SELECT MANAGER_NAME, FULL_TEXT, SUMMARY, ID, SUBMITTED_BY, SUB_DATE
    FROM IDEAS
    WHERE ID = :new.ID)
    LOOP
    APEX_MAIL.SEND(
    p_to => c1.email,
    p_from => c1.email,
    p_body =>
    'This is a test message. ' ||chr(10)||
    p_subj => 'test email subject');
    END LOOP;
    END IF;
    END LOOP;
    END IF;
    end;
    I've also tried setting the following line to the primary key field in the user table and inserting that value into the main table but I still get the same error message.
    WHERE fname||' '||lname = :new.manager_name)
    Thanks in advance for any help.

    Let me get this straight..
    You are inserting a row into a table, and when you insert the row, you are going to send an e-mail t o the manager who owns this row. In the data you are inserting, is the e-mail address of the manager, right?
    David has provided the answer for you.. Use the :NEW.Email value instead of creating a cursor and all that.. Unless you have a need to e-mail multiple people of the record insert..
    Thank you,
    Tony Miller
    Webster, TX
    On the road of life...There are 'windshields', and there are 'bugs'
    (splat!)
    "Squeegees Wanted"

  • Help with a basic trigger to capture OS_USER

    Below is the trigger and it does not work - help very much appreciated
    CREATE OR REPLACE TRIGGER trg_master_tab_aft
    AFTER INSERT OR UPDATE OR DELETE
    ON master_tab
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    BEGIN
         IF INSERTING THEN
         INSERT INTO master_tab_hst values (:NEW.col1,
         :NEW.OSUSER := SELECT SYS_CONTEXT('USERENV', 'OS_USER')  FROM dual
         ,'I'
         ,SYSDATE);
         ELSIF UPDATING THEN
         INSERT INTO master_tab_hst (:NEW.col1,
         :NEW.OSUSER := SELECT SYS_CONTEXT('USERENV', 'OS_USER')  FROM dual
         ,'U'
         ,SYSDATE);
         ELSIF DELETING THEN
         INSERT INTO master_tab_hst (:OLD.col1,
         :NEW.OSUSER := SELECT SYS_CONTEXT('USERENV', 'OS_USER')  FROM dual
         ,'D'
         ,SYSDATE);
         END IF;
    EXCEPTION
         WHEN OTHERS THEN
           -- Consider  the error and then re-raise
           RAISE;
    END ;

    Hello Srini,
    Please see if it helps you.
    CREATE OR REPLACE TRIGGER trg_master_tab_aft
    BEFORE  INSERT OR UPDATE OR DELETE
       ON master_tab    FOR EACH ROW
    BEGIN
       IF INSERTING THEN
       INSERT INTO master_tab_hst
       ( STR_NUM,
         TERM_ID,
         HOST_ENV,
         USR_TERMINAL,
         SESSION_USR,
         OS_USER,
         ACTION_DATE,
        ACTION_NAME)
       VALUES
       ( :NEW.STR_NUM,
         :NEW.TERM_ID,
              sys_context('USERENV', 'HOST'),
              sys_context('USERENV', 'TERMINAL'),
              sys_context('USERENV', 'SESSION_USER'),
              sys_context('USERENV', 'OS_USER'),
                   SYSDATE,
                   'INSERT');
        ELSIF UPDATING THEN
       INSERT INTO master_tab_hst
       ( STR_NUM,
         TERM_ID,
         HOST_ENV,
         USR_TERMINAL,
         SESSION_USR,
         OS_USER,
         ACTION_DATE,
        ACTION_NAME)
       VALUES
       ( TRUNC(:OLD.STR_NUM)||','||:NEW.STR_NUM,
         TRUNC(:OLD.TERM_ID)||','||:NEW.TERM_ID,
              sys_context('USERENV', 'HOST'),
              sys_context('USERENV', 'TERMINAL'),
              sys_context('USERENV', 'SESSION_USER'),
              sys_context('USERENV', 'OS_USER'),
                   SYSDATE,
                   'UPDATE');          
        ELSIF DELETING THEN
       INSERT INTO master_tab_hst
       ( STR_NUM,
         TERM_ID,
         HOST_ENV,
         USR_TERMINAL,
         SESSION_USR,
         OS_USER,
         ACTION_DATE,
        ACTION_NAME)
       VALUES
       ( :OLD.STR_NUM,
         :OLD.TERM_ID,
              sys_context('USERENV', 'HOST'),
              sys_context('USERENV', 'TERMINAL'),
              sys_context('USERENV', 'SESSION_USER'),
              sys_context('USERENV', 'OS_USER'),
                   SYSDATE,
                   'DELETE');
        END IF; 
    EXCEPTION
         WHEN OTHERS THEN
           -- Consider  the error and then re-raise
           RAISE;
    END;

  • Help with creation of a bespoke letterhead please....

    I am using 10.10 and Pages 5.5.
    e
    I wish to create a bespoke letterhead with a motif at the top and bottom of every page, with a header and footer that contains logo and contact details which appear on first page only. But I cannot get page 2 to come out right. If I create a section master with the logo and the address, it flips over to the second page. If I create page 2 as a new section, when I get to the end of the first page of section 1 the typing action just flips over to a new copy of the first page and I start writing on the second page of section 1 instead of flipping to the first page of section 2 which has a different format.
    Its driving me nuts.

    Close enough forum :-)
    Ok Quick checklist.
    Tomcat is running?
    You can access the Tomcat home page
    http://localhost:8080 ?
    In [myDirectory] you have a folder called WEB-INF,
    with a valid web.xml file?
    Your website should be:
    http://localhost:8080/[myDirectory]/myJspPage.jsp
    where [myDirectory] is the name of the directory
    under webapps.
    I will you point you in the direction of a tutorial.
    This should be installed on your machine as well:
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev
    /index.html
    specifically
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev
    /deployment.html
    cheers,
    evnafetsThanks for the prompt reply.Will follow the tutorial.
    AS

  • Help with creation of elevator simulator...

    I'm trying to create an elevator simulator but i'm having a problem making the elevator pause (for like 5secs) at the necessary floors to show the pick up & let off passengers ...
    Any suggestions on how to make it pause?
    I'm using: a timer to paint a graphic into a panel
    I'm not sure if any other information is needed... but if so just say & i'll post it.
    Thanks alot.

    TJacobs, that's an excellent idea, but I wonder when the number of threads goes up (and factor in the GUI event thread) whether those counts will still be accurate.
    I think another way to go would be to have one thread for all the elevators. Have it sleep at one second intervals. Then, have that thread wake up and iterate over each elevator. Each elevator class would sequentially evaluate its position. You would need to introduce an element of time into your elevator classes, having them calculate delta position or wait time in terms of one second units.
    Just a thought.
    - Saish

  • Help with validation of service order creation

    Dear All,
    I am working with creation of service order under service professional and got a requirement where
    1) I need to validate the quantity from BOM table comm_il_momitm. and
    2) Same product (product id) should not be called more than once, that is if the user selects same product once again it must throw an error.
    Please find the screenshot below
    Regards,
    Naveenn

    Hi Benoit,
    I give you my exact requirement,
    i need to validate quantity field entry (in above table) based on compon_qty field in comm_il_bomitm table.
    I tried to implement it using eh_onsave method in component BT116H_SRVO but it is displaying error message even the quantity is equal the compon_qty whereas it should display error only when it exceeds compon_qty.
    Please help by providing sample code.
    Regards,
    Naveenn

  • Help with Oracle Table Audit Trigger

    Hi Guys,
    Need some help with the design of a trigger please. I have created one standard audit table where all sensitive data will be audited/inserted. The idea is to insert the column name and the old and new values here, dont want to maintain an audit table for each and every table there is, reporting would be a nightmare.
    Trying to fetch all the column names from sys objects then looping through each and inserting the new and old values for them into the audit table. Everything else is fine apart from the actual :old and :new value inserts. The column name is coming from a variable in a cursor and this is where I seem to be failing.
    Can anyone help please? What is the correct syntax to use?
    CREATE OR REPLACE TRIGGER commission_update
        AFTER UPDATE
            ON commission
            FOR EACH ROW
    DECLARE
            v_username varchar2(10);
              v_column varchar2(20);
              -- Get Table Columns
              cursor table_column is
                      select c.name
                      from  sys.col$ c, sys.obj$ t
                      where t.obj# = c.obj#
                      and   t.type# in (2, 3, 4) 
                      and   bitand(c.property, 32) = 0 /* not hidden column */
                      and t.name = 'COMMISSION';
        BEGIN
            -- Find username of person performing UPDATE into table
            SELECT user
         INTO v_username
            FROM dual;
              open table_column;
                    loop
                          fetch table_column
                         into v_column;                    
                         EXIT WHEN table_column%NOTFOUND;
                                 -- Insert record into audit_record
                             INSERT INTO audit_record
                                  ( aud_code,
                                      aud_ban_code,
                                      aud_user,
                                      aud_table,
                                  aud_column,
                                   aud_old_val,
                                   aud_new_val,
                                   aud_date )
                                VALUES
                                  ( xaudit_record.nextval,
                                      :old.com_ban_code,
                                      v_username,
                                      'COMMISSION',
                                   v_column,
                                   :old.v_column, /* problem here!!!!!!! */
                                   :new.v_column, /* problem here!!!!!!! */
                                   sysdate );
                    end loop;
              close table_column;
        END;
    /

    What does auditing mean in the financial environment? "An audit is a professional, independent examination of a company's financial statements and accounting documents according to generally accepted accounting principles."
    What does it mean in database terms? Surely, the basic definition would be the same, ito of a proper independent examination of changes in the database according to accepted principles?
    And just how does a trigger live up to that? When it is fully dependent on being enabled for that transaction in order to examine it? It is trivial to disable a trigger, make changes, and re-enable it.
    So what happens to your "auditing" then?
    Do you really think that a trigger suffices as a means to audit changes in a table? And if so, what logic and reasoning do you use to discard Oracle's auditing features that are built into the core of the database?

  • Need help with complex column creation command

    Hello, all
    I need help with a complex column creation command and SQL anywhere help is not sufficient for it.
    Here is the situation:
    I need to write a generic DDL "alter table" command, which can add/modify columns without knowing in advance if they already exist in the destination table.
    Is there a command, which looks like:
    alter table "table1" add (on existing modify) column1 <datatype> <default> ?
    Thank you,
    Arcady

    Hi.
    I don't think this is supported in alter table command. But you can code that inside an if statement which queries systables & syscolumns. Your code should be something like that:
    if (select count(*) from sysobjects, syscolumns where sysobjects.id = syscolumns.id and sysobjects.name = 'some_table' and syscolumns.name = 'some_column') < 1
    begin
        alter table some_table add some_column numeric(12) not null
    end
    This is an example..
    Andreas.

Maybe you are looking for

  • In Mail App, Viewing Images

    In Mail, My preferences are set to display remote images. However, my incoming mail messages don't display the images. This is the condition when the mail is open, not just in preview. Is there another setting hidden somewhere in the app? Thanks much

  • Only RG23 A/C Part-2 Posting for free goods

    Hi Gurus, Hi Every one, how are you, i have one requirement from client. 1. this case is for free goods, where client wanted to take   credit for material purchase ie only part-2 entry should get posted, 2. Liabilities should not get posted. As  per

  • Issue with TextArea resize event

    Hi, In the following sample there is a button and a textarea in a VDivideBox. If you move the divider, the Textarea is resized and in its resize event I change the fonts size. It works very well except in one case: If the Textarea is given the focus

  • This is getting pretty nasty now...

    I've had this Dual 2.0 since last May, and while it was fine at first, it justs keep getting worse. Surfing is fine (most of the time), menial tasks aren't a problem and the overall performance, i.e. start-up, navigating the interface and such are gr

  • Error during post-installation step of UR4 for SCSM 2012 R2

    Hello experts, When attempting to execute the process documented in the "Resynchronize System Center Operations Manager mount point data" section of the UR4 installation instructions, we run into the following error.  Has anyone else encountered