Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

查询一条数据到结构体报错 #14

Open
xiaotang0128 opened this issue Jul 23, 2021 · 1 comment
Open

查询一条数据到结构体报错 #14

xiaotang0128 opened this issue Jul 23, 2021 · 1 comment

Comments

@xiaotang0128
Copy link

err = db.Where("ID=?",1).First(&info).Error
报错,dpiStmt_execute:ORA-00933:SQL command not properly ended

@austin-millan
Copy link

austin-millan commented Sep 17, 2021

Oracle 11 doesn't seem to support "FETCH" clause (introduced in Oracle 12). From the README:

Required dependency Install
Oracle 12C+

The First clause produces the query here:

		if limit := limit.Limit; limit > 0 {
			builder.WriteString(" FETCH NEXT ")
			builder.WriteString(strconv.Itoa(limit))
			builder.WriteString(" ROWS ONLY")
		}

Which leads to the error:

SELECT * FROM TABLE WHERE ID = '1' ORDER BY TABLE.ID  FETCH NEXT 1 ROWS ONLY;
                                                      *
ERROR at line 1:
ORA-00933: SQL command not properly ended

Edit: This means you should avoid using First and Limit clauses in this library for versions < Oracle 12g.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants