Skip to content
Advertisement

ORA-00928 missing SELECT keyword in Oracle

I’m using the following code to insert data. But I’m receiving an error as "ORA-00928: missing SELECT keyword"

try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxx.xxx.x.xxx:xxxx:xxxx", "xxxx", "xxxx");
String query="insert into offer1('RCODE','OFFERNO','DAT') values(?,?,?)"; 
    PreparedStatement ps=conn.prepareStatement(query);
    ps.setString(1,r_code);
    ps.setString(2,offerno);
    ps.setDate(3,sqlDate);
    ResultSet rs=ps.executeQuery();
    out.println("data inserted");
}catch(Exception e)
 {
     out.println(e);
 }

I can’t see any errors in this code. If someone finds, please tell me what is the mistake and how to solve it?

Advertisement

Answer

Without the single quotes, try

String query="insert into offer1(RCODE,OFFERNO,DAT) values(?,?,?)"; 
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement