请给个简单的例子,谢谢

解决方案 »

  1.   

    我之前做过中国联通的项目就用到过,例子也很简单:就是在select 前面添加with子句。
      

  2.   

    create or replace procedure test_pro is
    datetime date;
    begin
      with a as(
      select sysdate adate from dual
      )
      select adate into datetime from a;
      dbms_output.put_line(datetime);
    end test_pro;
      

  3.   

    WITH?很少用这个吧,
    一般都使用临时表
      

  4.   

    with 就是sql中的语法 能写sql的地方就能用
      

  5.   


    可以的 楼主试下便知
    SQL> create or replace procedure p1
      2  as
      3  p_no varchar2(100);
      4  begin
      5  with tb as
      6  (select 1 no,'wkc' name from dual union all
      7  select 2,'wkc168' from dual)
      8  select name into p_no from tb where no=2;
      9  dbms_output.put_line(p_no);
     10  end;
     11  /过程已创建。SQL> exec p1
    wkc168PL/SQL 过程已成功完成。
      

  6.   

    with語句是臨時表的一種用法。