I want to truncate a table using sqlplus where the table name is in shell variable:
I am using :
sqlplus -s / <<end
truncate table $TABLE
end
I want to truncate a table using sqlplus where the table name is in shell variable:
I am using :
sqlplus -s / <<end
truncate table $TABLE
end
shell script
table=table_name
sqlplus << EOSQL
${DB_LOGON}
@truncate.sql $table
EOSQL
sql script (truncate.sql)
define table_var = &1
truncate table '&table_var'
---------- Post updated at 05:16 AM ---------- Previous update was at 05:11 AM ----------
Or simply
shell script
table=mak_temp4;
sqlplus << EOSQL
${db_LOGON}
truncate table $table;
EOSQL
I think that you are simply missing the trailing ;
from your truncate statement.
Robin