How to implement the trigger

Hi,
I'm need of your help in completing the trigger...
I need to implement a trigger { after insert or update or delete ....  for each row}
on table temp1 ( status , outdated, seq,len) .... destination table is dest1(status ,outdated ,sequence ,length)
here status means if inserting then 'i' if updating then 'u' if deleting then 'd'
and outdated means if inserting or updating then 'n' if deleting then 'y'
and rest 2 columns are just mapping ( audit trigger)
and another condition is :
if seq changes the treat as delete + insert { means dest table should result in 2 rows...where status = d  and i also}
Could you please hint me in writing with the above logic...
I'm confused in adding the above condition...
Hope you will help me soon...
Thanks.

Hi,
The following is tables and triggers i tried
CREATE TABLE T_I_D
   CL_ID      NUMBER(38)                         NOT NULL,
   TRI_SEQ    NUMBER(38)                         NOT NULL,
   TRI_LEN    NUMBER,
    OUTDAT     VARCHAR2(1 BYTE)                   NOT NULL,
    MOTP     VARCHAR2(1 BYTE)                   NOT NULL
CREATE TABLE TI_T
  RI_ID         VARCHAR2(15 BYTE)               NOT NULL,
  RI_SEQ        INTEGER                         NOT NULL,
  LEN           FLOAT(126),
  ROUND         FLOAT(126),
CREATE OR REPLACE TRIGGER trig
AFTER INSERT OR UPDATE OR DELETE
OF RI_SEQ, LEN
ON TI_T REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
  riSeq TI_T.RI_SEQ%TYPE;
len TI_T.LEN%TYPE;
mTp VARCHAR2(1);
outDated VARCHAR2(1);
doconnect number:=0;
dodisconnect number:=0;
BEGIN
IF (UPDATING('RI_SEQ')) OR DELETING THEN
len :=:OLD.LEN;
mTp :='D';
outDated :='Y';
riSeq:=:old.RI_SEQ;
doconnect:=1;
END IF;
IF (UPDATING('RI_SEQ')) OR INSERTING THEN
doconnect:=0;
len :=:NEW.LEN;
mTp :='I';
outDated :='N';
riSeq:=:NEW.RI_SEQ;
doconnect:=1;
END IF;
IF UPDATING('LEN') THEN
len :=:NEW.LEN;
mTp :='U';
outDated :='N';
dodisconnect:=1;
END IF;
INSERT ALL
WHEN(doconnect=1) then
INTO T_I_D(
             CL_ID,
             TRI_SEQ,
              TRI_LEN,
             OUTDAT,
             MOD_TP )
values(      CL_ID,
             TRI_SEQ,
              TRI_LEN,
             OUTDAT,
             MOD_TP)
when (dodisconnect=1) then
INTO T_DTRI_D(
             CL_ID,
             TRI_SEQ,
              TRI_LEN,
             OUTDAT,
             MOD_TP)
values CL_ID,
             TRI_SEQ,
              TRI_LEN,
             OUTDAT,
             MOD_TP)
SELECT * FROM
    SELECT 1 AS CL_ID,
             riSeq as TRI_SEQ,
           len as TRI_LEN,
         outdated AS OUTDAT,
        mTp as MOD_TP
    FROM dual;
END;But while updating the 'SEQ' column i need to 2 rows in o/p table containing mTp ='d' and 'i' also
but i'm not getting the same..
so what changes do i need to do in code

