本帖最后由 new123456789 于 2010-04-29 12:46:20 编辑

解决方案 »

  1.   

    完全可以,
    SQL> select ename from emp;ENAME
    ----------
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER已选择14行。SQL> select substr(ename,1,2) from emp;SUBS
    ----
    SM
    AL
    WA
    JO
    MA
    BL
    CL
    SC
    KI
    TU
    AD
    JA
    FO
    MI已选择14行。SQL> 
      

  2.   

    最简单的例子
    select lower(dummy) from dual;
    lower是函数,dummy是dual表的字段
      

  3.   

    declare
      time_before number;
      time_after number;
      pv varchar2(20);
      ret varchar2(20);
      pv_1 pp.id%type;
    begin
    select id into pv_1 from pp;
     time_before := DBMS_UTILITY.GET_TIME;
       
      ret := func1(pv_1,pv);
      time_after := DBMS_UTILITY.GET_TIME;
      dbms_output.put_line(time_after - time_before);
      dbms_output.put_line(pv);
      dbms_output.put_line(ret);
    end;我想用pp表里的id字段值给变量pv_1赋值, 函数func1结构是func1(in,out)
      

  4.   

    好多条
    你的意思是缺少一个where条件是吗
    不过where条件怎么写呀  我只想把pp表里的id这一列值赋值给这个变量   
      

  5.   

    declare
      time_before number;
      time_after number;
      pv varchar2(20);
      ret varchar2(20);
      pv_1 pp.id%type;
    begin
    for cur in (select id from pp)loop 
     pv_1:=cur.id;
     time_before := DBMS_UTILITY.GET_TIME;
        
      ret := func1(pv_1,pv);
      time_after := DBMS_UTILITY.GET_TIME;
      dbms_output.put_line(to_char(time_after - time_before)||'  '||pv||'  '||ret);
    end loop;
    end;
      

  6.   

    declare
      time_before number;
      time_after number;
      pv number;
      ret varchar2(20);
      pv_1 pp.id%type;
      pv_2 pp.name%type;
      pv_3 pp.type%type;
      
    cursor cu is select * from pp;
    begin
    open cu;
    loop
    fetch cu into pv_1,pv_2,pv_3;
    exit when cu%notfound;
    time_before := DBMS_UTILITY.GET_TIME;
    ret := func1(pv_1,pv_2,pv_3,pv);
    time_after := DBMS_UTILITY.GET_TIME;
    dbms_output.put_line(time_after - time_before);
    dbms_output.put_line(pv);
    dbms_output.put_line(ret);
    end loop;
    close cu;
    commit;
    end;
    报错了  func1函数结构  funcl(in,in,in,out)