i have an stored procedure like below:
SET temp_Today = SUBSTR(( NOW() + 0) FROM 3 FOR 6);
SET temp_LastIdDoc = CONCAT(temp_Today,temp_IdAgency);
SELECT NumDoc FROM tbldocument WHERE NumDoc REGEXP '^temp_LastIdDoc';
i know it’s wrong because it searches for NumDoc that begins with ‘temp_LastIdDoc’. how can i use temp_LastIdDoc as parameter in this query?
and another question is that how can i limit chars that come after it to 4 chars?
You can use this way –