1、用execute immediate 'select * from '||tablename2、如果是9i可以用 full outer joinselect decode(a.id,null,decode(b.id,null,c.id),a.id) as id,
a.value as value1,b.value as value2,c.value as value3
from tablename a full outer join tablename b
on (a.id = b.id) full outer join tablename c
on (a.id = c.id)

解决方案 »

  1.   

    第一个问题可以使用
    execute immediate sql语句来做
      

  2.   

    v_sql;='select * from '||t_user_name;
    (也可以是表中t_'||var||'_name=t_user_name,var=user)
    execute immediate v_sql;
      

  3.   

    1,
    create procedure pro(p_tablename in varchar2)
    as
    str varchar2(50);
    begin
    str:='create table '||p_tablename||' (id varchar2(10))';
    execute immediate str;
    end;
    /
    2,http://expert.csdn.net/Expert/topic/2593/2593567.xml?temp=1.755923E-02
      

  4.   

    select decode(a.id,null,decode(b.id,null,c.id),a.id) as id,
    a.value as value1,b.value as value2,c.value as value3
    from tablename a full outer join tablename b
    on (a.id = b.id) full outer join tablename c
    on (a.id = c.id)
    ---有问题,下面的才能满足需求,不知有没有简便的方法
    select nvl(a.id,d.id) id,nvl(a.value,0) value1,nvl(d.value2,0) value2,nvl(d.value3,0) value3
    from tablename a full outer join (select nvl(b.id,c.id) id,nvl(b.value,0) value2,nvl(c.value,0) value3
    from tablename b full outer join tablename c on (b.id=c.id)) d on (a.id=d.id)