{"id":1415,"date":"2017-11-09T09:55:51","date_gmt":"2017-11-09T02:55:51","guid":{"rendered":"https:\/\/oracletutorial.com\/?page_id=1415"},"modified":"2025-05-23T20:27:53","modified_gmt":"2025-05-24T03:27:53","slug":"plsql-case-statement","status":"publish","type":"page","link":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/","title":{"rendered":"PL\/SQL CASE Statement"},"content":{"rendered":"\r\n<p><strong>Summary<\/strong>: In this tutorial, you will learn how to use the PL\/SQL <code>CASE<\/code> statement to control the flow of a program.<\/p>\r\n\r\n\r\n\r\n<p>The <code>CASE<\/code> statement allows you to choose one sequence of statements to execute out of many possible sequences.<\/p>\r\n\r\n\r\n\r\n<p>PL\/SQL supports two types of <code>CASE<\/code> statements:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Simple <code>CASE<\/code> statement.<\/li>\r\n\r\n\r\n\r\n<li>Searched <code>CASE<\/code> statement.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Both types of <code>CASE<\/code> statements support an optional <code>ELSE<\/code> clause.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='simple-plsql-case-statement'>Simple PL\/SQL CASE statement <a href=\"#simple-plsql-case-statement\" class=\"anchor\" id=\"simple-plsql-case-statement\" title=\"Anchor for Simple PL\/SQL CASE statement\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>A simple <code>CASE<\/code> statement evaluates a single expression and compares the result with some values.<\/p>\r\n\r\n\r\n\r\n<p>The simple <code>CASE<\/code> statement has the following structure:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CASE<\/span> selector\r\n<span class=\"hljs-keyword\">WHEN<\/span> selector_value_1 <span class=\"hljs-keyword\">THEN<\/span>\r\n    statements_1\r\n<span class=\"hljs-keyword\">WHEN<\/span> selector_value_1 <span class=\"hljs-keyword\">THEN<\/span> \r\n    statement_2\r\n...\r\n<span class=\"hljs-keyword\">ELSE<\/span>\r\n    else_statements\r\n<span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">CASE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Let&#8217;s examine the syntax of the simple <code>CASE<\/code> statement in detail:<\/p>\r\n\r\n\r\n\r\n<p><strong>1) selector<\/strong><\/p>\r\n\r\n\r\n\r\n<p>The <code>selector<\/code> is an expression that is evaluated once. The result of the selector is used to select one of the several alternatives, e.g., <code>selector_value_1<\/code> and <code>selector_value_2<\/code>.<\/p>\r\n\r\n\r\n\r\n<p><strong>2) WHEN <\/strong><code>selector_value<\/code> <strong>THEN <\/strong><code>statements<\/code><\/p>\r\n\r\n\r\n\r\n<p>The selector values i.e., <code>selector_value_1<\/code>, <code>selector_value_2<\/code>, etc., are evaluated sequentially. If the result of a selector value equals the result of the <code>selector<\/code>, then the associated sequence of statements executes and the <code>CASE<\/code> statement ends. In addition, the subsequent selector values are not evaluated.<\/p>\r\n\r\n\r\n\r\n<p><strong>3) ELSE <\/strong><code>else_statements<\/code><\/p>\r\n\r\n\r\n\r\n<p>If no values in <code>WHERE<\/code> clauses match the result of the selector in the <code>CASE<\/code> clause, the sequence of statements in the <code>ELSE<\/code> clause executes.<\/p>\r\n\r\n\r\n\r\n<p>Since the <code>ELSE<\/code> clause is optional, you can skip it. However, if you do so, PL\/SQL will implicitly use the following:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">ELSE<\/span> \r\n    <span class=\"hljs-keyword\">RAISE<\/span> <span class=\"hljs-built_in\">CASE_NOT_FOUND<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>In other words, PL\/SQL raises a <code>CASE_NOT_FOUND<\/code> error if you don&#8217;t specify an <code>ELSE<\/code> clause and the result of the <code>CASE<\/code> expression does not match any value in the <code>WHEN<\/code> clauses.<\/p>\r\n\r\n\r\n\r\n<p>Note that this behavior of the <code>CASE<\/code> statement is different from the <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-if\/\"><code>IF THEN<\/code> statement<\/a>. When the <code>IF THEN<\/code> statement has no <code>ELSE<\/code> clause and the condition is false, PL\/SQL raises an error.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='simple-case-statement-example'>Simple CASE statement example <a href=\"#simple-case-statement-example\" class=\"anchor\" id=\"simple-case-statement-example\" title=\"Anchor for Simple CASE statement example\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>The following example uses a simple CASE statement to compare a single value (<code>c_grade<\/code>) with many possible values &#8216;A&#8217;, &#8216;B&#8217;,&#8217;C&#8217;, &#8216;D&#8217;, and &#8216;F&#8217;:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SET<\/span> SERVEROUTPUT <span class=\"hljs-keyword\">ON<\/span>;\r\n\r\n<span class=\"hljs-keyword\">DECLARE<\/span>\r\n  c_grade <span class=\"hljs-type\">CHAR<\/span>( <span class=\"hljs-number\">1<\/span> );\r\n  c_rank  VARCHAR2( <span class=\"hljs-number\">20<\/span> );\r\n<span class=\"hljs-keyword\">BEGIN<\/span>\r\n  c_grade := <span class=\"hljs-string\">'B'<\/span>;\r\n  <span class=\"hljs-keyword\">CASE<\/span> c_grade\r\n  <span class=\"hljs-keyword\">WHEN<\/span> <span class=\"hljs-string\">'A'<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    c_rank := <span class=\"hljs-string\">'Excellent'<\/span> ;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> <span class=\"hljs-string\">'B'<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    c_rank := <span class=\"hljs-string\">'Very Good'<\/span> ;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> <span class=\"hljs-string\">'C'<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    c_rank := <span class=\"hljs-string\">'Good'<\/span> ;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> <span class=\"hljs-string\">'D'<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    c_rank := <span class=\"hljs-string\">'Fair'<\/span> ;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> <span class=\"hljs-string\">'F'<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    c_rank := <span class=\"hljs-string\">'Poor'<\/span> ;\r\n  <span class=\"hljs-keyword\">ELSE<\/span>\r\n    c_rank := <span class=\"hljs-string\">'No such grade'<\/span> ;\r\n  <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">CASE<\/span>;\r\n  DBMS_OUTPUT.PUT_LINE( c_rank );\r\n<span class=\"hljs-keyword\">END<\/span>;\r\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Output:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Very Good<\/code><\/span><\/pre>\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='searched-case-statement'>Searched CASE statement <a href=\"#searched-case-statement\" class=\"anchor\" id=\"searched-case-statement\" title=\"Anchor for Searched CASE statement\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>The searched <code>CASE<\/code> statement evaluates multiple Boolean expressions and executes the sequence of statements associated with the first condition that evaluates to <code>TRUE<\/code>.<\/p>\r\n\r\n\r\n\r\n<p>The searched <code>CASE<\/code> statement has the following structure:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">CASE<\/span>\r\n<span class=\"hljs-keyword\">WHEN<\/span> condition_1 <span class=\"hljs-keyword\">THEN<\/span> statements_1\r\n<span class=\"hljs-keyword\">WHEN<\/span> condition_2 <span class=\"hljs-keyword\">THEN<\/span> statements_2\r\n...\r\n<span class=\"hljs-keyword\">WHEN<\/span> condition_n <span class=\"hljs-keyword\">THEN<\/span> statements_n\r\n&#91; <span class=\"hljs-keyword\">ELSE<\/span>\r\n  else_statements ]\r\n<span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">CASE<\/span>;]\r\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>The searched <code>CASE<\/code> statement follows the rules below:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>The conditions in the <code>WHEN<\/code> clauses are evaluated in order, from top to bottom.<\/li>\r\n\r\n\r\n\r\n<li>The sequence of statements associated with the <code>WHEN<\/code> clause whose condition evaluates to TRUE is executed. If more than one condition evaluates to TRUE, only the first one executes.<\/li>\r\n\r\n\r\n\r\n<li>If no condition evaluates to TRUE, the <code>else_statements<\/code> in the <code>ELSE<\/code> clause executes. If you skip the <code>ELSE<\/code> clause and no expressions are TRUE, a <code>CASE_NOT_FOUND<\/code> <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-exception\/\">exception<\/a>\u00a0is raised.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='searched-case-statement-example'>Searched CASE statement example <a href=\"#searched-case-statement-example\" class=\"anchor\" id=\"searched-case-statement-example\" title=\"Anchor for Searched CASE statement example\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>The following example uses the searched <code>CASE<\/code> statement to calculate sales commission based on sales revenue.<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SET<\/span> SERVEROUTPUT <span class=\"hljs-keyword\">ON<\/span>;\r\n\r\n<span class=\"hljs-keyword\">DECLARE<\/span>\r\n  n_sales      NUMBER;\r\n  n_commission NUMBER;\r\n<span class=\"hljs-keyword\">BEGIN<\/span>\r\n  n_sales := <span class=\"hljs-number\">150000<\/span>;\r\n  <span class=\"hljs-keyword\">CASE<\/span>\r\n  <span class=\"hljs-keyword\">WHEN<\/span> n_sales    &gt; <span class=\"hljs-number\">200000<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    n_commission := <span class=\"hljs-number\">0.2<\/span>;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> n_sales   &gt;= <span class=\"hljs-number\">100000<\/span> <span class=\"hljs-keyword\">AND<\/span> n_sales &lt; <span class=\"hljs-number\">200000<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    n_commission := <span class=\"hljs-number\">0.15<\/span>;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> n_sales   &gt;= <span class=\"hljs-number\">50000<\/span> <span class=\"hljs-keyword\">AND<\/span> n_sales &lt; <span class=\"hljs-number\">100000<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    n_commission := <span class=\"hljs-number\">0.1<\/span>;\r\n  <span class=\"hljs-keyword\">WHEN<\/span> n_sales    &gt; <span class=\"hljs-number\">30000<\/span> <span class=\"hljs-keyword\">THEN<\/span>\r\n    n_commission := <span class=\"hljs-number\">0.05<\/span>;\r\n  <span class=\"hljs-keyword\">ELSE<\/span>\r\n    n_commission := <span class=\"hljs-number\">0<\/span>;\r\n  <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">CASE<\/span>;\r\n\r\n  DBMS_OUTPUT.PUT_LINE( <span class=\"hljs-string\">'Commission is '<\/span> || n_commission * <span class=\"hljs-number\">100<\/span> || <span class=\"hljs-string\">'%'<\/span>\r\n  );\r\n<span class=\"hljs-keyword\">END<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>Output:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Commission is 15%<\/code><\/span><\/pre>\r\n\r\n\r\n<p>In this example, the sales revenue was set to <code>150,000<\/code>. The first expression evaluated to FALSE:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\">n_sales &gt; <span class=\"hljs-number\">200000<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>But the second expression evaluates to <code>TRUE<\/code> and the sale commission was set to <code>15%<\/code>:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\">n_commission := <span class=\"hljs-number\">0.15<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>PL\/SQL stops evaluating the subsequent condition once it finds the first condition that evaluates to TRUE. Therefore, in this example, PL\/SQL will never evaluate the last two conditions in the <code>CASE<\/code> statement. The <code>ELSE<\/code> statement clause will also never execute.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='simple-or-searched-case-statement'>Simple or searched CASE statement <a href=\"#simple-or-searched-case-statement\" class=\"anchor\" id=\"simple-or-searched-case-statement\" title=\"Anchor for Simple or searched CASE statement\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>In general, use a searched <code>CASE<\/code> statement when you want to execute a sequence of statements based on the results of multiple Boolean expressions, and a simple <code>CASE<\/code> statement when\u00a0you want to execute a sequence of statements based on the result of a single expression.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='plsql-case-statement-vs-case-expression'>PL\/SQL CASE statement vs. CASE expression <a href=\"#plsql-case-statement-vs-case-expression\" class=\"anchor\" id=\"plsql-case-statement-vs-case-expression\" title=\"Anchor for PL\/SQL CASE statement vs. CASE expression\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>PL\/SQL also has <code>CASE<\/code> expression, which is similar to the <code>CASE<\/code> statement.<\/p>\r\n\r\n\r\n\r\n<p>A <code>CASE<\/code> expression evaluates a list of conditions and returns one of multiple possible result expressions.<\/p>\r\n\r\n\r\n\r\n<p>The result of a <code>CASE<\/code> expression is a single value, whereas the result of a <code>CASE<\/code> statement is the execution of a sequence of statements.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Use a simple <code>CASE<\/code> statement to evaluate a single expression against multiple values.<\/li>\r\n\r\n\r\n\r\n<li>Use a searched <code>CASE<\/code> statement to evaluate multiple, independent Boolean conditions.<\/li>\r\n\r\n\r\n\r\n<li>Use the <code>ELSE<\/code> clause to provide a default block to execute when no condition is true.<\/li>\r\n<\/ul>\r\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1415\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/\"\n\t\t\t\tdata-post-title=\"PL\/SQL CASE Statement\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1415\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/\"\n\t\t\t\tdata-post-title=\"PL\/SQL CASE Statement\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to use the PL\/SQL CASE statement to control the flow of a program.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1418,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1415","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PL\/SQL CASE Statement<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the PL\/SQL CASE statement including simple CASE and searched CASE statements.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PL\/SQL CASE Statement\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the PL\/SQL CASE statement including simple CASE and searched CASE statements.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/\" \/>\n<meta property=\"og:site_name\" content=\"Oracle Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-24T03:27:53+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-case-statement\\\/\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-case-statement\\\/\",\"name\":\"PL\\\/SQL CASE Statement\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\"},\"datePublished\":\"2017-11-09T02:55:51+00:00\",\"dateModified\":\"2025-05-24T03:27:53+00:00\",\"description\":\"This tutorial shows you how to use the PL\\\/SQL CASE statement including simple CASE and searched CASE statements.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-case-statement\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-case-statement\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-case-statement\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PL\\\/SQL Tutorial\",\"item\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PL\\\/SQL CASE Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/\",\"name\":\"Oracle Tutorial\",\"description\":\"Oracle Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.oracletutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PL\/SQL CASE Statement","description":"This tutorial shows you how to use the PL\/SQL CASE statement including simple CASE and searched CASE statements.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/","og_locale":"en_US","og_type":"article","og_title":"PL\/SQL CASE Statement","og_description":"This tutorial shows you how to use the PL\/SQL CASE statement including simple CASE and searched CASE statements.","og_url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/","og_site_name":"Oracle Tutorial","article_modified_time":"2025-05-24T03:27:53+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/","url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/","name":"PL\/SQL CASE Statement","isPartOf":{"@id":"https:\/\/www.oracletutorial.com\/#website"},"datePublished":"2017-11-09T02:55:51+00:00","dateModified":"2025-05-24T03:27:53+00:00","description":"This tutorial shows you how to use the PL\/SQL CASE statement including simple CASE and searched CASE statements.","breadcrumb":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-case-statement\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.oracletutorial.com\/"},{"@type":"ListItem","position":2,"name":"PL\/SQL Tutorial","item":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/"},{"@type":"ListItem","position":3,"name":"PL\/SQL CASE Statement"}]},{"@type":"WebSite","@id":"https:\/\/www.oracletutorial.com\/#website","url":"https:\/\/www.oracletutorial.com\/","name":"Oracle Tutorial","description":"Oracle Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oracletutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/comments?post=1415"}],"version-history":[{"count":0,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1415\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1418"}],"wp:attachment":[{"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/media?parent=1415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}