oracle6

CREATE OR REPLACE PROCEDURE OMSFM.create_view_alarm_all

authid current_user

IS

v_viewsql varchar2(1000);

v_cnt number(18,0);

BEGIN

declare
cursor c is select table_name from all_tables where owner='OMSFM' and table_name like '%HISTORICAL_ALARM%';
sqlstat varchar(4000) default 'create or replace view omsfm.view_omsfm_alarm_all as select * from omsfm.tbl_current_alarm';
i number(10) default 0;
begin
for t in c loop
  --if i <> 0 then
  sqlstat := sqlstat || ' union ';
  --end if;
  i := i + 1;
  sqlstat:=sqlstat||' select * from '||t.table_name;
end loop;
dbms_output.put_line(sqlstat);
execute immediate sqlstat;
end;

END;

你可能感兴趣的:(C++,c,C#)