Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

EOF error when using sql query in Snowflake

I am getting an error here on this Snowflake query and am not sure what is incorrect.
Not quite sure why I would have an issue, so was hoping for some help.

Any ideas?

  SELECT 
      EXTRACT (YEAR FROM t1.DOC_POST_DT) AS sap_post_year,
      t1.FISCL_YR_MO_NBR AS fiscal_year,
      t1.DOC_POST_DT AS post_date,
      t1.DOC_CRTE_DT AS doc_date,
      t1.CRTED_DT as created_date,
      t2.COST_CNTR_WO_ZEROS_CD AS cost_center,
      t2.COST_CNTR_NM cost_center_name,
      t2.COST_ELEM_WO_ZEROS_CD AS cost_element,
      t2.COST_ELEM_NM AS cost_element_name,
      t1.ORD_NBR AS Internal_order,
      t1.ACCTG_DOC_TYP_CD AS doc_type,
      t3.VNDR_NM AS vendor_name,
      t1.t1_LN_ITEM_DSC AS description,
      t1.CRTED_BY_NM AS created_by,
      t1.LCL_CRNCY_DBT_CR_AMT AS amount
  
  
FROM table1 t1
JOIN table2 t2 
    ON (t1.COST_CNTR_CD = t2.COST_CNTR_CD AND t1.t1_ACCT_NBR = t2.COST_ELEM_CD)
    AND (t2.COST_CNTR_WO_ZEROS_CD = '1292081800')
    AND (t2.COST_ELEM_WO_ZEROS_CD = '860379')
    
    
LEFT JOIN table3 t3
    ON (t1.t3NDR_ID = t3.t3NDR_ID)
    
WHERE (t1.FISCL_YR_MO_NBR BETWEEN 2021001 AND to_number(to_char(current_date, 'YYYYMMDD'))
AND (t1.t1_LN_ITEM_DSC LIKE '%TIE%');

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You’re missing a closing parenthesis on your to_number. Should be

(t1.FISCL_YR_MO_NBR BETWEEN 2021001 AND to_number(to_char(current_date, 'YYYYMMDD')))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading