Re: Q: sys_context() vs. regular function call

From: joel garry <>
Date: Mon, 18 May 2009 09:56:39 -0700 (PDT)
Message-ID: <>

On May 15, 10:22 am, (Malcolm Dew-Jones) wrote:
> Hello
> Are there any differences between using sys_context in an SQL statement
> and using a regular function?  I'm not concerned here with the security
> around setting the values, just the speed of accessing the value in an SQL
> statement, and in particular whether Oracle has any special ability to
> optimize calls to SYS_CONTEXT that it doesn't have with a user defined
> function.
> A did a couple of explain plans on some queries using a packaged function
> and SYS_CONTEXT, and they both show up as basically the same plan (the
> sys_context needed a to_number).
>         select * from my_table
>         where org_id = my_pkg.fn_wanted_org_id;
>         select * from my_table
>         where org_id = SYS_CONTEXT('APP_CTX','RPT_CENTRE_ID');
> but maybe there are situations where it would make a speed difference that
> I haven't considered.
> Thanks for feedback.

I dunno, if the plan the way you are using it is the same, it should be the same, but consider when you will be using it could make a differrence. I'm wondering where type of situations (extending your question to that sort of situation) might make a difference, such as not being able to use an FBI or some such thing. Some peoplesoft sites apparently have had issues that desc indices are actually FBI's. Hopefully that's far enough away from what you intend to not matter.


-- is bogus.
Shackles are not restraints.
Received on Mon May 18 2009 - 11:56:39 CDT

Original text of this message