Learn R Programming

ROracle (version 1.3-1.1)

dbCommit-methods: DBMS Transaction Management

Description

Commits or roll backs the current transaction in an Oracle connection

Usage

# S4 method for OraConnection
dbCommit(conn, ...)
# S4 method for OraConnection
dbRollback(conn, ...)

Arguments

conn

a OraConnection object, as produced by the function dbConnect

currently unused.

Side Effects

dbCommit

saves changes permanently.

dbRollback

undo all changes done after last save point.

Details

dbCommit

implementation saves all changes done on that connection. Changes can not be undone once saved permanently.

dbRollback

implementation undo all chnages done after last savepoint.

References

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

See Also

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

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
    drv <- dbDriver("Oracle")
    con <- dbConnect(drv, "scott", "tiger")
    dbReadTable(con, "EMP")
    rs <- dbSendQuery(con, "delete from emp where deptno = 10")
    dbReadTable(con, "EMP")
    if(dbGetInfo(rs, what = "rowsAffected") > 1)
    {
      warning("dubious deletion -- rolling back transaction")
      dbRollback(con)
    }
    dbReadTable(con, "EMP")
  
# }

Run the code above in your browser using DataLab