powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Oracle [игнор отключен] [закрыт для гостей] / Помогите с тестовым
11 сообщений из 11, страница 1 из 1
Помогите с тестовым
    #39476009
pronect
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Понимаю, что для опытных людей вопрос покажется наглым и не уместным. Есть тестовое задание для практики, в котором нужно найти "грамматические" ошибки в коде. Всего ошибок 8.
Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
select name_r 'Имя', rtpl_id rtpl, 
  count(distinct case when             s<153  then subs_id else null end) x153,
  count(distinct case when 153<=s  and s<306  then subs_id else null end) x306,
  count(distinct case when 305<=s  and s<459  then subs_id else null end) x459,
  count(distinct case when 459<=s  and s<612  then subs_id else null end) x612,
  count(distinct case when 612<=s  and s<765  then subs_id else null end) x765,
  count(distinct case when 765<=s  and s<918  then subs_id else null end) x918,
  count(distinct case when 918<=s  and s<1071 then subs_id else null end) x1071,
  count(distinct case when 1071<=s and s<1224 then subs_id else null end) x1224,
  count(distinct case when 1224<=s and s<1377 then subs_id else null end) x1377,
  count(distinct case when 1377<=s and s<1530 then subs_id else null end) x1530,
  count(distinct case when 1530<=s and s<2294 then subs_id else null end) x2294,
  count(distinct case when 2294<=s and s<3059 then subs_id else null end) x3059
  count(distinct case when 3059<=s            then subs_id else null end) y3059
from (
select s.subs_id, 
       case when nvl(c.subs_count,0)<>0 then amount_r/c.subs_count else 0 end "s",
       x.name_r, x.rtpl_id
 from r_20070730 r, agg.client_d c agg.subs_d s, (select * from bis.rate_plans x where x.end_date='31.12.2999') x where c.d='01/07/2007'
  and s.d=to_date('01.07.2007','dd.mm.yyyy')
  and c.client_id=r.clnt_clnt_id
  and s.client_id=c.client_id
--  and s.status_bu in (4,6)
  and s.sbst_id = 2 and s.status_bu = 4
  and s.rtpl_id=x.rtpl_id
  and x.rtpl_id not in [0,169]
)
group by name_r, rtpl_id rtpl
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476023
MaximaXXL
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
pronect,

ну я 8 нашел, не врут наверно =)
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476036
Фотография env
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
MaximaXXL,

С какими допущениями относительно типов данных и названий полей в исходных объектах запроса?

От 7 и больше.
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476043
Фотография AmKad
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В куске кода, где считаются count-ы, не хватает строки типа
Код: plsql
1.
count(distinct case when 4000<=s            then subs_id else null end) й4000
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476055
MaximaXXL
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
AmKad,

чтоб добавить ошибок?
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476059
Dshedoo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
MaximaXXL,

Я нашёл только 5, без исправления которых, селект при любых форматах данных не отработает.

Где же остальные 3?
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476061
trace.log
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
цветом выделяйте ошибки
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476066
georgy_g
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Нужно просто найти и пойти пить чай или назвать их в теме? )
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476081
Фотография andrey_anonymous
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Если очень бегло:
pronect
Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
select name_r 'Имя', rtpl_id rtpl, 
  count(distinct case when            s<153  then subs_id else null end) x153,
  count(distinct case when 153<=s  and s<306  then subs_id else null end) x306,
  count(distinct case when 305<=s  and s<459  then subs_id else null end) x459,
  count(distinct case when 459<=s  and s<612  then subs_id else null end) x612,
  count(distinct case when 612<=s  and s<765  then subs_id else null end) x765,
  count(distinct case when 765<=s  and s<918  then subs_id else null end) x918,
  count(distinct case when 918<=s  and s<1071 then subs_id else null end) x1071,
  count(distinct case when 1071<=s and s<1224 then subs_id else null end) x1224,
  count(distinct case when 1224<=s and s<1377 then subs_id else null end) x1377,
  count(distinct case when 1377<=s and s<1530 then subs_id else null end) x1530,
  count(distinct case when 1530<=s and s<2294 then subs_id else null end) x2294,
  count(distinct case when 2294<=s and s<3059 then subs_id else null end) x3059 
  count(distinct case when 3059<=s            then subs_id else null end) y3059
