Our large application (VB.Net, Framework 3.5) was developed more or less from the very beginning of using SQL Server and SQL Server. Of course, one day someone sold it to a client with the promise that we can get him to work on Oracle (10 g and above), and now this is happening, but we have significant performance problems.
This is due to the fact that almost all SQL (contained in the application code) is in parameterized form queries
SELECT Col1, Col2, Col3 FROM TableName WHERE IdCol = @EntityId
It is then passed to our data access layer along with an array of parameter names, an array of types, and an array of values ββand then executed using Enterprise Library 5 to handle the actual connections, etc.
When this project started, someone realized that Oracle requires parameters in the form
:EntityId
and decided that instead of trying to find and rewrite each bit of SQL (only one application contains about a million LOC, and there are others in the package), they would add a function that is called immediately before executing a query that replaces @: as in an array of queries , and in the parameter name. It also removes βWITH NOLOCKβ, square brackets, and replaces the concatenation characters and other similar artifacts that SQL Server uses, but which Oracle does not. The problem with this, of course, is that finding and replacing strings is expensive and at some point a simple action in the application executes more than 2000 simple queries. It takes very little time against SQL Server, but it takes 20-30 seconds against the Oracle platform.
Ideally, I would like to rewrite huge code codes to weed out bad / inefficient code and design and fix the dodgy architecture and replace the batch of nHibernate or Entity Framework. But this will not happen in the near future due to commercial pressure and the size of the task.
Given that Iβm unlikely to make such huge fundamental changes as switching to ORM or redesigning a lot of code, my question is pretty simple:
Is there a way to get SQL Server or Oracle to understand the parameter identifier for another, or some reasonable, easy way to write parameterized queries in a general way without huge amounts of row replacements or IF ... Other statements that depend on the target platform? I understand that I still have to edit almost every SQL statement in the application, but if so, let it be so, I just need to sell the idea to my superiors.
Greetings