I have a function as below, which is working fine.
this function excutes a package to get all the column values for a given aid from procurementaction table and is stored in a variable l_pa
i select one of the column like awardnbr and display the value of it
my requirenment is in "l_pa.awardnbr", i want function to take the column name from the input parameter, instead of hardcoding the column name
meaning it should say something like "select l_pa.p_col_name from dual"
how do i do this
create or replace function get_value(p_aid in number, p_col_name in varchar2) return varchar2 is
l_pa := ina_pkg.get_pa(p_aid);
select l_pa.awardnbr into b from dual;
Research Dynamic SQL and execute immediate statement.
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Click Here to Expand Forum to Full Width