DisplayAdd1

TechnoTechDB is a platform, which will help to grow your carrier in Information sector. Having 15 years of Experience in Oracle/MongoDB/Postgres/Mysql databases, along with having good expertise level of knowledge in Scripting to automate database task. Our goal to start with zero to hero level expertise in Database. You can access/refer my some blogs on https://mrorcldba.blogspot.com link and post your comments and your suggestion to motive us.

Sunday, 18 June 2023

TRANSPOSE Column to Rows in Linux script

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

Steps to Rename Host in Oracle RESTART (ASM) in Linux

  oracle@localhost ] asmcmd ASMCMD> lsdg State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_...