Subject | Re: [IBO] Global Temporary Tables |
---|---|
Author | Thomas Steinmaurer |
Post date | 2014-02-07T07:52:27Z |
Hi,
http://www.firebirdsql.org/refdocs/langrefupd21-ddl-table.html
If not specified otherwise, the ON COMMIT DELETE ROWS is the default
mode, thus whenever you are doing a commit (or possibly auto commit in
your case), rows are deleted.
Create the GTT that way and then re-try:
CREATE GLOBAL TEMPORARY TABLE TEMPTBL
(
REF1 Integer NOT NULL,
REF2 Integer NOT NULL,
DESC Varchar(30),
PRIMARY KEY (REF1,REF2)
) ON COMMIT PRESERVE ROWS;
This enhances the context for the data from transaction to connection-level.
--
With regards,
Thomas Steinmaurer
http://www.upscene.com/
Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.
> I have a table defined as follows:Check out the GTT reference here:
>
> CREATE GLOBAL TEMPORARY TABLE TEMPTBL
> (
> REF1 Integer NOT NULL,
> REF2 Integer NOT NULL,
> DESC Varchar(30),
> PRIMARY KEY (REF1,REF2)
> );
>
> I have a TIBOQuery supplying the data to a TDBGrid, which is
> user-editable. If I insert then delete a row, I get the error "Record
> was not located to delete". Similarly if I try and edit a previously
> inserted row I get "Record was not located to update" on posting.
> Keylinks on the query are set correctly, the primary key fields are set
> by the client (i.e. not by a trigger on the server) and I can't think of
> what else to check. If I use an identical table but not defined as
> "GLOBAL TEMPORARY" I don't get any error.
>
> Can you advise please? Thanks in advance.
http://www.firebirdsql.org/refdocs/langrefupd21-ddl-table.html
If not specified otherwise, the ON COMMIT DELETE ROWS is the default
mode, thus whenever you are doing a commit (or possibly auto commit in
your case), rows are deleted.
Create the GTT that way and then re-try:
CREATE GLOBAL TEMPORARY TABLE TEMPTBL
(
REF1 Integer NOT NULL,
REF2 Integer NOT NULL,
DESC Varchar(30),
PRIMARY KEY (REF1,REF2)
) ON COMMIT PRESERVE ROWS;
This enhances the context for the data from transaction to connection-level.
--
With regards,
Thomas Steinmaurer
http://www.upscene.com/
Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.