参考一下(Interbase SQL)
Create Procedure QueryAnswer(
NAME VARCHAR(20)
)
RETURNS
(
NAME VARCHAR(20),
POINTS INTEGER;
NUM INTEGER;
)
AS
BEGIN
FOR SELECT NAME, POINTS FROM CUSTOMER INTO :NAME, OINTS DO
BEGIN
SELECT COUNT(*)+ 1 FROM CUSTOMER WHERE (POINTS > ( SELECT POINTS FROM CUSTOMER WHERE NAME='SUN' )) INTO :NUM;
SUSPEND;
END
END;
参考一下(Interbase SQL)
Create Procedure QueryAnswer(
NAME VARCHAR(20)
)
RETURNS
(
NAME VARCHAR(20),
POINTS INTEGER;
NUM INTEGER;
)
AS
DECLARE VARIABLE ID INTEGER;
BEGIN
ID=0;
FOR SELECT NAME, POINTS FROM CUSTOMER INTO :NAME, OINTS DO
BEGIN
ID=ID+1;
NUM=ID;//自增
SUSPEND;
END
END;