Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: is this a good practice...pl/sql question
> Keeping aside all considerations about the loop, I see no problem
>here. The cursor variable is just short-hand notation for defining a
>table%ROWTYPE - you are not modifying some hidden Oracle internal state
>if this is what you are fearing. No 'mutating cursor', if I guess you
>correctly.
I guess I am really wondering if it is a good practice to modify the attributes of a record previously selected via a cursor. It is not just a typical variable that is defined and used in a manner that suits the algorithm. I am just wondering if it would be a better idea to treat this type of a record as a constant. To elevate it conceptually. The reason being that it does(should?)represent what was actually selected from the database. If another developer, or myself for that matter, were to come along at a later date, and use that attribute in another section of code not knowing, or forgetting, it had been altered above. I have actually used this technique extensively in a couple of routines more complex than the one I have described above. It was just as I made this little code change, I felt a pang of conscience, and wanted to ask this philosophical question.
I am not worried about mucking up the database, or any such thing. I am aware that variable is just like any other attribute in any record I might have explicitly created myself. It is just that since the database instantiated this record to represent the results of my query, I am wondering if it should grant it an elevated postition.
Sorry for rambling on and on etc.
Steve
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Steve McClure INET: smcclure_at_usscript.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Sep 17 2003 - 16:44:40 CDT