<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Need a script , thanks for help! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416932#M861453</link>
    <description>Hello all fellows,&lt;BR /&gt;&lt;BR /&gt;If I had a coulmn in number datatype and the value should be always sequential.&lt;BR /&gt;How could I get the value which is not in sequential?&lt;BR /&gt;&lt;BR /&gt;ex.&lt;BR /&gt;SQL&amp;gt; select * from temp order by 1;&lt;BR /&gt;&lt;BR /&gt;      COL1&lt;BR /&gt;----------&lt;BR /&gt;         0&lt;BR /&gt;         1&lt;BR /&gt;         2&lt;BR /&gt;         3&lt;BR /&gt;         6&lt;BR /&gt;         8&lt;BR /&gt;         9&lt;BR /&gt;&lt;BR /&gt;7 rows selected.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; &lt;BR /&gt;&lt;BR /&gt;How could I get the lost number : 4 , 5 , 7 ?&lt;BR /&gt;Thanks for any tips.&lt;BR /&gt;&lt;BR /&gt;Violin.</description>
    <pubDate>Mon, 08 Nov 2004 03:01:21 GMT</pubDate>
    <dc:creator>violin_1</dc:creator>
    <dc:date>2004-11-08T03:01:21Z</dc:date>
    <item>
      <title>Need a script , thanks for help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416932#M861453</link>
      <description>Hello all fellows,&lt;BR /&gt;&lt;BR /&gt;If I had a coulmn in number datatype and the value should be always sequential.&lt;BR /&gt;How could I get the value which is not in sequential?&lt;BR /&gt;&lt;BR /&gt;ex.&lt;BR /&gt;SQL&amp;gt; select * from temp order by 1;&lt;BR /&gt;&lt;BR /&gt;      COL1&lt;BR /&gt;----------&lt;BR /&gt;         0&lt;BR /&gt;         1&lt;BR /&gt;         2&lt;BR /&gt;         3&lt;BR /&gt;         6&lt;BR /&gt;         8&lt;BR /&gt;         9&lt;BR /&gt;&lt;BR /&gt;7 rows selected.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; &lt;BR /&gt;&lt;BR /&gt;How could I get the lost number : 4 , 5 , 7 ?&lt;BR /&gt;Thanks for any tips.&lt;BR /&gt;&lt;BR /&gt;Violin.</description>
      <pubDate>Mon, 08 Nov 2004 03:01:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416932#M861453</guid>
      <dc:creator>violin_1</dc:creator>
      <dc:date>2004-11-08T03:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script , thanks for help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416933#M861454</link>
      <description>since you don't mention the database you're using, we can't use extra functionality built-in in some databases.&lt;BR /&gt;&lt;BR /&gt;Personally I'd use perl/DBI, but I don't know if you have the corresponding driver installed, otherwise, after the connect to $dbh, you would have had something like&lt;BR /&gt;&lt;BR /&gt;my ($min, $max, $col1, %val) = (999999, 0);&lt;BR /&gt;my $sth = $dbh-&amp;gt;prepare ("select col1 from temp");&lt;BR /&gt;$sth-&amp;gt;bind_columns (\$col1);&lt;BR /&gt;while ($sth-&amp;gt;fetch) {&lt;BR /&gt; $val{$col1}++;&lt;BR /&gt; $val &amp;lt; $min and $min = $val;&lt;BR /&gt; $val &amp;gt; $max and $max = $val;&lt;BR /&gt; }&lt;BR /&gt;for ($min .. $max) {&lt;BR /&gt; exists $val{$_} or print "$_ missing\n";&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;otherwise you could create a temp2 table that has all values inserted from min(temp.col1) to max(temp.col1)&lt;BR /&gt;&lt;BR /&gt;select col1 from temp2 where col1 not in (select col1 from temp);&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 08 Nov 2004 03:11:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416933#M861454</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-11-08T03:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script , thanks for help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416934#M861455</link>
      <description>Sorry, the DB is Oracle 8.1.7.4.</description>
      <pubDate>Mon, 08 Nov 2004 03:13:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416934#M861455</guid>
      <dc:creator>violin_1</dc:creator>
      <dc:date>2004-11-08T03:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script , thanks for help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416935#M861456</link>
      <description>PL/SQL version :&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; set serveroutput on&lt;BR /&gt;SQL&amp;gt; declare&lt;BR /&gt;  2    tmpnum number(2);&lt;BR /&gt;  3    maxval number(2);&lt;BR /&gt;  4    curval number(2);&lt;BR /&gt;  5  begin&lt;BR /&gt;  6    tmpnum:=0;&lt;BR /&gt;  7    select max(col1) into maxval from temp;&lt;BR /&gt;  8    while (tmpnum&lt;MAXVAL&gt;&lt;/MAXVAL&gt;  9    loop&lt;BR /&gt; 10      select count(*) into curval from temp where col1=tmpnum;&lt;BR /&gt; 11      if curval=0 then&lt;BR /&gt; 12        dbms_output.put_line(tmpnum);&lt;BR /&gt; 13      end if;&lt;BR /&gt; 14      tmpnum:=tmpnum+1;&lt;BR /&gt; 15    end loop;&lt;BR /&gt; 16  end;&lt;BR /&gt; 17  /&lt;BR /&gt;4&lt;BR /&gt;5&lt;BR /&gt;7&lt;BR /&gt;&lt;BR /&gt;ProcÃ©dure PL/SQL terminÃ©e avec succÃ¨s.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Nov 2004 04:11:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416935#M861456</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-11-08T04:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script , thanks for help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416936#M861457</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;is the case of lost numbers is a problem (should not be though!) then there must be a flaw in the piece of code generating it!&lt;BR /&gt;&lt;BR /&gt;in practice, you would use a trigger + sequence to accomplish that.&lt;BR /&gt;&lt;BR /&gt;You may also use a function to generate that for you.&lt;BR /&gt;e.g.&lt;BR /&gt;create or replace function get_nextval( p_name in varchar2 ) return number&lt;BR /&gt;as&lt;BR /&gt;  l_id number;&lt;BR /&gt;begin&lt;BR /&gt;     update ids set id = id+1 where name = upper(p_name)&lt;BR /&gt;     returning id into l_id;&lt;BR /&gt;  &lt;BR /&gt;     if ( sql%rowcount = 0 ) then&lt;BR /&gt;            raise_application_error( -20001, 'No such id name ' || p_name );&lt;BR /&gt;     end if;&lt;BR /&gt;     return l_id;&lt;BR /&gt;end;&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Yogeeraj</description>
      <pubDate>Mon, 08 Nov 2004 04:55:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416936#M861457</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2004-11-08T04:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script , thanks for help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416937#M861458</link>
      <description>hi, &lt;BR /&gt; &lt;BR /&gt;if you are using sequences to generate this number you can never guarantee that the numbers will always sequential:&lt;BR /&gt; &lt;BR /&gt;- if the sequence is created with "cache n entries" you will loose all entries in cache when the database is shutdowned.&lt;BR /&gt;- if the sequence is fetched, and then the transaction is rollbacked, then the fetched sequence entry is again lost.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Mon, 08 Nov 2004 06:34:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-script-thanks-for-help/m-p/3416937#M861458</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2004-11-08T06:34:31Z</dc:date>
    </item>
  </channel>
</rss>

