function
定义:
create or replace function getApple(userCode number)
return number
is
apple number;
begin
select apple into apple from t_user where user_code=userCode;
return apple;
end;
/
drop table t_friend purge;--删除表,同时回收表空间,不可恢复
begin
for i in 1...10 loop
dbms_output.put_line(i);
end loop;
end;
create or replace function wait_char(t_char char)
return char deterministic --确定返回值时,oracle会减少重复不必要的工作(缓存),即确定返回值函数(根据输入参数确定返回值)
is
begin
sys.dbms_lock.sleep(1);--睡眠1秒
return p_char;
end;
/