Stored Procedure/Function of MySql
Stored Procedure/Function of MySql
Hello:
Someone has a simple example to run a stored procedure/function of Mysql ?
Regards
Someone has a simple example to run a stored procedure/function of Mysql ?
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- César E. Lozada
- Posts: 128
- Joined: Wed Oct 26, 2005 12:18 pm
- Location: Los Teques, Miranda, Venezuela
Re: Stored Procedure/Function of MySql
You must pass the parameters:
Regards
PD:
#xDefine Carpe_diem_quam_minimum_credula_postero "Aprovecha el día, no confíes en mañana"
Thanks!
Code: Select all
[SELECT * FROM CLIENTS WHERE State(CLIENTS.ADDRESS,"%WYOMING%")]
CREATE DEFINER = 'root'@'localhost' FUNCTION `State`(cAddress TEXT,cState TEXT)
RETURNS tinyint(1)
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
RETURN cAdress LIKE cState;
END;
PD:
#xDefine Carpe_diem_quam_minimum_credula_postero "Aprovecha el día, no confíes en mañana"
Thanks!
Re: Stored Procedure/Function of MySql
César:
Thanks a lot.
As I know your sample is to create the stored procedure, Now, how can I execute it ?
Regards
Return(.T.)
Thanks a lot.
As I know your sample is to create the stored procedure, Now, how can I execute it ?
Regards
Code: Select all
PD:
#xDefine Carpe_diem_quam_minimum_credula_postero "Aprovecha el día, no confíes en mañana"
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- César E. Lozada
- Posts: 128
- Joined: Wed Oct 26, 2005 12:18 pm
- Location: Los Teques, Miranda, Venezuela
Re: Stored Procedure/Function of MySql
>>As I know your sample is to create the stored procedure, Now, how can I execute it ?
You can execute it only from a MySQL query:
[SELECT * FROM CLIENTS WHERE State(CLIENTS.ADDRESS,"%WYOMING%")]
You can execute it only from a MySQL query:
[SELECT * FROM CLIENTS WHERE State(CLIENTS.ADDRESS,"%WYOMING%")]
Re: Stored Procedure/Function of MySql
Here is the sample to create and Execute StoredProcedure in Mysql
Command to Execute Procedure Sp_Item
Regards,
Sajith
Code: Select all
create Procedure Sp_Item(IN name varchar(25))//Here name is parameter
Begin
select * from Item where Item.name=name;
end;
Code: Select all
CALL Sp_Item('Computer');
Sajith
Re: Stored Procedure/Function of MySql
César & Sajith:
Thank you very much to both
I'll try it
Regards
Thank you very much to both
I'll try it
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Re: Stored Procedure/Function of MySql
Dear Friends:
With your help I was able to create and execute a stored procedure successfully
thanks a lot for that, but I can't execute a STORED FUNCTION, is there a diference ?
Here is the code for my stored function
Regards
With your help I was able to create and execute a stored procedure successfully
thanks a lot for that, but I can't execute a STORED FUNCTION, is there a diference ?
Here is the code for my stored function
Code: Select all
CREATE FUNCTION `sf_hola`() RETURNS char(50)
RETURN('Hola !')
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- César E. Lozada
- Posts: 128
- Joined: Wed Oct 26, 2005 12:18 pm
- Location: Los Teques, Miranda, Venezuela
Re: Stored Procedure/Function of MySql
It runs here!
How are you calling it?
How are you calling it?
Re: Stored Procedure/Function of MySql
César:
This my code
The error message is "Procedure sf_hola does not exist"
And I use MySql 5.0.18
Regards
This my code
Code: Select all
CALL sf_hola('Armandito');
And I use MySql 5.0.18
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Willi Quintana
- Posts: 859
- Joined: Sun Oct 09, 2005 10:41 pm
- Location: Cusco - Perú
- Contact:
Re: Stored Procedure/Function of MySql
HI Maese.
//------------------
DELIMITER $$
DROP PROCEDURE IF EXISTS `cijmey`.`prueba` $$
CREATE PROCEDURE `cijmey`.`prueba` (IN cCodigo VARCHAR(20))
BEGIN
SELECT * FROM kardex WHERE cod_producto = cCodigo ;
END $$
DELIMITER ;
//---------
crealo cpon el Administrator del MySQL, con el Script
y lueco lo llamas con:
CALL prueba('CAS200065')
Salu2
//------------------
DELIMITER $$
DROP PROCEDURE IF EXISTS `cijmey`.`prueba` $$
CREATE PROCEDURE `cijmey`.`prueba` (IN cCodigo VARCHAR(20))
BEGIN
SELECT * FROM kardex WHERE cod_producto = cCodigo ;
END $$
DELIMITER ;
//---------
crealo cpon el Administrator del MySQL, con el Script
y lueco lo llamas con:
CALL prueba('CAS200065')
Salu2
Re: Stored Procedure/Function of MySql
Willi:
Muchas gracias por el ejemplo, ando buscando un ejemplo pero
de stored function.
Saludos
Muchas gracias por el ejemplo, ando buscando un ejemplo pero
de stored function.
Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero