oracle 如何在 PL/SQL 中一行打印所有数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11361398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:57:01  来源:igfitidea点击:

how could I print all data in one line in PL/SQL

sqloracleplsql

提问by user1252398

I am practicing pl/sql programs .I have one program i.e.: Example:

我正在练习 pl/sql 程序。我有一个程序,即:示例:

begin
    for i in 1..10
    loop
        dbms_output.put_line(i);
    end loop;
end;

the output is like this:

输出是这样的:

1
2
3
.
.
.
10

But I have to print all the numbers in one line i.e.(123.....10) how could I archive this so, I will get the output is like this:123...10

但是我必须在一行中打印所有数字 ie( 123.....10) 我怎么能存档这个,我会得到这样的输出:123...10

回答by Vincent Malgrat

Use DBMS_OUTPUT.put:

使用DBMS_OUTPUT.put

SQL> begin
  2     for i in 1..10 loop
  3        dbms_output.put(i);
  4     end loop;
  5     dbms_output.new_line;
  6  end;
  7  /
12345678910

PL/SQL procedure successfully completed.

回答by Shehzad Bilal

use .put(i) instead of put_line

使用 .put(i) 而不是 put_line