+ 1
Stored program seems to work but not returning values
I am a complete newbie at coding and SQL. I just started taking a class and we are learning stored programs. I am trying to get the result set to display the number of invoices that are over $6,000. The action output box says it should work but I am not getting any returned rows. Any help would be appreciated! Use ap; Drop Procedure If Exists balance; Delimiter // Create Procedure balance() Begin Declare invoice_total INT; Select count(invoice_total) Into invoice_total From invoices Where invoice_total >=6000; If invoice_total >=6000 then Select Concat (count(invoice_total), 'invoices exceed $6000') As message; End if; End// Delimiter ; Call balance();
1 Respuesta
0
I am not experienced with MySQL but I think you need to distinguish between the local variable invoice_total and the field name invoice_total. The local variable should be delimited with an @ sign in front of it wherever it is used in the code, like ... INTO @invoice_total.