Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> URGENT: Problem with cursor

URGENT: Problem with cursor

From: Joan Sanchez <joan.sanchez_at_estamp.es>
Date: Tue, 26 Aug 2003 08:23:10 +0200
Message-ID: <bieuch$755$1@nsnmpen2-gest.nuria.telefonica-data.net>


Hello,

When I execute the following code, the cursor doesn't retreive any row, but If I execute the select in svrmgrl a row is retrevied to me.

Does anyone know the reason?

Thank you.

Joan Sánchez

      cursor cLOCK(plILCK baan.ttisfc962998.t$ilck%TYPE, plETID baan.ttisfc962998.t$etid%TYPE) is

            select t$item,t$cdad from ttisfc962998 where t$etid<>3 and t$ilck=14 and rownum=1;

        sITEM_LOCK baan.ttisfc962998.t$item%TYPE;
        lCDAD_LOCK baan.ttisfc962998.t$cdad%TYPE;
        sITEM_2_LOCK baan.ttisfc962998.t$item%TYPE;
        lCDAD_2_LOCK baan.ttisfc962998.t$cdad%TYPE;
    BEGIN
        update ttisfc962998 set t$ilck=lILCK where t$etid=lETID and
t$ilck=0;
        if SQL%FOUND then   /* Si se modifica devolver un rdo */
            open cLOCK(lILCK,lETID);
            if cLOCK%FOUND then
                fetch cLOCK into sITEM_LOCK, lCDAD_LOCK;
                select t$item, t$cdad into sITEM_2_LOCK,lCDAD_2_LOCK from
baan.ttisfc962998 where t$etid=lETID;
                if sITEM_2_LOCK <> sITEM_LOCK then      /* Como el art es
diferente -> rollback */
                    update baan.ttisfc962998 set t$ilck=0 where t$ilck=lILCK
or t$etid=lETID;
                    return 3;       /* Artículo diferente con 1º et.int. de
la secuencia */
                end if;
                if lCDAD_2_LOCK <> lCDAD_LOCK then      /* Como la cdad es
diferente -> rollback */
                    update baan.ttisfc962998 set t$ilck=0 where t$ilck=lILCK
or t$etid=lETID;
                    return 2;       /* Cdad diferente con 1º et.int. de la
secuencia */
                end if;
                return 0;           /* Etiq.int. bloqueada y comprobada */
            else
                return 0;           /* Al ser la primera etiq.int. y
bloquearse, se devuelve OK */
            end if;
        else
            update ttisfc962998 set t$ilck=0 where abs(t$ilck)=lILCK;
            return 1;
        end if;
    EXCEPTION
       WHEN others THEN
           return 4;

    END;     FUNCTION UNLOCK_ALL RETURN NUMBER IS     BEGIN
        update baan.ttisfc967998 set t$ilck=0;      -- Etiq.Odettes LANZADAS
        update baan.ttisfc962998 set t$ilck=0;      -- Etiq.Internas
LANZADAS
        update baan.ttisfc963998 set t$ilck=0;      -- Etiq.Internas
UBICADAS
        update baan.ttisfc964998 set t$ilck=0;      -- Etiq.Internas
PREPARADAS
        RETURN 1;
    EXCEPTION
        WHEN OTHERS THEN
            RETURN 0;

    END; Received on Tue Aug 26 2003 - 01:23:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US