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

Home -> Community -> Usenet -> c.d.o.tools -> Re: PLS-00302 error again,sorry

Re: PLS-00302 error again,sorry

From: Gennady <gbesfamilny_at_home.com>
Date: 2000/05/05
Message-ID: <YtEQ4.204137$Dv1.2596690@news1.rdc1.bc.home.com>#1/1

Hi,
the 'field_name' is A VARIABLE and I put in this variable actual OLD and NEW tables (both have SAME structure) column names which I get from SYSTEM VIEW user_tab_columns, using cursor c3 (see the code). So the actual question is: how to make a reference to the component (element) of a composite variable , for example old_row, when a component name (field name)
is a variable?
Thanks,
Gennady

Reidel Jogie wrote in message <3912513E.A9C765E5_at_usa.net>...
>My assumption is that you are trying to compare the definition of two
 tables.
>The syntax variable old_row.field_name and new_row.field_name means that
 you
>are trying to reference a column called field_name on the old and new
 tables.
>Your code is assuming a Unix shell like substituition of field_name during
>runtime.
>
>Gennady wrote:
>
>> Hello,
>> In my PL/SQL code I have a composite variable of ROWTYPE and I try to
 access
>> the variable component using another variable, but I got an error:
>> "PLS-00302: component 'field_name' must be declared".
>> The code is:
>> declare
>> cursor c1 is select * from old;
>> old_row c1%ROWTYPE;
>> cursor c2 is select * from new;
>> new_row c2%ROWTYPE;
>> cursor c3 is select column_name from user_tab_columns where table_name =
>> 'OLD';
>> field_name c3%ROWTYPE;
>> begin
>> dbms_output.enable;
>> open c1;
>> open c2;
>> open c3;
>> loop
>> fetch c1 into old_row;
>> fetch c2 into new_row;
>> exit when (c1%notfound or c2%notfound);
>> end loop;
>> loop
>> fetch c3 into field_name;
>> If (old_row.field_name = new_row.field_name) then --error in this line!
>> dbms_output.put_line('SAME VALUE');
>> else
>> dbms_output.put_line('DIFFERENT VALUE');
>> end if;
>> exit when c3%notfound;
>> end loop;
>> end;
>> How can I fix the problem??
>> Thanks.
>
Received on Fri May 05 2000 - 00:00:00 CDT

Original text of this message

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