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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Generalized UPDATE procedure

Re: Generalized UPDATE procedure

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 06 Aug 1999 17:24:09 +0800
Message-ID: <37AAA9B9.42AA@yahoo.com>


tomkenn_at_my-deja.com wrote:
>
> I'd like to use a generalized UPDATE procedure such as this:
>
> procedure genUpd( key varchar2, aCol varchar2, bCol varchar2) is
> rec rowtype%myTable
> begin
> select * into rec where keyCol = key for update;
> -- update column a if value supplied
> if aCol is not null then rec.a = aCol;
> -- update column b if value supplied
> if bCol is not null then rec.b = bCol;
> update myTable set (a,b) = (rec.a, rec.b);
> end;
>
> What are the pros and cons of this method?
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Look at DBMS_SQL in v7, v8 or "execute_immediate" from 8i.

It will run a little slower than if you did the updates explictly...

--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Fri Aug 06 1999 - 04:24:09 CDT

Original text of this message

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