Home » SQL & PL/SQL » SQL & PL/SQL » trigger
trigger [message #403] Sun, 10 February 2002 22:41 Go to next message
tofeks
Messages: 10
Registered: December 2001
Junior Member
i have created table testo with field NUMO, A, B, C
whenever i entered data at field C field NUMO,A and b will automatically filled
so i have created trigger so my table look alike this

NUMO A B c
---- - - -
1 1 A TEST2
2 1 B TEST3
3 2 A TEST0
4 2 B TEST4
5 3 A TEST5
6 3 B TEST2
. . . .
. . . .

tHIS IS THE TRIGGER I HAVE CREATED:

SQL> create trigger testmodo
2 before insert or update on testo
3 for each row
4 begin
5 :new.A := trunc(:new.NUMO/2+0.5);
6
7 if (mod(:new.NUMO,2) = 0) then
8 :new.B := 'B';
9 else
10 :new.B := 'A';
11 end if;
12 end;
13 /

Trigger created.

When i entered data i get ERROR

SQL> insert into testo (NUMO, c) values (NUMO.NextVal, 2);
insert into testo (NUMO, c) values (NUMO.NextVal, 2)
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "SCOTT.TESTMODO", line 7
ORA-04088: error during execution of trigger 'SCOTT.TESTMODO'

WHY IT IS??
PLS HELP ME

Regards
Tofeks
Re: trigger [message #411 is a reply to message #403] Mon, 11 February 2002 06:40 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
what are datatypes of columns in table?
Previous Topic: Select/Order By Question
Next Topic: Help !!! URGENT PLEASE.
Goto Forum:
  


Current Time: Thu Aug 06 02:44:13 CDT 2020