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" <[EMAIL PROTECTED]> 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@postgresql.org > <mailto:pgsql-sql@postgresql.org> > > >>> "Ezequias R. da Rocha" <[EMAIL PROTECTED]> 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 > > > (http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-structures.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 <= 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" <[EMAIL PROTECTED]> 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. > > > > > > 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 > ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings