简体   繁体   English

使用 VBA 运行 Oracle 查询

[英]Run Oracle Query using VBA

When i run the below script i'm getting "TYPE MISMATCH" Error当我运行以下脚本时,出现“TYPE MISMATCH”错误

'Getting error when i execute below code '当我执行下面的代码时出错

query1 = "Select count(*) from test" & _
Query2 = query1 & "where proc_d" & _
Query3 = Query2 & "IN('10 jun 2015')"

The reason for your error is that你的错误的原因是

query1 = "Select count(*) from test" & _
Query2 = query1 & "where proc_d" & _
Query3 = Query2 & "IN('10 jun 2015')"

becomes变成

query1 = "Select count(*) from test" & Query2 = query1 & "where proc_d" & Query3 = Query2 & "IN('10 jun 2015')"

after combining lines together.将线条组合在一起后。

Change it to将其更改为

query1 = "Select count(*) from test " & _
         "where proc_d " & _
         "IN('10 jun 2015')"

Note also the addition of the extra space after the words "test" and "proc_d".还要注意在单词“test”和“proc_d”之后添加了额外的空格。 Without those spaces the SQL command will be constructed, but will be invalid.如果没有这些空格,将构造 SQL 命令,但将无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM