Re: Update 100 rows and sleep for 60 sec

From: Balwanth B <balwanthdba_at_gmail.com>
Date: Tue, 28 Mar 2017 14:11:38 -0400
Message-ID: <CAL72EnAaXtTa_F=jfH-QFpyYjObCakyLgs0xQhBWd+Jy+qPfRw_at_mail.gmail.com>



getting below error

ERROR at line 10:

ORA-06550: line 10, column 19:
PLS-00225: subprogram or cursor 'REC_CUR' reference is out of scope
ORA-06550: line 10, column 1:

PL/SQL: Statement ignored

On Tue, Mar 28, 2017 at 1:04 PM, Balwanth B <balwanthdba_at_gmail.com> wrote:

> I have modified something like below.. application operation takes place
> with that update device gets activated so i need to give some time gap for
> that.
>
> declare
> CURSOR REC_CUR IS
> select serialnumber from hdm_mon.TEMP_CDSERIAL
> TYPE ROWID_T IS TABLE OF VARCHAR2(50);
> ROWID_TAB ROWID_T;
> BEGIN
> OPEN REC_CUR;
> LOOP
> FETCH REC_CUR BULK COLLECT INTO ROWID_TAB LIMIT 100;
> EXIT WHEN REC_CUR.COUNT=0;
> FORALL I IN 1.. ROWID_TAB.COUNT
> update device set activated=1 where activated =0 and managed =1 and id=
> ROWID_TAB(I);
> COMMIT;
> dbms_lock.sleep(30);
> END LOOP;
> CLOSE REC_CUR;
> commit;
> END;
>
>
> Does this look good?
>
> On Tue, Mar 28, 2017 at 12:59 PM, Powell, Mark <mark.powell2_at_hpe.com>
> wrote:
>
>> See DBMS_LOCK.SLEEP(n)
>>
>>
>> where N is how many seconds you want the process to sleep. Though what
>> is the point of sleeping.
>> ------------------------------
>> *From:* oracle-l-bounce_at_freelists.org <oracle-l-bounce_at_freelists.org> on
>> behalf of Balwanth B <balwanthdba_at_gmail.com>
>> *Sent:* Tuesday, March 28, 2017 12:16:07 PM
>> *To:* ORACLE-L
>> *Subject:* Update 100 rows and sleep for 60 sec
>>
>> I am looking for script which will update
>>
>>
>> Update 100 rows
>> commit
>> sleep
>> then next update 100 rows
>> follow the same pattern
>>
>> I have something like below but how do I make sure it sleeps for
>> mentioned time and does the next 100 rows.
>>
>> *declare*
>> *CURSOR REC_CUR IS*
>> *select statement;*
>> *TYPE ROWID_T IS TABLE OF VARCHAR2(50);*
>> *ROWID_TAB ROWID_T;*
>> *BEGIN*
>> *OPEN REC_CUR;*
>> *LOOP*
>> *FETCH REC_CUR BULK COLLECT INTO ROWID_TAB LIMIT 5000;*
>> *EXIT WHEN REC_CUR%NOTFOUND;*
>> *FORALL I IN 1.. ROWID_TAB.COUNT*
>> *update statement*
>> *COMMIT;*
>> *END LOOP;*
>> *CLOSE REC_CUR;*
>> *END; *
>>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Mar 28 2017 - 20:11:38 CEST

Original text of this message