My problem is that I have to create a procedure that has to check if a certain value exists in a table and if it does exist it has to delete some rows from a different table. So far I have tried using a select count(*) from (the select statement) as numOfRows; command but as far I have seen and searched on the internet it only returns the number of rows, without having the possibility to use it further.
I`m interested if there is a way to create something like this:
if (the value exists in the table) then
-- do whatever it has to be done
Any idea is welcome! 🙂
Remember to paramatize statements to avoid SQL Injection but the following should give you a general idea.