Mistři v programování na #hovnokod

K německým kolegům zřejmě ještě nedorazila vymoženost funkce COALESCE

          CASE 
           WHEN NULLIF([Packing Material], 'Not assigned') IS NULL
             OR [Packing Material] = '' 
            THEN
             CASE 
              WHEN NULLIF (Material, 'Not assigned') IS NULL
                OR Material = '' 
               THEN
                CASE 
                 WHEN NULLIF ([Reporting Brand], 'Not assigned') IS NULL 
                   OR [Reporting Brand] = '' 
                  THEN '#' 
                 ELSE [Reporting Brand] + '_#' 
                END 
               ELSE Material 
              END 
             ELSE [Packing Material] 
            END AS BRANDS, 

Anonymous,

Zeby nova syntax Oraclu, o ktorej este neviem? Ale kdeze... ved naco by clovek pouzil LISTAGG, ked moze vytvorit svoju vlastnu funkciu, navyse s takym krasnym nazvom!

select join(
cursor(
select xxx 
FROM yyy, zzz  
WHERE ...
),',')
from dual;


function join
(
    p_cursor sys_refcursor,
    p_del varchar2 := ','
) return varchar2
is
    l_value   varchar2(32767);
    l_result  varchar2(32767);
begin
    loop
        fetch p_cursor into l_value;
        exit when p_cursor%notfound;
        if l_result is not null then
            l_result := l_result || p_del;
        end if;
        l_result := l_result || l_value;
    end loop;
    return l_result;
end join;

Anonymous,

s kolegom sme riesili pocty zaznamov v tabulke, ale bolo tam par duplikatnych zaznamov, tak sme ich potrebovali vyfiltrovat, ja som to robil pomocou jedneho stlpcu, ktory indikoval duplicitu, on to robil pomocou distinct, co by tiez malo stacit, tak som sa ho opytal, nech mi posle jeho query, no a ked som to videl, tak som vsetko pochopil

select distinct count(*) from fcm_sync.cmd_cas_number;

Anonymous,

celé zle (PP)

SELECT      (
                SELECT      TO_CHAR(HeadersID) HeadersID 
                FROM        datapt_eng_vw a
                WHERE       a.datapoint_id = b.COLUMN_VALUE
            ) headerId,
            (
                SELECT      TO_CHAR(DATAPT_TIMESTAMP, 'MM/DD/YY HH:MI:SS.ff3 AM') 
                FROM        datapt_eng_vw a
                WHERE       a.datapoint_id = b.column_value
            ) tdateForOrder, 
            (
                SELECT      DATAPT_TIMESTAMP
                FROM        datapt_eng_vw a
                WHERE       a.datapoint_id = b.column_value
            ) DATAPT_TIMESTAMP
FROM        TABLE(CAST (PKG_TDS_ENG.GET_SESSION_DATAPOINTS() AS TBL_DATAPOINT_SKEY)) b 
ORDER BY    DATAPT_TIMESTAMP desc;

Anonymous,

Kdyz uz mi posilate SELECT dotaz, tak pokud mozno funkcni... Pro Ty, co nenasli hned chybu, tak si zvetste pismo nebo pouzijte lupu.

select * from objednavky
where cislo_objednavky = '12345678’;

Anonymous,