logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: reuse RECORD in function 'select into'?: msg#00259

Subject: Re: reuse RECORD in function 'select into'?
Rory,

> In the function below I do four "select into" actions to check if
> particular values already exist in any one of several tables.
>
> Can I reuse the RECORD for each 'select into'? The RECORDs are
> presumably empty after each select into, as the function needs FOUND to
> be false to continue.

You certainly can, technically.  In fact, you don't even need the RECORD to be 
empty.   

But you want to be *real* careful doing this.  Re-using variables for 
different purposes (in procedural languages), in general, is a very bad idea 
unless you are desperately shourt of memory.   It's far too easy to lose 
track of a re-used variable and waste hours debugging.

O'Reilly's "PL/SQL Programming"  has an excellent chapter on good programming 
practives for SQL-procedural languages that I would love to razor out and 
distribute as a pamphlet.   It would be worth a gander the next time you have 
a long lunch in your local tech book store.

> Also, should I "RETURN 0" after a RAISE EXCEPTION?

Yes, to make the parser happy.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)




Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>