简体   繁体   中英

how to declare multiple variables in one line in oracle plsql block

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.

Thanks in Advance,

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.

Maybe you mean something else though...

不,这是它在PLSQL中的工作方式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM