Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2-A) Run the code below which causes an error. A CASE statement must find a matching clause (direct match or ELSE). DECLARE v_val PLS_INTEGER :=

2-A) Run the code below which causes an error. A CASE statement must find a matching clause (direct match or ELSE).

DECLARE

v_val PLS_INTEGER := 2002;

v_message VARCHAR2(50);

BEGIN

CASE v_val

WHEN 2001 THEN

v_message := 'I am 2001';

WHEN 2004 THEN

v_message := 'I am 2004';

WHEN 2005 THEN

v_message := 'I am 2005';

END CASE;

DBMS_OUTPUT.PUT_LINE(v_message);

END;

2-B) Code an EXCEPTION handler named e_errormsg that traps this error and displays No message available if the CASE selector is 2002. This error is not predefined so you will need to name declare an exception and associate the name with the error code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions