<?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 Re: select script returns no results in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966093#M787246</link>
    <description>You were absolutely right&lt;BR /&gt;$i instead of $1&lt;BR /&gt;&lt;BR /&gt;I cant believe I did that!&lt;BR /&gt;Thanks!</description>
    <pubDate>Thu, 09 Mar 2006 21:26:20 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2006-03-09T21:26:20Z</dc:date>
    <item>
      <title>select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966087#M787240</link>
      <description>I have a flat file that I need to see if these records are in the data base, the script runs but returns 0 in database and I know there are records in the db. I can manually copy the one record from the flat file and run simple sql and it returns 1.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&amp;gt;GSG.not.in.ac; &amp;gt;GsG.in.ac&lt;BR /&gt;cat GSG.class |while read i&lt;BR /&gt;do echo $i&lt;BR /&gt;var=`sqlplus -s admin/admin &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;set echo off head off&lt;BR /&gt;SELECT  count (cct)&lt;BR /&gt;FROM table&lt;BR /&gt;WHERE CCT = '$1';&lt;BR /&gt;exit&lt;BR /&gt;EOF`&lt;BR /&gt;&lt;BR /&gt;if [ $var -eq 0 ]; then&lt;BR /&gt;echo $i &amp;gt;&amp;gt;GSG.not.in.ac&lt;BR /&gt;else&lt;BR /&gt;echo $i&amp;gt;&amp;gt;GSG.in.ac&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Flat file looks like:&lt;BR /&gt;GSG44U104186000TSYS000&lt;BR /&gt;GSG44U105141000TSYS000&lt;BR /&gt;GSG44U105142000TSYS000&lt;BR /&gt;GSG44U105143000TSYS000&lt;BR /&gt;GSG44U105144000TSYS000&lt;BR /&gt;GSG44U105169000TSYS000&lt;BR /&gt;GSG44U107608000TSYS000&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 17:39:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966087#M787240</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-03-09T17:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966088#M787241</link>
      <description>Instead of single quoting the variable use double quotes otherwise the shell won't expand it i.e.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; WHERE CCT = '$1';&amp;lt;&lt;BR /&gt;...should be...&lt;BR /&gt;WHERE CCT = "$1";&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Thu, 09 Mar 2006 17:47:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966088#M787241</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-03-09T17:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966089#M787242</link>
      <description>Shouldn't it be $i in position of $1 ?&lt;BR /&gt;&lt;BR /&gt;Volker</description>
      <pubDate>Thu, 09 Mar 2006 17:51:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966089#M787242</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2006-03-09T17:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966090#M787243</link>
      <description>Thanks Volker...it should be $i instead of $1 and moreover if the table column is of type number then don't quote it at all.&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Thu, 09 Mar 2006 17:56:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966090#M787243</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-03-09T17:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966091#M787244</link>
      <description>Hmm,&lt;BR /&gt;&lt;BR /&gt;GSG44U104186000TSYS000 lets me assume to be very much a sting. So single quoutes seem to me a proper solution, which might interfere with the reverse quotes.&lt;BR /&gt;May be they need to be escaped.&lt;BR /&gt;&lt;BR /&gt;What did you try when you included a record directly ? Just the sqlplus or the entire assignment to "var" ?&lt;BR /&gt;&lt;BR /&gt;so may be either&lt;BR /&gt;&lt;BR /&gt;WHERE CCT = '$i';&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;WHERE CCT = \'$1\';&lt;BR /&gt;&lt;BR /&gt;could be of help ?!!?&lt;BR /&gt;&lt;BR /&gt;Volker&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 18:09:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966091#M787244</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2006-03-09T18:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966092#M787245</link>
      <description>Hi Hradowy,&lt;BR /&gt;&lt;BR /&gt;Your script is fine whether single or double quotes. &lt;BR /&gt;&lt;BR /&gt;Only change is WHERE CCT = '$1'; the comparing vaue is in $i and not $1.&lt;BR /&gt;&lt;BR /&gt;And also make sure that your text on the flat file does not have any special chanracters towards the end. In whcih case you will have to use the 'like' instead of '='&lt;BR /&gt;&lt;BR /&gt;Like '%$i%'  instead of = '$i'.&lt;BR /&gt;&lt;BR /&gt;I tested with the same flat file that you gave and it works fine with the = '$i'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Indira A&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Mar 2006 19:46:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966092#M787245</guid>
      <dc:creator>Indira Aramandla</dc:creator>
      <dc:date>2006-03-09T19:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: select script returns no results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966093#M787246</link>
      <description>You were absolutely right&lt;BR /&gt;$i instead of $1&lt;BR /&gt;&lt;BR /&gt;I cant believe I did that!&lt;BR /&gt;Thanks!</description>
      <pubDate>Thu, 09 Mar 2006 21:26:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-script-returns-no-results/m-p/4966093#M787246</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-03-09T21:26:20Z</dc:date>
    </item>
  </channel>
</rss>

