0

I need load OBJECTID from remote DB but I'm still getting error:

RuntimeError: Underlying DBMS error [ORA-00923: FROM keyword not found where expected] [SDEDO.E_EL_TU][STATE_ID = 22362]

I don't know why. After all, sql statement compiles SearchCursor do why I'm getting this error?

My code looks this:

import arcpy

obj_id = 0
table = "C:\\Temp\\My_connection.sde\\SDEDO.E_EL_TU"

    with arcpy.da.SearchCursor(in_table=table, field_names=["OBJECTID"], sql_clause=("TOP 1", "ORDER BY OBJECTID DESC")) as cursor:
        for row in cursor:
            obj_id = row[0]
            break

I was googling for a long time but nowhere is topic with this error and SearchCursor.

1 Answer 1

2

TOP is not recognized by Oracle, so fetch all records and read only the first 10 ones.

From the arcpy.da.SearchCursor documentation for the sql_clause parameter:

Note:

...

TOP is only supported by SQL Server databases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.