Using a prepared statement to get the next sequence value.
Removed count(*) when checking if a sequence exists.