Hi, Can i know is this the correct way to declare using MySQL? Because i keep hitting error which state that I have an error in your SQL syntax;
What I have tried:
<pre>CREATE DEFINER =
'
root'
@
'
localhost'
PROCEDURE db.Hello( )
BEGIN
DECLARE @Text VARCHAR(MAX);
SET @Text =
'
hello'
;
As shared by Garth in comments, VARCHAR(MAX) is SQL Server way.
For MySQL: Refer:
MySQL :: MySQL 8.0 Reference Manual :: 11.3.2 The CHAR and VARCHAR Types
[
^
]
How to declare in MySQL:
DECLARE
variable_name datatype(size) [
DEFAULT
default_value];
Quote:
Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used. See Section 8.4.7, “Limits on Table Column Count and Row Size”.
In contrast to CHAR, VARCHAR values are stored as a 1-byte or 2-byte length prefix plus data. The length prefix indicates the number of bytes in the value. A column uses one length byte if values require no more than 255 bytes, two length bytes if values may require more than 255 bytes.
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.