Learn R Programming

ROracle (version 1.3-1)

fetch-methods: Fetch records from a previously executed query

Description

This method is a straight-forward implementation of the corresponding generic function.

Usage

# S4 method for OraResult
fetch(res, n = -1, ...)

Arguments

res

an OraResult object.

n

maximum number of records to retrieve per fetch. Use n = -1 to retrieve all pending records.

currently unused.

Value

number of records fetched from database.

Details

The ROracle implementations retrieves only n records, and if n is missing it returns all records.

References

For the Oracle Database documentaion see http://www.oracle.com/technetwork/indexes/documentation/index.html.

See Also

Oracle, dbConnect, dbSendQuery, dbGetQuery, dbClearResult, dbCommit, dbGetInfo, dbReadTable.

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
    drv <- dbDriver("Oracle")
    con <- dbConnect(drv, "scott", "tiger")
    res <- dbSendQuery(con, "select * from emp")

    # we now fetch the first 10 records from the resultSet into a data.frame
    data1 <- fetch(res, n = 10)   
    dim(data1)

    dbHasCompleted(res)

    # let's get all remaining records
    data2 <- fetch(res, n = -1)
  
# }

Run the code above in your browser using DataLab