MySQL Forums
Forum List  »  Stored Procedures

Re: excellent performance speed.
Posted by: Roland Bouman
Date: November 25, 2005 04:06AM

If it's Ok to have one more difference between the first and the remaining expression, you could do this:

substring(substring_index(@v1:='what,fun,no?',',',@n:=1),character_length(substring_index(@v1,',',@n-1))+1)

for the first one (+1 instead of +1+if(@n=1,0,1))

and this:

substring(substring_index(@v1,',',@n:=@n+1),character_length(substring_index(@v1,',',@n-1))+2)

for the remaining expressions (+2 instead of +1+if(@n=1,0,1)):


mysql> 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
-> ;

Options: ReplyQuote


Subject
Views
Written By
Posted
2196
November 24, 2005 07:40AM
1592
November 24, 2005 07:45PM
1639
November 25, 2005 01:30AM
Re: excellent performance speed.
2009
November 25, 2005 04:06AM
1561
November 25, 2005 08:11AM
1559
November 25, 2005 08:19AM
1489
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.