2

My Spring Boot/Java 8 app updates rows in an Oracle 11g database. Is there an efficient way to return the rows that were updated (note, NOT the count, but the data from each row updated)?

Obviously, I could update a column in each row with an id then do a select for that ID, but I am wondering if there is a better way.

I'm currently using Spring's jdbctemplate, but I'm not wedded to it.

Andrew
  • 18,680
  • 13
  • 103
  • 118
eze
  • 2,332
  • 3
  • 19
  • 30
  • 1
    uh..care to explain the down vote? – eze May 31 '16 at 16:58
  • How long after you perform the update do you want to find out what was updated? Do you want to do this as part of the update, or at some time in the future? – Bob Jarvis - Слава Україні May 31 '16 at 18:53
  • 1
    My goal is to get the results in the same statement that performs the update. Basically a process is "checking out" certain rows to perform work. I think the returning into clause fits my needs. – eze Jun 01 '16 at 17:53

1 Answers1

1

You can use RETURNING INTO clause of UPDATE query. See example here

Unfortunatley this syntax requires PL/SQL code for storing resulting datasets, so you have to work on PL/SQL to obtain your goal.

Carlo
  • 1,539
  • 1
  • 11
  • 25