Without getting into a discussion about whether the business logic should be in the database or at the application layer, since it has been covered elsewhere.
My team is translating 100K+ lines of PL/SQL code and moving the logic from the database into the application. We were using VB6 with straight calls to Oracle 9i Stored Procedures and Ad-hoc queries and are now using C#, .net 3.5, Winforms with NHibernate to an Oracle 9i database.
We have already found a wonderful tool to assist in converting the Ad-hoc queries, SmartCode, but it only creates code based on Tables and Views. We are looking for a tool to assist in converting the Stored Procedures.
The Stored Procedures have most of the Business logic in them that we want to migrate to the application layer. We are wondering if there are any tools to convert the Stored Procedures into C# code.
Assuming there are none, what would be the best place to start if we develop the tool in-house/open source. Is there another similar system with similar goals that could be used as a starting place?
Accepted Answer UPDATE: I have selected scope-creep's answer, because it appears to be the best method for implementing the issue presented in the question. For those that deal with this same issue, I heartedly recommend Adam's response, as he has strongly advocated against the use of a tool and provides a strong rationale. He has also provided the most interaction with this question and had the most up-voted response.
Thank you to everyone for your help and dialog.
One way to do it is to use ANTLR v3, to construct a domain specific language. ANTLR V3 has a PL/SQL Pl/SQL grammer for 10g,11g to construct a lexer/parser for PL/SQL, which would be the first step. A C# 3.0 code generator is available for the backend for C#3.0. The code generator is still under development, but it's in an advanced state.
I don't know how much work would ensue with this approach, but I certainly think it would cost less than doing manual translation.
There is a book available called The Definitive ANTLR Reference: Building Domain-Specific Languages . I know suggesting a book at this time, when you have a sh't load of work to do is crass, but it will give you an idea of the process involved, and perhaps enough to cost the conversion.
There has already been a question on Stack Overflow: Writing a Language Translator which links to the ANTLR Morph project, which is a subproject to define a common translation mechanism. The Doc and FAQ explain how it works. Essentially a script is used to define a translation mechanism. Its in early stages yet, but could be worth a look, as this is a common scenario which has not been addressed as yet.
This example explains how do create tree transformations, i.e. walking the tree to output translated code, found here: Tree Translations, with associated ANTLR documentation: Tree Consuruction
Finding the right compiler engineer would be key to success. I had a look at some sites, and their are a few compiler engineers available. I think it would be less expensive employing 1 or 2 compiler engineers for 3+ months, to do the work than employing than 4+ engineers for 3+ months for manual translation. In the UK you would be looking for a contractor to do it.
Hope that helps Bob.
Edit: 01/08
I've found another book which discusses creating language translators, found here, called Language Implementation Patterns