Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Long to Varchar2
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01BFF20C.A5D576E0
Content-Type: text/plain
Hi Jain,
First create table
Then create and run the following procedure
create or replace procedure long2varchar
AS
begin
declare
name varchar2(30);
condition varchar2(2000);
cursor long_cursor is select * from user_constraints;
long_value long_cursor%ROWTYPE;
begin
for long_value in long_cursor
loop
name := long_value.constraint_name;
condition := long_value.search_condition;
insert into long2varchar2
values (name,condition);
end loop;
end;
end;
/
From: Jain Rahul [SMTP:Rahul.Jain_at_sisl.co.in] Sent: Thursday, July 20, 2000 10:45 AM To: Multiple recipients of list ORACLE-L Subject: Long to Varchar2 Hi List, Can anyone tell me the way to convert a LONG column to VARCHAR2 ? Actually, I need to select the 'SEARCH_CONDITION' (Long) column from user_constraints and insert it in one of my own table in a varchar2(2000) column. Any help in this regard is appreciated. RJ -- Author: Jain Rahul INET: Rahul.Jain_at_sisl.co.in Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
------_=_NextPart_001_01BFF20C.A5D576E0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =charset=3Dus-ascii">
<TITLE> Long to Varchar2</TITLE> </HEAD> <BODY>
<P><FONT SIZE=3D2 FACE=3D"Arial">Hi Jain,</FONT> </P>
<P><FONT SIZE=3D2 FACE=3D"Arial">First create table </FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">*****************************</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">create table long2varchar2</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial"> (name varchar2(30),</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial"> condition varchar2(2000)</FONT> </P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Then create and run the following =
procedure</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">create or replace procedure = long2varchar</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">AS</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">begin</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">declare </FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">name varchar2(30);</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">condition varchar2(2000);</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">cursor long_cursor is select * from =user_constraints;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">begin</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">for long_value in long_cursor</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">loop </FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">name :=3D =long_value.constraint_name;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">insert into long2varchar2</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">values (name,condition);</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">end loop;</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">end;</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">end;</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">/</FONT> <BR><FONT SIZE=3D2 = FACE=3D"Arial">*********************************************************= ****************************</FONT> </P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Hi List,</FONT> </P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Can anyone tell me the way to convert =
a LONG column to VARCHAR2 ?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Actually, I need to select the =
'SEARCH_CONDITION' (Long) column from</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">user_constraints and insert it in =
one</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">of my own table in a varchar2(2000) =
column.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Any help in this regard is =
appreciated.</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">RJ</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">-- </FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">Author: Jain Rahul</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial"> INET: =Rahul.Jain_at_sisl.co.in</FONT>
<P><FONT SIZE=3D2 FACE=3D"Arial">Fat City Network =
Services -- (858) 538-5051 FAX: (858) =
538-5051</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">San Diego, =
California -- Public Internet =
access / Mailing Lists</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">---------------------------------------------------------=-----------</FONT>