我在Sybase中创建了一个过程
System.exit()
当我尝试执行程序时
create procedure prcrms_crms_cust_id_verify_ins(@customer_code numeric(12,0),@id_type tinyint,@verification_status varchar(12),@verification_response varchar(255),@verification_date datetime,@add_user varchar(21)) as
begin
declare @check_id_exists int
select @check_id_exists = count(*) from crms_customer_id_verification where ( ('customer_code'=@customer_code) and ('id_type'=@id_type))
if(@check_id_exists > 0)
begin
update crms_customer_id_verification set verification_status=@verification_status,verification_response=@verification_response,verification_date=@verification_date where ( ('customer_code'=@customer_code) and ('id_type'=@id_type))
return @@rowcount
end
if((@check_id_exists <> null) or (@check_id_exists <> 0))
begin
insert into crms_customer_id_verification(customer_code,id_type,verification_status,verification_response,verification_date,add_user) values(@customer_code,@id_type,@verification_status,@verification_response,@verification_date,@add_user)
return @@rowcount
end
end
它显示'3344'附近的语法不正确。
答案 0 :(得分:0)
/*
create procedure prcrms_crms_cust_verify_ins(@customer_code varchar(255),@id_type varchar(255) ,@verification_status varchar(12),@verification_response varchar(255),@verification_date varchar(255),@add_user varchar(21))as
/*
** ------------------------------------
** Created By : Bibil Mathew Chacko
** Created On : Jul 16 2016
** Description : insert in crms_customer_id_verification if id_type and customer exist.Update table if customer and id_type exist.
** -------------------------------------
*/
begin
declare
@check_id_exists int,
@cc numeric,
@id_t tinyint,
@vd datetime
select @cc = convert(numeric(12,0),@customer_code)
select @id_t = convert(tinyint,@id_type)
select @vd = convert(datetime,@verification_date)
select @check_id_exists = count(*) from crms_customer_id_verification where ( (customer_code=@cc) and (id_type=@id_t))
if(@check_id_exists > 0)
begin
update crms_customer_id_verification set verification_status=@verification_status,verification_response=@verification_response,verification_date=@vd where (customer_code=@cc and id_type=@id_t)
return @@rowcount
end
if((@check_id_exists <> null) or (@check_id_exists <> 0))
begin
insert into crms_customer_id_verification(customer_code,id_type,verification_status,verification_response,verification_date,add_user) values(@cc,@id_t,@verification_status,@verification_response,@vd,@add_user)
return @@rowcount
end
end
*/
/*exec prcrms_crms_cust_verify_ins '3344','0',"VERIFIED",'{test:test}','1998-09-09 12:12:12.000','Admin'*/
应该使用VARCHAR类型作为参数和过程应该支持转换为所需类型。我做的另一个错误是Sybase Procedures没有括号。