I’m running a stored procedure and have ran into a problem with the following line:
SELECT photo_data_id
INTO gallery_rel_id_check
FROM photo_data
WHERE object_type = 4
AND data_id = 0
AND photo_id = row_photo_id LIMIT 1;
In some cases, this query will return 0 rows and thus gallery_rel_id_check doesn’t get a value assigned to it.
For some odd reason, this seems to stop the stored procedure. Should I be assigning gallery_rel_id_check in a different way as I need to use it later in the procudure to check to see if its > 0
Thanks
credit goes to @Paolo Bergantino
Just use:
SET gallery_rel_id_check = (SELECT…);