IIF and Oracle [message #443904] |
Thu, 18 February 2010 00:05 |
aijaz786
Messages: 91 Registered: February 2010
|
Member |
|
|
I will appreciate if someone could transform this MS Access syntax in Oracle 10g format.
I checked the postings but I did not find any specific sol.
IIf([No_of_files] Between 1 And 10 And [Timedur] Between 1 And 30,Yes,IIf([No_of_files] Between 11And 3 And [Timedur] Between 1 And 60,Yes,No)) TestField
Thanks
|
|
|
|
|
|
|
|
|
Re: IIF and Oracle [message #443925 is a reply to message #443920] |
Thu, 18 February 2010 00:45 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
In general, people are unwilling to do other people's work for them, especially if the one requesting it does not show any sign of what (s)he did or tried him/herself.
Show us what you tried so far and where you got stuck. We will help you out waaay faster than when you just demand others to do it for you.
|
|
|
Re: IIF and Oracle [message #443928 is a reply to message #443904] |
Thu, 18 February 2010 00:50 |
aijaz786
Messages: 91 Registered: February 2010
|
Member |
|
|
I tried the following
decode(((No_of_Physical_files between 1 and 500) and (uploaddurationdw between 1 and 30)),'YES',
decode((No_of_Physical_files between 1 and 500) and (uploaddurationdw between 1 and 30)),'YES','NO') WithinTargetRange
or
CASE WHEN (No_of_Physical_files between 1 and 500) and (uploaddurationdw between 1 and 30)
THEN 'YES' END as WithinTargetRange,
CASE WHEN (No_of_Physical_files between 501 and 3000) and (uploaddurationdw between 1 and 180)
THEN 'YES END as WithinTargetRange
ELSE 'NO' as WithinTargetRange
END
Not working.
|
|
|
Re: IIF and Oracle [message #443939 is a reply to message #443928] |
Thu, 18 February 2010 01:23 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
You have too many 'end's in your block. Here's a hint, end comes at the ... end. You are only trying to create a single column. Therfore, ony one "as WithinTargetRange" is necessary.
Think
case when condition then value
when condition then value
when condition then value
else vale
end as name
[edit: PS "Not working" is not a valid error in Oracle. Try in future to give more useful information]
[Updated on: Thu, 18 February 2010 01:25] Report message to a moderator
|
|
|
|
|
|
Re: IIF and Oracle [message #677196 is a reply to message #677192] |
Thu, 29 August 2019 13:31 |
|
Michel Cadot
Messages: 68728 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Welcome to the forum.
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
If you don't know how to format the code, learn it using SQL Formatter.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
Also always post your Oracle version, with 4 decimals, as solution depends on it.
With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
Explain why the previous replies don't answer your issue.
[Updated on: Thu, 29 August 2019 13:32] Report message to a moderator
|
|
|
Re: IIF and Oracle [message #677197 is a reply to message #677192] |
Thu, 29 August 2019 13:39 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
The correct solution, based on tge small amount of information that you have posted, is... Don't.
Use a case expression.
|
|
|
Re: IIF and Oracle [message #677246 is a reply to message #677197] |
Thu, 05 September 2019 13:05 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
case
when [No_of_files] Between 1 And 10 And [Timedur] Between 1 And 30)
( ([No_of_files] Between 11And 3 And [Timedur] Between 1 And 60) then
'Yes'
else
'No'
end
I leave to you to figure out how to determine the time duration and the number of files
[Updated on: Thu, 05 September 2019 13:06] Report message to a moderator
|
|
|
Re: IIF and Oracle [message #677257 is a reply to message #677192] |
Fri, 06 September 2019 08:32 |
|
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
Instead of reviving and hijacking a nine-year-old thread you should start your own, even if the subject is the same.
AND WRITING IN ALL CAPS COMES ACROSS IN THE PRINTED WORD AS SHOUTING!
|
|
|