I'm trying to test out an update prior to running it on our production server, however when running my transaction in sqlplus
, I don't seem to be able to commit the transaction or get any data back from my select, what am I doing wrong?
SQL> select activity_message, regexp_replace(activity_message, 'null', new_value) from organization_activity_log where event = 'ADDED' and activity_item = 36 and activity_message = 'Added: null';
ACTIVITY_MESSAGE
--------------------------------------------------------------------------------
REGEXP_REPLACE(ACTIVITY_MESSAGE,'NULL',NEW_VALUE)
--------------------------------------------------------------------------------
Added: null
Added: 1234567891
Added: null
Added: 1234567890 Expires: 12/31/2016
SQL> begin;
2 select activity_message, regexp_replace(activity_message, 'null', new_value) from organization_activity_log where event = 'ADDED' and activity_item = 36 and activity_message = 'Added: null';
3 commit;
4
Best Answer
Oracle's transactions are implicit in
sqlplus
you're already in one and don't have to start it. This means you can just doselect ... update .. rollback ... select...
if you do an
exit
without doingexit rollback
it will commit on exit.begin
is not necessary here.