cursor Error " " Comparison of records

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Tue, 29 Dec 2009 10:55 am

Good morning guys ... I got a problem.

I created is now the first procedure she was to do the following: Verify that the current registry value is greater than the value of the next record, if you're going to add the two values otherwise the current record will receive zero.

But it is showing an error.

Error (3.1): PLS-00103: Encountered the symbol " (" \"when expecting one of the following: begin function package pragma procedure subtype type use an identifier < > < a double-quoted delimited-> form current cursor external identifier language
Code: Select all
create or replace
PROCEDURE STP_PARC_ABE IS
(
   @VLR_PRINC NUMBER (20,2),
   @CTR_LIB   NUMBER (20)
)
DECLARE
  CURSOR C_PRINCIPAL
      IS
        SELECT CONCAT(CONCAT(NM_CONTRAT,'/'),NM_LIBERAC) CTR_LIB,VLR_PRINC     
          FROM ZZ_PARCELA_ABERTA
        ORDER BY CTR_LIB,NM_PARCELA
        FOR UPDATE OF VLR_PRINC;

BEGIN



OPEN C_PRINCIPAL;
LOOP
     
     FETCH C_PRINCIPAL INTO @VLR_PRINC,@CTR_LIB;
     EXIT WHEN C_PRINCIPAL%NOTFOUND;

      @VLR_PRINC = VLR_PRINCIPAL;
      @CTR_LIB = CTR_LIB;

    IF (@CTR_LIB = CTR_LIB) THEN
      IF (VLR_PRINC > @VLR_PRINC) THEN
          @VLR_PRINC := @VLR_PRINC + VLR_PRINC;     

      ELSE

        IF (VLR_PRINC < @VLR_PRINC) THEN
          UPDATE ZZ_PARCELA_ABERTA
          SET @VLR_PRINC = 0;

      END IF;
    END IF;

      UPDATE ZZ_PARCELA_ABERTA
           SET VLR_PRINC = @VLR_PRINC;

    END LOOP;

CLOSE C_PRINCIPAL;
DEALLOCATE C_PRINCIPAL;

  COMMIT;

END STP_PARC_ABE;
what is IT?
EvertonKopec
Location: Curitiba

É isso aí...

Poston Tue, 29 Dec 2009 12:26 pm

Is that the syntax is wrong: I don't know why you use the @ lá, never used.

You don't need to declare.

And is is after the Declaration of the parameters
Code: Select all
PROCEDURE STP_PARC_ABE( VLR_PRINC NUMBER (20,2),
CTR_LIB NUMBER (20)
) IS
CURSOR ....
SergioLBJr
Location: Parobé - RS

Sérgio Luiz Bonemberger Junior
Programador Junior
Parobé RS

[]s

Poston Tue, 29 Dec 2009 12:42 pm

@ MEAN IS A VARIABLE USED IN THE CURSOR.
EvertonKopec
Location: Curitiba

É isso aí...

Poston Tue, 29 Dec 2009 5:12 pm

Same thing here: viewtopic.php?t=5510&highlight=nomes variable name cannot begin with arroba.

It would be something (without describe number and accuracy in varchar2 parameters as well):
Code: Select all
   
create or replace
PROCEDURE STP_PARC_ABE IS
(
VLR_PRINC OUT NUMBER,
CTR_LIB OUT NUMBER
)
DECLARE
CURSOR C_PRINCIPAL
IS
SELECT CONCAT(CONCAT(NM_CONTRAT,'/'),NM_LIBERAC) CTR_LIB,VLR_PRINC
FROM ZZ_PARCELA_ABERTA
ORDER BY CTR_LIB,NM_PARCELA
FOR UPDATE OF VLR_PRINC;

BEGIN
...
fsitja
Location: Gaúcho no Rio de Janeiro - RJ

"The scars exist to remind us that the past was real"
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html

OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist

Poston Tue, 29 Dec 2009 5:13 pm

Sorry, but you can't edit the message. No DECLARE also on procedure.

Code: Select all
create or replace PROCEDURE STP_PARC_ABE IS
(
VLR_PRINC OUT NUMBER,
CTR_LIB OUT NUMBER
) AS
CURSOR C_PRINCIPAL IS
...
fsitja
Location: Gaúcho no Rio de Janeiro - RJ

"The scars exist to remind us that the past was real"
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html

OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist

Poston Tue, 29 Dec 2009 5:14 pm

Bah ... the Strip IS between the name of the procedure and the bracket too, please, I'm tired I think ...: roll:
fsitja
Location: Gaúcho no Rio de Janeiro - RJ

"The scars exist to remind us that the past was real"
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html

OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist

Poston Wed, 30 Dec 2009 7:32 am

Just a question, my brothers, the procedure of the utterance was SQL Server, correct?
In any way I can help, I'm back to the Forum.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP


  • See also
    Replies
    Views
    Last Post