[Application Express 4.2.1.00.08.]
Hello, Super Gurus!
Maybe I'm still not able to wrap my head around quotes and concatenations yet, as in this post , I'd like to ask for your help again.
I can't seem to get a NEW LINE character to work in my htp.p & javascript.
Full story: it's an extension to what I've been working on, as noted in the link above. This time around, I'm calling a similar query, as shown below, from my "After Submit PL/SQL anonymous block" process:
DECLARE
TYPE emp_aat IS TABLE OF emp%ROWTYPE;
l_employees emp_aat;
v_result varchar2(5000) := '';
BEGIN
SELECT *
BULK COLLECT INTO l_employees
FROM emp
ORDER BY ename;
FOR i IN 1 .. l_employees.COUNT
LOOP
v_result := v_result || l_employees (i).ename || ' - '
|| 'Job: ' || l_employees (i).job || ' ';
|| chr(10);
END LOOP;
DBMS_OUTPUT.put_line (v_result);
END;
The above works nicely with the CHR(10), where each result starts on a new line:
ADAMS - Job: CLERK
ALLEN - Job: SALESMAN
BLAKE - Job: MANAGER
CLARK - Job: MANAGER
Further down on my PL/SQL block process, the problem I'm having is that I cannot get the v_result to show up as desired, with the new line:
htp.p('<body>');
htp.p('<script type="text/javascript">');
HTP.p('window.location.href="mailto:' || v_logged_on_user_email || ';'
||'?subject=Salary Raise Request'
||'&cc='
||v_hr_email
||';'
||'&body= '
||'\n'
||'Two hundred % raise for these luck folks!'
||'\r\n'
||v_result
||'";'
);
htp.p('</script>');
htp.p('</body>');
As a matter of fact, those '\n' and '\r\n' above don't seem to work at all. And the body of my email just has 1 big lump:
ADAMS - Job: CLERK ALLEN - Job: SALESMAN BLAKE - Job: MANAGER CLARK - Job: MANAGER
Questions:
- Should I replace "CHR(10)" in my SQL query with something so that javascript would recognize?
- How come '\n' is not working, as expected?
Please let me know if I've done something incorrectly with the above, and what should be done to correct it.
Thank you very much!