MySQL Forums
Forum List  »  General

New EXISTS() functionality in 5.5?
Posted by: Eric McNeill
Date: January 05, 2011 04:24PM

On the web I find lots of discussions about how this typical SQL Server sproc syntax doesn't work on MySQL:

IF EXISTS(SELECT * FROM Foo WHERE Bar = 'x') THEN
-- do something
END IF;

However I'm finding that on MySQL 5.5.8 it works just fine. Is EXISTS() used in this context a new feature in 5.5? In the docs I see it mentioned as being used in subqueries or as part of statements such as CREATE DATABASE, but it seems to stand on its own, e.g.

SET @x = EXISTS(Select * FROM Foo);

This would be a great boon to those out there using count(*) for this sort of thing.

Eric

Options: ReplyQuote


Subject
Written By
Posted
New EXISTS() functionality in 5.5?
January 05, 2011 04:24PM


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.