With an oracle unfamiliar, just starting to learn. Here is the query that selects subscribers and bases

SELECT DISTINCT ss_login, ct_mcode, ct_id FROM inac.start_stop, inac.services, inac.cities0, inac.services_param WHERE inac.services.s_f_vpdn = 1 AND inac.services.s_f_ppp = 0 AND inac.start_stop.ss_service = inac.services.s_id AND inac.services.s_city = inac.cities0.ct_id AND ct_mcode = 'RND' AND ss_start <= to_date('01.11.2016', 'DD/MM/YYYY') AND (ss_stop >= to_date('01.10.2016', 'DD/MM/YYYY') or ss_stop is null) 

it is necessary that information about whether the subscriber is convergent or not has got into the sample

connection of inac.start_stop.ss_service = inac.services_param.id_service condition that the subscriber is convergent inac.services_param.param_name = 'BILL_TYPE' and inac.services_param.param_number = 3

I tried it like this

 SELECT DISTINCT ss_login, ct_mcode, ct_id, param_name, param_number CASE WHEN param_name = 'BILL_TYPE' and param_number = 3 THEN 'Да' ELSE 'Нет' end FROM inac.start_stop, inac.services, inac.cities0, inac.services_param WHERE inac.services.s_f_vpdn = 1 AND inac.services.s_f_ppp = 0 AND inac.start_stop.ss_service = inac.services.s_id AND inac.services.s_city = inac.cities0.ct_id AND inac.start_stop.ss_service = inac.services_param.id_service AND ct_mcode = 'RND' AND ss_start <= to_date('01.11.2016', 'DD/MM/YYYY') AND (ss_stop >= to_date('01.10.2016', 'DD/MM/YYYY') or ss_stop is null) 

Error ERROR at line 3: ORA-00923: FROM keyword not found where expected

Closed due to the fact that off-topic party PashaPash 11 Dec '16 at 15:38 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - PashaPash
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    In the first line, after `param_number` put a comma - Mike
  • But I'm not sure that it will give the desired result. If there are such lines in the sample for which for a single login there can be both "yes" and "no", then there will be two lines at the output. But not seeing the whole structure of your tables is impossible to say. - Mike
  • @Mike, thank you kind man, you need to carefully read the examples. - thecoder
  • @thecoder, try using join . With them where more readable requests are obtained, IMHO. - 4per
  • @ 4per, what an example the customer gave such try to try. Than they will be more readable? - thecoder

1 answer 1

It seems Billy missed a comma. It should be in front of CASE, at the end of the first line.