I wrote a very simple script. I am new to PSQL and I wanted to return some values based on a very simple loop.
CREATE PROCEDURE DRAW_DOWN
RETURNS(
I_VAL INTEGER)
AS
DECLARE VARIABLE STARTING_BALANCE INTEGER;
DECLA开发者_开发知识库RE VARIABLE TRADING_SERIES INTEGER;
DECLARE VARIABLE I INTEGER;
BEGIN
SUSPEND;
I_VAL = 1;
WHILE (i < 5) DO
BEGIN
/*RAND();*/
SUSPEND;
I_VAL = i;
i = i +1;
END
SUSPEND;
END;
This just returns one value.
What am i doing wrong?
Regards, Tom
You're probably running the proc with EXECUTE
instead of SELECT
. You'd use
SELECT *
FROM DRAW_DOWN
...for multiple results.
精彩评论