我正在编写一个名为 MAKE_EMAIL 的存储函数,它将接受名字和姓氏的输入参数,并将返回一个包含电子邮件地址的 varchar2 值,其形式为名字的第一个首字母,后跟完整的姓氏,后跟 @hpu.edu .
例如:调用:
select make_email('Edward','Souza')
from dual
...将返回单个值:
'esouza@hpu.edu'
请考虑以下函数代码:
代码:
create or replace function MAKE_EMAIL(lastname varchar2(10),firstname varchar2(10))
return VARCHAR
IS
email VARCHAR2;
BEGIN
email := substr(lastname ,1,1)|| firstname || '@hpu.edu';
RETURN email;
END;
/
运行上述功能后,我遇到了一些错误。请找出以下错误。请让我知道如何删除这些错误或上述代码有任何问题?
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION MAKE_EMAIL:
LINE/COL ERROR
-----------------------------------------------------------------
1/38 PLS-00103: Encountered the symbol "(" when expecting one of the
following:
:= . ) , @ % default character
The symbol ":=" was substituted for "(" to continue.
1/61 PLS-00103: Encountered the symbol "(" when expecting one of the
following:
:= . ) , @ % default character
The symbol ":=" was substituted for "(" to continue.
这是错误的链接: