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
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf2fc5-31685.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf2fc5-31685.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?