在Oracle Live SQL中返回50行

发布于 2025-02-08 08:57:21 字数 1365 浏览 1 评论 0 原文

关于Oracle Live SQL在线环境( https://livesql.oracle.com/

:查询,默认情况下仅返回50行。

有没有办法返回50行?


示例会话:

“在这里输入图像描述”


源脚本: a>

--This query should return 220 rows.
with dimension as (
    select 0 as point from dual
      union all 
    select level
    from dual
    connect by level <= 10
), points as (
    select 
      a.point as startpoint, 
      b.point as endpoint,
      c.point as fixed
    from dimension a
    cross join dimension b
    cross join dimension c
    where b.point - a.point = 1
)
select
  startpoint as startpoint_x,
  fixed as startpoint_y,
  endpoint as endpoint_x,
  fixed as endpoint_y
from points
  union all
select
  fixed as startpoint_x,
  startpoint as startpoint_y,
  fixed as endpoint_x,
  endpoint as endpoint_y
from points
order by startpoint_y, endpoint_y, startpoint_x, endpoint_x

Regarding the Oracle Live SQL online environment (https://livesql.oracle.com/):

When I run a query, only 50 rows are returned by default.

Is there a way to return more than 50 rows?


Example session: https://livesql.oracle.com/apex/livesql/s/nmwyv5cu5vo4p9vofwjsasemh

enter image description here


Source script: https://stackoverflow.com/a/72621332/5576771

--This query should return 220 rows.
with dimension as (
    select 0 as point from dual
      union all 
    select level
    from dual
    connect by level <= 10
), points as (
    select 
      a.point as startpoint, 
      b.point as endpoint,
      c.point as fixed
    from dimension a
    cross join dimension b
    cross join dimension c
    where b.point - a.point = 1
)
select
  startpoint as startpoint_x,
  fixed as startpoint_y,
  endpoint as endpoint_x,
  fixed as endpoint_y
from points
  union all
select
  fixed as startpoint_x,
  startpoint as startpoint_y,
  fixed as endpoint_x,
  endpoint as endpoint_y
from points
order by startpoint_y, endpoint_y, startpoint_x, endpoint_x

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太傻旳人生 2025-02-15 08:57:21

这是livesql的限制。您可以使用选项操作 - &gt;最大行首选项 “请参阅屏幕截图” ,您可以在其中设置最高限制5000。AFAIK仍然无法设置Infinity-有一个解释“这可以防止您的浏览器被非常大的查询结果超载。小部件。

This is limitation of LiveSQL. You can partially circumvent it using option Action -> Maximum Rows Preference see screenshot, where you can set the highest limit 5000. It is AFAIK still impossible to set infinity - there is an explanation "This prevents your browser from being overloaded with very large query results. " in the help widget.

我很OK 2025-02-15 08:57:21
DECLARE cur CURSOR FOR
SELECT Salary FROM YourTableName WHERE Salary < @SalaryThreshold;

OPEN cur;

DECLARE @CurrentSalary INT;

FETCH NEXT FROM cur INTO @CurrentSalary;

WHILE @@FETCH_STATUS = 0
BEGIN
    UPDATE YourTableName
    SET Salary = @NewSalary
    WHERE CURRENT OF cur;

    FETCH NEXT FROM cur INTO @CurrentSalary;
END

CLOSE cur;

DEALLOCATE cur;
DECLARE cur CURSOR FOR
SELECT Salary FROM YourTableName WHERE Salary < @SalaryThreshold;

OPEN cur;

DECLARE @CurrentSalary INT;

FETCH NEXT FROM cur INTO @CurrentSalary;

WHILE @@FETCH_STATUS = 0
BEGIN
    UPDATE YourTableName
    SET Salary = @NewSalary
    WHERE CURRENT OF cur;

    FETCH NEXT FROM cur INTO @CurrentSalary;
END

CLOSE cur;

DEALLOCATE cur;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文