| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pl/sql to validate email addresses
I haven't got sql*plus in front of me at the mo to test this so the
following could be a bit ropey! (I can't remember the order of
parameters of the replace command, i think its right).
We can assume that an email address shouldn't have spaces or 2 @ signs. Returns TRUE if the address is valid.
Function Validate_Email(vEmailAddress in varchar2) return boolean is
vBeforeLength number := 0;
vAfterLength number := 0;
begin
vBeforeLength := length(vEmailAddress);
vAfterLength := length(replace(vEmailAddress, '@@','')); if vBeforeLength = vAfterLength then
return FALSE;
end if;
end;
In article <3835477A.46C9E60D_at_sheffield.ac.uk>,
j.m.whitehead_at_sheffield.ac.uk wrote:
> Does anybody know where I can get a pl/sql routine that will
> validate an
> entered email address? For example if somebody enters
> xyz_at_xyz.com
> it will accept it as valid but:
> xyz @ xyz . com
> wouldn't be accepted as valid. The validation doesn't need to be
> sophisticated just something that makes it hard for a user to
> enter a
> value that could never be a valid email address.
> TIA,
> Jon.
![]() |
![]() |