//---------------- 声明部分 ----------------
create or replace package Pro_Test_User is
PROCEDURE Ins_Test_User(I_ID IN VARCHAR2,I_NAME IN VARCHAR2,I_AGE IN VARCHAR2,O_RET_CODE OUT NUMBER,O_RET_MSG OUT VARCHAR2);
end Pro_Test_User;
//---------------- BODY部分 ----------------
create or replace package body Pro_Test_User is
PROCEDURE Ins_Test_User(I_ID IN VARCHAR2,
I_NAME IN VARCHAR2,
I_AGE IN VARCHAR2,
O_RET_CODE OUT NUMBER,
O_RET_MSG OUT VARCHAR2)IS
v_id Test_User.ID%type;
BEGIN
O_RET_CODE:=0;
O_RET_MSG:='初始化默认成功';
IF I_ID IS NOT NULL AND I_NAME IS NOT NULL AND I_AGE IS NOT NULL THEN
INSERT INTO Test_User(ID,NAME,AGE) VALUES (I_ID,I_NAME,I_AGE) returning ID into v_id;
dbms_output.put_line(v_id);
COMMIT;
O_RET_CODE:=0;
O_RET_MSG:='操作成功';
ELSE
O_RET_CODE:=1;
O_RET_MSG:='没有ID|姓名|年龄';
END IF;
EXCEPTION
WHEN OTHERS THEN
O_RET_CODE:=-1;
O_RET_MSG:='sql执行过程出错啦!';
END Ins_Test_User;
end Pro_Test_User;