MySQL Forums
Forum List  »  Stored Procedures

Re: excellent performance speed.
Posted by: Felix Geerinckx
Date: November 25, 2005 08:11AM

Roland Bouman wrote:

> select substring(substring_index(@v1:='yes,this,really,is ,fun',',',@n:=1),character_length(substring_index(@v1,',',@n-1))+1) c1
> -> ,substring(substring_index(@v1,',',@n:=@n+1),character_length(substring_index(@v1,',',@n-1))+2) c2
> -> ,substring(substring_index(@v1,',',@n:=@n+1),character_length(substring_index(@v1,',',@n-1))+2) c3
> -> ,substring(substring_index(@v1,',',@n:=@n+1),character_length(substring_index(@v1,',',@n-1))+2) c4
> -> ,substring(substring_index(@v1,',',@n:=@n+1),character_length(substring_index(@v1,',',@n-1))+2) c5
> -> ;

I prefer

SET @v1 := 'yes,this,really,is,fun';
select
substring_index(substring_index(@v1, ',', 1), ',', -1) c1,
substring_index(substring_index(@v1, ',', 2), ',', -1) c2,
substring_index(substring_index(@v1, ',', 3), ',', -1) c3,
substring_index(substring_index(@v1, ',', 4), ',', -1) c4,
substring_index(substring_index(@v1, ',', 5), ',', -1) c5
;

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Views
Written By
Posted
2194
November 24, 2005 07:40AM
1591
November 24, 2005 07:45PM
1639
November 25, 2005 01:30AM
2009
November 25, 2005 04:06AM
Re: excellent performance speed.
1558
November 25, 2005 08:11AM
1559
November 25, 2005 08:19AM
1488
November 25, 2005 03:39PM


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.