change data type

hi every one.
i connect to oracle database with oracle connector node and i select one table with db table selector node but this table dont have any value .
now i wanna insert some value into that table.
i create some data with create table .
but cant insert this value into table .
what i can i do??
how i can change data type of column in data base ???
thanks

Hi @alrz , can you confirm what data type KNIME is setting for the empty column, or is it set to unknown type?

Is it always a specific column that causes this problem or could it be a different column on another occasion?

hi @takbb
i change data type with db sql excecutor node.
but still i cant insert value to table

“insert into “APPQOSSYS”.“testTable”(id , name)values(1 ,“name-sample”);”
this is that query i write for oracle .
where is the problem???

Hi @alrz , I’m going to need more information to be able to help as you haven’t given me a lot to go on at the moment :wink:

You need to tell me

  • what the table and column definitions are on the oracle table
  • what the data types for the columns are in KNIME
  • an actual example of the data you are trying to insert
  • what error message you are getting.
  • an actual example of your insert statement as what you have shown above is syntactically incorrect.

Please post a copy of the insert statement as a screenshot so I can see exactly what it looks like without it being modified by the forum software.

Is your table actually called "testTable" or is it called "TESTTABLE" and are you really writing

"name-sample"

in the values clause when you should be writing

'name-sample'?

Have you also tried it without putting the ; on the end of the statement?

At the moment I can see so many possibilities from for what might be wrong that without more information I don’t know which issues to concentrate on…

bro ! I really don’t know what happened, but it fixed itself :joy:

@takbb
I have another question.


in this photo i wanna drop table with query that i insert in this node
this is my query => DROP TABLE “PLAYER”
but after execute i got error.in console
It’s interesting here that table will remove correctly .
Why does it show an error?
thanks

HI @alrz, ideally questions that are new should be posted as separate questions on the forum, because this puts it out to a wider audience. Also there’s no guarantee that the person answering your initial question is best placed for answering your new question.

In this case though, I’d say you shouldn’t be using a DB Query Reader to drop a table, since DB Query Reader is expecting to get back the result of a query.

I’d suggest (I’m guessing) therefore that what you see happens because the DB Query Reader passes your request to DROP TABLE "PLAYER" to the database, which gets actioned, and when the DB Query Reader then attempts to return the resultant response from the database into a table (as it would do for a SELECT statement), it finds it can’t because the resultant query spec is “null”.

Have you considered the DB SQL Executor node instead, which should be where you would put such DDL statements?

you are right i should posts separate . sorry
yes i do that with DB SQL Executor correctly with out any error .
i am new in knime and still cant understand when i should to use which node .specially when work with data base node .

No problem @alrz, and I’m glad to hear the DB SQL Executor worked for you.

There are a few places with some tips:

The primary KNIME DB extensions documentation is here: KNIME Database Extension Guide

This post may be useful as it mentions DML (e.g. queries) and DDL (the other stuff!) statements

You could also do worse than to read some of @mlauber71 's excellent posts on the subject, such as this article on Medium

I hope that helps, and welcome to KNIME.

2 Likes

thanks a lot @takbb :+1:

1 Like