Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> What is wrong with this trigger definition?
Hello!
I cannot find out what I'm doing wrong with the definition of the trigger below. I would like to create a MAPPING table which contains aliases/translations of primary key values in other tables (with different names of the primary key column). With the trigger I want to make sure that the alias target really exists before entering a tuple into the MAPPING table. It does two things (well, not quite yet): (1) find out which column is primary key for the table; (2) check that column for the target value. But the trigger only compiles with errors:
LINE/COL ERROR
-------- ------------------------------------------- 9/9 PL/SQL: SQL Statement ignored
I think it is some problem with using the result (key_col) of the first SELECT query in the second one. But I'm kind of stuck here.
I hope the example below is clear enough that you can maybe point me towards some solution. I'm running 10g on Windows 2003.
Thanks a lot in advance,
Benjamin
CREATE TABLE SPORTS (
Name VARCHAR2(64) PRIMARY KEY NOT NULL,
Description VARCHAR2(64)
);
ALTER TABLE "MAPPING"
ADD CONSTRAINT pk_mapping
PRIMARY KEY (Alias, TableName)
;
INSERT INTO SPORTS VALUES ('Soccer', 'Nice game'); INSERT INTO SPORTS VALUES ('Tennis', 'Very boring');
![]() |
![]() |