0

**1. Create a procedure called InsertProduct that takes in all the details for a Product and inserts it into the Product Table. What i attempted:

CREATE OR REPLACE PROCEDURE InsertProduct
(a IN varchar2,b IN varchar2,c IN int,d IN real) as
BEGIN
INSERT INTO Product
(ID,Name,Quantity,UnitPrice)
VALUES
(a,b,c,d);
END;
  1. Create a Trigger called InsertProduct_Trigger that displays “A Product has been added!” after a product has been added to the Product table.

    CREATE OR REPLACE TRIGGER InsertProduct_Trigger AFTER INSERT ON Product ENABLE BEGIN dbms_output.put_line('A Product has been added!'); END;

  2. Create a function called FindUnitPrice that takes in the name of an item and returns its unit price. Use the function to print the unit price of Bread.

CREATE OR REPLACE FUNCTION FindUnitPrice (a IN varchar2) RETURN REAL AS PRICE REAL; BEGIN SELECT UnitPrice INTO PRICE FROM Product WHERE ID = a; RETURN PRICE; END;

XING
  • 9,608
  • 4
  • 22
  • 38
britt
  • 1
  • 1
  • 6
    Please describe the problem. What exactly do you not understand? For your attempted code, what happens, vs what is supposed to happen? Are there errors? Etc. If you do the up-front work of testing your code and reporting the results, everyone will be much more willing to help, as opposed to requiring everything to be done by every single potential answerer. – Amadan Nov 20 '19 at 02:08
  • For trigger its not printing the print out. – britt Nov 21 '19 at 02:15
  • The function.. doesnt return the price.. – britt Nov 21 '19 at 02:15

0 Answers0