CASE..WHEN &a THEN decode(instr(colA,'-') 1,colA,......
Using CASE within a function I wish to apply a second level of criteria within the CASE statement, something along the lines of the following:
CASE upper(option_in)
WHEN 'P' THEN decode(instr(value_in,'-')>1,value_in,plan_b)
WHEN ...
Looks nifty but doesn't work. Any suggestions would be appreciated.
Thanks,
Dan
Why are you switching to DECODE? Just use CASE again:
case upper(option_in)
when 'P' then case
when instr(value_in, '-') > 1 then value_in
else plan_b
end
when ...
Similar Messages
-
Using case when statement or decode stament in where clause
hi gems..
i have a problem in the following query..
i am trying to use case when statement in the where clause of a select query.
select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
cr.salary as salary
from customer_details cr
where (case when '>' = '>' then 'cr.salary > 5000'
when '>' = '<' then 'cr.salary < 5000'
when '>' = '=' then 'cr.salary = 5000'
else null
end);
the expression in the when clause of the case-when statement will come from UI and depending on the choice i need to make the where clause.
thats why for running the query, i have put '>' in that place.
so the original query will look like this(for your reference):
select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
cr.salary as salary
from customer_details cr
where (case when variable = '>' then 'cr.salary > 5000'
when variable = '<' then 'cr.salary < 5000'
when variable = '=' then 'cr.salary = 5000'
else null
end);
so, in actual case,if the user selects '>' then the filter will be "where cr.salary > 5000"
if the user selects '<' then the filter will be "where cr.salary < 5000"
if the user selects '=' then the filter will be "where cr.salary = 5000"
but i am getting the error "ORA 00920:invalid relational operator"
please help..thanks in advance..Hi,
select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
cr.salary as salary
from customer_details cr
where ( v_variable = 'bigger'
and cr.salary > 5000
or ( v_variable = 'less'
and cr.salary < 5000
or ( v_variable = 'eq'
and cr.salary = 5000
)Edited by: user6806750 on 22.12.2011 14:56
For some reason I can't write in sql '<', '>', '=' -
Hi,
How to convert this decode statements into CASE WHEN syntax
phone_v := DECODE (c_rec.phone, NULL, NULL, DECODE ( is_it_number (c_rec.phone), 'F', DBMS_RANDOM.STRING ('a', LENGTH (c_rec.phone)), SUBSTR (DBMS_RANDOM.VALUE, 2, LENGTH (c_rec.phone))));
thanks, BcjThat should be easiest written like the following :
phone_v := DECODE (c_rec.phone
, NULL, NULL
, DECODE ( is_it_number (c_rec.phone)
, 'F', DBMS_RANDOM.STRING ('a', LENGTH (c_rec.phone))
, SUBSTR (DBMS_RANDOM.VALUE, 2, LENGTH (c_rec.phone))
);Is it ?
Nicolas. -
SELECT v_startdate, v_enddate,
(CASE WHEN SYSDATE BETWEEN v_startdate AND v_enddate THEN
‘active’
ELSE
‘inactive’
END) status
FROM correction_tab;
Could you kindly guide us as to how can we use DECODE and get the desired output.
Thanks,
Rami Reddy.You can, like this.
However, the CASE seems a lot clearer to me so why bother with a DECODE?
sql> with correction_tab as
2 ( select trunc(sysdate)-1 as v_startdate, trunc(sysdate) as v_enddate from dual
3 union all
4 select trunc(sysdate) as v_startdate, trunc(sysdate)+1 as v_enddate from dual
5 union all
6 select trunc(sysdate)+1 as v_startdate, trunc(sysdate)+2 as v_enddate from dual
7 )
8 SELECT v_startdate
9 , v_enddate
10 , CASE
11 WHEN SYSDATE BETWEEN v_startdate AND v_enddate
12 THEN 'active'
13 ELSE 'inactive'
14 END status
15 , decode ( sign(sysdate-v_startdate), 1, decode(sign(v_enddate-sysdate), 1, 'active', 'inactive'), 'inactive')
as status2
16 FROM correction_tab
17 /
V_STARTDA V_ENDDATE STATUS STATUS2
12-DEC-12 13-DEC-12 inactive inactive
13-DEC-12 14-DEC-12 active active
14-DEC-12 15-DEC-12 inactive inactive -
Hi, another case statement question. My set up is calling from dasnboard prompt to publisher with an rtf template. My question is whether my logic/syntax is corrected. Thank you.
and "office"."branch" = ( CASE WHEN :BRANCH = '' THEN "office"."branch" ELSE :BRANCH END)
case when :BRANCH is null THEN 'or' ELSE 'and' END -----> (here I want to be able either or / and in case when edit box with BRANCH parameter is null use OR operator and when BRANCH parameter is field use AND operator.
and "office"."employee" like upper( CASE WHEN :EMPLOYEE = '' THEN "office"."employee" ELSE :EMPLOYEE END)try this in TOAD (replace each apostrophe of your sql by two apostrophes and add the starting and ending apostrophe to obtain a string)
execute immediate 'INSERT INTO DATAMART.PERSONSITE (PERSON_DBID,SITE) SELECT PDBIDSKILL.DBID, MIN(PDBIDSKILL.SKILL) FROM
(SELECT DISTINCT DATAMART.V_CFG_PERSON.DBID, CASE WHEN DATAMART.V_CFG_SKILL.NAME=''Complex_Rslve'' OR DATAMART.V_CFG_SKILL.NAME=''Broadband_Business_Resolve'' THEN ''BBHD'' WHEN DATAMART.V_CFG_SKILL.NAME=''General'' OR DATAMART.V_CFG_SKILL.NAME=''General_Mobile'' OR DATAMART.V_CFG_SKILL.NAME=''General_Billing'' THEN ''MASS'' WHEN DATAMART.V_CFG_SKILL.NAME=''Faults_General'' OR DATAMART.V_CFG_SKILL.NAME=''Faults_Business'' THEN ''Faults'' ELSE ''_Other'' END AS SKILL
FROM DATAMART.V_CFG_SKILL INNER JOIN DATAMART.V_CFG_SKILL_LEVEL ON DATAMART.V_CFG_SKILL.DBID = DATAMART.V_CFG_SKILL_LEVEL.SKILL_DBID
INNER JOIN DATAMART.V_CFG_PERSON ON DATAMART.V_CFG_PERSON.DBID = DATAMART.V_CFG_SKILL_LEVEL.PERSON_DBID) PDBIDSKILL GROUP BY PDBIDSKILL.DBID';it should give the same result as your original sql statement
before using the string in VBA you must replace '' with the characters used to denote an apostrophe within apostrophes.
I don't know nothing about VBA but I'm sure you'll know how to deal with it (an apostrophe within apostrophes).
Regards
Etbin -
Hi gurus,
I am new to PL SQL and wanted to know that cant we put MIN inside the CASE WHEN.
I have following mentioned query:
It is not allowing me to execute it, can anyone help me out?
SELECT A,
B,
D,
E,
F,
SUM
(CASE
WHEN <Expression> THEN (CASE
WHEN ( <Expression>
THEN 0
ELSE min(<Expression>) or min(<Expression>)
END
ELSE 0
END
) AS sales
FROM tab1
WHERE ( column1 = 'x' )
GROUP BY A,
B,
D,
E,
F,
Edited by: user11001347 on Oct 29, 2009 2:34 AMGroup functions within a case are perfectly acceptable e.g.
select sum(case when dummy = 'X' then '1' else min(dummy) end) from dual group by dummy
SUM(CASEWHENDUMMY='X'THEN'1'ELSEMIN(DUMMY)END)
1There are other problems with your code...
This looks wrong to me:
min(<Expression>) or min(<Expression>)and you have a trailing comma after F in the group by clause.
When you're having problems with a piece of SQL, It's useful to us if you post the error you are getting back, and your table structure and sample test data too if possible.
Edited by: Cyn on Oct 29, 2009 9:43 AM -
Boundary on "CASE WHEN" does not what i expect
Hi!
The results of query1 are exactly what i expect but when i compare the counts with CASE WHEN (query2) then i get double records where the count is exactly 8. The value of Result on the second record becomes Null. This seems to me somewhat strange.
Any suggestion?
query1:
SELECT DISTINCT inline_view.u_plot_number AS Research_Group,
inline_view.external_reference AS Parental_Line,
inline_view.u_box_code AS Box,
inline_view.description AS Test,
COUNT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R1,
COUNT(DISTINCT NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R2
FROM ( SELECT DISTINCT sdg.sdg_id,
sample.sample_id,
test_template.test_template_id,
sample_user.u_plot_number,
sdg.external_reference,
sample_user.u_box_code,
test.description
FROM sdg,sdg_user,sample,sample_user,aliquot,test,test_template
WHERE sdg.sdg_id = sdg_user.sdg_id
AND sdg.sdg_id = sample.sdg_id
AND sample.sample_id = sample_user.sample_id
AND aliquot.sample_id = sample.sample_id
AND test.aliquot_id = aliquot.aliquot_id
AND test_template.test_template_id = test.test_template_id
AND sdg.sdg_id >505
) inline_view,
( SELECT DISTINCT u_finalresult_user.u_sdg_id,
u_finalresult_user.u_calculated_result,
u_finalresult_user.u_overruled_result,
u_finalresult_user.u_sample_id,
u_finalresult_user.u_test_template_id
FROM u_finalresult_user
WHERE u_finalresult_user.u_requested = 'T'
) inline_view_finalresult
WHERE inline_view.sample_id = inline_view_finalresult.u_sample_id (+)
AND inline_view.test_template_id = inline_view_finalresult.u_test_template_id (+)
ORDER BY inline_view.description,inline_view.u_box_codequery2:
SELECT DISTINCT inline_view.u_plot_number AS Research_Group,
inline_view.external_reference AS Parental_Line,
inline_view.u_box_code AS Box,
inline_view.description AS Test,
CASE WHEN
COUNT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) < 8
THEN
'onv'
ELSE
CASE WHEN
COUNT(DISTINCT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result)))
OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) > 1
THEN
'spl'
ELSE
NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result)
END
END AS Result
FROM ( SELECT DISTINCT sdg.sdg_id,
sample.sample_id,
test_template.test_template_id,
sample_user.u_plot_number,
sdg.external_reference,
sample_user.u_box_code,
test.description
FROM sdg,sdg_user,sample,sample_user,aliquot,test,test_template
WHERE sdg.sdg_id = sdg_user.sdg_id
AND sdg.sdg_id = sample.sdg_id
AND sample.sample_id = sample_user.sample_id
AND aliquot.sample_id = sample.sample_id
AND test.aliquot_id = aliquot.aliquot_id
AND test_template.test_template_id = test.test_template_id
AND sdg.sdg_id >505
) inline_view,
( SELECT DISTINCT u_finalresult_user.u_sdg_id,
u_finalresult_user.u_calculated_result,
u_finalresult_user.u_overruled_result,
u_finalresult_user.u_sample_id,
u_finalresult_user.u_test_template_id
FROM u_finalresult_user
WHERE u_finalresult_user.u_requested = 'T'
) inline_view_finalresult
WHERE inline_view.sample_id = inline_view_finalresult.u_sample_id (+)
AND inline_view.test_template_id = inline_view_finalresult.u_test_template_id (+)
ORDER BY inline_view.description,inline_view.u_box_codeNVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result)does not return double records without the CASE WHEN (see below) but i don't understand why it comes that when i compares the counts in a CASE WHEN that i get double records where the second record has value Null as Result. Could somebody provide me with a solution?
SELECT DISTINCT inline_view.u_plot_number AS Research_Group,
inline_view.external_reference AS Parental_Line,
inline_view.u_box_code AS Box,
inline_view.description AS Test,
COUNT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R1,
COUNT(DISTINCT NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R2,
NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result) AS Result
FROM ( SELECT DISTINCT sdg.sdg_id,
sample.sample_id,
test_template.test_template_id,
sample_user.u_plot_number,
sdg.external_reference,
sample_user.u_box_code,
test.description
FROM sdg,sdg_user,sample,sample_user,aliquot,test,test_template
WHERE sdg.sdg_id = sdg_user.sdg_id
AND sdg.sdg_id = sample.sdg_id
AND sample.sample_id = sample_user.sample_id
AND aliquot.sample_id = sample.sample_id
AND test.aliquot_id = aliquot.aliquot_id
AND test_template.test_template_id = test.test_template_id
AND sdg.sdg_id >505
) inline_view,
( SELECT DISTINCT u_finalresult_user.u_sdg_id,
u_finalresult_user.u_calculated_result,
u_finalresult_user.u_overruled_result,
u_finalresult_user.u_sample_id,
u_finalresult_user.u_test_template_id
FROM u_finalresult_user
WHERE u_finalresult_user.u_requested = 'T'
) inline_view_finalresult
WHERE inline_view.sample_id = inline_view_finalresult.u_sample_id (+)
AND inline_view.test_template_id = inline_view_finalresult.u_test_template_id (+)
ORDER BY inline_view.description,inline_view.u_box_code -
Help in changing plsql case when to decode
Hi,
Can anyone help me to change this sql for it to use decode function instead of case when? Below is the sql code
Thanks in advance.
SELECT
parts,
weeks,
SUM(qty) qty
FROM (
SELECT
CASE
WHEN ((is_tbd = 'yes' AND is_tbd_order = 'no') OR ex_fac_date > v_asofdate + 131) THEN 'tbd'
WHEN ex_fac_date BETWEEN v_asofdate - 1 AND v_asofdate + 5 AND is_tbd = 'no' THEN 'wk1'
WHEN ex_fac_date BETWEEN v_asofdate + 6 AND v_asofdate + 12 AND is_tbd = 'no' THEN 'wk2'
WHEN ex_fac_date BETWEEN v_asofdate + 13 AND v_asofdate + 19 AND is_tbd = 'no' THEN 'wk3'
WHEN ex_fac_date BETWEEN v_asofdate + 20 AND v_asofdate + 26 AND is_tbd = 'no' THEN 'wk4'
WHEN (ex_fac_date < v_asofdate - 1) AND is_tbd = 'no' THEN 'past_due'
END weeks,
ffdate,
parts,
SUM(qty) qty
FROM
delivery)I can't use case because my oracle is 8i,Please join 21st Century
Can you help me checnge this to if then elsif insteadSQL does does contain IF statement! -
Hi,
I had a condition like
test -table
code - column
t --> True
f --> False
I had two choices of writing query
select decode(code,'t','True','False') from test;
or
select case code
when 't' then 'True'
else 'False'
end
from test;
I want to know which one is best performance wiseWrong question really.. unless you writing a very tight loop doing 100's of 1000's of iterations using that type of conditional structure. And even then performance difference will not be that significant.
The right question to ask is which one is more flexible and allows for the programmer that comes after you to read and understand and maintain your code. The CASE statement is in this regard, a lot better than a DECODE statement.
Looking just at performance (which I suggest you do not do in isolation!!), I get mixed results using 10G Enterprise on different platforms (HP-UX vs SUN AMD) and operating systems (HP-UX vs Linux).
On the former the DECODE is slightly faster. On the latter the CASE is slightly faster.
Using the construct you've specified and doing a tight loop of a 100,000 iterations, the elapsed execution times are:
HP-UX DECODE = 00:00:11.83
HP-UX CASE = 00:00:12.32
Linux/AMD DECODE =00:00:02.02
Linux/AMD CASE = 00:00:01.84
Obviosuly the CPU architecture plays a major role here. The AMD is considered as the best 64 CPU on the market. The HP-UX PARISC CPU (also 64bit), does not really compare raw performance wise. In addition this is a RISC CPU whereas the AMD CPU is I believe more CISC than RISC.
Also interesting that the faster Sun AMD/Linux server I used for this benchmark is about 10% the price of the HP-UX server.. and about 5x faster ito raw speed as this benchmark showed. :-)
An interesting exercise, but one with little real world value. Yes performance is important. But within PL/SQL, not to the level about debating whether a CASE or DECODE is faster. As I've mentioned, I believe the right question being one about readability and maintenance and not performance in this case. -
Hi everybody,
I have column in Discoverer like this one shown bellow:
DECODE(Vrstapolise,1,'Aktivno',4,'Kapitalisano',3,DECODE(Stanjepreisteka,'Aktivno','Aktivno','Kapitalisano','Kapitalisano',NULL),NULL)
I want to make the same column with same functionality in OBI BMM. Is it possible? If it is possible, how to do that?
Thanks in advance.As Sai said use Case stmt, your code will something like this
Case Vrstapolise
When 1 then 'Aktivno'
When 4 then 'Kapitalisano'
When 3 then
Case Stanjepreisteka
when 'Aktivno' then 'Aktivno'
when 'Kapitalisano' then 'Kapitalisano'
else Null end
else Null End
Thanks,
Vino -
Using CASE WHEN THEN in dynamic Region Source area
Hi all,
I've been knocking my head around on this one for a while. Hope someone can show me some guidance. So far, the SQL Query in the Region Source works ok except after the THEN ''||'LINK'||'' . All text between the single quotes displays, and not just the hyperlink LINK. (My goal is to this simple test working, then go back an substitute in APP_ID, Page#, SESSION variables.) But I'm stuck with this problem. Searched the forum but this is as far as I got. Below is the code I'm using in the Region Source area. Perhaps a region attribute setting is needed but I'm unsure. Thanks for any assistance. -Mike
select DISTINCT
AWARD,
CASE
WHEN WINNER_NAME = 'India Retail Support Team'
THEN '<A HREF="http://www.hotmail.com">'||'LINK'||'</A>' *----------------HREF link (LINK) is working fine here but doesn't work ok in Region Source.
ELSE WINNER_NAME
END WN,
GBU_WINNER,
DORDER
from GBUSERVICEPACESETTERAWARDS
where FY = '2012'
and TYPE = 'Service Award'>
As previously requested, please update your forum profile with a real handle instead of "user10734329".
I've been knocking my head around on this one for a while. Hope someone can show me some guidance. So far, the SQL Query in the Region Source works ok except after the THEN ''||'LINK'||'' . All text between the single quotes displays, and not just the hyperlink LINK.Not clear from this what the problem is. It appears to me that LINK is all of the "text between the single quotes". What do you mean by "all text"? (An example on apex.oracle.com is a good way to resolve such ambiguities...)
The usual cause of unexpected results when the separation of concerns is breached and HTML is directly generated in report queries is having the Display Text As report column attribute wrongly set. Ensure it is Standard Report Column rather than the default Display as Text (escape special characters). -
CASE WHEN statement IS NULL THEN ......
-- i've table's acoount and owner
create table account
( code-number(30) , name-nvarchar(200))
create table owner
( code-nvarchar2(20 BYTE) ,
name -nvarchar(100),
account_code-number(30)) account_code is foreign key
code
name
account_code
1.1
a
1.1
5
x
5
3.3
c
3.3
7
y
19
dd
code
name
1.1
z
5
b
3.3
c
3.3
c
now my result should be
code(owner)
name(owner)
code(account)
name(account)
1.1
a
1.1
z
5
x
5.
b
3.3
c
3.3
c
7
y
19
dd
my script
SELECT CASE WHEN O.ACCOUNT_CODE IS NULL THEN A.CODE=NULL ELSE A.CODE=(VALUE) END, // HOW SHOULD I WRTIE HERE ???
CASE WHEN O.ACCOUNT_CODE IS NULL THEN A.NAME=NULL ELSE A.NAME=(VALUE) END,
O.CODE,
O.NAME
FROM OWNER O,
ACCOUNT A
WHERE A.CODE = O.ACCOUNT_CODE;I don't see the need for case statement here. Cant you just do this.
SQL> with owner
2 as
3 (
4 select 1.1 code, 'a ' name, 1.1 account_code from dual union all
5 select 5 code, 'x ' name, 5 account_code from dual union all
6 select 3.3 code, 'c ' name, 3.3 account_code from dual union all
7 select 7 code, 'y ' name, null account_code from dual union all
8 select 19 code, 'dd' name, null account_code from dual
9 ), account
10 as
11 (
12 select 1.1 code, 'z' name from dual union all
13 select 5 code, 'b' name from dual union all
14 select 3.3 code, 'c' name from dual union all
15 select 3.3 code, 'c' name from dual
16 )
17 select o.code "code (owner)"
18 , o.name "name (owner)"
19 , a.code "code (account)"
20 , a.name "name (account)"
21 from owner o
22 left
23 join (
24 select distinct code, name
25 from account
26 ) a
27 on o.account_code = a.code
28 order
29 by 1;
code (owner) name (owner) code (account) name (account)
1.1 a 1.1 z
3.3 c 3.3 c
5 x 5 b
7 y
19 dd -
Hello everyone,
We have a function return Y or N.
We have 2 table YTable YT and NTable NT.
We are using UNION now.
SELECT ONE.CL1
FROM (
SELECT CL1Y FROM YTable WHERE FUNCTION = 'Y'
UNION
SELECT CL1N FROM NTable WHERE FUNCTION = 'N') ONEWe are wondering to use CASE, WHEN, THEN, END.
Is it possible or NOT?
If you have a chance, please share your experiences.
Thanks in advance,
NY
P.S.
If you have more questions, please let us know.
Edited by: New Yorker on Aug 31, 2010 10:08 AMNew Yorker,
According to the given SQL block, the case function can not be used. You can use the case function with multiple table joins but you can only use the CASE WHEN ELSE END block for one column.
If i got your question correct, that is my answer to your question.
Regards.
Ogan -
In my database, two variable ID and time (varchar2) are there. I want to populate another variable using case when then by putting below conditon to convert like this
But its not working. Can anyone help me
if time =1 day then '1 Day'
time > 2 days and time <=7 days then '2 to 7 days'
time > 8 days and time <=15 days then '8 to 15 days'
else 'not matching'
ID Time
12 1 days
23 244 days
12 2 days
14 4 days
15 6 days
17 9 days
select time,
case WHEN
UPPER(Time) = '1 DAY'
THEN
'1 day'
WHEN
UPPER(Time) Between '2 DAYS' and '7 DAYS'
THEN
'2 to 7 days'
WHEN
UPPER(Time) Between '8 DAYS' and '15 DAYS'
THEN
'8 to 15 days'
ELSE
'Not matching'
END "update time"
from table1900487 wrote:
In my database, two variable ID and time (varchar2) are there. If you are storing Days in a column store it as NUMBER or INTERVAL data type. The way you have stored the value looks incorrect.
What you can do is extract the number portion of your time column and apply the CASE statement. Something like this
SQL> with t
2 as
3 (
4 select 12 id, '1 days' time1 from dual union all
5 select 23 id, '244 days' time1 from dual union all
6 select 12 id, '2 days' time1 from dual union all
7 select 14 id, '4 days' time1 from dual union all
8 select 15 id, '6 days' time1 from dual union all
9 select 17 id, '9 days' time1 from dual
10 )
11 select id,
12 time1,
13 case when time1 = 1 then '1 day'
14 when time1 between 2 and 7 then '2 to 7 days'
15 when time1 between 8 and 15 then '8 to 15 days'
16 else 'not matching'
17 end "update time"
18 from (
19 select id, to_number(regexp_substr(time1, '^[[:digit:]]*')) time1
20 from t
21 )
22 /
ID TIME1 update time
12 1 1 day
23 244 not matching
12 2 2 to 7 days
14 4 2 to 7 days
15 6 2 to 7 days
17 9 8 to 15 days
6 rows selected. -
Case-when-then logic in join condition
Is it possible to implement case when then logic in join condition?
Instead of:
INGRP1.COL1 = INGRP2.COL1 (+)
something like:
case
when INGRP1.COL2 IS NULL
then INGRP1.COL1 = INGRP2.COL1 (+)
else INGRP1.COL3 = INGRP2.COL3 (+)
end
expression builder for join condition.
Any help much appreciated.Hi Kaiser,
this is my variant
1) join first table with second table twice (define two input group in join, include second table in mapping twice and map them to appropriate join group)
INGRP1.COL1=INGRP2.COL1(+) and INGRP1.COL3=INGRP3.COL3(+)
2) after join calculate attributes from second table with expression like
case when COL2 IS NULL the INGRP2_ATTR else INGRP3_ATTR end
Maybe anyone has a better solution...
Regards,
Oleg
Maybe you are looking for
-
Can I add movie to Apple TV without itunes or store
I would like a movie to reside on my apple tv but i dont want it on my computer. It is not available to download from Itunes. Is there a way to put it on the atv without having to sync. I have tried to add it to my itunes library, sync it through the
-
How to get the number of rows in a report region
Hi all, Is there a way to get the number of rows returned in a report region, without issuing an additional "select count(*) from some_table"? I mean something like the substitution string #ROW_NUM# but for the total rows. Thanks, Pedro.
-
Nokia express music 5800 contact number problem
I can't get my phone numbers from my phone. when i try to open the phonebook it says no contact is there. though there is contacts saved in phonebook. Even if any person call me it displays there name in Dialed,missed,recieved number list. IIf i try
-
Hello Everyone! On gw8.03. When i attempt to open the gwia in console1 it returns an error: An error occured converting the groupwise object to its edirectory counterpart (image attached). I think i must graft the gwia (or, maybe not), but i can't fi
-
Ich hätte gerne von Adobe eine Stellungnahme zu obigen Problem!