Pro*C to Stored Proc

Our development team is currently coding some new features into the system. A senior developer got assigned a couple tasks to complete. I performed the design for one of these tasks. And I provided the design to the developer. I purposefully left the database technology out of the design. This was because I figured it would be easiest for the developer to use a technology they were familiar with. The task got broken up and assigned to one other developer as well. The first guy decided to use Pro*C to access the database. He figured this was the easiest for him.

The application being modified already uses Pro*C for some of its database access. So a decision to use Pro*C did not seem unusual. And I knew that this particular developer was familiar with it. However the other developer requested that the common code be put in a PL/SQL stored procedure. That way it could be written once. This stored procedure could be called from the Pro*C function. And since this guy was the team lead, he made the final call. The other developer expressed reservation about this decision. As a result, the coding task got reassigned to me.

Personally I love writing code in PL/SQL. And I figured it was no big deal to call a stored procedure in Pro*C. You just do something like this:

EXEC SQL EXECUTE
BEGIN
pkg.proc(:var);
END;
END-EXEC;

There were other examples of this pattern in the code for the application being modified. So I coded in those hooks. I also wrote the common PL/SQL back end stored procedure. The procedure was actually quite easy to code. I knew we made the right decision when the database table being accessed got some column name changes. I just modified the stored procedure and everything worked fine.

Maybe the original developer did not want to agree with our team lead. I normally do not take this stance. It is fun to write code. A good developer should be able to write the code in any language and with any technology. Those details are usually not important. Calling a stored procedure in a package from Pro*C is also easy. I think I might give the link to this blog post to the original developer. He might learn a thing or two. And I am not talking about Pro*C syntax.