title: How to store Oracle Rowid in Java bean
body: <p>I am calling a stored procedure that is returning the rowid for a list of rows. I am having trouble with storing the actual rowid value in Java so I can then later use that rowid for a follow up update statement.</p>
  
  <p>For example :</p>
  
  <pre><code>Select name, age, ROWID, from myTable where rownum&lt;20;
  </code></pre>
  
  <p>I can store the name and age, but when I try to store ROWID in a string like:</p>
  
  <pre><code>    setRowID(workTableResponseJson.getString("ROWID"));
  
  public void setRowID(String rowid) {
      this.rowid = rowid;
  }
  </code></pre>
  
  <p>The value does not exactly match. I instead get a value like :oracle.sql.ROWID@123a123b</p>
  
  <p>Does anyone know how to properly store the rowid value in Java so you can then later use it in a follow up statement?</p>
  
  <p>Thank you.</p>
  
  <p>EDIT: APC answered the question below and I have marked it. Thank you.</p>
  
  <p>The issue was with the query itself. I needed to change:</p>
  
  <pre><code>select rowid
  </code></pre>
  
  <p>to instead be:</p>
  
  <pre><code>select ROWIDTOCHAR(ROWID)
  </code></pre>
  
  <p>java was then able to store that value in a string. Although, I did not need to do the second modification as requested as it currently works when I still use:</p>
  
  <pre><code>update name='bob' where rowid=:rowid;
  </code></pre>