Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Location
    India
    Posts
    2

    Unanswered: timeout occurred while waiting to lock object

    i have made a procedure in oracle8i
    and when ever i am running that procedure
    my sqlplus stop responding and if i modify that procedure
    i am getting error
    timeout occurred while waiting to lock object <object name>
    status of my procedure is valid can some one help me in this regards


    my procedure code is


    create or replace procedure stock_update_code
    Is
    Begin
    For c1 in (select distinct depot_code from depot_master) loop
    FOR C IN( SELECT INV_NO,depot_code FROM INVOICE_DETAILS
    WHERE DEPOT_CODE =C1.DEPOT_CODE AND INSTR(INV_NO ,'-')=0 )LOOP
    UPDATE INVOICE_DETAILS SET INV_NO = (c.DEPOT_CODE ||'-' ||C.INV_NO )
    WHERE depot_code=c.DEPOT_CODE;
    END LOOP;
    FOR M IN (SELECT INV_NO,depot_code FROM INVOICE_MASTER
    WHERE DEPOT_CODE =C1.DEPOT_CODE AND INSTR(INV_NO ,'-')=0 )LOOP
    UPDATE INVOICE_MASTER SET INV_NO = (m.DEPOT_CODE ||'-' ||M.INV_NO )
    WHERE depot_code=m.DEPOT_CODE;
    END LOOP;
    End loop;
    EXCEPTION
    WHEN OTHERS THEN
    BEGIN
    NULL;
    END;
    End stock_update_code;

    best regards

    Alpesh Patel

  2. #2
    Join Date
    Jul 2003
    Location
    Near Paris France
    Posts
    60
    Your syntax is not correct,

    you must declare a cursor before using it

    e.g.
    DECLARE
    bonus REAL;
    CURSOR c1 IS SELECT empno, sal, comm FROM emp;
    BEGIN
    FOR c1rec IN c1 LOOP
    bonus := (c1rec.sal * 0.05) + (c1rec.comm * 0.25);
    INSERT INTO bonuses VALUES (c1rec.empno, bonus);
    END LOOP;
    COMMIT;
    END;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •