donpick
asked on
Help defining variables in Mysql code
Running MySql on an HP ML350 G5 server. Operating system is Small Business Server 2008 .
I have written some SQL server stored programs. I am not an expert.
I have now switched to using MySql.
What I want to do is quite simple. I am not sure what MySql calls a stored program.
I want to write a routine which will read a row from a table.
I want to put the fields into variables.
Then I will calculate the values I want and write them to another table.
I know how to write an INSERT and UPDATE sql statements.
My question:
I need to know how to declare variables in a Mysql type of stored program.
May be someone could share some code showing how they declared variables, then created an INSERT statement
with the variables in the INSERT statement?
I have written some SQL server stored programs. I am not an expert.
I have now switched to using MySql.
What I want to do is quite simple. I am not sure what MySql calls a stored program.
I want to write a routine which will read a row from a table.
I want to put the fields into variables.
Then I will calculate the values I want and write them to another table.
I know how to write an INSERT and UPDATE sql statements.
My question:
I need to know how to declare variables in a Mysql type of stored program.
May be someone could share some code showing how they declared variables, then created an INSERT statement
with the variables in the INSERT statement?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Arnold: Thank you for the link.
Hello Zberteoc: Great idea. I don't write much sql code so your ideas are very useful.