Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
Why is that so?
Regards
Grzegorz
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
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
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