I have an error when execute query that update in database

Query = (((‘UPDATE orders_shipment SET driver_id = ’ + ‘’’) + DelvNum) + ‘’, delivery_date= CURRENT_DATE WHERE id= (SELECT id FROM orders_shipment WHERE current_status in (’+ “’”+‘new’ + “’”+’, ‘+ "’"+‘ready_for_delivery’ + “’”+’) ORDER BY RANDOM() LIMIT 1)’)

QueryResult = CustomKeywords.‘databasepackage.TestPostgres.ExecuteDBQuery’(Query)

The query is executed but return an error in console (Caused by: org.postgresql.util.PSQLException: No results were returned by the query.

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html)

Just a note that it would help some if you put three backticks (found on the same key as the tilde ~) above and below your code, like ```

Also, remove all the parentheses you can from the statement. As an example, you do not need the 3 leading ones, but you do need the ones on RANDOM() and (SELECT.

Once you have “cleaned” up the code, put a print statement below your query line, like:

Query = 'UPDATE...
println(Query)

so you can see what the final query result actually looks like and put the same statement into your database as a manual query for any feedback the DB engine can give you.

Maybe like
Maybe like
Query = "UPDATE orders_shipment SET driver_id = '" + DelvNum + "', delivery_date = CURRENT_DATE WHERE id= (SELECT id FROM orders_shipment WHERE current_status in ('new', 'ready_for_delivery') ORDER BY RANDOM() LIMIT 1)"

println(Query)