oracle函数怎么调用 有哪些方法?比如这有个函数 但是我不会调用?
 create or replace function fun_test return t_test%rowtype is
  l_test t_test%rowtype;
 cursor c_test is select * from t_test;
  begin
    open c_test;
            fetch c_test into l_test;
   while c_test%found loop
            dbms_output.put_line('name:'||l_test.name||'id:'||l_test.id);
                    fetch c_test into l_test;
        return l_test;
            end loop;
     close c_test;
  end ;

解决方案 »

  1.   

    var t t_test%rowtype;
    begin
     t:=fun_test;
    end;
    print t;
      

  2.   

    函数在一个语句中以表达式方式调用。
    过程是以一个独立语句的形式调用。
    在pl/sql块中调用fun_test如下:
    DECLARE
      t_row t_test%ROWTYPE;
    BEGIN
      t_row := fun_test; --作为赋值语句的右值表达式
      dbms_output.put_line('name:' || t_row.name || 'id:' || t_row.id);
    END;
    /
      

  3.   

    sqlplus中不支持直接声明%rowtype类型