You want something like this. Although, you should add some error handling, like what do you return when you do not get any rows, or when you get more than one row. And I do not know your table name or column names. Try readiing PL/SQL Best Practices by Steven Feuerstein.
Code:CREATE FUNCTION get_CardNumber ( p_appid IN cardtable.appid%TYPE ) RETURN cardtable.cardnumber%TYPE AS v_return cardtable.cardnumber%TYPE; BEGIN SELECT cardnumber INTO v_return FROM cardtable WHERE appid = p_appid; RETURN v_return; END get_CardNumber; /




Reply With Quote