oracle表具有时间戳时,vba ODBC给出了Unspecified错误 [英] vba ODBC gives Unspecified error when oracle table is having timestamp
问题描述
我有vba代码,可通过 ODBC 将Oracle表数据提取到记录集中.但是,如果oracle表中包含timestamp字段,则会显示一些未指定的错误.
I have vba code to fetch Oracle tables data in to a recordset via ODBC. But it shows some unspecified error if the oracle table is having timestamp field in it.
我有100多个表,我不知道哪个表会有时间戳. 我正在循环查询下运行以检索数据.
I have 100+ table i dont know which table will have timestamp. I am running below query in loop to retrieve data.
Query = "Select End_Time from MyTable" 'this table has End_Time timestamp(6) field
CmdSQLData.CommandText = Query
CmdSQLData.CommandType = adcmdText
CmdSQLData.Timeout=0 set rs = CmdSQLData.Execute() 'This line shows unspecified error then the table is having timestamp field
'Then code for store data here...
运行时错误'-2147467259(80004005)';未指定的错误
Oracle表结构为:
Oracle Table structure is :
create table MyTable (
Date_id Integer,
Date_Today Date,
End_Time Timestamp(6)
)
请不建议
从my_table中选择to_char(时间戳字段)
select to_char(timestamp_field) from my_table
如果我在上面进行查询,那么问题就不会出现. 我需要永久性代码来处理Recordsets中的时间戳,因为我可能不知道该表是否具有时间戳字段,因为我有100多个表
If i do above query, then the problem is not coming. I need permanent code to handle Timestamps in Recordsets because i may not know whether the table is having timestamp field or not as i have 100+ tables
推荐答案
You may be running into something like the following: https://forums.oracle.com/forums/thread.jspa?messageID=4210331
尝试升级ODBC客户端.
Try upgrading your ODBC client.
这篇关于oracle表具有时间戳时,vba ODBC给出了Unspecified错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!