Scene: 1 Ubuntu (Hoary/5.04) Linux box running PostgreSQL 7.4.7
Tables:
[tt]
invoices
id integer (sequence)
inv_number char(11)
invoice_details
id integer (sequence)
inv_number char(11) FK to invoices.inv_number, required, not null
amount numeric(8,2)
[/tt]
Now, I need to, once getting all the details right, 'lock' this invoice. No deletions, updates, or insertions on the given invoice_number.
I have achieved prevention of update or delete by making a third table:
[tt]
invoice_locks
inv_number char(11) FK to invoices.inv_number, required, not null, on update/delete RESTRICT
[/tt]
This works for update/delete, but I still can't prevent INSERTion of invoice_details using a 'locked' invoice_number. I'm betting a trigger would do it, but having a great deal of trouble getting it right. I could do this with VBA on my Access 2000 front-end, but feel this operation is best left to the database on the back-end.
My skill level with procedures and such is pretty slim. I appreciate any help!
----
JBR
Tables:
[tt]
invoices
id integer (sequence)
inv_number char(11)
invoice_details
id integer (sequence)
inv_number char(11) FK to invoices.inv_number, required, not null
amount numeric(8,2)
[/tt]
Now, I need to, once getting all the details right, 'lock' this invoice. No deletions, updates, or insertions on the given invoice_number.
I have achieved prevention of update or delete by making a third table:
[tt]
invoice_locks
inv_number char(11) FK to invoices.inv_number, required, not null, on update/delete RESTRICT
[/tt]
This works for update/delete, but I still can't prevent INSERTion of invoice_details using a 'locked' invoice_number. I'm betting a trigger would do it, but having a great deal of trouble getting it right. I could do this with VBA on my Access 2000 front-end, but feel this operation is best left to the database on the back-end.
My skill level with procedures and such is pretty slim. I appreciate any help!
----
JBR