dbTalk Databases Forums  

Is this a bug of stored procedure?

mailing.database.myodbc mailing.database.myodbc


Discuss Is this a bug of stored procedure? in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Is this a bug of stored procedure? - 05-10-2006 , 10:23 PM






------=_Part_28877_17722556.1147317789094
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

I tried to pass the name of a table into a procedure and use that in a
select statement. Somehow it doesn't work. Here is the code:

create procedure sp3(in tablename varchar(10))
begin
select count(*) from tablename;
end$

When the procedure is called, I got the following error: ERROR 1146 (42S02)=
:
Table 'test.tablename' doesn't exist.

Does anyone know why my code generated an error? Is this a bug?

Thanks,

Tom

------=_Part_28877_17722556.1147317789094--

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Is this a bug of stored procedure? - 05-10-2006 , 10:42 PM






------=_Part_29366_6799531.1147318958105
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

never mind. I found the answer:

http://dev.mysql.com/tech-resources/...toredproc.html



On 5/10/06, tom soyer <tom.soyer (AT) gmail (DOT) com> wrote:
Quote:
Hi,

I tried to pass the name of a table into a procedure and use that in a
select statement. Somehow it doesn't work. Here is the code:

create procedure sp3(in tablename varchar(10))
begin
select count(*) from tablename;
end$

When the procedure is called, I got the following error: ERROR 1146
(42S02): Table 'test.tablename' doesn't exist.

Does anyone know why my code generated an error? Is this a bug?

Thanks,

Tom

------=_Part_29366_6799531.1147318958105--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.