Regarding case statement
Hi guys,
i am getting a very strange problem. i have score column. basis of this column i am sorting the dataand after it i am giving rank to it.
but for one employee it is not giving rank. giving null.so please any suggestion.
i am applying case statement for it.
It can be because of case statement...Whats the purpose of case statement here ? plz elaborate..
Try removing case and check if you are getting same error
Similar Messages
-
Regarding case statement and decode function
Hi Experts,
I have question.....regarding case statement and decode statement....
Can you please explain me that which one will be efficient,to place in insert statement...
insert statement(
(case when ........then
case when ....then
else
end)
else
end)
or
insert statement(
case when.....then
decode(....)
else
end)
Can you people explain me which one is more efficient method?
Thanks in advance.......The are major differences to talk about in case of CASE vs DECODE, but performance wise both are pretty much the same.
Have a look at Tom's thread
Ask Tom "better performance - case or decode"
I would suggest to use CASE whenever possible. Don't worry about the performance part. -
Just a FYI regarding Case statements in ORacle 8i in pl/sql
Well..I saw numerous posts in this forum regarding not being able to do case statement within pl/sql. Well..you can do
that using dynamic SQL. IT works like a champ.Hi,
Try first to (re)compile ll invalid objects. then
you can run:
select owner,type,count(*) from all_errors
group by owner,typeif you still have uncompiled objects, then report the different errors:
select * from all_errors... -
Help Regarding CASE Statement.
hey !
i m trying to apply COUNT to a column , with a particular condition.
like.
CASE
WHEN( A > B)
THEN COUNT(some column)
else '0'
end
but its not working.
can anyone tell me how to count only particular rows which satisfy the given condition in WHEN Clause.
i m trying to add many columns from different tables by joining them and then adding column one by one satisfying different conditions.
my final table looks like this.
items in stock-----|-----items_not_in_STock----|----Items_fully_in_stock
its something like this...!!!
secondly , what if i dont want any ELSE condition.
is it possible???I am not quite sure I understood your "requirement"...no tables, no sample data, no expected output...
can anyone tell me how to count only particular rows which satisfy the given condition in WHEN ClauseAssuming your requirement is above i.e. getting count of resultset based on different conditions, following might help you.
SQL> select sum(case when object_id > 10000 then 1 end) from t ;
SUM(CASEWHENOBJECT_ID>10000THEN1END)
74 -
Query regarding case statement
Hi,
I have a SP which has in_rc as an input parameter
Now I have a select query which is as follows in pseudo
select....
where <condition1>
And <condition2>
And <condition3>
Now my requirement is that I want to add one more filter based on the in_rc
ie if in_rc is not null, then I want to add one more filter condition along with the existing condition else only the existing condition.
pseudo:
select....
where <condition1>
And <condition2>
And <condition3>
case <in_rc><when not null>then
AND <condition 4>
possible?
regds,
SunI am not pedantic. Just pointing out some things to be aware of (should be allowed, shouldn't it?);)
It only requires a few more NVL's. ;) or lnnvl? ;)
michaels> VAR mgr number
michaels> EXEC :mgr := 7782
michaels> SELECT ename, mgr
FROM emp
WHERE lnnvl (mgr != :mgr)
ENAME MGR
KING /* want nulls or not? */
MILLER 7782
michaels> EXEC :mgr := NULL
michaels> SELECT ename, mgr
FROM emp
WHERE lnnvl (mgr != :mgr)
ENAME MGR
SMITH 7902
ALLEN 7698
WARD 7698
JONES 7839
MARTIN 7698
BLAKE 7839
CLARK 7839
SCOTT 7566
KING
TURNER 7698
ADAMS 7788
JAMES 7698
FORD 7566
MILLER 7782 -
CASE not found while executing CASE statement on Submit Form
Hi to all APEX users and developers.
I have several APEX applications and they are all working well, but recently I got one strange exception when I try to submit page:
Session: Fetch session header information
...metadata, fetch page info
...Validate item page affinity.
...Validate hidden_protected items.
Add error onto error stack
...Error data:
......message: Error processing request.
......additional_info: ORA-06592: CASE not found while executing CASE statement
......display_location: ON_ERROR_PAGE
......is_internal_error: true
......apex_error_code: APEX.UNHANDLED_ERROR
......ora_sqlcode: -6592
......ora_sqlerrm: ORA-06592: CASE not found while executing CASE statement
.....error_backtrace: ORA-06512: at "APEX_040100.WWV_FLOW", line 9273
......component.type: APEX_APPLICATION_AUTH
......component.id: 41350431648668800
......component.name: MNRFR
...Show Error on Error Page
......Performing rollback
Processes - point: AFTER_ERROR_HEADER
Processes - point: BEFORE_ERROR_FOOTER
End Page Processinga
Page has more than 120 items (most of them are hidden), so my first thought is that page has problem with posting so many items, but APEX error message doesn't hel me at all. Any help would be very appreciated :)
AlmirHi Almir,
actually it is the 100 page item limit. See (http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/limits.htm)
I also had a look into the source code and the code at the position where the error gets raised only supports 100 page items.
Can you have a look into the generated HTML code and look if you have a page items which is mapped to p_t101 or a higher number ?
I will file a bug to show a better error message.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
CASE statement in Calculated column
Hi Frzz,
I have below requirement in Calculated column with CASE statement. Could some one help me how to achieve this with case statement.
String = 0Hello
01Hello
012Hello
0123Hello
If 1st Character of the string is '0' then - 0Hello
1st 2 characters of the String is '01' - 22Hello
1st 3 characters of the String is '01' - 333Hello
1st 4 characters of the String is '01' - 4444Hello
Thank you.
Best Regards,
Krishna.Hi Krishna ,
Using IF and MATCH to do that: ( I took one of the conditions you specified )
IF(match("STRING1",'??0??'),'333Hello',"STRING1")
Output:
Regards,
Krishna Tangudu -
How can you change a drop down menu's selection in a case statement?
Hi,
I am trying to an array finding vi. This VI will take an existing xml file and after the user has selected his/her equipment, input, output, and frequency it will put all of those options into a string and search the xml file for that exact array name and display it on an output screen. The problem I am having is that my input and outputs selection needs to be a little different depending upon the equipment selected. I thought that I could use a case statement to change the input and output selectable options, but I have run into many snags with it. For one everytime I place a new Input and Output drop down menu in the case statement it wants to place a new one in the front panel (I only want one input and output not three I have two inputs and outputs hidden right now). I believe I am using the case statement wrong... Can anyone help change my input and output selectable options depending upon the equipment selected. Attached is my xml file, Array Find.vi (the original one), and Array Find_Test.vi (this is the one I am trying to modify).
Thanks,
dlovell
Solved!
Go to Solution.
Attachments:
Find Array.zip 126 KBHi dlovell,
There are 2 key things I'd recommend for the code - using property nodes to edit the strings in the combo boxes. Something like the following snippet:
Also, check your CPU in task manager when running the code. It will eat a whole core of your machine (25% quad core, 50% dual, 100% single) - that is because you are running the while loop and polling the control as fast as Windows will allow you to. Using Event Structures is a much more efficient way of working in this example.
Check out the MOD attached
Regards,
Peter D
Attachments:
MOD_Find Array.vi 28 KB -
Please Help!!!
How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
January 2014 January
2013 +/-
Region Entry Exit Total Entry Exit Total (Total of Jan2014-Total of Jan2013)
A 2 3
40 5 7 30 40-30= 10What is a table structure? Sorry cannot test it right now..
SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
FROM tbl
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
HI ALL,
in the program,i need to display description based on condition type.
so we used CASE statement as below in LOOP. ITS not working .
could anyone please suggest if anything wrong in the following code.
LOOP AT gt_mat.
MOVE gt_mat-type TO gt_final-type.
Condition description
CASE gt_mat-type .
when 'N'.
move 'New' to gt_final-condes.
when 'B'.
move 'Block' to gt_final4-condes.
ENDCASE.
ENDLOOP.
please let me know whats the problem i above code and how to solve.
thanks in advance.Hi,
The only solution for this could be to debug the program and check if the coresponding values are populated and available. You could also try to replace the CASE statement with a simple IF statement and check if its working.
LOOP AT gt_mat.
MOVE gt_mat-type TO gt_final-type.
* Condition description
IF gt_mat-type = 'N'.
gt_final-condes = 'New'.
elseif gt_mat-type = 'B'.
gt_final-condes ='Block'.
append gt_final.
clear gt_final.
ENDIF.
ENDLOOP.
Also make sure the case of the value in gt_mat-type matches with the condition
Regards,
Vikranth -
Case statement in a multiple query
Hi everyone,
This is my first time to use case statement in a multiple query. I have tried to implement it but i got no luck.. Please see below
set define off
SELECT g.GROUP_NAME as Market
,t.NAME as "Template Name"
,t.TEMPLATE_ID as "Template ID"
,(SELECT created
FROM material
where template_id = t.template_id) as "Date Created"
*,(SELECT DESTINATION_FOLDER_ID,*
CASE DESTINATION_FOLDER_ID
WHEN NULL THEN 'Upload'
ELSE 'HQ'
END
from log_material_copy
where destination_material_id in (select material_id
from material
where template_id = t.template_id ))as "Origin"
,(select material_id
from log_material_copy
where destination_material_id in (select material_id
from material
where template_id = t.template_id)) as "HQ/Upload ID"
,(SELECT COUNT (mse.ID)
FROM MATERIAL_SEND_EVENT mse, material m, creative c
WHERE mse.MATERIAL_ID = m.MATERIAL_ID
AND mse.MATERIAL_TYPE_ID = m.MATERIAL_TYPE_ID
AND m.ASSET_ID = c.id
AND c.TEMPLATE_ID = t.TEMPLATE_ID) as Sent
,(SELECT COUNT (de.ID)
FROM download_event de, material m, creative c
WHERE de.MATERIAL_ID = m.MATERIAL_ID
AND de.MATERIAL_TYPE_ID = m.MATERIAL_TYPE_ID
AND m.ASSET_ID = c.id
AND c.TEMPLATE_ID = t.TEMPLATE_ID) as Download
,(SELECT 'https://main.test.com/bm/servlet/' || 'UArchiveServlet?action=materialInfo&materialId=' || DESTINATION_MATERIAL_ID || '&materialFolderId=' || DESTINATION_FOLDER_ID
from log_material_copy
where destination_material_id in (select material_id
from material
where template_id = t.template_id)) as "URL to template on MPC layer"
--, t.AVAILABLE_FOR_TRANSFER as "Available for transfer"
FROM template t, layout l, groups g
WHERE t.LAYOUT_ID = l.LAYOUT_ID
AND l.ORGANIZATION_ID = g.IP_GROUPID
AND g.IP_GROUPID in ( 1089, 903, 323, 30, 96, 80, 544, 1169, 584, 785, 827, 31, 10, 503, 1025 )
ORDER BY g.GROUP_NAME ASC;
The one in bold is my case statement.. Please let me know what is wrong with this.
Regards,
JasI think you're getting the idea, but:
You're still selecting 2 columns in the (scalar) subquery. Did you read the link I posted for you?
"a) scalar subqueries - *a single row, single column query that you use in place of a "column"*, it looks like a column or function."
You must move that query outside, join to template.
Something like:
NOT TESTED FOR OBVIOUS REASONS SO YOU'LL PROBABLY NEED TO TWEAK IT A BIT
select g.group_name as market,
t.name as "Template Name",
t.template_id as "Template ID",
m.created as "Date Created",
lmc.destination_folder_id,
case lmc.destination_folder_id
when null then 'Upload'
else 'HQ'
end as "Origin"
(select material_id
from log_material_copy
where destination_material_id in
(select material_id
from material
where template_id = t.template_id)) as "HQ/Upload ID"
(select count(mse.id)
from material_send_event mse, material m, creative c
where mse.material_id = m.material_id
and mse.material_type_id = m.material_type_id
and m.asset_id = c.id
and c.template_id = t.template_id) as sent
(select count(de.id)
from download_event de, material m, creative c
where de.material_id = m.material_id
and de.material_type_id = m.material_type_id
and m.asset_id = c.id
and c.template_id = t.template_id) as download
(select 'https://main.test.com/bm/servlet/' ||
'UArchiveServlet?action=materialInfo&materialId=' ||
destination_material_id || '&materialFolderId=' ||
destination_folder_id
from log_material_copy
where destination_material_id in
(select material_id
from material
where template_id = t.template_id)) as "URL to template on MPC layer"
--, t.AVAILABLE_FOR_TRANSFER as "Available for transfer"
from template t
, layout l
, groups group by
, MATERIAL M
, LOG_MATERIAL_COPY LMC
where t.layout_id = l.layout_id
and l.organization_id = g.ip_groupid
and M.TEMPLATE_ID = t.template_id
and LMC.destination_material_id in ( select material_id
from material
where template_id = t.template_id
and g.ip_groupid in (1089,
903,
323,
30,
96,
80,
544,
1169,
584,
785,
827,
31,
10,
503,
1025)
order by g.group_name asc; -
Need help in this query using Case Statement
I have the following query which is currently existing and I am adding few more conditions based on the new requirements which is based on a particular flag set as 1 or 0.
If it is set to 1 then I should use the old query as it is and if it is set to 0 then I should add the new conditions.
Basically when the flag is set to 0, I shouldnt be including some of the records that already exists and should include only new records. This is based on the plan_type_ids in (1,2,3,4).
Hence I am using the Case statement to check if the plan_type_id is in (1,2) then do a set of not exists and if the plan_type_id in (3,4) then do set of not exists.
But when I run this query it is giving me error. What am I doing wrong?
Is there any other simple way to combine all the not exists for all of those select statements as given after the line ------------------------- into a single one?
What am I doing wrong?
I tried putting the NOT EXists before the case too but that too didnt work.
Please help. Appreciate it.
Thank you in advance.
SELECT
ee.employee_id
,'WELCOMEMSG'
,DECODE( me.member_enrollment_id
,first_enr.enrollment_id
,20
,23
) status_id
,me.member_enrollment_id
,wk.welcome_msg_id
FROM wk
,employees ee
,MEMBER_ENROLLMENTS me
,plans pl
,( SELECT employee_id
,plan_type_id
,start_date
,plan_id
,MIN(MEMBER_ENROLLMENT_ID) member_enrollment_id
FROM ( SELECT me.employee_id
,DECODE(pl.plan_type_id,1,2,pl.plan_type_id) plan_type_id
,pl.start_date
,wk.plan_id
,me.member_enrollment_id
FROM wk
,PLANS pl
,MEMBER_ENROLLMENTS me
WHERE wk.done_by = nvl('TEST' ,wk.done_by)
AND wk.welcome_msg_name <> 'NONE'
AND pl.employer_id = wk.employer_id
AND wk.employer_id = 5
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = wk.plan_type_id
AND pl.plan_id = NVL(wk.plan_id,pl.plan_id)
AND me.plan_id = pl.plan_id
AND me.coverage_effective_date <> NVL(me.coverage_end_Date, me.coverage_effective_date + 1)
AND me.coverage_effective_Date BETWEEN wk.start_date AND NVL(wk.end_date, me.coverage_effective_date + 1)
MINUS
SELECT me.employee_id
,DECODE(pl.plan_type_id,1,2,pl.plan_type_id) plan_type_id
,pl.start_date
,NULL plan_id
,me.member_enrollment_id
FROM wk
,PLANS pl
,MEMBER_ENROLLMENTS me
WHERE wk.done_by = nvl(NULL,wk.done_by)
AND wk.welcome_msg_name <> 'NONE'
AND pl.employer_id = wk.employer_id
AND wk.employer_id = 5
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = wk.plan_type_id
AND pl.plan_id = wk.plan_id
AND me.plan_id = pl.plan_id
AND me.coverage_effective_date <> NVL(me.coverage_end_Date, me.coverage_effective_date + 1)
AND me.coverage_effective_Date BETWEEN wk.start_date AND NVL(wk.end_date, me.coverage_effective_date + 1)
WHERE employee_id = 100
GROUP BY employee_id ,plan_type_id,start_date ,plan_id
)first_enr
,MEMBER_EVENTS mv
WHERE wk.done_by = nvl(NULL,wk.done_by)
AND wk.employer_id = ee.employer_id
AND ee.employee_id = me.employee_id
AND ee.employee_id = 100
AND me.plan_id = pl.plan_id
AND me.coverage_effective_date <> NVL(me.coverage_end_Date, me.coverage_effective_date + 1)
AND me.coverage_effective_Date BETWEEN wk.start_date AND NVL(wk.end_date, me.coverage_effective_date + 1)
AND is_expired(me.employee_id,me.plan_id) = 'Y'
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = wk.plan_type_id
AND pl.plan_id=nvl(wk.plan_id,pl.plan_id)
AND me.employee_id = first_enr.employee_id
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = first_enr.plan_type_id
AND pl.start_date = first_enr.start_date
AND me.member_enrollment_id = mv.member_enrollment_id (+)
AND 'WELCOMEMSG' = mv.event_name(+)
AND mv.member_enrollment_id IS NULL
AND wk.welcome_msg_name <> 'NONE'
AND NVL(first_enr.plan_id,0) = NVL( wk.plan_id,0)
AND (FN_get_all_participant(wk.employer_id) = 1
OR
(FN_get_all_participant(wk.employer_id) = 0
AND (CASE WHEN pl.plan_type_id IN (1,2)
THEN NOT EXISTS (SELECT 'X'
FROM member_accounts ma
member_enrollments men3
plans pl3
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = me.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date < pl.START_DATE
AND TRUNC(men3.coverage_effective_date) <> TRUNC(NVL(men3.coverage_end_date, men3.coverage_effective_date + 1 ))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id in (1, 2)
UNION
(SELECT 'X'
FROM member_accounts ma
member_enrollments men3
plans pl3
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = me.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date = (pl.start_date - 365)
\ AND TRUNC(men3.coverage_effective_date) <> TRUNC(NVL(men3.coverage_end_date, men3.coverage_effective_date + 1 ))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id = wk.plan_type_id
UNION
(SELECT 'X'
FROM member_accounts ma
member_enrollments men3
plans pl3
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = men2.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date < pl2.START_DATE -- '01-Jan-2011'
AND TRUNC(men3.coverage_effective_date) <> TRUNC(NVL(men3.coverage_end_date, men3.coverage_effective_date + 1 ))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id = 2
UNION
(SELECT 'X'
FROM member_accounts ma
member_enrollments men3
plans pl3
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = men2.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date < pl2.START_DATE -- '01-Jan-2011'
AND TRUNC(men3.coverage_effective_date) <> TRUNC(NVL(men3.coverage_end_date, men3.coverage_effective_date + 1 ))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id = 1
WHEN pl.plan_type_id IN (3, 4)
THEN NOT EXISTS (SELECT 'X'
FROM member_accounts ma
member_enrollments men3
plans pl3
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = men2.employee_id
AND nvl(ma.account_end_date, sysdate) <= trunc(sysdate)
AND ma.plan_id = pl3.plan_id
AND pl3.start_date <= pl2.START_DATE
AND TRUNC(men3.coverage_effective_date) <> TRUNC(NVL(men3.coverage_end_date, men3.coverage_effective_date + 1 ))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id in (3, 4)
END
AND (CASE WHEN pl.plan_type_id IN (1,2)
ERROR at line 89:
ORA-00936: missing expressionMaybe
SELECT ee.employee_id,
'WELCOMEMSG',
DECODE(me.member_enrollment_id,first_enr.enrollment_id,20,23) status_id,
me.member_enrollment_id,
wk.welcome_msg_id
FROM wk,
employees ee,
MEMBER_ENROLLMENTS me,
plans pl,
(SELECT employee_id,
plan_type_id,
start_date,
plan_id,
MIN(MEMBER_ENROLLMENT_ID) member_enrollment_id
FROM (SELECT me.employee_id,
DECODE(pl.plan_type_id,1,2,pl.plan_type_id) plan_type_id,
pl.start_date,
wk.plan_id,
me.member_enrollment_id
FROM wk,
PLANS pl,
MEMBER_ENROLLMENTS me
WHERE wk.done_by = nvl('TEST',wk.done_by) /* same as wk.done_by = 'TEST' */
AND wk.welcome_msg_name 'NONE'
AND pl.employer_id = wk.employer_id
AND wk.employer_id = 5
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = wk.plan_type_id
AND pl.plan_id = NVL(wk.plan_id,pl.plan_id)
AND me.plan_id = pl.plan_id
AND me.coverage_effective_date != NVL(me.coverage_end_Date,me.coverage_effective_date + 1)
AND me.coverage_effective_Date BETWEEN wk.start_date AND NVL(wk.end_date,me.coverage_effective_date + 1)
MINUS
SELECT me.employee_id,
DECODE(pl.plan_type_id,1,2,pl.plan_type_id) plan_type_id,
pl.start_date,
NULL plan_id,
me.member_enrollment_id
FROM wk,
PLANS pl,
MEMBER_ENROLLMENTS me
WHERE wk.done_by = nvl(NULL,wk.done_by) /* same as 1 = 1 */
AND wk.welcome_msg_name 'NONE'
AND pl.employer_id = wk.employer_id
AND wk.employer_id = 5
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = wk.plan_type_id
AND pl.plan_id = wk.plan_id
AND me.plan_id = pl.plan_id
AND me.coverage_effective_date NVL(me.coverage_end_Date,me.coverage_effective_date + 1)
AND me.coverage_effective_Date BETWEEN wk.start_date AND NVL(wk.end_date, me.coverage_effective_date + 1)
WHERE employee_id = 100
GROUP BY employee_id,
plan_type_id,
start_date,
plan_id
) first_enr,
MEMBER_EVENTS mv
WHERE wk.done_by = nvl(NULL,wk.done_by)
AND wk.employer_id = ee.employer_id
AND ee.employee_id = me.employee_id
AND ee.employee_id = 100
AND me.plan_id = pl.plan_id
AND me.coverage_effective_date != NVL(me.coverage_end_Date,me.coverage_effective_date + 1)
AND me.coverage_effective_Date BETWEEN wk.start_date AND NVL(wk.end_date, me.coverage_effective_date + 1)
AND is_expired(me.employee_id,me.plan_id) = 'Y'
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = wk.plan_type_id
AND pl.plan_id = nvl(wk.plan_id,pl.plan_id)
AND me.employee_id = first_enr.employee_id
AND DECODE(pl.plan_type_id,1,2,pl.plan_type_id) = first_enr.plan_type_id
AND pl.start_date = first_enr.start_date
AND me.member_enrollment_id = mv.member_enrollment_id(+)
AND 'WELCOMEMSG' = mv.event_name(+)
AND mv.member_enrollment_id IS NULL
AND wk.welcome_msg_name != 'NONE'
AND NVL(first_enr.plan_id,0) = NVL(wk.plan_id,0)
AND (
FN_get_all_participant(wk.employer_id) = 1
OR
(FN_get_all_participant(wk.employer_id) = 0
AND NOT EXISTS(SELECT 'X'
FROM member_accounts ma,
member_enrollments men3,
plans pl3,
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = me.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date < pl.START_DATE
AND TRUNC(men3.coverage_effective_date) != TRUNC(NVL(men3.coverage_end_date,men3.coverage_effective_date + 1))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id in (1,2)
and pl.plan_type_id IN (1,2)
UNION
SELECT 'X'
FROM member_accounts ma,
member_enrollments men3,
plans pl3,
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = me.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date = (pl.start_date - 365)
AND TRUNC(men3.coverage_effective_date) != TRUNC(NVL(men3.coverage_end_date,men3.coverage_effective_date + 1))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id = wk.plan_type_id
and pl.plan_type_id IN (1,2)
UNION
SELECT 'X'
FROM member_accounts ma,
member_enrollments men3,
plans pl3,
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = men2.employee_id
AND ma.plan_id = pl3.plan_id
AND pl3.start_date < pl2.START_DATE -- '01-Jan-2011'
AND TRUNC(men3.coverage_effective_date) != TRUNC(NVL(men3.coverage_end_date,men3.coverage_effective_date + 1))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id = (1,2)
and pl.plan_type_id IN (1,2)
UNION
SELECT 'X'
FROM member_accounts ma,
member_enrollments men3,
plans pl3,
plan_types pt3
WHERE ma.member_account_id = men3.member_account_id
AND ma.employee_id = men2.employee_id
AND trunc(nvl(ma.account_end_date,sysdate)) <= trunc(sysdate)
AND ma.plan_id = pl3.plan_id
AND pl3.start_date <= pl2.START_DATE
AND TRUNC(men3.coverage_effective_date) != TRUNC(NVL(men3.coverage_end_date,men3.coverage_effective_date + 1))
AND pl3.plan_type_id = pt3.plan_type_id
AND pt3.plan_type_id in (3,4)
and pl.plan_type_id IN (3,4)
)Regards
Etbin -
Sql case statement with link not opening new window
Apex 4.2
I am writing a query that has a case statement. I need the case statement to open up a new window, not a new tab. I have the following:
SELECT
case when SCHED_ID = 1 then
'<a href="javascript:popupURL(''http://www.google.com'')">LINK</a>'
end as MyLink
FROM Table_Name
When I plug this into a a column link in the URL field under a page item or report item, then a popup window appears. However, inside the query I am getting a new tab.
ANy help on this matter would be great. Thanks in advance.Hi,
Try adding a target attribute to you link:
'<a href="javascript:popupURL(''http://www.google.com'')" target="_blank">LINK</a>'
Regards,
Vincent -
CASE Statement in IRR Compute(probable bug)
In IRR i am not able to create Compute with CASE statement. It is giving me error
"Invalid computation expression. THEN"
It is simple Compute
CASE WHEN A = 'SALES' THEN B + C ELSE B END
Also when i noticed the available functions(in Compute screen) THEN is missing.
Is it a bug? or I am missing something
Regards
PrabaharI'm also running into this bug, though we're still back at Apex 3.1.1.
Has anyone figured out a workaround for it? I tried changing CASE to a DECODE, but I'm still getting an error. I'm having trouble understanding how any computation that used a function would pass this validation test.
Suggestions would be most welcome.
Thanks,
Stew -
Case statement in order by clause
Hi,
I have written the below query which is having CASE statement in ORDER BY clause. Please let me know what mistake i have done in the query because am getting "Missing Keyword" Error.
SELECT opn_quest_id, seq_nbr
FROM opinion_question
order by case when :p=1 then
opn_quest_id,seq_nbr
else
opn_quest_id
end;
Thanks,
Santhosh.STry Ignore the following solution.
SELECT opn_quest_id, seq_nbr
FROM opinion_question
ORDER BY CASE
WHEN : p = 1 THEN opn_quest_id || seq_nbr
ELSE opn_quest_id
END;
What are the data type of the corresponding columns used in the CASE Statement? I have assumed it to be strings.
!http://www.mysmiley.net/imgs/smile/sad/sad0049.gif! My Apologies....
Regards,
Jo
Edited by: Joice John on Jul 13, 2009 3:07 AM
Wrong Solution. Corrected by Sven.
Maybe you are looking for
-
I'm having trouble finding the identical aspect ratio to import either an Illustrator or Photoshop title screen into Premiere Pro. There are so many ratios to choose from with Premiere Pro that I've about lost my mind. I was able to import Photoshop
-
Which path is the localhost for the tomcat
hi, if i type http://localhost:8080/ then which path will it access i have the tomcat in the directory called d:\jakarta-tomcat-4.1.12\ please help me from darshan soni
-
Help with displaying info from database+asp
How can I display info from a database so that it is formatted into rows in a table here is an example of what I would like http://www.westerveltcollege.com/new/programs/bus_admin_computers.html (it is the section that show the course content) I know
-
Only create planned order if no stock
Experts, I want to setup MTO environment with possible delivery from stock. If I use strategy 20 (MTO) the system always generates planned orders even if there is stock, with strategy 10 (MTS) no planned orders are created. Flow: - when sales order i
-
Intradoc.data.DataException: !csJdbcCommitCalledInAutoCommitMode
Hi guys, I have written a checkin filter. this filter searches for some content in content server and based on the result do some proccessing . Here is the code : DataBinder serviceBinder = new DataBinder(); serviceBinder.putLocal("Que