Statement.execute(sql) vs executeUpdate(sql) and executeQuery(sql)

前端 未结 3 1898
独厮守ぢ
独厮守ぢ 2020-12-14 16:03

I have a question related to this method: st.execute(sql); where st obviously is a Statement object. Directly from this oracle java tutorial:

3条回答
  •  -上瘾入骨i
    2020-12-14 16:23

    execute() : The method used for all types of SQL statements, and that is, returns a boolean value of TRUE or FALSE. If the method return TRUE, return the ResultSet object and FALSE returns the int value.

    executeUpdate() : This method is used for execution of DML statement(INSERT, UPDATE and DELETE) which is return int value, count of the affected rows.

    executeQuery() : This method is used to retrieve data from database using SELECT query. This method returns the ResultSet object that returns the data according to the query.

提交回复
热议问题