Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Writing a general update procedure..
tjmxyz_at_my-deja.com wrote:
>
> Hi...
>
> I want to write a general Update Procedure.
>
> What I do now is for each table I have a function like.
>
> CREATE TABLE t1
> (
> col1 Number(2),
> col2 varchar2(20)
> );
>
> CREATE OR REPLACE PROCEDURE t1_update
> (incol1 number,
> incol2 char
> ) IS
>
> BEGIN
> update t1 set col1=incol1 and col2=incol2;
> END;
>
> More or less this is the idea.
> But what if I change the name of col1 to something else...
>
> I do this because there is some more processing for some records to
> other tables and such...
>
> But My problem is some tables have many columns and in this stage
> columns are changing frequently...
>
> How can I build a generalized function where
> the columns are generated at call time.
>
> Is there any other ideas for an update procedure???
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
You could use the catalog and dbms_sql (or execute_immediate in 8i) to build what you want...but given that (classically) a column represents an indivisible unit of information - I can understand why you would be adding and maybe even removing columns...but why rename them ??? --
"Some days you're the pigeon, and some days you're the statue." Received on Mon Aug 23 1999 - 08:47:21 CDT