PL/SQL ERROR, TRIGGER PROBLEM [message #37088] |
Wed, 16 January 2002 15:24 |
Joan Padilla i Salom
Messages: 5 Registered: January 2002
|
Junior Member |
|
|
Hi,
I has been maden a trigger and then i found this error. Someone know why?
thx.
CREATE TABLE in_emple (
Nuser VARCHAR2(20),
apellido VARCHAR2(10),
salari NUMBER,
comisio NUMBER,
data_alta DATE,
msg VARCHAR(50));
CREATE OR REPLACE TRIGGER ins_emple
AFTER INSERT
ON EMPLE
FOR EACH ROW
DECLARE
nom VARCHAR2(100);
apel VARCHAR2(10);
sal NUMBER;
comis NUMBER;
data DATE;
msg1 VARCHAR2(20);
msg2 VARCHAR2(20);
msg3 VARCHAR2(20);
BEGIN
dbms_output.put_line ('petada de las gordas.');
nom := USER;
apel := :NEW.apellido;
sal := :NEW.salario;
comis:= :NEW.comision;
data:= :NEW.fecha_alt;
msg1:= '';
msg2:= '';
msg3:= '';
dbms_output.put_line ('assignacio ok');
IF :NEW.salario > 6000 THEN
msg1 := 'Alerta sou excesiu.';
END IF;
dbms_output.put_line('comp salario ok');
IF :NEW.comision > 600 THEN
msg2 := 'Alerta comisio exces.';
END IF;
dbms_output.put_line('comp comisio ok');
IF :NEW.fecha_alt > SYSDATE THEN
msg3:= 'Data dubtosa.';
END IF;
dbms_output.put_line('com data ok');
IF (:NEW.salario > 6000) OR (:NEW.comision > 600) OR (:NEW.fecha_alt > SYSDATE) THEN
dbms_output.put_line ('abans INSERT');
INSERT INTO in_emple
VALUES (nom,apel,sal,comis,data,msg1 || msg2 || msg3);
END IF;
END ins_emple;
The error was:
SQL> insert into emple values (10,'garci','chapero',1,sysdate,6001,601,10);
insert into emple values (10,'garci','chapero',1,sysdate,6001,601,10)
*
ERROR en línea 1:
ORA-06502: PL/SQL: error: buffer de cadenas de caracteres demasiado pequeño
numérico o de valor
ORA-06512: en "PADIX.INS_EMPLE", línea 30
ORA-04088: error durante la ejecución del disparador 'PADIX.INS_EMPLE'
|
|
|
|
Re: PL/SQL ERROR, TRIGGER PROBLEM [message #38026 is a reply to message #37088] |
Thu, 14 March 2002 00:11 |
Debasish Bhattacharya
Messages: 1 Registered: March 2002
|
Junior Member |
|
|
Please check your variables those are really conflicting with columns of the table
salari NUMBER in table but in case of trigger you wrote
sal := :NEW.salario;
Actual table name is in_emple but in the body of trigger you gave EMPLE
like this so many things are wrong please correct it.
Debasish
|
|
|