如:
 create view aaa
 as 
  select * from area_code where area_code=:vareacode之类的,
如果可以,如何实现?

解决方案 »

  1.   

    sql*plus里面只能这样12:56:21 SQL> create view v1 as select * from tb11 where wzbh=&a;
    输入a的值: '0001'
    原值   1:create view v1 as select * from tb11 where wzbh=&a
    新值   1:create view v1 as select * from tb11 where wzbh='0001'视图已建立。实际:140
    12:56:32 SQL> select * from v1;WZBH       RKBH       RKSL       RKJE
    ---------- ---------- ---------- ----------
    0001       R001       9          54实际:40
    12:56:36 SQL> 要么动态创建
    ...
    t_sql := 'create view v1 as select * from tb11 where wzbh='||t_str;
    execute immediate t_sql;
      

  2.   

    视图也是sql语句,只要你在程序里面动态sql执行之就行。
      

  3.   

    可以呀CREATE OR REPLACE VIEW AAA(字段1.....) as select 字段1.... from area_code where area_code=:vareacode;
      

  4.   

    因为SQL很复杂,
    原希望写在后台以防出错可改
      

  5.   

    declare
      l_sql varchar(100);
      test number;
    begin
      ....
      l_sql :='create view aaa as select * from area_code where area_code=';
      l_sql :=l_sql||test;
      execute immediate l_sql;
      ...
    end;
    /good luck
      

  6.   

    (  p_date  in date )
    as
      l_sql varchar(100);
      
    begin
      l_sql :='create view v_with_date as select * from  zygl_ where sr_rq >=';
    l_sql :=l_sql||to_char(p_date);
      dbms_output.put_line(l_sql);
      execute immediate l_sql ;end   sp_cr_view ;
    高书我参数类型错误