from (
select s.subs_id, 
       case when nvl(c.subs_count,0)<>0 then  amount_r/c.subs_count else 0 end "s",
       x.name_r, x.rtpl_id
 from r_20070730 r, agg.client_d c agg.subs_d s, (select * from bis.rate_plans x where x.end_date='31.12.2999') x where c.d='01/07/2007'
  and s.d=to_date('01.07.2007','dd.mm.yyyy')
  and c.client_id=r.clnt_clnt_id
  and s.client_id=c.client_id
--  and s.status_bu in (4,6)
  and s.sbst_id = 2 and s.status_bu = 4
  and s.rtpl_id=x.rtpl_id
  and x.rtpl_id not in [0,169]
join-предикат для x?
)
group by name_r, rtpl_id  rtpl
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476098
Dshedoo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
pronectПонимаю, что для опытных людей вопрос покажется наглым и не уместным. Есть тестовое задание для практики, в котором нужно найти "грамматические" ошибки в коде. Всего ошибок 8.
Код: sql
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
select name_r [color=red]'Имя'[/color], rtpl_id rtpl, 
  count(distinct case when             s<153  then subs_id else null end) x153,
  count(distinct case when 153[color=yellow]<=[/color]s  and s<306  then subs_id else null end) x306,
  count(distinct case when [color=yellow]305[/color][color=yellow]<=[/color]s  and s<459  then subs_id else null end) x459,
  count(distinct case when 459[color=yellow]<=[/color]s  and s<612  then subs_id else null end) x612,
  count(distinct case when 612[color=yellow]<=[/color]s  and s<765  then subs_id else null end) x765,
  count(distinct case when 765[color=yellow]<=[/color]s  and s<918  then subs_id else null end) x918,
  count(distinct case when 918[color=yellow]<=[/color]s  and s<1071 then subs_id else null end) x1071,
  count(distinct case when 1071[color=yellow]<=[/color]s and s<1224 then subs_id else null end) x1224,
  count(distinct case when 1224[color=yellow]<=[/color]s and s<1377 then subs_id else null end) x1377,
  count(distinct case when 1377[color=yellow]<=[/color]s and s<1530 then subs_id else null end) x1530,
  count(distinct case when 1530[color=yellow]<=[/color]s and s<2294 then subs_id else null end) x2294,
  count(distinct case when 2294[color=yellow]<=[/color]s and s<3059 then subs_id else null end) x3059[color=red] [/color]
  count(distinct case when 3059[color=yellow]<=[/color]s            then subs_id else null end) y3059
from (
select s.subs_id, 
       case when nvl(c.subs_count,0)<>0 then [color=yellow] [/color]amount_r/c.subs_count else 0 end [color=yellow]"s"[/color] ,
       x.name_r, x.rtpl_id
 from r_20070730 r, agg.client_d c[color=red] [/color]agg.subs_d s, (select * from bis.rate_plans x where x.end_date=[color=yellow]'31.12.2999'[/color]) x where c.d=[color=yellow]'01/07/2007'[/color]
  and s.d=[color=yellow]to_date('01.07.2007','dd.mm.yyyy')[/color]
  and c.client_id=r.clnt_clnt_id
  and s.client_id=c.client_id
--  and s.status_bu in (4,6)
  and s.sbst_id = 2 and s.status_bu = 4
  and s.rtpl_id=x.rtpl_id
  and x.rtpl_id not in [color=red][0,169][/color]
)
group by name_r, rtpl_id[color=red] rtpl[/color]


Красным - ошибки
Жёлтым - возможные ошибки.
...
Рейтинг: 0 / 0
Помогите с тестовым
    #39476105
Dshedoo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Dshedoo,

P.S. версия для дальтоников и ЧБ мониторов.
...
Рейтинг: 0 / 0
11 сообщений из 11, страница 1 из 1
Форумы / Oracle [игнор отключен] [закрыт для гостей] / Помогите с тестовым
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]