Pervasive logo

Prev SQL Engine Reference Next

FETCH


Remarks

A FETCH statement positions an SQL cursor on a specified row of a table and retrieves values from that row by placing them into the variables in the target list.

Examples

The FETCH statement in this example retrieves values from cursor c1 into the CourseName variable. The Positioned UPDATE statement in this example updates the row for Modern European History (HIS 305) in the Course table in the DEMODATA sample database:

CREATE PROCEDURE UpdateClass(); 
BEGIN 
DECLARE :CourseName CHAR(7); 
DECLARE :OldName CHAR(7); 
DECLARE  c1 cursor FOR SELECT name FROM course WHERE name = :CourseName FOR UPDATE; 
SET :CourseName = 'HIS 305'; 
OPEN c1; 
FETCH NEXT FROM c1 INTO :OldName; 
UPDATE SET name = 'HIS 306' WHERE CURRENT OF c1; 
END;

See Also

CREATE PROCEDURE


Prev
EXISTS
Contents
Up
Check for Revisions
Next
FOREIGN KEY