MySQL Forums
Forum List  »  Stored Procedures

Re: Use of SUBSTRING_INDEX in a stored procedure ?
Posted by: Andrew Gilfrin
Date: March 24, 2005 12:52PM

Yves

The first problem is that you not giving your VARCHAR's a length. Also It might be more logical to use set rather than the first select like so.

mysql> create procedure authent(in login_par varchar(20))
-> begin
-> declare domain_name varchar(20);
-> set domain_name = substring_index(login_par,'@',-1);
-> end
-> //
Query OK, 0 rows affected (0.02 sec)

Using select implies that your selecting from a table, where as set immediately identifies your using variables. More of a style issue than anything else so if you happy using select then thats fine.

If you need any more tips check out my site http://www.mysqldevelopment.com it has plenty of info about mysql stored procedures.

Cheers

Andrew Gilfrin
http://www.mysqldevelopment.com

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Use of SUBSTRING_INDEX in a stored procedure ?
4170
March 24, 2005 12:52PM


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.