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 -> Can I compare records in PLSQL?

Can I compare records in PLSQL?

From: Neil W. Garside <nwgarside_at_my-deja.com>
Date: Thu, 16 Sep 1999 05:26:32 GMT
Message-ID: <7rpv20$mcv$1@nnrp1.deja.com>


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 - 00:26:32 CDT

Original text of this message

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