Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to create a format in sql query USING <HTML> tags

User_H6M8ADec 19 2018 — edited Dec 20 2018

Hello gurus,

I need to represent values in the below format:

   

End Customer Account Name
End Customer Country
Sales Order #
Product SKUQuantityStart dateEnd date

The  below ones can be of multiple rows

Product SKUQuantityStart dateEnd date

I used the below approach but the whole content i,e repeating

   

End Customer Account Name
End Customer Country
Sales Order #
Product SKUQuantityStart dateEnd date

DECLARE

p_order_number NUMBER;

   TYPE V_STR IS TABLE OF VARCHAR2(32767);

      v_str_col v_str:= v_str();

      c_str CLOB;

    v_count NUMBER:=0;

    v_service_Reference_type_Code VARCHAR2(300):=NULL;

    v_refer_item  VARCHAR2(1000):=NULL;

    l_email_users VARCHAR2(2000):=NULL;

   

BEGIN

EXECUTE IMMEDIATE 'SELECT ''<html><head>

<style>

table, th, td {

    border: 1px solid black;

}

</style>

</head>

<body>

<table>

<tr>

    <th colspan="2">Sales Order ''||order_number||'' has been shipped for Details below: </th>

  </tr>

  <tr>

    <th colspan="2">Lici Information</th>

  </tr>

  <tr>

    <td>End Customer Account Name</td>

    <td>''||end_customer_party||''</td>

  </tr>

   <tr>

    <td>End Customer Country</td>

    <td>''||territory_short_name||''</td>

  </tr>

   <tr>

    <td>Sales Order #</td>

    <td>''||order_number||''</td>

  </tr>

   <tr>

    <td>Product SKU</td>

    <td>''||ordered_item||''</td>

  </tr>

   <tr>

    <td>Quantity</td>

    <td>''||ordered_quantity||''</td>

  </tr>

   <tr>

    <td>Subscription Start Date</td>

    <td>''||SERVICE_START_DATE||''</td>

  </tr>

  <tr>

    <td>Subscription End Date</td>

    <td>''||SERVICE_END_DATE||''</td>

</tr>   

</table>

</body>

</html>

<br /><br />

<table>

  <tr>

    <th colspan="2">Technical Contact Information</th>

  </tr>

  <tr>

    <td>Reseller</td>

    <td>''||attribute18||''</td>

  </tr>

  <tr>

    <td>Technical Name</td>

    <td>''||attribute19||''</td>

  </tr>

  <tr>

    <td>Technical Contact E-Mail Address</td>

    <td>''||attribute20||''</td>

  </tr>

  </table>

  <br /><br />

  <table>

  <tr>

    <td>Purchase Order #</td>

    <td>''||cust_po_number||''</td>

  </tr> 

  </table>

  <br /><br />

   <table>

  <tr>

    <td>Please Provide the Serial Number :</td>   

  </tr> 

  </table>

   <br /><br />

   </table>

   <br /><br />

''

                     FROM apps.TEST_VIEW

                     WHERE 1=1

                     AND ORDER_NUMBER = ' ||''''||108256||''''||''

                  

BULK COLLECT INTO v_str_col;

FOR I IN 1 .. v_str_col.COUNT LOOP

          DBMS_OUTPUT.PUT_LINE(v_str_col(i));

c_str := c_str||CHR(13)||v_str_col(i);        

v_count:=   v_str_col.COUNT;

END LOOP;

END;

Comments
Post Details
Added on Dec 19 2018
5 comments
1,810 views