# NOT RUN { # } # NOT RUN { # first load the library library("ROracle") # create an Oracle instance drv <- dbDriver("Oracle") con <- dbConnect(drv, "scott", "tiger") dbListTables(con) # fetch all results from the emp table res <- dbGetQuery(con, "select * from emp") # dbSendQuery can be used to fetch data in chunks # as well as all of data at once res <- dbSendQuery(con, "select * from emp") # fetch all results fetch(res) # or a chunk at a time fetch(res, n = 5) # describing the schema for the emp table using dbGetInfo dbGetInfo(res, what = 'fields') # clear the result dbClearResult(res) # disconnect from the database dbDisconnect(con) # free the driver object dbUnloadDriver(drv) # }
Run the code above in your browser using DataCamp Workspace