【发布时间】:2018-07-20 11:40:10
【问题描述】:
我是 postgreSQL 的新手。我正在尝试将SQL store procedure 转换为postgreSQL store function. 我尝试了成功创建下面的存储功能,但是当我尝试执行时,我收到以下错误消息。我没有找到需要替换 PERFORM 的地方。
ERROR: query has no destination for result data
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
SQL 存储过程
CREATE PROCEDURE [dbo].[roomType]
@intInstId int
AS
BEGIN
SELECT
nClientRoomTypeID,sClientRTDesc,sClientRTName,sClientRTCode
FROM
ClientRoomType
WHERE
ClientRoomType.nInstID=@intInstId
ORDER BY
ClientRoomType.sClientRTCode
END
GO
PostgreSQl 存储函数
CREATE OR REPLACE FUNCTION roomType (int_inst_id int)
RETURNS VOID
AS $$
BEGIN
SELECT
nclient_room_type_id,sclient_rt_desc,sclient_rt_name,sclient_rt_code
FROM
clientroomtype
WHERE
clientroomtype.ninst_id=int_inst_id
ORDER BY
clientroomtype.sclient_rt_code;
END;
$$ LANGUAGE plpgsql;
【问题讨论】:
标签: postgresql stored-procedures plpgsql stored-functions