Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> What is wrong with this trigger definition?

What is wrong with this trigger definition?

From: Benjamin Hell <bhell_at_spamfence.net>
Date: Thu, 22 Jun 2006 13:57:14 +0200
Message-ID: <4fvet4Fi06fjU1@individual.net>


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

11/13 PL/SQL: ORA-00903: invalid table name

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');

Received on Thu Jun 22 2006 - 06:57:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US