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 to select tables to drop

More
03 Jan 2019 15:51 #1 by leo75
Hi!

First of all, happy new year!

Second, I have a process wich is composed of two SQLOperations :
- the first one : select the table to drop on the database

- the second one : linked by a DirectBind to the first one, is getting the select result from # and is supposed to drop the tables

But... it doesn't do anything...
Any idea?

Thanks a lot!

Leo
Attachments:
More
04 Jan 2019 17:20 #2 by Thomas BLETON
Replied by Thomas BLETON on topic SQLOperation to select tables to drop
Hi Leo and happy new year :)

At first sight everything looks correct.
What happens at execution ?
What is the value of the variable "CORE_BIND_ITERATIONS" for the "DropTablesSelected" action, after execution ?
More
07 Jan 2019 09:18 #3 by leo75
Replied by leo75 on topic SQLOperation to select tables to drop
Hi Thomas,

After execution, CORE_BIND_ITERATIONS = 0

I know that's not a good sign :silly:

Attachments:
More
07 Jan 2019 10:59 #4 by Thomas BLETON
Replied by Thomas BLETON on topic SQLOperation to select tables to drop
CORE_BIND_ITERATIONS = 0 means that the SELECT action did not fetch any rows.
=> double check your SELECT query :)
More
07 Jan 2019 11:23 #5 by leo75
Replied by leo75 on topic SQLOperation to select tables to drop
When I execute the query on MSSQL Studio, it returns lines, but the same query executed in Stambia returns 0 line.
I think there is something wrong with the schema, it's like the query is not executed with the schema I set up in the parameters of the SQLOperation.
More
07 Jan 2019 11:29 - 07 Jan 2019 11:29 #6 by Thomas BLETON
Replied by Thomas BLETON on topic SQLOperation to select tables to drop
That is probably the reason.
MSSQL Studio creates a kind of context when you open a SQL editor => I suppose the SQL editor works in a "current" database and/or schema. This kind of client-specific context does not exist when working with Stambia (our SQL editor is a generic JDBC client).
=> Try to specify fully qualified names for the Tables / Views : <database>.<schema>.<table>
Last edit: 07 Jan 2019 11:29 by Thomas BLETON.
More
07 Jan 2019 11:54 #7 by leo75
Replied by leo75 on topic SQLOperation to select tables to drop
All good, it's working the DB + schema in the query!

Thanks!
More
16 Aug 2021 10:01 - 16 Aug 2021 10:09 #8 by aschuh
Replied by aschuh on topic SQLOperation to select tables to drop
Hello.

I have a problem similar to the one related to this topic

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.

I have one Action Code object with this select query :
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 Action Code object, linked to the first one by a Direct Bind, with this code :
:{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
Last edit: 16 Aug 2021 10:09 by aschuh.