List:General Discussion« Previous MessageNext Message »
From:javad bakhshi Date:September 2 2011 1:09pm
Subject:Re: Arrays
View as plain text  
Hi,

None of the above. :) .This is just an academic research on a benchmark. I just want to
access my database with this function and return 4 Integer values.
I separated the 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 numbers or not. I think to solve my problem
among the ways mentioned before I will create a table with Engine=Memory to speed up
things. I don't think any other way is possible.
 
Thanks,
Javad


________________________________
From: Shawn Green (MySQL) <shawn.l.green@stripped>
To: javad bakhshi <javadbakhshi@stripped>
Cc: "mysql@stripped" <mysql@stripped>
Sent: Friday, September 2, 2011 2:18 PM
Subject: Re: Arrays

Hello Javad,

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
> follows:
> 
> CREATE FUNCTION Myfunction( type TINYINT, sec SMALLINT, vid INTEGER,
> way TINYINT, quid INTEGER, day TINYINT )
> RETURNS CHAR(50)
> BEGIN
> 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;
> 
> ELSE
> 
> SELECT CONCAT_WS(',',sec, 0, quid, 0 ) into result;
> 
> END IF;
> RETURN result;
> END;
> 
> 
> 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.

Regards,
-- Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN
Thread
Arraysjavad bakhshi24 Aug
  • Re: Arrayshsv26 Aug
    • Re: ArraysJohan De Meersman26 Aug
      • Re: Arraysjavad bakhshi26 Aug
        • Re: ArraysMichael Dykman27 Aug
        • Re: Arrayshsv27 Aug
          • Re: ArraysArthur Fuller27 Aug
            • Re: ArraysJohan De Meersman28 Aug
          • Re: ArraysJohan De Meersman28 Aug
            • Re: Arrayshsv29 Aug
          • Re: ArraysMichael Dykman28 Aug
          • Re: ArraysMySQL)29 Aug
            • Re: Arraysjavad bakhshi2 Sep
              • Re: ArraysMySQL)2 Sep
                • Re: Arraysjavad bakhshi2 Sep
                  • Re: Arrayshsv2 Sep