Informix 7.3 isql 插入语句 - text/blob/clob 字段插入错误
有办法解决这个问题吗?
我正在尝试将一些数据插入到一个结构为的表中:
Column name Type Nulls
crs_no char(12) no
cat char(4) no
pr_cat char(1) yes
pr_sch char(1) yes
abstr text yes
最后一个字段的类型为“文本”,但是当尝试插入到该表中时,我收到此错误:
insert into crsabstr_rec values ("COMS110","UG09","Y","Y","CHEESE");
617: A blob data type must be supplied within this context.
Error in line 1
Near character position 66
所以该字段显然是某种 blob,但是不会进行插入(或更新)。 通常,这些记录被插入到 GUI 表单中,然后 C 代码处理插入。
Is a way around this??
I am trying to insert some data into a table whose structure is:
Column name Type Nulls
crs_no char(12) no
cat char(4) no
pr_cat char(1) yes
pr_sch char(1) yes
abstr text yes
The type of the last field reads 'text', but when trying to insert into this table, I get this error:
insert into crsabstr_rec values ("COMS110","UG09","Y","Y","CHEESE");
617: A blob data type must be supplied within this context.
Error in line 1
Near character position 66
So this field is some sort of blob apparently, but won't take inserts (or updates). Normally, these records are inserted into a GUI form, then C code handles the insertions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Informix Dynamic Server (IDS) 中没有 blob(BYTE 或 TEXT)文字,IDS 9.00 及更高版本中也没有 CLOB 或 BLOB 类型。 这一直是我沮丧的根源。 我多年来一直在系统中提出该功能请求,但它从未达到内部的痛苦阈值,这意味着它得到了修复 - 其他事情得到了更高的优先级。
尽管如此,它却总是咬人。
在 IDS 7.3 中(您应该升级它 - 它在大约十年后于 2009 年 9 月停止服务),您几乎只能使用 C 将数据放入数据库的 TEXT 字段。 您必须使用批准的 C 类型“loc_t”来存储有关 BYTE 或 TEXT 数据的信息,并将其传递到服务器。
如果您需要 ESQL/C 中的示例,请查看 International Informix User Group 网站,尤其是 < a href="https://www.iiug.org/en/iiug-software-repository/#ESQL" rel="nofollow noreferrer">软件存储库。 除此之外,您还可以找到源代码形式的原始 SQLCMD 程序(Microsoft 的同名程序是 Johnny-Come-Lately)。 它还包括一组我称之为“vignettes”的程序; 它们以各种方式操作 blob,旨在展示如何在各种场景中使用“loc_t”结构。
There are no blob (BYTE or TEXT) literals in Informix Dynamic Server (IDS) - nor for CLOB or BLOB types in IDS 9.00 and later. It is an ongoing source of frustration to me; I've had the feature request in the system for years, but it never reaches the pain threshold internally that means it gets fixed -- other things get given a higher priority.
Nevertheless, it bites people all the time.
In IDS 7.3 (which you should aim to upgrade - it goes out of service in September 2009 after a decade or so), you are pretty much stuck with using C to get the data into the TEXT field of a database. You have to use the approved C type 'loc_t' to store the information about the BYTE or TEXT data, and pass that to the server.
If you need examples in ESQL/C, look at the International Informix User Group web site, and especially the Software Repository. Amongst other things, you'll find the original SQLCMD program (Microsoft's program of the same name is a Johnny-Come-Lately) in source form. It also includes a set of programs that I dub 'vignettes'; they manipulate blobs in various ways, and are designed to show how to use 'loc_t' structures in various scenarios.
在 iSQL....
已加载 3 行。
desc.txt 是一个 | (管道)分隔文本文件和 txt 中的字段数必须与表中的字段数匹配
in iSQL....
3 row(s) loaded.
desc.txt is a | (pipe) delimited text file and the number of fields in the txt have to match the number of fields in the table