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: Oracle: Accessing Record Fields (dynamically)

Re: Oracle: Accessing Record Fields (dynamically)

From: datDude <alindie_at_gmail.com>
Date: 26 May 2005 18:04:34 -0700
Message-ID: <1117155874.117388.133150@o13g2000cwo.googlegroups.com>


more info

I have this collection of n records (field names are different per row) row_id: 1
file_id: 1

field_name_1: airtime_charges
field_value_1: 60
field_name_2: airtime_sur_charges
field_value_2: 70
field_name_3: intl_sur_charges
field_value_3: 80

row_id: 2
file_id: 2

field_name_1: local_charges
field_value_1: 100
field_name_2: intl_charges
field_value_2: 20
field_name_3: roaming_charges
field_value_3: 80


CURSOR table_cur IS
SELECT
 airtime_charges
 airtime_sur_charges
 intl_sur_charges
 local_charges
 intl_charges
 roaming_charges
>From table_charges

FOR input_rec IN table_cur
LOOP
  --i need to process only records for which i can find a match on all fields for a collection row

  if     input_rec.airtime_charges = 60
     and input_rec.airtime_sur_charges = 70
     and input_rec.intl_sur_charges = 80
  then
    follow processing code
  end if;
END LOOP; --the if statement is supposed to be dynamic to check the fields according to the field names in the
--collection row it is currently checking against ie the check against row 1 of the collection should be (based on the field names of the collection row)
if     input_rec.airtime_charges = 60
   and input_rec.airtime_sur_charges = 70
   and input_rec.intl_sur_charges = 80

then

    follow processing code
end if;

ie the check against row 2 of the collection should be (based on the field names of the collection row)

if     input_rec.local_charges = 100
   and input_rec.intl_charges = 20
   and input_rec.roaming_charges = 80

then

    follow processing code
end if;

--so in essence, i have my input_rec, but I dont know which fields i should validate against until i get
--them from the collection row
--this scenerio makes me ask the question can i have dynamic column names

if     input_rec.[collection(row_id).field_name_1] = 100
   and input_rec.[collection(row_id).field_name_1] = 20
   and input_rec.[collection(row_id).field_name_1] = 80
then
  follow processing code
end if; Received on Thu May 26 2005 - 20:04:34 CDT

Original text of this message

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