<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>kwatog &#38; co. &#187; long</title>
	<atom:link href="http://kwatog.com/tag/long/feed/" rel="self" type="application/rss+xml" />
	<link>http://kwatog.com</link>
	<description>tech notes and general nonsense</description>
	<lastBuildDate>Wed, 25 Aug 2010 05:46:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Long to Varchar2</title>
		<link>http://kwatog.com/blog/oracle/long-to-varchar2/</link>
		<comments>http://kwatog.com/blog/oracle/long-to-varchar2/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 16:07:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PL/SQL]]></category>
		<category><![CDATA[c onversion]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[varchar2]]></category>

		<guid isPermaLink="false">http://kwatog.com/?p=104</guid>
		<description><![CDATA[I got tangled with a problem on the datatype LONG in Oracle which is still being used in a number of applications. Siebel, is actually one of them. When I was tasked to extract some data from one of the tables in EIM using C++, I run into this problem. I googled for answer and [...]]]></description>
			<content:encoded><![CDATA[<p>I got tangled with a problem on the datatype LONG in Oracle which is still being used in a number of applications. Siebel, is actually one of them. When I was tasked to extract some data from one of the tables in EIM using C++, I run into this problem.</p>
<p>I googled for answer and here&#8217;s what I got.<br />
<code><br />
CREATE OR REPLACE FUNCTION LONG_TO_CHAR( in_rowid rowid,in_owner<br />
varchar,in_table_name varchar,in_column varchar2)<br />
RETURN varchar AS<br />
text_c1 varchar2(32767);<br />
sql_cur varchar2(2000);<br />
--<br />
begin<br />
  sql_cur := 'select '||in_column||' from<br />
'||in_owner||'.'||in_table_name||' where rowid =<br />
'||chr(39)||in_rowid||chr(39);<br />
  dbms_output.put_line (sql_cur);<br />
  execute immediate sql_cur into text_c1;</p>
<p>  text_c1 := substr(text_c1, 1, 5000);<br />
  RETURN TEXT_C1;<br />
END;<br />
</code></p>
<p>It&#8217;s pretty simple but unfortunately, we can&#8217;t do this without using function.</p>
<p>Example use:<br />
<code><br />
SELECT MI_F_LONG_TO_CHAR(ROWID, 'SIEBEL','EIM_ORDER','ORD_X_COMMENTS')<br />
FROM  SIEBEL.EIM_ORDER<br />
</code></p>
<p>credit to <a href="http://www.oracle.com/technology/oramag/code/tips2003/052503.html">Oracle Mag</a> for this entry.</p>
]]></content:encoded>
			<wfw:commentRss>http://kwatog.com/blog/oracle/long-to-varchar2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
