Re: Long to varchar2?
Date: 1996/06/13
Message-ID: <4ppj0m$fnq_at_inet-nntp-gw-1.us.oracle.com>#1/1
In article <4ppgnr$fij_at_rzsun02.rrz.uni-hamburg.de>, 3bohlman_at_rzdspc5.informatik.uni-hamburg.de (Holger Bohlmann) writes:
|> Hello,
|>
|> is there anybody out there, who knows, how I can convert a
|> LONG-Value in a VARCHAR2-Value (in Oracle?). Is it possible
|> to do that?
|>
|> Holger Bohlmann
|>
First of all, the LONG would have to be less than 2000 characters, since that
is the maximum length of a VARCHAR2. The best bet would be to use PL/SQL.
Something like:
DECLARE
v_LongVal LONG;
v_VarcharVal VARCHAR2(2000);
BEGIN
SELECT ...
INTO v_LongVal
FROM ...;
v_VarcharVal := vLongVal;
INSERT INTO ... VALUES (..., v_VarcharVal);
END;
Or you can just select into the VARCHAR variable directly from the LONG column,
which will do the conversion implicitly.
-- ------------------------------------------------------------------------ Scott Urman Oracle Corporation surman_at_us.oracle.com ------------------------------------------------------------------------ Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm ------------------------------------------------------------------------ "The opinions expressed here are my own, and are not necessarily that of Oracle Corporation" ------------------------------------------------------------------------Received on Thu Jun 13 1996 - 00:00:00 CEST