Oracle ORA-01722 error during a simple query

Hi all,

we are trying a simple query against an Oracle table, which just selects the whole table by a table selector node. Any tries to get data from this node lead to an error like:
”Error during fetching data from the database: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number”. We tried all fields or single fields and got always the same result. The data types on the oracle side are varchar2 and binary_double.

When we tried exactly the same query which KNIME produces: select \* “<schema name>”.”<table name>” in Oracle SQL Developer everything worked fine and data was passed back.

So I wonder which SQL is passed against Oracle and how we can debug this case. Could it also be a bug?

Thanks in advance for any help

Hi @RolandGrund , that Oracle error message is not likely to be a bug with KNIME, although it could be caused means that somewhere where Oracle attempted to interpret your query it attempted to convert some non-numeric character data into a number.

For example, suppose you had the following table:

create table mytable (code varchar2(5), name varchar2(100));

insert into mytable(code, name) values ('1','Adam');
insert into mytable(code, name) values ('2','Bob');
code name
1 Adam
2 Bob

The following select would work, because although code is a varchar2 column, the data contained within can be interpreted as numeric

select * from mytable where code=1;

However, if you added the following data row:

insert into mytable(code, name) values ('c','Charlie');

Your table would now look like this:

code name
1 Adam
2 Bob
c Charlie

The following query would now fail with
ORA-01722: invalid number

select * from mytable where code=1;

e.g. demo using Oracle Live SQL

But with additional “c” row:

This fails because in order to find rows where code=1, Oracle attempts to translate all values of code to numeric, and hits the “invalid number” error when it gets to “c”.

Now without knowing your actual table data, and the query, it is not possible to tell you exactly where your problem is, but the problem will be with your query or a misunderstanding of your data.

It could be that the query you are generating with KNIME needs to have single quotes put round a numeric value, but you’d need to give more information and show us the actual query. Unfortunately Oracle is not very forthcoming about the specific row of data causing the problem, or even the column which is frustrating. I’ve been there many times! :wink:

The example query that you included appears to be slightly garbled, but did it contain a WHERE clause?

Also, did you tell SQL Developer to return ALL rows from the entire returned dataset or did you just have it return the first 50 (for example) rows? If it only returned a subset of the rows, it is possible that it didn’t hit the error in the returned data. KNIME will be returning ALL rows, so Oracle will hit the error when it gets to the offending row.

Which nodes are you using in KNIME to query the database, and have you told KNIME to convert any returned data to Integer or other numeric fields using the type mapping tabs on any of the db query nodes?

Somewhere, either intentionally or unintentionally, you are asking Oracle to convert character data to numeric data and it is failing in Oracle.

1 Like

Hi @takbb ,

KNIME is using the simplest possible query (automatically generated by a table selector node): select * from schema.table, both schema and table names are in double quotes. Meanwhile I also ran the same select statement on Oracle SQL Developer and successfully exported all rows (165.277) to a spool file. So there was no error during this query.

Hi @RolandGrund, can you also tell us the following

Is it a custom query or just using schema name and table name configuration in DB Table Selector?

This is odd as it’s an Oracle error return code which is very specific, so the key is to identify what it actually being asked of Oracle, and why.

Also, which version of Oracle, and which version of KNIME?

Some further questions that may be relevant… are you using your own Oracle jdbc driver, or the driver supplied in the Oracle database extension, and are you using the Oracle Connector, or a generic Database Connector?
thanks

Thanks for your help … here are some more details:
the table selector node configuration - quite simple:

The data types of the input source:

The automatically generated query:

The input type mapping default values - I did not change anything here:

Maybe BINARY_DOUBLE is missing?

The error message from table preview - maybe it’s a driver problem?:

KNIME version is 5.5.1.
Here is the Oracle driver:

Oracle Version is:

thanks for all the additional info.

I haven’t personally used binary double columns with KNIME, and I don’t have an oracle database at the moment to connect to.

Can you try a couple of things?

In the Table Selector, can you make it a “custom query” and enter the following query:

SELECT
    MATERIAL10,
    MATERIAL13,
    BU,
    BILLINGDATEMONTH,
    STATUSCOSTPOTENTIAL,
    COSTUDEADLINE,
    COSTACTION
FROM 
   MARD_AAMS.V_AAMS_COST_POTENTIAL_DATA

and see if that gives the same error.

The try it with this query:

SELECT
    IPPTURNOVER,
    NPPTURNOVER,
    QTYBASEUNIT,
    GM1CONSO,
    GM1POTENTIALPRICE,
    GM1POTENTIALCOST,
    GM1PERCENTAGEOFNS,
    NPP,
    MINNPP,
    PPC,
    PPCCONSO,
    TARGETFEPAAONNPPMIN,
    MINIMUMMARGIN
FROM
   MARD_AAMS.V_AAMS_COST_POTENTIAL_DATA

I hope I got all the column names right. (I got chatgpt to extract them from the screenshots!)

I’m just trying to separate the return of VARCHAR2 columns vs BINARY_DOUBLE columns to see if that changes anything. From what you said in your first post, you may already have tried this so I apologise if you have already done so.

JDBC DRIVER VERSION?
One other thought. I just looked up ojdbc8 and I understand this does not officially support JRE 17, which I think is the version of java in use with KNIME 5.5.

Is there a specific reason for configuring your own jdbc driver rather than using the KNIME Oracle extension? Have you tried using a later ojdbc driver that is designed for JRE17? Unless there is good reason not to, I would generally use the Oracle extension and the Oracle connector set to “latest available driver”, rather than configuring my own jdbc driver.

1 Like

Meanwhile I tried the two queries - they both produce the same error as before.
Additionally I tried the latest driver (see below) - unfortunately with the same result:

Darn, this is frustrating.. Are you able to use the Oracle Connector instead of the DB connector, and what happens if you change the query to

Select 'test' as col from dual

Or even a query from a different table?

I don’t know if this helps but have you tried to cast the binary_double column as a string?

SELECT BU, TO_CHAR(NPP, '99999999') FROM MARD_AAMS.V_AAMS_COST_POTENTIAL_DATA

This would help to narrow down the problem to the binary_double columns.

Hi both,

it’s really strange, no query at all seems to run with this table (except select * from #table# where 0 = 1). Even if I’m selecting just one column there is the same error - here is what the KNIME log says when we have e.g. select BU from #table# - maybe this helps? Interestingly the driver complains about a Syntax error:

at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:632)

... 29 more

2025-11-14 08:42:00,626 : WARN : AWT-EventQueue-0 : : DBDataPortObject : DB Table Selector : 3:9186 : Error during fetching data from the database: java.sql.SQLSyntaxErrorException: ORA-01722: Ungültige Zahl

java.util.concurrent.ExecutionException: java.sql.SQLSyntaxErrorException: ORA-01722: Ungültige Zahl

at java.base/java.util.concurrent.FutureTask.report(Unknown Source)

at java.base/java.util.concurrent.FutureTask.get(Unknown Source)

at java.desktop/javax.swing.SwingWorker.get(Unknown Source)

at org.knime.database.port.DBDataPortObject$PreviewPanel$2.doneWithContext(DBDataPortObject.java:324)

at org.knime.core.util.SwingWorkerWithContext.done(SwingWorkerWithContext.java:163)

at java.desktop/javax.swing.SwingWorker$5.run(Unknown Source)

at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)

at java.desktop/sun.swing.AccumulativeRunnable.run(Unknown Source)

at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)

at java.desktop/javax.swing.Timer.fireActionPerformed(Unknown Source)

at java.desktop/javax.swing.Timer$DoPostEvent.run(Unknown Source)

at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.desktop/java.awt.EventQueue$4.run(Unknown Source)

