【发布时间】:2011-03-01 21:02:35
【问题描述】:
我正在尝试设置输出参数thirdPartyId 的值,但在set thirdPartyId 语句中出现missing or invalid option 错误消息。
PROCEDURE usp_insert_user( userType VARCHAR2,
logonId VARCHAR2,
title VARCHAR2,
firstName VARCHAR2,
middleName VARCHAR2,
lastName VARCHAR2,
comments VARCHAR2,
thirdPartyId OUT number) AS
begin
set thirdPartyId := select max(third_party_id) + 1 from third_party_user_temp;
insert into THIRD_PARTY_USER_TEMP
(Third_party_id,web_logon_id,prsn_type_cd,prsn_title_nm,
prsn_first_nm,prsn_mdl_nm,prsn_last_nm,addtnl_third_party_txt)
VALUES(thirdPartyId,logonId,upper(userType),title,
firstName,middleName,lastName,comments)
;
end usp_insert_user;
这样做的正确方法是什么?
谢谢!
更新:这样更安全吗?
insert into THIRD_PARTY_USER_TEMP
(Third_party_id,web_logon_id,prsn_type_cd,prsn_title_nm,
prsn_first_nm,prsn_mdl_nm,prsn_last_nm,addtnl_third_party_txt)
VALUES((select max(third_party_id) + 1 from third_party_user_temp),logonId,upper(userType),title,
firstName,middleName,lastName,comments)
returning third_party_id into thirdPartyId
【问题讨论】:
标签: sql oracle stored-procedures output-parameter