Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
GKarg
Contributor
Contributor

Null values passed to tDBRow prepared statements

Hi everyone!

Is there any way that I can use NULL in a tDBRow prepared statement as Int or String parameter value?

Every time I pass a null as a parameter value it throws back null pointer exception.

I use Talend Open Studio for Big Data 7.3.1

Looks like auto generated code is designed just for Date type parameters:

0695b00000IeDxwAAF.png

Why is that so?

Regards

Grzegorz

Labels (3)
3 Replies
Anonymous
Not applicable

Hello,

What does your prepared statement look like?

Have you tried to set all the null values to an empty string "" in a tDBRow prepared statement as String parameter value?

Best regards

Sabrina

GKarg
Contributor
Contributor
Author

Thanks Sabrina - it worked! I just had to cast these values in the query back to int like so:

 

INSERT INTO _kafka_fos_raw_log (...)

VALUES (?,?,?,?,?,?,?,?,?,?,?,?::int,?::int,?::int,?::int,?::int,?::int,?::int,?::int,?::int,?::int)

ON CONFLICT ON CONSTRAINT unique_raw_log DO NOTHING;

 

It's a bit sketchy and I wonder how much it affects performance, but such workaround works fine.

I think the best solution of my problem would be to have the option "on conflict do something" in the postgres tDBInput component because that's why I'm using dbrow instead of dbinput.

Anyway, big thanks for your help!

 

Best regards

Grzegorz

Anonymous
Not applicable

Hello,

Great it works. Indeed, it is a bit sketchy. I will make a discussion with our manager to see if there is any better solution.

It seems the option "on conflict do something" to be a work item/new feature.

Feel free to raise a jira issue on talend bug tracker about it.

https://jira.talendforge.org/secure/Dashboard.jspa

Best regards

Sabrina