Question about a TRIGGER

Hello

I have problems creating a trigger. I have 4 tables (customers, Agents, products, orders):

customers (cid char (4) not null, cname varchar (13), city varchar (20), real discnt);

agents (char (3) not null, Anom varchar support (13), city varchar (20), number (6)) percent;

products (pid char (3) not null, pname varchar (13), city varchar (20), number (10) of real price, quantity);

orders (ordno number (6) not null, char (3) months, cid char (4), tank (3) aid, pid (3) tank, number (6) qty, float $);

I'm trying to write a TRIGGER that will increase the volume of a customer discnt every time they place a new order. Here's what I've written so far:

SQL > CREATE OR REPLACE TRIGGER UpdateDiscnt
2 AFTER INSERT ON orders
3 AS NEW SEO newOrder
4 BEGIN
5 UPDATE customer c SET c.discnt = c.discnt + 0.2
6. WHERE (SELECT newOrder.cid FROM Orders o WHERE c.cid = newOrder.cid);
7 END;
8.

WARNING: Trigger created with compilation errors.

SQL > errors see her trigger UpdateDiscnt;
Errors for UPDATEDISCNT TRIGGER:

LINE/COL - ERROR
2/1 - PL/SQL: statement ignored
3/69-PL/SQL: ORA-00936: lack of expression


At the moment I'm learning this material, so I would greatly appreciate any comments or suggestions. In addition, please tell me if this is a completely bad way to accomplish the task. I try to create the TRIGGER of the example, what I went through on the internet, so I could be way out of my attempts.

Thanks in advance,
Jason Beer

Hi, Jason.

In the error messages for the triggers, line numbers beginning with the first statement DECLARE or BEGIN.
On line 3, you need a colon in: newOrder. The error message on line 2 which means simply that the error on line 3 all caused the statement to be ignored.

If fix you this, you will have another error, because there no (for example EXISTS) operator in the WHERE clause and the subquery is trying to reference the table orders itself, which is not allowed.

I think that's what you want:

CREATE OR REPLACE TRIGGER UpdateDiscnt
AFTER INSERT ON Orders
REFERENCING NEW AS newOrder     -- No : needed here - newOrder is okay
BEGIN
     UPDATE  Customers     c
     SET         c.discnt     = c.discnt + 0.2
     WHERE      c.cid          = :newOrder.cid;
END;

You are very smart to write a tiny trigger first. Take baby steps. Once you get this well in running and tested, add as little as possible and test again.

Tags: Database

