Have a tricky situation in witch I belive you guys can help me out. I want to use decode in my cursors where-clause. I am using "IN()" but I belive the program thinks the comma belongs to the decode and not as a separator between values.
I think maybe using CASE might solve this, am I right?
CURSOR order_cur (
cur_ao VARCHAR2) IS
SELECT t1.nr, t1.status$nr
FROM eh_order_t@NGEXT_DBLINK t1
WHERE t1.status$nr IN (3, 6)
AND t1.ao IN (DECODE (
cur_ao,
'ALLA', Argus_ehandel_pkg.get_ehorder_ao (
t1.nr),
SUBSTR (cur_ao, 1, 2), SUBSTR (cur_ao, 3, 2)))
CASE variant
CURSOR order_cur (
cur_ao VARCHAR2) IS
SELECT t1.nr, t1.status$nr
FROM eh_order_t@NGEXT_DBLINK t1
WHERE t1.status$nr IN (3, 6)
AND t1.ao IN (CASE
WHEN cur_ao = 'ALLA'
THEN
Argus_ehandel_pkg.get_ehorder_ao (t1.nr)
ELSE
SUBSTR (cur_ao, 1, 2), SUBSTR (cur_ao, 3, 2)
END) -- SUBSTR (cur_ao, 3, 2) END)
--AND t1.nr = DECODE (order_in, NULL, t1.nr, order_in)
ORDER BY t1.skapad_dat ASC;