Oracle Some Examples: различия между версиями

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
(Новая: =Оракл - несколько примеров= ==dbms_output.put_line и execute immediate== <PRE> begin execute immediate 'truncate table ERI_TMP_TEST2'; for c in (select table...)
 
Строка 21: Строка 21:
   
 
end;
 
end;
<PRE>
+
</PRE>

Версия 08:27, 24 мая 2011

Оракл - несколько примеров

dbms_output.put_line и execute immediate

begin

execute immediate 'truncate table ERI_TMP_TEST2';
  for c in (select table_name from all_tables where owner = 'PMMCOUNTER_DB' and table_name like 'ERI%\_W' escape '\') loop

  dbms_output.put_line ('INSERT INTO ERI_TMP_TEST2 select ' || 
'min(PMM_DATESTAMP), '|| 
'max(PMM_DATESTAMP),PMM_DATETIME, '''|| c.table_name || ''' from PMMCOUNTER_DB.' || c.table_name || ' GROUP BY PMM_DATETIME order by 3;');
  
  execute immediate 'INSERT INTO ERI_TMP_TEST2 select ' ||'min(PMM_DATESTAMP), '|| 'max(PMM_DATESTAMP),PMM_DATETIME, '''|| c.table_name || ''' from PMMCOUNTER_DB.' || c.table_name || ' GROUP BY PMM_DATETIME order by 3';


  
  
  end loop;



end;