- zhanggenzhong
- 等级: 初级会员
- 性别:
- 文章: 8
- 积分: 72
- 来自: 上海
|
第一次用存储过程,总结一下今天写的第一个存储过程
该存储过程主要实现简单插入操作
sql 代码
- create or replace procedure pro_add_operation_log(
- operation_name in sys_operation_log.operation_name%type,
- operation_desc in sys_operation_log.operation_desc%type,
- operator_name in sys_operation_log.operator_name%type,
- operation_date in varchar2,
- out_return out number,
- out_error_msg out varchar) is
-
- SUCCESS NUMBER := 0;
- EXCEPTION_CALL_SP number:= -103;
-
- begin
- insert into sys_operation_log(log_id,
- operation_name,
- operation_desc,
- operator_name,
- operation_date)
- values
- (seq_operation_log.nextval,
- operation_name,
- operation_desc,
- operator_name,
- to_date(operation_date,'YYYY-MM-DD HH24:MI:SS'));
- commit ;
- out_return:= SUCCESS;
- exception
- when others then
- rollback;
- out_error_msg := 'encounter a exception,'||'sql code:'||sqlcode||'sqlerrm:'||sqlerrm;
- out_return:= EXCEPTION_CALL_SP;
- end pro_add_operation_log;
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
返回顶楼 |
|
|