Comments (1)
注释到这几句就正常了, 没看明白这几行是用于什么场景的
用来在分页查询时如果没有指定排序方式的话使用主键作为默认排序方式。
在 Oracle 数据库中,如果你使用
OFFSET
进行分页查询,通常建议在查询中显式指定排序方式,尤其是在使用OFFSET
和FETCH NEXT
进行分页时。原因是,
OFFSET
和FETCH NEXT
语法是和排序相关的,如果没有明确指定排序方式,查询结果的顺序可能是不确定的。在分页查询中,不确定的顺序可能导致在不同页之间的重复或遗漏的数据。示例:
SELECT * FROM your_table ORDER BY your_column OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;在上面的示例中,
ORDER BY your_column
明确指定了排序方式,确保在进行分页查询时结果是可预测的。如果你省略了ORDER BY
子句,查询结果的顺序可能会随数据库的实现而变化,可能不符合你的预期。因此,为了确保分页查询的结果是有序的,建议在使用
OFFSET
和FETCH NEXT
进行分页时,总是显式指定排序方式。
明白了这个的作用了,但是为什么count函数会进到这里面来,count应该不需要排序, gorm/gen 的count,应该用的也是gorm的count函数。而且我有leftjoin,生成的语句没有 tablename前缀,所以不知道是哪张表的id
Originally posted by @SheltonZhu in #11 (comment)
@SheltonZhu 感谢反馈,问题已修复,详情请查看 v1.5.20
from gorm-oracle.
Related Issues (12)
- 列名大小写问题 HOT 1
- CLOB 字段数据过长时报 ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值
- 使用 gorm.io/gen 创建数据时无法获取自增主键返回值(insert 语句主键 id 获取不到) HOT 20
- 能用在生产环境嘛? HOT 2
- 分页问题 HOT 1
- Using `schema.Namer` to support customize naming strategy
- Oracle stored procedure OUT Variables HOT 1
- when a entity has a `[]byte` field, call `AutoMigrate()` throw ` ORA-22859: invalid modification of columns` HOT 1
- 结构体中如果存在保留字段,默认会多加一对双引号,导致数据库自动创建表失败。 HOT 1
- 在gorm的自定义类型`JSONMap` 时,在已生成表的情况下,再次运行数据库迁移报`ORA-22859: 无效的列修改` HOT 1
- 插入数据时缺少 `[]byte`到 `BLOB` 类型的转换,插入数据不成功 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gorm-oracle.