Why is this an invalid trigger?
HelloI have a problem with a trigger. After creating the trigger it gives me the message
invalid trigger type, I have this table
create the USER tableand if I do this:
(
U_ID NUMBER (6) not null,
U_NOME VARCHAR2 (60) not null,
U_SEXO VARCHAR2 (10) not null,
U_IDADE NUMBER (3) not null,
U_ALTURA NUMBER (3) not null,
U_PESO NUMBER (6) not null,
U_IMC NUMBER (2.2).
U_PRIVILEGIOS NUMBER (1) not null,
U_PASSWORD VARCHAR2 (10) not null,
primary key constraint PK_UTILIZADOR (U_ID)
);
INSERT IN USER (U_ID, U_NOME, U_SEXO, U_IDADE, U_ALTURA, U_PESO, U_PRIVILEGIOS, U_PASSWORD) VALUES (1, 'my name', 'Male', 32, 174, 74000, 0, 'password');and then
SELECT * FROM USER;I see that everything goes as planned.
What I want to do, it's when you insert or update of U_ALTURA or U_PESO, the U_IMC field is automatically updated / inserted.
Here is if:
CREATE OR REPLACE TRIGGER CALCULA_IMCCan someone please tell me what I'm doing wrong?
AFTER INSERTION OR THE U_ALTURA UPDADE, U_PESO ON THE USER
FOR EACH LINE
BEGIN
UPDATE USER
SET U_IMC = (U_PESO / 1000) / (POWER(U_ALTURA / 100,2);
END;
/
Kodiak
898791 wrote:
What I want to do, it's when you insert or update of U_ALTURA or U_PESO, the U_IMC field is automatically updated / inserted.Here is if:
CREATE OR REPLACE TRIGGER CALCULA_IMC
AFTER INSERTION OR THE U_ALTURA UPDADE, U_PESO ON THE USER
FOR EACH LINE
BEGIN
UPDATE USER
SET U_IMC = (U_PESO / 1000) / (POWER(U_ALTURA / 100,2);
END;
/Can someone please tell me what I'm doing wrong?
Kodiak
There are a few problems with your relaxation. First of all, it is UPDA * T * E not UPDA * D * E. More important still, you cannot update the table that you created the trigger on, and you can't do that in an after trigger. Finally, even if you could do it the way you are trying to do, update you every row in the table for each insertion and update.
You need something more like:
CREATE OR REPLACE TRIGGER calcula_imc
BEFORE INSERT OR UPDADE OF u_altura, u_peso ON utilizador
FOR EACH ROW
BEGIN
:new.u_imc := (:new.u_peso / 1000) / (POWER(:new.u_altura / 100, 2));
END;
John
Tags: Database
Similar Questions
-
Why is this work not running?
Why is this work not running?
This work follow these steps:SQL> BEGIN 2 DBMS_SCHEDULER.RUN_JOB('EXCHANGE_PART_JOB'); 3 END; 4 / BEGIN * Error in line 1: ORA-00911: invalid character. ORA-06512: in "SYS.DBMS_ISCHED", line 150 ORA-06512: in "SYS.DBMS_SCHEDULER", line 441 ORA-06512: in line 2
Use the following program:CREATE OR REPLACE PROCEDURE Exchange_Partition IS Sql_Exchange VARCHAR2(2000); BEGIN Sql_Exchange := 'ALTER TABLE HR.GPS_LOG_HIS EXCHANGE PARTITION '|| 'udp_part'||TO_CHAR(SYSDATE-1/24,'YYYYMMDDHH24') ||' WITH TABLE HR.GPS_LOG'; EXECUTE IMMEDIATE Sql_Exchange; END; /
Use the following code to create the work:BEGIN DBMS_SCHEDULER.create_program ( program_name => 'exchange_part_prog', program_type => 'STORED_PROCEDURE', program_action => 'EXCHANGE_PARTITION', --Use a database directory to replace the OS directory. number_of_arguments => 0, enabled => TRUE, comments => 'Program to exchange partitions for hr.gps_log_his table or other tables use a shell script.'); END; /
BEGIN DBMS_SCHEDULER.create_job ( job_name => 'exchange_part_job', program_name => 'exchange_part_prog', schedule_name => 'exchange_part_hourly_schedule', enabled => TRUE, auto_drop => false, comments => 'Job defined to exchange partitions for gps_log_his table or orhter tables.'); END; /
Ok
ORA-14099: all rows in the table are not eligible for the specified partition
Cause: There is at least one line in the non-partitioned table which does not qualify for the partition specified in the PARTITION of EXCHANGE ALTER TABLE
Action: Ensure that all the lines in the segment qualify for the partition. Perform the operation table alter with the NO CHECK option. Run ANALYZE table VALIDATE on that partition, namely the invalid rows and delete them.I think you should check the data in gps_log, some lines must belog to another partition?
Concerning
Peter -
Have been left in charge all night I get the message "after reboot requires the password" question is why is this automatic restart, and is this normal
Occasionally, it may restart because something was wrong. It is not a problem unless this happens frequently.
-
failure of the SIM, why I this message all the time?
failure of the SIM, why I this message all the time?
This means that your SIM card is defective or otherwise expired
Can you make and receive calls and texts?
If so - go out the SIM card - wait about 45 seconds and re insert it back
If not - contact your carrier for a new SIM card
Remove or change the SIM card in your iPhone or iPad - Apple Support
-
Pages take a while to load. Firefox is slow. Internet Explore will be charge the same pages in no time. Why is this? I had FireFox for some time and never had any problems. It lasts for months.
Hello
The reset Firefox feature can solve a lot of problems in restaurant Firefox to its factory default condition while saving your vital information.
Note: This will make you lose all the Extensions, open Web sites and preferences.To reset Firefox, perform the following steps:
- Go to Firefox > help > troubleshooting information.
- Click on the button 'Reset Firefox'.
- Firefox will close and reset. After Firefox is finished, it will display a window with the imported information. Click Finish.
- Firefox opens with all the default settings applied.
Information can be found in the article Firefox Refresh - reset the settings and Add-ons .
This solve your problems? Please report to us!
If you have security software (antivirus, firewall etc.), you can also try to check by disabling it temporarily, turn on the Windows Firewall and browse a few well-known websites without downloading or installing anything. You can also disable (uncheck) Enable Javascript in Firefox Tools (Alt + T) > Options > contentand turn off the Plugins in Tools (Alt + T) > modules before checking it in.
-
I have Firefox 12.0 installed and when I open Youtube and/or Gmail they detect that the browser is obsolete. Why is this happening?
You have a pref general.useragent.override, which identifies you as a Firefox/4.0
- Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; RV:1.8.1.16; .NET CLR 2.0.50727; ffco7) Gecko/20080702 Firefox/4.0
See:
-
I'm trying to follow the instructions of the Firefox Help. Step 2 to import bookmarks is to select the option "Import data from another browser" in history-library-import and backup. However, this option is grayed out for me and I can't select it. Why is this grayed out? How can I make this?
Make sure that you do not use Firefox mode of private - browsing using Firefox without saving history .
- To view the history settings and cookies, choose: Firefox > Options > privacy, choose the setting Firefox will: use the custom settings for the story of
- : Uncheck the [] "always use the private browsing mode.
Now do-> Import Favorites to Internet Explorer
Check and tell if its working.
Not related to your problem, but your Plugins are out of date
- Update all of your Firefox Plugins-> https://www.mozilla.org/en-US/plugincheck/
- During the installation of the Plugins download files hotfix, remove the check mark to download any other software options with your Plugins (for example, toolbars, McAfee, Google Chrome, etc.)
-
How do I do to get the slide to set up to go to the right and continue? I was up half the night and is not wrong. The only thing that I just did is plugged into the wall outlet and now I'm right back where I had problems. Why keep this product?
What do you exactly mean by "get the slide to set up go to the right and continue"? Can you give us a little more context and detail?
-
I noticed this for a while now. iTunes and my iPhone 5 c case came in says it's 8GB. But looking at storage left on my iPhone and iTunes, it seems only 5.15 GB. Why is this?
The iOS operating system and apps alone can explain the difference.
http://www.huffingtonpost.com/2015/01/08/iPhone-free-space-tips_n_6269756.html
-
Information in the tab I used disappeared and has been replaced with the details of the files on my desktop and when I downloaded/viewed them etc. Why would this happen?
has inadvertently dragging a folder from your desktop in the firefox window?
try it now for more clarity
-
I have Sony Ericsson Xperia X 10 mini and WOULD like Firefox Mobile on it. However, for now, Firefox is only compatible with the Xperia X 10. Why is this and it will be fixed?
This is due to the processor that uses the X 10 mini. Mobile Firefox requires a processor that supports the ARMv7 architecture, but the processor in the X 10 mini supports ARMv6 architecture.
For some time Mozilla developed a version which worked on processors who use ARMv6, but currently stopped because there were bugs that caused his accident ever. Mozilla peut start developing for ARMv6 processors once again, but right now they are not actively working on it.
-
I have iTunes on Windows 10. iTunes does not recognize my internal speakers when other applications will recognize them. I can use the helmet without a problem. Why is this?
If you go to iTunes/Edit/Preferences/reading and select 'Audio Direct' for 'use of Audio play '. Then log off iTunes and back log and you should be able to hear through your headphones. Good luck!
-
I bought my iphone ringtones. but the money is deducted for that every week. Why is this happening? How to stop it?
Greetings Gokul_23,
Thank you for using communities Support from Apple!
I understand that you bought a few rings and now it seems that you are charged for ringtones on a regular basis. If you are constantly being charged, first of all, I would like to check to see if if you chose inadvertently to a subscription service.
View, change or cancel your subscription - Apple Support
If so, the information in the article above will help you cancel this subscription. If you do not see a subscription, check your purchase history to see what is actually loaded on your account.
See your purchase history in iTunes on Mac or PC - Apple Support store
Have a great day!
-
My phone won't let me download music on the cloud, it says I have to wait 25 days until I can download and listen to it, why is this? It makes me very angry.
Looks like you were using a different iTunes on that account the iPhone and now you UM wait to use another. This is how it works if you try to use different accounts.
Is that what happened?
-
I buy iphone 5s currently and I checked the imei number. The IMEI says this iphone was purchese in 1978. Why is this?
Check here:
Maybe you are looking for
-
Satellite A100-599 - hibernation process hangs
Hello. I have problem with hibernation in Vista.He worked initially but later something was wrong, and now hibernation freezes.I have just white screen and the computer never stops (HDD light is always on). Looks like it hangs during the hibernation
-
Is there a sleep timer hide in my new Apple TV?
I know that I can put my Apple TV in standby mode or after inactivity it will go on its own; However, I want a timer. I want the TV and Apple TV power off after 60 minutes so that I don't use data while he slept. IIf there is a work around for that
-
Original title: Windows Vista, Windows Mail, error 623, unable to connect to the mail.This problem occurred after a storm. Modem was fried. Replaced the modem with the modem "2wire" ATT. Now get "error 623: the system could not find the directory en
-
I'm just curious to know what the "integrated" in the international search report is actually referring sm. Is he referring to the fact that several forms of WAN interface are integrated into a single router? Thanks for the clarification.
-
VPN Tunnel established but no LAN access
I have an embarrassing problem where more remote site PCs are accessing resources HQ LAN very well using the VPN Client (v4.6) connecting to a Cisco PIX 515E. Any PC running Windows XP SP2 with the firewall off o/s. A PC site however establishes the