mysql - Procedure isn't doing anything -


please, me modify mysql code below?

it not affecting rows like. :/ beginner.

delimiter $$ drop procedure if exists category$$   create procedure category() begin  declare count int default 877;  declare prd int;     while count < 1040     select product_id prd xxx_hikashop_product     (replace(product_name, 'model ', '') = count);     insert xxx_hikashop_product_category     (product_category_id, category_id, product_id, ordering)    values    (1445+count, 33, prd, count);      set count = count + 1;  end while; end$$  delimiter ;  printed error:  #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near     'select product_id elody_hikashop_product replace(product_alias,  'mode' @ line 7 

i'm going assume product_alias field has form "model 888" , trying extract numeric value, , compare count. need convert resulting string number, using:

select product_id prd xxx_hikashop_product (convert(replace(product_name, 'model ', ''), unsigned) = count); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -