Forum Discussion

N78A's avatar
N78A
Contributor
7 years ago

Using like operator in JDBC soapui

data in databasesoapui_JDBC_Request

Hi,

 

I am trying to run below query but it does not work.

 

select * from <table> where row_key like ':custId%'

 

where ":custId" is parametrized to fetch the custId from excel sheet and I want to get the records from database which are having  combination of custId (from excel sheet) , '|' and timestamp. please refer image attached for exact data.

 

If  I try to execute below , it works fine, but I need to use :custId from excel sheet. Please refer to image attached for my JDBC request.

 

select * from <table> where row_key like '1012|%'

 

 

  • Problem is resolved, I used below query to use 'like' in soapui jdbc.

     

    SELECT * FROM (SELECT * FROM <table> where row_key like concat(:custId,'%') )

  • It looks like you're trying to use Oracle parameter expansion. Try something like this:

     

    context.expand('${Your JDBC step name#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/custId[1]}')

     

    You can also right-click in the query window and click 'Get Data' and then select the node directly. This is of course assuming you are only getting one custId per query

    • N78A's avatar
      N78A
      Contributor

      Hi Justin,

      Thanks for your reply but I am not picking anything from response. that is a seperate step, as of now I am trying to fetch the data against :custId  from oracle database [which in turn I am fetching from excel sheet (in JDBC test step by parameterizing) ]and trying to get records from oracle database after making a connectivity between JDBC step & my oracle database.

       

      I just want to fetch the records from oracle database against custId defined in jdbc test step properties using "like".

      • N78A's avatar
        N78A
        Contributor

        Problem is resolved, I used below query to use 'like' in soapui jdbc.

         

        SELECT * FROM (SELECT * FROM <table> where row_key like concat(:custId,'%') )