Subject Re: [firebird-support] How to use rand()?
Author weiwufeng
Why I get some differ rows when I call the SP many times in a connection?
When I reconnect to the database,why the SP return a same row again?

SET TERM ^ ;
ALTER PROCEDURE GET_RANDOM_FORTUNE
RETURNS (
FORTUNE Varchar(1000) )
AS
BEGIN
FOR SELECT FIRST 1 FORTUNE
FROM FORTUNE
ORDER BY rand()
INTO :FORTUNE
do
begin
end
SUSPEND;

END^
SET TERM ; ^