- 排名:
rank()over(partition by TABLE.COLUMN_1 order by count(distinct TABLE.COLUMN_2)desc)
這是常需要用,但不太會用的語法
- 取得TABLE及COLUMN的資訊:
select distinct table_name from all_tab_cols where owner='XXX'
- CREAT TABLE時加大空間:
STORAGE ( INITIAL 512K MINEXTENTS 1 MAXEXTENTS unlimited )
- Truncate_Partition:
若資料有依年月切PARTITION分的,
當要DELETE某年月的資料時,
可採 TRUNCATE PARTITION的方式,可提高清資料的效率sql_stmt_01 := 'alter table DM_CSV.F_CSV_ACCT_HOLDINGS truncate partition ' || 'P_' || v_SNAP_YYYYMM; EXECUTE IMMEDIATE sql_stmt_01;