![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista |
#3
| |||
| |||
|
|
Krista <ywa... (AT) gmail (DOT) com> wrote in news:1193017317.584469.269100 @e34g2000pro.googlegroups.com: Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista SQL> SHOW ERROR- Hide quoted text - - Show quoted text - |
#4
| |||
| |||
|
|
On Oct 21, 7:57 pm, "Ana C. Dent" <anaced... (AT) hotmail (DOT) com> wrote: Krista <ywa... (AT) gmail (DOT) com> wrote in news:1193017317.584469.269100 @e34g2000pro.googlegroups.com: Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista SQL> SHOW ERROR- Hide quoted text - - Show quoted text - after i typed show error, it shows LINE/COL ERROR -------- ----------------------------------------------------- 3/5 PL/SQL: SQL Statement ignored 3/62 PL/SQL: ORA-00920: invalid relational operator i am just beginner, so i am not quit sure what it mean....3/5 mean line 3? but how about 5? what is the meaning column 5 ?anyone can help? krista |
#5
| |||
| |||
|
|
Krista <ywa... (AT) gmail (DOT) com> wrote in news:1193022691.631666.152270 @i38g2000prf.googlegroups.com: On Oct 21, 7:57 pm, "Ana C. Dent" <anaced... (AT) hotmail (DOT) com> wrote: Krista <ywa... (AT) gmail (DOT) com> wrote in news:1193017317.584469.269100 @e34g2000pro.googlegroups.com: Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista SQL> SHOW ERROR- Hide quoted text - - Show quoted text - after i typed show error, it shows LINE/COL ERROR -------- ----------------------------------------------------- 3/5 PL/SQL: SQL Statement ignored 3/62 PL/SQL: ORA-00920: invalid relational operator i am just beginner, so i am not quit sure what it mean....3/5 mean line 3? but how about 5? what is the meaning column 5 ?anyone can help? krista It would help if you actaully posted the code along with the results.- Hide quoted text - - Show quoted text - |
#6
| |||
| |||
|
|
Krista <ywanip (AT) gmail (DOT) com> wrote in news:1193017317.584469.269100 @e34g2000pro.googlegroups.com: Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista SQL> SHOW ERROR |
#7
| |||
| |||
|
|
Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista |
#8
| |||
| |||
|
|
Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista |
#9
| |||
| |||
|
|
Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista |
#10
| |||
| |||
|
|
On Sun, 21 Oct 2007 18:41:57 -0700, Krista <ywa... (AT) gmail (DOT) com> wrote: Hi everyone, I am practice on create trigger in Oracle. I found some simples online and tried to put it in my computer. However, it pops up an error messge "warning: trigger created with compilation errors." Question: we want the net worth of any executive to be below $50000. First i created the table: create table movieexce(name varchar2(50) primary key, address varchar2(50), networth number(9,2)); Second i tried to create trigger: ( actually, i put the same thing on the net to test it) create or replace trigger avgnetworthafterupdate after update of networth on movieexce referencing old as oldstuff new as newstuff begin if (50000>(select avg(networth) from movieexce)) then delete from movieexce where (name, address, networth) in newstuff; insert into movieexce (select * from oldstuff); end if; end avgnetworthafterupdate; / Result:warning: trigger created with compilation errors. any one has clue what is wrong with that trigger? Thanks, Krista Why use a TRIGGER? Perhaps a CONSTRAINT can be ADDed to the TABLE to only only less then that salary. ALTER TABLE MovieExec ADD CONSTRAINT xxx CHECK (NetWorth < 50000); This way the record is rejected with an error, as opposed to secretly changed. B.- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |