在PLSQLdeveloper上面执行下列代码时报错 ORA-01008:并非所有变量都已绑定,新手求解,
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在PLSQLdeveloper上面执行下列代码时报错 ORA-01008:并非所有变量都已绑定,新手求解,相关的知识,希望对你有一定的参考价值。
BEGIN
SELECT base_cost,base_duration,unit_cost,cost_type INTO v_cost FROM cost c JOIN service s ON s.cost_id = c.id AND s.id
= :new.service_id;
IF v_cost.cost_type=2 THEN
SELECT count(*) into v_count FROM month_duration WHERE service_id = :new.service_id AND month_id = TO_CHAR
(:new.logout_time,'yyyymm');
IF v_count>0 THEN
SELECT sofar_duration INTO v_sofar_duration FROM month_duration WHERE service_id = :new.service_id AND month_id =
TO_CHAR(:new.logout_time,'yyyymm');
v_temp_duration:=v_sofar_duration;
v_sofar_duration := v_sofar_duration + :new.duration;
v_duration := v_sofar_duration - v_cost.base_duration*60*60;
IF v_duration > 0 AND v_cost.base_duration*60*60> v_temp_duration THEN
:new.cost := v_cost.unit_cost * v_duration/3600;
ELSIF v_duration > 0 AND v_cost.base_duration*60*60<= v_temp_duration THEN
:new.cost :=v_cost.unit_cost*:new.duration/3600;
END IF;
UPDATE month_duration SET sofar_duration=v_sofar_duration WHERE service_id = :new.service_id AND month_id =
TO_CHAR(:new.logout_time,'yyyymm') ;
ELSE
v_sofar_duration := :new.duration;
INSERT INTO month_duration(service_id,month_id,sofar_duration)
VALUES (:new.service_id,TO_CHAR(:new.logout_time,'yyyymm'),v_sofar_duration);
END IF;
ELSIF v_cost.cost_type=3 THEN
:new.cost :=v_cost.unit_cost*(:new.duration/3600);
END IF;
END;
以上是关于在PLSQLdeveloper上面执行下列代码时报错 ORA-01008:并非所有变量都已绑定,新手求解,的主要内容,如果未能解决你的问题,请参考以下文章