<?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>惜分飞 &#187; ORA-01465</title>
	<atom:link href="https://www.xifenfei.com/tag/ora-01465/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Sat, 07 Nov 2026 15:45:44 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>ORA-01465: invalid hex number</title>
		<link>https://www.xifenfei.com/2011/09/ora-01465-invalid-hex-number.html</link>
		<comments>https://www.xifenfei.com/2011/09/ora-01465-invalid-hex-number.html#comments</comments>
		<pubDate>Wed, 28 Sep 2011 09:25:05 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[ORA-xxxxx]]></category>
		<category><![CDATA[ORA-01465]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=1619</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2011/09/ora-01465-invalid-hex-number.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2011/09/ora-01465-invalid-hex-number.html" target="_blank">ORA-01465: invalid hex number</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p>网友反馈blob插入一些字段报错，查询metalink，发现使用<strong>rawtohex</strong>处理即可，测试如下：</p>
<pre class="brush: sql; title: ; notranslate">
SQL&gt; create table t_lob (t blob);

Table created.

SQL&gt; insert into t_lob values('-------');
insert into t_lob values('-------')
                         *
ERROR at line 1:
ORA-01465: invalid hex number


SQL&gt; insert into t_lob values(rawtohex('---------'));

1 row created.

SQL&gt; insert into t_lob values('－－－－－－－－－－&amp;');
insert into t_lob values('－－－－－－－－－－&amp;')
                         *
ERROR at line 1:
ORA-01465: invalid hex number

SQL&gt; insert into t_lob values(rawtohex('－－－－－－－－－－&amp;'));

1 row created.

SQL&gt; commit;

Commit complete.
</pre>
<p>网友提供java处理代码如下：</p>
<pre class="brush: java; title: ; notranslate">
///插入
public void test()
	{
		conn=DBUtil.getActiveConnection();
		String sqlStr=&quot;Set define off&quot;;
		String ss=&quot;————&quot;;
		String sql=&quot;insert into test1(names,btestname) values('12',rawtohex('&quot;+ss+&quot;'))&quot;;
		System.out.println(sqlStr);
		System.out.println(sql);
		try {
			pstmt=conn.prepareStatement(sqlStr);
			pstmt.addBatch();  
			
			pstmt=conn.prepareStatement(sql);
			pstmt.addBatch();
			pstmt.executeBatch();
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally
		{
			DBUtil.closeStatement(pstmt);
			DBUtil.closeConnection(conn);
		}
	}

／／／／查询语句
public void getTest()
	{
		conn=DBUtil.getActiveConnection();
		String sql=&quot;select * from test1 where names='12'&quot;;
		//oracle.sql.BLOB blob = null;
		InputStream inStream=null;
		
		try {
			pstmt=conn.prepareStatement(sql);
			set=pstmt.executeQuery();
			if(set!=null &amp;&amp; set.next())
			{
				//接收blob类型
				java.sql.Blob blob = (oracle.sql.BLOB)set.getBlob(&quot;btestname&quot;);
				//注意
				inStream = blob.getBinaryStream();
		        if(blob!=null) System.out.println(&quot;有值＝＝＝＝＝＝＝＝＝＝＝＝&quot;);
				try {
					byte[] data = new byte[200];
						
					 int length=0;//每次读取的实际字节长度
						//is.read()方法：从buff缓中区的第0个位开始读取字节，每次最多读取200，
						//方法会返回一个实际读取的长度，用length接收，当值为-1时，表示所有的字节全部读取完毕
					 while((length=inStream.read(data,0,200))!=-1)
					{
						//把字节以平台的默认编码方式转为字符，从buff的第0个位开始转换，实际要转换的长度是length
						String str=new String(data,0,length);	
						System.out.println(&quot;最终结果====  &quot;+str+&quot;  ====&quot;);
					}
	 
					//关闭流
					inStream.close();	
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			}	
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally
		{
			DBUtil.closeResultSet(set);
			DBUtil.closeStatement(pstmt);
			DBUtil.closeConnection(conn);
		}
	}
</pre>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/%e7%bd%91%e7%ab%99%e6%b5%81%e9%87%8f%e7%bb%9f%e8%ae%a1.html" rel="bookmark" class="crp_title">网站流量统计</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/05/linux-oracle-babyk-source.html" rel="bookmark" class="crp_title">linux环境oracle数据库被文件系统勒索加密为.babyk扩展名溯源</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/fckeditor%e4%bd%bf%e7%94%a8%e8%af%b4%e6%98%8e.html" rel="bookmark" class="crp_title">fckeditor使用说明</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/04/db2%e4%b8%ad%e4%ba%a7%e7%94%9f%e5%94%af%e4%b8%80%e5%80%bc%e4%b8%89%e7%a7%8d%e6%96%b9%e5%bc%8f.html" rel="bookmark" class="crp_title">DB2中产生唯一值三种方式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/%e9%80%9a%e8%bf%87%e4%bf%ae%e6%94%b9%e5%9f%ba%e8%a1%a8link%e8%ae%a9%e9%9d%9epublic-dblink%e5%8f%98%e4%b8%bapublic.html" rel="bookmark" class="crp_title">通过修改基表(link$)让非public dblink变为public</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/03/multiple-table-cache-group%e9%85%8d%e7%bd%ae.html" rel="bookmark" class="crp_title">Multiple-table cache group配置</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/08/dul%e5%ae%9e%e7%8e%b0exp-dump%e6%96%87%e4%bb%b6%e8%bd%ac%e6%8d%a2sqlldr%e6%a0%bc%e5%bc%8f.html" rel="bookmark" class="crp_title">密码保护：dul实现exp dump文件转换sqlldr格式</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/10/%e9%80%9a%e8%bf%87web%e6%9b%b4%e6%96%b0%e7%bd%91%e7%ab%99%ef%bc%881%ef%bc%89.html" rel="bookmark" class="crp_title">通过web更新网站（1）</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/dropdownlist-%e7%9c%81%e5%b8%82%e5%8e%bf%e4%b8%89%e7%ba%a7%e8%81%94%e5%8a%a8.html" rel="bookmark" class="crp_title">dropdownlist 省市县三级联动</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/01/sqlite.html" rel="bookmark" class="crp_title">sqlite数据库简单操作</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/08/oracle-%e6%8f%92%e5%85%a5%e5%90%ab%e5%ad%97%e7%ac%a6%e4%b8%b2.html" rel="bookmark" class="crp_title">oracle 插入含&#038;字符串</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/05/%e4%bd%bf%e7%94%a8dblink%e5%af%bc%e8%87%b4%e7%9a%84-opaque_transform.html" rel="bookmark" class="crp_title">使用dblink导致的/*+ OPAQUE_TRANSFORM */</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2011/09/ora-01465-invalid-hex-number.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
