Oracle ORA-00933:SQL命令未正确结束

I try to use golang and query data from Oracle. My SQL query is:

SELECT * FROM TABLE1 OFFSET 10 ROWS;

But it gives an error:

EXTRA *errors.withStack=dpiStmt_execute: ORA-00933: SQL command not properly ended

My SQL query works fine when I query in SQL*Plus, but errors when I use golang.

If the offset is not specified, it is assumed that it is 0 (zero). So, remove that clause (as it does nothing in your case), i.e.

select * from table1

and use that query in golang.

I am pretty sure that just your closing semicolon is to much. The semicolon is a character to separate several SQL statements or to close a pl/sql block. So when you write it at the end of a SQL statement the parser doesn't know how to handle it, cause he only awaits a single SQL statement.

I'd try running the query without the terminating semicolon, as Alex Poole pointed out. A lot of Oracle client libraries (i.e. cx_Oracle in python, ADO.NET Oracle Libraries) do complain if you try to execute a query ending with the semicolon (which is perfectly legal in SQL/Plus)