Trigger how to get new and old value for nested table column?

Hi,
I have created a nested table based on the following details:
CREATE TYPE typ_item AS OBJECT --create object
(prodid NUMBER(5),
price NUMBER(7,2) )
CREATE TYPE typ_item_nst -- define nested table type
AS TABLE OF typ_item
CREATE TABLE pOrder ( -- create database table
ordid NUMBER(5),
supplier NUMBER(5),
requester NUMBER(4),
ordered DATE,
items typ_item_nst)
NESTED TABLE items STORE AS item_stor_tab
INSERT INTO pOrder
VALUES (800, 80, 8000, sysdate,
typ_item_nst (typ_item (88, 888)));
Now I would like to create a trigger on table pOrder for after insert or update or delete
and I would like to track the new and old value for the columns inside nested table.
Can anybody direct me how to do it?
I would like to know the sytax for it like:
declare
x number;
begin
x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
end;
Hope my question is clear.
Thanks,
Lavan

Hi,
Try like this:
CREATE OR REPLACE TRIGGER PORDER_I
BEFORE INSERT
ON PORDER
REFERENCING OLD AS old NEW AS new
FOR EACH ROW
DECLARE
  items_new typ_item_nst;
  ordid_NEW NUMBER;
BEGIN
FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
  DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
  DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price:  ' || :new.items(I).price );
END LOOP;
END;Regards,
Peter

Similar Messages

  • How to get new and old value in an alert?

    Hi,
    I created one event alert in Oracle Apps on PER_ALL_PEOPLE_F table.My intention is to execute the concurrent program attached to the alert when the user changes last_name fileld of that table.How can i get the :new.last_name and :old.last_name in alert.
    Please give valuable solution to this question
    Thanks in Advance
    Manoj M

    As I aware of there is not concept of :old vs :new in alert. since you change last_name which mean it is an update instead of correction then you can get the new effective start_date and do minus - 1 to get the previouse record effective end_date and using that you can get the old last name.

  • Cant able to see new value and old value for change in purchase order text

    Hi all ,
    I am not able to see changes done in material's purchase order text in material master. When i use tcode MM04 to see changes done material master it does not report new and old value for change if it is done in purchase order text of that material .
    Thanks in advance  ,
    Shikha

    Hi Shikha,
    I'm not sure it works or not. But you can try SCU3 t.code and table DBTABLOG. May it can help you out.
    I also faced this type of issue in Plant data and it get resolved.
    Try and let me know...
    Regards
    Sunil Sisodia

  • How to get the current month value for a customer exit variable?

    How to get the current month value for a customer exit variable? 
    And also if we have an InfoObject with date value (including date, month, year), then how to derive the month value from this date type of Char.?
    Thanks!

    Hi Kevin,
    Check here........
    Re: Customer Exist for "From Current Date To Month End"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Cal month
    Regards,
    Vijay.

  • Could someone please tell me where I can get new and free games for my

    could someone please tell me where I can get new and free games for my 80 GB iPod classic?

    You can get games from the itunes store, but they're not free.
    iPodArcade has some quiz things, but they are nothing like the games you can purchase.

  • How to get the list of values for a dynamic parameter using Web Services SDK?

    <p>I am struggling to get the list of values for a dynamic parameter of a report.</p><p>I am using Java Web Services SDK ... I tried to use PromptInfo.getLOV().getValues() method but it does not work.</p><p>First of all ... is this possible (to get the list of values for a dynamic param) using Web Services?</p><p>Second of all, if this is possible, how should I do it ... it seems it works fine when running the report from CMC. It asks for DB logon info and after that it provides a list of values.</p><p>Thx </p>

    <p>Your assumption is correct. We are trying to get the LOVs from the Crystal Report. I was not aware that this is not supported by Web Services SDK.</p><p>We used Web Services SDK to integrated the Crystal Reports in our web application. We implemented some basic actions for reports: schedule, view instances, run ad-hoc reports.</p><p>We encountered this problem when trying to run/schedule reports with dynamic parameters (a list of values from DB). We were unable to get the LOVs.</p><p>Please let me know if you can think of an alternative to look at.</p><p>Thanks a lot,</p><p>Catalin </p>

  • How to get max and min salary in a table

    How to get max and min salary in a table

    SQL> select max(sal),min(sal) from emp;
      MAX(SAL)   MIN(SAL)
          5512        800
    SQL>

  • How to compare New and Old long text at PO Line Item

    Hi all,
    I am Using user exit "EXIT_SAPMM06E_013". In user exit i am trying to compare the old and new values of PO maintain at item level. All this values, i am getting in X and Y structures in user exit
    For long text there is no Such structures. When i am trying to fetch the details from FM Read_Text to fetch this values, Every time i am getting old values. Since new values has not yet been store to database.
    Is there any way through which i can compare the old and new values of item Long text.
    Thanks in advance,
    Regards,
    Vikram Singh.

    Hi Vikram,
    Iam not sure though, did you chekced EXIT_SAPMM06E_022 if it helps you in anyway.
    Regards,
    Swarna Munukoti

  • How to get key and text value of field "TNDRST" in VTTK from R/3 into BI

    There is one field call "TNDRST(Tender Status)" in SAP table VTTK in R/3. We can find  key value, but we are unable to find text for this field in VTTK. However we can see text value if we double click domain:TNDRST and go to value range.
    Questions, how to get key value and text of TNDRST together in BI. Do we need to create a master data source for TNDRST text information in R/3 and extracting into BI, if yes, how to? Are there any easy way to do it??
    Thanks,
    Sudree

    Hi Sudree,
    You need to create a generic Text Datasource to extract this information into BI System.
    1. Create a generic DS based on Table: DD07T
    2. The fields should be put in the extract structure.
              DOMNAME (Make this as Selection in the DS ) -
    Filter the Domain Name
              DOMVALUE_L -
    Key Value of Tender Status
              DDTEXT -
    Text / Description
              DDLANGUAGE -
    Language
    3. DD07T is the table with all the Domain names & their values, so in the Infopackage enter the Selection Value for DOMNAME as 'TNDRST' and then run it.
    Or you can create a view out of this table based on DOMNAME filter as 'TNDRST'.
    Regards,
    Chathia.

  • How to get Max and Min value entered in a DOS console?

    Hi there? I wanted to get the Maximum and Minimum value that I entered in a console and displays it. This is using the java.lang.Math class and using it's method max and main. please help. thanks - new to java

    Sounds like you need very basic advice: Start with the tutorials: http://java.sun.com/docs/books/tutorial/index.html
    And if the algorithm is the problem:
    - Make two variables that hold the current maximum and minimum value
    - whenever a value is entered, compare it with the minimum, if it is smaller, set the minimum to that value
    - ditto with maximum
    at the end the two variables contain the maximum and minimum values.

  • How to get new and updated data into LO Excel in Xcelsius

    Dear Experts,
    I have created dashboard on top of webi report by using Live-Office connection. Latest data of webi report is imported into excel and mapped data with components and generated SWF file and exported into server.
    To day my webi report has latest instance with new and updated data. But until unless by clicking "Refresh All Objects" i am not getting updated data into excel.
    When i am trying to open dashboard in BI Launch Pad/CMC it is showing data whatever exist in excel(i.e yesterday data). But here we need to show data of latest instance of webi report.(i.e New and updated data as of now).
    I have selected option "Latest instance: From latest instance scheduled by" in "refresh options".
    My Question & Doubts:
    1) Is it mandatory to open dashboard every day and need to click on "Refresh All Objects" to get updated data into excel or dashboard.
    2) Is there any option to automate this process.
    Regards,
    PRK.

    Hi,
    Schedule the webi report to get the latest data from the source. To answer your query no is doesn't require to open the dashboard every time to refresh the excel to get the latest data.
    Please use the Refresh Before Components are Loaded: Select this option to refresh the data each time the model loads and to use that data as the initial data for the model (using a Reset Button component, it will reset the data to the values from the last time the model was loaded).
    You are using the Live Office  so here automatic refresh is not possible without touch the swf file, you need to use the refresh but to get the latest data. If you are using QAAWS, Web Service & XML then automatic refresh is possible.
    For more information please check the below document for in-depth idea on the design pattern.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b02e31fb-3568-2e10-e78f-92412c3c0a96?overridelayout=t…
    Kindly revert for more clarification!!!
    --SumanT

  • How to classify new and old user account from idm system using SPML

    hi all,
    i can use SPML code to create new user on IDM system but, i can't classifying new or old user account
    any advise ? very thank you in advanced.
    athikom.

    Hi Vikram,
    Iam not sure though, did you chekced EXIT_SAPMM06E_022 if it helps you in anyway.
    Regards,
    Swarna Munukoti

  • How to get monthwise opening qty / value for previous years

    I do not get the month wise opening quantity and values for the items for the previous years using the below query. How i can modify this query to get opening qty / value of any year less than current year.
    Yogesh
    SELECT OPN_ITEM_CODE,
    ---------------------------------------OPENING QTY---------------------------------------------------
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),3)THEN ROUND(OPSTK,3) ELSE NULL END)APR_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),4)THEN ROUND(OPSTK,3) ELSE NULL END)MAY_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),5)THEN ROUND(OPSTK,3) ELSE NULL END)JUN_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),6)THEN ROUND(OPSTK,3) ELSE NULL END)JUL_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),7)THEN ROUND(OPSTK,3) ELSE NULL END)AUG_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),8)THEN ROUND(OPSTK,3) ELSE NULL END)SEP_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),9)THEN ROUND(OPSTK,3) ELSE NULL END)OCT_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),10)THEN ROUND(OPSTK,3) ELSE NULL END)NOV_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),11)THEN ROUND(OPSTK,3) ELSE NULL END)DEC_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12)THEN ROUND(OPSTK,3) ELSE NULL END)JAN_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),13)THEN ROUND(OPSTK,3) ELSE NULL END)FEB_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),14)THEN ROUND(OPSTK,3) ELSE NULL END)MAR_OPQ,
    ---------------------------------------OPENING VALUE----------------------------------------------------
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),3)THEN ROUND(OPVAL,3) ELSE NULL END)APR_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),4)THEN ROUND(OPVAL,3) ELSE NULL END)MAY_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),5)THEN ROUND(OPVAL,3) ELSE NULL END)JUN_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),6)THEN ROUND(OPVAL,3) ELSE NULL END)JUL_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),7)THEN ROUND(OPVAL,3) ELSE NULL END)AUG_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),8)THEN ROUND(OPVAL,3) ELSE NULL END)SEP_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),9)THEN ROUND(OPVAL,3) ELSE NULL END)OCT_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),10)THEN ROUND(OPVAL,3) ELSE NULL END)NOV_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),11)THEN ROUND(OPVAL,3) ELSE NULL END)DEC_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12)THEN ROUND(OPVAL,3) ELSE NULL END)JAN_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),13)THEN ROUND(OPVAL,3) ELSE NULL END)FEB_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),14)THEN ROUND(OPVAL,3) ELSE NULL END)MAR_OPV
    FROM( SELECT SL_ITEM_CODE OPN_ITEM_CODE, SL_DT,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_QTY_BU/IU_CONV_FACTOR/IU_MAX_LOOSE_1)OPSTK,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_VAL_1)OPVAL
    FROM OS_STK_LEDGER, OM_ITEM_UOM
    WHERE SL_ITEM_CODE = IU_ITEM_CODE
    GROUP BY SL_ITEM_CODE, SL_DT
    GROUP BY OPN_ITEM_CODE

    it think you need to look for [lag and lead|http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#sthref1753]

  • How to get telephone and mobile phone for one partner

    Hello Expert,
    In VA03, I open one sales order and go into the partner tab. Then I selection one partner and click "Detail" button, one page with partner detailed information will pop up.
    In the pop-up window:
    There are two fields: Telephone and Mobile Phone.
    In my program, I want to get these two information. 
    I tried to call FM 'ADDR_COMM_GET' by passing address_number(VBPA-ADRNR), table_type('ADTEL'), iv_current_state(SPACE). For some partner, it works, but for others it doesn't work.
    Then I find table ADR2 which is used to keep phone infomration. There are two entries in the table. But how can I identity which one is telephone and which one is Mobile phone?
    So can any expert help me on how to get the telephone and Mobile Phone of the pop-up page?
    Thanks in advance,
    Best Regards, Johnny.

    Read ADR2-TEL_NUMBER where ADDRNUMBER = VBPA-ADRNR and R3_USER = '2' or '3'.
    These are the possible values
            Telephone is Landline Telephone
    1     Telephone is Default Under Landline Telephones
    2     Telephone is Mobile Telephone but Not Default Mobile Phone
    3     Telephone is Default Mobile Telephone
    X     Obsolete - No Longer Valid

  • How to get previous month's values for current month

    Hi..
    I have a requirement on a report, where for a particular month, the key figure value should be from the previous month.
    Eg: KF1 value for Sept 2007 should come from Aug 2007, KF value for Dec 2007 should be the value of Nov 2007, etc.
    There are other key figures on the report which do not need this logic. It is only for one key figure.
    Should we do this on the backend or front-end, and how? Any tips will be appreciated.
    Thanks
    R.

    hi,
    Use a Restricted Keyfigure.
    Drag your KF1 and Drag Calandar Month with a Variable Current Cal Month with variable Offset to -1.
    KEERTTHi

Maybe you are looking for

  • How to remove photos from the photo library

    How can I remove photos from the photo library? I searched and tried the below method. I connected to the PC and open iTunes. I clicked "photos" on the top. Then clicked the box "Sync Photos with" and choose the dropdown and "choose folder" Then I cl

  • Window that slides into view

    Hi all, I'm looking to add a little bit of Swing eye-candy. I have a little pop-up window that informs the user that their file has saved after they hit "save" or Ctr-S. I need it to be noticeable (so that they are assured that their file did indeed

  • Use of field "Open Item management" in Configuration of order types?

    Hi All, Can any body explain me the use of BOX for selectind or de-selecting "Open item management" field for order type in "Configuration of order types"? I need to understand the use of selecting it and not selecting it?

  • Why would some animated gifs loop some not? (all do on other browsers)

    Hello. I have 2 different animated gifs on the site I'm building with Weebly. One of them is a loop which works just fine. The other gif is made to just happen once. However, it will not replay when its page is refreshed or revisited (it does replay

  • Changes in scripts ?

    in intervies ask  we can copied the predefined script & changes happen ?what r the changes you can done. explain plzzzzzzzz ?