Добро пожаловать в форум, Guest  >>   Войти | Регистрация | Поиск | Правила | В избранное | Подписаться
Все форумы / Oracle Новый топик    Ответить
 Оптимизация SQL  [new]
MLisa
Member

Откуда:
Сообщений: 1
Подскажите пожалуйста, как можно оптимизировать такой Statement? Можно ли его как-то переделать в Table Function?


SELECT a.name NAME, a.ORG_UNIT ORG_UNIT, to_char(a.f_day,'Dy DD.Mon.YY') FIRST_DAY, nvl(absence_calendar([SYS.USER_ID],a.f_day),decode(a.d01,0,'RED','GREEN')) D01, nvl(absence_calendar([SYS.USER_ID],a.f_day+1),decode(a.d02,0,'RED','GREEN')) D02, nvl(absence_calendar([SYS.USER_ID],a.f_day+2),decode(a.d03,0,'RED','GREEN')) D03, nvl(absence_calendar([SYS.USER_ID],a.f_day+3),decode(a.d04,0,'RED','GREEN')) D04, nvl(absence_calendar([SYS.USER_ID],a.f_day+4),decode(a.d05,0,'RED','GREEN')) D05, nvl(absence_calendar([SYS.USER_ID],a.f_day+5),decode(a.d06,0,'RED','GREEN')) D06, nvl(absence_calendar([SYS.USER_ID],a.f_day+6),decode(a.d07,0,'RED','GREEN')) D07, nvl(absence_calendar([SYS.USER_ID],a.f_day+7),decode(a.d08,0,'RED','GREEN')) D08, nvl(absence_calendar([SYS.USER_ID],a.f_day+8),decode(a.d09,0,'RED','GREEN')) D09, nvl(absence_calendar([SYS.USER_ID],a.f_day+9),decode(a.d10,0,'RED','GREEN')) D10, nvl(absence_calendar([SYS.USER_ID],a.f_day+10),decode(a.d11,0,'RED','GREEN')) D11, nvl(absence_calendar([SYS.USER_ID],a.f_day+11),decode(a.d12,0,'RED','GREEN')) D12, nvl(absence_calendar([SYS.USER_ID],a.f_day+12),decode(a.d13,0,'RED','GREEN')) D13, nvl(absence_calendar([SYS.USER_ID],a.f_day+13),decode(a.d14,0,'RED','GREEN')) D14, nvl(absence_calendar([SYS.USER_ID],a.f_day+14),decode(a.d15,0,'RED','GREEN')) D15, nvl(absence_calendar([SYS.USER_ID],a.f_day+15),decode(a.d16,0,'RED','GREEN')) D16, nvl(absence_calendar([SYS.USER_ID],a.f_day+16),decode(a.d17,0,'RED','GREEN')) D17, nvl(absence_calendar([SYS.USER_ID],a.f_day+17),decode(a.d18,0,'RED','GREEN')) D18, nvl(absence_calendar([SYS.USER_ID],a.f_day+18),decode(a.d19,0,'RED','GREEN')) D19, nvl(absence_calendar([SYS.USER_ID],a.f_day+19),decode(a.d20,0,'RED','GREEN')) D20, nvl(absence_calendar([SYS.USER_ID],a.f_day+20),decode(a.d21,0,'RED','GREEN')) D21, nvl(absence_calendar([SYS.USER_ID],a.f_day+21),decode(a.d22,0,'RED','GREEN')) D22, nvl(absence_calendar([SYS.USER_ID],a.f_day+22),decode(a.d23,0,'RED','GREEN')) D23, nvl(absence_calendar([SYS.USER_ID],a.f_day+23),decode(a.d25,0,'RED','GREEN')) D24, nvl(absence_calendar([SYS.USER_ID],a.f_day+24),decode(a.d25,0,'RED','GREEN')) D25, nvl(absence_calendar([SYS.USER_ID],a.f_day+25),decode(a.d26,0,'RED','GREEN')) D26, nvl(absence_calendar([SYS.USER_ID],a.f_day+26),decode(a.d27,0,'RED','GREEN')) D27, nvl(absence_calendar([SYS.USER_ID],a.f_day+27),decode(a.d28,0,'RED','GREEN')) D28, decode(to_char(a.f_day+28,'MM'),to_char(a.f_day,'MM'),decode(to_char(a.f_day+28,'d'),7,'BLANK',decode(to_char(a.f_day+28,'d'),1,'BLANK',nvl(absence_calendar([SYS.USER_ID],a.f_day+28),decode(a.d29,0,'RED','GREEN')))),'BLANK') D29, decode(to_char(a.f_day+29,'MM'),to_char(a.f_day,'MM'),decode(to_char(a.f_day+29,'d'),7,'BLANK',decode(to_char(a.f_day+29,'d'),1,'BLANK',nvl(absence_calendar([SYS.USER_ID],a.f_day+29),decode(a.d30,0,'RED','GREEN')))),'BLANK') D30, decode(to_char(a.f_day+30,'MM'),to_char(a.f_day,'MM'),decode(to_char(a.f_day+30,'d'),7,'BLANK',decode(to_char(a.f_day+30,'d'),1,'BLANK',nvl(absence_calendar([SYS.USER_ID],a.f_day+30),decode(a.d31,0,'RED','GREEN')))),'BLANK') D31, to_char(a.f_day,'Day') DD01, to_char(a.f_day+1,'Day') DD02, to_char(a.f_day+2,'Day') DD03, to_char(a.f_day+3,'Day') DD04, to_char(a.f_day+4,'Day') DD05, to_char(a.f_day+5,'Day') DD06, to_char(a.f_day+6,'Day') DD07, to_char(a.f_day+7,'Day') DD08, to_char(a.f_day+8,'Day') DD09, to_char(a.f_day+9,'Day') DD10, to_char(a.f_day+10,'Day') DD11, to_char(a.f_day+11,'Day') DD12, to_char(a.f_day+12,'Day') DD13, to_char(a.f_day+13,'Day') DD14, to_char(a.f_day+14,'Day') DD15, to_char(a.f_day+15,'Day') DD16, to_char(a.f_day+16,'Day') DD17, to_char(a.f_day+17,'Day') DD18, to_char(a.f_day+18,'Day') DD19, to_char(a.f_day+19,'Day') DD20, to_char(a.f_day+20,'Day') DD21, to_char(a.f_day+21,'Day') DD22, to_char(a.f_day+22,'Day') DD23, to_char(a.f_day+23,'Day') DD24, to_char(a.f_day+24,'Day') DD25, to_char(a.f_day+25,'Day') DD26, to_char(a.f_day+26,'Day') DD27, to_char(a.f_day+27,'Day') DD28, to_char(a.f_day+28,'Day') DD29, to_char(a.f_day+29,'Day') DD30, to_char(a.f_day+30,'Day') DD31
from
(SELECT
u.user_id ID,
u.full_name NAME,
org.org_unit_name ORG_UNIT,
min(calendar_day) f_day,
sum(decode(to_char( calendar_day,'DD'),'01', c.workload_capacity,0)) D01,
sum(decode(to_char( calendar_day,'DD'),'02', c.workload_capacity,0)) D02,
sum(decode(to_char( calendar_day,'DD'),'03', c.workload_capacity,0)) D03,
sum(decode(to_char( calendar_day,'DD'),'04', c.workload_capacity,0)) D04,
sum(decode(to_char( calendar_day,'DD'),'05', c.workload_capacity,0)) D05,
sum(decode(to_char( calendar_day,'DD'),'06', c.workload_capacity,0)) D06,
sum(decode(to_char( calendar_day,'DD'),'07', c.workload_capacity,0)) D07,
sum(decode(to_char( calendar_day,'DD'),'08', c.workload_capacity,0)) D08,
sum(decode(to_char( calendar_day,'DD'),'09', c.workload_capacity,0)) D09,
sum(decode(to_char( calendar_day,'DD'),'10', c.workload_capacity,0)) D10,
sum(decode(to_char( calendar_day,'DD'),'11', c.workload_capacity,0)) D11,
sum(decode(to_char( calendar_day,'DD'),'12', c.workload_capacity,0)) D12,
sum(decode(to_char( calendar_day,'DD'),'13', c.workload_capacity,0)) D13,
sum(decode(to_char( calendar_day,'DD'),'14', c.workload_capacity,0)) D14,
sum(decode(to_char( calendar_day,'DD'),'15', c.workload_capacity,0)) D15,
sum(decode(to_char( calendar_day,'DD'),'16', c.workload_capacity,0)) D16,
sum(decode(to_char( calendar_day,'DD'),'17', c.workload_capacity,0)) D17,
sum(decode(to_char( calendar_day,'DD'),'18', c.workload_capacity,0)) D18,
sum(decode(to_char( calendar_day,'DD'),'19', c.workload_capacity,0)) D19,
sum(decode(to_char( calendar_day,'DD'),'20', c.workload_capacity,0)) D20,
sum(decode(to_char( calendar_day,'DD'),'21', c.workload_capacity,0)) D21,
sum(decode(to_char( calendar_day,'DD'),'22', c.workload_capacity,0)) D22,
sum(decode(to_char( calendar_day,'DD'),'23', c.workload_capacity,0)) D23,
sum(decode(to_char( calendar_day,'DD'),'24', c.workload_capacity,0)) D24,
sum(decode(to_char( calendar_day,'DD'),'25', c.workload_capacity,0)) D25,
sum(decode(to_char( calendar_day,'DD'),'26', c.workload_capacity,0)) D26,
sum(decode(to_char( calendar_day,'DD'),'27', c.workload_capacity,0)) D27,
sum(decode(to_char( calendar_day,'DD'),'28', c.workload_capacity,0)) D28,
sum(decode(to_char( calendar_day,'DD'),'29', c.workload_capacity,0)) D29,
sum(decode(to_char( calendar_day,'DD'),'30', c.workload_capacity,0)) D30,
sum(decode(to_char( calendar_day,'DD'),'31', c.workload_capacity,0)) D31
FROM
krsc_resource_capacity_v c,
knta_users u,
krsc_org_unit_members ogm,
krsc_org_units org
WHERE
c.user_id=u.user_id
and c.user_id in ogm.user_id
and org.org_unit_id = ogm.org_unit_id
and calendar_day >= to_date(decode(length('[P.TPS_WC_YEAR]'),15,to_char(current_date,'YYYY'),'[P.TPS_WC_YEAR]')||'-'||decode(length('[P.TPS_WC_MONTH]'),16,to_char(current_date,'MM'),'[P.TPS_WC_MONTH]')||'-01 00:00:00','YYYY-MM-DD HH24:MI:SS')
and calendar_day <= last_day(to_date(decode(length('[P.TPS_WC_YEAR]'),15,to_char(current_date,'YYYY'),'[P.TPS_WC_YEAR]')||'-'||decode(length('[P.TPS_WC_MONTH]'),16,to_char(current_date,'MM'),'[P.TPS_WC_MONTH]')||'-01 00:00:00','YYYY-MM-DD HH24:MI:SS'))
and (org.parent_org_unit_id = nvl(absence_portlet([SYS.USER_ID]),'') or org.org_unit_id = nvl(absence_portlet([SYS.USER_ID]),'') or org.parent_org_unit_id in (select org_unit_id from krsc_org_units where parent_org_unit_id = nvl(absence_portlet([SYS.USER_ID]),'')))
´
group by

u.user_id, u.full_name, to_char(calendar_day,'YYYYMM'),org.org_unit_name
order by org.org_unit_name,u.full_name) a
4 дек 07, 13:59    [5000902]     Ответить | Цитировать Сообщить модератору
 Re: Оптимизация SQL  [new]
Elic
Member

Откуда:
Сообщений: 29991
MLisa
Можно ли его как-то переделать?
Сперва его придётся перевести на понятный Oracle-у язык
4 дек 07, 14:05    [5000955]     Ответить | Цитировать Сообщить модератору
 Re: Оптимизация SQL  [new]
sendal
Guest
А работающий вариант "Живого" запроса можно привести ? Желательно с планом, который у Вас получается ...
4 дек 07, 14:39    [5001178]     Ответить | Цитировать Сообщить модератору
 Re: Оптимизация SQL  [new]
Форматтер
Guest
Форматируйте запросы! Например, встроенным в PLSQL Developer форматтером

SELECT a.name NAME,
       a.ORG_UNIT ORG_UNIT,
       to_char(a.f_day, 'Dy DD.Mon.YY') FIRST_DAY,
       nvl(absence_calendar(SYS.USER_ID, a.f_day),
           decode(a.d01, 0, 'RED', 'GREEN')) D01,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 1),
           decode(a.d02, 0, 'RED', 'GREEN')) D02,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 2),
           decode(a.d03, 0, 'RED', 'GREEN')) D03,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 3),
           decode(a.d04, 0, 'RED', 'GREEN')) D04,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 4),
           decode(a.d05, 0, 'RED', 'GREEN')) D05,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 5),
           decode(a.d06, 0, 'RED', 'GREEN')) D06,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 6),
           decode(a.d07, 0, 'RED', 'GREEN')) D07,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 7),
           decode(a.d08, 0, 'RED', 'GREEN')) D08,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 8),
           decode(a.d09, 0, 'RED', 'GREEN')) D09,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 9),
           decode(a.d10, 0, 'RED', 'GREEN')) D10,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 10),
           decode(a.d11, 0, 'RED', 'GREEN')) D11,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 11),
           decode(a.d12, 0, 'RED', 'GREEN')) D12,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 12),
           decode(a.d13, 0, 'RED', 'GREEN')) D13,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 13),
           decode(a.d14, 0, 'RED', 'GREEN')) D14,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 14),
           decode(a.d15, 0, 'RED', 'GREEN')) D15,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 15),
           decode(a.d16, 0, 'RED', 'GREEN')) D16,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 16),
           decode(a.d17, 0, 'RED', 'GREEN')) D17,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 17),
           decode(a.d18, 0, 'RED', 'GREEN')) D18,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 18),
           decode(a.d19, 0, 'RED', 'GREEN')) D19,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 19),
           decode(a.d20, 0, 'RED', 'GREEN')) D20,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 20),
           decode(a.d21, 0, 'RED', 'GREEN')) D21,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 21),
           decode(a.d22, 0, 'RED', 'GREEN')) D22,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 22),
           decode(a.d23, 0, 'RED', 'GREEN')) D23,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 23),
           decode(a.d25, 0, 'RED', 'GREEN')) D24,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 24),
           decode(a.d25, 0, 'RED', 'GREEN')) D25,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 25),
           decode(a.d26, 0, 'RED', 'GREEN')) D26,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 26),
           decode(a.d27, 0, 'RED', 'GREEN')) D27,
       nvl(absence_calendar(SYS.USER_ID, a.f_day + 27),
           decode(a.d28, 0, 'RED', 'GREEN')) D28,
       decode(to_char(a.f_day + 28, 'MM'),
              to_char(a.f_day, 'MM'),
              decode(to_char(a.f_day + 28, 'd'),
                     7,
                     'BLANK',
                     decode(to_char(a.f_day + 28, 'd'),
                            1,
                            'BLANK',
                            nvl(absence_calendar(SYS.USER_ID, a.f_day + 28),
                                decode(a.d29, 0, 'RED', 'GREEN')))),
              'BLANK') D29,
       decode(to_char(a.f_day + 29, 'MM'),
              to_char(a.f_day, 'MM'),
              decode(to_char(a.f_day + 29, 'd'),
                     7,
                     'BLANK',
                     decode(to_char(a.f_day + 29, 'd'),
                            1,
                            'BLANK',
                            nvl(absence_calendar(SYS.USER_ID, a.f_day + 29),
                                decode(a.d30, 0, 'RED', 'GREEN')))),
              'BLANK') D30,
       decode(to_char(a.f_day + 30, 'MM'),
              to_char(a.f_day, 'MM'),
              decode(to_char(a.f_day + 30, 'd'),
                     7,
                     'BLANK',
                     decode(to_char(a.f_day + 30, 'd'),
                            1,
                            'BLANK',
                            nvl(absence_calendar(SYS.USER_ID, a.f_day + 30),
                                decode(a.d31, 0, 'RED', 'GREEN')))),
              'BLANK') D31,
       to_char(a.f_day, 'Day') DD01,
       to_char(a.f_day + 1, 'Day') DD02,
       to_char(a.f_day + 2, 'Day') DD03,
       to_char(a.f_day + 3, 'Day') DD04,
       to_char(a.f_day + 4, 'Day') DD05,
       to_char(a.f_day + 5, 'Day') DD06,
       to_char(a.f_day + 6, 'Day') DD07,
       to_char(a.f_day + 7, 'Day') DD08,
       to_char(a.f_day + 8, 'Day') DD09,
       to_char(a.f_day + 9, 'Day') DD10,
       to_char(a.f_day + 10, 'Day') DD11,
       to_char(a.f_day + 11, 'Day') DD12,
       to_char(a.f_day + 12, 'Day') DD13,
       to_char(a.f_day + 13, 'Day') DD14,
       to_char(a.f_day + 14, 'Day') DD15,
       to_char(a.f_day + 15, 'Day') DD16,
       to_char(a.f_day + 16, 'Day') DD17,
       to_char(a.f_day + 17, 'Day') DD18,
       to_char(a.f_day + 18, 'Day') DD19,
       to_char(a.f_day + 19, 'Day') DD20,
       to_char(a.f_day + 20, 'Day') DD21,
       to_char(a.f_day + 21, 'Day') DD22,
       to_char(a.f_day + 22, 'Day') DD23,
       to_char(a.f_day + 23, 'Day') DD24,
       to_char(a.f_day + 24, 'Day') DD25,
       to_char(a.f_day + 25, 'Day') DD26,
       to_char(a.f_day + 26, 'Day') DD27,
       to_char(a.f_day + 27, 'Day') DD28,
       to_char(a.f_day + 28, 'Day') DD29,
       to_char(a.f_day + 29, 'Day') DD30,
       to_char(a.f_day + 30, 'Day') DD31
