>Hi

>st 25. 1. 2023 v 16:39 odesílatel songjinzhou <2903807...@qq.com> napsal: 
>Hello, my personal understanding is that you can use multiple iterative 
>controls (as a merge) in a fo loop, otherwise we can only separate these 
>iterative controls, but in fact, they may do the same thing.

>1. please, don't use top posting in this mailing list 
>https://en.wikipedia.org/wiki/Posting_styl

>2. I understand the functionality, but I don't think there is a real necessity 
>to support this functionality.  Not in this static form, and just for integer 
>type.

>Postgres has a nice generic type "multirange". I can imagine some iterator 
>over the value of multirange, but I cannot imagine the necessity of a richer 
>iterator over just integer range. So the question is, what is the real 
>possible use case of this proposed functionality? 

1. I'm very sorry that my personal negligence has caused obstacles to your 
reading. Thank you for your reminding.
2. With regard to the use of this function, my understanding is relatively 
simple: there are many for loops that may do the same things. We can reduce our 
sql redundancy by merging iterative control; It is also more convenient to 
understand and read logically.

As follows, we can only repeat the for statement before we use such SQL:

begin
for i in 10..20 loop
raise notice '%', i; -- Things to do
end loop;

for i in 100 .. 200 by 10 loop
raise notice '%', i; -- Things to do
end loop;
end;

But now we can simplify it as follows:

begin
for i in 10..20, 100 .. 200 by 10 loop
raise notice '%', i; -- Things to do
end loop;
end;

Although we can only use integer iterative control here, this is just a 
horizontal expansion of the previous logic. Thank you very much for your reply. 
I am very grateful!

---

songjinzhou(2903807...@qq.com)

Reply via email to