Oracle1写pl/sql程序,变量有汉字输入报错处理

---35、写出一段PL/SQL程序,输入项目类别,统计出该类别的资金金额总额。(2分)
declare
ta project.protype%type:=&h;
mons project.promoney%type;
begin
select sums into mons  from(
select sum(promoney) sums,protype from project group by protype ) d
where d.protype=ta ;

dbms_output.put_line(ta||'资金金额总额'||mons);
end;

 使用声明时带汉字,所以声明时需要加单引号

declare
ta project.protype%type:='&h';
mons project.promoney%type;
begin
select sums into mons  from(
select sum(promoney) sums,protype from project group by protype ) d
where d.protype=ta ;

dbms_output.put_line(ta||'资金金额总额'||mons);
end;
 

猜你喜欢

转载自blog.csdn.net/qq_38735996/article/details/89212807
今日推荐