Question

Write a procedure called insert_emp which inserts a new employee into f_emps. Pass the employee id,...

Write a procedure called insert_emp which inserts a new employee into f_emps. Pass the employee id, last name, salary, and department id to the procedure as IN parameters. The procedure should call your check_dept function to verify that the passed department id exists in the f_depts table. If it exists, insert the employee. If it does not exist, use DBMS_OUTPUT.PUT_LINE to display a suitable error message. Save your code.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution

create or replace procedure insert_emps(p_id f_emps.employee_id%type,p_last f_emps.last_name%type,p_sal f_emps.salary%type,p_dep f_emps.department_id%type)

is

begin

if check_dept(p_dep)=true then

insert into f_emps values(p_id,p_last,p_sal,p_dep);

else

dbms_output.put_line('The department does not exist!');

end if;

end;

---

all the best

Add a comment
Know the answer?
Add Answer to:
Write a procedure called insert_emp which inserts a new employee into f_emps. Pass the employee id,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help with this C++ code. If possible comment the code and please send screenshots of...

    Please help with this C++ code. If possible comment the code and please send screenshots of the code. This assignment involves creating a program to track employee information. Keep the following information on an employee: Employee ID (string) Last name (string) First Name (string) Birth date (string as MM/DD/YYYY) Gender (M or F, single character) Start date (string as MM/DD/YYYY) Salary per year (double) Thus you must create a class that has all of this, and get/set methods for each...

  • Write a class called Book. Here are the relevant attributes: title author yearPublished            bookPriceInCAD Provide...

    Write a class called Book. Here are the relevant attributes: title author yearPublished            bookPriceInCAD Provide a constructor that takes parameters to initialize all the instance variables. The constructor calls the mutator (set) methods to initialize the instance variables. Provide an accessor (get) and mutator (set) for each instance variable. The mutators all validate their parameters appropriately and use them only if valid. If the passed parameter was invalid an IllegalArgumentException will be thrown with a proper error message A...

  • C++ Simple Employee Tracking System

    This assignment involves creating a program to track employee information.  Keep the following information on an employee:1.     Employee ID (string, digits only, 6 characters)2.     Last name (string)3.     First Name (string)4.     Birth date (string as MM/DD/YYYY)5.     Gender (M or F, single character)6.     Start date (string as MM/DD/YYYY)7.     Salary per year (double)Thus you must create a class that has all of this, and get/set methods for each of these fields.  Note: The fields that are designated as string should use the string...

  • sql server please help me>>> Create a stored procedure called uspRetrieveOrders that returns all the orders...

    sql server please help me>>> Create a stored procedure called uspRetrieveOrders that returns all the orders for a last name. It should return first name, last name, item price, discount amount, quantity, the line item extended amount ((ItemPrice-DiscountAmount)*Quantity), the tax amount, and the card type. It should accept LastName as a parameter. Include logic to test if the customer exists in the database. If not, generate an error message. Show the code you used to test the proc.

  • 2. write a SQL procedure called min max that takes department name as input and returns...

    2. write a SQL procedure called min max that takes department name as input and returns maximum and minimum salary of the department. Test your procedure running following queries: set @dept-"History". # @dept is a MariaDB local variable CALL min_max(@dept,@minv,@maxv) select @dept as department,@minv as minsalary, @maxv as maxsalary:

  • Write a C program which is called ‘multiple_copy’. This program copies one source file to two...

    Write a C program which is called ‘multiple_copy’. This program copies one source file to two destination files as follows: $./multiple_copy....... source_file....... destination_file1......... destination_file2 multiple_copy program copies the contents of source file (i.e., source_file) to any named two destination files in the command line. The number of arguments should be 4 including multiple_copy. If the number of arguments is not 4, the program should display error message saying: “Usage: multiple_copy source_file destination_file1 destination_file2”. When the source_file does not exist, the...

  • create java application with the following specifications: -create an employee class with the following attibutes: name...

    create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...

  • Write a Java class called BankAccount (Parts of the code is given below), which has two...

    Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors and five methods getName(), getBalance(), deposit (double amount), withdraw(double amount) and toString(). The first constructor should initialize name to null and balance to 0. The second constructor initializes name and balance to the parameters passed. deposit method deposits the amount to the account causing the current balance to increase, withdraw method withdraws the amount causing the...

  • Write a Java class called BankAccount (Parts of the code is given below), which has two...

    Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors and five methods getName(), getBalance(), deposit (double amount), withdraw(double amount) and toString(). The first constructor should initialize name to null and balance to 0. The second constructor initializes name and balance to the parameters passed. deposit method deposits the amount to the account causing the current balance to increase, withdraw method withdraws the amount causing the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT