Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Generalized UPDATE procedure
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...
--
"Some days you're the pigeon, and some days you're the statue." Received on Fri Aug 06 1999 - 04:24:09 CDT