Solved

ORACLE Error 00936

Posted on 2011-03-01
4
398 Views
Last Modified: 2013-12-07
Below is the code I am using in an Access module. I've step through everything and I know the connection works fine; but, I am getting errors at the "ODBCRecordset1.Open" line. I would like to be able to run this each night then loop through the values and paste them into another table (in access). I have done this succesfully with other Oracle DB's but cant seem to get this one to work. The errors I get most frequenty are "ORA-00936 - Missing Expression" and "ORA- 00933 - SQL not properly ended"
Also, initially there were some WHERE clauses but even after I removed them I got the same errors

Any help would be great.



Public Function Connect()

Const adlockoptimistic = 3
Const adopenstatic = 3
Const aduseclient = 3


Dim ODBCConnectionString
Dim ODBCRecordset1


Set ODBCConnectionString = CreateObject("ADODB.connection")
Set ODBCRecordset1 = CreateObject("ADODB.recordset")



ODBCConnectionString.Open "Driver=Microsoft ODBC for Oracle;Server=-----;Uid=----;Pwd----;"
ODBCConnectionString.CommandTimeout = 1200
ODBCRecordset1.Open "SELECT [TECSDAT-XLPD].[PKG_XCP_RPT_DT], [TECSDAT-XLPD].[PKG_XCP_RPT_CNY_CD], [TECSDAT-XLPD].[PKG_TCK_NR], [TECSDAT-XLPD].[PKG_XCP_RSN_CD], [TECSDAT-XLPD].[SHR_AC_NR] FROM [TECSDAT-XLPD]", ODBCConnectionString, adopenstatic, adlockoptimistic


ODBCConnectionString.Close

End Function

Open in new window

0
Comment
Question by:JClayton7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35008931
in Oracle, don't use [object _name], but "object_name"

0
 
LVL 15

Expert Comment

by:Aaron Shilo
ID: 35010053
hi
line 19 is wrong

fix : ODBCRecordset1.Open "SELECT TECSDAT-XLPD.PKG_XCP_RPT_DT, TECSDAT-XLPD.PKG_XCP_RPT_CNY_CD, TECSDAT-XLPD.PKG_TCK_NR, TECSDAT-XLPD.PKG_XCP_RSN_CD, TECSDAT-XLPD.SHR_AC_NR FROM TECSDAT-XLPD", ODBCConnectionString, adopenstatic, adlockoptimistic


0
 

Accepted Solution

by:
JClayton7 earned 0 total points
ID: 35010331
Thanks everyone! Ended up being t."fieldname" - I think its a table alias problem
0
 

Author Closing Comment

by:JClayton7
ID: 35431187
Figured out the answer before anyone posted it
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question