select ... from a_dept where id =memberid),'omrole',
(select displayname from tib_role where id=memberid),'omstaff',
(select displayname from tib_staff where id=memberid) displayname,
decode(a.memberkind,'omdept',(select kind as deptkind from a_dept where id=memberid),'omrole',
(select '' as deptkind from tib_role where id=memberid),'omstaff',
(select '' as deptkind from tib_staff where id=memberid))deptkind
from  a_orgrelation a start with a.memberid=:key connect by prior a.parentguid=a.guidselect ... from dual where :1=1 union select 2 as scope,t.column_name,
decode(t.data_type,'char',1,
   'varchar2',12,
   'number',  3,
   'long',    -1,
   'date',    93,
   'raw',     -3,
   'long raw',-4,1111)as data_type,
t.data_type as type_name,
decode(t.data_precision,null,t.data_length,t.data_precision) as column_size,
       0 as buffer_length,
t.data_scale as decimal_digits,
l as pseudo_column 
from  all_tab_columns t,
 all_ind_columns i where :2=1 and
 t.table_name:=3 and
 t.owner like:4 escape '/'    and
 t.nullable !=:5              and
 t.owner=i.table_owner        and
 t.table_name =i.table_name   and
 t.column_name =i.column_name想知道这两段语句实现的功能 ?
 解释结合变量?

解决方案 »

  1.   

    第一個是一個tree結構的查詢。
    第二個是一個帶參數的查詢語句。
      

  2.   

    能不能用scott里面的emp表做一个完整的例子,有实际结果出来(直观一点)谢谢
      

  3.   

    select *from dual where :1=1  
    SP2-0552: 未说明结合变量"1", 应该怎样说明?
      

  4.   

    第一条语句是一个tree型语句
    第二条语句是引用了all_tab_columns ,all_ind_columns 这两个系统表 但t.table_name:=3  --这句话出现在查询语句中,会出错
      

  5.   

    第一条语句是一个tree型语句
    第二条语句是引用了all_tab_columns ,all_ind_columns 这两个系统表 但t.table_name:=3  --这句话出现在查询语句中,会出错
      

  6.   

    declare
    num number;
    begin
    execute immediate 'select 1 from dual where :1=1' into num;
    dbms_output.put_line(num);
    end;
    /
      

  7.   

    刚才是我笔误正确的是:t.table_name=:3 and
      

  8.   

    我的qq是42008282想和大家交个朋友。
    t.owner like:4 escape '/'    and  这一句escape '/'是什么意思
      

  9.   

    escape '/' : 忽略 '/'
      

  10.   

    escape '/' : 忽略 '/'
      

  11.   

    start with a.memberid=:key connect by prior a.parentguid=a.guid
    这句话怎么理解?
      

  12.   

    http://gigabase.idi.ntnu.no/oradoc/server.901/a90125/queries2.htm#2053937
      

  13.   

    http://expert.csdn.net/Expert/topic/1551/1551178.xml?temp=.3297693