一、syntax:
CREATE [OR REPLACE] FUNCTION function_name (
parateter1 [IN | OUT | IN OUT ] datatype [ DEFAULT := value],...)
RETURN return_datatype
AS | IS
/*declare section here*/
BEGIN
/*executeable section here*/
END function_name; Note:1.参数列表之后,必须包含一个RETURN语句,来指明返回值的类型,但不能约束返回值的长度、精度、刻度等。
2.在函数体的定义中,必须至少包含一个RETURN语句,来指明函数的返回值。
二、Example
create or replace function detector_plsql_fn(
v_in in varchar2,v_out out varchar2)
return varchar2
as
/* declare section here */
begin
dbms_output.put_line('v_in:'||v_in);
v_out := v_in;
return 'ret of '||v_out;
end detector_plsql_fn;..
PL/SQL函数创建与使用详解
2517

被折叠的 条评论
为什么被折叠?



