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

Home -> Community -> Usenet -> c.d.o.server -> Re: UPDATE the column (Parametrization)

Re: UPDATE the column (Parametrization)

From: David <dt_146_at_yahoo.co.in>
Date: 5 Feb 2004 00:12:24 -0800
Message-ID: <d5840ebd.0402050012.6c03fb99@posting.google.com>


Dear NOEL

Thanks for your info.
I would like to say that I still run the script seven times if there are 7 datafiles .I want to run the script at a single time in order to update the 7 datafiles in the target_parameter column.

Please keep in touch .

Thanks

david

"Noel" <tbal_at_go2.pl> wrote in message news:<bvq8m4$p30$1_at_inews.gazeta.pl>...
> > SQL> Create table Parameters(Parameter_ID number,Description
> > varchar2(50), Source_Parameter varchar2(400),Target_Parameter
> > varchar2(400));
> >
> > Insert Statement:
> >
> > SQL> 'insert into parameters(Parameter_ID,Description,Source_Parameter,
> > Target_Parameter)
> > select 19,''DataFile Paths'',file_name,null from dba_data_
> >
> > Update Code:
> >
> > accept trg_prm1 prompt 'Enter the name of DataFile of the Source
> > Parameter Column: '
> > accept trg_prm2 prompt 'Enter the name of DataFile for the Target
> > Parameter Column: '
> > declare
> > b varchar2(20);
> > begin
> > select count(*) into b from parameters where description='DataFile Paths';
> > For i in 1..b
> > loop
> > update parameters set TARGET_PARAMETER = '&&trg_prm2'
> > where Source_Parameter = '&&trg_prm1';
> > end loop;
> > end;
> > /
> > The above code works, but I run it every time in order to update the
> > target_parameter column with datafiles.
> > Is there a way or what changes I should do in the update code that at
> > a single time I updated all the datafiles in the
> > target_parameter&#8221>
> > Any suggestion will be appreciated.
>
>
>
> Yikes! What a weird code!
>
> Why not simple
> UPDATE parameters
> SET target_parameter = '&&trg_prm2'
> WHERE Source_Parameter = '&&trg_prm1'
> AND description='DataFile Paths';
>
> You used syntax that shouldn't work.
> You declared a variable as varchar2 and put into it count(*) result.
> Then used it in loop.
> It shouldn't work.
Received on Thu Feb 05 2004 - 02:12:24 CST

Original text of this message

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