SQL for mysql and Oracle and removed debug