CASES where the clasue issue
Hi I have a select query that gives question saying key word missing in a case statement else part please suggest./ * Formatted on 2012/11/02 16:19 (trainer more v4.8.8) * /.
SELECT a.kintana_number, a.crid, a.projectestimateid, a.reasonimpacts
FROM (SELECT p.kintana_number AS kintana_number, cr.crid AS crid,
PE.projectestimateid AS projectestimateid,
l.LookupValue AS reasonimpacts,
(SELECT COUNT (1))
FROM (SELECT p.projectestimateid
INNER JOIN projectestapplications p projectestimates PA
ON pa.projectestimateid = p.projectestimateid
AND pa.impacted = 1
INNER JOIN applicationsupproviders ASP.
ON asp.appid = pa.appid
INNER JOIN optionssupportproviders OSP
ON osp.providerid = asp.providerid
AND LOWER (TRIM (osp.provider)) = 'ibm - adm.
WHERE asp.providertypeid = 2
OR p.admvendornercid IS NOT NULL
UNION
SELECT p.projectid
PROJECT p INNER JOIN impactedgroups GI
ON ig.projectid = p.projectid
AND ig.impacted = 1
INNER JOIN optionsgroups og
ON ig.groupid = og.groupid
WHERE og.ibmtowerid IS NOT NULL)
WHERE projectestimateid = pe.projectestimateid) AS v_count
OF LEFT OUTER JOIN projectestimates project EP p
ON p.projectid = pe.projectid
INNER JOIN attcr.cr_detail ON pe.crid = cr.crid cr
LEFT OUTER JOIN attcr.cr_detail_reason r ON r.crid = cr.crid
LEFT OUTER JOIN attcr.site_lookup l ON l.lookupid =
r.crreasonid
WHERE (CASE
WHEN v_count = 0
THEN pe.estimatestatusid <>3
ELSE pe.projectestimateid (1, 2, 3)
END
)
PE.CRID AND IS NOT NULL) a
WHERE (CASE
WHEN v_count = 0
THEN pe.estimatestatusid <> 3
ELSE pe.projectestimateid (1, 2, 3)
END
)
You cannot use the CASE statement like this. Change your where clause like this.
WHERE (
(v_count = 0 and pe.estimatestatusid != 3) or
(v_count != 0 and pe.projectestimateid IN (1, 2, 3)
)
Tags: Database
Similar Questions
-
Problem with the case where the clause
Hello
I want to use cases in which clause. I wrote a very simple query to test how it works. However, I always got an error message. Here's what I did.
Select eid, firstname, lastname from employee where eid = 1 works fine
Select eid, name, name of the employee
where
cases where 1 = 1 then eid = 1
When 1! = 1 then eid = 2
end
I ORA-00905: lack of keyword.
Did I miss something?
Thank you
Jennifer
Hi, Jennifer.
Why do you want to use BOX in a WHERE clause? The wonderful thing about the CASE is that it allows you to do IF-THEN-ELSE logic. In a SELECT clause, or an ORDER BY clause, this is really useful, but the WHERE clause already allows you to use the IF-THEN-ELSE logic.
However, if you use the BOX in a WHERE clause, it is as it does nowhere else. Always BARGAIN instead of a single expression in a SQL data types. All the clauses THEN (and ELSE, if there is one) must return a single expression, such as the NUMBER. (There is no BOOLEAN data type in SQL). So, you can use a CASE statement like this:
...
CASES WHERE
WHEN 1 = 1 THEN 1
WHEN 1! = 1 THEN 2
END = eid
Here, the CASE expression takes the place of a NUMBER.
However, if I was not sure if 1 = 1 or not, I would write the condition in this way, without a CASE expression:
WHERE (1 = 1 AND eid = 1)
OR (1! = 1 AND eid = 2).
-
Case where the Condition when Clause Condition use
Hello
How can I use case in the where condition and in when I need to use a condition, be clearly
I need to get the following
When I run the present, I'm missing keyword error.and (case WHEN :PROMT = 'Closed' then status_date >= trunc(sysdate)) end)
How can I solve this?I think you can do it just like this:
... and ( :PROMPT != 'Closed' or status_date >= trunc(sysdate) ) ...
-
Hello
I want to use the case (or decode etc.) in which a part of sql.
I want to find the number of rows depending on where the conditions.
For example, I have a table b, d, e, p and s are fields of this table.
If the value of the field b is 1 then my condition clause that will be value fields d, e value fields
If the value of the fields of b is 2 then my condition clause where the declaration will be p field value < s value fields.
Select count (*) of A
where
(if b = 1 then) d, e
(if b = 2 then) p < s
How can I achieve this?where (b = 1 and d
-
Cases where the failure of the statement
Can anyone help, where I am doing mistake here
-case when "Sales Rep". "" Sales Rep name ' ('Michele Lombardo") then"core facts ". "" Recipes "= 0 otherwise
"Basic facts '." End of revenue. "
Thank you
Veera
Hello
Check this box...
-case when "Sales Rep". "" Sales Rep Name ' to ("Michele Lombardo") then 0 else 'basic facts '. "" End of the revenue.
-
cases where the declaration in decode
Hello
Here is an example with the CASE WHEN statement.
SELECT empno, ename, sal,
CASE
Sal WHEN BETWEEN 800 AND 1200
THEN "low wages".
Sal WHEN BETWEEN 1200 AND 2800
THEN "moderate Pay."
ELSE "higher pay".
END sal_report
EMP;
DECODE even can be a replacement for this scenario, but it can have for flexibility as the CASE may be.
Now, I want the equivalent code to DECODE.
Can someone help me please...
Thanks in advance,
Rami Reddy.Just to complete, here is the full replication CASE, according to what the OP has posted:
SELECT e.*, DECODE(ABS(SIGN(sal - 800) + SIGN(sal - 1200)), 2, DECODE(ABS(SIGN(sal - 1200) + SIGN(sal - 2800)), 2, 'Highest Pay', 'Moderate Pay'), 'Lowest Pay') p FROM apex.emp e ORDER BY sal;
-
Cases where the undo data generated
Other than the DML activities, what are the other cancellations of cases generated?Most of the DDL statements are translated into some update database dictionary (which means DML to tables SYS) and/or DML on the application tables: so DOF also generates Cancel.
-
Hi all
My job is: Loop While structure generates the signal for 4 seconds when you press the 'start build' button, after that data has been backed up. You press the button "generate the beginning' once again, and the loop runs one again.
My problem is: the first pressing, the loop, exactly 4 s (3, 999 s), but him second, third pressing on... The time elapsed is not 4 seconds, always smaller (even ~ s 0.003). The loop works correctly after press the "Exit" button and launch the program again.
How can I control exactly time loop work While Structure without the press "Exit".
Thank you any help!
P/S: I used the number of cycles (ms) just to look at a working time of the While loop.
NMCuong
This shows a quick solution
-
Hi guys, I'm not a developer oracle as such, but I'm trying to get some information from oracle to send to other systems of the company, since we are dealing with oracle HRMS as the master system for employee information.
In particular, we would like to create people in our training and the security system when they are created in oracle.
I was told that the oracle per_all_people_f object acts as a slowly changing dimension of type 2, where a person can have several versions, which only is always the current version and the current version can be retrieved using the standard parttern of "date of current between the effective start date and actual end date. So far so good.
However, I can see there are cases where the minimum 'effective_start_date' is greater than the current date. It is, indeed, equal to their start_date. I guess start_date represents "the first day of work" of the person.But this means then there is no "current" information known to people who have not yet really started working for the company again. This seems odd. How can I have someone for whom we have no information "currently correct? I was told that the effective_start_date of the line is automatically set to their "first day of work" date on which the information is entered into the system, IE, the user to enter information doesn't have the ability to say 'this is the current version of the data for that person, who starts at a date in the future. "
For this reason, I cannot know these new people (who have been entered in oracle, but did not have actually to their first day of work still) training system. But we would obviously get people established in related systems so that they can use all of these systems on their first day of work.
Have I misunderstood something here? How can there be no correct version for a person at the date and time?
Hello
How normally "inform you" the training system on a new person record? If it's a kind of report or an interface, it may be useful changed to examine a number of days in the future, for example
+ 7 It is important to understand when you look at an Oracle HRMS instance through enforcement (i.e. the ' front end'), you look at the data on a date date (of the session) - by default, the date is the system date, but it is possible for a user to change this date to be in the future or the past as they see fit. The ability to implement the records in person in the future is a great feature to have, of course, but it must be understood that in this situation, at the date of the day the person's file logically does not exist yet from the point of view of the MFC features. Behind the scenes, however, in the per_all_people_f of the table, the line exist. Similarly, future update of changes to a person (e.g. marital status from Single to married) could be implemented, and the change in status would be visible if the session has been scheduled on a date or after the date of the marriage. As correctly observe you, behind the scenes, the table will hold all historic entries for this person_id with contiguous effective_start_date and effective_end_date beaches.
Either way, date_start value is not related to as such hiring date; It is actually the value of effective_start_date earlier for the person_id. All changes, regardless of how many or what the effective_start_date is in each case, will always carry this same start_date value. It * may * be identical to the hiring date (certainly the fact that you configure their hire date person records would cause that), but if the person has been created as a postulant effective from 1 September and was then hired has effect from 21 September, column start_date value would be still 1 September. The record of the person would be visible when the current date is on or after this date - the only difference is that they show that an employee until the 21st.
I hope this helps, but it is possible, that I just confused you more!
Clive
-
Hi all
I posted the question about CASES where the condition. It is one of the changes.
The first condition was, if the Individual is 01 extraction then all the values of the table where the column of FLG = 'Y '. If the Individual is 02 and then extract all the values of the table where the column of FLG = ' no or NULL. Here, INDI is the setting.
Select count (*) from cntl
XYZ
where NVL(FLG,'N') = decode(INDI,'01','Y','02','N');
Now the chnages is, if the Individual is 01 and then extract all the values in the table where FLG colum = 'Y '. If the Individual is 02 and then extract all the values in the table, including ('Y', ' n, NULL). no need to put the filter of the FLG columns in which contion.It's not just...
select count(*) into cntl from xyz where NVL(FLG,'N') = decode(INDI,'01','Y','02',NVL(FLG,'N'));
Or shorter:
select count(*) into cntl from xyz where NVL(FLG,'N') = decode(INDI,'01','Y',NVL(FLG,'N'));
If you are happy for 01 retreat flg of Y and any other value fold everything.
Published by: BluShadow on June 3, 2009 12:31
-
I have windowsimagebackup folder where I want to restore the file. This is not the case in the menu catering
Hello
see if this information helps you
How to make a backup of your data
http://www.vista4beginners.com/how-to-backup-your-data
How to restore your files
http://www.vista4beginners.com/how-to-restore-files
the 1st link below is how do the backup complete pc
http://www.bleepingcomputer.com/tutorials/tutorial145.html
and that is how do to recover the backup complete pc
http://www.bleepingcomputer.com/tutorials/tutorial144.html
and here is the information of microsoft in restoring a system image backup
http://Windows.Microsoft.com/en-us/Windows-Vista/restore-your-computer-from-a-system-image-backup
If you have problems, it's in here is a forum for microsoft specifically for backup issues
http://social.technet.Microsoft.com/forums/en-us/WindowsBackup/threads
-
problem of installing active sync 6.1 64-bit with active sync. you have a known issue with the compatibility. you have a work around where the way to get these two together?
-
If the case change the ip address change active directory Microsoft that this issue face our windows network.
as matter
1. any client machine ip address change.Hi Andrew,
The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.
http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer
Hope this information is useful.
-
Need all the data in the case where if I pass null
Oracle 10 g version
Hi gurus
I appreciate if someone help out me.
Examples of data
as with a reference
(
Select 'AAA' crt_file, 'A1' scode of union double all the
Select 'AAA' crt_file, 'A2' from dual union all
Select "AAA" crt_file, null of union double all the
Select 'BBB' crt_file, 'A1' scode of union double all the
Select 'BBB' crt_file, 'A2' from dual union all
Select 'BBB' crt_file, the double null)
Select * reference
where crt_file = "AAA".
and nvl (scode, 'x') = nvl (& s_cd, 'x')
;Rule result
I need to extract the result as in & s_cd and it works very well.
but in case where if I put a value zero in & s_cd my query should return all data related to "AAA", something like below:
Result if I pass NULL to & s_cd that then it shows all the results
CRT_FILE, SCODE
AAA A1
AAA A2
AAA
Concerning
Mitt
as with a reference
(
Select 'AAA' crt_file, 'A1' scode of union double all the
Select 'AAA' crt_file, 'A2' from dual union all
Select "AAA" crt_file, null of union double all the
Select 'BBB' crt_file, 'A1' scode of union double all the
Select 'BBB' crt_file, 'A2' from dual union all
Select 'BBB' crt_file, the double null
)
Select * reference
where crt_file = "AAA".
and (scode = & s_cd and & s_cd is null)
-
How can I activate Technicon in adobe elements first 13? I can see it running in the Manager of tasks as elementsautoanalyzer13.exe but didn't interrupt the process in the case where he assigned to the program. There must be a way inside the adobe program to turn off because I turned it on by clicking with the right button on an image in the editor of the first, and then when you are prompted, he said he would run in the background and I said okay, now I can't stop it! . It appears in earlier versions of first items under Edit-> Preferences-> media analysis you could uncheck it to turn it off. But there is only a media section and in this tab, there is no automatic Analyzer to be seen. Thanks in advance for any advice
Rebeccah
What computer operating system? You are in the first elements 13/13.1 editor preferences or in organizing elements 13/13.1 preferences?
Where are you looking for in organizing elements 13/13.1 that you do not see Edit Menu/preferences /-media analysis that you do not see the options of AutoAnalzyer.
Organizing elements 13/13.1 preferences...
Please point out where you find a command to run AutoAnalzyer in the background in 13/13.1. If I right click a file, I see AutoAnalzyer perform what seems to be a time run command automatic Analyzer of a file.
Please specify.
Thank you.
RTA
Maybe you are looking for
-
The last time that I downloaded the latest version of firefox that all my favorites have been removed. I don't want to download the latest version - please help
-
How to convert .smi .dmg in El Capitan
I downloaded the system 7 in the .smi (System 7.0.1.smi) format image file and I found no way to mount it or convert it to dmg. Disk utility doesn't support .smi conversion to the current version. Are there other ways of "extract"? Thank you in advan
-
No sound after the s7530n pavilion slimline for Windows 7 RC1 upgrade
I know that Windows 7 is still in version final candidate and so is not taken in charge by Wells, anyone, but I've seen some people have luck on this forum so I'm him kicking. I have a HP slimline s7530n Pavilion that came with Windows XP Media Cente
-
I want to watch videos from amazon to my MacBook Air on my HDMI TV. What do I need?
I want to watch videos from Amazon/Netflix etc on my HDMI TV. What type of cable/connector do I need?
-
Controller 360 set up blocked Due to compatibility
OK, so I went out and bought a 360 controller for my computer, but when I go to install the software, I get this error message. This problem is blocked due to compatibility issues Program: Microsoft Xbox 360 accessories Publisher: Microsoft Corporati