How to declare multiple variables on one line in oracle plsql block

I want to declare several variables 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 on the same line.

Thanks Advance,

+4
source share
2 answers

I don’t know why you intentionally made 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 delimiter in PL / SQL, and it doesn’t matter if you have spaces or newlines; unlike a simple SQL run in SQL * Plus, let's say where the new statement after the separator should be on a new line, but this is the client thing.

Maybe you mean something else, though ...

+11

, PLSQL.

+5

Source: https://habr.com/ru/post/1532619/


All Articles