473,729 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

triggers to monitor stock options backdating

2 New Member
I'm a newbie in oracle 10g - I was hoping if some one could walk me through writing a trigger function for this particular problem:

the scenario:
" ... the practice is called backdating because an executive manages to move the date of a stock option back in time, presumably to when the stock price was lower. Stock options grant the recipient the right to buy shares at the stated price after a certain period of time has gone by. If the market price is higher than the so-called strike price, the employee makes money. Find a way to lower the price of the grant - by moving back the grant date during a rising market, for example - and the option is worth even more."

the policy has to be:
The exercise date cannot be more than 3 days either before or after the grant date. Write a database trigger that does not allow entering a new grant record or modifying an existing one that violates this policy.

So I've written:
Expand|Select|Wrap|Line Numbers
  1. create or replace trigger date_violation
  2. before insert or update on option_grants
  3. for each row
  4.  
  5. declare
  6.  
  7.    date_diff number;
  8.  
  9. begin
  10.  
  11.    date_diff := exercise_date - grant_date;
  12.    if (abs(date_diff) >= 3)
  13.  
  14. then
  15.  
  16. raise_application_error(-20003, 'Check date. Date cannot be more than 3 days after or before the grant date.');
  17.  
  18. end if;
  19.  
  20. end;
  21. /
  22.  
--but I'm getting this error:
Expand|Select|Wrap|Line Numbers
  1. LINE/COL ERROR
  2. -------- -----------------------------------------------------------------
  3. 7/1      PL/SQL: Statement ignored
  4. 7/14     PLS-00201: identifier 'EXERCISE_DATE' must be declared
  5.  
------------------------------------------

I'm not sure what to define.

Here's what my table looks like:

Expand|Select|Wrap|Line Numbers
  1.  
  2. create table option_grants
  3. (grant# varchar2(4),
  4. grant_date date,
  5. exercise_date date,
  6. emp_id number(9),
  7. stock_symbol char(3),
  8. strike_price number(5,2));
  9.  
  10. insert into option_grants
  11. values ('A234', '25-Jan-04', '23-Jan-04', 123456789, 'XYZ', '12.54');
  12. insert into option_grants
  13. values ('A345', '23-Mar-05', '23-Mar-05', 666555444, 'XYZ', '18.22');
  14. insert into option_grants
  15. values ('B456', '15-Apr-06', '15-Apr-06', 123456790, 'XYZ', '13.79');
  16. insert into option_grants
  17. values ('C956', '24-Dec-06', '23-Dec-06', 666555444, 'XYZ', '9.75');
  18.  
I know that this is alot ... I really appreaciate the help.

Thank you and please have an outstanding day.
May 14 '07 #1
2 2181
whiskeylima64
2 New Member
Hey - To whom it concerns... I figured out my issue... I'm an idiot

Expand|Select|Wrap|Line Numbers
  1. create or replace trigger date_violation
  2. before insert or update on option_grants
  3. for each row
  4.  
  5. declare
  6.  
  7. date_diff number;
  8.  
  9. begin
  10.  
  11. date_diff := :new.exercise_date - :old.grant_date;
  12.  
  13. if (abs(date_diff) >= 3)
  14.  
  15. then
  16.  
  17. raise_application_error(-20003, 'Check date. Date cannot be more than 3 days after or before the grant date.');
  18.  
  19. end if;
  20.  
  21. end;
  22. /
  23.  
May 14 '07 #2
sbldragon
2 New Member
i like ur post. this example help me to improve my trigger :) i'm new in oracle
Mar 25 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
72658
by: Ryan | last post by:
Hello, I am pretty much a newbie with SQL server. I have what is probably a pretty stupid question. In SQL Enterprise manager, is there a way to easily see all triggers, or, even better, all tables and there associated triggers? I suppose at the least in a way similar to viewing all saved functions or views. Thanks, Ryan
0
2187
by: support | last post by:
Do you need to monitor websites for changes? iSpySiteWatch (http://www.ispysitewatch.com) is an Automated WebSite Monitoring system that can track changes on most websites. We've tested it to work with the major online Auction sites (for tracking online bids), like eBay.com, uBid.com, OnSale.com, lastminute.com auctions, Yahoo! Auctions, qxl.com, gutterbids.com - and it may work with many more!
1
1700
by: anjana sisodia via SQLMonster.com | last post by:
I have an area on our website where users can customize what data fields they want to see displayed from a list of about 50 different fields. I have a query that has about 50 subqueries to pull all this info and it has just got to be extemely slow...sometimes even times out. I need to pull alot of data from different tables and the only solution i can think of is to create triggers on the different tables that i want to pull and store...
10
11616
by: santiago538 | last post by:
Hi, Is there any way to specify which monitor a Window.open() will launch a new browser window in on systems with more than one display. It would only need to work with Mozilla browsers, and not IE. Thanks!
0
1097
by: Henry | last post by:
I am not really sure what news group this should be posted to. It has to do with a visual studio install project for a c# application. We have noticed that if any of the files installed by the installer are moved or deleted that this automatically triggers the installer the next time the application is started. While this would appropriate if the file in question were an executable, the files are actually report files. Clients want to...
5
2446
by: Bruce | last post by:
I have several user defined functions which are referenced in triggers and views. For software upgrades, I need to be able to drop the triggers and views which reference these user defined functions, then drop and recreate the user defined functions, then recreate all the views and triggers. I don't imiagine I'm the first person who needed to do this, and I don't have a lot of db2 experience, so I wanted to see if there is a common or...
3
6181
by: sushi | last post by:
Hello, I have to monitor a remote server for functions such as CPU Utilization etc. I am using System.Management namespace for the same. But when I try to execute the following code, it gives System.UnauthorizedAccessException though the user which I have provided is a valid domain user having administratice rights on that computer.
4
1396
mafaisal
by: mafaisal | last post by:
Hi experts I am Using Sql Server 2005 Hw to Create & call of triggers in sqlserver I have Table salesMast,salesdet,stock When after insertion in salesdet stock is minus & when cancel sales stock plus
0
8921
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.