create or replace function get_Sub_Item_data(vfieldname in varchar2, vtablename in varchar2, vjcdatetime in varchar2) return number is item_cjvalue number(10, 5); v_sql varchar2(200); begin v_sql := 'select ' || vfieldname || ' from ' || vtablename || ' where to_char(jcrq,''yyyy-mm-dd'')=''' || vjcdatetime || ''' and rownum=1'; execute immediate v_sql into item_cjvalue ; return item_cjvalue ;