Subject INSERT / CREATE if non-existent
Author lutterot
Hi!

I am looking for a good way to create a table if a table of the same
name does not exist, and inserting a row if a row with the same
primary key value does not exist, for many rows and tables. That is, I
need to merge data and metadata into an existing DB using an SQL
script. I have heard that the upcoming Firebird version will support
an INSERT OR UPDATE, but I don't know any details.

I have tried something like this:

EXECUTE BLOCK AS BEGIN
INSERT ...
CREATE TABLE ...

WHEN SQLCODE <0 DO CONTINUE;
END;

...but for some syntactic reason it could not be executed.

Thank you,
Christof