Home » Other » Training & Certification » PL/SQL help, I need to write tigger, function, procedure
PL/SQL help, I need to write tigger, function, procedure [message #319427] Sat, 10 May 2008 23:18 Go to previous message
sqluser87
Messages: 3
Registered: May 2008
Junior Member
Create table EMP(EmpID Integer Not Null Primary key,
Name Char (10) Not Null,
Salary Number (10, 2) Not Null);
-------------------------------
Function Stars that takes N (an Integer smaller than or equal to 50) as input and
returns N stars in a character string to the calling routine.
Trigger Check_Raise that runs after an employee is given a raise. The trigger
checks the new salary and makes sure that it is more than the old salary. If the
new salary is less than or equal to the old salary, it will raise an application error
and exits. If the raise is a valid raise, it calls the stored procedure (Print_Stars)
and sends the employee name, new and the old salaries to the procedure.
Stored procedure Print_Stars calculates the difference between the old and the
new salaries (rounding it up if necessary) and then prints employee’s name on
the first line and as many stars as the difference in salaries, up to 50 starts per
line, calling the function stars to prepare each stars line.
For example, if Sam’s raise is $115 the output is:
Sam’s raise is:
**************************************************
**************************************************
***************

[Updated on: Sat, 10 May 2008 23:20]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OracleSQL - Exam Revision help
Next Topic: how can i catch prime numbers with While Loop ?
Goto Forum:
  


Current Time: Thu Apr 25 08:43:52 CDT 2024