from   (SELECT u.user_id ID,
               u.full_name NAME,
               org.org_unit_name ORG_UNIT,
               min(calendar_day) f_day,
               sum(decode(to_char(calendar_day, 'DD'),
                          '01',
                          c.workload_capacity,
                          0)) D01,
               sum(decode(to_char(calendar_day, 'DD'),
                          '02',
                          c.workload_capacity,
                          0)) D02,
               sum(decode(to_char(calendar_day, 'DD'),
                          '03',
                          c.workload_capacity,
                          0)) D03,
               sum(decode(to_char(calendar_day, 'DD'),
                          '04',
                          c.workload_capacity,
                          0)) D04,
               sum(decode(to_char(calendar_day, 'DD'),
                          '05',
                          c.workload_capacity,
                          0)) D05,
               sum(decode(to_char(calendar_day, 'DD'),
                          '06',
                          c.workload_capacity,
                          0)) D06,
               sum(decode(to_char(calendar_day, 'DD'),
                          '07',
                          c.workload_capacity,
                          0)) D07,
               sum(decode(to_char(calendar_day, 'DD'),
                          '08',
                          c.workload_capacity,
                          0)) D08,
               sum(decode(to_char(calendar_day, 'DD'),
                          '09',
                          c.workload_capacity,
                          0)) D09,
               sum(decode(to_char(calendar_day, 'DD'),
                          '10',
                          c.workload_capacity,
                          0)) D10,
               sum(decode(to_char(calendar_day, 'DD'),
                          '11',
                          c.workload_capacity,
                          0)) D11,
               sum(decode(to_char(calendar_day, 'DD'),
                          '12',
                          c.workload_capacity,
                          0)) D12,
               sum(decode(to_char(calendar_day, 'DD'),
                          '13',
                          c.workload_capacity,
                          0)) D13,
               sum(decode(to_char(calendar_day, 'DD'),
                          '14',
                          c.workload_capacity,
                          0)) D14,
               sum(decode(to_char(calendar_day, 'DD'),
                          '15',
                          c.workload_capacity,
                          0)) D15,
               sum(decode(to_char(calendar_day, 'DD'),
                          '16',
                          c.workload_capacity,
                          0)) D16,
               sum(decode(to_char(calendar_day, 'DD'),
                          '17',
                          c.workload_capacity,
                          0)) D17,
               sum(decode(to_char(calendar_day, 'DD'),
                          '18',
                          c.workload_capacity,
                          0)) D18,
               sum(decode(to_char(calendar_day, 'DD'),
                          '19',
                          c.workload_capacity,
                          0)) D19,
               sum(decode(to_char(calendar_day, 'DD'),
                          '20',
                          c.workload_capacity,
                          0)) D20,
               sum(decode(to_char(calendar_day, 'DD'),
                          '21',
                          c.workload_capacity,
                          0)) D21,
               sum(decode(to_char(calendar_day, 'DD'),
                          '22',
                          c.workload_capacity,
                          0)) D22,
               sum(decode(to_char(calendar_day, 'DD'),
                          '23',
                          c.workload_capacity,
                          0)) D23,
               sum(decode(to_char(calendar_day, 'DD'),
                          '24',
                          c.workload_capacity,
                          0)) D24,
               sum(decode(to_char(calendar_day, 'DD'),
                          '25',
                          c.workload_capacity,
                          0)) D25,
               sum(decode(to_char(calendar_day, 'DD'),
                          '26',
                          c.workload_capacity,
                          0)) D26,
               sum(decode(to_char(calendar_day, 'DD'),
                          '27',
                          c.workload_capacity,
                          0)) D27,
               sum(decode(to_char(calendar_day, 'DD'),
                          '28',
                          c.workload_capacity,
                          0)) D28,
               sum(decode(to_char(calendar_day, 'DD'),
                          '29',
                          c.workload_capacity,
                          0)) D29,
               sum(decode(to_char(calendar_day, 'DD'),
                          '30',
                          c.workload_capacity,
                          0)) D30,
               sum(decode(to_char(calendar_day, 'DD'),
                          '31',
                          c.workload_capacity,
                          0)) D31
        FROM   krsc_resource_capacity_v c,
               knta_users               u,
               krsc_org_unit_members    ogm,
               krsc_org_units           org
        WHERE  c.user_id = u.user_id
               and c.user_id in ogm.user_id
               and org.org_unit_id = ogm.org_unit_id
               and calendar_day >=
               to_date(decode(length('[P.TPS_WC_YEAR]'),
                                  15,
                                  to_char(current_date, 'YYYY'),
                                  '[P.TPS_WC_YEAR]') || '-' ||
                           decode(length('[P.TPS_WC_MONTH]'),
                                  16,
                                  to_char(current_date, 'MM'),
                                  '[P.TPS_WC_MONTH]') || '-01 00:00:00',
                           'YYYY-MM-DD HH24:MI:SS')
               and calendar_day <=
               last_day(to_date(decode(length('[P.TPS_WC_YEAR]'),
                                           15,
                                           to_char(current_date, 'YYYY'),
                                           '[P.TPS_WC_YEAR]') || '-' ||
                                    decode(length('[P.TPS_WC_MONTH]'),
                                           16,
                                           to_char(current_date, 'MM'),
                                           '[P.TPS_WC_MONTH]') || '-01 00:00:00',
                                    'YYYY-MM-DD HH24:MI:SS'))
               and
               (org.parent_org_unit_id = nvl(absence_portlet(SYS.USER_ID), '') or
               org.org_unit_id = nvl(absence_portlet(SYS.USER_ID), '') or
               org.parent_org_unit_id in
               (select org_unit_id
                 from   krsc_org_units
                 where  parent_org_unit_id =
                        nvl(absence_portlet(SYS.USER_ID), ''))) ´
        group  by u.user_id,
                  u.full_name,
                  to_char(calendar_day, 'YYYYMM'),
                  org.org_unit_name
        order  by org.org_unit_name,
                  u.full_name) a
4 дек 07, 20:57    [5003302]     Ответить | Цитировать Сообщить модератору
Все форумы / Oracle Ответить