Solved

query

Posted on 2014-04-11
6
237 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 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 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create file system directory from Oracle 10g 4 46
subtr returning incorrect value 8 93
Oracle Errors 11 86
Oracle Query to Find number of process consumed by a session 15 68
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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…
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…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

737 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