日期:2014-05-17 浏览次数:21149 次
create or replace procedure p1 is
Cursor cursor is select t.column_name cn
from user_col_comments t
where t.table_name = upper('t1') and t.column_name <> 'y';
sqlstr varchar2(4000);
begin
for c_name in cursor loop
begin
sqlstr := sqlstr + ' select '
------解决方案--------------------
c_name.cn
------解决方案--------------------
',decode(t1.y,2009,(select '
------解决方案--------------------
c_name.cn
------解决方案--------------------
' from t1 where y=2009),0) cc from t1 union all ';
DBMS_OUTPUT.PUT_LINE(sqlstr);
end;
end loop;
--EXECUTE IMMEDIATE (sqlstr);
end p1;