Subject | Re: INSERT / CREATE if non-existent |
---|---|
Author | Adam |
Post date | 2007-06-19T23:55:09Z |
--- In firebird-support@yahoogroups.com, "lutterot" <lutteroth@...> wrote:
list, as were some similar ideas (insert or update / replace). I am
not sure about what was decided, but you can search the list yourself.
same transaction as DML.
'Recreate table' drops the table first if it already exists.
'Create or Alter Procedure'
'Create or Alter Trigger'
Most admin tools allow you to define a source and destination
database, and it will create a migration script.
Adam
>The 'merge' feature (SQL 2003) has been discussed in the Architect
> --- In firebird-support@yahoogroups.com, "lutterot" <lutteroth@> wrote:
> >
> > 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.
list, as were some similar ideas (insert or update / replace). I am
not sure about what was decided, but you can search the list yourself.
> >Furthermore, if you want things to work properly, never mix DDL in the
> > 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.
>
> I have read now that DDL cannot be executed in a stored procedure, so
> the CREATE TABLE in EXECUTE BLOCK seems to be forbidden as well.
same transaction as DML.
> However, I am still wondering if there isn't a simple way to makeFor many operations, there is a create or alter style option.
> Firebird ignore errors in an SQL script, so that the transaction
> continues.
'Recreate table' drops the table first if it already exists.
'Create or Alter Procedure'
'Create or Alter Trigger'
Most admin tools allow you to define a source and destination
database, and it will create a migration script.
Adam