Update trigger is not working...

Hi
I am writing an update trigger.
We have a two DB, one is application DB and other is reporting DB. We are writing trigger on Reporting DB. There is a job schedule for synchronizing the application data to reporting DB , this daly basis synchronization. So when the synchronization runs and if the FUNDING_RULE_TABLE is updated them my trigger gets called.
CREATE OR REPLACE
TRIGGER COMM_EXISTING_REP_TRIGGER AFTER UPDATE OF FR_IR_NAME ON FUNDING_RULE_TABLE
DECLARE
serialno INTEGER;
CURSOR C_CES_REP IS
Select distinct FR_IR_NAME,FR_IR_CODE from FUNDING_RULE_TABLE ;
V_IR_NAME FUNDING_RULE_TABLE.FR_IR_NAME%TYPE;
V_IR_CODE FUNDING_RULE_TABLE.FR_IR_CODE%TYPE;
CURSOR C_CES_COMIT IS
SELECT DISTINCT FR_IR_NAME1,FR_IR_CODE from COMM_EXSTS_COMIT_AGGR;
IR_NAME VARCHAR2(20);
IR_CODE VARCHAR2(10);
BEGIN
OPEN C_CES_REP;
LOOP
FETCH C_CES_REP INTO V_IR_NAME,V_IR_CODE;
IF C_CES_REP%NOTFOUND THEN
EXIT;
END IF;
OPEN C_CES_COMIT;
LOOP
FETCH C_CES_COMIT INTO IR_NAME,IR_CODE;
IF(V_IR_CODE = IR_CODE AND V_IR_NAME = IR_NAME) THEN
EXIT;
ELSE
update COMM_EXSTS_COMIT_AGGR set FR_IR_NAME1 = IR_NAME where FR_IR_CODE = IR_CODE;
END IF;
END LOOP;
CLOSE C_CES_COMIT;
END LOOP;
CLOSE C_CES_REP;
END COMM_EXISTING_REP_TRIGGER;
The problem is:
When the synchronization runs the trigger will gets called and the synchronization prc never stops because of the table locks.
1)     why some tables are getting locks? (I think this is becuse some source is waiting for another to release-deadlock)
2)     Is there any problem in trigger? (I think there is some problem is trigger)
3)     When I comment below part then sync procedure works fine
OPEN C_CES_COMIT;
LOOP
FETCH C_CES_COMIT INTO IR_NAME,IR_CODE;
IF(V_IR_CODE = IR_CODE AND V_IR_NAME = IR_NAME) THEN
EXIT;
ELSE
update COMM_EXSTS_COMIT_AGGR set FR_IR_NAME1 = IR_NAME where FR_IR_CODE = IR_CODE;
END IF;
END LOOP;
CLOSE C_CES_COMIT;
It menas that there is somr problem in trigger because i am reading and updation is performed on the same table "COMM_EXSTS_COMIT_AGGR ".
Is this is the problem?
waitting for ur rply...thx..
Edited by: 931005 on Apr 30, 2012 2:38 AM

Welcome to the forum!
Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
1) why some tables are getting locks? (I think this is becuse some source is waiting for another to release-deadlock)
>
Because you have an UPDATE statement in your inner loop that may lock one or more rows that are updated.
>
2) Is there any problem in trigger? (I think there is some problem is trigger)
>
Many problems
1. The outer query queries the same table that the update trigger is updating. So some rows may never get seen; rows inserted or updated by other sessions. This means the DISTINCT results may not be distinct at all.
2. The cursors select into SCALAR variables so if either cursor returns more than one row the trigger will raise an exception.
3. The nested cursor loops could be replaced by a simple update statement.
4. The original issue of updating the same table queried by your cursor.
Whatever it is you are trying to do - this isn't the way to do it.

