Hi Jin,This is actually for ArcGIS 10. You will need to replace 'arcpy' with 'gp' to have this work with 9.3. Also, you will need to make a few changes to the 'SearchCursor'. Here is a link that discusses how to do this for 9.3.
import arcpy, cx_Oracle from arcpy import env env.workspace = r"C:\TEMP\Python\Test.gdb" env.overwriteOutput = 1 fc = "Hospitals" list = [] # append all CODE values from feature class to list rows = arcpy.SearchCursor(fc) for row in rows: list.append(row.getValue("FAC_TYPE")) # create a connection to Oracle instance connstr='vector/vector@orcl' conn = cx_Oracle.connect(connstr) curs = conn.cursor() oracleList = [] # query Oracle table using items from list and append to new list for item in list: curs.execute('select FAC_TYPE FROM Hospital_Info where FAC_TYPE = ' + str(item)) for row in curs: oracleList.append(row[0]) # Find items that have duplicates and delete from feature class for item in set(oracleList): if oracleList.count(item) > 1: arcpy.MakeFeatureLayer_management(fc, "Hospital_Lyr", "FAC_TYPE = " + str(item)) arcpy.DeleteRows_management("Hospital_Lyr") print "Successfully deleted rows" conn.close()
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.