Gnarley Query - can this be done in oracle ?

From: Christopher Drake; NetSafe <netsafe_at_pobox.com>
Date: 1996/08/16
Message-ID: <3213393D.65D_at_pobox.com>#1/1


Best explained by example:-

I have a table:

			fred	wilma	 barney
			  1      red      true
			  7      blue	  false
			 16      green	  true

and another:

			colname	colval	updname	updval
			  fred    7     barney  true
			  wilma  red    fred     3

Can one write an update to search the first table, in row [colname] (eg1: fred) and then update field [updname] (eg1: barney --> true) ?

If the two updates are applied as per my second table, the result should be:-

			fred	wilma	 barney
			  3      red      true
			  7      blue	  TRUE
			 16      green	  true

(I'd prefer not to write a huge block of 'IF's of course - I'm dealing with 200 columns which come and go, so to speak. (project still under dvt)).

Chris Drake. Received on Fri Aug 16 1996 - 00:00:00 CEST

Original text of this message