Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 506C79FB7A6 for ; Tue, 13 Mar 2007 10:42:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 45722-05 for ; Tue, 13 Mar 2007 10:41:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 0051F9FB60B for ; Tue, 13 Mar 2007 10:41:33 -0300 (ADT) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Tue, 13 Mar 2007 14:28:47 +0100 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Tue, 13 Mar 2007 14:41:31 +0100 Message-Id: <45F6B808.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Tue, 13 Mar 2007 14:41:13 +0100 From: "Bart Degryse" To: Cc: "Ezequias R. da Rocha" Subject: Re: For loop References: <45F69D7C.4070304@fastcon.com.br><45F6A06E.7090104@fastcon.com.b r><45F6B1A2.A3DD.0030.0@indicator.be><45F6B1A2.A3DD.0030.0@indicator.be> < 45F6A4E5.7090707@fastcon.com.br><45F6B4EB.A3DD.0030.0@indicator.be><45F6B 4EB.A3DD.0030.0@indicator.be><45F6A793.1090904@fastcon.com.br> In-Reply-To: <45F6A793.1090904@fastcon.com.br> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part9BBF25E9.1__=" X-imss-version: 2.046 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=0 required=5 tests=AWL, BAYES_20, FORGED_RCVD_HELO, HTML_30_40, HTML_MESSAGE, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200703/162 X-Sequence-Number: 27800 --=__Part9BBF25E9.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable AFAK you can also use them in eg CREATE TRIGGER and on the psql command = prompt. What are you trying to accomplish. When we understand that, maybe we can = point you in the right direction. >>> "Ezequias R. da Rocha" 2007-03-13 14:30 >>> I quetion one more time. I must have a function ? Isn't another way to=20 implement it without using functions ? Ezequias Bart Degryse escreveu: > Please post your complete CREATE FUNCTION statement. Error code 42601=20 > refers to some syntax error which probably occurs just before you=20 > start looping. To find it I need to see more code. > Please don't mail me directly. Only mail to pgsql-sql@postgresql.org=20 > > > >>> "Ezequias R. da Rocha" 2007-03-13 14:19 = >>> > They are not working well. > > Allways the same error. > > (if while) > ERROR: syntax error at or near "WHILE" > SQL state: 42601 > Character: 1 > > (if for) > > ERROR: syntax error at or near "FOR" > SQL state: 42601 > Character: 1 > > (if loop) > ERROR: syntax error at or near "LOOP" > SQL state: 42601 > Character: 1 > I installed the pgsql but I don't think it is a problem of language. > What could be wrong ? I am not using functions too. I am using the SQL > tool of PgAdmin III. > > Any help would be glad. > > Ezequias > > Bart Degryse escreveu: > > As you can see in the manual > >=20 > (http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-structure= s.html)=20 > > > you have to remove the ; after the initial LOOP > >=20 > > LOOP > > statements > > IF i > 1000000 THEN EXIT; > > END LOOP; > >=20 > > Or you can try... > >=20 > > WHILE i <=3D 1000000 LOOP > > statements > > END LOOP; > >=20 > > Or even... (don't initialize i in this case) > >=20 > > FOR i IN 1 .. 1000000 LOOP > > statements > > END LOOP; > > > > >>> "Ezequias R. da Rocha" 2007-03-13=20 > 14:00 >>> > > Ezequias R. da Rocha escreveu: > > > Hi list, > > > > > > I would like to test the power of processing of postgresql (and my > > > server) by insert a large ammount of data on a table I have. > > > > > > I would like to know how to implement a For... loop . With it I = think > > > I could check the real power of my server. > > > > > > Ezequias > > > > > I tryed a way but it is not working. Please see it: > > > > LOOP; > > -- some computations > > insert into carga (desc) values ('My Text'); > > IF count > 1000000 THEN > > EXIT; -- exit loop > > END IF; > > END LOOP; > > > > The postgresql reports the following error: > > / > > ERROR: syntax error at or near "LOOP" > > SQL state: 42601 > > Character: 1/ > > > > ---------------------------(end of broadcast)--------------------------= - > > TIP 3: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/docs/faq=20 > ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings --=__Part9BBF25E9.1__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
AFAK you can also use them in eg CREATE TRIGGER and on the psql = command prompt.
What are you trying to accomplish. When we understand that, maybe we = can point you in the right direction.

>>> "Ezequias R. da = Rocha" <ezequias@fastcon.com.br> 2007-03-13 14:30 >>>
I = quetion one more time. I must have a function ? Isn't another way to =
implement it without using functions ?

Ezequias
Bart Degryse = escreveu:
> Please post your complete CREATE FUNCTION statement. = Error code 42601
> refers to some syntax error which probably = occurs just before you
> start looping. To find it I need to see = more code.
> Please don't mail me directly. Only mail to pgsql-sql@po= stgresql.org
> <mailto:pgsql-sql@postgresql.org>
>
&g= t; >>> "Ezequias R. da Rocha" <ezequias@fastcon.com.br> = 2007-03-13 14:19 >>>
> They are not working well.
>> Allways the same error.
>
> (if while)
> ERROR: = syntax error at or near "WHILE"
> SQL state: 42601
> Character:= 1
>
> (if for)
>
> ERROR: syntax error at or near = "FOR"
> SQL state: 42601
> Character: 1
>
> (if = loop)
> ERROR: syntax error at or near "LOOP"
> SQL state: = 42601
> Character: 1
> I installed the pgsql but I don't think = it is a problem of language.
> What could be wrong ? I am not using = functions too. I am using the SQL
> tool of PgAdmin III.
>
&= gt; Any help would be glad.
>
> Ezequias
>
> Bart = Degryse escreveu:
> > As you can see in the manual
> > =
> (http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-st= ructures.html)
>
> > you have to remove the ; after the = initial LOOP
> >
> > LOOP
> >   =   statements
> >     IF i > 1000000 = THEN EXIT;
> > END LOOP;
> >
> > Or you can = try...
> >
> > WHILE i <=3D 1000000 LOOP
> = >     statements
> > END LOOP;
> = >
> > Or even... (don't initialize i in this case)
> = >
> > FOR i IN 1 .. 1000000 LOOP
> >   = ;  statements
> > END LOOP;
> >
> > = >>> "Ezequias R. da Rocha" <ezequias@fastcon.com.br> = 2007-03-13
> 14:00 >>>
> > Ezequias R. da Rocha = escreveu:
> > > Hi list,
> > >
> > > I = would like to test the power of processing of postgresql (and my
> = > > server) by insert a large ammount of data on a table I have.
&= gt; > >
> > > I would like to know how to implement a = For... loop . With it I think
> > > I could check the real = power of my server.
> > >
> > > Ezequias
> = > >
> > I tryed a way but it is not working. Please see = it:
> >
> > LOOP;
> >     = -- some computations
> > insert into carga (desc) values ('My = Text');
> >     IF count > 1000000 = THEN
> >         = EXIT;  -- exit loop
> >     END = IF;
> > END LOOP;
> >
> > The postgresql = reports the following error:
> > /
> > ERROR: syntax = error at or near "LOOP"
> > SQL state: 42601
> > = Character: 1/
> >
> > ---------------------------(end of = broadcast)---------------------------
> > TIP 3: Have you checked = our extensive FAQ?
> >
> >     &= nbsp;          http://www.postgresql.org/docs/faq
&= gt;


---------------------------(end of broadcast)---------------= ------------
TIP 5: don't forget to increase your free space map = settings
--=__Part9BBF25E9.1__=--