Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 ORACLE HELP TRIGGERS

Author  Topic 

bdso
Starting Member

1 Post

Posted - 2011-09-15 : 04:40:32
Hey everyone i'm trying to set up the following table for a registration page for a website using oracle

im having problem with triggers heres my code:

Create Table:

CREATE TABLE Users
( User_id NUMBER NOT NULL,
UserName VARCHAR2(25),
Password VARCHAR2(25),
Email VARCHAR(50),
Phone NUMBER(10),
Full_Name VARCHAR2(50),
Address VARCHAR2(100),
Primary key (User_id)
);


Heres the Sequence

CREATE SEQUENCE Users_sequence
START WITH 1
INCREMENT BY 1;


Heres the trigger:

CREATE OR REPLACE TRIGGER Users_trigger
BEFORE INSERT
ON USERS
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT Users_sequence.nextval INTO :NEW.users_id FROM dual;
END;
/



Now the error i get is:

ERROR at line 1:
ORA-04082: NEW or OLD references not allowed in table level triggers

anyhelp will be much appreciated :)

Kristen
Test

22859 Posts

Posted - 2011-09-15 : 04:50:46
Sorry, this is a Microsoft SQL Server forum. You would be better off asking your question on an Oracle site
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-15 : 04:50:53
you would be better off posting this in oracle forum like www.orafaq.com. this is ms sql server forum

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -