MySQL Forums
Forum List  »  Newbie

Re: Help with concat
Posted by: Peter Brawley
Date: September 03, 2016 06:52PM

If a column is specified as a constant in the Where clause, it's redundant in the Select list.

If there's just one table in the From clause, nothing's gained by qualifying column names with the table name.

And if the columns to be selected are predetermined too, the table name isn't a variable, so there's no need for Prepare, assuming a table named tbl ...

select amount from tbl where vesselid = p_vesselID;

If there's a reason we can't see that you need Prepare, you still don't need qualified column names and you otherwise're close ...

set @s = concat( "select amount from ", @t, " where vesselID = ", @v );

Options: ReplyQuote


Subject
Written By
Posted
September 03, 2016 02:26PM
Re: Help with concat
September 03, 2016 06: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.