gpt4 book ai didi

mysql程序: syntax,语法,语法……太难找了

转载 作者:行者123 更新时间:2023-11-29 20:55:06 26 4
gpt4 key购买 nike

这是我的程序:

delimiter //
drop procedure if exists migContactToActor;
create procedure migContactToActor()
begin
declare vctaid int;
declare firstname char(255);
declare lastname char(255);
declare phone char(255);
declare cellphone char(255);
declare fax char(255);
declare mail char(255);
declare location char(255);
declare extcode char(255);
declare vcpyid int;
declare vquaid int;
declare userModif char(255);
declare entityIdResp int;
declare niveauCreat char(255) default "contactMigration2.21";
declare userCreat char(255) default "contactMigration2.21";
declare backIdResp int;
declare userIdResp int;
declare zipcode char(255);
declare country char(255);
declare dateModif char(255);
declare dateCreated char(255);
declare dateRelation char(255);
declare groupLabel char(255);
declare adminLogId int;
declare finContact boolean default 0;
declare ctt int default 1; /* decompte contacts */
declare entityName char(255) default ''; /* entite courante du user a linker */
declare entityId int default 0; /* et son Id */
declare vctaidPrev int default 0;

declare curs1 cursor for select
ctaid, ctafirstname,ctalastname,ctaphone,ctacellphone,ctaemail,
substr(concat_ws(' ',ctaaddress,ctaaddress2,ctacity,ctazipcode),1,255),ctacode, cpyid,quaid,C.enoid_resp,
ctafax,C.actid_bck,ctadate_created,ctacountry,ctadate_modified,C.actid_resp,ctauser_modified, G.hemlabel, R.sync_update
from contact C
left join hd_contact_group_relationship R on R.hbhid = C.ctaid
left join hd_contact_group G on G.hemid = R.hemid
where !ifnull(C.ctaflagdeleted,0) and !ifnull(G.hemflag_deleted,0);
declare continue handler for not found set finContact = 1;
declare continue handler for sqlexception
begin
rollback;
end;

select '======== debut ...';
drop table if exists ent221;
create temporary table ent221 as select enoid, enoname from entityowner where enoname like 'CLI.CG_%.CLI';
alter table ent221 add index(enoname); /* not unique in dev, fetch the first in prod if any */

set autocommit = 0; /* TTT */
start transaction; /* TTT */
open curs1;
contactloop:loop
fetch curs1 into vctaid, firstname,lastname,phone,cellphone,mail,location,extcode,vcpyid,vquaid,entityIdResp,
fax,backIdResp,dateCreated,country,dateModif,userIdResp,userModif,groupLabel,dateRelation;
if finContact then
close curs1;
leave contactloop;
end if;
if vctaid = vctaidPrev then
set vctaidPrev = vctaid;
if (mod(ctt,100) = 0) then
set @msg = concat(ctt, ' contacts migrated');
select @msg;
end if;
update OPMSequence set counter = (@wbuf1 := counter) + 1 where name = 'ACTOR';
insert into actor (actid,cpyid,actlastname,actfirstname,actemail,actphone,actmobilephone,
actlocalisation, actid_responsible_owner,actid_backup_owner,enoid_responsible_owner,
actuser_created,actniveau_created, actdate_created,actuser_modified,
actdate_modified,actcountry,actfax,actqualifid,actexternal_code)
values
(@wbuf1,vcpyid,lastname,firstname,mail,phone,cellphone,location,userIdResp,backIdResp,entityIdResp,
userCreat,niveauCreat,dateCreated,userModif,dateModif,country,fax,vquaid,extcode);

update adminLog set adltype = 'User', adlobject_id = @wbuf1,
adlobject_description = concat(adlobject_description,'//oldContact=',vctaid)
where adlobject_id = vctaid and adltype = 'Contact';
end if;

if groupLabel is not null then
set @entName = concat('CLI.CG_',groupLabel,'.CLI);
select enoid from ent221 where enoname = @entName limit 1 into @wbuf2;
if @wbuf2 is not null then
insert into actorentityrelationship (enoid,actid,aerdate_created,aerniveau_created) values
(@buf2,@wbuf1,dateRelation,niveauCreat);
enf if;
end if;
set ctt = ctt + 1;
end loop contactloop;
rollback; /* TTT */
end //

delimiter ;
call migContactToActor;
drop procedure migContactToActor;

这是为什么???查询正常,0 行受影响,1 条警告(0.00 秒)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''.CLI); select enoid from ent221 where enoname = @entName limit 1 into @wbuf2' at line 83

最佳答案

我想你错过了引号

set @entName = concat('CLI.CG_',groupLabel,'.CLI);

带引号

set @entName = concat('CLI.CG_',groupLabel,'.CLI');

关于mysql程序: syntax,语法,语法……太难找了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37703857/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com