{"id":2865,"date":"2019-08-09T03:54:51","date_gmt":"2019-08-09T10:54:51","guid":{"rendered":"https:\/\/oracletutorial.com\/?page_id=2865"},"modified":"2025-05-25T03:47:12","modified_gmt":"2025-05-25T10:47:12","slug":"oracle-cursor-for-update","status":"publish","type":"page","link":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/","title":{"rendered":"Oracle CURSOR FOR UPDATE"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: In this tutorial, you will learn how to use the Oracle updatable cursor to update data in a table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-oracle-cursor-for-update'>Introduction to Oracle Cursor FOR UPDATE <a href=\"#introduction-to-oracle-cursor-for-update\" class=\"anchor\" id=\"introduction-to-oracle-cursor-for-update\" title=\"Anchor for Introduction to Oracle Cursor FOR UPDATE\">#<\/a><\/h2>\n\n\n\n<p>Sometimes, you want to lock a set of rows before you can <a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-update\/\">update<\/a> them in your program. Oracle provides the <code>FOR UPDATE<\/code> clause of the <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-select\/\">SELECT<\/a><\/code> statement in an updatable cursor to perform this kind of locking mechanism.<\/p>\n\n\n\n<p>Here&#8217;s the syntax for declaring an updatable cursor:<\/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\">CURSOR<\/span> cursor_name <span class=\"hljs-keyword\">IS<\/span>\n    <span class=\"hljs-keyword\">SELECT<\/span> select_clause\n    <span class=\"hljs-keyword\">FROM<\/span> from_clause\n    <span class=\"hljs-keyword\">WHERE<\/span> where_clause\n    <span class=\"hljs-keyword\">FOR<\/span> <span class=\"hljs-keyword\">UPDATE<\/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>\n\n\n<p>The new syntax here is the <code>FOR UPDATE<\/code> keywords.<\/p>\n\n\n\n<p>Once you open the cursor, Oracle will lock all rows selected by the <code>SELECT ... FOR UPDATE<\/code> statement in the tables specified in the <code>FROM<\/code> clause. These rows will remain locked until the cursor is closed or the transaction is completed with either <code>COMMIT<\/code> or <code>ROLLBACK<\/code>.<\/p>\n\n\n\n<p>Since Oracle locks all rows returned by the <code>SELECT ... FOR UPDATE<\/code> during the update, you should have a <code><a href=\"https:\/\/www.oracletutorial.com\/oracle-basics\/oracle-where\/\">WHERE<\/a><\/code> clause to select only necessary rows to be locked.<\/p>\n\n\n\n<p>If you have a specific column that you want to update, you can list it in the <code>FOR UPDATE<\/code> clause as follows:<\/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\">CURSOR<\/span> cursor_name <span class=\"hljs-keyword\">IS<\/span>\n    <span class=\"hljs-keyword\">SELECT<\/span> select_clause\n    <span class=\"hljs-keyword\">FROM<\/span> from_clause\n    <span class=\"hljs-keyword\">WHERE<\/span> where_clause\n    <span class=\"hljs-keyword\">FOR<\/span> <span class=\"hljs-keyword\">UPDATE<\/span> <span class=\"hljs-keyword\">OF<\/span> <span class=\"hljs-built_in\">column_name<\/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>\n\n\n<p>In this case, Oracle only locks rows of the table that has the column name listed in the <code>FOR UPDATE OF<\/code> clause.<\/p>\n\n\n\n<p>Note that if you use only <code>FOR UPDATE<\/code> clause and do not include one or more column after the <code>OF<\/code> keyword, Oracle will then lock all selected rows across all tables listed in the <code>FROM<\/code> clause.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='oracle-cursor-for-update-example'>Oracle Cursor FOR UPDATE example <a href=\"#oracle-cursor-for-update-example\" class=\"anchor\" id=\"oracle-cursor-for-update-example\" title=\"Anchor for Oracle Cursor FOR UPDATE example\">#<\/a><\/h2>\n\n\n\n<p>We&#8217;ll use the <code>customers<\/code> and <code>orders<\/code> from <a href=\"https:\/\/www.oracletutorial.com\/getting-started\/oracle-sample-database\/\">sample database<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"354\" height=\"145\" src=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png\" alt=\"Customers and Orders tables\" class=\"wp-image-643\" srcset=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png 354w, https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables-300x123.png 300w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/figure>\n\n\n\n<p>The following example uses a cursor <code>FOR UPDATE<\/code> to update credit limit for customers:<\/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\">DECLARE<\/span>\n    <span class=\"hljs-comment\">-- customer cursor<\/span>\n    <span class=\"hljs-keyword\">CURSOR<\/span> c_customers <span class=\"hljs-keyword\">IS<\/span> \n        <span class=\"hljs-keyword\">SELECT<\/span> \n            customer_id, \n            <span class=\"hljs-type\">name<\/span>, \n            credit_limit\n        <span class=\"hljs-keyword\">FROM<\/span> \n            customers\n        <span class=\"hljs-keyword\">WHERE<\/span> \n            credit_limit &gt; <span class=\"hljs-number\">0<\/span> \n        <span class=\"hljs-keyword\">FOR<\/span> <span class=\"hljs-keyword\">UPDATE<\/span> <span class=\"hljs-keyword\">OF<\/span> credit_limit;\n    <span class=\"hljs-comment\">-- local variables<\/span>\n    l_order_count PLS_INTEGER := <span class=\"hljs-number\">0<\/span>;\n    l_increment   PLS_INTEGER := <span class=\"hljs-number\">0<\/span>;\n    \n<span class=\"hljs-keyword\">BEGIN<\/span>\n    <span class=\"hljs-keyword\">FOR<\/span> r_customer <span class=\"hljs-keyword\">IN<\/span> c_customers\n    <span class=\"hljs-keyword\">LOOP<\/span>\n        <span class=\"hljs-comment\">-- get the number of orders of the customer<\/span>\n        <span class=\"hljs-keyword\">SELECT<\/span> COUNT(*)\n        <span class=\"hljs-keyword\">INTO<\/span> l_order_count\n        <span class=\"hljs-keyword\">FROM<\/span> orders\n        <span class=\"hljs-keyword\">WHERE<\/span> customer_id = r_customer.customer_id;\n        <span class=\"hljs-comment\">-- <\/span>\n        <span class=\"hljs-keyword\">IF<\/span> l_order_count &gt;= <span class=\"hljs-number\">5<\/span> <span class=\"hljs-keyword\">THEN<\/span>\n            l_increment := <span class=\"hljs-number\">5<\/span>;\n        <span class=\"hljs-keyword\">ELSIF<\/span> l_order_count &lt; <span class=\"hljs-number\">5<\/span> <span class=\"hljs-keyword\">AND<\/span> l_order_count &gt;=<span class=\"hljs-number\">2<\/span> <span class=\"hljs-keyword\">THEN<\/span>\n            l_increment := <span class=\"hljs-number\">2<\/span>;\n        <span class=\"hljs-keyword\">ELSIF<\/span> l_increment = <span class=\"hljs-number\">1<\/span> <span class=\"hljs-keyword\">THEN<\/span>\n            l_increment := <span class=\"hljs-number\">1<\/span>;\n        <span class=\"hljs-keyword\">ELSE<\/span> \n            l_increment := <span class=\"hljs-number\">0<\/span>;\n        <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">IF<\/span>;\n        \n        <span class=\"hljs-keyword\">IF<\/span> l_increment &gt; <span class=\"hljs-number\">0<\/span> <span class=\"hljs-keyword\">THEN<\/span>\n            <span class=\"hljs-comment\">-- update the credit limit<\/span>\n            <span class=\"hljs-keyword\">UPDATE<\/span> \n                customers\n            <span class=\"hljs-keyword\">SET<\/span> \n                credit_limit = credit_limit * ( <span class=\"hljs-number\">1<\/span> +  l_increment\/ <span class=\"hljs-number\">100<\/span>)\n            <span class=\"hljs-keyword\">WHERE<\/span> \n                customer_id = r_customer.customer_id;\n            \n            <span class=\"hljs-comment\">-- show the customers whose credits are increased<\/span>\n            dbms_output.put_line(<span class=\"hljs-string\">'Increase credit for customer '<\/span> \n                || r_customer.NAME || <span class=\"hljs-string\">' by '<\/span> \n                || l_increment || <span class=\"hljs-string\">'%'<\/span> );\n        <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">IF<\/span>;\n    <span class=\"hljs-keyword\">END<\/span> <span class=\"hljs-keyword\">LOOP<\/span>;\n    \n    <span class=\"hljs-keyword\">EXCEPTION<\/span>\n        <span class=\"hljs-keyword\">WHEN<\/span> OTHERS <span class=\"hljs-keyword\">THEN<\/span>\n            dbms_output.put_line(<span class=\"hljs-string\">'Error code:'<\/span> || SQLCODE);\n            dbms_output.put_line(<span class=\"hljs-string\">'Error message:'<\/span> || <span class=\"hljs-built_in\">sqlerrm<\/span>);\n            <span class=\"hljs-keyword\">RAISE<\/span>;\n            \n<span class=\"hljs-keyword\">END<\/span>;\n\/\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>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Increase credit for customer Supervalu by 5%\nIncrease credit for customer NextEra Energy by 5%\nIncrease credit for customer Raytheon by 2%\nIncrease credit for customer Plains GP Holdings by 2%\n...<\/code><\/span><\/pre>\n\n\n<p>How it works:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, declare an updatable cursor that updates credits of the customers whose credits are greater than zero.<\/li>\n\n\n\n<li>Next, loop over the rows in the cursors.<\/li>\n\n\n\n<li>Then, get the number of orders for each customer.<\/li>\n\n\n\n<li>After that, assign the credit increment based on the order count.<\/li>\n\n\n\n<li>Finally, update the credit of the customer.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the Oracle updatable cursor to update data in a table.<\/li>\n<\/ul>\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=\"2865\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/\"\n\t\t\t\tdata-post-title=\"Oracle CURSOR FOR UPDATE\"\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=\"2865\"\n\t\t\t\tdata-post-url=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/\"\n\t\t\t\tdata-post-title=\"Oracle CURSOR FOR UPDATE\"\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>In this tutorial, you will learn how to use Oracle CURSOR FOR UPDATE to update data in a table.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1418,"menu_order":25,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2865","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>Oracle Cursor FOR UPDATE<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use the Oracle FOR UPDATE cursor to update data in a table.\" \/>\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\/oracle-cursor-for-update\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle Cursor FOR UPDATE\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use the Oracle FOR UPDATE cursor to update data in a table.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/\" \/>\n<meta property=\"og:site_name\" content=\"Oracle Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-25T10:47:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png\" \/>\n\t<meta property=\"og:image:width\" content=\"354\" \/>\n\t<meta property=\"og:image:height\" content=\"145\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\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=\"2 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\\\/oracle-cursor-for-update\\\/\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/\",\"name\":\"Oracle Cursor FOR UPDATE\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/customers_orders_tables.png\",\"datePublished\":\"2019-08-09T10:54:51+00:00\",\"dateModified\":\"2025-05-25T10:47:12+00:00\",\"description\":\"In this tutorial, you will learn how to use the Oracle FOR UPDATE cursor to update data in a table.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/customers_orders_tables.png\",\"contentUrl\":\"https:\\\/\\\/www.oracletutorial.com\\\/wp-content\\\/uploads\\\/2017\\\/08\\\/customers_orders_tables.png\",\"width\":354,\"height\":145,\"caption\":\"Customers and Orders tables\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oracletutorial.com\\\/plsql-tutorial\\\/oracle-cursor-for-update\\\/#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\":\"Oracle CURSOR FOR UPDATE\"}]},{\"@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":"Oracle Cursor FOR UPDATE","description":"In this tutorial, you will learn how to use the Oracle FOR UPDATE cursor to update data in a table.","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\/oracle-cursor-for-update\/","og_locale":"en_US","og_type":"article","og_title":"Oracle Cursor FOR UPDATE","og_description":"In this tutorial, you will learn how to use the Oracle FOR UPDATE cursor to update data in a table.","og_url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/","og_site_name":"Oracle Tutorial","article_modified_time":"2025-05-25T10:47:12+00:00","og_image":[{"width":354,"height":145,"url":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/","url":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/","name":"Oracle Cursor FOR UPDATE","isPartOf":{"@id":"https:\/\/www.oracletutorial.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/#primaryimage"},"image":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/#primaryimage"},"thumbnailUrl":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png","datePublished":"2019-08-09T10:54:51+00:00","dateModified":"2025-05-25T10:47:12+00:00","description":"In this tutorial, you will learn how to use the Oracle FOR UPDATE cursor to update data in a table.","breadcrumb":{"@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/#primaryimage","url":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png","contentUrl":"https:\/\/www.oracletutorial.com\/wp-content\/uploads\/2017\/08\/customers_orders_tables.png","width":354,"height":145,"caption":"Customers and Orders tables"},{"@type":"BreadcrumbList","@id":"https:\/\/www.oracletutorial.com\/plsql-tutorial\/oracle-cursor-for-update\/#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":"Oracle CURSOR FOR UPDATE"}]},{"@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\/2865","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=2865"}],"version-history":[{"count":0,"href":"https:\/\/www.oracletutorial.com\/wp-json\/wp\/v2\/pages\/2865\/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=2865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}