CREATE OR REPLACE PROCEDURE P_ADD_KNOWLEDGELIB
-- in 传入 out 传出 没in或out代表即默认为in
(I_KLTITLE VARCHAR2,
I_KLNAME VARCHAR2,
I_KLTYPE VARCHAR2,
I_STAFFNO VARCHAR2,
O_KLID OUT NUMBER) AS
V_KLNAME VARCHAR2(50);
BEGIN
-- o_klId := seq_kl_klId.Nextval;(错误的做法Error: PLS-00357: 在此上下文中不允许表, 视图或序列引用 'SEQ_KL_KLID.NEXTVAL')
SELECT SEQ_KL_KLID.NEXTVAL INTO O_KLID FROM DUAL;
V_KLNAME := O_KLID + I_KLNAME;
DBMS_OUTPUT.PUT_LINE('o_klId:' || O_KLID);
DBMS_OUTPUT.PUT_LINE('v_klName:' || V_KLNAME);
INSERT INTO T_CC_KNOWLEDGELIB
(KLID, KLTITLE, KLNAME, KLTYPE, STAFFNO)
VALUES
(O_KLID, I_KLTITLE, V_KLNAME, I_KLTYPE, I_STAFFNO);
END;
oracle 存储过程使用 sequence
最新推荐文章于 2021-05-12 21:50:56 发布