4
我有以下存儲過程,它返回0結果,但如果運行查詢本身,它會導致很多結果。我錯過了什麼。PostgreSQL存儲過程數據參數
CREATE OR REPLACE FUNCTION countStatistics(baselineDate Date) RETURNS int AS $$
DECLARE
qty int;
BEGIN
SELECT COUNT(*) INTO qty FROM statistics WHERE time_stamp = baselineDate;
RETURN qty;
END;
$$ LANGUAGE plpgsql;
--Execute the function
SELECT countStatistics('2015-01-01 01:00:00') as qty;
返回0結果
SELECT COUNT(*) FROM statistics WHERE time_stamp = '2015-01-01 01:00:00';
回100+導致
感謝您的幫助。 – user373201 2011-05-14 02:24:42