List:General Discussion« Previous MessageNext Message »
From:chamila gayan Date:March 16 2010 4:46am
Subject:Re: udf return column name not value
View as plain text  
Thank you for your speedy reply.

I tried on your way. But it gives *error* as "*Dynamic SQL is not allowed in
stored function or trigger*". I'm using *MySql 5* as my sever. How can I
solve that.

thank you

On Mon, Mar 15, 2010 at 11:43 PM, Gavin Towey <gtowey@stripped> wrote:

> You'll have to do something like this:
> SET @sql := CONCAT('select ',columnname,' into retval from user where
> ID=',id);
> PREPARE mySt FROM @sql;
> -----Original Message-----
> From: chamila gayan [mailto:cgchamila@stripped]
> Sent: Monday, March 15, 2010 12:58 AM
> To: mysql@stripped
> Subject: udf return column name not value
> CREATE FUNCTION getcolumnvalue(id int,columnname varchar(30))
> begin
> declare retval varchar(50);
> return retval;
> end;
> I want get value of related column but it return column name.
> ex:- ('tom' what I want but it return 'name')
> plz tell what the wrong of this
> thank you
> This message contains confidential information and is intended only for the
> individual named.  If you are not the named addressee, you are notified that
> reviewing, disseminating, disclosing, copying or distributing this e-mail is
> strictly prohibited.  Please notify the sender immediately by e-mail if you
> have received this e-mail by mistake and delete this e-mail from your
> system. E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed, arrive late
> or incomplete, or contain viruses. The sender therefore does not accept
> liability for any loss or damage caused by viruses or errors or omissions in
> the contents of this message, which arise as a result of e-mail
> transmission. [FriendFinder Networks, Inc., 220 Humbolt court, Sunnyvale, CA
> 94089, USA,

udf return column name not valuechamila gayan15 Mar
  • RE: udf return column name not valueGavin Towey15 Mar
    • Re: udf return column name not valuechamila gayan16 Mar