Similar Messages

  • How to implement the schema validation with XSD in adapter module

    Dear All,
    I am trying to develop a EJB as the file adapter mudule.
    Please guide me how to implement the schema validation of the source message with XSD.
    Or provide me the relative resources about this task.
    Thanks & Regards,
    Red
    Edited by: Grace Chien on Nov 19, 2008 8:23 AM

    Hi Grace,
    You can do the xml scema validation in PI7.1 version directly.
    To develop the adapter module for xml schema validation
    Validating messages in XI using XML Schema
    Schema Validation of Incoming Message
    Regards
    Goli Sridhar

  • How to implement the shared lock in a  table view

    Hi,
    How to implement the shared lock in a  table view.for multiple users to edit on this same table.
    Thanks in advance
    Swathi

    Hi,
    Please refer this link to find solution to your querry.
    Hope it helps.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c322c690-0201-0010-fb86-811c52b0acc2.
    Regards,
    Rahul

  • How to implement the selfsecured page in oaf

    hi
    any one having knowledge how to implement the selfsecured OAF page documents
    can you please send me [email protected]
    Regards
    Chandra

    Use the search facility on the forum. Did you read the dev guide?
    --Shiv                                                                                                                                                                                       

  • How to implement the spell check in oracle forms 10g or 6i...

    How to implement the spell check in oracle forms.
    Is there any different method is there.
    Please help me....
    Praveen.K

    Here is one different from Jspell..
    In 6i client/server you can call MS Word spell checker using OLE. Below sample code for 6i.
    For 10g you will need webutil to use same code. install webutil and just replace "OLE2." with "CLIENT_OLE2."
    PROCEDURE spell_check (item_name IN VARCHAR2)
    IS
       my_application   ole2.obj_type;
       my_documents     ole2.obj_type;
       my_document      ole2.obj_type;
       my_selection     ole2.obj_type;
       get_spell        ole2.obj_type;
       my_spell         ole2.obj_type;
       args             ole2.list_type;
       spell_checked    VARCHAR2 (4000);
       orig_text        VARCHAR2 (4000);
    BEGIN
       orig_text := NAME_IN (item_name);
       my_application := ole2.create_obj ('WORD.APPLICATION');
       ole2.set_property (my_application, 'VISIBLE', FALSE);
       my_documents := ole2.get_obj_property (my_application, 'DOCUMENTS');
       my_document := ole2.invoke_obj (my_documents, 'ADD');
       my_selection := ole2.get_obj_property (my_application, 'SELECTION');
       ole2.set_property (my_selection, 'TEXT', orig_text);
       get_spell :=ole2.get_obj_property (my_application, 'ACTIVEDOCUMENT');
       ole2.invoke (get_spell, 'CHECKSPELLING');
       ole2.invoke (my_selection, 'WholeStory');
       ole2.invoke (my_selection, 'Copy');
       spell_checked := ole2.get_char_property (my_selection, 'TEXT');
       spell_checked :=SUBSTR (REPLACE (spell_checked, CHR (13), CHR (10)),1,LENGTH (spell_checked));
       COPY (spell_checked, item_name);
       args := ole2.create_arglist;
       ole2.add_arg (args, 0);
       ole2.invoke (my_document, 'CLOSE', args);
       ole2.destroy_arglist (args);
       ole2.RELEASE_OBJ (my_selection);
       ole2.RELEASE_OBJ (get_spell);
       ole2.RELEASE_OBJ (my_document);
       ole2.RELEASE_OBJ (my_documents);
       ole2.invoke (my_application, 'QUIT');
       ole2.RELEASE_OBJ (my_application);
    END;Call it like this: SPELL_CHECK ('BLOCK.MY_TEXT_ITEM' );

  • How to implement the Export to Excel funtionality in VC like in Webdynpro

    Hi
    I have requirement to display the BAR charts, Pie charts ,Line graphs based on the data retreiving from the R/3 thorgh VC.
    I hope it is possible .
    i have requirement like exporting the data whichis pulled from the R3 to display those charts, this data need to be exported to the Excel sheet by providing the button in VC. Like same way we have the privision in WEbdynpro exporting table data to excell sheet.
    How to implement the same thing in VC,
    Can any body help me
    Regards
    Vijay

    1) yes, it's possible
    2) Another one that's in the Visual Composer WIKI:
    https://wiki.sdn.sap.com/wiki/display/VC/Exportingdatafrom+VC

  • How to refer the trigger written in one form from another form ?

    How to refer the trigger written in one form from another form ?
    Thanks,
    Ravi Shankar

    Try to convert the PL/SQL code from Forms trigger into a PL/SQL library(.PLL),
    and then attach that PLL in your forms.
    Note that all Forms objects should be referenced indirectly, for example,
    you have to rewrite
    :B1.DEPT_CODE := :B2.DEPT_CODE;
    :B3.TOTAL_AMOUNT := 100;
    ==>
    copy('B2.DEPT_NO','B1.DEPT_NO');
    copy('100','B3.TOTAL_AMOUNT');
    This is the best way to share PL/SQL code among Oracle Forms.

  • How to implement the FCKeditor in the WPC

    Hi all,
    can anyone tell me how to implement the FCKeditor in the Web Page Composer?
    I failed to implement TinyMCE because of the domain relaxing thing...
    Thanks a lot
    Steffi

    It's one of J2EE Patterns - Value List Handler.
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html
    Here is some implementation.
    http://valuelist.sourceforge.net/
    and some article
    http://www.devx.com/Java/Article/21383
    Just google "J2EE paging"

  • How to implement the Internationaliztion in VC

    Hi All,
    How to implement the Internationalization in VC. Based on the Portal user Lanugauge attribute. how to implement .? Is it possible to implement the Internationalization , changing the  displaying label data and Title names in VC application.
    Regards
    Vijay

    Hi Vijay,
    I think this help-entry should answer all your questions:
    Preparing iViews for Portal Translation:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ae/48e7428d877276e10000000a1550b0/frameset.htm
    If you have further questions, don't hesitate to ask!
    Regards,
    Christian
    don't forget the points

  • How to implement the pagination  in the entity bean?

    How to implement the pagination in the entity bean? could The rumnum and sub qurey be used in the ejb ql?
    Would you mind giving me some methods to implement it?

    It's one of J2EE Patterns - Value List Handler.
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/ValueListHandler.html
    Here is some implementation.
    http://valuelist.sourceforge.net/
    and some article
    http://www.devx.com/Java/Article/21383
    Just google "J2EE paging"

  • How to implement the search help exit to MM01 for Material by product hiera

    Hi,
    How to implement the search help exit to MM01 T-code for Material by product hierarchy,
    but system default it gives the data from MVKE table, my client wants from MARA table,
    i created the one Function Module, write this code in that FM.
    IF CALLCONTROL-STEP EQ 'DISP'.
    REFRESH RECORD_TAB.
    SELECT * FROM MARA INTO TABLE RECORD_TAB
    WHERE PRDHA = 
    ENDIF.
    I Face the problem what variable i have to pass in WHERE CONDITION, FROM THE MM01 T-code.
    is't require to IMPORT variable from MM01 program, what is that import variable, please give me the solution.
    thanks to all.

    Hi there..
    check my web blog on search help exit...
    [Search help exit code|https://wiki.sdn.sap.com/wiki/x/du0]

  • How to implement the pessimistic locking using toplink with sybase

    we want to allocate the unique primary key to each row when many user try to insert the records concurrently..So what we are trying to do is we calculate the maximum of Primary Key and incremented it by 1. Now we want to Apply the locking concept on the so that unique key will be allocated to each newly inserted row
    Can you please tell me
    1. how we can genrate unique primary key in toplink using sybase?
    2.how to implement the pessimistic or optimistic locking ?which one will be preferable?

    Hi brother
    I think that this link can help you
    http://download-east.oracle.com/docs/cd/A97688_16/toplink.903/b10064/database.htm#1007986
    Good luck

  • How to implement the View V_SEPA_CUST in SAP 4.7 ?

    Hi SAP Experts,
    We are going to implement SEPA in our project and currently using SAP 4.7.
    Is there any way to implement the View V_SEPA_CUST in SAP 4.7.
    I came to know that there is an OSS Note available for this implementation but I couldn't find the same.
    Please suggest me how to Implement the View V_SEPA_CUST in our SAP system, since we need this View for SEPA implementation.
    Many Thanks in Advance.
    Yogesh.
    Moderator message: one thread only per issue, please.
    Edited by: Thomas Zloch on Jan 31, 2012

    Dear Yogesh,
    SAP has just recently released a note you might want to consider: 1834272. One of the preliminary notes for this note is 1784060...
    This works for SAP 6.4. I can not help you where it is specifically related to SAP 4.7
    Hoping it is of use.
    Best regards,
    Raymond

  • How to implements the single thread modal?

    how to implement the singlethread modal in servler/jsp?

    Do you mean 'model?' and 'servlet?' and are you referring to the interface with that name? which your servlet class just has to declare that it implements?

  • How to implement the promotional quantity on a purchase order

    HI,
    Good Afternoon,
    Scenario on a procurement of every 10 Qty we receive 1 Promotional quantity.
    How can we acheive the above
    How to implement the promotional quantity on a purchase order
    Regards
    Kiran T

    Can you consider adding another line at $0?
    Also look at Sundeep Sharma's presentation at http://www.ncoaug.org/NCOAUG%20Training%20Day%20Feb%202009/Sundeep%20Sharma%20-%20Integrating%20Advanced%20Pricing%20with%20Purchasing%20in%20Release12.pdf
    Sandeep Gandhi

Maybe you are looking for

  • Installing OS 10 on an old G4

    I recently acquired an old G4/400 Mhz desktop that has OS 9.22 installed. I'm thinking about installing OS 10.2 or 10.4 on it. Besides the common sense precaution of backing up data, is there anything else I should be concerned about?

  • Serious performance issue with LV 7.1 Development Environment

    I'm posting this issue to the forums prior to submitting a bug report to ensure that the problems I'm having are reproducible. To reproduce this bug, you're going to have to be an advanced user with a large project (hundreds to thousands of VIs) as t

  • Please Urgent help needed.........Cant open Downloads !!

    After the download completes i am unable to open any file.....its says this..... THIS IS THE MESSAGE........ SAFARI CAN'T OPEN THE FILE SAFARI CAN'T OPEN THE FILE  "filename" BECAUSE "filename" HAS MOVED SINCE YOU DOWNLOADED IT.

  • Menus appearing underneath other components

    I am having a problem making my menus appear on top when they 'pop up'. I know this is a problem with mixing heavyweight and lightweight components, and I have been trying to force the menus to be heavyweight but to no avail. I have been trying to se

  • Can't generate code from class diagram

    I have installed Studio Enterprise 8. I tried to create a class, but when I right-clicked on a class, there was no "Generate Code" on the contextual menu. I've tried the Help guide as pasted below. Would appreciate anybody's help. Thanks. To generate