database function Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: database function

  1. #1
    Join Date
    Jun 2008

    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);
    l_pa := ina_pkg.get_pa(p_aid);

    select l_pa.awardnbr into b from dual;

    return b;


  2. #2
    Join Date
    Mar 2007
    Ft. Lauderdale, FL
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width