How can I avoid having to open and close a database connection twice when working with a sub-work...

I would like to export the number of faulty rows of a

SELECT

statement, no matter if the the result is

= 0

or

<> 0

, to an Excel file. If the result is

<> 0

, I would like to export the faulty rows as well to a separate Excel file. How can I do this in a way that is better than this one?

(I am using `KNIME 4.6.3` and not the most recent version because of [these restrictions](https://community.knime.com/c/ask-the-community/starting-knime-from-console-noclassdeffounderror-could-not-initialize-class-org-knime-database-driver-dbdriverregistry-driverclassloader).)

Main workflow:

Sub-workflow:

As you can see, the output port of the `Call Workflow (Table Based)` node is crossed out. When the cursor is pointed to it, it says

Output (Inactive Port Object)

.

What bothers me is that a database connection is opened and closed twice which I deem to be unnecessary but maybe there is no alternative for this use case?

What do you think? Can this problem be solved in a better way?