Similar Questions

  • question about the trigger

    Well, I create 1 table 2 columns id and name (primary key on this name and id)
    2 table 4 column id2, name2, qnty and rates that relate to the foreign key of the table 1
    now, in the form builder, I built a form
    table 2
    I want whenever I get the id of the table on the table 2 id2 name2 the name of table1
    I try this, but his does not work
    Table 1 column id trigger when_validate_item
    Select 1 name in: 2.name2 where 1.2 1.id = 2.id2;

    This is not forum forms. Please post the problem here->

    Forms

    And close the thread marked as answer here.

    Kind regards.

    LOULOU.

  • A few Questions about the advanced Actions window

    Hello

    I have a few questions about the progress of the Actions (using the version of track CP7)

    1. What is the function of the action to "continue?"   Out of the peak action and advance the playback cursor?

    2. What does mean this comment "Nested calls to action advanced is a nice improvement."? Is the advanced decision at the top of a page of action tabs?

    3. What is the function of the option "custom" in the IF statement - "preform action if - custom", it doesn't seem to do anything for me?

    4. where can I get information about the timeline / playhead interaction with advanced actions, i.e. where the playhead is going again at the beginning of the slide. slide custom question - display button, e.g. verification of responses, comments - when all the objects are at the beginning of the timeline. I'm looking more for the read head of infromation functionality rather than how to implement this type of question.

    Thank you

    Donal.

    Continue: If an advanced standard action is triggered by a button, this will not trigger the playback head. If you want out, you can use continues. Continue can also be a choice in a conditional action, when one orders branching has nothing to special, but in advance. Continuous is also the "dummy" statement/command (this is the official name of a line in the dialog box advanced actions) If a statement has become unusable due to some reasons, it will be replaced by continue

    There is no nested call stocks advanced possible right now, one of my many feature requests. It would be sort of a subroutine that you can use over and over again, instead of having to create each time when necessary.

    A decision is one of the conditions to be an advanced conditional action. They allow to create more complex actions, as a loop or arrays are not possible. All decisions are executed in sequence and always.

    Custom: is a combination of or but it is rather limited, because you cannot use parentheses.

    I guess you'd better visit my blog if you want to learn more about the advanced actions.

    http://blog.lilybiri.com/

    I also did several Webinars on stocks advanced, last this afternoon (on the sharing of the actions) for Adobe. They are all available on request.

    Lilybiri

  • A few questions about the making of the animated for a site Web Nav buttons

    Hello, I have a few questions about creating some animated for a NAV buttons.

    There are 2 actions I want to trigger on pouting above.

    If I want to use a static (PNG) image I created in Photoshop for the real button, can I use that? I want well drag the button down on the passage of the mouse and drag upward on the mouse. If I push the part of the "Web" button (sorry, that it comes from a Photoshop guy) it will disappear in the final animation? Another way to say this, if I put something lively off the coast of the white area, it no longer appears in the movie (.swf) when it is published?

    For the second part. You can see a bit of what I want to do if you look high Nav of the page of the website: http://www.photoshopsupport.com/index.html

    I need the 'light' above the button and it's going to be on another < div > color so I can't put a solid color of BG for my flash document. But I want to get the effect of the 'bar' lighting up above the button and the real key slide downwards to pouting on.

    You can provide any help would be greatly appreciated.

    We target the dynamicaly graph. Since the MouseEvent is now on the invisible sprite and not the graph itself, the one-for-all function has no reference to this graph. You can access the invisible sprite with event.target (or event.currentTarget), you can also target the chart because we declared "mygraphic" custom property to serve as a reference for the graphic. Thus, event.target.mygraphic is the benchmark for graphics.

    Of course, this is just an example. There are other variations of this trick.

    ____________________

    Design Cyboide

    Web site creation

  • Where can I ask a handful of general order questions about Firefox OS as a consumer and get the answers? (a forum or something similar)

    I have about seven questions about Firefox OS. I'm potentially interested in opting for a tablet that works instead of Android or iOS. I couldn't find a place to ask questions like that. Thank you!

    https://support.Mozilla.org/en-us/forums/Firefox-OS-English-Forum

    There is another option.

  • About a month ago I posted a question about iMovie and not being able to "share". I solved the problem thanks, so no more emails!

    About a month ago I posted a question about iMovie and not being able to "share". I solved the problem thanks, so no more emails!

    Hi Michael,

    If you want to stop receiving notifications by electronic mail, in the thread, that you have created, then I suggest that you follow the steps below:

    One time connected to the Apple Support communities, visit your mini profile and select manage subscriptions.

    Content

    To manage this content, you are currently subscribed and changing your preferences, select the content.

    Select next to see what content you are currently following.  Note that any thread you are responding you subscribe you automatically to this thread.

    You can select to terminate a subscription to a thread.

    Learn how to manage your subscriptions

    Take care.

  • Where and how do I ask questions about Email?

    The Commission opening thingy is complicated, I have trouble finding my way around it.  I don't know where or how questions about email.  Is there an easier way than trawling through all these icons?  Like a list or something - as you get on all other forums on the internet?

    It would be a good starting point: Mac mini

    Or the appropriate under MAC Os and system software section.

    You might also find this useful: find answers and new questions

  • Many questions about the HP 50 g

    I just ordered a HP 50 g graphic calculator! I have a few questions about this so hang on tight! What is the USB connector on the calculator? Mini-USB, micro USB, or is it a connector owner, "custom". Then, it would be possible to connect a keyboard to the HP 50 g by using the USB Port? Is there a program that would make this possible? (I doubt it would work if you plug it..) I have a Mini-USB to female USB 2.0 connector. So I could just plug the keyboard right, provided that the port on the calculator is a Mini-USB Port. If this is not so that I could use my female to female USB adaptor to connect the keyboard.

    Thanks for your help,

    Zekelegge

    Hi!, zekelegge:

    Welcome to Forum!

    The only printer I use, 50G calculators, 48GII, 39GS and 17BII +, as well as many former models, such as the 48 s/SX/G/G + / GX, 38 G, 39 G, 42, 41 C/CV/CX and 28 C/S, is the infrared printer HP 82240 b. If you can use the emulator HP50G, on the PC, the simulator of the printer, you can download, since... http://www.HPCalc.org/details.php?id=7386

    The printer... HP 82240 B

    The cable series...

    The description... http://www.allenwan.com/hpcalcserialcable/

    The original cable...

  • Question about warranty after exchanges of RAM on Satellite module series

    Hello together,

    I have a question about the warranty. My laptop is 5 months old and now I want to improve it with more RAM. I want to do it myself, and now I'm wondering if the warranty will be getting hurt.
    Thanks in advance for your answers.

    Concerning

    TiG3r

    For new models of laptops the RAM upgrade described in s operating manuals. It is public act and it shows the owner of the notebook how do RAM upgrade only.

    If Toshiba offers something like this he won't have the negative influence of valid warranty.
    Buy a compatible module and RAM upgrade.

    Bye and good luck!

  • A few quick questions about the Satellite P300 - 18 M

    Hello

    I am about to order a Satellite P300 - 18 M and have just a few questions about this:

    (Although these may apply for other similar Satellite/Equium P300.)

    Is the touchpad made by / to use the Alps or Synaptics driver?

    It has the Wireless N network card, is the map made by Intel or Realtec?

    And also, someone has experience with face recognition software to connect?

    If so, does it take a lot of time to initalise?

    Thanks in advance,
    Jack

    Hello

    The P300 - 18M belongs to the PSPCCE series.
    It uses the two touchpad drivers. Synaptics & Alps Electric
    There is an Intel 802.11agn minicards WLan installed

    The face recognition is a nice tool but local to be illuminated and you must take your face the right of the post sometimes it of not very easy

    But if you face is recognized correctly that the connection should work properly

    See you soon

  • Questions about nb200

    I recently bought a mini nb200 with windows 7 and I have a few questions about it. How can you set up your email, I was willing to put up with Outlook Express, but I don't know if I can. Also, is there a way to get a paper copy of the user manual?

    You can download and install a new e-mail program when you download Windows Live via Microsoft Update. You can select the components of Windows Live, you want to include by checking a box for each you want. I installed all the. Or you can use Outlook, if you have Microsoft Office and you want to install it.

  • A few questions about the difference between the Satellite P70, L70, S70

    Hello, I have a lot of questions about the P70, L70, S70 series that come with a 1920 x 1080 panel.

    (1) what are the differences between the L70 and S70 series? With the exception of the RAM and HARD drive capacity, books seem pretty identical.

    (2) P70, L70, S70 doesn't support a 2nd HARD drive or it's just the P70 series that support?

    (3) all the three (P70, L70, S70 series) come with the same TFT panels?

    (4) of the above series, which supports mSata?

    (5) all the model of each series are delivered with support from mSata? For example, it could be that L70 - a - 13 m supports mSata is not the case of the L70-a-146?

    (6) all the foregoing, are delivered with a S - ATA II or III S - ATA interface?

    (7) who is the best of these series listed? I'm trying to understand what makes the big difference of S70 to P70 except for the envelope for example.

    Thank you in advance.

    > (1) what are the differences between the series L70 and S70? With the exception of the RAM and HARD drive capacity, books seem pretty identical.

    What models Sat L70 and S70 do you mean exactly? There are different L70-xxx-xxx and S70 models on the market that supports different hardware specifications.

    (> S70 2) P70, L70, support a 2nd drive HARD or is - it just the series P70 that support?
    As you can see in this [Sam P70 HDD replacement document, | http://aps2.toshiba-tro.de/kb0/CRU3903II0000R01.htm] the P70 series supports the 2nd drive Bay HARD, BUT even if there is a 2nd HARD drive Bay, this does not mean that you can use the 2nd HARD drive. In the case where the 2nd HARD drive Bay are equipped with HARD drive connector, you can use the 2nd HARD drive

    I also found the [Sam L70/S70 HDD replacement | http://aps2.toshiba-tro.de/kb0/CRU3703HG0000R01.htm] the document on the Toshiba page and there I see this 2nd HARD drive Bay is not available

    (> 3) all three (P70, L70, S70 series) come with the same TFT panels?
    See point 1). Different P70, L70, S70 models were equipped with different material parts.

    (> 4) of the series above, which takes in charge mSata?
    As far as I know that some P70 models are equipped with an mSATA SSD of 256 GB.

    (> 5) do all the model of each series are delivered with support mSata? For example, it could be that L70 - a - 13 m supports mSata is not the case of the L70-a-146?
    See point 4) not all models supports the same hardware specifications

    (> 6) all of the above, come with a S - ATA II or III S - ATA interface?
    I don t think that SATA III is supported. I guess it would be SATA II

    (> 7) which is the best of these series listed? I'm trying to understand what makes the big difference of S70 to P70 except for the envelope for example.
    Not easy to answer because there are too many models released in Europea.
    And not all models are available in each country. So I guess you will have to look for the models that have been released in your country.

  • Satellite L650-11R - a few questions about this

    Hello there :-)

    I have a few questions about my new L650.

    I've never had Toshiba notebook before so I apologize if some of these "quirks" are actually quite normal on this laptop. I really want to hear the views of other users L650.

    1)
    First of all, by the time I turned it on I saw gradient thin (1-2 mm) along the right edge of the screen that goes from the bottom up. Maybe "degraded" isn't the right word, but it seems that since two or three pixels are kind of discoloration or lose brightness/sharpness to the edge along the straight bezel. It is not really that visible, looks like the colors are desaturated a bit here or brightness is a bit lacking. He can be seen everywhere (bios or no color in Windows, but better in the lighter background).
    The left side (or other) seems ok, all this along the right edge is somewhat suspicious. If one can compare? I don't know if it's something to worry about or is just supposed to be like that.

    2)
    The other thing I noticed heating of the processor (Intel i3 330M) and GPU (ATi Mobility Radeon 5650). It's pretty hot here right now (I would say that the temperature is around 28 degrees Celsius when using cell phones). He is sitting on the hard surface (table) and nothing is blocking the vents.
    However, at "rest" (surf the web & regular light stuff), average CPU temp hovers around 58 ° C. It usually goes from 45 to 62 in just a few minutes after starting, and then I can hear and see (Toshiba PC Health Monitor) evacuate the kicks in. Temp goes back to 50 +, event stops and then the temp rises to 60 + until the vent is used again.
    During load full (Prime95 or some games), CPU is going all the way up to 75 degrees (the highest being 77). Fan runs at 75 to 77% during this time, never go faster.

    GPU idling is usually around 5 degrees above temp CPU (62-65). During full load (for example. Benchmark of Far Cry 2), I see a lot of stuttering with the latest drivers Catalyst and DX10 (not sure if the stuttering has something to do with heat), otherwise it is ok (no artifacts or anything like that). Temp of GPU during the loading goes up to 74-75, fan speed is locked at 30%, the frequency of the heart 5650 is 450 MHz. left side of the laptop (vent and below) is pretty hot, while the keyboard is warm (or slightly warmer who who).

    These time seems correct and safe in the long term? I'd rather events works all the time (they aren't really very strong) and keeping time less than 50, but there are just wishful pious bios control events and I can't control not the bios. :-)

    3)
    This is just General related products. :-)
    Official specifications of Toshiba L650 say ATi 5650 (between other low range GPU), but I saw a few specifications calling for there 5730 (same model 11R). Is there really a Satellite L650 with ATi 5730 GPU models?

    Sorry for the long post, I tried to include the best possible description that I could do. :-)

    Thank you in advance.

    Thanks for the additional info!

  • Hi there, I have a question about storage, even if I have 2, 53GB, storage watch 21, 99GB usage, why this difference? I use an iMac 2009, thank you!

    Hi there, I have a question about storage, even if I have 2, 53GB, storage watch 21, 99GB usage, why this difference? I use an iMac 2009, thank you!

    Spotlight re-indexing.

  • A few questions about the upgrade on Satellite A300-144

    Sorry for the typos, English is not my mother tongue.
    I want to ask some questions about the upgrade of a300-144.

    * Some info first.*

    CPU: T2370 ([http://ark.intel.com/products/34445/Intel-Pentium-Processor-T2370-1M-Cache-1_73-GHz-533-MHz-FSB]).
    Chipset: GM965 ([http://ark.intel.com/products/29821/Intel-82GM965-Graphics-and-Memory-Controller]).

    * Questions.*

    1. my frequency of laptop memory at 533 MHz, supports 667 MHz memory controller, memory modules can work at 667 MHz. Is - this because CPU FSB 533 MHz frequency and new processor at 667/800 MHz FSB will fix it or it is hardcoded in the BIOS?

    2 Intel said that the size of max memory for my chipset is 4 GB (2 x 2 GB), but Toshiba says that only 2 GB (2 x 1 GB), who is right?

    3 I know, taken of my CPU is μFCPGA-478 aka socket P, max FSB 800 MHz, max 35 W TDP, so T9500 ([http://ark.intel.com/products/33918/Intel-Core2-Duo-Processor-T9500-6M-Cache-2_60-GHz-800-MHz-FSB]) is a compatible processor or there are some limitations in the BIOS?

    > 1. My frequency of laptop memory at 533 MHz, supports 667 MHz memory controller, memory modules can work at 667 MHz. Is - this because CPU FSB 533 MHz frequency and new processor at 667/800 MHz FSB will fix it or it is hardcoded in the BIOS?

    The speed of the memory is related on the material. This means that the FSB is responsible for the limitation.
    If the FSB would allow support 667 MHz then the memory would also at this speed.

    > 2. Intel says that the size of max memory for my chipset is 4 GB (2 x 2 GB), but Toshiba says that only 2 GB (2 x 1 GB), who is right?
    The memory depends on the chipset. So if the chipset supports 4 GB of RAM, you should be capable of this move to 4 GB of RAM

    > 3. I know, my CPU is? FC-PGA-478 aka socket P, max FSB 800 MHz, max 35 W TDP, so T9500 (http://ark.intel.com/products/33918/Intel-Core2-Duo-Processor-T9500-6M-Cache-2_60-GHz-800-MHz-FSB) will be a compatible processor or there are some limitations in the BIOS?

    It might be possible that the new processor would be fully supported by the BIOS, but in most cases it should not be a problem if the chipset would support the new processor.
    But as far as I know the upgrade of the CPU is not supported by Toshiba or any other manufacturers of portable and its your own risk to run laptop with the new processor.

Maybe you are looking for

  • 12.4.3.1 iTunes crashes when syncing iPhone installed 6 9.3.5

    As it is said, iTunes force crashes/closes unexpectedly when you try to sync with my iPhone 6. It is a problem, too I had with previous versions of iOS and the phone seems stuck after saving the phone, usually the last stage, or more generally during

  • I can do something that would cause all the new sequence files to have the same local variables?

    I would like to add local or drop some variables global to all the new sequence files I create. I was hoping that I could simply add the variable to the process template and make it appear whenever I created a new sequence or in any order who have us

  • Wong Version of Windows Vista

    Hello I recently reinstalled Windows Vista on my Dell Studio XPS 1640. I don't have a relocation to Moose DVD I bought this from craigslist. I used an old, that I had for many years. There are a lot of players missing and I can't connect to the inter

  • Lightroom 6.6.1 problem upgrading and adjustment of brush

    Hi, just upgraded to LR 6.6.1 online. after reboot, I noticed my stroke adjustments in shift almost thumbs down. for example; If I try to paint some one side instead he'll paint on the neck. so there's some shifted on my race. I need help please.Than

  • ESXI 5.5 GROUP (Purple Screen of Death)

    Dear SirI installed ESXI 5.5 U1IBM x 3850 x 5 systemAfter the configuration of the machine puts the GROUP belowone please tell what could be the reason.regardingBrowlinPost edited by: Browlin