Click here to Skip to main content
15,891,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 12-Jun-10 22:29pm
v2

I'm not entirely sure but you could try this -
SELECT xxx_pck.funct(p1, p2, pn) AS Computed, ID, ... FROM tablename
.
 
Share this answer
 
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
 
Share this answer
 
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900