dbTalk Databases Forums  

How do I convert a Long datatype to Varchar

comp.database.oracle comp.database.oracle


Discuss How do I convert a Long datatype to Varchar in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Craig Kunzel
 
Posts: n/a

Default How do I convert a Long datatype to Varchar - 03-07-2005 , 04:08 PM






I need to convert a Long Data type to a varchar

I have a procedure that goes something like this:

CREATE TABLE SA_NOTES (
REQ_NO VARCHAR2 (7) NOT NULL,
NOTE_DESC LONG )

CREATE TABLE 2nd_table(
REQ_NO VARCHAR2 (7) NOT NULL,
NOTE_DESC varcahr(2000) )

v_note VARCHAR(2000);
CURSOR c_note IS
SELECT * FROM sa_notes
WHERE REQ_NO in (SELECT REQ_NO FROM 2ND_TABLE)

FOR r_note IN c_note LOOP
BEGIN
v_note := CONVERT_LOG_TO_VARCHAR(r_note.NOTE_DESC) ???
UPDATE 2nd_table
SET Req_notes = v_note
WHERE requisition_no = r_note.req_no;
COMMIT;
END LOOP;

I've tried ULT_RAW, but it;s not a raw. I have also tried
utl_raw.CAST_TO_VARCHAR2(utl_raw.cast_to_raw(r_not e.NOTE_DESC

TIA

Craig





Reply With Quote
  #2  
Old   
Craig Kunzel
 
Posts: n/a

Default Re: How do I convert a Long datatype to Varchar - 03-07-2005 , 04:31 PM






Never mind I figured it out. I have to assign the column to va variable then
normal string functions work.

long_var long

LONG_VAR := r_note.note_desc;
v_req_note := SUBSTR(LONG_VAR,1,2000);


"Craig Kunzel" <ckunzelNOSPAM (AT) riversideca (DOT) gov> wrote

Quote:
I need to convert a Long Data type to a varchar

I have a procedure that goes something like this:

CREATE TABLE SA_NOTES (
REQ_NO VARCHAR2 (7) NOT NULL,
NOTE_DESC LONG )

CREATE TABLE 2nd_table(
REQ_NO VARCHAR2 (7) NOT NULL,
NOTE_DESC varcahr(2000) )

v_note VARCHAR(2000);
CURSOR c_note IS
SELECT * FROM sa_notes
WHERE REQ_NO in (SELECT REQ_NO FROM 2ND_TABLE)

FOR r_note IN c_note LOOP
BEGIN
v_note := CONVERT_LOG_TO_VARCHAR(r_note.NOTE_DESC) ???
UPDATE 2nd_table
SET Req_notes = v_note
WHERE requisition_no = r_note.req_no;
COMMIT;
END LOOP;

I've tried ULT_RAW, but it;s not a raw. I have also tried
utl_raw.CAST_TO_VARCHAR2(utl_raw.cast_to_raw(r_not e.NOTE_DESC

TIA

Craig







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.