what I'm trying to do is ... need to drop tables w/ names like
ABC_NY_2001
ABC_ORD_2001
ABC_TX_2001
ABC_CL_2001
For this, I want to write a query "DROP TABLE ABC_var_2001".
now "var" should be either NY, ORD, TX or CL.
I'm new to programming so don't know how to create a variable w/ OR operation means do i need to create array and assign these values to array ? .. if so can you guys pls help me how to solve this w/ example script.
Thanks in Advance!!!
RAM
>for x in {NY,ORD,TX,CL}
> do
> echo "DROP TABLE ABC_"$x"_TBL"
> done
DROP TABLE ABC_NY_TBL
DROP TABLE ABC_ORD_TBL
DROP TABLE ABC_TX_TBL
DROP TABLE ABC_CL_TBL
How are you planing to execute these statements in sql prompt.
---------- Post updated at 05:07 PM ---------- Previous update was at 05:01 PM ----------
for x in {AA,BB,CC}; do echo "DROP TABLE A_"$x"_TBL"; done |isql db_name db_user
1 Like
Hey kumaran,
Thx for quick response.
now I want to call sqlplus in script and drop those tables.
Actually I'm using Netezza which is similar to oracle. Below is the code i'm trying but its not working.
NZCommand="nzsql -host <HOST> -db <DB_NM> -u <USER> -pw <PWD> -A"
$NZComamnd<<EOF
drop table ABC_"$x"_TBL
EOF
What kind of error you are facing. Simply saying it is not working will not help us understand.
Post some output or the error.