Solved

query

Posted on 2014-04-11
6
238 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
[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
6 Comments
 
LVL 49

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 77

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 38

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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.
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…

688 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