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 >> How to get rows that r not common in two tables

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: How to get rows that r not common in two tables
 Irfan  Posted: Apr 02, 2008 02:10:54 AM

 Total Post: 29
 Joined: Nov, 2005






 hi ,
I have two tables report and report_old having same table structure.Data in both is different.Some rows are common in both while others are different.
MSISDN NUMBER,
EXPIRY_DATE DATE,
VAL_BKT VARCHAR2(4000),
ACCT_BALANCE NUMBER,
BAL_BKT VARCHAR2(4000)
I want to get to get all the msisdn in report table that are not in the report_old table.I use below query for that but its taking long time execute.
create table report_ins
as
(select *From report
where msisdn not in (select msisdn from report_old));
Both the table contain more than 360000 rows of data .
Plz help.

 Murtuja
Posted: Apr 02, 2008 03:40:45 AM  

 Total Post: 857
 Joined: Jan, 2006






 
Hi Irfan,

Try this query

select * from report r1 where not exists (select r2.msisdn from report_old r2 where r1.msisdn=r2.msisdn)

and tell me whether it makes any difference in execution time.

 Irfan
Posted: Apr 02, 2008 04:00:23 AM  

 Total Post: 29
 Joined: Nov, 2005






 
hi Murtuja,
Thanks execution time has greatly reduced..

 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
  Gopu Gopi334
  Gitesh Trivedi322
  Vinoth Kumar264
  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