先看程序

create or replace function get_content
(v_title in xland.title%type,v_content out xland.content%type)
return number
is
v_state number;
begin
select state,content into v_state,v_content from xland where title = v_title;
return v_state;
end get_content;

参数可分为输入参数和输出参数
函数还有返回值
is和begin之间是定义部分
函数其实与过程类似

看调用过程

declare
 xland varchar2(222):= 'xland';
 content varchar2(2048);
 out_v number;
begin
 out_v := get_content(xland,content);
 dbms_output.put_line(to_char(out_v));
 dbms_output.put_line(content);
end;


定义了三个变量
前两个是函数的参数
后一个是返回值

看输出结果

0
xland is my name



删除一个过程

drop function yourfuncname

相关文章:

  • 2021-09-28
  • 2021-06-30
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2022-01-10
猜你喜欢
  • 2022-12-23
  • 2021-07-19
  • 2021-12-27
相关资源
相似解决方案