oracle 如何在oracle plsql块中的一行中声明多个变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22527050/
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
how to declare multiple variables in one line in oracle plsql block
提问by Adarsh
I want to declare multiple variable in one line, Is there any way to write it ?
我想在一行中声明多个变量,有什么方法可以写吗?
DECLARE
A integer :=10;
B integer :=5;
BEGIN
END;
i want to declare a and b in one line.
我想在一行中声明 a 和 b。
Thanks in Advance,
提前致谢,
回答by Alex Poole
No idea why you'd intentionally make your code less readable, but just... put them on one line:
不知道为什么你会故意降低代码的可读性,但只是……把它们放在一行上:
set serveroutput on
DECLARE
A integer :=10;B integer :=5;
BEGIN
dbms_output.put_line(a ||':'|| b);
END;
/
anonymous block completed
10:5
The semicolon is a statement separator within PL/SQL and it doesn't matter whether or not you have whitespace or new lines; unlike plain SQL run in SQL*Plus, say, where a new statement after a separator does have to be on a new line, but that's a client thing.
分号是 PL/SQL 中的语句分隔符,与是否有空格或新行无关;与在 SQL*Plus 中运行的普通 SQL 不同,比如说,分隔符后的新语句必须在新行上,但这是客户端的事情。
Maybe you mean something else though...
也许你的意思是别的...
回答by Rene
no, this is the way it works in PLSQL.
不,这是它在 PLSQL 中的工作方式。