VB.NET Oracle SQL "INSERT INTO" with "RETURNING INTO" gives ORA-00933 Command Not Properly Ended
<p>I need to update some code and as part of this I need to insert a row into a table and obtain the id (primary key) of the row just entered. </p>

<p>Have researched this and I believe I should be using RETURNING INTO and Oracle Parameters. I have used parameters in the past successfully to Insert values. </p>

<p>I have an INSERT statement that runs perfectly from VB.NET, but as soon as I add the text "" RETURNING id INTO :myId" I get ORA-00933 Command Not Properly Ended.</p>

<p>Here is a version of the code.</p>

<pre><code>sql = "INSERT ... RETURNING id INTO :myId"
Connect()
Dim intRecsAffected As Integer = 0

Dim comm As OracleCommand = New OracleCommand(sql, _conn)
Dim param As OracleParameter
param = New OracleParameter()

param.ParameterName = ":myId"
param.OracleDbType = OracleDbType.Int32
param.Direction = ParameterDirection.Output ' Tried ReturnValue

comm.Parameters.Add(param)

intRecsAffected = comm.ExecuteNonQuery()
id = comm.Parameters(":myId").Value

Disconnect()
</code></pre>

<p>Any ideas? </p>