{"id":161,"date":"2007-08-14T08:58:36","date_gmt":"2007-08-14T07:58:36","guid":{"rendered":"http:\/\/bar-solutions.com\/wordpress\/?p=161"},"modified":"2007-08-14T08:58:36","modified_gmt":"2007-08-14T07:58:36","slug":"open-cursors","status":"publish","type":"post","link":"https:\/\/blog.bar-solutions.com\/?p=161","title":{"rendered":"Open cursors&#8230;"},"content":{"rendered":"<p>Today I came across a very strange problem in the code I am working on. The code raised a correct error, when executed the first time, but ran with no problems the second time. After a lot of debugging (even built a log package, hopefully so generic it will one day make it to my toolbox) I found out that the problem was a cursor that wasn&#8217;t closed properly when the error appeared.<\/p>\n<div class=\"wlWriterSmartContent\" id=\"57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:f31c44ed-e6c3-49cd-b1bc-c381b6fc1374\" contenteditable=\"false\" style=\"padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px\">\n<pre style=\"background-color:White;;overflow: auto;\"><div><!--\n\nCode highlighting produced by Actipro CodeHighlighter (freeware)\nhttp:\/\/www.CodeHighlighter.com\/\n\n--><span style=\"color: #000000; \">      <\/span><span style=\"color: #0000FF; \">IF<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">NOT<\/span><span style=\"color: #000000; \"> ggp_cur%<\/span><span style=\"color: #0000FF; \">ISOPEN<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">THEN<\/span><span style=\"color: #000000; \">\n        <\/span><span style=\"color: #0000FF; \">OPEN<\/span><span style=\"color: #000000; \"> ggp_cur( lv_ggp_opt_seqnr );\n      <\/span><span style=\"color: #0000FF; \">END<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">IF<\/span><span style=\"color: #000000; \">;\n<\/span><\/div><\/pre>\n<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http:\/\/dunnhq.com --><\/div>\n<p>Of course, I know, there should always be an error handling section in every part of the code, but this is some really old and sometimes fuzzy code, that doesn&#8217;t have these sections almost anywhere.<\/p>\n<p>So, the simplest solution was to make sure the cursor was closed before we checked and opened the cursor.<\/p>\n<div class=\"wlWriterSmartContent\" id=\"57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:6c6ddf7c-abf5-45f7-bbeb-98c86d823751\" contenteditable=\"false\" style=\"padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px\">\n<pre style=\"background-color:White;;overflow: auto;\"><div><!--\n\nCode highlighting produced by Actipro CodeHighlighter (freeware)\nhttp:\/\/www.CodeHighlighter.com\/\n\n--><span style=\"color: #000000; \">      <\/span><span style=\"color: #0000FF; \">IF<\/span><span style=\"color: #000000; \"> ggp_cur%<\/span><span style=\"color: #0000FF; \">ISOPEN<\/span><span style=\"color: #000000; \">\n      <\/span><span style=\"color: #0000FF; \">THEN<\/span><span style=\"color: #000000; \">\n        <\/span><span style=\"color: #0000FF; \">CLOSE<\/span><span style=\"color: #000000; \"> ggp_cur;\n      <\/span><span style=\"color: #0000FF; \">END<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">IF<\/span><span style=\"color: #000000; \">; <\/span><span style=\"color: #008000; \">--<\/span><span style=\"color: #008000; \">ggp_cur%ISOPEN<\/span><span style=\"color: #008000; \">\n<\/span><span style=\"color: #000000; \">      \n      <\/span><span style=\"color: #0000FF; \">IF<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">NOT<\/span><span style=\"color: #000000; \"> ggp_cur%<\/span><span style=\"color: #0000FF; \">ISOPEN<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">THEN<\/span><span style=\"color: #000000; \">\n        <\/span><span style=\"color: #0000FF; \">OPEN<\/span><span style=\"color: #000000; \"> ggp_cur( lv_ggp_opt_seqnr );\n      <\/span><span style=\"color: #0000FF; \">END<\/span><span style=\"color: #000000; \"> <\/span><span style=\"color: #0000FF; \">IF<\/span><span style=\"color: #000000; \">;\n<\/span><\/div><\/pre>\n<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http:\/\/dunnhq.com --><\/div>\n<p>This code could be made even simpler by removing the second check, but that&#8217;s something for another day. At this moment the code does what it is supposed to do and I don&#8217;t have the time or get the resources to rebuild this code, although I would like to do that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I came across a very strange problem in the code I am working on. The code raised a correct error, when executed the first time, but ran with no problems the second time. After a lot of debugging (even built a log package, hopefully so generic it will one day make it to my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","hentry","category-oracle","category-plsql"],"_links":{"self":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161"}],"version-history":[{"count":0,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}