I have table tab1 (pseudo-structure)
tab1
{
fname char(20)
code int
}
I have a procedure like this
change(a varchar(20) )
{
update tab1
set code = a where fname = 'lisa'
}
I want a was every thing except int;
i want convert varchar to int and int to varchar too.
You won’t need it. If you invoke it
CALL change('123a31')MySQL will do its best to get a number out of your varchar.If you absolutely need to cast try
SELECT CAST('123' AS SIGNED)MySQL Docs