Subject Re: [firebird-support] Insert SQL ???
Author Uwe Grauer
Hi Gerry,

yust a view hints:

ggroper wrote:

> I am new to Firebird and need a little clue as to the proper syntax
> for a stored procedure.
> I'm inserting data into and existing empty table from a view.
> The view and the table structures are the same, field names, field
> characteristic (as seen by Developers Workbench), and field order.
> insert into existingtable select * from view
> First question, does the insert ignore field names and just uses field
> order and expect the field types to OK?
No, specify fieldnames in insert and select like you need it:
insert into existingtable (col1, col2, ...) values (select (col1, col2,
...) from view)

> Second, do I need some begin trans ... commit trans statements around
> the insert statements???.
Yes, its always better to use exclusive transactions.

> Is there any way to insert new records(primary key) and ignore
> duplicate records or do I need to revise a view to illiminate those
> duplicates??
You could use Generators for this. (You have to write a before insert
trigger for this.)

> thanks,
> gerry

Hope this helps for a starting point.