分析以下代码的错误并改正:create or replace procedure inuser ( resultStr out char, v_username in VARCHAR2, v_id_card in CHAR, v_password in CHAR ) is a number; b number; age number; temp number; Begin --请自行编辑存储过程函数体 a:=to_number(to_char(sysdate, 'yyyy' )); b:=to_number(to_char(substr('184659994544545',7,4))); age:=b-a; temp:=mod(to_number(to_char(substr(v_id_card,18))),2); if temp=0 then insert into userinfo (userid,username,password,uage,usex,uphone,uemail,id_card) values (userid.nextval,v_username,v_password,age,'女',v_uphone,v_uemail,v_id_card); ResultStr := 'success: 执行成功.'; return; else insert into userinfo (userid,username,password,UAGE,USEX,UPHONE,UEMAIL,ID_CARD) values (userid.nextval,v_username,v_password,age,'男',v_uphone,v_uemail,v_id_card); ResultStr := 'success: 执行成功.'; end if; End;
时间: 2023-06-07 15:10:02 浏览: 172
js代码-计算 时的代码
这段代码有两个错误,第一个是在插入语句的values子句中出现了中文全角括号,需要修改为半角括号。第二个错误是在插入语句的字段列表中出现了大写字母,需要修改为小写字母。
修改后的代码如下:
create or replace procedure inuser (
resultStr out char,
v_username in varchar2,
v_id_card in char,
v_password in char
) is
a number;
b number;
age number;
temp number;
begin
--请自行编辑存储过程函数体
a:=to_number(to_char(sysdate, 'yyyy'));
b:=to_number(to_char(substr('184659994544545',7,4)));
age:=b-a;
temp:=mod(to_number(to_char(substr(v_id_card,18))),2);
if temp=0 then
insert into userinfo (userid,username,password,uage,usex,uphone,uemail,id_card)
values (userid.nextval,v_username,v_password,age,'女',v_uphone,v_uemail,v_id_card);
resultStr := 'success: 执行成功.';
return;
else
insert into userinfo (userid,username,password,uage,usex,uphone,uemail,id_card)
values (userid.nextval,v_username,v_password,age,'男',v_uphone,v_uemail,v_id_card);
resultStr := 'success: 执行成功.';
end if;
end;
阅读全文