By using AWS re:Post, you agree to the AWS re:Post Terms of Use

SYNTAX_ERROR: line 1:10: Function to_number not registered

0

I am getting the error message in the title box when attempting to run a query. I believe the following line is where the problem is : TO_NUMBER(TO_CHAR(T1."INVOICE_DATE" ,'YYYY')) "c1",

asked 2 years ago334 views
2 Answers
1

TO_NUMBER is not a function that works in Athena.

Rather use cast(value AS type) or try_cast(value AS type). For example try CAST(TO_CHAR(T1."INVOICE_DATE" ,'YYYY') AS int)

Reference: Please refer to Functions in Athena https://docs.aws.amazon.com/athena/latest/ug/presto-functions.html

profile pictureAWS
answered 2 years ago
0

SELECT cast(TO_CHAR(T1."INVOICE_DATE" ,'YYYY')) "c1",

Error line 1:49: mismatched input ')'. Expecting: <expression>

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions