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: SQL*Plus and PL/SQL >> Usage of "where exists" clause

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: Usage of "where exists" clause
 Nash  Posted: Aug 30, 2008 11:45:21 PM

 Total Post: 1
 Joined: Aug, 2008






 Consider tables A and B. Both the tables have columns x,y and z. Column x of A is updated with column x of B based on the equality condition, A.y=B.y and A.z= B.z.
May I know the difference between the update statements given below?

i) update B
set x=( Select x
from A
where A.y=B.y
and A.z=B.z)

ii) update B
set x=( Select x
from A
where A.y=B.y
and A.z=B.z)
where exists(Select y,z
from A
where A.y=B.y
and A.z=B.z)

 6s
Posted: Sep 01, 2008 04:34:24 AM  

 Total Post: 1
 Joined: Sep, 2008






 
If the subquery returns at least one row, then only the entire update will work (atleast updation of one row will happen).
So whenever EXISTS is used and your DML task is done, be sure the subquery condition has been met.
You can use NOT EXISTS as well.

 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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar357
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






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