MySQL

Gene Dascher gedascher at multiservice.com
Wed Jul 18 19:41:37 CDT 2001


You can't do it, as far as I know.  It has to be one or the other.  To
accomplish this task, you have to run 2 separate statements.  The first
one will be the UPDATE statement, and if that fails, you'd need to run
the INSERT statement.  I don't know if MySQL supports blocks of SQL code
(like PL/SQL in Oracle), but if it does, you can put both statements in
the same block of code and run it that way. 

Gene

Baker wrote:
> 
> Im trying to write an SQL statement that will update a row if the data
> exists or insert a new row if it doesnt.  All of the web research that I
> have done on this gives me expressions that will not evaluate.  Does
> anyone know how to accomplish this?
> 
> --
>               Jason
>        www.cyborgworkshop.com
> ...and the geek shall inherit the earth...
> 




More information about the Kclug mailing list