- 3,715,654 Users
- 2,242,821 Discussions
- 7,845,480 Comments
Forum Stats
Discussions
Categories
- 17 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 467 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 3 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 416 SQLcl
- 42 SQL Developer Data Modeler
- 184.8K SQL & PL/SQL
- 21K SQL Developer
- 1.9K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 8 DevOps
- 3K QA/Testing
- 247 Java
- 5 Java Learning Subscription
- 10 Database Connectivity
- 66 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 30 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 3 Deutsche Oracle Community
- 10 Español
- 1.9K Japanese
- 2 Portuguese
How to avoid query rewrite with Oracle.ManagedDataAccess.Client.OracleDataAdapter
Hi everybody,
I am developing my own tool that allows me to optimize SQL queries. One of the features shows the execution plan of an executed query, just as I want if (I have some special needs on how to represent an execution plan). This tool uses the Oracle.ManagedDataAccess.Client.OracleDataAdapter component. Here is an example :
this.daPlans.SelectCommand.CommandText = myTextbox.Text;
this.daPlans.Fill (this.resultTable);
My problem is the following: in my textbox, I write a query that I retrieved from the ORACLE logs. The original query is executed from SQL Developer or another software. I want to get exactly the same SQL_ID as the original query because I want the same execution plan to be chosen by the optimizer. But although I type exactly the same query in my myTextbox, the OracleDataAdapter component replaces some characters at runtime (I can see it in ORACLE logs) such as carriage returns by spaces. As an issue I am not getting the same SQL_ID as the original query and another execution plan is chosen. The original query runs from a software that does not use .NET.
How can I make the OracleDataAdapter component not replace characters and strictly respect my query as it's written in my textbox ? I have had a look at all the properties avaliable on the adapter ans command objects but didn't find anything.
Here is an example of what I get from ORACLE logs of the same query ran from SQL Developer and my tool ;
Original Query :
SELECT ITEM.*
FROM ITEM
Here is the result from SQL Developer and my tool
This is the simplest example I can do. You can see that the OracleDataAdapter has modified the original query by using another carriage return than the orginal. But replacing carriage returns is not enough. The OracleDataAdapter has a kind of own formating on the final query. For example, if in my orginal query I have somewhere 5 spaces, the OracleDataAdapter decides to put 4 spaces instead. Here is an example :
Have you any idea of how I can get out with this ? I upgraded to the last version of Oracle ADO .NET components, but my issue is still there.
Thank you for your help.
Best regards.
MS