{"id":625,"date":"2026-07-21T03:34:46","date_gmt":"2026-07-21T03:34:46","guid":{"rendered":"https:\/\/mitalgoswami.in\/?p=625"},"modified":"2026-07-23T05:57:18","modified_gmt":"2026-07-23T05:57:18","slug":"oracle-pl-sql-control-statements","status":"publish","type":"post","link":"https:\/\/mitalgoswami.in\/?p=625","title":{"rendered":"Oracle PL\/SQL Control Statements"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">1. IF Condition<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>IF statement<\/strong> is used to execute a block of code when a specified condition is true.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>IF condition THEN\n   statements;\nEND IF;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    num NUMBER := 15;\nBEGIN\n    IF num &gt; 10 THEN\n        DBMS_OUTPUT.PUT_LINE('Number is greater than 10');\n    END IF;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Number is greater than 10<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>IF<\/code> checks the condition.<\/li>\n\n\n\n<li>If the condition is <code>TRUE<\/code>, the statements inside <code>THEN<\/code> are executed.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. IF-ELSE Condition<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>IF condition THEN\n   statements1;\nELSE\n   statements2;\nEND IF;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    marks NUMBER := 45;\nBEGIN\n    IF marks &gt;= 35 THEN\n        DBMS_OUTPUT.PUT_LINE('Pass');\n    ELSE\n        DBMS_OUTPUT.PUT_LINE('Fail');\n    END IF;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Pass<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Executes one block if the condition is true.<\/li>\n\n\n\n<li>Executes the <code>ELSE<\/code> block if the condition is false.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. IF-ELSIF-ELSE Condition<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>IF condition1 THEN\n    statements1;\nELSIF condition2 THEN\n    statements2;\nELSE\n    statements3;\nEND IF;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    marks NUMBER := 82;\nBEGIN\n    IF marks &gt;= 90 THEN\n        DBMS_OUTPUT.PUT_LINE('Grade A+');\n    ELSIF marks &gt;= 75 THEN\n        DBMS_OUTPUT.PUT_LINE('Grade A');\n    ELSIF marks &gt;= 60 THEN\n        DBMS_OUTPUT.PUT_LINE('Grade B');\n    ELSE\n        DBMS_OUTPUT.PUT_LINE('Grade C');\n    END IF;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Grade A<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Checks multiple conditions.<\/li>\n\n\n\n<li>The first true condition is executed.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">4. CASE Statement (Switch Case)<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Oracle PL\/SQL does not have <code>switch<\/code>; it uses the <strong>CASE<\/strong> statement.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>CASE expression\n    WHEN value1 THEN\n        statements;\n    WHEN value2 THEN\n        statements;\n    ELSE\n        statements;\nEND CASE;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    day_no NUMBER := 3;\nBEGIN\n    CASE day_no\n        WHEN 1 THEN\n            DBMS_OUTPUT.PUT_LINE('Monday');\n        WHEN 2 THEN\n            DBMS_OUTPUT.PUT_LINE('Tuesday');\n        WHEN 3 THEN\n            DBMS_OUTPUT.PUT_LINE('Wednesday');\n        ELSE\n            DBMS_OUTPUT.PUT_LINE('Invalid Day');\n    END CASE;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Wednesday<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Compares one expression with multiple values.<\/li>\n\n\n\n<li>Executes the matching block.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">5. Looping Structures<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">A. Simple LOOP<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>LOOP\n   statements;\n   EXIT WHEN condition;\nEND LOOP;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    i NUMBER := 1;\nBEGIN\n    LOOP\n        DBMS_OUTPUT.PUT_LINE(i);\n        i := i + 1;\n        EXIT WHEN i &gt; 5;\n    END LOOP;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1\n2\n3\n4\n5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Executes repeatedly until <code>EXIT WHEN<\/code> becomes true.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">B. WHILE LOOP<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>WHILE condition LOOP\n    statements;\nEND LOOP;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    i NUMBER := 1;\nBEGIN\n    WHILE i &lt;= 5 LOOP\n        DBMS_OUTPUT.PUT_LINE(i);\n        i := i + 1;\n    END LOOP;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1\n2\n3\n4\n5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Checks the condition before each iteration.<\/li>\n\n\n\n<li>Executes while the condition is true.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">C. FOR LOOP<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>FOR variable IN start..end LOOP\n    statements;\nEND LOOP;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>BEGIN\n    FOR i IN 1..5 LOOP\n        DBMS_OUTPUT.PUT_LINE(i);\n    END LOOP;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1\n2\n3\n4\n5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automatically initializes and increments the loop variable.<\/li>\n\n\n\n<li>No need to declare or increment the loop variable.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">D. REVERSE FOR LOOP<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>BEGIN\n    FOR i IN REVERSE 1..5 LOOP\n        DBMS_OUTPUT.PUT_LINE(i);\n    END LOOP;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>5\n4\n3\n2\n1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Loops from the ending value down to the starting value.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">6. Operators in PL\/SQL<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">A. Arithmetic Operators<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Operator<\/th><th>Description<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td>+<\/td><td>Addition<\/td><td>10+5 = 15<\/td><\/tr><tr><td>&#8211;<\/td><td>Subtraction<\/td><td>10-5 = 5<\/td><\/tr><tr><td>*<\/td><td>Multiplication<\/td><td>10*5 = 50<\/td><\/tr><tr><td>\/<\/td><td>Division<\/td><td>10\/5 = 2<\/td><\/tr><tr><td>**<\/td><td>Exponent<\/td><td>2**3 = 8<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    a NUMBER := 20;\n    b NUMBER := 5;\nBEGIN\n    DBMS_OUTPUT.PUT_LINE(a+b);\n    DBMS_OUTPUT.PUT_LINE(a-b);\n    DBMS_OUTPUT.PUT_LINE(a*b);\n    DBMS_OUTPUT.PUT_LINE(a\/b);\nEND;\n\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">B. Comparison (Relational) Operators<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Operator<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td>=<\/td><td>Equal<\/td><\/tr><tr><td>!= or &lt;&gt; or ^=<\/td><td>Not Equal<\/td><\/tr><tr><td>&gt;<\/td><td>Greater Than<\/td><\/tr><tr><td>&lt;<\/td><td>Less Than<\/td><\/tr><tr><td>&gt;=<\/td><td>Greater Than or Equal<\/td><\/tr><tr><td>&lt;=<\/td><td>Less Than or Equal<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    a NUMBER := 10;\n    b NUMBER := 20;\nBEGIN\n    IF a &lt; b THEN\n        DBMS_OUTPUT.PUT_LINE('a is smaller');\n    END IF;\nEND;\n\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">C. Logical Operators<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Operator<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>AND<\/td><td>Both conditions must be true<\/td><\/tr><tr><td>OR<\/td><td>At least one condition is true<\/td><\/tr><tr><td>NOT<\/td><td>Reverses the result<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    age NUMBER := 22;\nBEGIN\n    IF age &gt;= 18 AND age &lt;= 60 THEN\n        DBMS_OUTPUT.PUT_LINE('Eligible');\n    END IF;\nEND;\n\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">D. Assignment Operator<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Operator<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>:=<\/td><td>Assigns value to a variable<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    name VARCHAR2(20);\nBEGIN\n    name := 'Oracle';\n    DBMS_OUTPUT.PUT_LINE(name);\nEND;\n\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">7. SELECT INTO Statement<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>SELECT INTO<\/strong> statement retrieves a single row from a table and stores the values into PL\/SQL variables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT column1, column2\nINTO variable1, variable2\nFROM table_name\nWHERE condition;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Example Table<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE employee(\n    emp_id NUMBER PRIMARY KEY,\n    emp_name VARCHAR2(30),\n    salary NUMBER\n);\n\nINSERT INTO employee VALUES (101,'Rahul',30000);\nINSERT INTO employee VALUES (102,'Priya',45000);\nCOMMIT;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Example 1: Fetch One Record<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    v_name employee.emp_name%TYPE;\n    v_salary employee.salary%TYPE;\nBEGIN\n    SELECT emp_name, salary\n    INTO v_name, v_salary\n    FROM employee\n    WHERE emp_id = 101;\n\n    DBMS_OUTPUT.PUT_LINE('Employee: ' || v_name);\n    DBMS_OUTPUT.PUT_LINE('Salary: ' || v_salary);\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Employee: Rahul\nSalary: 30000<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Description<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>SELECT INTO<\/code> retrieves exactly one row.<\/li>\n\n\n\n<li>The selected values are stored in PL\/SQL variables.<\/li>\n\n\n\n<li>If no row is found, Oracle raises <code>NO_DATA_FOUND<\/code>.<\/li>\n\n\n\n<li>If more than one row is returned, Oracle raises <code>TOO_MANY_ROWS<\/code>.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Example 2: SELECT INTO with Exception Handling<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>DECLARE\n    v_name employee.emp_name%TYPE;\nBEGIN\n    SELECT emp_name\n    INTO v_name\n    FROM employee\n    WHERE emp_id = 500;\n\n    DBMS_OUTPUT.PUT_LINE(v_name);\n\nEXCEPTION\n    WHEN NO_DATA_FOUND THEN\n        DBMS_OUTPUT.PUT_LINE('Employee not found.');\n    WHEN TOO_MANY_ROWS THEN\n        DBMS_OUTPUT.PUT_LINE('More than one employee found.');\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Employee not found.<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Summary Table<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Topic<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td>IF<\/td><td>Executes statements when a condition is true<\/td><\/tr><tr><td>IF-ELSE<\/td><td>Chooses between two alternatives<\/td><\/tr><tr><td>IF-ELSIF<\/td><td>Checks multiple conditions<\/td><\/tr><tr><td>CASE<\/td><td>Selects one block from multiple options (switch-like)<\/td><\/tr><tr><td>LOOP<\/td><td>Repeats statements until <code>EXIT WHEN<\/code><\/td><\/tr><tr><td>WHILE LOOP<\/td><td>Repeats while a condition is true<\/td><\/tr><tr><td>FOR LOOP<\/td><td>Iterates over a range automatically<\/td><\/tr><tr><td>REVERSE FOR LOOP<\/td><td>Iterates in reverse order<\/td><\/tr><tr><td>Operators<\/td><td>Perform arithmetic, comparison, logical, and assignment operations<\/td><\/tr><tr><td>SELECT INTO<\/td><td>Retrieves a single row from a table into PL\/SQL variables<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax Example Output Description 2. IF-ELSE Condition Syntax Example Output Description 3. IF-ELSIF-ELSE Condition Syntax Example Output Description 4. CASE Statement (Switch Case) Oracle PL\/SQL does not have switch; it uses the CASE statement. Syntax [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-625","post","type-post","status-publish","format-standard","hentry","category-oracle"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num &gt; 10 THEN DBMS_OUTPUT.PUT_LINE(&#039;Number is greater than 10&#039;); END IF; END; \/ Output Number is greater than 10 Description\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"admin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/mitalgoswami.in\/?p=625\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Mital&#039;s Blog - My  Blog\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Oracle PL\/SQL Control Statements - Mital&#039;s Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num &gt; 10 THEN DBMS_OUTPUT.PUT_LINE(&#039;Number is greater than 10&#039;); END IF; END; \/ Output Number is greater than 10 Description\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mitalgoswami.in\/?p=625\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-07-21T03:34:46+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-23T05:57:18+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Oracle PL\/SQL Control Statements - Mital&#039;s Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num &gt; 10 THEN DBMS_OUTPUT.PUT_LINE(&#039;Number is greater than 10&#039;); END IF; END; \/ Output Number is greater than 10 Description\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#blogposting\",\"name\":\"Oracle PL\\\/SQL Control Statements - Mital's Blog\",\"headline\":\"Oracle PL\\\/SQL Control Statements\",\"author\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/#organization\"},\"datePublished\":\"2026-07-21T03:34:46+00:00\",\"dateModified\":\"2026-07-23T05:57:18+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#webpage\"},\"articleSection\":\"oracle\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mitalgoswami.in\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?cat=30#listItem\",\"name\":\"oracle\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?cat=30#listItem\",\"position\":2,\"name\":\"oracle\",\"item\":\"https:\\\/\\\/mitalgoswami.in\\\/?cat=30\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#listItem\",\"name\":\"Oracle PL\\\/SQL Control Statements\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#listItem\",\"position\":3,\"name\":\"Oracle PL\\\/SQL Control Statements\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?cat=30#listItem\",\"name\":\"oracle\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/#organization\",\"name\":\"Mital's Blog\",\"description\":\"My  Blog\",\"url\":\"https:\\\/\\\/mitalgoswami.in\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?author=1#author\",\"url\":\"https:\\\/\\\/mitalgoswami.in\\\/?author=1\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a575ce1a3c064ed3befd825918c1c0457a92281570ba3e96c008e1c0af08ddc5?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"admin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#webpage\",\"url\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625\",\"name\":\"Oracle PL\\\/SQL Control Statements - Mital's Blog\",\"description\":\"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num > 10 THEN DBMS_OUTPUT.PUT_LINE('Number is greater than 10'); END IF; END; \\\/ Output Number is greater than 10 Description\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?p=625#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/?author=1#author\"},\"datePublished\":\"2026-07-21T03:34:46+00:00\",\"dateModified\":\"2026-07-23T05:57:18+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/#website\",\"url\":\"https:\\\/\\\/mitalgoswami.in\\\/\",\"name\":\"Mital's Blog\",\"description\":\"My  Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mitalgoswami.in\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Oracle PL\/SQL Control Statements - Mital's Blog","description":"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num > 10 THEN DBMS_OUTPUT.PUT_LINE('Number is greater than 10'); END IF; END; \/ Output Number is greater than 10 Description","canonical_url":"https:\/\/mitalgoswami.in\/?p=625","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/mitalgoswami.in\/?p=625#blogposting","name":"Oracle PL\/SQL Control Statements - Mital's Blog","headline":"Oracle PL\/SQL Control Statements","author":{"@id":"https:\/\/mitalgoswami.in\/?author=1#author"},"publisher":{"@id":"https:\/\/mitalgoswami.in\/#organization"},"datePublished":"2026-07-21T03:34:46+00:00","dateModified":"2026-07-23T05:57:18+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/mitalgoswami.in\/?p=625#webpage"},"isPartOf":{"@id":"https:\/\/mitalgoswami.in\/?p=625#webpage"},"articleSection":"oracle"},{"@type":"BreadcrumbList","@id":"https:\/\/mitalgoswami.in\/?p=625#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in#listItem","position":1,"name":"Home","item":"https:\/\/mitalgoswami.in","nextItem":{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in\/?cat=30#listItem","name":"oracle"}},{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in\/?cat=30#listItem","position":2,"name":"oracle","item":"https:\/\/mitalgoswami.in\/?cat=30","nextItem":{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in\/?p=625#listItem","name":"Oracle PL\/SQL Control Statements"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in\/?p=625#listItem","position":3,"name":"Oracle PL\/SQL Control Statements","previousItem":{"@type":"ListItem","@id":"https:\/\/mitalgoswami.in\/?cat=30#listItem","name":"oracle"}}]},{"@type":"Organization","@id":"https:\/\/mitalgoswami.in\/#organization","name":"Mital's Blog","description":"My  Blog","url":"https:\/\/mitalgoswami.in\/"},{"@type":"Person","@id":"https:\/\/mitalgoswami.in\/?author=1#author","url":"https:\/\/mitalgoswami.in\/?author=1","name":"admin","image":{"@type":"ImageObject","@id":"https:\/\/mitalgoswami.in\/?p=625#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a575ce1a3c064ed3befd825918c1c0457a92281570ba3e96c008e1c0af08ddc5?s=96&d=mm&r=g","width":96,"height":96,"caption":"admin"}},{"@type":"WebPage","@id":"https:\/\/mitalgoswami.in\/?p=625#webpage","url":"https:\/\/mitalgoswami.in\/?p=625","name":"Oracle PL\/SQL Control Statements - Mital's Blog","description":"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num > 10 THEN DBMS_OUTPUT.PUT_LINE('Number is greater than 10'); END IF; END; \/ Output Number is greater than 10 Description","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mitalgoswami.in\/#website"},"breadcrumb":{"@id":"https:\/\/mitalgoswami.in\/?p=625#breadcrumblist"},"author":{"@id":"https:\/\/mitalgoswami.in\/?author=1#author"},"creator":{"@id":"https:\/\/mitalgoswami.in\/?author=1#author"},"datePublished":"2026-07-21T03:34:46+00:00","dateModified":"2026-07-23T05:57:18+00:00"},{"@type":"WebSite","@id":"https:\/\/mitalgoswami.in\/#website","url":"https:\/\/mitalgoswami.in\/","name":"Mital's Blog","description":"My  Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/mitalgoswami.in\/#organization"}}]},"og:locale":"en_US","og:site_name":"Mital's Blog - My  Blog","og:type":"article","og:title":"Oracle PL\/SQL Control Statements - Mital's Blog","og:description":"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num &gt; 10 THEN DBMS_OUTPUT.PUT_LINE('Number is greater than 10'); END IF; END; \/ Output Number is greater than 10 Description","og:url":"https:\/\/mitalgoswami.in\/?p=625","article:published_time":"2026-07-21T03:34:46+00:00","article:modified_time":"2026-07-23T05:57:18+00:00","twitter:card":"summary_large_image","twitter:title":"Oracle PL\/SQL Control Statements - Mital's Blog","twitter:description":"1. IF Condition The IF statement is used to execute a block of code when a specified condition is true. Syntax IF condition THEN statements; END IF; Example DECLARE num NUMBER := 15; BEGIN IF num &gt; 10 THEN DBMS_OUTPUT.PUT_LINE('Number is greater than 10'); END IF; END; \/ Output Number is greater than 10 Description"},"aioseo_meta_data":{"post_id":"625","title":"#post_title #separator_sa #site_title","description":"#post_excerpt","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-07-21 03:34:46","updated":"2026-07-24 04:48:56","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mitalgoswami.in\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mitalgoswami.in\/?cat=30\" title=\"oracle\">oracle<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tOracle PL\/SQL Control Statements\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mitalgoswami.in"},{"label":"oracle","link":"https:\/\/mitalgoswami.in\/?cat=30"},{"label":"Oracle PL\/SQL Control Statements","link":"https:\/\/mitalgoswami.in\/?p=625"}],"_links":{"self":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=625"}],"version-history":[{"count":1,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/625\/revisions"}],"predecessor-version":[{"id":626,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=\/wp\/v2\/posts\/625\/revisions\/626"}],"wp:attachment":[{"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mitalgoswami.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}