Solved

query

Posted on 2014-04-11
6
232 Views
Last Modified: 2014-06-10
How can I create a query..
The output of select * from dba_users should not have the given list of users sch1,sch2,sch3

ie, if the database has sch1,sch2,sch3 list out.. that
0
Comment
Question by:tonydba
6 Comments
 
LVL 48

Assisted Solution

by:PortletPaul
PortletPaul earned 250 total points
ID: 39995391
I really don't understand your question.

do you want ONLY sch1,sch2,sch3

select * from dba_users where username in ('sch1','sch2','sch3')


or do you want everything EXCEPT sch1,sch2,sch3

select * from dba_users where username NOT in ('sch1','sch2','sch3')
0
 
LVL 15

Expert Comment

by:Devinder Singh Virdi
ID: 39995404
If you have list of owner in separate table, then you can also use

select * from dba_users where username IN (select username from another_table);

You can use NOT IN as well as required.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39995490
One minor correction to the first post.  Oracle translates object names to upper case unless you force them to case sensitive, NOT recommended, by using double quotes.

Change:
select * from dba_users where username NOT in ('sch1','sch2','sch3');

to:
select * from dba_users where username NOT in ('SCH1','SSH2','SCH3');
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 39995995
What is your expected output?
0
 
LVL 22

Expert Comment

by:Steve Wales
ID: 40124047
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

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…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now