日期:2014-05-17 浏览次数:20863 次
LONG to VARCHAR2 Function CREATE OR REPLACE FUNCTION LONG_TO_CHAR( in_rowid rowid,in_owner varchar,in_table_name varchar,in_column varchar2) RETURN varchar AS /* CREATE BY: D.Jenkins Date: 28-Apr02003 Use: Long to varchar2 conversion, to allow a substring on long column in the table; Notes: Errors out with varchar > 32767 ORA-06502: PL/SQL: numeric or value error: character string buffer too small Synonyms and Grants: create public synonym LONG_TO_CHAR for synergen.CDBF_LONG_TO_CHAR; grant execute as required or grant execute long_to_char to public; */ text_c1 varchar2(32767); sql_cur varchar2(2000); -- begin 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; /
------解决方案--------------------
支持搂主,收藏