in reply to Re^2: No stored procedure bashing on my watch!
in thread Recoding a multi-sql-statement storedProc transaction in a script

I feel like poor Paco.

I fully understand the value of storedProcs, and the value of abstracting, and the value of not using SQLs in the scripts, etc. I merely wanted to find out how to replicate a multi-command SQL proc in my script, because, well..., because I wanted to.

I have come to the conclusion that it is messy to do so because DBI doesn't seem to provide the ability of abstracting the transactions for me, but that is a good and valuable conclusion.

Now, I have a minor quibble to pick with the above post.

Besides from the reasons given by other people, it gives database people the opportunity to re-organize the data layout (add/delete columns, split tables) without having to modify an unknown number of programs - all that's needed is to change the relevant stored procedures.

Well, what the heck are storeprocs other than an "unknown number of programs?" I can't see how the db structure can be changed, and yet storedProcs can prevent any pain? Whether I get to the data via a SQL statement in my Perl script, or via a storedProc in the database called from my Perl script, somewhere, someone will have to change something.

I think the dba types tend to think one way only -- that the world depends on the database they are custodians of. While that may be true in their realm, there are tons of small programs and processes that are run using databases where the dba can't do everything. The programmer has to find ways to do things in a variety of ways.

That is the kind of situation I ran into.

Anyway, thanks everyone for the input. Every bit helps.

  • Comment on Re^3: No stored procedure bashing on my watch!

Replies are listed 'Best First'.
Re^4: No stored procedure bashing on my watch!
by Anonymous Monk on Dec 17, 2004 at 09:41 UTC
    Well, what the heck are storeprocs other than an "unknown number of programs?"
    They are a known number of programs, all written in the same language, and stored centrally. Given a database, it's very easy to extract out all its stored procedures - and its quite easy to find out which tables each stored procedure touches. But if the SQL is scattered around over many applications, written in a myriad of languages, all running somewhere on the network (and for some organizations, the "network" can consist of thousands of machines), it's much harder to get everything updated if the schemas change.
      and so is a finite number of Perl scripts with SQL "scattered" around in them a known number of programs, all written in the same language, just happened to be stored "externally."

      There are many conditions in which the argument to access everything via storedProcs would apply, but there are many conditions in which not to do so would also apply.

      case closed.