Groovy sql, if the query result is empty set, but I want to use a value to represent it, what to do with it?

    loan_db.eachRow("""select stepid from mytable WHERE userid =:userid
        AND TIMESTAMPDIFF (month,LastUpdateDate,now()) <1
        AND LastUpdateDate < now() ORDER BY id DESC limit 1""",userid:userid){
        expectValue.add(it.stepid);
    }
    

this query may return empty set
, but I want to record this, using a value to represent
if there is a value, add the actual result. If it is empty set, I want to use a value, such as null or 0, what to do with

I found that my brain was short-circuited. It would be nice to initialize the corresponding variables first. If there is a value, re-assign the update. If the empty set does not execute anyway, it is the initialized value

.

it"s embarrassing to find that you can"t delete the problem

Mar.02,2021
Menu