Convert the Clob object to string

Source: Internet
Author: User

/*** @title: clobparsestring * @description: TODO Clob Object converted to String *@author: Yubo *@paramCLOB *@return     * @throwsSQLException * @date: 2016-1-6 pm 4:01:42*/     Public StaticString clobparsestring (Clob Clob)throwssqlexception{String Result= ""; if(Clob! =NULL) {result= Clob.getsubstring ((Long) 1, (int) clob.length ()); }        returnresult; }

Row to column Oracle:

Create or ReplaceType Type_concatstr_clob asobject (Total Clob, staticfunctionOdciaggregateinitialize (sctxinchOut Type_concatstr_clob)return  Number, memberfunctionOdciaggregateiterate (selfinchOut Type_concatstr_clob,valueinchClobreturn  Number, memberfunctionOdciaggregateterminate (selfinchType_concatstr_clob,returnvalue out Clob,flagsinch  Number)return  Number, memberfunctionOdciaggregatemerge (selfinchOut TYPE_CONCATSTR_CLOB,CTX2inchTYPE_CONCATSTR_CLOB)return  Number)/Create or Replacetype body Type_concatstr_clob is  --rewrite on the basis of CONCATSTRStaticfunctionOdciaggregateinitialize (sctxinchOut Type_concatstr_clob)return  Number   is  beginSctx:=Type_concatstr_clob (NULL); returnodciconst.success; End; MemberfunctionOdciaggregateiterate (selfinchOut Type_concatstr_clob,valueinchClobreturn  Number   is|| ',' ||value; returnodciconst.success; End; MemberfunctionOdciaggregateterminate (selfinchType_concatstr_clob,returnvalue out Clob,flagsinch  Number)return  Number   is  beginreturnvalue:= LTrim(,','); returnodciconst.success; End; MemberfunctionOdciaggregatemerge (selfinchOut TYPE_CONCATSTR_CLOB,CTX2inchTYPE_CONCATSTR_CLOB)return  Number   is||; returnodciconst.success; End;End;/
Create or Replace function varchar2 return clob  parallel_enable  aggregate using Type_concatstr_clob;

For example:

SELECT  from (SELECT f_concatstr_clob (e.c_agencyno| | ' : ' ||  from   Tagencyinfo e) U;

Clob object is converted to string

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: 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.