The function of an ORACLE long type into VARCHAR2

Source: Internet
Author: User
Tags chr

Do not know who originally wrote the function, take over to record, may use later.

* * Where In_rowid is a row id,in_owner the account name for the database, In_table_name is the database table name, in_column a long type of table field name for the database * *

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 (); 
-- 
begin 
  Sql_cur: = ' SELECT ' | | in_column| | ' from 
' | | in_owner| | '. ' | | in_table_name| | ' Where rowID = 
' | | Chr (39) | | in_rowid| | Chr (); 
  Dbms_output.put_line (sql_cur); 
  Execute immediate sql_cur into TEXT_C1; 

  TEXT_C1: = substr (TEXT_C1, 1, 4000); 
  return TEXT_C1;  
End;


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.