AnsweredAssumed Answered

Join Oracle table

Question asked by mrosenberg57 on Feb 22, 2018
Latest reply on Feb 27, 2018 by kimo

I am trying to join an Oracle table to a feature class but have not found success yet...

Here is my code:

# Import arcpy moduleimport arcpyfrom arcpy import env #Set Variables parent = "Database Connections\\db.sde\\db.DBO.layer"child = "Database Connections\\db.sde\\db.DBO.layer2"codeList = ['SC21', 'SC22', 'SC23', 'SC24', 'SC25', 'SC26', '2C27', 'SC28', 'SC29', 'SC30', 'SC31', 'SC33', 'SC34', 'SC35', 'SC36', 'SC37']parentView = "layer"tableView = "connectionFees"table = "Database Connections/oracle.sde/oracleDB.oracleTable"if arcpy.Exists(child):    arcpy.Delete_management(child, "FeatureClass")#Make a feature layer in order to perform a selectionarcpy.MakeFeatureLayer_management(parent, parentView)#Select all features that match the codes from the code listfor code in codeList:    arcpy.SelectLayerByAttribute_management(parentView, "ADD_TO_SELECTION", "Code = '"+ code+"'")#Copy the selected featuresarcpy.CopyFeatures_management(parentView, child)#Make Query Layer of Oracle table since it does not contain an incrementing ID field
arcpy.MakeQueryLayer_management("Database Connections/db.sde", tableView, "SELECT   \n         field1,\n         field2,\n         field3,\n         SUM (amount) total\n    FROM layer\nGROUP BY field1\n", "field1", "", "", "")
#Join the gdb layer to the Connection Fees Table from oracle DB
.JoinField_management(child, "field1", tableView, "field2")


I get a generic 999999 error.. Any thoughts?