473,785 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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.Connectio n
Dim rs As New ADODB.Recordset

Dim sSQLQuery As String

cn.Open "PROVIDER=OraOL EDB.Oracle;DATA SOURCE=ORADS;US ER ID=userX;PASSWO RD=******;"

sSQLQuery ="SELECT DW.F_DIST.DIA_I D_CALENDARIO_DW " & _
"FROM DW.F_DIST " & _
"WHERE (((DW.F_DIST.CL IENTE_DIST_ID_C LIENTE_DW) = 2388) And ((DW.F_DIST.DIA _ID_CALENDARIO_ DW) = 3223)) " & _
"GROUP BY DW.F_DIST.DIA_I D_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 20734
gc1010
1 New Member
remove he semicolon(;) frm the sql command...and c it run....:)
Sep 21 '07 #2
QVeen72
1,445 Recognized Expert Top Contributor
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 New Member
@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
mouse71
1 New Member
@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
GrapeApe
1 New Member
@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
26790
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 null then RAISE_APPLICATION_ERROR(-20000,'Record is not saved. Check course record and try to save again.'); end if;
6
4697
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
22798
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 and NLS_LANGUAGE and NLS_TERRITORY doesn't have an effect on the text of ORA- error messages at all?
1
7865
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 method "public" and "static". I have done both here and still have the same error: Java Code:::::::::::::::::::::::::::::::::::::::::::::: CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "TimeZoneFormatter" AS import java.util.TimeZone;
3
17424
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 on ORA-214 and noted the following: 00214, 00000, "control file '%s' version %s inconsistent with file '%s' version " // *Cause: Versions of control files and datafiles/logfiles mismatch // *Action: Use same version of control files and...
0
7082
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 IN varchar2, priority IN number, workgroup IN WorkgroupID,--Subtype as varchar2(20) creatingUser IN UserID,--subtype as varchar2(40) faultAttributes IN ...
5
4445
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) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RWCString tmp = ""; EXEC SQL BEGIN DECLARE SECTION; char dbColValue;
1
4381
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: core dump Please help me out in this regards.
2
6324
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 "PSCONTENT.CHECK_CHANNEL_UNPUBLISH", line 4 ORA-06512: at "PSCONTENT.CHECK_CHANNEL_UNPUBLISH_TR", line 1 ORA-04088: error during execution of trigger ................................ // Trigger CREATE OR REPLACE TRIGGER check_channel_unpublish_tr before delete ON...
1
3349
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
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.