[MDEV-14564] support FOR loop in stored aggregate functions Created: 2017-12-04  Updated: 2022-06-15

Status: Stalled
Project: MariaDB Server
Component/s: Stored routines
Fix Version/s: None

Type: Task Priority: Major
Reporter: Sergei Golubchik Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Blocks
is blocked by MDEV-14415 Add Oracle-style FOR loop to sql_mode... Closed
Relates
relates to MDEV-7773 Aggregate stored functions Closed

 Description   

Support the syntax (subject to discussion):

[begin_label:]
FOR GROUP ROWS DO
  statement_list
END FOR [ end_label ]

See also MDEV-14415.

Example:

CREATE AGGREGATE FUNCTION avg(x DOUBLE) RETURNS DOUBLE
BEGIN
  DECLARE count INT DEFAULT 0;
  DECLARE sum DOUBLE DEFAULT 0;
  FOR GROUP ROWS DO
    SET count:=count+1;
    SET sum:=sum+x;
  END FOR;
  RETURN sum/count;
END



 Comments   
Comment by Varun Gupta (Inactive) [ 2017-12-29 ]

http://lists.askmonty.org/pipermail/commits/2017-December/011777.html

Generated at Thu Feb 08 08:14:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.