4

I need to read an Oracle (not Spatial) table with OGR.

I have no problem with ogrinfo. I use this command:

ogrinfo -ro OCI:user/password -sql "select * from HR.EMPLOYEES"

I have this kind of output:

OGRFeature(select * from HR.EMPLOYEES):106
  EMPLOYEE_ID (Integer) = 206
  FIRST_NAME (String) = William
  LAST_NAME (String) = Gietz
  EMAIL (String) = WGIETZ
  PHONE_NUMBER (String) = 515.123.8181
  JOB_ID (String) = AC_ACCOUNT
  SALARY (Real) =  8300.00
  COMMISSION_PCT (Real) = (null)
  MANAGER_ID (Integer) = 205
  DEPARTMENT_ID (Integer) = 110

Now I would like to export (in example) in CSV format, using OGR. This is the command:

ogr2ogr -f "CSV" test.csv OCI:"user/password" -sql "select * from HR.EMPLOYEES"

I have this errors:

ERROR 4: Failed to create test.csv\select * from HR.EMPLOYEES.csv:
Invalid argument
ERROR 1: Terminating translation prematurely after failed
translation from sql statement.

I'm not able to find the syntax error.

What's wrong?

I'm using GDAL/OGR 1.9 and Oracle 11g for windows.

2 Answers 2

7

try adding -nlt NONE, in case it's a table without geometries

0
2

I suppose the -sql parameter should be positioned before the destination file:

ogr2ogr -f "CSV" -sql "select * from HR.EMPLOYEES" test.csv OCI:"user/password"
0

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.