.NET 和 Oracle:将一个表连接到另一个表的空集
我正在尝试将 tableA 与一些数据连接到另一个 tableB 的空集。 主要目的是获取tableB的所有列。 我不需要表B的任何数据。
我构建了以下 SQL:
SELECT uar.*, s.screen_id, s.screen_name
FROM crs_screens
LEFT JOIN crs\_user\_access\_right uar
ON s.rid IS NOT NULL AND uar.rid IS NULL
此 SQL 在 TOAD 上完美运行,但当我在 VB.NET OracleDataAdapter.Fill(DataTable) 语句中使用它时,它返回错误。
如果有解决方法可以达到相同的效果就好了。 非常感谢。
错误信息:
OCI-22060:参数 [2] 是无效或未初始化的数字
配置:
.NET Framework:1.1
Oracle 9i
I am trying to join tableA with some data to an empty set of another tableB. The main purpose is to get all the columns of tableB. I do not need any data of tableB.
I have constucted the following SQL:
SELECT uar.*, s.screen_id, s.screen_name
FROM crs_screens
LEFT JOIN crs\_user\_access\_right uar
ON s.rid IS NOT NULL AND uar.rid IS NULL
This SQL runs perfectly on TOAD but it returns an error when I use it in my VB.NET OracleDataAdapter.Fill(DataTable) statement.
It is fine if there is a work-around to achieve same effect. Thank you very much.
Error message:
OCI-22060: argument [2] is an invalid or uninitialized number
Config:
.NET framework: 1.1
Oracle 9i
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
也许问题不在于语句,而在于“uar”表的第二列。
您可以尝试使用不同的表进行查询来确认这一点吗?
Perhaps the problem is not with the statement, but something about the 2nd column of the "uar" table.
Can you try the query with a different table to confirm this?
尝试明确列出所有列并检查所有数据类型 - 特别是 uar 的第二列。
Try listing out all your columns explicitly and review all the data types - particular the second column of uar.
我对 Oracle 不太熟悉(所以我不能说这是否是 Oracle 的具体问题),但也许像这样重新表述你的 SQL 会起作用:
你不应该需要在 s.rid 上进行比较,因为在左侧,crs_screen 将始终包含在左外连接中。
I'm not too familiar with Oracle (so I can't say if it is an Oracle issue specifically), but perhaps rephrasing your SQL like this would work:
You shouldn't need the comparison on s.rid, since being on the left side, crs_screen will always be included in the left outer join.
您运行的是哪个版本的客户端驱动程序? 我的意思是实际的完整版本。 例如,如果您使用 OleDB 与 Oracle 通信,则为 ORAOLEDB.DLL 文件的版本。 例如,是9.2.0.7吗?
Which version of the client driver are you running? By that I mean the actual full version. For instance, if you're using OleDB to talk to Oracle, the version of the ORAOLEDB.DLL file. For instance, is it 9.2.0.7?
我知道这是一个旧线程,但如果其他人遇到“OCI-22060:参数 [2] 是无效或未初始化的数字”问题,我找到了适合我的解决方案。
对于原始光标:
... 的简单重构...
... 有效。 我只需要过滤掉客户端中的虚假行。
I know this is an old thread, but if anyone else is having the "OCI-22060: argument [2] is an invalid or uninitialized number" issue, I've found a solution that works for me.
for the original cursor:
... a simple refactor of ...
... works. I just had to filter out the bogus row in my client.