Beginner needs help on INSERT INTO trigger [message #38277] |
Sun, 07 April 2002 10:53 |
nicole
Messages: 10 Registered: January 2002
|
Junior Member |
|
|
Hello,
I am trying to add a record into my sql database witht the following "when-button-pressed" trigger:
declare
v_ssn VARCHAR2(9);
begin
v_ssn := :patient.ssn;
insert into patient(ssn) values ('v_ssn');
commit;
end;
but i get the ERROR Message: FRM-3050: ORACLE error: unable to insert record.
Does anybody know what is wrong? please help me. Thanks! :)
Nicole
|
|
|
Re: Beginner needs help on INSERT INTO trigger [message #38286 is a reply to message #38277] |
Mon, 08 April 2002 05:04 |
Jon
Messages: 483 Registered: May 2001
|
Senior Member |
|
|
For starters, you don't want quotes around v_ssn. By putting them there, you are making the SSN='v_ssn', not the value of v_ssn. Still, assuming ssn is VARCHAR2 on the database (it probably is), you should be able to (incorrectly) make the SSN 'v_ssn', but if this is the unique primary key, only once!!
If that doesn't clear it up, DESC the PATIENT table. What is the value of :patient.ssn? It could be any number of reasons - not null columns, duplicate value on unique index.
|
|
|