Forum Discussion

dumbuser's avatar
dumbuser
Occasional Contributor
7 years ago

Multiple sql statements in one JDBC step with Oracle

Is there a way to use multiple sql statements with JDBC step while using Oracle database? I can have multiple inserts, updates etc. in one test step while working with Postgres, but with oracle I get ORA-00933 error. 

 

Is there a workaround so I don't have to make loads of separate JDBC steps? I have to change my tests made for Postgres so they would work in Oracle and I have A LOT of testdata creation and deletion. For example testcase which contains 7 steps right now would contain nearly 30 steps and I have testcases which would probably go up to atleast 50-60 steps. Also it's a lot of manual work, so maybe there's a better way.

 

Thanks in advance

  • One way to achieve this is to use a groovy step and script the db queries, you should find the information you need to get started with groovy sql coding in the documentaion here

     

    NOTE: The objects that are returned from the sql query methods are ArrayLists and so to retrieve a specific element (column name) from within the object (sql result object) you would use something like

    object.specificElement

     

    Hope this was helpful,

    Mo

     

    EDIT: You can also find some usage examples here

  • One way to achieve this is to use a groovy step and script the db queries, you should find the information you need to get started with groovy sql coding in the documentaion here

     

    NOTE: The objects that are returned from the sql query methods are ArrayLists and so to retrieve a specific element (column name) from within the object (sql result object) you would use something like

    object.specificElement

     

    Hope this was helpful,

    Mo

     

    EDIT: You can also find some usage examples here

    • dumbuser's avatar
      dumbuser
      Occasional Contributor

      Thanks, this was very helpful. Had to google some other examples as well for my case, but this was probably the best at explaining the principle.