Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

Topic-icon Question SQLOperation, used to create the list and execute the alter table shrink queries

More
16 Aug 2021 10:51 #1 by aschuh
Hello.

I have a problem similar to the one related to the existing topic "SQLOperation to select tables to drop"

I must first create the list of queries to shrink periodically all our tables
Then I have to execute all the alter table queries, in the right order, table by table.

I have one SQLOperation object with this select query (action_type=SELECT):
SELECT
'alter table DEV_PREPUSER2.' || table_name || ' enable row movement' LINE_1
,'alter table DEV_PREPUSER2.' || table_name || ' shrink space compact' LINE_2
,'alter table DEV_PREPUSER2.' || table_name || ' shrink space cascade' LINE_3
,'alter table DEV_PREPUSER2.' || table_name || ' disable row movement' LINE_4
FROM
user_tables
WHERE
TABLE_NAME not like '%$%'
AND rownum = 1

I first wanted to test the creation of the 4 alter table queries, for only 1 table. The aim is to delete the clause "AND rownum=1", in order to shrink all the tables.

I have a second SQLOperation object, linked to the first one by a Direct Bind, with this code (action_type=DDL_DML and multi_queries=true):
:{LINE_1}:;
:{LINE_2}:;
:{LINE_3}:;
:{LINE_4}:;

Result : for only 1 table, the execution is working well, but when I delete the clause on the rownum, it doesn't work !

What is missing in my 2 objects ? What has to be modified ?

Thanks in advance for your answers

Alex