<?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 Update field based on flat file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966480#M787290</link>
    <description>How would I update a record based on one the first column of a flat file and update with second column.&lt;BR /&gt;I know I would use set in sql but how to open the flat file to do the imput.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&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;set CID = $2&lt;BR /&gt;FROM table&lt;BR /&gt;WHERE CCT = '$i';&lt;BR /&gt;exit&lt;BR /&gt;EOF`&lt;BR /&gt;&lt;BR /&gt;So basically update record that has GSG44U104186000TSYS000 in CCT colume and update the CID column with 1234&lt;BR /&gt;&lt;BR /&gt;Flat file looks like:&lt;BR /&gt;GSG44U104186000TSYS000,1234&lt;BR /&gt;GSG44U105141000TSYS000,3456&lt;BR /&gt;GSG44U105142000TSYS000,5747&lt;BR /&gt;GSG44U105143000TSYS000,4473&lt;BR /&gt;GSG44U105144000TSYS000,2233&lt;BR /&gt;GSG44U105169000TSYS000,3342&lt;BR /&gt;GSG44U107608000TSYS000,3422</description>
    <pubDate>Fri, 10 Mar 2006 12:48:20 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2006-03-10T12:48:20Z</dc:date>
    <item>
      <title>Update field based on flat file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966480#M787290</link>
      <description>How would I update a record based on one the first column of a flat file and update with second column.&lt;BR /&gt;I know I would use set in sql but how to open the flat file to do the imput.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&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;set CID = $2&lt;BR /&gt;FROM table&lt;BR /&gt;WHERE CCT = '$i';&lt;BR /&gt;exit&lt;BR /&gt;EOF`&lt;BR /&gt;&lt;BR /&gt;So basically update record that has GSG44U104186000TSYS000 in CCT colume and update the CID column with 1234&lt;BR /&gt;&lt;BR /&gt;Flat file looks like:&lt;BR /&gt;GSG44U104186000TSYS000,1234&lt;BR /&gt;GSG44U105141000TSYS000,3456&lt;BR /&gt;GSG44U105142000TSYS000,5747&lt;BR /&gt;GSG44U105143000TSYS000,4473&lt;BR /&gt;GSG44U105144000TSYS000,2233&lt;BR /&gt;GSG44U105169000TSYS000,3342&lt;BR /&gt;GSG44U107608000TSYS000,3422</description>
      <pubDate>Fri, 10 Mar 2006 12:48:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966480#M787290</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-03-10T12:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Update field based on flat file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966481#M787291</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you want to read your file and split its lines into comma-delimited fields, do:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;OLDIFS=${IFS}&lt;BR /&gt;IFS=","&lt;BR /&gt;while read X Y&lt;BR /&gt;do&lt;BR /&gt;  echo "$X = $Y"&lt;BR /&gt;done &amp;lt; filein &lt;BR /&gt;IFS=${OLDIFS}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 10 Mar 2006 12:54:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966481#M787291</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-03-10T12:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Update field based on flat file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966482#M787292</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here's a script to update columns of a table from values listed in a flat file:&lt;BR /&gt;&lt;BR /&gt;=============================================&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;IFS=","&lt;BR /&gt;while read CCT CID&lt;BR /&gt;do&lt;BR /&gt;var=`sqlplus $USERID &amp;lt;&amp;lt;-EOF&lt;BR /&gt;set echo off head off&lt;BR /&gt;update tablename&lt;BR /&gt;   set CID = $CID&lt;BR /&gt; where CCT = $CCT&lt;BR /&gt;/&lt;BR /&gt;exit&lt;BR /&gt;EOF`&lt;BR /&gt;done &lt;INP&gt;&lt;/INP&gt;=============================================&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Fri, 10 Mar 2006 15:36:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966482#M787292</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-03-10T15:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Update field based on flat file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966483#M787293</link>
      <description>One small note on performance. It would be advisable to use one of the Oracle built-in functions like UTL_FILE in order to read the flat file and update the records in one fell swoop instead of looping through them one-by-one.&lt;BR /&gt;&lt;BR /&gt;The script reads one line of input, opens up a database sqlplus session and updates one record of the table and then exits. It repeats this procedure until end of flat file is reached. This is quite resource intensive and the recommended thing would be to use the Oracle supplied UTL_FILE package.&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Fri, 10 Mar 2006 15:57:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966483#M787293</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-03-10T15:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update field based on flat file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966484#M787294</link>
      <description>thanks</description>
      <pubDate>Fri, 10 Mar 2006 16:50:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/update-field-based-on-flat-file/m-p/4966484#M787294</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-03-10T16:50:33Z</dc:date>
    </item>
  </channel>
</rss>

