Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Trigger help

Author  Topic 

blammo04
Starting Member

7 Posts

Posted - 2009-11-19 : 11:37:17
I am trying to use a trigger to generate a late fee from two dates. If the return date is passed the planned return date then I need to subtract those days and multiply by 100 and then UPDATE the latefee column with the new latefee amount charged.

I keep getting a compilation error with this.....

SQL> CREATE OR REPLACE TRIGGER latefree
2 BEFORE INSERT OR UPDATE OF actualreturn,plannedreturn ON charters
3 FOR EACH ROW
4 DECLARE late number(8,2);
5 BEGIN
6 IF(:new.actualreturn) > plannedreturn THEN
7 late=(actualreturn-plannedreturn)*100;
8 UPDATE Charters
9 SET latefee = late;
10 END IF;
11 END;
12 ;
13 /

Warning: Trigger created with compilation errors.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-11-19 : 11:41:01
This is a Microsoft SQL Server Forum, you may need to look elsewhere for help.

www.dbforums.com

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-19 : 11:41:38
You didn't answer my question in the other topic. Are you using Microsoft SQL Server or some other database platform? Your syntax isn't valid T-SQL which leads me to believe you aren't using Microsoft SQL Server. SQLTeam is for Microsoft SQL Server. Other technologies have their own web sites. Dbforums.com covers many different dbms platforms, so you may want to try there instead.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

blammo04
Starting Member

7 Posts

Posted - 2009-11-19 : 11:50:23
its oracle sql plus, sorry if i bothered you guys.....
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-19 : 11:53:31
It's no problem. We just don't want you to waste your time here unless you are using Microsoft SQL Server. We can't really help with other dbms platforms since that isn't our specialty.

I hope you are able to find the answers at another site. Oracle help can be hard to get.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -