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

Home -> Community -> Usenet -> c.d.o.server -> Re: Can I compare records in PLSQL?

Re: Can I compare records in PLSQL?

From: Jeff Guttadauro <jeff109_at_NOSPAM.netscape.net>
Date: Thu, 16 Sep 1999 16:12:10 GMT
Message-ID: <37e1158b.6997411@news>


Hi, Neil.

        This is just a guess. I don't know if you can compare whole records like this without breaking it down field by field. If you can, then maybe the problem is that the 2 records are defined as different types. Even though curBefore%ROWTYPE and curAfter%ROWTYPE will have the same structure, maybe Oracle just sees that you are comparing 2 objects with different types and does not look further to see that the types are identical.

        Again just an idea... Let us know what you find out.

-Jeff

On Thu, 16 Sep 1999 05:26:32 GMT, Neil W. Garside <nwgarside_at_my-deja.com> wrote:

>Does anyone know how I can compare 2 records in a table? In my Forms
>6.0 application I am calling a external application which may (or may
>not) alter a record's data. I need to be able to compare the record's
>data from before and after the call to the external application. I've
>tried the following PL/SQL:
>
>DECLARE
> CURSOR curBefore IS
> SELECT * FROM MyTable
> WHERE id = 10;
> curBeforeRec curBefore%ROWTYPE;
>
> CURSOR curAfter IS
> SELECT * FROM MyTable
> WHERE id = 10;
> curAfterRec curAfter%ROWTYPE;
>
>BEGIN
> OPEN curBefore;
> FETCH curBefore INTO curBeforeRec;
> CLOSE curBefore;
>
> --Call external application...might amend this record's data!
>
> OPEN curAfter;
> FETCH curAfter INTO curAfterRec;
> CLOSE curAfter;
>
> IF curBeforeRec = curAfterRec THEN
> MESSAGE('They are the same!');
> ELSE
> MESSAGE('They are different!');
> END IF;
>END;
>
>However, this doesn't compile - I get the message "wrong number or
>types of arguments in call to '='"for the "IF curBeforeRec = ..." line.
>
>I could compare the record column by column but the table in question
>has at least 200 columns and is often having columns added or removed
>which would make a column-by-column comparison difficult.
>
>Anyone any ideas?
>
>Neil W. Garside (Brisbane, Australia)
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Thu Sep 16 1999 - 11:12:10 CDT

Original text of this message

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