Skip to content
Advertisement

Is there a way to change the output row name in Oracle?

I have Procedure which removed/deleted the lowest lnr. The code works fine.

SELECT * FROM lager; -- Before

CREATE OR REPLACE
PROCEDURE del_min_lager AS
BEGIN
    DELETE FROM Lagerbuchung
    WHERE  LNR = (SELECT MIN(LNR) FROM Lager);
    DELETE FROM Lager
    WHERE  LNR = (SELECT MIN(LNR) FROM Lager);
END del_min_lager;
/

EXECUTE del_min_lager;
SELECT * FROM Lager; -- After

So my question is, if there is anyway I can make my output better.

I’ve tried following:

SELECT * FROM Lager as 'Before';

But it doesn’t work like it does in SSMS.

I would like to have output such as:

BEFORE
.
.
.
.
.

Advertisement

Answer

You could simply add a column for status

SELECT 'BEFORE' AS status, lager.* FROM lager
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement