Why is the second update in trigger not executing

Hi all I'm just starting with pl/sql . My trigger works but the second update does not execute.
why is it not executing? and how can I get it to execute?
CREATE OR REPLACE TRIGGER bb_ordercancel_trg
AFTER UPDATE OF idstatus ON bb_basketstatus
FOR EACH ROW
WHEN( new.idstage = 4)
DECLARE
CURSOR basketitem_cur is
SELECT idproduct,quantity,option1
from bb_basketitem
where idbasket =:new.idbasket;
lv_chg_num NUMBER(3,1);
BEGIN
FOR basketitem_rec in basketitem_cur LOOP
IF basketitem_rec.option1 =1 then
lv_chg_num := (.5*basketitem_rec.quantity);
ELSE
lv_chg_num := basketitem_rec.quantity;
END IF;
update bb_product
set stock= stock - lv_chg_num
where idproduct = basketitem_rec.idproduct;
update bb_basket
set orderplaced = NULL
where idbasket = :new.idbasket;
END LOOP;
END;

I retract that and with the modified code it works .
thanks guys, I should have drank a little more coffee when I started this ;-)
CREATE OR REPLACE TRIGGER bb_ordcancel_trg
AFTER INSERT ON bb_basketstatus
FOR EACH ROW
WHEN( new.idstage = 4)
DECLARE
CURSOR basketitem_cur is
SELECT idproduct,quantity,option1
from bb_basketitem
where idbasket =:new.idbasket;
lv_chg_num NUMBER(3,1);
BEGIN
FOR basketitem_rec in basketitem_cur LOOP
IF basketitem_rec.option1 =1 then
lv_chg_num := (.5*basketitem_rec.quantity);
ELSE
lv_chg_num := basketitem_rec.quantity;
END IF;
update bb_product
set stock= stock - lv_chg_num
where idproduct = basketitem_rec.idproduct;
update bb_basket
set orderplaced = 0
where idbasket = :new.idbasket;
END LOOP;
END;
Edited by: user8690163 on Dec 8, 2009 12:57 PM

