Hi,
I have a big problem using Delphi 7, Oracle 8 and UniDAC 2.70.09:
On 2 different Oracle-Servers with the same Tables I get different cols for my tables. For example:
Server 1: MyUniTable.Fields[0].FieldName is 'CustomerNr'
Server 2: MyUniTable.Fields[0].FieldName is 'ROWID'
and MyUniTable.Fields[1].FieldName is 'CustomerNr'
Now I can change the Code to "MyUniTable.FieldByName ('CustomerNr')", but i have to change hundreds of lines...
Is there any way in TUniTable, TQuery to make ROWID on Server 2 unvisible? Or is it a Config-Problem of the Oracle-Server?
Thanks in advance for any information.
Kind regards,
Gerd Brinkmann
invent GmbH
Please help: Question about Oracle-RowId
Hello
Please check the KeyFields property of your TUniTable. If the KeyFields property is set to "RowID" then the "RowID" field will be added before all fields in the table. Also it can occur if the identical tables have primary key in the first database and in the other database primary key is not created. In case when primary key is not created the "RowID" field will be added before all fields to make this table updatable.
To resolve this issue:
- check the KeyFields property in the run-time: if it has the same value for both databases
- check primary key for identical tables in both databases: identical tables should have identical primary keys
Please check the KeyFields property of your TUniTable. If the KeyFields property is set to "RowID" then the "RowID" field will be added before all fields in the table. Also it can occur if the identical tables have primary key in the first database and in the other database primary key is not created. In case when primary key is not created the "RowID" field will be added before all fields to make this table updatable.
To resolve this issue:
- check the KeyFields property in the run-time: if it has the same value for both databases
- check primary key for identical tables in both databases: identical tables should have identical primary keys
Hello bork,
thank you for the fast answer. I checkd both servers, all primary keys are well defined. The property KeyFields is not set manually in all TUniTables.
1. My first test was ShowMessage (MyUniTable.KeyFields).
Result on Server 1: 'CUSTOMERNR'
Result on Server 2: '' (empty string)
2. Than I started DBMonitor to watch TUniTable and there are two different SQL-Statements :
On Server 1 TUniTable makes:
SELECT T.* FROM CUSTOMERS T WHERE CUSTOMERNR = '10008'
On Server 2 TUniTable makes
SELECT T.RowId, T.* CUSTOMERS T WHERE CUSTOMERNR = '10008'
I think, you are right, the TUniTable cannot find the Primary Keys on server 2. But why ???
For your information: On both servers are 298 tables, all created in the same way. All 298 have a primary key and TUniTable.KeyFields gives an empty string on Server 2.
I hope, you have one or two more ideas what I can do.
Thanks in advance for any information.
Kind regards,
Gerd Brinkmann
invent GmbH
thank you for the fast answer. I checkd both servers, all primary keys are well defined. The property KeyFields is not set manually in all TUniTables.
1. My first test was ShowMessage (MyUniTable.KeyFields).
Result on Server 1: 'CUSTOMERNR'
Result on Server 2: '' (empty string)
2. Than I started DBMonitor to watch TUniTable and there are two different SQL-Statements :
On Server 1 TUniTable makes:
SELECT T.* FROM CUSTOMERS T WHERE CUSTOMERNR = '10008'
On Server 2 TUniTable makes
SELECT T.RowId, T.* CUSTOMERS T WHERE CUSTOMERNR = '10008'
I think, you are right, the TUniTable cannot find the Primary Keys on server 2. But why ???
For your information: On both servers are 298 tables, all created in the same way. All 298 have a primary key and TUniTable.KeyFields gives an empty string on Server 2.
I hope, you have one or two more ideas what I can do.
Thanks in advance for any information.
Kind regards,
Gerd Brinkmann
invent GmbH
Hello
Please check the result of the following query:
This query should return the same result for both databases.
Also please check that your primary keys are not disabled.
Please check the result of the following query:
Code: Select all
SELECT '' TABLE_CATALOG, IC.TABLE_OWNER TABLE_SCHEMA, IC.TABLE_NAME, '' INDEX_CATALOG, IC.INDEX_OWNER INDEX_SCHEMA, IC.INDEX_NAME, IC.COLUMN_NAME, IC.COLUMN_POSITION, DECODE(IC.DESCEND, 'ASC', 0, 1) DESCENDING
FROM SYS.ALL_IND_COLUMNS IC, SYS.ALL_INDEXES I
WHERE IC.TABLE_OWNER = '...' AND -- your username in the upper case
IC.TABLE_NAME = '...' AND -- your table name in the upper case
I.UNIQUENESS = 'UNIQUE' AND
I.OWNER = IC.INDEX_OWNER AND
I.INDEX_NAME = IC.INDEX_NAME
ORDER BY IC.INDEX_OWNER, IC.TABLE_OWNER, IC.TABLE_NAME, IC.INDEX_NAME, IC.COLUMN_POSITION
Also please check that your primary keys are not disabled.