Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Oracle Certified Professional Exams (OCP & OCA) >> Is the following true or false?

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Is the following true or false?
 gill123  Posted: Jun 20, 2007 07:31:19 PM

 Total Post: 12
 Joined: Jun, 2007






 
Plz let me know whether the following statement is true or false:

"A single row subquery cannot be used in a condition where the LIKE operator is used for comparison."

Thanks.


 chinna
Posted: Jun 21, 2007 02:26:40 AM  

 Total Post: 28
 Joined: May, 2007






 
hi,
a single row subquery can be used in where clause.
example dept table has one corresnding row with deptno as 10 and dname as accounting.deptno is pk in table dept and foreign key in emp.
so the query as follows.
select * from emp where deptno=(select deptno from dept where dname='ACCOUNTING');
THE SUBQUERY RETURNS A SINGLW ROW CORRESPONDING ROWS FROM EMP TABLE ARE DISPLAYED.

BYE
SRAWAN



 gill123
Posted: Jun 21, 2007 03:36:26 AM  

 Total Post: 12
 Joined: Jun, 2007






 
Yes but can you use a LIKE operator when you are using a single or multiple row subquery as a condition ??

 gps
Posted: Jun 21, 2007 04:38:32 AM  

 Total Post: 38
 Joined: May, 2006






 
Yes, you can use single row subquery with LIKE operator as follows:


select * from emp where deptno like (select deptno from dept where loc='NEW YORK')


select * from emp where deptno like '%'||(select deptno from dept where loc='NEW YORK')||'%'


Gurwinder

 gps
Posted: Jun 21, 2007 04:40:36 AM  

 Total Post: 38
 Joined: May, 2006






 
You can not do like this if your inner query is returuing multi-rows.

Gurwinder

 KS
Posted: Jun 21, 2007 04:53:46 AM  

 Total Post: 63
 Joined: Nov, 2006






 
Its False,

Look at the following query :


SQL> select count(1)
from emp
where JOB like '%'||(select distinct Job
from emp
where job='SALESMAN')||'%';

COUNT(1)
----------
4

This works fine.


-sri

 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar816
  Mohammed Taj746
  Jayanta Sur479
  positive fanatic418
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi250
  Ramesh Jois245
  neeraj sharma243
  Bishal Khetan207






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software