Need to delete N rows in SQL

I've tried this

public void deleteRegisterByFileEx(String fileCode, int batchSize) {
    String sql = "DELETE FROM TB_REGISTRO WHERE FILE_ID = ? LIMIT ?";
    int[] argTypes = { Types.VARCHAR, Types.INTEGER };

    List<Object[]> batchArgs = new ArrayList<>();
    batchArgs.add(new Object[] { fileCode, batchSize });

    template.batchUpdate(sql, batchArgs, argTypes);
}

and also this

    String sql = "DELETE TOP (?) FROM TB_REGISTRO WHERE FILE_ID = ?";
    int[] argTypes = { Types.INTEGER, Types.VARCHAR };

    List<Object[]> batchArgs = new ArrayList<>();
    batchArgs.add(new Object[] { batchSize, fileCode });

    template.batchUpdate(sql, batchArgs, argTypes);

Neither of those worked, and i don't really know why, the only error message is ORA-00933: SQL command not properly ended



from Recent Questions - Stack Overflow https://ift.tt/3DLer2H
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)