CRecordset与Oracle函数一起崩溃 [英] CRecordset crashes with Oracle function

查看:82
本文介绍了CRecordset与Oracle函数一起崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在使用Oracle的ODBC驱动程序通过CRecordset执行select语句时遇到问题.

我的环境是MSVS2008,Oracle 10g DB,Ora ODBC和CRecordset.我在像xxx_pck.funct(p1,p2,pn)这样的语句中有一个计算字段.还有其他各种类型的字段,例如ID,CUSTOMER等.如果第一个字段是类似于SELECT xxx_pck.funct(p1, p2, pn), ID, ... FROM tablename的函数,则CRecordset :: Open将使用无效的标识符崩溃.

如果函数位于SELECT ID, xxx_pck.funct(p1, p2, pn),... FROM tablename之类的其他地方,则一切正常!有人已经收到这个奇怪的错误消息吗? Grants,同义词很好(因为更改列的顺序是可以的).谢谢您的答复!
-mfg-
adam

Hi,

I have a problem with executing a select statement with CRecordset using Oracle''s ODBC driver.

My environment is MSVS2008, Oracle 10g DB, Ora ODBC and CRecordset. I have a computed field in the statement like xxx_pck.funct(p1, p2, pn). There are other fields as well like ID, CUSTOMER, etc. in various types. If the first field is a function like SELECT xxx_pck.funct(p1, p2, pn), ID, ... FROM tablename, then CRecordset::Open crashes with invalid identifier.

If the function is somewhere else like SELECT ID, xxx_pck.funct(p1, p2, pn),... FROM tablename everything''s fine! Have someone already got this strange error message? Grants, synonyms are fine (since changing the order of columns is OK).Thank you for your reply!
-mfg-
adam

推荐答案

我不确定,但是您可以尝试使用-
I''m not entirely sure but you could try this -
SELECT xxx_pck.funct(p1, p2, pn) AS Computed, ID, ... FROM tablename

.


超人,

感谢您的答复,不幸的是,由于我所做的完全相同,因此声明的指定不够,我使用and子句输入了该语句. :(所以SELECT ID, xxx_pck.funct(p1, p2, pn) as COMP, ...

-mfg-
abw
Hi Superman,

thank you for your reply, unfortunately the statement was not specified enough since I did exactly the same, I entered the statement with and AS clause. :( So SELECT ID, xxx_pck.funct(p1, p2, pn) as COMP, ...

-mfg-
abw




如果有人被打扰:我发现了一些东西,不幸的是没有解决的办法. AFX_ODBC_CALL(:: SQLExecute(m_hstmt))创建SELECT语句的方式是,将表名附加到第一个字段.因此,在我们的例子中:SELECT table.xxx_pck.funct(p1, p2, pn),...这显然是无效的.它不存在.如果第一列是表中的现有列,则此错误不存在.也许这是一个ORACLE ODBC驱动程序错误,因为我在MS上进行了尝试,然后出错了:((很遗憾,很多事情没有,我们不得不升级到ORA.)

-mfg-
亚当
Hi,

if someone''s interrested in: I found something, unfortunately not the solution. AFX_ODBC_CALL(::SQLExecute(m_hstmt)) creates the SELECT statement the way, that it appends the tablename to the first field. So in our case: SELECT table.xxx_pck.funct(p1, p2, pn),... which is obvious invalid. It does not exists. If the first column is an existing column in the table, this error not exists. Maybe it is an ORACLE ODBC driver error since I tried it out with the MS one and it goes :( (Unfortunately a lot of things not and we had to upgrade to ORA.)

-mfg-
adam


这篇关于CRecordset与Oracle函数一起崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