CREATE OR REPLACE PROCEDURE Register_Student (
    p_student_no IN NUMBER,
    p_module_code IN VARCHAR2
)
AS
    v_count NUMBER;
BEGIN
    -- Check if student is already registered
    SELECT COUNT(*)
    INTO v_count
    FROM REGISTRATION
    WHERE Student_No = p_student_no
    AND Module_Code = p_module_code;

    IF v_count = 0 THEN
        INSERT INTO REGISTRATION (Student_No, Module_Code, Registration_Date)
        VALUES (p_student_no, p_module_code, SYSDATE);

        DBMS_OUTPUT.PUT_LINE('Student registered successfully.');
    ELSE
        DBMS_OUTPUT.PUT_LINE('Student is already registered for this module.');
    END IF;
END;
/

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: