j A L
2010-12-06 21:03:30 UTC
Member_ID NUMBER PRIMARY KEY,
First_Name VARCHAR2(25),
Last_Name VARCHAR2(25),
Street VARCHAR2(25),
City VARCHAR2(15),
Phone CHAR(11),
Valid_Date DATE,
message VARCHAR2(200))
/
this is my code:
it is suppose to add a new member if they do not already exist and give them a new memberid
CREATE OR REPLACE PROCEDURE add_check_member(
p_firstName member.first_name%TYPE, p_lastName member.last_name%TYPE,
p_street member.street%TYPE, p_city members.city%TYPE , p_phone member.phone%TYPE , p_valid member.valid_date%TYPE
, p_memberId member.member_id%TYPE, p_message member.message%TYPE)
is
p_memberId member.id%TYPE :=0;
CURSOR member_cur
IS
SELECT*
FROM member
WHERE member_id = p_memberId;
member_rec member_cur%rowtype;
BEGIN
OPEN member_cur;
FETCH member_cur INTO member_rec;
IF member_cur%notfound THEN
SELECT MAX(S_MEMBER_ID) +1
INTO p_memberId
FROM member;
INSERT INTO member VALUES(
p_memberId, p_firstName, p_lastName, p_street, p_city, p_phone, null);
DBMS_OUTPUT.PUT_LINE('member ID is : ' || p_memberId);
DBMS_OUTPUT.PUT_LINE('New member enrollment is done!! : ' );
ELSE
select memberId
From member
WHERE last_name=p_lastName;
DBMS_OUTPUT.PUT_LINE('members id is' || memberId );
END IF;
CLOSE member_cur;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error Code: ' || SQLCODE);
DBMS_OUTPUT.PUT_LINE('Error Message: ' || SQLERRM);
END add_check_member;
this is my error code:
PL/SQL: Compilation unit analysis terminated
PLS-00410: duplicate fields in RECORD,TABLE or argument list are
not permitted