title: Is there a way to write the PL/SQL code of select...INTO.. query in Java
body: <p>I am converting the PL/SQL code to Java code to get rid of the DB dependency. In PL/SQL we have something like this.</p>
  <pre><code>SELECT Status_Code, ERROR_CODE, Error_Message
            INTO I_Status_Code, I_Error_Code, I_Error_Message
            FROM T_Parent_Lots_Api
           WHERE Transaction_Id = I_Transaction_Id;
  EXCEPTION
      WHEN No_Data_Found THEN
        I_Status_Code   := Failure_Code;
        I_Error_Code    := SQLCODE;
        I_Error_Message := 'Error for transaction id -' || I_Transaction_Id ||
                           '- in tlotutils.t_update_txn_status-' || SQLERRM;
        RETURN;
  </code></pre>
  <p>Seems we cannot run the above SQL query in Java due to the <code>INTO</code> keyword. I can write the catch block to handle exception. I can remove the <code>INTO</code> keyword and execute the query and assign them from the <code>ResultSet</code> but the challenge here is if the select query is not returning any data then the relative java code <code>SQLException.getErrorCode()</code> &amp; <code>SQLException.getSQLState</code> for <code>SQLCODE</code> &amp; <code>SQLERRM</code> functions are returning empty</p>