Solved

Getting "Syntax Error: Expecting identifier or quoted identifier." exception when trying to use DataAdapter.FillSchema() on an Oracle Database

Posted on 2009-05-08
5
2,633 Views
Last Modified: 2013-12-18
I am working an a Visual Studio 2008 C# application connecting to an Oracle 10.2 database using built in .NET data object for Oracle.

My code as exists looks like:

da.FillSchema(sourceDt, SchemaType.Mapped);



When I run this code, I get the following exception: "Syntax Error: Expecting identifier or quoted identifier."

The SQL that is being run is: select * from (SELECT * FROM company) OracleTestSQL

This select works correctly when run directly against the database when using a tool like DBVisualizer.

The code also works perfectly, without generating any exception when I change it to the following:

da.Fill(sourceDt);



Granted, I could just use that last bit of code, but for reasons of speed and latency, I want to only get the schema/data that I need, rather then alot of extra data.

Any help/suggestions would be greatly appreciated! Thanks in advance!

Aaron@Exago

0
Comment
Question by:StewartMeyers
  • 3
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24339453
cna you please explain why you run that subquery?
or is that just a sample or what you really want to run?

listening...
0
 

Author Comment

by:StewartMeyers
ID: 24339511
That SQL sample was just a testing sample. It can be any possible sub query, but in my testing, I just happened to use a basic sub select in the overall select.

The application needs to be any type of sub select and or joins, etc and treat it as a data object.

Hopefully that helps to clarify.
 
 
0
 
LVL 6

Expert Comment

by:RPCIT
ID: 24339512
try explicitly defining the field names in the select...

select field1, field2, field3, field4, from (SELECT * FROM company) OracleTestSQL


The scheme mapping may not know how to deal with the wildcard field operator
0
 

Author Comment

by:StewartMeyers
ID: 24339572
Thanks RPCIT, but I wouldn't worry about the select *. It's standard SQL and works (and generates the proper rows/data) in any other SQL editor connecting to the same database using the same database connector (I'm using DBVisualizer). If the schema mapping didn't know how to deal with the wildcard, I would think it would also throw the error in any tool.

Thanks again.
0
 

Accepted Solution

by:
StewartMeyers earned 0 total points
ID: 24369433
I found found the answer to the problem myself. The code works just fine if I use the Oracle provided .NET Data Adapter instead of using Microsoft's provided Data Adapter for Oracle.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Salesforce.com is a cloud-based customer relationship management (CRM) system. In this article, you will learn how to add and map custom lead and contact fields to your Salesforce instance.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to recover a database from a user managed backup

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now