Ingres/unloadtable

Advertisement


Question
Hi, I would read the deleted records of a tablefield in the order in which they were deleted. The UNLOADTABLE statement processes deleted record in the reverse order in which they were deleted. Can you help me?

Answer
Hello,

Yes I hope I can help you ...
Let me remember some knowledge :
1/ _state = 4 if a row is deleted
2/ _record = _record * -1 when a row is deleted

It mean, for example, if you have a tablefield with 4 rows :
1/ You delete row 3. The _state become 4 and _record become -3
2/ You insert again row 3. The _state is 1 and _record is 3
3/ You delete again row 3. The _state of this new row is 4 and _record become -3 also ...

From Ingres2006 documentation (download it from www.ingres.com) see a PDF named fadt.pdf (Form-Based Application Development Tools User Guide), page 16-2 from the index table (page 574 of the real PDF file). It show a diagram explaining that ...

So you can imagine to read the tablefield in the correct order is impossible without manipulation.

What you need is to maintaint an hidden column with a chronologic data (sequence or date & time), then load it in a Global Temporary Table (for example) and then do a SELECT on this session table in the order you need.

When I say chronologic with a sequence I refer to CREATE SEQUENCE (see SQL.PDF).
When I talk about Global Temporary Table I refer to DECLARE GLOBAL TEMPORARY TABLE (see SQL.PDF again).

Hope this help.

Regards,
Jean-Pierre ZUATE
La Fage Conseil
+33(0)6 1140 1109

Ingres

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jean-Pierre Zuate

Expertise

Any questions about database Ingres (owned by Computer Associates then Ingres Corp) : - Ingres 6.4 - OpenINGRES from 1.0 to 2.0 - IngresII from 2.0 to 2.6 - Ingres R3, Ingres 2006 (Open Source version) - Ingres 9.x, Ingres 10.x - All tool around Ingres : ABF, Report Writer, Replicator, OpenROAD (3.5 to 2006), Ingres/NET Ingres/STAR, ...

Experience

16 years of computing experience as :
- AS400 programmer
- AIX / Ingres administrator and developer (OpenROAD and korn shell)
- Ingres DataBase Administrator
- Ingres expert - Data modelisation - ETL - Reporting - Many of Computer Associates sofwares - ITIL / CMDB / Change Management

Organizations
http://lafageconseil.fr

Education/Credentials
Computing bachelor (1989)

Past/Present Clients
More than 100 customers during my 6 years of CA has an Ingres consultant, all around France and Africa (Togo, Cameroon, Morrocco, ...)

©2012 About.com, a part of The New York Times Company. All rights reserved.