mysql - "Column 'option_type_id' cannot be null..." -


I am writing a SQL script and end of the script appears this error.

"column 'Option_type_id' can not be zero

 SET @valor = 10, @ op1: = @valor * 2 - 1, @ op2: = @valor * 2; ... `putting magento`.`catalog_product_option_type_title` (` option_type_title_id`, `option_type_id`,` store_id`, `title`) values ​​(@ OP1, @ OP1, '0', 'DIREITO');` Magento`. `putting catalog_product_option_type_title` (` option_type_title_id`, `option_type_id`,` store_id`, `title`) values ​​(@ op2, @ op2, '0', 'ESQUERDO');` putting Magento`.`catalog_product_option_type_price` ( ` option_type_price_id`, `option_type_id`,` store_id`, `price`,` price_type`) values ​​(@ OP1, @ OP1, '0', '0.0000', 'fixed'); `putting Magento`.`catalog_product_option_type_price` ( `option_type_price_id`,` option_type_id`, `store_id`,` price`, `price_type`) values ​​(@ op2, @ op2, '0', '0.0000', 'fixed'); 

I first Only from Examine the entries and work fine but these entries fail. Please help me. Thank you very much!

Obviously you can either set the variable with = or : = so I have removed my second reply.

You must separate the first row into two sets of commands:

  SET @valor: = 10; SET @ op1: = @valor * 2 - 1, @ op2: = @valor * 2;  

In a liner @valor , the other two assignments are not set before, so they are null .

Returns a simple arithmetic at null in mysql, then @ op1 and @ op2 are in the null .

For the other statement in the script, null will be inserted for @ op1 and @ op2 , but @valor for 10 .


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -