Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle: Accessing Record Fields (dynamically)
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 = 80then
if input_rec.airtime_charges = 60 and input_rec.airtime_sur_charges = 70 and input_rec.intl_sur_charges = 80
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
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] = 80then