Resolving variable as a column name...

From: Kurt Lee Harless <kurt.harless_at_allied.com>
Date: 1996/11/18
Message-ID: <3290ABDF.2687_at_allied.com>#1/1


Help!

Have created a stored procedure that is fired by a before insert trigger and is passed the tablename from which fired it. This procedure then does a look up of the columns that are in that table and stores them in an array.

I would like to then reference the :new.colname values by dynamically resolving the reference as; :new.column_array(index), where column_array(index) contains a string that equals a column name in the table.

EXAMPLE: TABLEA

COL1	COL2	COL3
----	----	----
A111	A222	A333
b111	b222	b333

.
.
.

Before insert trigger would contain:

:NEW.COL1 = A111, :NEW.COL2 = A222, :NEW.COL3 = A333 ETC... I have assigned the following;

column_array(1) := 'COL1';
column_array(2) := 'COL2';
column_array(3) := 'COL3';

I then want to reference it as :NEW.column_array(1), etc...

Is this possible???

Any and all help appreciated...

Kurt Harless
AlliedSignal - Engine's DBA Group
KURT.HARLESS_at_ALLIEDSIGNAL.COM Received on Mon Nov 18 1996 - 00:00:00 CET

Original text of this message