UserVT
UserVT

Reputation: 21

Need help on oracle query format

I need help on setting the format for SQL output. for ex. I have this below query which gives the following result:

SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
isorcl1          OPEN

But I want the output to be in the format something like below, can you please help! Thanks in advance!

SQL> select instance_name,status from v$instance;

INSTANCE_NAME      ISORCL1   
STATUS             OPEN

Upvotes: 2

Views: 56

Answers (1)

Srini V
Srini V

Reputation: 11375

Ugly but it works for the OP's example; Mask the header and run this query in sqlplus

SET HEADING OFF;

SELECT 'INSTANCE_NAME', instance_name FROM v$instance
UNION ALL
SELECT 'STATUS', status FROM v$instance;

Upvotes: 1

Related Questions