• NAXJA is having its 18th annual March Membership Drive!!!
    Everyone who joins or renews during March will be entered into a drawing!
    More Information - Join/Renew
  • Welcome to the new NAXJA Forum! If your password does not work, please use "Forgot your password?" link on the log-in page. Please feel free to reach out to [email protected] if we can provide any assistance.

Can I get a little Oracle trigger help?

kujito

NAXJA Forum User
Location
colorado
Oracle9i on UNIX via telnet
I have dba and system rights, but working in a user account for this.

OK, so I have a table set up like:
Table_Name Null? Type
ID NOT NULL NUMBER(3)
NAME NOT NULL VARCHAR2(20)
SALARY NOT NULL NUMBER(6)
DEPT VARCHAR2(4)
LAST_UPDATE_USER CHAR(20)
LAST_UPDATE_DATE DATE

and this trigger:
CREATE OR REPLACE TRIGGER Emp_Timestamp_bc
BEFORE Insert OR Update ON emp
REFERENCING New AS New_Row
FOR EACH ROW
BEGIN
:New_Row.Last_Update_User := USER;
:New_Row.Last_Update_Date := SYSDATE;
END Emp_Timestamp;
/

When I try to add a new row to the 'emp' table,
:SQL> insert into emp values
2 (10, 'Adam', 50000, 'MIS');

I get this error:
ERROR at line 1:
ORA-00947: not enough values

I think that means that the trigger is not firing. At a loss beyond that. Any suggestions?
Thanks,
Brian
 
Those are what the trigger is for.
Figured it out. Just had to walk away for a while.
Insert should've been:
insert into emp(id, name, salary, dept) values
(etc.)

stoopid technology
 
I hate computers. I hear the big Apple/Windows debates all the time. I think they're all a big pain in the ass. Of course, all I see are the problems. I guess it beats digging holes for a living.
 
Ralph said:
I guess it beats digging holes for a living.
Hell yes it does! The GF keeps asking me if I like computer work better than construction. She always acts surprised when I tell her no. I love building stuff, but my knees(or shoulder/back/whatever hurts today) won't let me do it for much longer. That, and I'm starting to get a little soft around the middle.
I haven't gone home bleeding in a few months though, which is kinda nice.
 
Back
Top