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

Home -> Community -> Usenet -> c.d.o.server -> Re: Q: Using of variables in PL/SQL in a LOOP??

Re: Q: Using of variables in PL/SQL in a LOOP??

From: sybrandb <sybrandb_at_gmail.com>
Date: 12 Sep 2006 03:23:51 -0700
Message-ID: <1158056631.429543.52350@d34g2000cwd.googlegroups.com>

Ralf Bender wrote:
> Hello togehter!
>
> Call me blind, but why is this not working. Is it not possible to use
> sFlag(i) or sVNr(i) in a LOOP? :
>
> CREATE OR REPLACE TRIGGER trig_ai2_ABTEST
> AFTER INSERT ON ABTEST
> FOR EACH ROW
> DECLARE
> sFlag1 BOOLEAN;
> sVNr1 CHAR(5);
> sFlag2 BOOLEAN;
> sVNr2 CHAR(5);
>
> stemp CHAR(1);
> sSQLStatement VARCHAR(250);
> BEGIN
> IF INSERTING THEN
> IF :NEW.V_NUMMER1 IS NOT NULL AND :NEW.SEITE = '001' THEN
> sVNr1 := :NEW.V_NUMMER1;
> sFlag1 := TRUE;
> dbms_output.put_line(SYSDATE ||'Flag1:');
> END IF;
> IF :NEW.V_NUMMER2 IS NOT NULL AND :NEW.SEITE = '001' THEN
> sVNr2 := :NEW.V_NUMMER2;
> sFlag2 := TRUE;
> dbms_output.put_line(SYSDATE || 'Flag2:');
> END IF;
>
> FOR i IN 1 .. 4 LOOP
> IF sFlag(i) = TRUE THEN
> dbms_output.put_line(SYSDATE || 'Flag(I):'||sVNr(i));
> END IF;
> END LOOP;
> END IF;
> END;
>
> /

Sflag is not a collection. sVNR is also not a collection, but a string. The (<subscript>) syntax applies to collections only. So yes, you need more coffee.

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Tue Sep 12 2006 - 05:23:51 CDT

Original text of this message

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