這是我寫的預存程序:
create or replace procedure exec_result
( route_value IN NUMBER,
route_value OUT NUMBER)
as
rv INTEGER;
pt VAECHAR2;
rc VAECHAR2;
rv VAECHAR2;
rd VAECHAR2;
pno VAECHAR2;
pname VAECHAR2;
declare cursor log is select route_value,process_time,rsp_code,rsp_desc from log_interface_detail;
begin
for log1 in log loop
rv:=log1.route_value;
pt:=log1.process_time;
rc:=log1.rsp_code;
rd:=log1.rsp_desc;
end loop;
end;
declare cursor pro is select pro_no,pro_name from a_city_code;
begin
for pro1 in pro loop
pno:=pro1.pro_no;
pname:=pro1.pro_name;
end loop;
end;
citycode NUMBER;
begin
select route_value,process_time,rsp_code,rsp_desc into log
from log_interface_detail
where route_value=rv and process_time>='20090224000000';
select areano into citycode from GsmNumberBound
where beginnum<=rv and endnum>=rv;
select pro_no,pro_name into pro from a_city_code
where city_no=citycode;
dbms_output.put_line(rv);
dbms_output.put_line(pt);
dbms_output.put_line(rc);
dbms_output.put_line(rd);
dbms_output.put_line(pno);
dbms_output.put_line(pname);
end exec_result;
/
exec exec_result
編譯出現如下錯誤:
Error(13,1): PLS-00103: 出現符號 "DECLARE"在需要下列之一時: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor 符號 "begin" 被替換為 "DECLARE" 後繼續。
Error(29,10): PLS-00103: 出現符號 "NUMBER"在需要下列之一時: := . ( @ % ; 符號 ":=" 被替換為 "NUMBER" 後繼續。
Error(48): PLS-00103: 出現符號 "end-of-file"在需要下列之一時: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge <a single-quoted SQL string> pipe
不知道為什麼…………