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

Home -> Community -> Mailing Lists -> Oracle-L -> Long to Varchar2

Long to Varchar2

From: VenkataRamana_Muthumula <VenkataRamana_Muthumula_at_satyam.com>
Date: Thu, 20 Jul 2000 11:07:58 +0530
Message-Id: <10563.112495@fatcity.com>


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



create table long2varchar2
 (name varchar2(30),
 condition varchar2(2000)

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">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2650.12">
<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">&nbsp;(name varchar2(30),</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;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">long_value = long_cursor%ROWTYPE;</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&nbsp;&nbsp; :=3D =
long_value.constraint_name;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">condition :=3D = long_value.search_condition;</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>

<UL>
<P><A NAME=3D"_MailData"><FONT SIZE=3D2 = FACE=3D"Arial">----------</FONT></A>
<BR><B><FONT SIZE=3D2 FACE=3D"Arial">From:&nbsp; Jain Rahul = [SMTP:Rahul.Jain_at_sisl.co.in]</FONT></B>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Sent:&nbsp; Thursday, July 20, 2000 = 10:45 AM</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">To:&nbsp; Multiple recipients of list = ORACLE-L</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Subject:&nbsp; Long to = Varchar2</FONT><B></B><B></B><B></B>
</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)&nbsp; 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">&nbsp; INET: =
Rahul.Jain_at_sisl.co.in</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Fat City Network = Services&nbsp;&nbsp;&nbsp; -- (858) 538-5051&nbsp; FAX: (858) = 538-5051</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">San Diego, = California&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Public Internet = access / Mailing Lists</FONT>
<BR><FONT SIZE=3D2 =

FACE=3D"Arial">---------------------------------------------------------=
-----------</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">To REMOVE yourself from this mailing = list, send an E-Mail message</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">to: ListGuru_at_fatcity.com (note EXACT = spelling of 'ListGuru') and in</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">the message BODY, include a line = containing: UNSUB ORACLE-L</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">(or the name of mailing list you want = to be removed from).&nbsp; You may</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">also send the HELP command for other = Received on Thu Jul 20 2000 - 00:37:58 CDT

Original text of this message

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