How Best to Replace Ugly Queries and Dynamic PL/SQL with C#?

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-20T01:12:15Z Indexed on 2010/05/20 1:20 UTC
Read the original article Hit count: 205

Filed under:
|
|
|

Hi,

I write a lot of one-off Oracle SQL queries (in Toad), and sometimes they can get complex, involving lots of unions, joins, and subqueries, and sometimes requiring dynamic SQL. That is, sometimes SQL queries require set based processing along with significant procedural processing. This is what PL/SQL is custom made for, but as a language it does not begin to compare to C#. Now and then I convert a PL/SQL procedure to C#, and am always amazed at how much cleaner and easier to both read and write the C# version is. The C# program might for example construct a SQL query string piece by piece and/or run several queries and process them as needed. The C# version is usually much faster as well, which must mean that I'm not very good at PL/SQL either. I do not currently have access to LINQ.

My question is, how best to package all these little C# programs, which are really just mini reports, that is, replacements for ugly SQL queries? Right now I'm actually using NUnit to hold them, and calling each report a [Test], even though they aren't really tests. NUnit just happens to provide a convenient packaging framework.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Oracle