In my work application, I use a mini language to express updates to the database schema, and I have code to parse that out and execute the necessary SQL. Here's a part of the update we used when we were moving to referencing users by id instead of by handle:

desc: category mod/ed referenced by id table: change moderator moderator_handle varchar(32), + change editor editor_handle varchar(32) table: add moderator int(11) unsigned not null, + add editor int(11) unsigned not null [loop: (uid, uhandle) select distinct u.id, u.handle + from users u, category c + where u.handle = c.moderator_handle or u.handle = c.editor_handl +e pop: update category set moderator = *uid where moderator_handle = + *uhandle pop: update category set editor = *uid where editor_handle = *uhan +dle ] table: drop moderator_handle, drop editor_handle

The code doing this is complex and intimately tied up with a lot of other stuff, so I'm not going to try to post it here. But I see no reason why you couldn't do something similar to parse the stored procedures and execute them directly - it'll take some pain to get the code working, but once you've done that you'll have the benefit that you only need to develop and maintain one version of each stored procedure.

Hugo


In reply to Re: Recoding a multi-sql-statement storedProc transaction in a script by hv
in thread Recoding a multi-sql-statement storedProc transaction in a script by punkish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.