DELETE « Statement « Java Database Q&A





1. DELETE statement deletes record but returns 0    coderanch.com

Hi, I have a method that deletes a record public int deleteDepartment(String departmentId) throws SQLException { int recordsAffected = 0; //TODO: MODIFY RECORD SO IT DOESN'T DELETE RECORD IF THERE ARE user_id's CONNECTED TO IT //TODO: MODIFY THE QUERY SO THAT IT ONLY DELETES USER-DEFIEND RECORDS query = "DELETE FROM departments_tbl WHERE department_id LIKE ?"; ps = conn.prepareStatement(query); ps.setString(1, departmentId); recordsAffected ...

2. Proper SQL Delete statement    java-forums.org

You would do better to post actual code. That code won't have a hope in compiling as a Connection object does not have any sort of sql execution methods. Next, you would also do well to explain your problem, because I can't tell whether it's a delete you're having problems with or a select or what. That would include any exceptions, ...

3. Is this SQL DELETE statement correct ?    forums.oracle.com