Last active
April 11, 2020 14:39
-
-
Save yogonza524/0b8d07649d16202675c8 to your computer and use it in GitHub Desktop.
La función se encarga de comprobar que el parametro tenga el formato conocido para los emails. Devuelve TRUE o FALSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION validateEmail(email character varying) | |
RETURNS BOOLEAN AS $$ | |
BEGIN | |
IF (email !~ '^[A-Za-z0-9._%-]+@[A-Za-z0-9-]+[.][A-Za-z]+$') THEN | |
RETURN FALSE; | |
ELSE | |
RETURN TRUE; | |
END IF; | |
END | |
$$ | |
LANGUAGE PLPGSQL | |
SELECT validateEmail('[email protected]'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Saludos amigo.
Cómo realizarías las siguientes restricciones para esta tabla:
Tabla: Speaker
Campos: speaker_code, speaker_name, email, birth_date
Restricciones: