{"id":1345,"date":"2012-03-09T04:41:23","date_gmt":"2012-03-09T09:41:23","guid":{"rendered":"http:\/\/www.dpriver.com\/blog\/?page_id=1345"},"modified":"2012-03-09T04:41:23","modified_gmt":"2012-03-09T09:41:23","slug":"get-all-the-variables-in-an-oracle-package-procedure-or-function","status":"publish","type":"page","link":"https:\/\/www.dpriver.com\/blog\/list-of-demos-illustrate-how-to-use-general-sql-parser\/get-all-the-variables-in-an-oracle-package-procedure-or-function\/","title":{"rendered":"Get all the variables in an Oracle Package, Procedure or Function"},"content":{"rendered":"

This demo illustrates how to use general sql parser<\/a> to get all the variables in an Oracle Package, Procedure or Function that are in scope based on a line number. <\/p>\n

For example, if we specify a line number that is within a specific procedure in a package, this demo will let you know which variables are defined for that procedure, not any others. The same for stand alone procedures and functions that are not part of a package.<\/p>\n

Let’s take this SQL for example:<\/p>\n

    \r\n01  create or replace\r\n02  package body pkg_dbgd as\r\n03    function tst_1(i in integer) return integer is\r\n04    begin\r\n05      if i between 5 and 10 then\r\n06        return 2*i;\r\n07      end if;\r\n08  \r\n09      if i between 0 and 4 then\r\n10        return tst_2(3+i);\r\n11      end if;\r\n12  \r\n13      if i between 11 and 15 then\r\n14        return tst_2(i-2);\r\n15      end if;\r\n16  \r\n17      return i;\r\n18    end tst_1;\r\n19  \r\n20    function tst_2(var1 in integer) return integer as\r\n21  \tmyreturn integer;\r\n22    begin\r\n23  \t  myreturn := var1-1;\r\n24    \r\n25      if var1 between 6 and 8 then\r\n26        myreturn := fn_add_numbers(var1,10);\r\n27      end if;\r\n28  \r\n29      if var1 between 1 and 5 then\r\n30        myreturn := fn_add_numbers(var1,5);\r\n31      end if;\r\n32  \t\r\n33      return myreturn;\r\n34    end tst_2;\r\n35  end pkg_dbgd\r\n<\/pre>\nLets say which variables would be available in scope at line 25,
    \nthis demo will show you  myreturn (Integer) and var1 (integer).
    \nthat would be all the variables for the function tst_2. <\/p>\nDownload this demo: C# version<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"This demo illustrates how to use general sql parser to get all the variables in an Oracle Package, Procedure or Function that are in scope based on a line number. For example, if we specify a line number that is within a specific procedure in a package, this demo will let you know which variables are defined for that procedure, not any others. The same for stand alone procedures and functions that are not part of a package. Let’s take this SQL for example: 01 create or replace 02 package body pkg_dbgd as 03 function tst_1(i in integer) return integer\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":235,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"gsp_feature_page_tt.php","meta":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nHelp you to make better use of General SQL Parser<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\t\n