DBA_TAB_PARTITIONS中 high_value欄位long型轉varchar2

guocun09發表於2017-10-26
CREATE OR REPLACE function SMES_C.long_2_varchar (
p_table_owner    in DBA_TAB_PARTITIONS.table_owner%type,
p_table_name     in DBA_TAB_PARTITIONS.table_name%type,
p_partition_name in DBA_TAB_PARTITIONS.partition_name%type) 
return varchar2
as
l_high_value LONG;
begin
    select high_value
    into l_high_value      
    from DBA_TAB_PARTITIONS
    where table_owner = p_table_owner
    and table_name  = p_table_name and partition_name = p_partition_name;
return substr( l_high_value, 1, 4000 );
end;
/


select A.TABLE_OWNER,a.table_name,SMES_c.long_2_varchar(TABLE_OWNER,table_name,partition_name) from DBA_TAB_PARTITIONS a
WHERE  TABLE_OWNER='SMES_C' 
AND TABLE_NAME='H_EQP_TRPA' 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25583515/viewspace-2146409/,如需轉載,請註明出處,否則將追究法律責任。

相關文章