MySQL Forums
Forum List  »  Newbie

Re: A problem with IFstatement.
Posted by: Roland Bouman
Date: July 26, 2005 09:13AM

Hi, since the statements you want to execute conditionally are in fact inserts, you could use a where clause to do it.

Unfornately, MySQL does not have a 'real' DUAL table like oracle (although select 'dual' from DUAL is valid!) so something like:

insert
into pol_polac(polic_id, action_name)
select @@last_insert_id,'pm_proj_admin'
from dual
where @hadProductTarget = 0

won't work. (sadly, it *does* work without the where)

You can create sucha a table yourself:

create temporary table onerow (onerow enum('onerow') default 'onerow' primary key);

insert into onerow (onerow) values ('onerow');

and then do

insert
into pol_polac(polic_id, action_name)
select @@last_insert_id,'pm_proj_admin'
from onerow
where @hadProductTarget = 0

Options: ReplyQuote


Subject
Written By
Posted
Re: A problem with IFstatement.
July 26, 2005 09:13AM


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.