Question

Asked on 2009-09-17 at 08:40:15ID: 25463789

Oracle Table Comparison

by: victory_in500

Rating8.8Very Good

Hi Experts,
This is very urgent!!!
 I need to write a PL/SQL procedure to compare the data between the two tables. If I found the record mismatch then I need to write to the other table  saying that "provider_id mismatch, that way I need to compare  4 (svc_prvd_nbr, cldr_bill_amt, cldr_schd_amt) columns. and also I need to compare the record count between the two tables as well. Please help!!!

--Victor

DECALRE 
  CURSOR cur01 IS 
    SELECT clm_nbr, svc_prvd_nbr, cldr_bill_amt, cldr_schd_amt, clmd_svc_beg,
       clmd_svc_end, xxpos_cd, indv_hrn, bl_cpt_proc, xxbil_typ_cd
  FROM qcare_report a;
 
  CURSOR cur02 (pk hsd_profsvc_claim_header.claim_number%TYPE) IS 
(SELECT a.claim_number,
       d.provider_id,
       b.billed_amt,
       b.allowed_amt,
       b.detail_svc_date,
       b.svc_to_date,
       b.place_of_service,       
       c.diamond_id member_id,
       b.procedure_code
FROM   hsd_profsvc_claim_header a, hsd_profsvc_claim_detail b, 
       hsd_member_master c, hsd_prov_master d
WHERE a.seq_claim_id = b.seq_claim_id
  AND a.seq_memb_id = c.seq_memb_id
  AND a.seq_prov_id = d.seq_prov_id
  AND a.claim_number = pk) TEMP;
 
  rec02 temp%ROWTYPE;
 
BEIGN
  FOR rec01 IN cur01 LOOP
    OPEN cur02(rec01.clm_nbr);
    FETCH cur02 INTO rec02;
     IF NOT ((rec01.clm_nbr=rec02.claim_number) or (rec01.svc_prvd_nbr=rec02.prcvider_id)) THEN
      --insert into mismatch ...
      INSERT INTO 
     END IF;
  END LOOP;
  EXCEPTION WHEN NO_DATA_FOUND THEN
   NULL;
END;
                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:

Select allOpen in new window

Related Solutions

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
Participating Experts
1
Solution Grade
A

Replies

 by:

Posted on 2009-09-17 at 09:12:44ID: 28258466

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: victory_in

Posted on 2009-09-17 at 09:18:03ID: 28258467

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: victory_in

Posted on 2009-09-17 at 09:30:18ID: 28258468

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: markgeer

Posted on 2009-09-17 at 09:30:35ID: 28258469

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: victory_in

Posted on 2009-09-17 at 09:39:58ID: 28258470

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: markgeer

Posted on 2009-09-17 at 10:12:40ID: 28258471

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: victory_in

Posted on 2009-09-17 at 10:27:27ID: 28258472

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert