Re: PROC Problem : Select for update

From: Wario <r0cky_at_insightbb.com>
Date: 27 Aug 2004 06:30:41 -0700
Message-ID: <9204a53e.0408270530.583cb22f_at_posting.google.com>


> >
> > Try using PL/SQL
> >
> > declare
> > cursor work_cur is
> > SELECT CHAMP1 FROM TAB1 WHERE CHAMP2="4" AND CHAMP3 = "C" FOR UPDATE;
> > begin
> > for x in work_cur loop
> > update tab1 set champ1 = 'test'
> > where current of work_cur;
> >
> > end loop;
> >
> > commit;
> > end;
> > /
>
>
> Why use the declare?
>
> begin
> for x in (
> SELECT CHAMP1
> FROM TAB1
> WHERE CHAMP2="4"
> AND CHAMP3 = "C" FOR UPDATE
> )
> loop
> update tab1 set champ1 = 'test'
> where current of work_cur;
>
> end loop;
>
> commit;
> end;

Danes,

I like declares. In this case I use it to add readability, as long as performance is not affected. Your suggestion works great though.

Wario Received on Fri Aug 27 2004 - 15:30:41 CEST

Original text of this message