Jump to content

stored procedure erro ?


y

Recommended Posts

hello falks

 

please i've done this procedure to insert into two related tables

 

create procedure sp_new_empdet
    -> (in p_name varchar(50),in p_address varchar(100),in p_phone varchar(20))
    -> begin 
    -> insert into emp(name) values(p_name);
    -> insert into emp_details(id,address,phone) values(last_insert_id(),p_address,p_phone);
    -> end;
    -> $$

 

the procedure created successfuly, but when i call it to add row like this

call sp_new_emp('y1','y1address','y1123');
    -> $$
ERROR 1318 (42000): Incorrect number of arguments for PROCEDURE db1.sp_new_emp; expected 1, got 3

 

please help me to correct the error in code

 

thnx

 

 

Link to comment
Share on other sites

the procedure that you posted:

 

create procedure sp_new_empdet
    -> (in p_name varchar(50),in p_address varchar(100),in p_phone varchar(20))
....
....

 

the posted error:

ERROR 1318 (42000): Incorrect number of arguments for PROCEDURE db1.sp_new_emp; expected 1, got 3

 

is not the error clear?  ... sp_new_empdet != sp_new_emp

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.