Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing ORDER BY to sort data
    primarykey
    data
    text
    <p>This is the data that I would like to sort.</p> <pre><code>AAAAAAAA 0.0.0.0 hs01.stuff.net BBBBBBBB 0.0.0.0 hs01.morestuff.net CCCCCCCC 0.0.0.0 hs01.evenmorestuff.net DDDDDDDD 0.0.0.0 hs01.stuff.net EEEEEEEE 0.0.0.0 hs01.stuff.net FFFFFFFF 0.0.0.0 hs01.evenmorestuff.net GGGGGGGG 0.0.0.0 hs01.stuff.net HHHHHHHH 0.0.0.0 hs01.evenmorestuff.net </code></pre> <p>This is the result of the ORDER BY:</p> <pre><code>AAAAAAAA 0.0.0.0 hs01.stuff.net BBBBBBBB 0.0.0.0 hs01.morestuff.net CCCCCCCC 0.0.0.0 hs01.evenmorestuff.net DDDDDDDD 0.0.0.0 hs01.stuff.net EEEEEEEE 0.0.0.0 hs01.stuff.net FFFFFFFF 0.0.0.0 hs01.evenmorestuff.net GGGGGGGG 0.0.0.0 hs01.stuff.net HHHHHHHH 0.0.0.0 hs01.evenmorestuff.net </code></pre> <p>THE SAME OUTPUT, so something went wrong.</p> <p>This is what I have tried thus far</p> <pre><code>$dbh_source2 = DBI-&gt; connect("dbi:Oracle:host=????;port=????;sid=????",'????','????'); $SEL = "SELECT DISTINCT PE_LOOPBACK_IP, PE_FQDN FROM TABLE_NAME WHERE SITE_NAME = ? ORDER BY PE_FQDN"; $sth = $dbh_source2-&gt;prepare($SEL); </code></pre> <p>This does not work and does not sort the last column by the name. Does <code>ORDER BY</code> only sort based on the first character? Are the numbers that are within the name causing it to fail?</p> <p>Here is the code that I use to display the data:</p> <pre><code>print '&lt;table border=1&gt;'; print '&lt;tr&gt;'; print '&lt;th&gt;Tower name&lt;/th&gt;'; print '&lt;th&gt;SUR IP&lt;/th&gt;'; print '&lt;th&gt;SUR FQDN&lt;/th&gt;'; print '&lt;/tr&gt;'; foreach my $data_line (@raw_data) { chomp $data_line; $sth-&gt;execute($data_line); while (my @row = $sth-&gt;fetchrow_array ) { #Print data into cells# print "&lt;tr&gt;"; print "&lt;td&gt;$data_line&lt;/td&gt;"; foreach (@row) { print "&lt;td&gt;$_&lt;/td&gt;"; } print "&lt;/tr&gt;"; #print "&lt;$data_line&gt;\t @row\n"; } } print "&lt;/table&gt;"; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload