ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error: expected something between '(' and the 'SELECT' keyword. Erro

Database

ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error: expected something between '(' and the 'SELECT' keyword. Erro

HI,
i am new to teradata. But I have some exp in writting teh sqll quries.
please find my query

SELECT call_origtg_no AS numero_chaimante,
(SELECT COUNT (call_dur)
FROM v_wbc_webcare_mvno vw
WHERE call_dur_units = 'second'
AND vw.call_origtg_no = vw.call_origtg_no) AS numero_chimate,
(SELECT SUM (call_dur)
FROM v_wbc_webcare_mvno vw
WHERE vw.call_origtg_no = vw.call_origtg_no
AND call_dur_units = 'second') AS durata_totale,
(SELECT SUM (call_dur)
FROM v_wbc_webcare_mvno vw
WHERE vw.call_origtg_no = vw.call_origtg_no
AND call_dur_units = 'bytes') AS volume_traffico_dati,
(SELECT SUM (call_dur)
FROM v_wbc_webcare_mvno vw
WHERE vw.call_origtg_no = vw.call_origtg_no
AND call_dur_units = 'event') AS numero_sms
FROM v_wbc_webcare_mvno vw
WHERE vw.party_orignl_cd = '00001045'

I am getting the following error. I don't where exactly it going wrong.
ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error:
expected something between '(' and the 'SELECT' keyword.
Error
Code: 3706

regards
~vijay
4 REPLIES
Senior Apprentice

Re: ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error: expected something between '(' and the 'SELECT' keyword. Erro

Hi Vijay,
Teradata doesn't support Scalar Subqueries in the select list before TD13.
In most cases they have a bad performance and can easily replaced with an outer join.

Your query doesn't need a join at all:

SELECT
call_origtg_no AS numero_chaimante
,COUNT (CASE WHEN call_dur_units = 'second' THEN call_dur END) AS numero_chimate
,SUM (CASE WHEN call_dur_units = 'second' THEN call_dur END) AS durata_totale
,SUM (CASE WHEN call_dur_units = 'bytes' THEN call_dur END) AS volume_traffico_dati
,SUM (CASE WHEN call_dur_units = 'event' THEN call_dur END) AS numero_sms
FROM v_wbc_webcare_mvno
WHERE party_orignl_cd = '00001045'
GROUP BY 1

btw, you should update your JDBC driver, 3.01 is at least 5 years old

Dieter

Re: ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error: expected something between '(' and the 'SELECT' keyword. Erro

thank you for the help. It is great help. I need to write 3 more report queries. I will try first. if not I need your help if u don't mind
regards
~vijay

Re: ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error: expected something between '(' and the 'SELECT' keyword. Erro

hi,
I need one more help. I have written the

select * from view where mobile_no like '%3939%'. I just want to select all the rows whose mobile number has 3939 pattern. please help me on this?

regards
~vijay

Re: ERROR: [NCR] [Teradata DBMS] [TeraJDBC 03.01.00.103] Syntax error: expected something between '(' and the 'SELECT' keyword. Erro

HI,
I have got the solution the problem is i Have renaming the column name. I need to write the codition on the renamed column such as

select col1 as COL1 from view where COL1 like '%3939%' instead of col1 like '%3939%'
regards
~vijay