1

I am trying to delete a record from my database using Jmeter and I am having some difficulties. I can query just fine, but when it comes to DELETE, I am getting an error. I enter the following code in my Jmeter:

delete from DATA_RECORDS where DATA_RECORDS_ID = (select id from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue');

delete from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue';

After running the test in Jmeter I get the following error:

java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

However when I enter that same code in my SQLDeveloper, SQL actually runs the script and it deletes the appropriate data.

The Query Type is set to: Update Statement and I have nothing in the remaining fields: Parameter values, Parameter types, Variable names, etc. I would also like to mention that I am running Jmeter 3.2 GUI mode. If you could help me out that would greatly be appreciated. Thanks!

6
  • can you post your complete code. Commented Jul 25, 2017 at 16:34
  • Are you allowed multiple sql statements from jmeter? Other interfaces that I know, don't allow it, with a very similar error message (caused by there being extraneous text after the first semi-colon i.e. a second statement). With SQL Developer this is no problem. Commented Jul 25, 2017 at 16:35
  • @SudiptaMondal This is the complete code. If you take a look at the Jmeter JDBC Request Sampler you will see that the above code goes into the SQL Query textarea. I copied and pasted it in. I've encountered this error before when doing select statements and I fixed it by changing the '=' to 'like' but it doesn't work here. Commented Jul 25, 2017 at 16:40
  • @JonathanWillcock I tried to run only the second delete statement to see if that was the issue but it still gives me the same error message. It must be something very small or subtle. Commented Jul 25, 2017 at 16:41
  • Does the first statement run by itself? Commented Jul 25, 2017 at 16:44

1 Answer 1

0

Separate to 2 jdbc requests:

 delete from DATA_RECORDS where DATA_RECORDS_ID = (select id from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue')


  delete from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue'
Sign up to request clarification or add additional context in comments.

4 Comments

When I try to run the following code in ONE JDBC Request I a different error. Query Statement: delete from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue' results in java.sql.SQLIntegrityConstraintViolationException: ORA-02292: integrity constraint violated - child record found.
You should Keep the order
You sir are a genius! Can you please explain why this method works?
You have foreign key on the second table so the order of deletion is important

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.