java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000]

General
VJ
Fan

java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000]

Hi,

Trying to execute below piece of query in python:

try:
    curs =conn_teradata.cursor()
    curs.execute('SELECT DATABASE;')
    print("-----------")

    curs.execute('CREATE VOLATILE TABLE ZZMD_SET1,NO FALLBACK, NO LOG (FIS_WK_NBR SMALLINT, FIS_YR_NBR INTEGER,MDSE_PRD_KEY INTEGER,SEAS_YR_KEY INTEGER,WJXBFS1 FLOAT,WJXBFS2 FLOAT,WJXBFS3 FLOAT,WJXBFS4 FLOAT,WJXBFS5 FLOAT,WJXBFS6 FLOAT,WJXBFS7 FLOAT,WJXBFS71 FLOAT,WJXBFS8 FLOAT,WJXBFS9 FLOAT,WJXBFSa FLOAT,WJXBFSb FLOAT,WJXBFSc FLOAT) PRIMARY INDEX (FIS_WK_NBR, FIS_YR_NBR, MDSE_PRD_KEY, SEAS_YR_KEY)ON COMMIT PRESERVE ROWS) by teradata')
    print("-----------")
except Exception as e:
    print(e) 

but getting:

 

java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000] Syntax error: expected something between the 'ROWS' keyword and ')'.


It has been quite sometime trying to figure out the issue but not able to get around. Any help/ suggestion is highly appreciated. Thanks

 

3 REPLIES 3
Teradata Employee

Re: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000]

Why do you have this extra text at the end of the string passed to the execute method? Remove it.

) by teradata

VJ
Fan

Re: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000]

Thank you Fred. At last I had to remove it. But how to keep ") by teradata" and make the query run?

Highlighted
Supporter

Re: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.02] [Error 3706] [SQLState 42000]

Putting two dashes before it makes it a comment; " --) by teradata".

Teradata Frank, Certified Master