BEGIN
dbms_stats.set_table_prefs
( ownname => 'SALES_MART',
tabname => SELECT DISTINCT (table_name)
FROM all_part_tables
WHERE OWNER = 'SALES_MART',
pname => 'INCREMENTAL',
pvalue =>'TRUE'
);
END;
ORA-06550:第5行,第16栏:PLS-00103:遇到符号 " SELECT"期待以下之一:
( - + case mod new not null继续avg count current current max min 先前的sql stddev sum variance执行forall合并时间戳 间隔日期管道
&安培; - +; / at用于mod余数rem和/或具有相交减去的组 订单开始联合连接||多重集
答案 0 :(得分:1)
DBMS_STATS.SET_TABLE_PREFS
过程接受表名作为参数。你不能通过select语句。
我假设您要为所有表SALES_MART
执行此过程,因此在这种情况下,您可以使用游标并在循环中调用此过程:
BEGIN
FOR part_tables_rec in (
SELECT DISTINCT table_name
FROM all_part_tables
WHERE OWNER = 'SALES_MART'
) LOOP
dbms_stats.set_table_prefs (
ownname =>'SALES_MART',
tabname => part_tables_rec.table_name,
pname => 'INCREMENTAL',
pvalue => 'TRUE' );
END LOOP;
END;
答案 1 :(得分:0)
试试这个。
begin
for p_tab_name_list in (SELECT owner,table_name
FROM all_part_tables
WHERE owner = 'SALES_MART'
and table_name not like 'BIN$%'
group by owner,table_name
) LOOP
dbms_stats.set_table_prefs (
ownname => p_tab_name_list.owner,
tabname => p_tab_name_list.table_name,
pname => 'INCREMENTAL',
pvalue => 'TRUE' );
end loop;
end;