回覆列表
  • 1 # lanfengkd

    參考程式碼:

    包stuPack新增程式碼如下:

    PROCEDURE usp_InsertStudent (

    vage NUMBER,vstuName VARCHAR2);

    包stuPack的程式包主體新增程式碼如下

    PROCEDURE usp_InsertStudent (

    vage NUMBER,vstuName VARCHAR2) As

    BEGIN

    INSERTINTOSTUDENT(stuName,age)

    VALUES(vstuName,vage);

    END;

    主鍵自增方案:

    create sequencestuSeq;

    CREATEORREPLACETRIGGER stu_TRG

    BEFOREINSERTORUPDATEOF stuID

    ON Student

    FOREACHROW

    BEGIN

    IF INSERTING THEN

    SELECT stuSeq.NEXTVAL INTO :NEW.stuID FROM DUAL;

    ELSE

    RAISE_APPLICATION_ERROR(-20020, "不允許更新stuID值!");

    ENDIF;

  • 中秋節和大豐收的關聯?
  • 找泰戈爾的一首詩?