Below commands I have used in Oracle query where some time I need to put data in IN clause from txt file manually or with other method. But with this commands you can put in script it will automatically generate syntax format for ORACLE IN Clause
[oracle@oracle11g ]cat sqlid.txt <<--- Input
c3yw7auzsah15
378r7ukq8caam
9y55n98wubu9d
f7m1bh706uqss
[oracle@oracle11g ]$ cat /tmp//sqlid.txt | while read a
> do
> _sqlid+="'$a',"
> echo $_sqlid >/tmp//_sqlid1.log
> done
[oracle@oracle11g ]$ cat /tmp//_sqlid1.log
'c3yw7auzsah15','378r7ukq8caam','9y55n98wubu9d','f7m1bh706uqss',
[oracle@oracle11g ]$
[oracle@oracle11g ]$ _sid_lst=` cat /tmp//_sqlid1.log | rev | cut -c2- | rev`
[oracle@oracle11g ]$ echo $_sid_lst
'c3yw7auzsah15','378r7ukq8caam','9y55n98wubu9d','f7m1bh706uqss' <-- Output
No comments:
Post a Comment