Skip navigation links

MySQL Forums :: UDF :: CREATE OR REPLACE FUNCTION


Advanced Search

Re: CREATE OR REPLACE FUNCTION
Posted by: koustubh dave ()
Date: December 06, 2007 08:28AM

Please help me,

my function is executing properly but according to my requirenment when i execute a select query it was not giving me a proper result which i want

SELECT country_fcn('PAK');

and it give me an error message
"Result consisted of more than one row error no :1172"

and when i put "LIMIT 1" it always gives me the first record of my table

my "mysql verson is 5.0.45"

CREATE FUNCTION `country_fcn`(country_code VARCHAR(25)) RETURNS varchar(60)
READS SQL DATA
BEGIN
DECLARE country_n VARCHAR(60);
DECLARE output_text VARCHAR(25);

SET @output_text = country_code;

SELECT DISTINCT country_name INTO country_n
FROM core_country_master
WHERE country_code = @output_text;
RETURN country_n;

END

Options: ReplyQuote


Subject Views Written By Posted
CREATE OR REPLACE FUNCTION 36715 Ekrem SABAN 06/02/2007 06:19AM
Re: CREATE OR REPLACE FUNCTION 13226 graeme gerber 07/18/2007 08:13AM
Re: CREATE OR REPLACE FUNCTION 6970 William Chiquito 07/18/2007 08:42AM
Re: CREATE OR REPLACE FUNCTION 6686 koustubh dave 12/06/2007 08:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.