哈希分区表属于散列分区,还真不好确定属于哪个分区 不知道能不能获取分区的物理存储范围,然后根据rowid的信息进行查找 rowid由file# block# row#组成,占用6个bytes的空间,10 bit 的 file# ,22bit 的 block# ,16 bit 的 row# 最简单的方式是写个函数,调用就可以了 FUNCTION GetPartition(P_A IN VARCHAR2) RETURN varchar2 IS i number; BEGIN select count(1) into i from T partition(part_1) where A=P_A and rownum=1; if i>0 then return 'part_1'; end if; select count(1) into i from T partition(part_2) where A=P_A and rownum=1; if i>0 then return 'part_2'; end if; select count(1) into i from T partition(part_3) where A=P_A and rownum=1; if i>0 then return 'part_3'; end if; return null; END;
不知道能不能获取分区的物理存储范围,然后根据rowid的信息进行查找
rowid由file# block# row#组成,占用6个bytes的空间,10 bit 的 file# ,22bit 的 block# ,16 bit 的 row#
最简单的方式是写个函数,调用就可以了
FUNCTION GetPartition(P_A IN VARCHAR2) RETURN varchar2 IS
i number;
BEGIN
select count(1) into i from T partition(part_1) where A=P_A and rownum=1;
if i>0 then
return 'part_1';
end if;
select count(1) into i from T partition(part_2) where A=P_A and rownum=1;
if i>0 then
return 'part_2';
end if;
select count(1) into i from T partition(part_3) where A=P_A and rownum=1;
if i>0 then
return 'part_3';
end if;
return null;
END;
可以直接查询具体的分区
字段是很多,但是分区个数是不多的,如你的例子,就才3个分区