Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to use Talend Keyword in select Query

Hello All, 

Hope you are doing good,

 

I have been facing some problem while querying my table from tDBInput component,

Actually my table has the Column name as "DATETIME"  when i try to query (Select DATETIME from tablename) the table, i was getting the error like java.sql.SQLSyntaxErrorException: ORA-00936: missing expression. Is there any possibilities to escape the/use talend keyword in query?  

 

 

"SELECT
"+context.DB_Schema+".MYTABLE.\"DATETIME \"
FROM "+context.DB_Schema+".MYTABLE"

 

then I tried below( this also getting  error) 

 

"SELECT
"+"\"DATETIME\""+" FROM MYTABLE"

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    I agree with TRF. DATETIME is a reserved keyword and ideally we should not use these keywords while creating column names. Please refer the Oracle documentation below. 

 

https://docs.oracle.com/cd/E17952_01/mysql-5.1-en/datetime.html#targetText=The%20supported%20range%2...

 

    The right approach will be to choose another name for your column which will not conflict with keyword settings.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

View solution in original post

5 Replies
TRF
Champion II

I'm afraid that DATETIME is an Oracle SQL reserved word.
Anonymous
Not applicable
Author

Hi,

 

    I agree with TRF. DATETIME is a reserved keyword and ideally we should not use these keywords while creating column names. Please refer the Oracle documentation below. 

 

https://docs.oracle.com/cd/E17952_01/mysql-5.1-en/datetime.html#targetText=The%20supported%20range%2...

 

    The right approach will be to choose another name for your column which will not conflict with keyword settings.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

Thank you,

 

Without changing the column name in the table(Should not change), Need to handle this inside the tDbInput component. Can anybody help on this.

Anonymous
Not applicable
Author

Hi Vignesh,

 

     Its an Oracle DB error. Could you please check whether the query is working from SQL Prompt or Oracle SQL Assistant?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

yes the query is perfectly working sql prompt.

 

Select DATETIME from tablename;

 

listing the result correctly.