Forum Discussion

VLiljeb_ck's avatar
VLiljeb_ck
Occasional Contributor
12 years ago

[Resolved] Error when using property in Sql query

I have my SoapUI project connected to a postgres database. I uses JDBC request to retrieve information from the database. When adding a property and run the sql query below I get an error message, "ERROR:org.postgressql.until.PSQLException: ERROR: operator does not exist: integer = character varying".
Property: c = 8955587
Sql Query: select * from a where b = :c

But if I type the number directly in the sql query everything works fine...
Sql Query: select * from a where b = 8955587

This is the case for some objects in the database, others works with properties. Somebody who knows what to do?

4 Replies

  • are there more properties in your jdbc step??
    you can only define the properties used in your query in the jdbc step, otherwise SOAp is confused.
    So split your properties into use per step where you need them.
    Then there should be no problem anymore
  • VLiljeb_ck's avatar
    VLiljeb_ck
    Occasional Contributor
    No, there is only one property "c" that I also use in the Sql query. I have other JDBC steps where I do the same thing but in another table in the postgres and it works fine so I do not understand why it does not work in this particular table..
  • Hi,

    SoapUI sets the property value as text. In your case column b looks like an integer and I think that is why the comparison is failing. I would suggest try to cast your column like b::TEXT . That should probably work.

    Regards,
    Shadid
    SmartBear Sweden
  • VLiljeb_ck's avatar
    VLiljeb_ck
    Occasional Contributor
    Yes that was the case! Thank you for the help!
    I solved it by using this sql query "select * from a where b = (select cast(:c as int)) limit 1"
    And now it works