DB Tool SQL error: SQL command not properly ended

areyesyareyesy Posts: 6

I'm trying to execute a DB Tool test. I get the following error: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

Scenario:

  • Set-Up Tests
  • Tear-Down Tests
  • Test 1: authorize
  • Test 2: DB Tool
  • Test 3: redeem

My SQL:
SELECT UPDATE_APP_NAME
FROM CREDITACCOUNT.CREDIT_PROVIDER_REBATE
WHERE CAPTURE_KEY = ${AuthorizationCode}

${AuthorizationCode} is from an XML Data Bank in a previous test (Test 1). There seems to be a problem when I try to use the variable. If I replace ${AuthorizationCode} with a literal the DB Tool test passes. I'm using an Oracle driver.

Do you know why I'm getting the SQL Error?

Comments

  • benken_parasoftbenken_parasoft Posts: 348 ✭✭✭
    edited October 2017

    Please check the DB Tool's traffic viewer to verify whether ${AuthorizationCode} in your SQL query was correctly resolved . Most likely, the data bank source column named "AuthorizationCode" did not resolve to anything. You must run the Data Bank first so that your AuthorizationCode column is populated. Also, make sure the XPath used for the Data Bank actually matched something.

  • areyesyareyesy Posts: 6

    ${AuthorizationCode} was resolved. I see the output in Traffic Viewer - Request. I'm running the test from the Test Suite level, so Test 1 runs success before hitting Test 2 which is the DB Took test I'm having a problem with.

  • benken_parasoftbenken_parasoft Posts: 348 ✭✭✭

    Your SQL query is most likely not correct, "not properly ended" as the error from the Oracle JDBC driver suggests. Is CAPTURE_KEY a string value? If so, shouldn't that mean you need ${AuthorizationCode} in quotes as in WHERE CAPTURE_KEY = "${AuthorizationCode}"?

  • areyesyareyesy Posts: 6

    Figured it out...CAPTURE_KEY is a varchar. I added single tick quotes around ${AuthorizeCode}. Duh! Having a closer look at the Traffic View helped. Thanks

  • benken_parasoftbenken_parasoft Posts: 348 ✭✭✭

    OK. We posted at almost the same thing at almost the same time about using quotes. Anyway, happy you figured it out :)

Sign In or Register to comment.