From: Peter Brawley Date: December 26 2008 7:27pm Subject: Re: Question on default database for stored functions List-Archive: http://lists.mysql.com/mysql/215732 Message-Id: <49553031.5090702@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------030604080709090306010903" --------------030604080709090306010903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >select get_area(11); >ERROR 1305 (42000): FUNCTION test2.get_area does not exist >Can someone tell me what I'm doing wrong? Thanks. SELECT dbWhereFunctionWasCreated.get_area(11); PB ----- Jerry Schwartz wrote: > >> -----Original Message----- >> From: blue.trapezius@stripped [mailto:blue.trapezius@stripped] On >> Behalf Of Vikram Vaswani >> Sent: Thursday, December 25, 2008 5:47 AM >> To: mysql@stripped >> Subject: Question on default database for stored functions >> >> Hi >> >> According to the MySQL manual, "By default, a routine is associated with >> the default database.When the routine is invoked, an implicit USE >> db_name is performed (and undone when the routine terminates)" >> >> However, when I tried accessing a stored routine from another database, >> I received an error. Output below: >> >> mysql> USE test >> > [JS] Stupid question, but do you have a semicolon at the end of the USE > statement? > > >> mysql> DELIMITER // >> mysql> CREATE FUNCTION get_area(radius INT) >> -> RETURNS FLOAT >> -> BEGIN >> -> RETURN PI() * radius * radius; >> -> END >> -> // >> Query OK, 0 rows affected (0.13 sec) >> mysql> DELIMITER ; >> mysql> USE test2 >> Database changed >> mysql> select get_area(11); >> ERROR 1305 (42000): FUNCTION test2.get_area does not exist >> >> Can someone tell me what I'm doing wrong? Thanks. >> >> Vikram >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: http://lists.mysql.com/mysql?unsub=jschwartz@the- >> infoshop.com >> > > > > > > > ------------------------------------------------------------------------ > > > Internal Virus Database is out of date. > Checked by AVG - http://www.avg.com > Version: 8.0.176 / Virus Database: 270.9.19/1853 - Release Date: 12/17/2008 8:31 AM > > --------------030604080709090306010903--