PostgreSQL中的@@ Fetch_status [英] @@Fetch_status in postgreSQL
本文介绍了PostgreSQL中的@@ Fetch_status的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将数据库从MS SQL Server传输到PostgreSQL,并且此触发器存在问题:
I'm transfering my database from MS SQL Server to PostgreSQL and I have a problem with this trigger:
CREATE TRIGGER added_clients ON client
FOR INSERT
AS
BEGIN
DECLARE cursor_inserted CURSOR
FOR SELECT name, surname FROM inserted;
OPEN cursor_inserted
DECLARE @name varchar(15), @surname varchar(20)
FETCH NEXT FROM cursor_inserted INTO @name, @surname
WHILE @@FETCH_STATUS = 0
BEGIN
print 'Added: '+@name+' '+ @surname
FETCH NEXT FROM cursor_inserted INTO @name, @surname
END
CLOSE cursor_inserted
DEALLOCATE cursor_inserted
END
GO
postgreSQL中的@@ FETCH_STATUS是什么意思?
What is the equivalent of @@FETCH_STATUS in postgreSQL?
推荐答案
以下是PostgreSQL的Cursor文档
Here is the Cursor documentation for PostgreSQL
http://www.postgresql.org/docs/current/static/plpgsql-cursors.html
通过光标循环:
[ <<label>> ]
FOR recordvar IN bound_cursorvar [ ( [ argument_name := ] argument_value [, ...] ) ] LOOP
statements
END LOOP [ label ];
这篇关于PostgreSQL中的@@ Fetch_status的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文