我需要从该表上创建的最新分区中获取信息。动态获取而不是使用下面的名称
select *
from dw.DWT509_DADOS_NCLIE partition ('Partition Name').
select *
from dw.DWT509_DADOS_NCLIE partition
(Select PARTITION_NAME
From (
Select PARTITION_POSITION, PARTITION_NAME,
Max(PARTITION_POSITION) over (partition by TABLE_NAME)
As MAX_P
From SYS.all_tab_partitions
Where TABLE_NAME='DWT509_DADOS_NCLIE'
--And Nvl(NUM_ROWS,0) = 0
)
Where PARTITION_POSITION = MAX_P);
答案 0 :(得分:0)
我认为您将不得不使用动态sql字符串...
declare
l t.x%type;
stmt varchar2(1000);
part varchar2(30);
begin
select max(x) into l from t;
stmt := 'select max(uo.subobject_name)
from t partition for (' || l || '), user_objects uo
where dbms_rowid.rowid_object(t.rowid) = uo.data_object_id';
execute immediate stmt into part;
dbms_output.put_line(part);
end;
/