pl/sql调用存储过程的格式
declare
start_date date:=sysdate-1; -- 开始时间
end_date date:=sysdate; -- 结束时间
begin
CRMSPL.TEST(start_date,end_date);
end;
/你这个存储过程代码不完善哦若查出多于一条的记录会报错的。
declare
start_date date:=sysdate-1; -- 开始时间
end_date date:=sysdate; -- 结束时间
begin
CRMSPL.TEST(start_date,end_date);
end;
/你这个存储过程代码不完善哦若查出多于一条的记录会报错的。
General SQL error.
ORA-00900:无效SQL语句
晕死了要
CURSOR cur_bus_city
IS
SELECT city_code
FROM dim_admin.bs_city_id_t
WHERE city_level = 3;BEGIN
OPEN cur_bus_city;
LOOP
FETCH cur_bus_city INTO v_city_code;
EXIT WHEN cur_bus_city%NOTFOUND; if vv_pay_type = 5
then
begin
select nvl(month_fee,0)
into vn_month_fee0
from RPT_193_group_DETAIL_t
where pay_type = vv_pay_type
AND month_id = v_fee_month
and service_group_id = vv_group_id
and city_code =v_city_code
and service_kind_id = 7;
exception when others then
vn_month_fee0 := 0;
end;
begin
select nvl(sum(month_fee),0)
into vn_year_fee0
from RPT_193_group_DETAIL_t
where substr(month_id,0,4) = v_fee_year
and pay_type = vv_pay_type
and service_group_id = vv_group_id
and city_code=v_city_code
and service_kind_id = 7
group by city_code,service_group_id;
exception when others then
vn_year_fee0 := 0;
end;
end if; INSERT INTO RPT_193_group_DETAIL_t
(
MONTH_ID ,
CITY_CODE ,
SERVICE_GROUP_ID ,
SERVICE_KIND_ID ,
MONTH_FEE ,
PAY_TYPE ,
YEAR_FEE0 ,
MONTH_FEE1 ,
YEAR_FEE1
)
VALUES (
v_fee_month,
v_city_code,
vv_group_id,
7,
vn_month_fee0,
7,
nvl(vn_year_fee0,0),
nvl(vn_month_fee1,0),
nvl(vn_year_fee1,0)
);
COMMIT; end loop;
close cur_bus_city;
因为我是做电信项目的,所以我的程序需要按地市循环(这段程序只是我程序的一小部分),有了 SELECT INTO 后边的变量,就使我省去了写 N 多 代码的麻烦,你先看看,有什么不懂的我再给你解释 ^_^
则是在命令窗口中执行exec test(sysdate,sysdate);
不能在SQL窗口中执行.
http://www.netyi.net/in.asp?id=hjf1010
yangyu9000(JIMMY(术士)) :我是在客户端的SQL里面调用的存储过程,你所说的
PLSQL Developer在哪里有啊
可以在网上下载的.