?
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
Medium Priority
?
2,818 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 143

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

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 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 syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

809 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