Hi.
Show here code sample
DROP PROCEDURE IF EXISTS `sp_students_INSERT_byPK`
GO
CREATE PROCEDURE sp_students_INSERT_byPK
(
IN p_student_id INT(11) ,
IN p_password VARCHAR(15) ,
IN p_active_flg TINYINT(4) ,
IN p_lastname VARCHAR(30) ,
IN p_firstname VARCHAR(20) ,
IN p_gender_code VARCHAR(1) ,
IN p_is_on_staff TINYINT(4) ,
IN p_birth_dttm DATETIME
)
BEGIN
INSERT INTO students
(
student_id ,
password ,
active_flg ,
lastname ,
firstname ,
gender_code ,
is_on_staff ,
birth_dttm
)
VALUES
(
p_student_id ,
p_password ,
p_active_flg ,
p_lastname ,
p_firstname ,
p_gender_code ,
p_is_on_staff ,
p_birth_dttm
) ;
END
GO
You will note that just like in a INSERT statement you do not have to
use all of the columns available when creating a stored procedure. You
must however populate all columnar data associated with the PK (primary
key), and columns associated with unique indexes (note: there are exceptions to
this, but they will not addressed here), and columns defined in the ddl
as "NOT NULL".