Solved

Select on Oracle view returns no rows

Posted on 2014-02-21
7
1,189 Views
Last Modified: 2014-06-09
Hi Experts,

I currently have an issue where I am trying to pull information from an Oracle DB, and when I run a select statement on a view, it returns no rows.  I know that it should return rows, as I can run the same script in the Application SQL utility and see results.

Is there something I am missing here?  It also returns no rows when logged in as sys.

Thanks!
Cody-
0
Comment
Question by:codyvance1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39877311
The view may be limiting results based on who is executing it.  This is called Label Security (I believe).

Try querying the view when logged into the database as the same use that the application uses.
0
 

Author Comment

by:codyvance1
ID: 39877318
I tried that as well, still shows no rows.
0
 
LVL 23

Expert Comment

by:paquicuba
ID: 39877437
Sounds like somehow your database is restricting access to certain applications. Like slightwv mentioned, a Label Security (add-on that cost money) or perhaps a VPD (Virtual Private Database) which is free with Enterprise Edition.

For example, if you create the following view and query it from SQL Developer, you'll get no rows returned, whereas if you use SQL*Plus it will return 'X'

create view dual2 as select * from dual where sys_context('USERENV', 'MODULE') != 'SQL Developer'
/
select * from dual2
/

What you need to do to test this theory, is go to the application where you see the data and run the following query:

SELECT sys_context('USERENV', 'MODULE') FROM DUAL;

Then set your module and select from the view again to see if it works:

EXEC DBMS_APPLICATION_INFO.SET_MODULE( module_name => '<Result from above query goes here>', action_name => 'Testing');
/
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39877464
>>I tried that as well, still shows no rows.

If you are logged into the database with the same user as the application and it still doesn't work it limits the possibility:

1:  You aren't using the same view the application is using
2:  Different database?
3:  As shown above:  You are limiting the rows based on program calling it, machine it is being called from or something else.

I would check with the developers/DBAs or someone that understands how the database works with the application.
0
 

Accepted Solution

by:
codyvance1 earned 0 total points
ID: 39877486
Alright, so the vendor finally got back to me, and it seems in order to view results you need to initialize a package first, who knew...

Thanks everyone for your input.
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 40121499
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question