1 Reply Latest reply: Apr 8, 2013 9:44 AM by AlbertoFaenza RSS

    HTML colum format

    User477708-OC
      Trying to format a html output in sqlplus. Report out ok, 1 of my columns just doesnt want to change its width and its wrapping. The col width is varchar2 50 and can have varying sentences in it. All words are wrapping. so for example if the data has
      "this is a sentence"

      the column comes out wrapped ala
      "this
      is
      a
      sentence"

      I tried setting the col format but no joy, the column after it is a smaller width, has similar varchar data and doesnt wrap. I tried placing my wrapping column placement but still wraps.
      SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON -
      HEAD "<TITLE> Jobs with Critical Page Alerts</TITLE> -
      <STYLE type='text/css'> -
      <!-- BODY {background: #FFFFC6} --> -
      </STYLE>" -
      BODY "TEXT='#000000'" -
      TABLE "WIDTH='90%' BORDER='5'"
      
      col crit_alert head "Critical Alert" format a70 
      
      spool c:\temp\file.html
      
      select crit_alert, crit_name
      from crit_Table;
      Ive written SQLplus HTML format for years, never seen this before.
        • 1. Re: HTML colum format
          AlbertoFaenza
          Hi,

          could you post some sample data?

          I've done the following test:
          SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON -
          HEAD "<TITLE> Jobs with Critical Page Alerts</TITLE> -
          <STYLE type='text/css'> -
          <!-- BODY {background: #FFFFC6} --> -
          </STYLE>" -
          BODY "TEXT='#000000'" -
          TABLE "WIDTH='90%' BORDER='5'"
          
          spool z:\temp\file.html
           
          with crit_table AS
          (
             select 'This is a sentence' crit_alert, 'This is the name of the alert' crit_name from dual
          )
          select crit_alert, crit_name
          from crit_Table;
          
          spool off
          and the code in my file file.html appears as below:
          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
          <meta name="generator" content="SQL*Plus 11.2.0">
          <TITLE> Jobs with Critical Page Alerts</TITLE>  <STYLE type='text/css'>  <!-- BODY {background: #FFFFC6} -->  </STYLE>
          </head>
          <body TEXT='#000000'>
          <p>
          <table WIDTH='90%' BORDER='5'>
          <tr>
          <th scope="col">
          CRIT_ALERT
          </th>
          <th scope="col">
          CRIT_NAME
          </th>
          </tr>
          <tr>
          <td>
          This is a sentence
          </td>
          <td>
          This is the name of the alert
          </td>
          </tr>
          </table>
          <p>
          
          </body>
          </html>
          Also can you check what is the value of your linesize in SQLPlus? Maybe you have a default value changed.
          show linesize
          You can set it to a different value with this command:
          set linesize 200
          Regards.
          Al