truncate+multiple+tables
how to truncate multiple tables in vertica assume 300+ tables
below is the sql code
sqlplus -s user password
declare
cursor c1 is select distinct(tname) from tab
begin
for i in c1
loop
begin
execute immediate 'TRUNCATE TABLE ' || i.TNAME;
end
below is the sql code
sqlplus -s user password
declare
cursor c1 is select distinct(tname) from tab
begin
for i in c1
loop
begin
execute immediate 'TRUNCATE TABLE ' || i.TNAME;
end
0
Comments
This is basic SQL generating SQL stuff, Kranthi:
Here's a script that you run with vsql - with these environment variables set previously:
VSQL_DATABASE, VSQL_HOST, VSQL_PASSWORD, VSQL_USER
It counts the rows in each table in my 'ofsdata' schema. Happy Playing - marco:
The statements referred by you are not available with Vertica.
Basically programmable SQL is not yet supported by Vertica, but there are workarounds for everything
So suppose you want to truncate 300 tables at once.
You can generate the SQL for 300 tables this way. You can redirect the output to sql file and run sql file using Hope this helps.
NC