Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

DB Tool SQL error: SQL command not properly ended

Options
areyesy
areyesy Posts: 7

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_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    edited October 2017
    Options

    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.

  • areyesy
    areyesy Posts: 7
    Options

    ${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_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    Options

    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}"?

  • areyesy
    areyesy Posts: 7
    Options

    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_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    Options

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