- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Update field based on flat file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2006 04:48 AM
тАО03-10-2006 04:48 AM
I know I would use set in sql but how to open the flat file to do the imput.
#!/usr/bin/sh
cat GSG.class |while read i
do echo $i
var=`sqlplus -s admin/admin <
set CID = $2
FROM table
WHERE CCT = '$i';
exit
EOF`
So basically update record that has GSG44U104186000TSYS000 in CCT colume and update the CID column with 1234
Flat file looks like:
GSG44U104186000TSYS000,1234
GSG44U105141000TSYS000,3456
GSG44U105142000TSYS000,5747
GSG44U105143000TSYS000,4473
GSG44U105144000TSYS000,2233
GSG44U105169000TSYS000,3342
GSG44U107608000TSYS000,3422
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2006 04:54 AM
тАО03-10-2006 04:54 AM
Re: Update field based on flat file
If you want to read your file and split its lines into comma-delimited fields, do:
#!/usr/bin/sh
OLDIFS=${IFS}
IFS=","
while read X Y
do
echo "$X = $Y"
done < filein
IFS=${OLDIFS}
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2006 07:36 AM
тАО03-10-2006 07:36 AM
SolutionHere's a script to update columns of a table from values listed in a flat file:
=============================================
#!/usr/bin/sh
IFS=","
while read CCT CID
do
var=`sqlplus $USERID <<-EOF
set echo off head off
update tablename
set CID = $CID
where CCT = $CCT
/
exit
EOF`
done
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2006 07:57 AM
тАО03-10-2006 07:57 AM
Re: Update field based on flat file
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.
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2006 08:50 AM
тАО03-10-2006 08:50 AM