Encounter ORA-00933 when use RETURN_GENERATED_KEYS
Hi All,
I working on data conversion using java (JDeveloper Tool).
I base on Expert One-on-One J2EE Design and Development page : 273 Chapter 7 to work for solution .
I encounter problem below:
ORA-00933: SQL command not properly ended
script as below :
public long insertAcctTelephone(Connections conn, Connection oConn,
long holderIdNo, String telNo, String telTypeCode )
{
PreparedStatement oPr = null;
ResultSet rs = null;
String oSql = "INSERT INTO telephone (" +
" investorid, telno, " +
" teltypecode) " +
" values (?, ?, ?),Statement.RETURN_GENERATED_KEYS";
try{
oPr = oConn.prepareStatement(oSql); //oPr = conn.updateOracleSQL(oConn, oSql);
} catch (Exception eo)
{
System.out.println(" PreparedStatement " + eo.getMessage());
conn.OracleErrEncounter(oConn," PreparedStatement " + eo.getMessage());
}
System.out.println("holderIdNo " + Long.toString(holderIdNo));
System.out.println("telNo " + telNo);
System.out.println("telTypeCode " + telTypeCode);
try{
oPr.setLong(1,holderIdNo);
oPr.setString(2,telNo);
oPr.setString(3, telTypeCode );
} catch (Exception zd)
{
System.out.println("YES THIS IS " + zd.getMessage());
}
try{
oPr.executeUpdate();
} catch (Exception www)
{
[u]System.out.println("OUT " + www.getMessage());</u>
}
try{
rs = oPr.getGeneratedKeys();
}catch(Exception zde)
{ System.out.println("OUT III " + zde.getMessage());}
try{
if (rs.next())
{
long key = rs.getLong(1);
return key;
}
}catch (Exception ioe)
{ System.out.println("OUT IV " + ioe.getMessage());}
return -1;
}
*****************
the process terminate at Exception OUT
Hope to get your reply soon.
Thank you so much.
|