MySQL Forums
Forum List  »  Stored Procedures

Stored Procedure
Posted by: krishna kin
Date: August 11, 2005 10:46PM

Hi Guys,

need help with this stored procedure. when i execute this stored procedure i am supposed to get the records deleted with the status "completed" ....and so on. but these records are not deleting at all. can you guys tell me what's wrong with this..?


CREATE OR REPLACE PROCEDURE "run_in_rest AS
err_num NUMBER(10);
err_msg VARCHAR2(100);
cursor c1 is select distinct
to_char(CREATED,'dd-mon-yyyy') DDATE
from
CRN_VENDOR_DATA
WHERE STATUS IN ('COMPLETED', ‘REJECTED’,
‘REVIEW CANCELLED’, ‘NOT REVIEWABLE’) AND
BATCH_TYPE = 'DOCUMENT';
begin
for temp in c1 loop
DELETE FROM run_in_rest
WHERE status IN ('COMPLETED', ‘REJECTED’,
‘REVIEW CANCELLED’, ‘NOT REVIEWABLE’) AND
BATCH_TYPE = 'DOCUMENT' and
to_char(UPLOAD_DATE,'dd-mon-yyyy') = temp.DDATE;
commit;
end loop;
DBMS_OUTPUT.put_line('Procedure completed Successfuly.');
EXCEPTION
WHEN CURSOR_ALREADY_OPEN THEN
DBMS_OUTPUT.put_line('Cursor already open');
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.put_line('No records found');
WHEN OTHERS THEN
err_num := SQLCODE;
err_msg := SUBSTR(SQLERRM, 1, 100);
DBMS_OUTPUT.put_line('ErrorNUM:'||err_num||'Message: '||err_msg);
end run_in_rest;

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored Procedure
4931
August 11, 2005 10:46PM
2249
August 12, 2005 06:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.