-
database function
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 procurementaction%ROWTYPE;
b VARCHAR2(500);
begin
l_pa := ina_pkg.get_pa(p_aid);
select l_pa.awardnbr into b from dual;
return b;
end;
Thanks
-
Research Dynamic SQL and execute immediate statement.