Return message using declare?

Asked

Viewed 23 times

0

I need to check a variable on MySQL similar to that of the SQLSERVER. where i check return on a variable in the bank’s own message example in SQLSERVER I do so:

DECLARE @nome VARCHAR(20) = 'NOME'
PRINT @Nome;

when running this code the database returns me: NAME.

But I can’t do it in MySQL

  • Try using SET instead of DECLARE.

  • 1

    @Kayobruno "in place" I think it is not possible, if change the declare for set won’t work, maybe use a set after the declare That’s what you meant?

  • Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).

1 answer

1

The MySQL does not have print.

Instead make a SELECT of your variable:

SET @nome = 'NOME';    
SELECT @nome;
  • It worked perfectly...Thank you

  • @user143412 do not forget to mark the answer as accepted

Browser other questions tagged

You are not signed in. Login or sign up in order to post.