samedi 9 mai 2020

Accessing record fields by their name

I want to know if there exists something like Reflection API in PLSQL or not.

I have a table like

create table my_table (
  id number,
  value1 number,
  value2 number, 
  value3 number,
  value4 number,
  value5 number);

And I have a variable as

rec as my_table%rowtype

is there any way I can populate rec field dynamically by its name.

I mean I know the index (in this case something between 1 and 5), so I want to set 'value'||index to something.

As in my real case the last index is much more than 5, using a set of if/elsif is not proper.





Aucun commentaire:

Enregistrer un commentaire