You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project I have Oracle 19c, that do not know about LIMIT command.
But cuz I want pagination, I decided to make query like this:
SELECT col_1, col_2
FROM my_table
WHERE ...
-- under K and N is values
OFFSET :K ROWS -- word ROWS required
FETCH NEXT :N ROWS ONLY
So if K = 0, I have same work as with LIMIT, and if K > 0 I have pagination rule.
But with this rule I can not do this, so i write special func:
funcaddPagination2Query(querystring, args []any, limit, offsetuint) (string, []any) {
/* thx oracle for this PITA: We can`t use goqu function(offset + fetch), cuz oracle want to add ROW|ROW|NEXT after value. https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html#GUID-CFA006CA-6FF1-4972-821E-6996142A51C6__BABBADDD Library goqu have OrderWithOffsetFetchSQL() special for strange dialects, like oracle. But this function don`t work if offset = 0 it skips offset+fetch part, but oracle don`t have LIMIT) https://github.com/doug-martin/goqu/blame/21b6e6d1cb1befe839044764d8ad6b1c6f0b5ef4/sqlgen/common_sql_generator.go#L116 */query=query+fmt.Sprintf(" OFFSET %s%d ROWS", string(PlaceHolderFragment), len(args)+1) +fmt.Sprintf(" FETCH NEXT %s%d ROWS ONLY", string(PlaceHolderFragment), len(args)+2)
returnquery, append(args, offset, limit)
}
What about:
Make Limit()/Offset() can take []any argument, not only uint, to use like this .Fetch(goqu.L(“? ROWS ONLY“, limit))
or
Delete this if
p.s. Yes, I know that oracle is PITA, and I must look for PG f.e., and Yes, I know about dirty oracle hack like this: https://stackoverflow.com/a/241643, but I don`t want to do it
The text was updated successfully, but these errors were encountered:
In my project I have Oracle 19c, that do not know about LIMIT command.
But cuz I want pagination, I decided to make query like this:
So if K = 0, I have same work as with LIMIT, and if K > 0 I have pagination rule.
But with this rule I can not do this, so i write special func:
What about:
[]any
argument, not only uint, to use like this.Fetch(goqu.L(“? ROWS ONLY“, limit))
or
p.s. Yes, I know that oracle is PITA, and I must look for PG f.e., and Yes, I know about dirty oracle hack like this: https://stackoverflow.com/a/241643, but I don`t want to do it
The text was updated successfully, but these errors were encountered: