12
返回列表 发新帖
楼主: armying

[精华] 一个数据类型长度的问题,始终无法解决,请教各位啦!

[复制链接]
论坛徽章:
2
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33
11#
发表于 2001-12-19 07:03 | 只看该作者
My other thought would be using SQL loader to load the data.

使用道具 举报

回复
论坛徽章:
25
ITPUB元老
日期:2005-02-28 12:57:00咸鸭蛋
日期:2013-02-07 11:51:42咸鸭蛋
日期:2013-02-08 09:48:51蜘蛛蛋
日期:2013-02-21 15:47:392013年新春福章
日期:2013-02-25 14:51:24咸鸭蛋
日期:2013-02-28 17:08:42蜘蛛蛋
日期:2013-03-29 16:17:14双黄蛋
日期:2013-04-11 16:11:04咸鸭蛋
日期:2013-05-07 11:55:14咸鸭蛋
日期:2013-05-28 10:46:24
12#
发表于 2001-12-20 11:03 | 只看该作者
在SQLPLUS中没有办法,
用程序应该用BIND方式,
JDBC中用setCharacterStream即可

使用道具 举报

回复
论坛徽章:
0
13#
 楼主| 发表于 2001-12-17 09:39 | 只看该作者

一个数据类型长度的问题,始终无法解决,请教各位啦!

表test
字段cnt  类型long
执行:
SQL> @ d:\temp\test.sql
输入被截为6003个字符
SP2-0027: 输入太长(> 2499个字符) - 已忽略的行
-----------------
test.sql:insert into test values('...............')  
插入的数据长度大概为3000个汉字


将字段类型改为clob,问题仍然存在

使用道具 举报

回复
论坛徽章:
0
14#
 楼主| 发表于 2001-12-17 10:24 | 只看该作者

最大长度为1235个汉字

经过测试,最多能插入1235个汉字

使用道具 举报

回复
论坛徽章:
0
15#
 楼主| 发表于 2001-12-17 14:02 | 只看该作者

使用程序插入也不行。php访问oracle出现如下错误

php访问oracle错误
在文本框中输入大概6000字节的数据,提交,然后出现如下错误:
Warning: Ora_Parse failed (ORA-01704: 文字字符串过长 -- while processing OCI function OPARSE) in F:\news\news_add.php on line 60

经测试发现最大只能在文本框中放入4000字节的数据

使用道具 举报

回复
论坛徽章:
0
16#
 楼主| 发表于 2001-12-17 14:23 | 只看该作者

数据类型是long,clob也试过,不过

都不行

使用道具 举报

回复
论坛徽章:
0
17#
 楼主| 发表于 2001-12-18 14:01 | 只看该作者

能不能介绍一下使用php如何插入数据(>4000byte)?

都快急死我了!

使用道具 举报

回复
论坛徽章:
5
授权会员
日期:2005-10-30 17:05:332009新春纪念徽章
日期:2009-01-04 14:52:282013年新春福章
日期:2013-02-25 14:51:242014年新春福章
日期:2014-02-18 16:41:11马上有车
日期:2014-02-18 16:41:11
18#
发表于 2001-12-17 23:53 | 只看该作者
如果在SQL*PLUS,用'||'来CONCATENATE字符串;
如果用JDBC,先把字符串写入一个TEXT文件,然后用IOSTREAM读写

使用道具 举报

回复
论坛徽章:
0
19#
发表于 2001-12-19 15:39 | 只看该作者
你可以试着使用BFILE类型嘛。

使用道具 举报

回复
论坛徽章:
2
授权会员
日期:2005-10-30 17:05:332011新春纪念徽章
日期:2011-01-04 10:35:48
20#
发表于 2001-12-19 13:18 | 只看该作者
Problem Description:  
====================  

When inserting a string literal into a long or varchar2 field, you get the
error ORA-01704 STRING LITERAL TOO LONG.
example:
insert into table (..., long_column, ...) values (..., 'A really really long
hardcoded string which is inside single quotes', ...);


Problem Explanation:  
====================  

String literals are limited to 2000 characters.
If the string inside the single quotes is more than 2000 characters, you will
get this error.  Note that this is not the length of the entire SQL statement,
just the length of the hardcoded string.

Solution Description:
=====================

Use a bind variable instead of a string literal.                              
  
This can only be done with the precompilers or OCI.

Solution Explanation:
=====================

For example, this is a solution in Pro*C:                                      
  
                                                                                
EXEC SQL begin declare section;                                                
  
  varchar long_val[10000];  /* Bind variable to store the column value */      
  
EXEC SQL end declare section;                                                  
  
                                                                                
  strcpy(long_val.arr, "A really really long hardcoded string which used to \  
  
         be inside single quotes";                                            
  
  long_val.len = strlen(long_val.arr);   

EXEC SQL insert into table (..., long_column, ...)                             
  values (..., :long_val, ...);  


Note the use of the bind variable, rather than the hardcoded string.
.
So , you know how to program PHP?r
Hi, Guys, more questions please
Jim IT Pub 第一击:[/SIZE]

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表