List:General Discussion« Previous MessageNext Message »
From:javad bakhshi Date:September 2 2011 9:51am
Subject:Re: Arrays
View as plain text  
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? 
Best regards,
Javad



________________________________
From: Shawn Green (MySQL) <shawn.l.green@stripped>
To: 
Cc: javad bakhshi <javadbakhshi@stripped>; Johan De Meersman
<vegivamp@stripped>; "mysql@stripped" <mysql@stripped>
Sent: Monday, August 29, 2011 4:51 PM
Subject: Re: Arrays

On 8/27/2011 11:18,  wrote:
>>>>> 2011/08/26 13:58 -0700, javad bakhshi>>>>
>   Thanks guys for the help. but my problem seems to stand unsolved.
> <<<<<<<<
> Right, no arrays. Nothing is left but table. I used a temporary table, but note that
MySQL also does not let table be returned, or passed in. The table-name will be *sigh*
global.
> 
> 

If the table remains an active part of the connection, you always have access to it. It
is possible to pass the name of the table into a stored procedure and use a prepared
statement to do nearly anything you want to do with the data.

What is it you are trying to do with this array in the first place?  It sounds as
though trying to process this data using the set-oriented functions of the SQL language
is causing you more of a problem than the fact that the language doesn't have an array
data type.

There are normally many ways to solve any problem. Perhaps if you shared the problem you
are trying to solve, you can see how many different ways the members of the list can
solve it without resorting to an array?

-- Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN

-- MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
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