Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with SYS_CONTEXT in WHERE clause in 10g

655592Aug 19 2008 — edited Aug 20 2008
I am running the following SELECT statement in 9i and 10g

SELECT COUNT(*)
FROM mapinfo.mapinfo_mapcatalog
WHERE tablename IN ('ESU_GRAPHICS', 'STREETS', 'ASD_STREETS', 'NSG_ARCHIVE_ESU_GRAPHICS')
AND ownername = sys_context('USERENV','CURRENT_SCHEMA');

When running in 9i it returns 4, the correct answer, but in 10g it always returns 0. I have tried populating a variable with the result from sys_context('USERENV','CURRENT_SCHEMA') such as:

SELECT sys_context('USERENV','CURRENT_SCHEMA')
INTO currentschema
FROM dual;

I have checked the variable and it is giving me the correct result in 10g, but I still get 0 returned from the select statement.

What am I missing to get this working in 10g?

Cheers
Sean
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 17 2008
Added on Aug 19 2008
5 comments
1,288 views