Problema con un trigger
Queria hacer la consulta sobre un trigger... Pasa que tengo un trigger que funciona correctamente... Lo que ahora estoy haciendo es que parte de ese trigger lo estoy poniendo como funcion ya que luego lo voy a reutilizar para otros triggers..
Pero cuando ejecuto la funcion me sale un error que es este
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:7 COLUMN: 16
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:8 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:9 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:10 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:11 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:12 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:15 COLUMN: 7
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:18 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:19 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:20 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:21 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:22 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:23 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:26 COLUMN: 7
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:29 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:30 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:31 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:32 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:33 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:34 COLUMN: 11
el trigger inicial es este:
CREATE OR REPLACE TRIGGER GENESYS_OCS.t_updtable_a08
BEFORE UPDATE
ON GENESYS_OCS.ATE_ROBO_POSTPAGO_PRECLISTA REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
v_call_time ate_robo_postpago_preclista.call_time%TYPE;
v_intento ate_robo_postpago_preclista.attempt%TYPE;
v_agent_id ate_robo_postpago_preclista.agent_id%TYPE;
v_outsourcer ate_robo_postpago_preclista.usr_proveed%TYPE;
v_attempts ate_robo_postpago_preclista.attempt%TYPE;
v_call_result ate_robo_postpago_preclista.call_result%TYPE;
v_script_varchar1 ate_robo_postpago_preclista.script_varchar1%TYPE;
v_venta NUMBER; --- 0 encuesta ; 1 venta
BEGIN
v_venta := 0;
v_call_time := :NEW.call_time;
v_script_varchar1 := :NEW.script_varchar1;
v_intento := :NEW.attempt;
v_call_result := :NEW.call_result;
IF (v_intento IS NOT NULL AND v_call_result != 33)
THEN
:NEW.usr_intento := v_intento;
END IF;
v_agent_id := :NEW.agent_id;
IF (v_agent_id IS NOT NULL)
THEN
:NEW.usr_login_agente := v_agent_id;
END IF;
v_outsourcer := :NEW.usr_proveed;
IF (v_outsourcer IS NOT NULL)
THEN
:NEW.usr_outsourcer := v_outsourcer;
END IF;
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND :NEW.call_result != 28
)
THEN
:NEW.attempt := :NEW.attempt + 1;
END IF;
:NEW.usr_intento := :NEW.attempt;
IF ( :OLD.record_status = 3
AND (:OLD.usr_conversion = 'CE' OR :OLD.usr_conversion = 'CNE')
)
THEN
raise_application_error (-20999, 'Registro marcado como contacto');
END IF;
-- llamada cortada
IF (v_call_result = 33 AND :OLD.record_status != 3)
THEN
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND :NEW.call_result != 28
)
THEN
:NEW.attempt := :NEW.attempt + 1;
END IF;
:NEW.usr_intento := :NEW.attempt;
IF (v_agent_id IS NOT NULL)
THEN
:NEW.usr_login_agente := v_agent_id;
END IF;
:NEW.usr_conversion := 'CNE';
END IF;
-- casilla de voz
IF (v_call_result = 9 AND :OLD.record_status != 3)
THEN
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND :NEW.call_result != 28
)
THEN
:NEW.attempt := :NEW.attempt + 1;
END IF;
:NEW.usr_intento := :NEW.attempt;
IF (v_agent_id IS NOT NULL)
THEN
:NEW.usr_login_agente := v_agent_id;
END IF;
:NEW.usr_conversion := 'NC';
END IF;
-- celular apagado
IF (v_call_result = 7 AND :OLD.record_status != 3)
THEN
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND...
Pero cuando ejecuto la funcion me sale un error que es este
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:7 COLUMN: 16
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:8 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:9 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:10 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:11 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:12 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR1' LINE:15 COLUMN: 7
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:18 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:19 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:20 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:21 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:22 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:23 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR2' LINE:26 COLUMN: 7
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:29 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:30 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:31 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:32 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:33 COLUMN: 11
PLS-00049: bad bind variable'NEW. SCRIPT_VARCHAR3' LINE:34 COLUMN: 11
el trigger inicial es este:
CREATE OR REPLACE TRIGGER GENESYS_OCS.t_updtable_a08
BEFORE UPDATE
ON GENESYS_OCS.ATE_ROBO_POSTPAGO_PRECLISTA REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
v_call_time ate_robo_postpago_preclista.call_time%TYPE;
v_intento ate_robo_postpago_preclista.attempt%TYPE;
v_agent_id ate_robo_postpago_preclista.agent_id%TYPE;
v_outsourcer ate_robo_postpago_preclista.usr_proveed%TYPE;
v_attempts ate_robo_postpago_preclista.attempt%TYPE;
v_call_result ate_robo_postpago_preclista.call_result%TYPE;
v_script_varchar1 ate_robo_postpago_preclista.script_varchar1%TYPE;
v_venta NUMBER; --- 0 encuesta ; 1 venta
BEGIN
v_venta := 0;
v_call_time := :NEW.call_time;
v_script_varchar1 := :NEW.script_varchar1;
v_intento := :NEW.attempt;
v_call_result := :NEW.call_result;
IF (v_intento IS NOT NULL AND v_call_result != 33)
THEN
:NEW.usr_intento := v_intento;
END IF;
v_agent_id := :NEW.agent_id;
IF (v_agent_id IS NOT NULL)
THEN
:NEW.usr_login_agente := v_agent_id;
END IF;
v_outsourcer := :NEW.usr_proveed;
IF (v_outsourcer IS NOT NULL)
THEN
:NEW.usr_outsourcer := v_outsourcer;
END IF;
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND :NEW.call_result != 28
)
THEN
:NEW.attempt := :NEW.attempt + 1;
END IF;
:NEW.usr_intento := :NEW.attempt;
IF ( :OLD.record_status = 3
AND (:OLD.usr_conversion = 'CE' OR :OLD.usr_conversion = 'CNE')
)
THEN
raise_application_error (-20999, 'Registro marcado como contacto');
END IF;
-- llamada cortada
IF (v_call_result = 33 AND :OLD.record_status != 3)
THEN
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND :NEW.call_result != 28
)
THEN
:NEW.attempt := :NEW.attempt + 1;
END IF;
:NEW.usr_intento := :NEW.attempt;
IF (v_agent_id IS NOT NULL)
THEN
:NEW.usr_login_agente := v_agent_id;
END IF;
:NEW.usr_conversion := 'CNE';
END IF;
-- casilla de voz
IF (v_call_result = 9 AND :OLD.record_status != 3)
THEN
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND :NEW.call_result != 28
)
THEN
:NEW.attempt := :NEW.attempt + 1;
END IF;
:NEW.usr_intento := :NEW.attempt;
IF (v_agent_id IS NOT NULL)
THEN
:NEW.usr_login_agente := v_agent_id;
END IF;
:NEW.usr_conversion := 'NC';
END IF;
-- celular apagado
IF (v_call_result = 7 AND :OLD.record_status != 3)
THEN
IF ( :NEW.attempt = :OLD.attempt
AND :NEW.call_result != :OLD.call_result
AND...
2 respuestas
Respuesta de sindimad
1
Respuesta de dperdomo
1