{"id":1532,"date":"2017-11-25T13:46:19","date_gmt":"2017-11-25T06:46:19","guid":{"rendered":"https:\/\/oracletutorial.com\/?page_id=1532"},"modified":"2025-05-25T06:10:46","modified_gmt":"2025-05-25T13:10:46","slug":"plsql-cursor-for-loop","status":"publish","type":"page","link":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/","title":{"rendered":"PL\/SQL Cursor FOR LOOP"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the PL\/SQL cursor <code>FOR LOOP<\/code>&nbsp;statement to fetch and process every record from a cursor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-plsql-cursor-for-loop-statement'>Introduction to PL\/SQL cursor FOR LOOP statement <a href=\"#introduction-to-plsql-cursor-for-loop-statement\" class=\"anchor\" id=\"introduction-to-plsql-cursor-for-loop-statement\" title=\"Anchor for Introduction to PL\/SQL cursor &lt;code&gt;FOR LOOP&lt;\/code&gt; statement\">#<\/a><\/h2>\n\n\n\n<p>The cursor <code>FOR LOOP<\/code> statement is an elegant extension of the numeric <code><a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-for-loop\/\">FOR LOOP<\/a><\/code> statement.<\/p>\n\n\n\n<p>The numeric <code><a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-for-loop\/\">FOR LOOP<\/a><\/code> executes the body of a loop once for every integer value in a specified range.&nbsp; Similarly, the cursor <code>FOR LOOP<\/code> executes the body of the loop once for each row returned by the <a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select\/\">query<\/a> associated with the cursor.<\/p>\n\n\n\n<p>A nice feature of the cursor <code>FOR LOOP<\/code> statement is that it allows you to fetch every row from a cursor without manually managing the execution cycle i.e., &nbsp;<code>OPEN<\/code>, <code>FETCH<\/code>, and <code>CLOSE<\/code>.<\/p>\n\n\n\n<p>The cursor <code>FOR LOOP<\/code> implicitly creates its loop index as a <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-record\/\">record<\/a> variable with the row type in which the cursor returns and then opens the cursor.<\/p>\n\n\n\n<p>In each loop iteration, the cursor <code>FOR LOOP<\/code> statement fetches a row from the result set into its loop index. If there is no row to fetch, the cursor <code>FOR LOOP<\/code> closes the cursor.<\/p>\n\n\n\n<p>The cursor is also closed if a statement inside the loop transfers control outside the loop, e.g., <code>EXIT<\/code>&nbsp;and&nbsp;<code><a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-goto\/\">GOTO<\/a><\/code>, or <a href=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-raise\/\">raises an exception<\/a>.<\/p>\n\n\n\n<p>The following illustrates the syntax of the cursor <code>FOR LOOP<\/code> statement:<\/p>\n\n\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\">FOR<\/span> <span class=\"hljs-type\">record<\/span> <span class=\"hljs-keyword\">IN<\/span> cursor_name\n<span class=\"hljs-keyword\">LOOP<\/span>\n    process_record_statements;\n<span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">LOOP<\/span>;\n<\/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>\n\n\n<p><strong>1) record<\/strong><\/p>\n\n\n\n<p>The <code>record<\/code> is the name of the index that the cursor <code>FOR LOOP<\/code> statement declares implicitly as a <code>%ROWTYPE<\/code> record variable of the type of the cursor.<\/p>\n\n\n\n<p>The <code>record<\/code> variable is local to the cursor <code>FOR LOOP<\/code> statement. It means that you can only reference it inside the loop, not outside. After the cursor <code>FOR LOOP<\/code> statement execution ends, the <code>record<\/code> variable becomes undefined.<\/p>\n\n\n\n<p><strong>2) cursor_name<\/strong><\/p>\n\n\n\n<p>The <code>cursor_name<\/code> is the name of an explicit cursor that is not opened when the loop starts.<\/p>\n\n\n\n<p>Note that besides the cursor name, you can use a <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select\/\">SELECT<\/a><\/code> statement as shown below:<\/p>\n\n\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\">FOR<\/span> <span class=\"hljs-type\">record<\/span> <span class=\"hljs-keyword\">IN<\/span> (select_statement)\n<span class=\"hljs-keyword\">LOOP<\/span>\n    process_record_statements;\n<span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">LOOP<\/span>; \n<\/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>\n\n\n<p>In this case, the cursor <code>FOR LOOP<\/code> declares, opens, fetches from, and closes an implicit cursor. However, the implicit cursor is internal; therefore, you cannot reference it.<\/p>\n\n\n\n<p>Note that Oracle Database automatically optimizes a cursor <code>FOR LOOP<\/code> to work similarly to a <code>BULK COLLECT<\/code> query. Although your code looks as if it fetched one row at a time, Oracle Database fetches multiple rows at a time and allows you to process each row individually.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='plsql-cursor-for-loop-examples'>PL\/SQL cursor FOR LOOP examples <a href=\"#plsql-cursor-for-loop-examples\" class=\"anchor\" id=\"plsql-cursor-for-loop-examples\" title=\"Anchor for PL\/SQL cursor &lt;code&gt;FOR LOOP&lt;\/code&gt; examples\">#<\/a><\/h2>\n\n\n\n<p>Let&#8217;s look at some examples of using the cursor <code>FOR LOOP<\/code> statement to see how it works.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='plsql-cursor-for-loop-example'>PL\/SQL cursor FOR LOOP example <a href=\"#plsql-cursor-for-loop-example\" class=\"anchor\" id=\"plsql-cursor-for-loop-example\" title=\"Anchor for PL\/SQL cursor FOR LOOP example\">#<\/a><\/h3>\n\n\n\n<p>The following example declares an explicit cursor and uses it in the cursor <code>FOR LOOP<\/code> statement.<\/p>\n\n\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>;\n\n<span class=\"hljs-keyword\">DECLARE<\/span>\n  <span class=\"hljs-keyword\">CURSOR<\/span> c_product\n  <span class=\"hljs-keyword\">IS<\/span>\n    <span class=\"hljs-keyword\">SELECT<\/span> \n        product_name, list_price\n    <span class=\"hljs-keyword\">FROM<\/span> \n        products \n    <span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \n        list_price <span class=\"hljs-keyword\">DESC<\/span>;\n<span class=\"hljs-keyword\">BEGIN<\/span>\n  <span class=\"hljs-keyword\">FOR<\/span> r_product <span class=\"hljs-keyword\">IN<\/span> c_product\n  <span class=\"hljs-keyword\">LOOP<\/span>\n    dbms_output.put_line( r_product.product_name || <span class=\"hljs-string\">': $'<\/span> ||  r_product.list_price );\n  <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">LOOP<\/span>;\n<span class=\"hljs-keyword\">END<\/span>;<\/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>\n\n\n<p>How it works:<\/p>\n\n\n\n<p>First, set serveroutput on to display output for the dbms_output.put_line:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">SET SERVEROUTPUT ON;<\/code><\/span><\/pre>\n\n\n<p>Second, declare a cursor based on a query that retrieves data from the <code>products<\/code> table in the sample database:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">CURSOR c_product\n IS\n   SELECT \n       product_name, list_price\n   FROM \n       products \n   ORDER BY \n       list_price DESC;<\/code><\/span><\/pre>\n\n\n<p>Third, iterate over the record of the cursor and display the product name and list price of each to the output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">FOR r_product IN c_product\n LOOP\n   dbms_output.put_line( r_product.product_name || <span class=\"hljs-string\">': $'<\/span> ||  r_product.list_price );\n END LOOP;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='cursor-for-loop-with-a-select-statement-example'>Cursor FOR LOOP with a SELECT statement example <a href=\"#cursor-for-loop-with-a-select-statement-example\" class=\"anchor\" id=\"cursor-for-loop-with-a-select-statement-example\" title=\"Anchor for Cursor FOR LOOP with a SELECT statement example\">#<\/a><\/h3>\n\n\n\n<p>The following example is equivalent to the example above but uses a query in a cursor <code>FOR LOOP<\/code> statement.<\/p>\n\n\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>;\n\n<span class=\"hljs-keyword\">BEGIN<\/span>\n  <span class=\"hljs-keyword\">FOR<\/span> r_product <span class=\"hljs-keyword\">IN<\/span> (\n        <span class=\"hljs-keyword\">SELECT<\/span> \n            product_name, list_price \n        <span class=\"hljs-keyword\">FROM<\/span> \n            products\n        <span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> list_price <span class=\"hljs-keyword\">DESC<\/span>\n    )\n  <span class=\"hljs-keyword\">LOOP<\/span>\n     dbms_output.put_line( r_product.product_name ||\n        <span class=\"hljs-string\">': $'<\/span> || \n        r_product.list_price );\n  <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">LOOP<\/span>;\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>\n\n\n<p>How it works:<\/p>\n\n\n\n<p>First, declare an implicitly declared record variable r_product wihtin the FOR LOOP. The cursor will hold one row returend by the SELECT statement.<\/p>\n\n\n\n<p>Second, specify a query that creates an implicit cursor: <\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">(SELECT product_name, list_price FROM products ORDER BY list_price DESC)<\/code><\/span><\/pre>\n\n\n<p>PL\/SQL engine will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Execute the SELECT query.<\/li>\n\n\n\n<li>Open an internal cursor for the result.<\/li>\n\n\n\n<li>Fetch rows from this cursor one by one.<\/li>\n\n\n\n<li>Close the cursor automatically when it completes processing all rows.<\/li>\n<\/ul>\n\n\n\n<p>Third, display the product and price within the loop body between LOOP and END LOOP.<\/p>\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=\"1532\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/\"\n\t\t\t\tdata-post-title=\"PL\/SQL Cursor FOR LOOP\"\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=\"1532\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/\"\n\t\t\t\tdata-post-title=\"PL\/SQL Cursor FOR LOOP\"\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 introduces you the PL\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1418,"menu_order":22,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1532","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 Cursor FOR LOOP Statement<\/title>\n<meta name=\"description\" content=\"This tutorial introduces you the PL\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.\" \/>\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-cursor-for-loop\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PL\/SQL Cursor FOR LOOP Statement\" \/>\n<meta property=\"og:description\" content=\"This tutorial introduces you the PL\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/\" \/>\n<meta property=\"og:site_name\" content=\"Oracle Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-25T13:10:46+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-cursor-for-loop\\\/\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-cursor-for-loop\\\/\",\"name\":\"PL\\\/SQL Cursor FOR LOOP Statement\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\"},\"datePublished\":\"2017-11-25T06:46:19+00:00\",\"dateModified\":\"2025-05-25T13:10:46+00:00\",\"description\":\"This tutorial introduces you the PL\\\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-cursor-for-loop\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-cursor-for-loop\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/plsql-cursor-for-loop\\\/#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 Cursor FOR LOOP\"}]},{\"@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 Cursor FOR LOOP Statement","description":"This tutorial introduces you the PL\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.","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-cursor-for-loop\/","og_locale":"en_US","og_type":"article","og_title":"PL\/SQL Cursor FOR LOOP Statement","og_description":"This tutorial introduces you the PL\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.","og_url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/","og_site_name":"Oracle Tutorial","article_modified_time":"2025-05-25T13:10:46+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-cursor-for-loop\/","url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/","name":"PL\/SQL Cursor FOR LOOP Statement","isPartOf":{"@id":"https:\/\/www.oracletutorial.com\/#website"},"datePublished":"2017-11-25T06:46:19+00:00","dateModified":"2025-05-25T13:10:46+00:00","description":"This tutorial introduces you the PL\/SQL cursor FOR LOOP\u00a0statement and show you how to fetch and process every record from a cursor.","breadcrumb":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/plsql-cursor-for-loop\/#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 Cursor FOR LOOP"}]},{"@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\/1532","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=1532"}],"version-history":[{"count":0,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/1532\/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=1532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}