tag:blogger.com,1999:blog-7849367040589270673.post7845138640541723949..comments2024-03-21T22:50:39.997-07:00Comments on Obsessed with Oracle PL/SQL: Referencing package-level variables inside the package bodySteven Feuersteinhttp://www.blogger.com/profile/18405765731886460622noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7849367040589270673.post-35754022095528228902017-10-08T04:30:24.326-07:002017-10-08T04:30:24.326-07:00I got that, David. Perhaps it was I who was not as...I got that, David. Perhaps it was I who was not as clear as could be.<br /><br />I mean that, for example, implicit cursors (SELECT-INTO) are generally faster than explicit OPEN-FETCH-CLOSE. So to pick an explicit cursor when you could fully qualify variables and have no concerns whatsoever about inappropriate name capture in the future doesn't seem to me to be a good choice.Steven Feuersteinhttps://www.blogger.com/profile/18405765731886460622noreply@blogger.comtag:blogger.com,1999:blog-7849367040589270673.post-47821631736873775972017-10-07T22:53:39.672-07:002017-10-07T22:53:39.672-07:00perhaps i phrased that badly..
I meant that if i ...perhaps i phrased that badly..<br /><br />I meant that if i end up with a query the needs to reference a variable, i will try to write it as an explicit cursor with parameters rather then reference the variable directly.<br /><br />Davidhttps://www.blogger.com/profile/03731906307931760453noreply@blogger.comtag:blogger.com,1999:blog-7849367040589270673.post-31854019996177337962017-10-06T04:21:17.300-07:002017-10-06T04:21:17.300-07:00David, I don't think it is a good idea to choo...David, I don't think it is a good idea to choose the type of SQL access you are writing in your code to avoid un-intended name capture.<br /><br />Instead, as I show above, you qualify *all* references inside the SQL statement - via table aliases and PL/SQL program / block name, and then you are 100% protected.Steven Feuersteinhttps://www.blogger.com/profile/18405765731886460622noreply@blogger.comtag:blogger.com,1999:blog-7849367040589270673.post-84835565493307487462017-10-05T23:23:34.360-07:002017-10-05T23:23:34.360-07:00I dislike using variables/parameters directly in D...I dislike using variables/parameters directly in DML statements like this for the similar reason of that _I_ dont necessarily know if "n_in" refers to a column or a variable. I had never considered what would happen if you added a new column to a table with that name..<br /><br />Instead, if possible I try to use an explicit cursor with cursor parameters.<br />Davidhttps://www.blogger.com/profile/03731906307931760453noreply@blogger.com