Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\"Create a procedure that accepts product ID as a parameter and returns the pric

ID: 3784593 • Letter: #

Question

"Create a procedure that accepts product ID as a parameter and returns the price from ProductTable table. Add exception handling to catch if product ID is not in the table." Using Oracle SQL Developer.

Listed below is what is suppose to be outputed.

PROCEDURE P_PRODUCT_PRICE complied

anonymous block completed

Producr ID 302   $2

anonymous block completed

Producr ID 299 $99.99

anonymous block completed

No products with product ID13 is found

anonymous block completed

No products with product ID-45 is found.

Explanation / Answer

CREATE OR REPLACE PROCEDURE PRODUCT_PRICE (P_PRODUCT_ID IN PRODUCT.PRODUCT_ID%TYPE
@P_PRODUCT_ID VARCHAR2
P_ERROR_MSG OUT VARCHAR2 )
  

AS

BEGIN

SELECT PRODUCT_ID, PRODUCT_PRICE FROM ProductTable WHERE PRODUCT_ID= @PRODUCT_ID;
  
COMMIT;

EXCEPTION

P_ERR_MSG := No products with PRODUCT_ID is found;

END PRODUCT_PRICE