MySQL Forums
Forum List  »  Stored Procedures

Error: 1048 Column cannot be null for Insert in Stored Procedure
Posted by: Vikram Singh Saini
Date: December 15, 2012 09:10PM

Hi,

I had created table 'my_user' in MySQL as:

CREATE TABLE `my_users` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`muser` VARCHAR(255) NOT NULL,
`mpass` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;

Next I created Stored Procedure 'sp_test' for inserting values in table as:

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_test`(IN `username` VARCHAR(255), IN `pass` VARCHAR(255))
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
insert into my_users(muser,mpass)
VALUES(@username,@pass);
END

Then after I tried to call SP as:

CALL `sp_test`('Vikram','password')

I got error as:

SQL Error (1048): Column 'muser' cannot be null

PROBLEM STATEMENT: As per my knowledge I had created correct SP. Calling it with some values (that are not null). Then why I am getting this error?

Options: ReplyQuote


Subject
Views
Written By
Posted
Error: 1048 Column cannot be null for Insert in Stored Procedure
55960
December 15, 2012 09:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.