Different return values of a function wmsys. wm_concat in oracle 10g and 11g

Source: Internet
Author: User


A function wmsys in oracle 10g and 11g. wmsys. the function of wm_concat is to merge multiple rows into one row. For example, if A person buys three stocks A, B, and C, we will record three data records normally, now we want to display the stock of this person with a piece of data. This is wmsys. the wm_concat method is useful. however, in 10 Gb, the return value of this method can be directly converted to String for use, but it is Clob type in 11g, you must convert clob to String or another type before using/*** to convert CLOB to String. The static method * @ param clob field * @ return indicates the content String. If an error occurs, returns null */public final static String clob2String (Clob clob) {if (clob = null) {www.2cto.com return null;} StringBuffer Sb = new StringBuffer (65535); // 64 K Reader clobStream = null; // create an input stream object try {clobStream = clob. getCharacterStream (); char [] B = new char [60000]; // get 60 K int I = 0 each time; while (I = clobStream. read (B ))! =-1) {sb. append (B, 0, I) ;}www.2cto.com} catch (Exception ex) {sb = null;} finally {try {if (clobStream! = Null) clobStream. close ();} catch (Exception e) {}} if (sb = null) return null; else return sb. toString ();}
 

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.