Oracle Some Examples
Материал из noname.com.ua
Версия от 08:27, 24 мая 2011; Sirmax (обсуждение | вклад) (→dbms_output.put_line и execute immediate)
Оракл - несколько примеров
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;