I have a question about the in parameter type of a stored procedure. Normally the definition of a parameter will look like this:
in param_test VARCHAR(100)
Do you know if I can defined a parameter like this?:
in param_test table.column%type
This way the parameter will be the same type as the column开发者_高级运维 of an specific table. So if the column type change from varchar(100) to varchar(250) I don't have to change the parameter type in the stored procedure.
I know It's possible in Oracle, but I don't know if it is in MySQL.
Thank you very much for your time and help.
Regards.
That syntax is not supported in MySQL. You need to explicitly declare the datatype for a parameter in a stored program.
If you want to protect yourself from future changes to the max length of a varchar column, you can just use the TEXT
datatype for the parameter,
how to pass parameter value to database of text datatype.. i am using this code mysql_CommandLtp.Parameters.Add("@prmName", MySqlDbType.Text); mysql_CommandLtp.Parameters["@prmName"].Value = prmName.ToString().Trim();
精彩评论