Let me covert those and see if it goes through! Thanks SO MUCH! Both of you! Give me a sec
42 Replies - 1307 Views - Last Post: 10 September 2009 - 09:08 PM
#31
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:01 PM
Let me covert those and see if it goes through! Thanks SO MUCH! Both of you! Give me a sec
#32
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:03 PM
#33
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:09 PM
CREATE OR REPLACE TRIGGER Tax_Return_Trigger BEFORE UPDATE OF AdjGrossIncome ON TaxReturns FOR EACH ROW DECLARE v_AdjGrossIncome NUMBER; v_TaxRate1 CONSTANT NUMBER(2,2) := 0.00; v_TaxRate2 CONSTANT NUMBER(2,2) := 0.20; v_TaxRate3 CONSTANT NUMBER(2,2) := 0.30; v_TaxRate4 CONSTANT NUMBER(2,2) := 0.40; v_TaxRate5 CONSTANT NUMBER(2,2) := 0.50; BEGIN SELECT AdjGrossIncome INTO v_AdjGrossIncome FROM TaxReturns; END; /
so far so good
This worked:
CREATE OR REPLACE TRIGGER Tax_Return_Trigger BEFORE UPDATE OF AdjGrossIncome ON TaxReturns FOR EACH ROW DECLARE v_AdjGrossIncome NUMBER; v_TaxRate1 CONSTANT NUMBER(2,2) := 0.00; v_TaxRate2 CONSTANT NUMBER(2,2) := 0.20; v_TaxRate3 CONSTANT NUMBER(2,2) := 0.30; v_TaxRate4 CONSTANT NUMBER(2,2) := 0.40; v_TaxRate5 CONSTANT NUMBER(2,2) := 0.50; v_NewRate NUMBER; BEGIN SELECT AdjGrossIncome INTO v_AdjGrossIncome FROM TaxReturns; IF :NEW.AdjGrossIncome >= 0 AND :NEW.AdjGrossIncome <= 29999 THEN v_NewRate := :NEW.AdjGrossIncome * v_TaxRate1; ELSIF :NEW.AdjGrossIncome >= 30000 AND :NEW.AdjGrossIncome <= 99999 THEN v_NewRate := :NEW.AdjGrossIncome * v_TaxRate2; ELSIF :NEW.AdjGrossIncome >= 100000 AND :NEW.AdjGrossIncome <= 249999 THEN v_NewRate := :NEW.AdjGrossIncome * v_TaxRate3; ELSIF :NEW.AdjGrossIncome >= 250000 AND :NEW.AdjGrossIncome <= 499999 THEN v_NewRate := :NEW.AdjGrossIncome * v_TaxRate4; ELSIF :NEW.AdjGrossIncome >= 500000 AND :NEW.AdjGrossIncome <= 999999999 THEN v_NewRate := :NEW.AdjGrossIncome * v_TaxRate5; INSERT INTO TaxReturns (IncomeTaxes) VALUES (v_NewRate); END IF; END; /
Let me try it out
#34
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:09 PM
#35
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:11 PM
OR....
As Amy Lee from Evanescence would say.... "Call me when you are sober"
This post has been edited by Martyr2: 10 September 2009 - 08:12 PM
#36
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:13 PM
It created the Trigger correctly but the trigger does nothing..that sucks
Dammit ...
Going to look it over now
This post has been edited by absynthe: 10 September 2009 - 08:14 PM
#37
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:16 PM
EDIT: Well, I guess you could use :old and just ignore the old select at the start, but I think both will accomplish the job.
This post has been edited by Martyr2: 10 September 2009 - 08:22 PM
#38
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:20 PM
#39
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:28 PM
#40
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:30 PM
Edit: Either way, you are in a lot better shape than you were.
This post has been edited by Martyr2: 10 September 2009 - 08:34 PM
#41
Re: Help With Creating a Trigger
Posted 10 September 2009 - 08:36 PM
#42
Re: Help With Creating a Trigger
Posted 10 September 2009 - 09:05 PM
Thanks again to both of you! It took DAYS AND DAYS to get help with it. It just so happened it came on the last night. If I can ever become a database guru Im going to start patrolling this area of DIC. Not too many people here really. Everyone likes their JAVA too much! haha!
KUDOS to both of you
haha! This is a hot topic in database...wonder if thats happened before?
I thanked you both
This post has been edited by absynthe: 10 September 2009 - 09:07 PM
#43
Re: Help With Creating a Trigger
Posted 10 September 2009 - 09:08 PM
|
|

New Topic/Question
Reply





MultiQuote





|