Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Single value comparison in PL/SQL question

Re: Single value comparison in PL/SQL question

From: <marcpark_at_my-deja.com>
Date: 2000/05/03
Message-ID: <8epc2k$h4$1@nnrp1.deja.com>#1/1

Yes, you can do this in PL/SQL, but it would be easier in SQL*PLUS You need 3 simple scripts
Select PK from T1
where T1.PK = T2.PK
and T1.Non_PK != T2.Non_PK

Select T1.PK
from T1, T2
where T1.PK = T2.PK (+)
and T2.PK is null;

And
Select T2.PK
from T1, T2
where T2.PK = T1.PK (+)
and T1.PK is null;

If you have to do it in PL/SQL
create cursors for t1 and t2, with an
order by clause.

Open both cursors
Loop
  Fetch each cusfor into a varaible
  Complare each field in the variable
  do your logic.
End Loop when no more data
Close the cursors.

Marc Parkinson
Oracle Developer

In article <390f4d23$0$6549_at_fountain.mindlink.net>,   "Gennady" <gennadyb_at_halcosoftware.com> wrote:
> Hello,
> In my Oracle 8.0.5 database I have 2 tables (T1 and T2)
> which have same structure. I need to create PL/SQL procedure
> using cursors on T1 and T2 to make a single data value comparison.
> In Visual Basic it looks like this:
> FOR k=0 TO ColumnCount - 1
> IF OraDynaSet1.Fields(k).Value <> OraDynaSet2.Fields(k).Value
 THEN
> vSameValue = FALSE
> /* ...Do something */
> ELSE
> vSameValue = TRUE
> /* ...Do something */
> END IF
> NEXT k
> Is it possible in PL/SQL and how?
>
> Thanks,
> Gennady
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed May 03 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US