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.

How to parameterize column names in SQL query template

Options
rvmseng
rvmseng Posts: 89
edited December 2020 in Virtualize

Dear Parasoft team,

I want to know can I use below SQL query template in Data Repository? I read "Criteria Expressions with the SQL Responder" but I want to use it in columns name not in where clause part because some times my columns name change.

SELECT ${c1}, first_name, FROM Customer WHERE username=${username} and password=${password}

when I use it in columns name I faced with below issue.

No SQL Data Set records in the "db-set" Data Set match the incoming JDBC URL and SQL template.

Please refer to below images,

Thanks.

Comments

  • rvmseng
    rvmseng Posts: 89
    Options

    Dear Parasoft Team,

    would you please help me? i need your answer

  • OmarR
    OmarR Posts: 234 admin
    Options

    Good afternoon,

    It seems that we can only parametrize the column values in the SQL template. I get the same error when I attempt to parameterize the column name.

    As a workaround, you can create duplicates of the SQL template row and replace the column name for each. See the screenshot below (Right-Click>View Image).

  • rvmseng
    rvmseng Posts: 89
    Options

    Thank you Omar,

    but in real project sometimes I faced with SQL queries that has dynamic value in body for example below query and I can not parametrize it.

    Select DBM_LOCK.RELEASE('10874334875384538') from dual

  • rvmseng
    rvmseng Posts: 89
    Options

    Dear omar,
    What are your solution for above problem?
    Would you please help me about my previous comment.

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    Options

    Hi,

    Could you contact support@parasoft.com so that we can better help you? I don't believe this use case is currently supported because the template is not fully user-configurable. Column names are not parameterizable so contacting support will help us determine what product enhancements would be necessary to support this use case.

    Thanks!

  • rvmseng
    rvmseng Posts: 89
    edited January 2021
    Options

    Thank you,
    Also I have another challenge, when I record JDBC driver queries I faced with invalid characters into csv files, you can find it in below image. I set Window > Preferences > General > Content Types to UTF-8 and also add -dfile.encoding=utf-8 in eclipse.ini but issue exist yet, would you please help me. my RDBMS is oracle.

    please find attachment file.

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    Options

    Please contact support@parasoft.com

  • rvmseng
    rvmseng Posts: 89
    Options

    would you please help me? because it is not related to tool it need to change configuration in encoding. how I can resolve it?

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    Options

    Hi,

    There isn't much I can do to help you. Something in your environment is going wrong. The recorded strings come from the results returned by the SQL query so it's not clear if the JDBC driver is sending the badly encoded values or if the desktop is reading or writing them wrong. There isn't much I can do to help address this issue using the forums. Contacting support will enable someone to get in touch with you directly and work through the issues in your environment.