postgreSQL 里面 可以用 setof record 来表示返回结果如
CREATE OR REPLACE FUNCTION _get_newest_date(_mmsi integer, _updatetime timestamp without time zone)
  RETURNS SETOF current_ships AS
$BODY$
declare
_rec current_ships%rowtype; 
        begin
for _rec in (select * from current_ships where mmsi = _mmsi and updatetime > _updatetime) loop   
return next _rec; 
end loop; 
        end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION _get_newest_date(integer, timestamp without time zone) OWNER TO postgres;
COMMENT ON FUNCTION _get_newest_date(integer, timestamp without time zone) IS '根据mmsi和时间得到此mmsi的数据';
但是mysql貌似不支持呢?
mysql怎么写阿?这样写不对
DELIMITER $$DROP FUNCTION IF EXISTS `_member_login`$$CREATE
    FUNCTION `_member_login`(_number INT, _passwd VARCHAR(20))
    RETURNS `members` TABLE
    BEGIN
RETURN (SELECT * FROM members WHERE number = _number AND passwd = _passwd);
    END$$DELIMITER ;网上我也看到有人问这个问题 http://forums.mysql.com/read.php?118,240489,267291#msg-267291求解...