problem in deleting records from a table. [message #8178] |
Fri, 01 August 2003 01:53 |
Zia Khattak
Messages: 22 Registered: July 2003
|
Junior Member |
|
|
I have problem in deleting records from a table.
Layout of mismst
MI_CON_NO NUMBER(11)
MI_NAME VARCHAR2(25)
MI_ADR_1 VARCHAR2(25)
MI_ADR_2 VARCHAR2(25)
MI_ADR_3 VARCHAR2(25)
MI_ADR_4 VARCHAR2(25)
MI_METR_STS CHAR(1)
MI_DEP_NO NUMBER(11)
MI_METR_NO VARCHAR2(10)
In my master table(mismst) records of different regions consumers are identified by different numbers.
like:
1 for region1
2 for region2
3 for region3
4 for region4
5 for region5
6 for region6
etc.
1st numeric of mi_con_no represent region
and in every region there are million records.
now the problem is i want to delete all records in region 6.
my query is :
DECLARE
CURSOR C1 IS SELECT * FROM MISMST WHERE SUBSTR(MI_CON_NO,1,1) = '6';
CNTR NUMBER(8);
BEGIN
FOR A IN C1 LOOP
BEGIN
CNTR := C1%ROWCOUNT;
DELETE FROM MISMST WHERE MI_CON_NO = A.MI_CON_NO;
IF MOD(CNTR,100) = 0 THEN
UPDATE TMP_COUNTER SET COUNT = CNTR;
COMMIT;
END IF;
END;
END LOOP;
UPDATE TMP_COUNTER SET COUNT = CNTR;
COMMIT;
END;
/
but response of this cursor query is slow.
plz help me if you have another better idea.
|
|
|
|
|
|
|