Subject Re: Updateable Views question.
Author mikcaau
--- In firebird-support@yahoogroups.com, "Greg At ACD"
<GregAtACD@h...> wrote:
>
> I have 2 tables (MyTable, MySubTable) where MySubTable's primary key
> is also a foreign key to MyTable. So, MySubTable is truly a child of
> MyTable.
>
snip
> Does anyone have any ideas how to best implement this type of
> scenario? Is it best to abandon the idea of an updateable trigger
> for this situation?
>
> thx!
>
> Greg

Your view will look like this
<from MyTable> <from MySubTable>
col1, col2 col1, col2, col3

MyTable will be duplicated in every row of the view.
Where MyTable has no child records in MySubTable there will be nulls
in the columns View.MySubTable.
As a result in MyView.BeforeUpdate trigger you can test for null in a
Not Null field and perform an insert if necessary.
Primary Key field is a good one.

mick