Selecting and showing a value from Oracle Table

1973
3
12-31-2013 01:36 AM
bugotk
by
New Contributor
Hi all !

- I have a feature layer (CADASTRAL_PARSEL) and a Oracle Table (ABS_PARCEL).
- OBJECTID field of feature layer and SDE_OBJECT_ID of Oracle Table are same.
- I have a form that searchs for block/parsel from feature layer, shows its 3 value for "neighborhood - section - area"
- The other part of the form shows the same values from Oracle Table. Our municipality fills this table with another program (management program) The fields mentioned above are same.

I am posting a part of the code that starts with cursor that has values of selected block/parcel. The problem is i can not enter QueryFilter for this SDE_OBJECT_ID field of Oracle Table = pfeature.value(intobjectid) of selected feature.

SDE_OBJECT_ID field of Oracle table is Long.

By the way i found this link and its similar with my problem but it doesn't help me that much:

http://forums.esri.com/Thread.asp?c=93&f=992&t=86418

Dim pFeatureClass As IFeatureClass
Set pFeatureClass = pFeatureLayer.FeatureClass

Dim pFields As IFields
Set pFields = pFeatureClass.Fields

Dim intSdeNeighbourhood As Integer
intSdeNeighbourhood = pFields.FindField("NAME_NEIGHBOURHOOD")

Dim intSdeCadastralSection As Integer
intSdeCadastralSection = pFields.FindField("CADASTRAL_SECTION")

Dim intSdeArea As Integer
intSdeArea = pFields.FindField("AREA")

Dim intObject As Integer
intObject = pFields.FindField("OBJECTID")

Dim pTable As ITable
Set pTable = pFeatureClass

Dim pCursor As ICursor
Set pCursor = pTable.Search(pQueryFilter, False) 'YOU DONT SEE THE UPPER CODES BUT ITS OK, EVERYTHING IS WORKING

Dim pRow As IRow
Set pRow = pCursor.NextRow

Dim pFeature As IFeature
Set pFeature = pRow

sde_neighbourhood.Caption = pFeature.Value(intSdeNeighbourhood)
sde_section.Caption = pFeature.Value(intSdeCadastralSection)
sde_area.Caption = pFeature.Value(intSdeArea)

'----------------------------------------------------------------------------------
'Here i open Oracle Table

Dim pPropset As IPropertySet
Set pPropset = New PropertySet

pPropset.SetProperty "DATABASE", "C:\Users\botken1\Desktop\ArcObject_Denemeler.mdb"
pPropset.SetProperty "DATAPROVIDER", "Access Data Source"

Dim pWorkspaceFactory As IWorkspaceFactory
Set pWorkspaceFactory = New AccessWorkspaceFactory

Dim pFeatureWorkspace As IFeatureWorkspace
Set pFeatureWorkspace = pWorkspaceFactory.Open(pPropset, 0)

'Open the Table
Dim pUTable As ITable
Set pUTable = pFeatureWorkspace.OpenTable("ABS_PARCEL")

Dim pUFields As IFields
Set pUFields = pUTable.Fields

Dim intSdeObjectID As Integer
intSdeObjectID = pUFields.FindField("SDE_OBJECT_ID")

Dim pURow As IRow
Set pURow = pUTable

'here i try to show the Oracle Table values with the objectid of selected feature

Dim pQueryFilterUKBS As IQueryFilter
Set pQueryFilterUKBS = New QueryFilter

Dim strSdeOID As String
strSdeOID = pFeature.Value(intObject)

'pQueryFilterUKBS.WhereClause = "SDE_OBJECT_ID = 123" THIS CODE WORKS, IT BRINGS YOU THE VALUE OF NEIHGBOURHOOD, SECTION AND AREA OF THE VALUE 123 FROM ORACLE TABLE BUT I DONT WANT TO SEE THE VALUE OF 123, I WANT THE OBJECTID OF SELECTED FEATURE FROM SDE LAYER

pQueryFilterUKBS.WhereClause = "SDE_NESNE_NO = pfeature.value(intobject)" THIS CODE DOESNT WORK AT ALL. IF I CAN MAKE IT WORK THEN EVERYTHING WILL BE OK

Dim pUCursor As ICursor
Set pUCursor = pUTable.Search(pQueryFilterUKBS, False)

Dim pURow As IRow
Set pURow = pUCursor.NextRow

Dim intUSection As Integer
intUSection = pUFields.FindField("ORACLE_SECTION")

ukbs_section.caption = pURow.Value(intSection)

End Sub

Can you please help me?
Thanks in advance.
0 Kudos
3 Replies
VinceAngelo
Esri Esteemed Contributor
Using the registered rowid column as a foreign key to an external table is not
recommended practice -- The rowid can't be guaranteed to be sequential.  Best
practice would be to create your own sequence-fed column, and use that for the
foreign key.

What exact datatype in Oracle is the SDE_OBJECT_ID column? (e.g. NUMBER(n) -
what is the value of 'n')  What ArcSDE datatype is reported for the column with
'sdetable -o describe'?

- V
0 Kudos
bugotk
by
New Contributor
Using the registered rowid column as a foreign key to an external table is not
recommended practice -- The rowid can't be guaranteed to be sequential.  Best
practice would be to create your own sequence-fed column, and use that for the
foreign key.

What exact datatype in Oracle is the SDE_OBJECT_ID column? (e.g. NUMBER(n) -
what is the value of 'n')  What ArcSDE datatype is reported for the column with
'sdetable -o describe'?

- V


SDE_OBJECT_ID field of Oracle table is Long.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
"Long" is almost useless, since it either describes a 32-bit integer, a 64-bit integer,
or a deprecated LOB type which hasn't been available since Oracle 8i.  This is why
I requested the actual Oracle type (that which is returned by a DESCRIBE tablename
in SQL*Plus) and the output of 'sdetable -o describe' on the table. I cannot help you
without this information.

- V
0 Kudos