We help IT Professionals succeed at work.

making a message body variable from an oracle select statement

Lawrence Avery
on
140 Views
Last Modified: 2017-03-10
I am looking to create a message body variable in a stored procedure by assigning results of a select statement to it.

Can I do that?
In other words, something like:

Declare message_body  varchar2

message_body = select * from table1;
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Lawrence AverySystem Developer

Author

Commented:
I am sending the results of the select statement to another procedure but I want the results to have column headings followed by the data.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
>>but I want the results to have column headings followed by the data.

That is a sqlplus thing.  In PL/SQL if/when you are dealing with a cursor, you don't get column headings.

>>I am sending the results of the select statement to another procedure

When I see message_body, I think email.  If you are just passing data around, I wouldn't do it as a CLOB.  I would use a cursor, XML or some other PL/SQL collection object.
Lawrence AverySystem Developer

Author

Commented:
Good solution