Similar Messages

  • ITunes Playlists:  Why is the new update for iTunes not playing whole playlists?

    Hi,
    All my music comes from my home network and works fine on my laptop, until I try to make a playlist.  The music plays fine until a certain point and then iTunes cannot locate the source files and an exclamation point pops up on the rest of the music I selected.
    If I then double click on the tracks with the exclamation point it finds the source file again, without me having to locate the file.  Very strange.
    Anyone with the same problem?  Or able to help?
    Computer Details
    Laptop: Packard Bell Easynote
    Processor: Intel Celeron @ 2.16GHz
    Memory: 4.00 GB Ram
    Storage Space: 450 GB
    iTunes: 12.1.1.4

    Hi there Glovener,
    I understand that you are seeing an issue with iTunes that has started after an update. Here is an article that talks about  troubleshooting iTunes issues and can help you address this issue:
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues - Apple Support
    https://support.apple.com/en-gb/HT203206
    While the title of the article does not specifically mention your issue, these basic troubleshooting steps will be a good starting point for addressing this. Thanks for coming to the Apple Support Communities!
    Cheers,
    Braden

  • Hello, I just did an update and now the second Language - Hebrew - does not working. why?

    Hello, I just did an update and now the second Language - Hebrew - does not working. why?

    More information please.
    If you are on adobe cloud, download indesign that support hebrew from CC desktop. Click on the preference gear on the top right then select App language.

  • Any ideas why the second HOST call does not work???

    Hi Folks.
    I have written the following code which works fine in all but one respect.
    The code creates a zip file on a server (Accessed over a network) hence the full windows network path name.
    The call to host on the server works in terms of running the zipinvoices.bat file and the zip file is generated on the server in the correct location.
    The prigram unit also generates the correctly formatted mailinvoices.bat file. However, the second call to HOST does not run/execute the mailinvoices.bat file. If I go to the server and run the mailinvoices.bat file directly, it runs perfectly and emails the file to me, no problemo.
    Why does the second call to HOST from the client machine not run?
    Any clues anyone???
    Cheers
    Simon Gadd
    PROCEDURE send_email_invoices_pu_p (p_organisation IN VARCHAR2) IS
    v_processing_cycle          CHAR(4);     
         v_alert_but                              NUMBER;
         v_error_num                              NUMBER;
         v_sent_status                     NUMBER(1);
    v_stage                                        NUMBER(1);
    v_year                                        VARCHAR2(4);
    v_month                                        VARCHAR2(9);
    v_folder_name                         VARCHAR2(25); -- Name of the file which holds the 'Printed' invoices in the receivables folder. v_organisation                    VARCHAR2(50);
    v_password                              VARCHAR2(25);
    v_organisation                    VARCHAR2(25);
         v_host_command                    VARCHAR2(100);
    v_from_name                              VARCHAR2(100);
    v_to_name                                   VARCHAR2(100);
    v_subject                                   VARCHAR2(100);
    v_error_txt                              VARCHAR2(200);
    v_file                                        VARCHAR2(200);
    v_message                                   VARCHAR2(500);
         v_line_buffer                         VARCHAR2(5000);
    v_working                                   BOOLEAN := TRUE;
    v_zipinvoices_bat               TEXT_IO.FILE_TYPE;
         v_mailinvoices_bat          TEXT_IO.FILE_TYPE;
         CURSOR c_sent_status IS
              SELECT sent
              FROM INVOICE_EMAIL
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
         CURSOR c_select_folder IS
              SELECT folder
              FROM INVOICE_EMAIL
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);     
    CURSOR c_select_email_elements IS
    SELECT      send_to,
                        send_from
    FROM INVOICE_EMAIL
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
    BEGIN
    v_organisation := p_organisation;
    -- Check to see if the invoices have already been e-mailed for this Procssing Cycle. If they have,
    -- then warn the user of this and get them to confirm that they wish to proceed and e-mail them again.
    -- The batch e-mail process will re-zip the invoices (ignoring a pre existing .zip file) and overwrite
    -- the existing zip file if it exists or generate it if it does not exist.
         OPEN c_sent_status;
              FETCH c_sent_status INTO v_sent_status;
         CLOSE c_sent_status;     
         IF v_sent_status = 1 THEN
              v_alert_but := SHOW_ALERT('SEND_AGAIN_ALRT');
                   IF v_alert_but = ALERT_BUTTON2 THEN RAISE FORM_TRIGGER_FAILURE;
                        ELSE NULL;
                   END IF;
         END IF;
    :CONTROL.WORKING := 'Started Zipping invoices for '||INITCAP(v_organisation)||'.'||CHR(10)||'Please wait..';
    SYNCHRONIZE;
    -- The following code opens the zipinvoices.bat file which resides in the root folder \\Ebony\c$\FCSS\DB_SCRIPTS\ and modifies it ready to
    -- zip up the invoices in the relevant organisation's invoice folder for the current processing cycle.
    v_processing_cycle := GET_CURRENT_TRAFFIC_PERIOD;
    v_month := RTRIM(INITCAP(TO_CHAR(TO_DATE(v_processing_cycle, 'MMYY'), 'MONTH')));
    v_year := (TO_CHAR(TO_DATE(v_processing_cycle, 'MMYY'), 'YYYY'));
         OPEN c_select_folder;
         FETCH c_select_folder INTO v_folder_name;
         CLOSE c_select_folder;
    KILL_OLD_ZIP_PU_P('del \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\invoices.zip');
    SELECT zip_password
    INTO v_password
    FROM INVOICE_EMAIL
    WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
    v_zipinvoices_bat := TEXT_IO.FOPEN('\\Ebony\c$\FCSS\DB_SCRIPTS\zipinvoices.bat', 'w');
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    v_line_buffer := 'wzzip -s'||v_password||' -x*.zip -ybc \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\invoices \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\*.*';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    v_line_buffer := 'exit';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    TEXT_IO.FCLOSE (v_zipinvoices_bat);
    -- The following code executes the freshly edited \\Ebony\c$\FCSS\DB_SCRIPTS\zipinvoices.bat file to produce the zipped invoices file
    -- ready to be e-mailed out to the address specified in the INVOICE_EMAIL table for the relevant organisation.
    v_host_command := '\\Ebony\c$\FCSS\DB_SCRIPTS\zipinvoices.bat';
    v_stage := 1;
    HOST (v_host_command, NO_SCREEN);
    IF NOT Form_Success THEN
         IF v_stage = 1 THEN
         :CONTROL.WORKING := 'Error -- The .zip file for '||INITCAP(v_organisation)||' was not produced.';
              SYNCHRONIZE;     
         ELSIF v_STAGE = 2 THEN
         :CONTROL.WORKING := 'Error -- The zipped invoices file for '||INITCAP(v_organisation)||' was not emailed.';
              SYNCHRONIZE;               
              END IF;     
    ELSE NULL;
    END IF;
    :CONTROL.WORKING := 'All invoices for '||INITCAP(v_organisation)||' successfully zipped.'||CHR(10)||'Attempting to send via e-mail.'||CHR(10)||'Please wait..';
    SYNCHRONIZE;
    -- The following code e-mails the freshly created .zip file for the relevant organisation and e-mails it to the
    -- recipient specified in the relevant row in the INVOICE_EMAIL programme along with from address, subject and
    -- message if specified.
    OPEN c_select_email_elements;
    FETCH c_select_email_elements INTO
    v_to_name,
    v_from_name;
    CLOSE c_select_email_elements;
    v_stage := 2;
    v_mailinvoices_bat := TEXT_IO.FOPEN('\\Ebony\c$\FCSS\DB_SCRIPTS\mailinvoices.bat', 'w');
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    v_line_buffer := 'clemail -quiet -smtpserver mailhost.0800dial.com -smtpport 25 -to '||v_to_name||' -from '||v_from_name||' -subject "'||v_month||' '||v_year||' Roaming Traffic Invoices from United Clearing Ltd" -bodyfile \\Ebony\c$\FCSS\DB_SCRIPTS\invoice_body.txt -attach \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\invoices.zip';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    v_line_buffer := 'exit';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    TEXT_IO.FCLOSE (v_mailinvoices_bat);
    v_host_command := '\\Ebony\c$\FCSS\DB_SCRIPTS\mailinvoices.bat';
    HOST (v_host_command, NO_SCREEN);
    IF NOT Form_Success THEN
         IF v_stage = 1 THEN
         :CONTROL.WORKING := 'Error -- The .zip file for '||INITCAP(v_organisation)||' was not produced.';
              SYNCHRONIZE;     
         ELSIF v_STAGE = 2 THEN
         :CONTROL.WORKING := 'Error -- The zipped invoices file for '||INITCAP(v_organisation)||' was not emailed.';
              SYNCHRONIZE;               
              END IF;     
    ELSE NULL;
    END IF;
    UPDATE INVOICE_EMAIL
         SET sent = 1
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
    COMMIT;
    GO_BLOCK ('INVOICE_EMAIL');
    EXECUTE_QUERY;               
    :CONTROL.WORKING := 'Please press a button on the left to e-mail invoices to the organisations listed.';
    SYNCHRONIZE;
    EXCEPTION
         WHEN OTHERS THEN
              v_error_num := SQLCODE;
              v_error_txt := SUBSTR(SQLERRM, 1, 200);
              MESSAGE('The error was: '||v_error_txt||' and the code was: '||v_error_num);
              RAISE FORM_TRIGGER_FAILURE;
    END;

    As a suggestion I'd put the Text_io segments into their own begin - exception - end sub-blocks within the main code. This way if Text_io does raise an exception you can catch it earlier as it may be able to recover - That is if it is a text_io exception.
    Other than that you;ll have to step through in Debug.

  • Why did the new update for my macbook air hinder my ability to use my camera for google  and skype but not photobooth or facetime??? This is messed up it was working yesterday and now neither google  or facetime can find a camera on from my mac?

    Why did the new update for my macbook air hinder my ability to use my camera for google  and skype but not photobooth or facetime??? This is messed up it was working yesterday and now neither google  or skype can find a camera on from my mac? what do I do??

    An update for same is coming.
    Theres a patch for same, see here:
    https://discussions.apple.com/thread/5306216?tstart=30

  • Why does the software update say that drivers for my printers are not available? I have the drivers installed from the CD but can't add the printer because it wants to go through software update.

    I have the latest operating system, but can't get my printers added. Why does the software update say that drivers for my printers are not available? I have the drivers installed from the CD but can't add the printer because it wants to go through software update.

    It's pretty difficult to offer suggestions when you say nothing about your Mac, the version of Mac OS it's running, or the models of printers you have. This forum, however, is intended for questions about old, pre-G3 hardware, so unless you are asking about an very old Mac, this is not the forum where you'll be most likely to get help with your problem. I'd suggest you ask this question in the forum for your model of Mac or version of Mac OS X it's running. You'll be more likely to get assistance there, assuming you provide sufficient detail for anyone to make a diagnosis of the problem.
    Regards.

  • Why does the content of my emails not show on the main Mail page but does in the Inbox list of all emails?

    Why does the content of my emails not show on the main Mail page but does in the Inbox list of all emails?

    Try a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release. When the screen goes blank power On again in the normal way.] It is absolutely/appsolutely safe!

  • Why is the Amber update different for ATT and Chin...

    Why is the Amber update different for ATT and China? For Lumia 520, it could tap to unlock but, in china, this function is disappeared disappear. Could you give an expain as the matching hardware, otherwise I think it's a definately discriminatory to Chinese.

    Double tap to unlock is not available for any 520, anywhere in the world. See link below. You should always check first before making allegations. 
    http://discussions.nokia.com/t5/Nokia-Lumia/quot-Missing-quot-new-features-in-Amber/td-p/2061872

  • Why is the Planned quantity in MCP9 not appearing(Repetitive Manufacturing)

    Sub:WHY IS THE PLANNED QUANTITY IN MCP9 NOT APPEARING(REPITITIVE MANUFACTURING
    Why are the planned orders not displayed anymore. They are still in the system - in  MD04 - but since we moved from release 3.1i to 4.0 the plan order qty disappeared  from transaction MCP9!!!!.Now we are using Version 4.7
    There must be a reason 
    Perhaps searching in  SAP OSS system -if the transaction is not supported in rel 4.0 anymore and we should use something else instead
    Or we need to apply an OSS note from SAP to repair the problem...
    Or the info system update must be modified because of rel change... I don't know.
    Please suggest your valuable guidance,Iam not able to enclose a screenshot of the problem,planned qty is 0 or it is not getting displayed.If you reply to this query i can send a detailed analysis to that mail id .

    Dear Guruji Mr.Rajesha vittal,
    Sir ,iam stuck with this problem,not able to proceed.
    Can i send the activites i have completed till now ,I want your e mial id sir for me to send the attachments to you.
    Also i dont know how to award points i need to award points to u for all the solutions i have recieved till now ,can you please explain to me
    I am stuck with this MCP9 problem i have done it according to your suggestion,but still the planned quantities are not displayed. can you please help me out.Very urgent. I need u mail id
    Thanks & Awaiting your reply
    P.S.KIRAN
    [email protected]
    [email protected]

  • HT4623 The software update tab is not in my settings but I can't download certain apps as I need to update ???????

    I have been trying to download some apps and it tells me I need to update my iPad. The software update tab is not there in my settings, Why?????

    If you have an iPad 1, the max iOS is 5.1.1. For newer iPads, the current iOS is 6.1.3. 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).
    Tip 2 - If you're updating via wifi, place your iPad close to your router to preclude getting a corrupted download.
     Cheers, Tom

  • Why do the mac updates take a ridiculously long time

    why do the mac updates take a ridiculously long time? 10 hours? this is ridiculous - my ISP is 40mbps

    Which updates were you trying to get? If you are going to a very busy web site or server, the connections could be extremely slow. But to wait so long invites troubles.
    If the machine is terribly slow, that should be an indication some maintenance or repair may be needed first. Some keyboard shortcuts can be used to check and attempt repair, and the problem likely is in the Mac.
    Everything from the amount of RAM installed, to the total capacity of the HDD (or SSD) vs free or unused space on the drive, is important to the function of the OS X. Or there may be an issue, if the OS X checks out OK, in the internet connection. If you use wireless mostly, check the connections by wire instead.
    Try to not get into a position where you end up using 'force quit' if the computer appears to freeze up. In the process of an update or upgrade, that's almost never a positive outcome.
    Good luck & happy computing!

  • Why is the Acrobat Updater separate?

    Why is the Acrobat Updater separate from the main Adobe Updater?
    Maybe there is a setting to change this but ever since I moved to CS5, 5.5 and now CS6, I get a seperate Acrobat Installer popup. It is a little annoying since ALL the other programs are so neatly streamlined with the Adobe Updater.
    Is there a way I can change this so ALL Adobe products are updated the same way?
    Thanks!
    Dan
    iMac (early 2009), OSX 10.6.8, Creative Cloud subscriber (CS6)

    On which web page are you looking?
    What country are you in (actually in, not your home address if different)?

  • Why does the flash update install mcaffee with out asking!!!

    Why does the flash update install mcaffee with out asking!!!

    Because McAffee pays to have their installer "bundled" with the update. It's not right, and the "blind installer" in the update (with no opt out) has been documented and reported.
    You can download the Adobe Flash Player installer directly (without any bundled installers) by clicking one of the following links.
    Flash Player for ActiveX (Internet Explorer)
    Flash Player Plug-in (All other browsers)
    Bookmark those for future use.

  • Why did the new update for itunes wipe out my music library?

    Why did the new update for itunes wipe out my music library?

    Very vague question.
    It should not.
    There is no way to know with the vague question you asked and no information at all.

  • My phone 5s did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.

    My phone 5s 16gb gold did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.   This phone is not even 6 months old been in case no scratches. This is driving me crazy.

    Connect your phone to a computer and restore your software using iTunes.

Maybe you are looking for

  • WebLogic Server 6.1 SP 3 DocumentBuilder throws IOException: Stream closed

    Hi,           I have a question about XML processing and error handling, and how the           WebLogic container affects things.           Here's what happens to us. We have a servlet parsing XML using DOM.           The servlet has an InputStream w

  • Can I update my Iphone 3gs to IOS 5 on a different computer?

    I am running two different laptops and a desktop with my Iphone 3gs and Ipad2.  I am just wondering if it is ok to upgrade my iphone and ipad to the new 5.0 OS using a different computer than the one I typically sync from. 

  • Export screen not showing up

    Hi guys. Trying to export a photo and the screen with options on where to export to does not show but it IS there. I know this because everything on the screen is unclickable, kinda like being froze but it's not. If I hit enter it attempts to "burn t

  • Suggestion: Group invitation settings

    The Group issue:   Some infuriating people invite you to a very very large group that you do not want to be a part of. You attempt to leave the group multiple times but this person reinvites you, or continually calls you. You do not want to unfriend

  • Multiple users at home (one calendar)

    How do 2 different users on the same iMac share a calendar created in iCal? My husband has created a calendar in iCal under his user name. I would like this to be our master calendar for the home. How do I access and/or update whatever calendar he ha