create or replace procedure proc
as
begin
declare
time_to_stay number(3):=90
with date_partitions as
(select dbms_xmlgen.getxmltype('
select p.table_owner,
p.table_name,
p.high_value
from all_part_key_columns k,
all_tab_cols c,
all_tab_partitions p
where k.owner = c.owner
and k.column_name = c.column_name
and k.name = c.table_name
and k.owner = p.table_owner
and k.name = p.table_name
and (c.data_type = ''DATE'' or
c.data_type like ''TIMESTAMP%'')')
as xml
from dual)
SELECT x.*
FROM date_partitions p,
xmltable('/ROWSET/ROW'
passing p.xml
columns table_owner varchar2(30)
path '/ROW/TABLE_OWNER',
table_name varchar2(30)
path '/ROW/TABLE_NAME',
high_value varchar2(30)
path '/ROW/HIGH_VALUE'
) x
where to_date(substr(x.high_value,
instr(high_value, '''')+2,
19),
'yyyy-mm-dd hh24:mi:ss') <= sysdate-time_to_stay
end;
當我執行代碼時,I過程被創建。但不起作用。當我嘗試編譯該過程時,出現以下錯誤。 錯誤(7,1):PLS-00103:遇到下列其中一項時遇到符號「WITH」:* & = - +;其中in是mod餘數不是rem <>或= =或= => = < = <>和或類似like2 like4 likec在||之間。 multiset成員submultiset ...在存儲過程中使用with clause
如果我與開始部分執行此代碼,它適用於我的罰款。