Service Virtualization

Expand all | Collapse all

Storing SQL Query result in Array

Jump to Best Answer
  • 1.  Storing SQL Query result in Array

    Posted 12-20-2018 08:58 AM

    I have a JDBC step with SELECT Query which brings results from Table. The result contains more than 1 rows. How to store the values of Select Query result(if more than one row) in array so that it can later be reused?



  • 2.  Re: Storing SQL Query result in Array
    Best Answer

    Broadcom Employee
    Posted 12-20-2018 09:34 AM

    The response of a JDBC call step, ie. the SQL result set, is actually an XML structure. So, as such it has inherently some characteristics of an array and you can create a loop and use xpath statements with index indicators (eg. /someTag1/someTag2/targetTag[0] ) to select a specific 'row' and subsequently get the data of that row.

     

    You can validate that it is an xml structure by adding an XML XPath filter to your JDBC step and you will see the ResultSet XML tree. The workstation just visually presents the ResultSet XML tree in a table format.

     

    So, would storing the xml (Store Step Response step) by sufficient enough for later reuse?

     

    Cheers,

    Danny