Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: CLOB to VARCHAR2

Re: CLOB to VARCHAR2

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 25 Nov 1999 08:32:50 -0500
Message-ID: <fheq3s4uurbngpa26h1hc0eou1q2b36867@4ax.com>


A copy of this was sent to "Primo¾ Miheli" <primoz.mihelic_at_ixtlan-team.si> (if that email address didn't require changing) On Thu, 25 Nov 1999 08:23:45 +0100, you wrote:

>Hi,
>
>I am trying to convert CLOB to VARCHAR2 in PL/SQL.
>First I read CLOB from the table.
>Then I try to convert CLOB to VARCHAR2.
>ls_data := sys.dbms_lob.substr(lbl_data, 1,
>sys.dbms_lob.GetLength(lbl_data));
>sys.dbms_output.put_line(ls_data);
>
>But I don't get any result.
>Can anyone explain what should I do?
>

don't ask me why but the author of the dbms_lob package made SUBSTR be:

substr( lob, FOR_BYTES, FROM_OFFSET )

instead of

substr( log, from, for )

as in SQL.....

you have the parameters backwards. you are substring the last byte, not the first N bytes.

>Thanks
>
> Primoz
>
>

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Nov 25 1999 - 07:32:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US