Avatar of Lawrence Avery
Lawrence Avery
Flag for United States of America asked on

making a message body variable from an oracle select statement

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;
Oracle Database

Avatar of undefined
Last Comment
Lawrence Avery

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Lawrence Avery

ASKER
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.
slightwv (䄆 Netminder)

>>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 Avery

ASKER
Good solution
Your help has saved me hundreds of hours of internet surfing.
fblack61