Home » SQL & PL/SQL » SQL & PL/SQL » How to display Column name
How to display Column name [message #7695] Tue, 01 July 2003 12:25 Go to next message
MM
Messages: 27
Registered: July 2002
Junior Member
I have a requirement which needs to display column name before the value of the column.

Example
Column name is MESSAGE_GROUP
Value in the column is BVTM

I need to be displayed as

MESSAGE_GROUP=BVTM in the MESSAGE_GROUP column

Thanks in advance.

MM
Re: How to display Column name [message #7697 is a reply to message #7695] Tue, 01 July 2003 12:50 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
select message_group || ' in the MESSAGE_GROUP column' message_group
  from table_name;
Re: How to display Column name [message #7700 is a reply to message #7697] Tue, 01 July 2003 13:21 Go to previous messageGo to next message
MM
Messages: 27
Registered: July 2002
Junior Member
When i run the query as explained by you, the result set is
BVTM in the MESSAGE_GROUP column
Is is possible to display
MESSAGE_GROUP = BVTM

Thanks
MM
Re: How to display Column name [message #7703 is a reply to message #7700] Tue, 01 July 2003 14:29 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9090
Registered: November 2002
Location: California, USA
Senior Member
Just change the wording between the single quotes and reverse the concatenation:

SELECT 'MESSAGE_GROUP = ' || message_group
AS message_group
FROM table_name;
Re: How to display Column name [message #7704 is a reply to message #7703] Tue, 01 July 2003 15:46 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Sorry, I misread that - I thought they wanted the text to be everything to the right of the equals sign.
Previous Topic: best WHERE clause
Next Topic: SQLPlus PL/SQL
Goto Forum:
  


Current Time: Fri Apr 26 06:43:49 CDT 2024