473,327 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

ORA-00911: Invalid character when using ADO and OraOLEDB.Oracle in Excel VBA

1
Hi,

I'm getting the ORA-00911:invalid character when trying to do a query to a Oracle database from a Excel VBA Macro.

I'm using the following code extraction:

----BEGIN CODE-----
Sub GDataTeste()

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Dim sSQLQuery As String

cn.Open "PROVIDER=OraOLEDB.Oracle;DATA SOURCE=ORADS;USER ID=userX;PASSWORD=******;"

sSQLQuery ="SELECT DW.F_DIST.DIA_ID_CALENDARIO_DW " & _
"FROM DW.F_DIST " & _
"WHERE (((DW.F_DIST.CLIENTE_DIST_ID_CLIENTE_DW) = 2388) And ((DW.F_DIST.DIA_ID_CALENDARIO_DW) = 3223)) " & _
"GROUP BY DW.F_DIST.DIA_ID_CALENDARIO_DW;"

rs.Open sSQLQuery, cn

----END CODE-----

The error shows up during the OPEN of the recordset which is done in the last statement of the above code: "rs.Open sSQLQuery, cn"

The full error is:
"Run time error '-2147217900 (80040e14)':
ORA-00911: invalid character"

If a use the same SQL construction above in ORACLE SQL*PLUS it works with no problem.

Any help is apreciated as i've searched everywher for a solution without success.

Regards
Joper
Oct 16 '06 #1
5 20679
gc1010
1
remove he semicolon(;) frm the sql command...and c it run....:)
Sep 21 '07 #2
QVeen72
1,445 Expert 1GB
Hi,

REmove Semicolcon at the end.
and If not using any Aggregate Functions in the query, why use "Group"..?
Instead use "Distinct" keyword:

Expand|Select|Wrap|Line Numbers
  1. sSQLQuery ="SELECT Distinct DW.F_DIST.DIA_ID_CALENDARIO_DW " & _
  2. "FROM DW.F_DIST " & _
  3. "WHERE (((DW.F_DIST.CLIENTE_DIST_ID_CLIENTE_DW) = 2388) And ((DW.F_DIST.DIA_ID_CALENDARIO_DW) = 3223)) "
  4.  
REgards
Veena
Sep 21 '07 #3
Davz
1
@gc1010
Thank you!
5.5 years later and your post is saving me more headache! Basically just retyped my entire 2 page query and was about to pull my hair out.
Apr 1 '13 #4
@gc1010
... and another 2 years later gc1010's response is the gift that keeps on giving.

I joined Bytes just to leave this comment - so much stress avoided!
May 15 '15 #5
@gc1010
Almost a decade later and this response just saved me from hours of beating my head against the wall.

Thank you gc1010!
Aug 24 '16 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Galina | last post by:
Hello I have created a trigger not to let records with certain fields null to be inserted into the table: BEGIN IF :new.RUL_CODE is null or :new.FES_UINS_CODE is null or :new.FES_UIO_CALOCC is...
6
by: bdj | last post by:
Hello! I have at set of tnsnames.ora. I wich to make an union, e.g. a single file of it. How can I do that easy? Greetings Bjørn
3
by: Michael John | last post by:
Hey, how can I get ORA-..... error messages in languages other than english. I did a alter session set NLS_LANG='GERMAN_GERMANY.WE8ISO8859P1'; but this only threw an ORA-00922. Or I'm wrong...
1
by: jkstexas2001 | last post by:
Could someone be of assistance and show me the problem with the following code? I have researched Metalink regarding ORA-29531, and the most common cause of this error is the failure to declare the...
3
by: nirop | last post by:
Hi, I have a problem with my control files not matched. I checked my alert log and noted the following error message ' ORA-214 signalled during: alter database mount exclusive...' I did an err...
0
by: prasannakhapli | last post by:
I am invoking one Package Procedure in a PLSQL Block.The Procedure is PROCEDURE createFault( reportedBy IN varchar2, reportedDate IN date, description ...
5
by: ravi | last post by:
Hello, I have the following piece of code in my server written in C++ (CC: Sun WorkShop 6 update 2 C++ 5.3 Patch 111685-12 2002/12/16) ProC++ (Pro*C/C++: Release 8.1.7.4.0) ...
1
by: rajukk200 | last post by:
Dear seniors, While starting up database I am getting "ORA-03113 End-of-file in communication channel" error. In alert log the following error is logged. ORA-07445: exception encountered:...
2
by: hemantmudaliar | last post by:
The Trigger is giving following exception java.sql.SQLException: ORA-04091: table PSCONTENT.VGNASCHANNEL is mutating, trigger/function may not see it ORA-06512: at...
1
by: dabikerdevil | last post by:
I was getting this error: ORA-12545 I changed the host name to numerical IP address in TnsNames.Ora Now I am getting the following error: ORA-12500. how do I solve these errors. Kindly Reply.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.