Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DELIMITER $$
- CREATE FUNCTION `A`(x int) RETURNS decimal(12,4)
- DETERMINISTIC
- BEGIN
- DECLARE result Decimal(12, 4);
- set result = (
- SELECT sum(a)
- from X where Id = x
- );
- RETURN result;
- END$$
- DELIMITER $$
- CREATE FUNCTION `B`(y) RETURNS decimal(12,4)
- DETERMINISTIC
- BEGIN
- DECLARE result Decimal(12, 4);
- set result = (
- SELECT sum(A(X))
- from another_something where Id = y
- );
- RETURN result;
- END$$
- DELIMITER $$
- CREATE FUNCTION `C`(z) RETURNS decimal(12,4)
- DETERMINISTIC
- BEGIN
- DECLARE result Decimal(12, 4);
- set result = (
- SELECT sum(B(Z))
- from another_table where Id = z
- );
- RETURN result;
- END$$
- SELECT VERSION();
- 5.0.96-log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement