Cursor statements

Supported

  • The following statements for retrieving and updating cursors are supported:

    Table 178. 

    CLOSE

    DECLARE

    DELETE

    FETCH

    FETCH FIRST

    FETCH LAST

    FETCH NEXT

    FETCH PRIOR

    OPEN

    UPDATE

       


  • Local cursors are supported.

  • Global and instance cursors are supported.

Unsupported

  • The Cursor SQL statement UPDATE Where Current is unsupported.

    Syntax:

    UPDATE TableName SetStatement WHERE CURRENT OF CursorName;
  • The Cursor SQL Statement DELETE Where Current is unsupported.

    Syntax:

    DELETE FROM TableName WHERE CURRENT OF CursorName;
  • If a cursor is declared for retrieving rows from a table, modifying (inserting, deleting, or updating) the table during the cursor open close period is unsupported . Otherwise, the data retrieved is different in the mobile application than in the PowerBuilder application.

    Example:

    DECLARE cur_empl CURSOR FOR select s_emplid, s_emplname from employee;
    OPEN cur_empl;
    INSERT INTO employee (s_emplid, s_emplname) VALUES (:ls_addid, :ls_addname);
    FETCH cur_empl INTO :ls_emplid, :ls_emplname;
    DO WHILE sqlca.sqlcode=0
    FETCH cur_empl INTO :ls_emplid, :ls_emplname;
    LOOP
    CLOSE cur_empl;
    Commit;
    
  • Placing the cursor declaration syntax in a statement block that may not be executed at runtime is unsupported. In PowerBuilder, cursor declaration syntax is treated the same way as variable declaration, so the syntax will not be skipped although the statement block is not executed. However, in the mobile application, the syntax may be skipped and cause errors.

    Example:

    if li_lenth = 10 then
    DECLARE cur_empl CURSOR FOR select s_emplid, s_emplname from employee;
    ......
    End if
    OPEN cur_empl;
    FETCH cur_empl INTO :ls_emplid, :ls_emplname;
    ......
    

    In the mobile application with the above syntax, if the li_length is not 10, the cursor declaration syntax cannot be read, and errors occur.