When used in a stored routine, which of the following demonstrates correct usage of case?

When used in a stored routine, which of the following demonstrates correct usage of case?

When used in a stored routine, which of the following demonstrates correct usage of case?

A.
CREATE PROCEDURE name_check (IN name CHAR(25))
BEGIN CASE name WHEN ‘United States’ THEN SELECT ‘USA’ AS Code;
ELSEIF WHEN ‘Finland’ THEN SELECT ‘FIN’ AS Code;
ELSE SELECT ‘Other’ AS Code;
END CASE;
END

B.
CREATE PROCEDURE name_check (IN name CHAR(25))
BEGIN CASE name WHEN ‘United States’ THEN SELECT ‘USA’ AS Code;
ELSE WHEN ‘Finland’ THEN SELECT ‘FIN’ AS Code;
ELSE SELECT ‘Other’ AS Code;
END CASE;
END

C.
CREATE PROCEDURE name_check (IN name CHAR(25))
BEGIN CASE name WHEN ‘United States’ THEN SELECT ‘USA’ AS Code;
WHEN ‘Finland’ THEN SELECT ‘FIN’ AS Code; ELSE SELECT ‘Other’ AS Code;
END CASE;
END

D.
CREATE PROCEDURE name_check (IN name CHAR(25))
BEGIN CASE name WHEN ‘United States’ THEN SELECT ‘USA’ AS Code;
WHEN ‘Finland’ THEN SELECT ‘FIN’ AS Code; ELSE THEN SELECT ‘Other’ AS Code;
END CASE;
END



Leave a Reply 0

Your email address will not be published. Required fields are marked *