September 3rd, 2012, 10:08 AM
Noob Inserting table data into a variable
I am trying to insert a column into a variable from a trigger.
Here is the code that i have:
CREATE OR REPLACE TRIGGER BUYER_after_update AFTER UPDATE ON buyer
FOR EACH ROW
select ID into v_key from buyer;
insert into message_log_table (table_name, message_comments)
('Buyer', 'Buyer '||v_key||' has been updated');
When I run the above I get the following compiler error:
[Error] ORA-00904 (6: 12): PL/SQL: ORA-00904: "ID": invalid identifier
Since ID is defined in my BUYER table I do not understand what the error means. Can someone please explain this error message to me.
Here is my create table statement:
CREATE TABLE BUYER
ID VARCHAR(50) NOT NULL PRIMARY KEY,
FNAME VARCHAR(50) NOT NULL,
LNAME VARCHAR(50) NOT NULL,
ADDRESS VARCHAR(50) NOT NULL,
CITY VARCHAR(50) NOT NULL,
STATE VARCHAR(2) NOT NULL,
ZIP_CODE NUMBER(5) NOT NULL
There are 10 kinds of people in the world. Those that understand binary and those that don't.