Similar Messages

  • After doing a widows update itunes will not work at all

    after doing a widows update itunes will not work at all

    hiya!
    I get the itunes has encounterd a problem and needs to close, sorry for the inconvenience error, no specific error number. I do not have QT installed,
    not having QT installed is what will be causing your itunes error message at the moment. let's try a careful standalone QT 7.1 install.
    download and save a copy of the QT 7.1 standalone installer to your hard drive. (we'll run the install from there rather than online.) switch off antivirus and antispyware applications prior to the install.
    Quicktime 7.1 Standalone Installer
    if that install goes through okay, does your itunes launch properly again?
    (if you get an error message on the QT standalone reinstall, let us know what it says. include error message numbers if you're getting any.)
    love, b

  • Update process does not work on Tabular Form

    Hello,
    I have 2 tabular forms on one page, which are using manual update processes.
    First form is created using wizard, and therefore works perfectly.
    The update process is as follows:
    DECLARE
      lc_string VARCHAR2(4000);
    BEGIN
      FOR i IN 1..APEX_APPLICATION.G_f01.COUNT
      LOOP
         lc_string := lc_string|| '[' ||APEX_APPLICATION.G_f*03*(i) || '|' || APEX_APPLICATION.G_f*04*(i) || ']';
      END LOOP;
      --Database processing using the concatenated string here
    END;Second form is created manually, using the following code:
    SELECT apex_item.checkbox (30,
                               '#ROWNUM#',
                               'onclick="highlight_row(this,' || '#ROWNUM#'|| ')"',
                               NULL,
                               'f30_' || '#ROWNUM#'
                              ) delete_checkbox,
           CATALOG_ID,
              apex_item.hidden (31, CATALOG_ID)
           || apex_item.text (32,
                              LANG,
                              80,
                              100,
                              'style="width:100px"',
                              'f32_' || '#ROWNUM#'
           || apex_item.hidden (33, wwv_flow_item.md5 (LANG, DESCRIPTION)) LANG,
           apex_item.text (34,
                           DESCRIPTION,
                           80,
                           100,
                           'style="width:255px"',
                           'f34_' || '#ROWNUM#'
                          ) DESCRIPTION
      FROM V_CATALOGS
    UNION ALL
    SELECT     apex_item.checkbox
                              (30,
                               TO_NUMBER(9900 + LEVEL),
                               'onclick="highlight_row(this,' || '#ROWNUM#' || ')"',
                               NULL,
                               'f30_' || TO_NUMBER (9900 + LEVEL)
                              ) delete_checkbox,
               NULL,
                  apex_item.hidden (31, NULL)
               || apex_item.text (32,
                                  NULL,
                                  80,
                                  100,
                                  'style="width:100px"',
                                  'f32_' || TO_NUMBER (9900 + LEVEL)
               || apex_item.hidden (33, NULL) LANG,
               apex_item.text
                                               (34,
                                                NULL,
                                                80,
                                                100,
                                                'style="width:255px" '  ,
                                                'f34_'
                                                || TO_NUMBER (9900 + LEVEL)
                                               ) DESCRIPTION
          FROM DUAL
         WHERE :P18_TEMP = 'ADD_ROWS1'
    CONNECT BY LEVEL <= 1However, the update process does not work on this form.
    I created it using the first one as an example, but with the id's of the second form:
    DECLARE
      lc_string VARCHAR2(4000);
    BEGIN
      FOR i IN 1..APEX_APPLICATION.G_f*30*.COUNT
      LOOP
         lc_string := lc_string|| '[' ||APEX_APPLICATION.G_f*32*(i) || '|' || APEX_APPLICATION.G_f*34*(i) || ']';
      END LOOP;
      --Database processing using the concatenated string here
    END;Also, both forms are opening in a modal pop-up dialog window.
    I use a Dialog Region plug-in for that.
    Please advise, what is causing a problem with update?

    Sloger,
    if this is your tabular form
    SELECT apex_item.checkbox (30,
    ...and this is your update statement
    FOR i IN 1..APEX_APPLICATION.G_f*30*.COUNT
    ...Then you will only ever update records that have been checked. Unchecked checkboxes are not passed back in the global array. You need to have a hidden column with the ID's for the record and loop through that when you are updating/inserting. That is why the built in tabular form has a MRU and a MRD. the MRU loops through the hidden ID column. The MRD loops through the checkbox.
    Thanks,
    Tyson Jouglet

  • Partial Trigger is not working with Panel Group Layout using ADF 11g.

    Friends,
    I have a requirment , Based on the <af:selectBooleanCheckbox> value I have to render <af:panelGroupLayout> dynamically. If the check box is checked then I have to display panel group layout otherwise not. The problem what I am facing here is Partial Trigger is not working, If I Un check the boolean box and refresh the page then I see it is working. If I don't refresh the page I am not seeing this is working as expected.
    Below is the snippet
    <af:selectBooleanCheckbox value="#{bindings.ChkBoolean.inputValue}"
    shortDesc="#{bindings.OtherOptChk.hints.tooltip}"
    id="OtherOpt" immediate="true" autoSubmit="true"
    />
    <af:panelGroupLayout id="pgl11" partialTriggers="ChkBoolean"
    rendered="#{bindings.ChkBoolean.inputValue}"">
    Am I doing anything wrong here
    Thanks in Advance

    Hi,
    I started to document common pitfalls like this. The problem has been reported last month too and is documented in here: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/oct2010-otn-harvest-183714.pdf
    Frank

  • Update Panel is not working browsers other than IE

    In SharePoint 2013, Update Panel is not working for firefox, chrome etc.

    Hi,
    From your description, my understanding is that you use
    <asp:UpdatePanel>tag in your code, but it does not work well in browsers except
    IE.
    I have test
    <asp:UpdatePanel>tag with code below, and it works well in IE, chrome, Firefox
    as the screenshot.
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
    <ContentTemplate>
    <asp:Label ID="lbl" runat="server" Text="Loaded" Visible="true"></asp:Label>
    <asp:Button ID="btn" runat="server" OnClick="btn_Click"/>
    </ContentTemplate>
    </asp:UpdatePanel>
    protected void btn_Click(object sender, EventArgs e)
    lbl.Text = "BUTTON CLICKED !";
    lbl.Visible = true;
    The screenshot below is my result(the first is result in Chrome, second is in Firefox and last is in IE):
    And you also could refer to this article:
    http://sharepoint.stackexchange.com/questions/72928/update-panel-not-working-in-firefox-2013
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Update debugger is not working

    Hi All,
    My problem is "Update debugger is not working" is not working.
    In VA02,  I am creating a EDI output type, before saving it i am going into debug mode activating the 'Update Debugger'.
    But after that a message is coming as 'Update debugging has been triggered' but debugger screen is not coming up.
    Please let me if you have inputs on this.
    Thanks
    Satyamkumar Jha

    >
    Satyamkumar Jha wrote:
    > Hi Saravraj ,
    >
    > Even if 1 session is opened then also it is not going for update debugging.
    >
    > Thanks
    > Satyam
    Did you check if a COMMIT statement is getting triggered(you can do that by placing a break point in the debugger at the statement COMMIT)? Click on F5 once the control reaches COMMIT statment and wait for a new session to
    get opened for debugging.
    Not sure, about the debugger that you are using(classical/New),  lately, I have faced issues with update debugging while using new debugger, it would be a good idea to cross-check in classical debugger.
    -Rajesh.

  • HT4972 My ipad 1 is stuck on IOS 4 as the IOS 5 update instructions do not work. When I use itunes update the software looks for an update file and the apple site doesn't have one!

    My ipad 1 is stuck on IOS 4 as these IOS 5 update instructions do not work. When I use itunes update the software looks for an IOS 5 software update file and the apple site doesn't seem have one anywhere!

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.0.1. For the iPad Mini the iOS is 6.0.2. The Settings>General>Software Update only appears if you have iOS 5.0 or higher currently installed.
    iOS 5: Updating your device to iOS 5 or Later
    http://support.apple.com/kb/HT4972
    How to install iOS 6
    http://www.macworld.com/article/2010061/hands-on-with-ios-6-installation.html
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    If you are currently running an iOS lower than 5.0, connect the iPad to the computer, open iTunes. Then select the iPad under the Devices heading on the left, click on the Summary tab and then click on Check for Update.
    Tip - If connected to your computer, you may need to disable your firewall and anitvirus software temporarily.  Then download and install the iOS update. Be sure and backup your iPad before the iOS update. After you update an iPad (except iPad 1) to iOS 6.x, the next update can be installed via wifi (i.e., not connected to your computer).
     Cheers, Tom

  • After doing last Mavericks update, Messages is not working properly

    Since yesterday, after doing last Mavericks update, Messages is not working properly - the Dock icon is not bouncing nor showing any number for new messages. Very annoying, since I usually have Messages on background while working and I now i don't realize if people is chatting me unless I open the messages wondows.

    Hi,
    Check System Preferences > Notification is set for Messages
    In Messages > Preferences > General Section change the Sound option for Message Received.
    Restart the app and test this sound is (still) playing.
    Place app in background an iMessages "yourself" form your iPhone.
    Does the sound Play ?
    10:18 pm      Wednesday; November 13, 2013
      iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • When-mouse-click trigger is not working

    Hi,
    My forms version is 10g.
    I've a black level and item level when-mouse-click trigger.
    There is some code inside that which is not being executed.
    To test, i simply printed a hello message inside the trigger's code.
    Even hello is not being displayed.
    Can anyone please help me in why this trigger is not working.
    Navnit

    You have some other issues going on if you don't see anything from a when-mouse-click trigger.
    First of all, are you spelling the trigger using a dash or underscore? WHEN-MOUSE-CLICK will run, but WHEN_MOUSE_CLICK will not.
    Have you set :SYSTEM.Message_Level to some value above zero in the form? If so, set it back to zero.
    On what object are you trying to click? Is this causing navigation? Navigation may cause validation to run, which may fail, which may prevent the navigation, which may prevent your when-mouse-click from running.
    And last, are you sure you are running the currently compiled fmx version of your form?
    When nothing works, you need to back up and start finding out what DOES work first.

  • How do I uninstall the iPhoto update which does not work on maverick?

    How do I uninstall the iphoto update which does not work. ie it tells me my library is locked out and the recommended action by apple does not open the phot library first aid. ? i need to go back to the old iphoto.

    Terence, I was trying a way to message you directly - jumping on a recent thread seemed to be the only way (sorry, DEW45). 
    Terence, you seem to be the foremost expert on apeture and iphoto and have helped me many times in the past (thanks).  I have a question that you may be able to help with (anyone also feel free to take a stab).  I use blogger to upload my photos and host my blog (www.sippingespresso.com).  I spend hours organzing and editing photos - namely, I will enhance and sometimes alter an image in Apeture.  It always saves over the orginal file (at least for viewing purposes), which is fine by me.  But then when I go to upload the photos onto blogger it seems to always pull my dull, original image.  Obviously, I want the newer, bright, enhanced photo.
    I'm one step away from importing them, dragging them out of iphoto and into Photoshop, then editing the files and dragging them back into iphoto, deleting the originals and uploading from there.  There HAS to be a better way - please help!!  I've already posted far too many boring images without the beauty of Apeture's "auto enhance".
    Thanks in advance, Terence or anyone else. 

  • App store, Safari, software updates, icloud, do not work in Mavericks 10.9 using a proxy server

    App store, Safari, software updates, icloud, do not work in Mavericks 10.9. these problems are interrelated I am sure. Apple apps were working fine in 10.8.5 I could do software updates through a proxy server using password authentication. I reinstalled a new system 10.9 on another partition and it won't let me use Safari or update software using a proxy server. Firefox works fine (I am using it to post). I am very disappointed that this wasn not fully tested BEFORE releasing Mavericks. Any solutions would be greatly appreciated.

    I had this problem myself.
    Checked the system log with Console, and I found the entry:-
    Nov 11 11:16:41 teds-new-mac.ad.mycompany.co.uk ocspd[537]: Authentication challenge received for "10.203.39.212:8080", unable to obtain proxy server credential from System keychain.
    For some unknown reason, Mavericks seems to be looking in the System keychain, when these credentials are actually held in the Login keychain.
    So, I tried "Copy & Paste"  - copying the https user name & password from the Login keychain and pasting into the System keychain, which worked but it's not quite as straightforward as I initially thought.
    Pasting into the System Keychain was, I found a not-very-intuitive process:
    Having opened your Login Keychain, click once on the item to be copied and when it's highlighted, select "Copy" from the Edit menu or, of course, cmd+c.
    Select the System Keychain:- DO NOT CLICK THE PADLOCK IN THE TOP LEFT TO UNLOCK IT.
    From the Edit menu, select "Paste" or cmd+v.
    You will then get a dialogue box,, enter your administrator's password and select "Modify Keychain" or just hit return, as it's the default entry.
    I found a restart was in order before it recognised everything and would accept https pages without alert boxes, but YMMV.
    Funnily enough - and this is where it seems counter-intuitive, if you do click on the padlock and unlock the System Keychain, "Paste" is greyed out in the Edit menu and cmd+v has no effect.
    Exactly the opposite to what I'd expect..

  • HT4623 how to update to ios 6.1 when my update software is not working

    I have iPhone 4s how to update to ios 6.1 when my update software is not working when I click software updates the gear is turning and there is a message downloading and estimating time remaining but I stays like that for two days now nothing is happening what can I do?

    MICHAEL MI IPOD ES 4 Y TAMBIEN QUIERO DESCARGAR IO7 PERO ME MARCA ITUNES QUE EL IO7 ES UN BETTA Y EL 21 DE SEP ITUNES BUSCARA UNA ACTUALIZACIO DE SOFTWARE DE IOS Y EL QUE SIGUE ES EL 6.1.3 Y LUEGO EL 7.0 DESPUES EL IOS X Y DESPUES EL IOS 7.1.2 MI DUDA ES CON CUAL SE VA ACTUALIZAR MI IPOD4 EL 21 DE SEPTIEMBRE

  • Looks like updates via the App. store update option is not working again. Comments?

    Looks like updates via the App. store update option is not working again. Comments?

    There are a number of other threads from people reporting a problem with a blank Updates tab in the App Store app - it looks like there is a problem at Apple's end which they need to fix.
    Some posts are suggesting that you if you go into the Purchased tab in the App Store app you might be able to update the apps from there, though you will need to scroll through the list to find those with updates and individually update them.

  • After update insert trigger is not working correctly

    Hello experts!
    I created an after insert/update trigger and what strikes me is that it is not working as expected.
    The trigger launches a procedure that does an insert in a second table if values in the triggered table ("my_table") are altered.
    The problem is that the values in my second table, which are correlated to "my_table", are not changed with the correct values right away. The trigger and insert trails behind!
    I have to update twice for the values to appear in my second table. Only then, the data of the first update will be inserted into the second table wheras the parent table ("my_table") will hold the latest values.
    Do you have an idea what could be wrong?
    create or replace
    trigger myscheme.after_update_insert_set_tw
    after update or insert
      on myscheme.my_table
      for each row
    declare
    begin
    pr_my_table_tw_sync_sk(:new.lng_falle, :new.int_fallennummer, :new.lng_schaedling, :new.objectid);
    end;Brgds,
    Seb

    Okay I'll give my best to explain what my procedure is supposed to do and what the table structure is like. I hope it'll help you to help me :-)
    My parent table is called fangzahlen and is created as follows:
    CREATE TABLE "BORKI"."FANGZAHLEN"
       (     "OBJECTID" NUMBER(10,0) NOT NULL ENABLE,
         "LNG_FALLE" NUMBER(10,0) NOT NULL ENABLE,
         "LNG_BEARBEITER" NUMBER(10,0),
         "DATE_DATUM" DATE DEFAULT SYSDATE NOT NULL ENABLE,
         "INT_FALLENNUMMER" NUMBER(4,0) NOT NULL ENABLE,
         "LNG_SCHAEDLING" NUMBER(2,0) NOT NULL ENABLE,
         "INT_VOLUMEN" NUMBER(10,0),
         "INT_ANZAHL" NUMBER(10,0),
         "INT_ANTEIL_JUNGKAEFER" NUMBER(3,0),
         "BOOL_KOEDERWECHSEL" NUMBER(1,0),
          CONSTRAINT "PK_FANGZAHLEN" PRIMARY KEY ("OBJECTID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
          CONSTRAINT "CHECK_DATE_DATUM" CHECK ("DATE_DATUM" >= '1.apr.2006') ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;It holds values such as:
    OBJECTID,"LNG_FALLE","LNG_BEARBEITER","DATE_DATUM","INT_FALLENNUMMER","LNG_SCHAEDLING","INT_VOLUMEN","INT_ANZAHL","INT_ANTEIL_JUNGKAEFER","BOOL_KOEDERWECHSEL"
    97548,"39","1081","08.04.10","1","2","","220","","0"
    97534,"39","1081","06.04.10","1","2","","100","","-1"My subtable is called tbl_test and created with:
    CREATE TABLE "BORKI"."TBL_TEST"
       (     "OBJECTID" NUMBER(12,0) NOT NULL ENABLE,
         "LNG_FALLE" NUMBER(10,0),
         "DATE_DATUM" DATE,
         "INT_FALLENNUMMER" NUMBER(4,0),
         "LNG_SCHAEDLING" NUMBER(2,0),
         "INT_VOLUMEN" NUMBER(10,0),
         "INT_ANZAHL" NUMBER(10,0),
         "LNG_FANGZAHLEN" NUMBER(12,0)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;Okay, this were the prerequisites!
    Let's concentrate on the trigger and procedure:
    The purpose of the procedure is to insert data into tbl_test once a record in "fangzahlen" has been updated or inserted.
    Tbl_test holds the mean average values (int_anzahl) for a number of collected items (lng_schaedling).
    I need to insert date values for the combination of each lng_fangzahlen, lng_schaedling, lng_falle and int_fallennr into tbl_test.
    If I had the following data in table fangzahlen:
    97548,"39","1081","08.04.10","1","2","","220","","0"
    97534,"39","1081","06.04.10","1","2","","100","","-1"the query in the insert section of my procedure returns the following data when run manually:
    97534     31.03.10     16,667     (null)     1     39     2
    97548     06.04.10     110     (null)     1     39     2Now, I need to generate the dates between the first and the second objectid (column 1 in the data above).
    Hence,
    97534     31.03.10     16,667     (null)     1     39     2
    97534     01.04.10     16,667     (null)     1     39     2
    97534     02.04.10     16,667     (null)     1     39     2
    97534     03.04.10     16,667     (null)     1     39     2
    97534     04.04.10     16,667     (null)     1     39     2
    97534     05.04.10     16,667     (null)     1     39     2
    97534     06.04.10     16,667     (null)     1     39     2
    97548     07.04.10     110     (null)     1     39     2
    97548     08.04.10     110     (null)     1     39     2
    My problem is thatthe values above will only appear after I do another update to table fangzahlen or insert a new record into it. Theoretically the result above should be inserted right away?
    Below is my procedure, which might give you a better idea of what I am trying to do! Please excuse this rather awkward explanation. If you need more info please don't hesitate to ask for it!
    create or replace
    Procedure "PR_FANGZAHLEN_TW_SYNC_SK"
        Pr_falle        Number,
        Pr_fallennummer Number,
        Pr_schaedling   Number,
        Pr_objectid     Number)
    Is
      Y                Number (10);
      pragma autonomous_transaction;
    Begin
    -- first all records should be deleted from the subtable i.e. tbl_test
        delete from borki.tbl_test where lng_falle = pr_falle
            and int_fallennummer = pr_fallennummer
            and lng_schaedling   = pr_schaedling
           and date_datum       > '31.03.2010';
          commit;
          For Rec In
          (select objectid lng_fangzahlen,
            date_datum,
            prev_date,
            (date_datum - prev_date) difference_in_days,
            round((
            case
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 1
              then int_volumen * 40
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 2
              then int_volumen * 550
              when nvl(int_anzahl,0) > 0
              then int_anzahl
            end ) / (date_datum - prev_date),3) counted_bugs,
            int_fallennummer,
            lng_falle,
            lng_schaedling
          from
            (select objectid,
              date_datum,
              case
                when lag(date_datum) over(order by date_datum) is null
                then to_date('31.03.2010')
                else lag(date_datum) over(order by date_datum)
              end as prev_date,
              int_volumen,
              int_anzahl,
              int_fallennummer,
              lng_falle,
              lng_schaedling
            from borki.fangzahlen
            where lng_falle      = pr_falle
            and int_fallennummer = pr_fallennummer
            and lng_schaedling   = pr_schaedling
            and date_datum       > '31.03.2010'
           -- and objectid         = pr_objectid
            order by date_datum desc
          order by date_datum asc
          Loop
            Y := 1;
            While Y < rec.difference_in_days + 1
            Loop
              Insert
              Into tbl_test
                  lng_fangzahlen,
                  date_datum,
                  int_anzahl,
                  int_volumen,
                  int_fallennummer,
                  lng_falle,
                 lng_schaedling
              select objectid lng_fangzahlen,
            prev_date +Y,
            round((
            case
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 1
              then int_volumen * 40
              when nvl(int_volumen,0) > 0
              and lng_schaedling      = 2
              then int_volumen * 550
              when nvl(int_anzahl,0) > 0
              then int_anzahl
            end ) / (date_datum - prev_date),3) counted_bugs,
            int_volumen,
            int_fallennummer,
            lng_falle,
            lng_schaedling
          from
            (select objectid,
              date_datum,
              case
                when lag(date_datum) over(order by date_datum) is null
                then to_date('31.03.2010')
                else lag(date_datum) over(order by date_datum)
              end as prev_date,
              int_volumen,
              int_anzahl,
              int_fallennummer,
              lng_falle,
              lng_schaedling
            from borki.fangzahlen
            where lng_falle      = pr_falle
            and int_fallennummer = pr_fallennummer
            and lng_schaedling   = pr_schaedling
            and date_datum       > '31.03.2010'
            order by date_datum desc
          order by date_datum asc
              commit;
              Y := Y + 1;
            End Loop;
          End Loop; -- end of cursor
      Exception
      When No_data_found Then
        Null;
      When Others Then
        -- Consider logging the error and then re-raise
        Raise;
      End "PR_FANGZAHLEN_TW_SYNC_SK";

  • Trigger is not working while updating the values of UDF

    Dear Freind,
    I have created one Trigger for ORDR for Sales order. It is working fine. For that i have created two UDF to Title level. When i fill all fields it shows the correct result in DocTotal. But problem is that, while updateing specific record it also update but only refresh the DocTotal.
    Means suppose i change the value of UDF fields that time it is not working it gives following error.
    "There is difference between the document total and component total"
    ALTER TRIGGER AmountForPC1
    ON dbo.ORDR
    AFTER INSERT,
    UPDATE
    AS
    SET NOCOUNT ON
    UPDATE x
    SET x.DocTotal = COALESCE(i.DocTotalSy, 0) + COALESCE(i.U_Ref, 0) + COALESCE(i.U_Sub, 0)
    FROM dbo.ORDR AS x
    INNER JOIN inserted AS i ON i.DocEntry = x.DocEntry
    Thanks
    Swapnil

    Hi Swapnil,
    Are you aware that you might run into trouble, at least when it comes to a support case, because you have created triggers?
    Accordingly to note [896891|https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMSZ3PTU4ODAwMDAr)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=896891] triggers are not supported.
    Regards
    Mario

Maybe you are looking for

  • Windows Vista start-up problem

    Please help!!! I have hp pavilion p6152f with vista 64-bit. I used windows 7 upgrade program to upgrade to windows 7. After several OS freezing i decided to recover to Vista using hard drive partition. So i did it but vista never started. I am unable

  • MS Excel as data source - Cannot create chart views

    Hi, I created a model with sql server and excel as the data sources. Most of the numerical data is coming from excel. In Answers, I created a table view and it showed me all the data (Eg months, budget amount, plan amount, actuals amount ). But when

  • JavaScript and Content Server Portlets

    Header, footer, news, custom, doesnt matter. Can you use javascript in them and if so, to what extent? For mouseovers, animation, div tag management and manipulation, etc...

  • Error message in systems preferences

    Hi. I attempted to open the users & groups preference pane and got this message: Preferences Error could not load users & groups preference pane Other preference panes open just fine. Signed in as owner of my own machine. has worked fine in the past.

  • SetBackground(Color.WHITE) not working

    I am trying to set background color to white, but it's not working. Can anyone find out the problem? import java.io.*; import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.font.FontRenderContext; import java.awt.font.LineMetri