at java.desktop/java.awt.EventQueue$4.run(Unknown Source)

at java.base/java.security.AccessController.doPrivileged(Unknown Source)

at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.sql.SQLSyntaxErrorException: ORA-01722: Ungültige Zahl

at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:628)

at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:562)

at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1207)

at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:727)

at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:291)

at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:498)

at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:115)

at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:946)

at oracle.jdbc.driver.OracleStatement.prepareDefineBufferAndExecute(OracleStatement.java:1245)

at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1132)

at oracle.jdbc.driver.OracleStatement.executeSQLSelect(OracleStatement.java:1589)

at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1430)

at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1968)

at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:394)

at org.knime.database.connection.wrappers.AbstractStatementWrapper.executeQuery(AbstractStatementWrapper.java:93)

at org.knime.database.connection.wrappers.AbstractStatementWrapper.executeQuery(AbstractStatementWrapper.java:93)

at org.knime.database.connection.wrappers.AbstractStatementWrapper.executeQuery(AbstractStatementWrapper.java:93)

at org.knime.database.connection.impl.monitored.MonitoredStatement.executeQuery(MonitoredStatement.java:82)

at org.knime.database.connection.wrappers.AbstractStatementWrapper.executeQuery(AbstractStatementWrapper.java:93)

at org.knime.database.agent.reader.impl.DefaultDBReader.read(DefaultDBReader.java:154)

at org.knime.database.port.DBDataPortObject$PreviewPanel$2.getDataTable(DBDataPortObject.java:380)

at org.knime.database.port.DBDataPortObject$PreviewPanel$2.doInBackgroundWithContext(DBDataPortObject.java:312)

at org.knime.database.port.DBDataPortObject$PreviewPanel$2.doInBackgroundWithContext(DBDataPortObject.java:1)

at org.knime.core.util.SwingWorkerWithContext.doInBackground(SwingWorkerWithContext.java:106)

at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: Error : 1722, Position : 744, Sql = SELECT * FROM (SELECT

BU

FROM “MARD_AAMS”.“V_AAMS_COST_POTENTIAL_DATA”) “tempTable_3780153465794249034” WHERE rownum <= 100, OriginalSql = SELECT * FROM (SELECT

BU

FROM “MARD_AAMS”.“V_AAMS_COST_POTENTIAL_DATA”) “tempTable_3780153465794249034” WHERE rownum <= 100, Error Msg = ORA-01722: Ungültige Zahl

at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:632)

... 29 more

@RolandGrund , if you ignore the preview in the table selector node and just attach a DB Reader node to the DB Table Selector node does that then execute ok?

You could also try attaching and executing a DB Query Extractor to see what that returns.

Edit: did you try using the Oracle Connector node instead of the generic DB Connector node, as mentioned earlier?

1 Like

@takbb the DB Reader node without preview leads to the same error.
Concerning Oracle connector:
how would I specify the following database URL in this node?
jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS_LIST=(LOAD_BALANCE=off)(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP)(HOST=FE0EXARAC01.de.bosch.com)(PORT=38000))(ADDRESS=(PROTOCOL=TCP)(HOST=SI0EXARAC04.de.bosch.com)(PORT=38000))(ADDRESS=(PROTOCOL=TCP)(HOST=SI0EXARAC05.de.bosch.com)(PORT=38000)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=RLDP01_CON_4.BOSCH.COM)))

That’s not really clear to me

Hi @RolandGrund , you’re right it’s not obvious how to use a tnsnames name with the Oracle Connector.

Your tns is using failover and so contains multiple host addresses that could be tried in turn if connection failed. For the purposes of this test, I would be inclined to just try configuring using one of the host names listed.

e.g.
FE0EXARAC01.de.bosch.com
like this:

If that host doesn’t connect, try configuring using one of the others SI0EXARAC04.de.bosch.com or SI0EXARAC05.de.bosch.com