Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Avoiding repeating code in PL/SQL DML
DA Morgan wrote:
> Martin T. wrote:
> > Hey all. (Oracle 9.2.0.1.0 on Windows XP)
> >
> > I have the following DML in my PL/SQL code:
> > ----
> > (snipped)
> > ----
> >
> > As you see, I use the same nested subquery twice in that delete
> > statement.
> > Since repeating code by c&p is rather evil in my opinion I would like
> > to know how to avoid such constructs. (_Especially_ if I have that
> > range SELECT from measures... appear a few more times in my PL/SQL
> > package)
> >
> > (snipped)
>
> In 10g I'd recommend using the WITH clause. In 9i an inline view.
>
> But is this a real problem or just a matter of elegance?
> --
> Daniel A. Morgan
Thanks for the tip.
C&P code is a matter of evil. ;-)
Seriously, I believe that when I have to resort to a lot of C&P then either I'm not skilled enough in the language (which may well be the case here) or the language does miss some important features.
If I have a solution where I do C&P code and I have a solution where I do not have to, then I will use the latter, even if it's 5 times slower. (Well, erm, if that slower doesn't break things of course ... I know that there's a thing like reality :)
best,
Martin
Received on Mon Jul 31 2006 - 10:41:13 CDT