Re: Puzzled: CURSOR in Package

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 20 Nov 2001 14:46:43 +0000
Message-ID: <3BFA6CD3.1495_at_yahoo.com>


jane wrote:
>
> Thanks, but is this really a strong reason for declaring only cursor header
> in pkg spec ?
> I mean first wrapping in-house source is rather rare in the corporate world,
> is'nt it ?
> second, what's the justification for hiding the SQL from the developers ?
> That's not likely to make them more productive or accurate, is it?
>
> Jane
>
> > You may want it that way for security reasons - in a similar way to the
> > Oracle supplied packages - the spec is typically readable from
> > DBA_SOURCE but the body is wrapped. Thus, you could publicize the
> > existence of a cursor to be shared, but not reveal its definition.
> >
> > hth
> > connor

[Quoted] Its not about "hiding", its about modularity. You're publicising an object (a cursor in this case), and (hopefully) you're publishing this as an unchanging, guaranteed to be there definition. You're advertising the fact that to (say) "get a list of employees", this is the cursor to be used.

You're protecting anyone that uses that cursor from the definition - it may be a query from EMP, it might be a join, it might (in 9i) be a PL/SQL routine that sends it results back via a pipelined clause...All of which you can add/change/implement/etc without a single line of code *outside* the package being needed.

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Tue Nov 20 2001 - 15:46:43 CET

Original text of this message