开发者

Interbase PSQL return values

开发者 https://www.devze.com 2023-01-22 01:42 出处:网络
I wrote a very simple script. I am new to PSQL and I wanted to return some values based on a very simple loop.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消