Solved

query

Posted on 2014-04-11
6
235 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, EE MVE
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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
case statement in where clause 5 48
ORA-04071: missing BEFORE, AFTER or INSTEAD OF keyword 2 46
Oracle DB monitor SW 21 49
Oracle - Query link database loop 8 39
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

809 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