On 9/2/2011 05:51, javad bakhshi wrote:
> Hi again,
> Thanks for the tips. My problem is:
> I have a Function in Mysql that has some arguments in the signature as
> CREATE FUNCTION Myfunction( type TINYINT, sec SMALLINT, vid INTEGER,
> way TINYINT, quid INTEGER, day TINYINT )
> RETURNS CHAR(50)
> DECLARE result CHAR(50);
> DECLARE Temp DECIMAL(9,1);
> SELECT Table1( vid, day, way) INTO Temp;
> IF Temp IS NOT NULL THEN
> SELECT CONCAT_WS(',',sec, 0, quid, Temp) into result;
> SELECT CONCAT_WS(',',sec, 0, quid, 0 ) into result;
> END IF;
> RETURN result;
> The problem seems to be solved by using CHAR but I really want to have a
> sequence of Integers as the result not CHAR. The reason that I dont use
> a table to insert the result into it and retrieve it later is that this
> process takes more time that It should. Any thoughts?
Actually, that's not 'the problem' you are attempting to solve at all.
That is an attempt at a 'solution' to the problem.
If I stare very hard into my crystal ball and use all of my
psychic-SQL-fu, all I can tell is that you are attempting to build some
kind of comma-separated value. However, why you need this list and what
it is trying to solve is beyond me.
Please step back from the SQL end of things for a second and talk to us
about the actual problem you are trying to solve. Are you generating
nuclear launch codes? Are you indexing someone's genome? Are you trying
to build a web page? All of this SQL coding is designed to be a single
step in some larger process. If you share that larger purpose with us,
we may be able to suggest a more efficient approach than arrays to solve
your larger problem.
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN