insert into tb_shop(id,name)values(232,'²âÊÔ') where not exists(select * from tb_shop where id=232); ÎÒÏëÅжÏÈç¹ûÊý¾Ý±ítb_shopÖв»´æÔÚ232ÕâÌõ¼Ç¼Ôò½øÐвåÈë¡£¡£sqlÓï¾äÈçÉÏ
²åÈëºÍ²éѯ²»ÄÜÔÚÒ»ÌõÓï¾äÀïÖ´ÐÐ, Óô洢¹ý³Ì insert ²»ÄܼÓwhereµÄ SQL code: declare num int; begin select count(1) into num tb_shop where id = 232; if num > 0 then insert into tb_shop(id,name) values(232,'²âÊÔ'); end if; end; /
µôÁ˸öfrom....... SQL code: declare num int; begin select count(1) into num from tb_shop where id = 232; if num > 0 then insert into tb_shop(id,name) values(232,'²âÊÔ'); end if; end; /