fetchnext

Syntax

fetchnext num_rows [connect_id.]command_id]

Description

Fetches up to num_rows rows from prepared command command_id on connection connect_id.

If command_id is not specified, fetches num_rows rows from the most recent command. The command must already have been run using exec.

Example

Command> create table t1 ( a int, b varchar(30));

Command> create sequence s;

Command> set autocommit 0;

Command> prepare 1 insert into t1 values( s.nextval, 'A');

Command> prepare 2 insert into t1 values( s.nextval, 'B');

Command> prepare 5 select * from t1;

Command> describe *;

There are 3 prepared commands.

Prepared Statement [1]:
  SQL: insert into t1 values( s.nextval, 'A')
  Columns:
    (none)

Prepared Statement [2]:
  SQL: insert into t1 values( s.nextval, 'B')
  Columns:
    (none)

Prepared Statement [5]:
  SQL: select * from t1
  Columns:
    A         NUMBER (38)
    B         VARCHAR2 (30)


Command> exec 1;
1 row inserted.

Command> exec 2;
1 row inserted.

Command> fetchnext 1;
< 1, A >
1 row found.

Command> fetchnext 1;
< 2, B >
1 row found.