From: javad bakhshi Date: September 2 2011 1:09pm Subject: Re: Arrays List-Archive: http://lists.mysql.com/mysql/225637 Message-Id: <1314968983.88968.YahooMailNeo@web125716.mail.ne1.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1400701486-1314968983=:88968" --0-1400701486-1314968983=:88968 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi,=0A=0ANone of the above. :) .This is just an academic research on a benc= hmark. I just want to access my database with this function and return 4 In= teger values. I=A0separated=A0the numbers with comma to process on it later= as an string and split the result using string functions which did work. I= was just wondering if its possible with mysql to return a sequence of numb= ers or not. I think to solve my problem among the ways mentioned before I w= ill create a table with Engine=3DMemory to speed up things. I don't think a= ny other way is possible.=0A=A0=0AThanks,=0AJavad=0A=0A=0A_________________= _______________=0AFrom: Shawn Green (MySQL) =0ATo= : javad bakhshi =0ACc: "mysql@stripped" =0ASent: Friday, September 2, 2011 2:18 PM=0ASubject: Re= : Arrays=0A=0AHello Javad,=0A=0AOn 9/2/2011 05:51, javad bakhshi wrote:=0A>= Hi again,=0A> =0A> Thanks for the tips. My problem is:=0A> I have a Functi= on in Mysql that has some arguments in the signature as=0A> follows:=0A> = =0A> CREATE FUNCTION Myfunction( type TINYINT, sec SMALLINT, vid INTEGER,= =0A> way TINYINT, quid INTEGER, day TINYINT )=0A> RETURNS CHAR(50)=0A> BEGI= N=0A> DECLARE result CHAR(50);=0A> DECLARE Temp DECIMAL(9,1);=0A> SELECT Ta= ble1( vid, day, way) INTO Temp;=0A> IF Temp IS NOT NULL THEN=0A> SELECT CON= CAT_WS(',',sec, 0, quid, Temp) into result;=0A> =0A> ELSE=0A> =0A> SELECT C= ONCAT_WS(',',sec, 0, quid, 0 ) into result;=0A> =0A> END IF;=0A> RETURN res= ult;=0A> END;=0A> =0A> =0A> The problem seems to be solved by using CHAR bu= t I really want to have a=0A> sequence of Integers as the result not CHAR. = The reason that I dont use=0A> a table to insert the result into it and ret= rieve it later is that this=0A> process takes more time that It should. Any= thoughts?=0A=0AActually, that's not 'the problem' you are attempting to so= lve at all. That is an attempt at a 'solution' to the problem.=0A=0AIf I st= are 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 v= alue. However, why you need this list and what it is trying to solve is bey= ond me.=0A=0APlease step back from the SQL end of things for a second and t= alk to us about the actual problem you are trying to solve. Are you generat= ing 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 ste= p 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 larg= er problem.=0A=0ARegards,=0A-- Shawn Green=0AMySQL Principal Technical Supp= ort Engineer=0AOracle USA, Inc. - Hardware and Software, Engineered to Work= Together.=0AOffice: Blountville, TN --0-1400701486-1314968983=:88968--