oracle long类型转换成varchar2

oracle long类型转换成varchar2_第1张图片
CREATE OR REPLACE FUNCTION LONG_TO_CHAR( in_rowid rowid,in_owner
varchar,in_table_name varchar,in_column varchar2)
RETURN varchar AS
text_c1 varchar2(32767);
sql_cur varchar2(2000);
--set serveroutput on size 10000000000;
--
begin
DBMS_OUTPUT.ENABLE (buffer_size=>null);
sql_cur := 'select '||in_column||' from
'||in_owner||'.'||in_table_name||' where rowid =
'||chr(39)||in_rowid||chr(39);
dbms_output.put_line (sql_cur);
execute immediate sql_cur into text_c1;

text_c1 := substr(text_c1, 1, 4000);
RETURN TEXT_C1;
END;

 

 insert into repo_file_2 select 
 uuid ,            
  create_time   ,    
  creator     ,     
  modify_time  ,    
  modifier     ,    
  digest_value  ,    
  digest_algorithm  ,
  signature_value  , 
  certificate     , 
  swf_uuid       ,   
  rec_ver         ,
  physical_file_id  ,
  file_name     ,
  content_type    ,
  long_to_char(rowid, 'xzsp_59', 'repo_file', 'file_size')     
  
  from repo_file;
  
  commit;

在转换过程中如果数据量比较大的情况下可能要执行10几或者20几分钟,请耐心等待

你可能感兴趣的:(oracle long类型转换成varchar2)