-
Simple PL/SQL coding advice needed.
I have a procedure to send an email (using UTL_SMTP) in the database.
The message body should be a list of records from a table.
What would be an efficient method for creating the message body?
I was thinking of declaring a char variable to hold the text and LOOPING through the table . For every record found it would append the 2 column char string to the string variable with a CHR(10) to throw a new line.
So (Pseudo code)
DECLARE
v_2_col_char_string VARCHAR2(100);
var_string VARCHAR2(4000);
CURSOR C1 IS
SELECT colA||' - '||colB
FROM table
WHERE x = y...;
OPEN c1 ...
LOOP ...
FETCH INTO v_2_col_char_string;
Var_string := var_string||v_2_col_char_string||CHR(10);
END LOOP;
THEN CALLING MY mail procedure:
SEND_MAIL(recipient, from, var_string ...);
Is there a more efficient or neater way of doing what I'm after?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|