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: Ralf Bender <ralf.bender_at_arcor.de>
Date: Tue, 12 Sep 2006 15:43:08 +0200
Message-ID: <4506b965$0$26963$9b4e6d93@newsspool4.arcor-online.net>


sybrandb said the following on 12.09.2006 12:23:
> 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.
>

You are right :-)
After a few cups it works .... The question was 10 level under novice... Received on Tue Sep 12 2006 - 08:43:08 CDT

Original text of this message

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