Help to decode/case
Hi all
Can I use function decode/inner carton of a decoding function?
{code}
SELECT TO_CHAR)
() EDMS_STRAGG_WC
DISTINCT DECODE)
EQS.attrib_code,
'PRODUCT_AUTHORIZATION', ' permission: '
|| CASE eqs.qual_value
WHEN "LIST".
THEN
(SELECT lookup_desc
OF edmsadm.edms_lookup
WHERE lookup_type =
'PARTNER_AUTHORIZATION '.
AND lookup_code =
EQLS.list_value)
ON THE OTHER
(SELECT lookup_desc
OF edmsadm.edms_lookup
WHERE lookup_type =
'PARTNER_AUTHORIZATION '.
AND lookup_code =
EQS.qual_value)
END,
'PRODUCT_CERTIFICATION', ' Certification: '
|| CASE eqs.qual_value
WHEN "LIST".
THEN
EQLS.list_value
ON THE OTHER
EQS.qual_value
END,
'PRODUCT_SPECIALIZATION', ' specialization: '
|| (SELECT lookup_desc
OF edmsadm.edms_lookup
WHERE lookup_type =
'PARTNER_SPECIALIZATION '.
AND lookup_code =
CASE eqs.qual_value
WHEN "LIST".
THEN
EQLS.list_value
ON THE OTHER
EQS.qual_value
END)))
program_value
Of edms_qual_stg EQS edms_qual_list_stg eqls
WHERE 1 = 1
AND eqs.qual_id = eqls.qual_id (+)
AND eqs.req_id = 192647
AND eqs.disc_line_id = 598631
AND IN eqs.attrib_code
("PRODUCT_CERTIFICATION",
"PRODUCT_AUTHORIZATION,"
"PRODUCT_SPECIALIZATION");
{code}
Edms_qual_stg:
AND_OR_CONDITION
ATTRIBUTE_SOURCE
ATTRIB_CODE
CREATED_BY
CREATED_DT
DISC_LINE_ID
END_DT
EXCLUDE_INCLUDE
GROUP_AND_OR_CONDITION
GROUP_CODE
MAX_VALUE
MIN_VALUE
MODIFIED_BY
MODIFIED_DT
QUAL_APPL_PRECEDENCE
QUAL_ID
QUAL_OPERATOR
QUAL_TYPE
QUAL_VALUE
REQ_ID
START_DT
Edms_qual_list_stg:
ATTRIBUTE_SOURCE
ATTRIB_CODE
CREATED_BY
CREATED_DT
END_DT
INCLUDE_AFFILIATES
INCLUDE_EXCLUDE
LIST_VALUE
MODIFIED_BY
MODIFIED_DT
PRIMARY_PARTY
QUAL_ID
QUAL_LIST_ID
REFERENCE_ID
START_DT
Edms_lookup:
CREATED_BY
CREATED_DT
DISPLAY_SEQ
EDMS_LOOKUP_ID
END_DATE
LOOKUP_CODE
LOOKUP_DESC
LOOKUP_REFERENCE
LOOKUP_TYPE
MODIFIED_BY
MODIFIED_DT
START_DATE
SELECT eqs.qual_id, eqs.disc_line_id, eqs.req_id, eqs.attrib_code, eqs.qual_value, eqls.list_value
Of edms_qual_stg EQS edms_qual_list_stg eqls
WHERE 1 = 1
AND eqs.qual_id = eqls.qual_id (+)
AND disc_line_id = 598631
AND req_id = 192647
AND IN eqs.attrib_code
("PRODUCT_CERTIFICATION",
"PRODUCT_AUTHORIZATION,"
"PRODUCT_SPECIALIZATION");
7509575 598631 192647 PRODUCT_CERTIFICATION LIST
7509575 598631 192647 PRODUCT_CERTIFICATION SILVER LIST
7509576 598631 192647 PRODUCT_AUTHORIZATION ATP - JOULEX ESCO PROVIDER LIST
7509576 598631 192647 PRODUCT_AUTHORIZATION ATP - JOULEX PROVIDER LIST IDENTIFY
7509577 598631 192647 PRODUCT_SPECIALIZATION LIST ADVANCED SECURITY
7509577 598631 192647 PRODUCT_SPECIALIZATION LIST EXPRESS FOUNDATION
Power required:
Certification: GOLD, SILVER, authorization: - JOULEX PROVIDER ESCO, ATP - ATP JOULEX PROVIDER IDENTIFIER, SPECIALIZATION: SECURITY ADVANCED, EXPRESS FOUNDATION.
THX
Rod.
Hello
Of course; an expression to DECODE or CASE that returns a NUMBER can be used anywhere a NUMBER is provided, including within another expression to DECODE or CASE. A DECODE or CASE expression that returns that a DATE can be used almost anywhere, a DATE is scheduled, including within another expression to DECODE or CASE. An expression to DECODE or CASE that returns that a VARCHAR2 can be used almost anywhere a VARCHAR2 is scheduled. (There are a few situations where it is absolutely a string literal).
There are not many situations where you really need to do this, however. It is generally simpler and more effective to use a simple CASE expression; nesting is seldom necessary.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Explain, using specific examples, how you get these results from these data.
Simplify the problem as much as possible, so that it contains only enough to show the part you don't already know how.
If you really need a user-defined function to show the problem, and then include a CREATE FUNCTION statement to explain what the function. Yet once again, simplify: If the function is not what you do not understand, post a problem that does not use the service.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002
Tags: Database
Similar Questions
-
Hi, I would like to get the same result by using the DECODE function instead of the CASE statement. I have a little an attempts but does not succeed. If anyone can help. Thank you
{code}
with t as)
Select 'Fees' rule, null as product, null as double union adjustment
Select "Wo", null, 1 double Union
Select "Chrg", 1, null from dual
) select
t.*,
cases where the product is null and adjustment is null then "Late fees".
When the product is null and the fit is not not null then 'settings '.
When the product is not null and adjustment is null then 'product_charges '.
otherwise null end as a result
t -;
{code}
Hello
ricard888 wrote:
Hi, I would like to get the same result by using the DECODE function instead of the CASE statement. I have a little an attempts but does not succeed. If anyone can help. Thank you
{code}
with t as)
Select 'Fees' rule, null as product, null as double union adjustment
Select "Wo", null, 1 double Union
Select "Chrg", 1, null from dual
) select
t.*,
cases where the product is null and adjustment is null then "Late fees".
When the product is null and the fit is not not null then 'settings '.
When the product is not null and adjustment is null then 'product_charges '.
otherwise null end as a result
t -;
{code}
Why do you want to DECODE? CASE is much simpler and more effective in this situation.
Would you consider using NVL2 instead of DECODING or CASE?
Using NVL2:
NVL2 (product
NVL2 (adjustment
NULL
, "product_charges".
)
NVL2 (adjustment
, "Settings".
'Cost of delay. "
)
)
With the help of DECODE, but not NVL2:
DECODE (product
, NULL, DECODE (adjustment
, NULL, "late fees".
, "Settings".
)
DECODE (adjustment
, NULL, "product_charges".
NULL - value by default. Optional
)
)
-
Hello
Can someone write me help to decode for conditional and not in the event
If substr (branch,-2, 2) = '00'
= 'N'
ELSE IF BW_SRC_TBL = 'Ease' AND the branch is present in the PS_UNDRAWN_GL_EXCEPTION table, then = ' don't
On the other
« Y »Hello
A good example of why do you use CASE:
NVL ( DECODE ( SUBSTR (branch, -2) , 'N' , DECODE ( bw_src_tbl , 'Facility', DECODE ( SIGN (( SELECT COUNT (*) FROM ps_undrawn_gl_exception WHERE branch = m.branch -- m refers to main query )) , 1 , 'N' ) ) ) , 'Y' )
-
I'm almost embarrassed to ask this, but my sql skills have not only maintained since 8i!
I know I could write a procedure and put the data into a temporary table, but I should really get with the program and learn a few new features!
using select wo_num, g_start, g_end of batch
I have a line returned from a table as follows
WO_NUM G_START G_END
________ ________ ______
1000000 100 105
To select a tuition assistance, that I would like to turn
WO_NUM G
________ ____
1000000 100
1000000 101
1000000 102
1000000 103
1000000 104
1000000 105With the clause type, 10g
WITH t AS (SELECT 1000000 wo_num, 100 g_start, 105 g_end FROM DUAL) SELECT wo_num, rn g FROM t model return updated rows partition by (wo_num) dimension by (1 rn) measures( G_START, G_END ) ( G_START[for rn from G_START[1] to G_END[1] increment 1]=cv(rn)); WO_NUM G ---------- ---------- 1000000 100 1000000 101 1000000 102 1000000 103 1000000 104 1000000 105 6 rows selected.
And connect
WITH t AS (SELECT 1000000 wo_num, 100 g_start, 105 g_end FROM DUAL) SELECT wo_num, g_start + LEVEL - 1 G FROM t CONNECT BY LEVEL <= g_end - g_start + 1; WO_NUM G ---------- ---------- 1000000 100 1000000 101 1000000 102 1000000 103 1000000 104 1000000 105 6 rows selected.
Published by: Salim champion 2009-05-07 06:34
-
Please help - spell decoder problem
Hello
I have problems with an assignment for a segment of decoder display 7 in hexadecimal. Everthing works except when I get 0010 binary which should display the number 2 on the 7 segment display I get a light on the segment f. I checked all my doors and Karnaugh maps on the multisim circuit, but could not find the error. I have attached the file if someone has the time to take a look. Thanks for any help or advice you can give me.
Doorway AND U42 is BA'. You want this '. See attachment.
Digital guy
-
Tag RAM, can someone help to decode?
Hello! I don't know if I should post here or on the surface of the RAM, but the last time I posted here, someone suggested I have move here, anyway.
I currently have a R5 Aurora with 2 x 4 GB ram sticks and want to add another 4 GB now and maybe another again.
I was wondering what the SCS and schedules are on the current sticks, I arrived, so I jumped my computer open and took a quick glance, it comes to the label that was on one of the sticks, now that I think, that the other could have had another, anyone knows if he would?
Anyway, ther anyway to find the latency CASE and others of the label?
Thank you, Saucybagel.
Discovered how it works, it turns out that there's a company called hynix which makes this RAM, they got a pdf file that you can use to decode the HMA code, here is the link for anyone else who is curious.
his virtue ddr4 module.
See you soon! Saucybagel.
-
I need help replacing my case on a Slimline fan.
I recently bought a HP Pavilion Slimline s5 - 1070t. I am running Windows 7 64 bit.
After several conversations with tech supports, the problem I have is a defective case fan. Rather than giving for repair of "bench" that will take nearly 2 weeks during the holidays, I want to replace it myself. My problem is that I can't find any specs on the fan to know what to buy (I know I can remove the one installed, but prefer to do all the material stuff at some point). I went through the HP part surfer and found the part number (646679-002 system fan-9225 mm, Stargell changed), but I can't find it via a google search.Suggestions as to what I should buy? I use the computer for office and photo applications.
Thanks in advance for your help.
Al, welcome to the forum.
I studied intensively a source for the fan. There is no other that be bought in the United Kingdom. You may have to send the computer to HP. Unless, that is, you can find another fan with the right connector on it. This may be difficult, however.
-
Oracle PL/SQL using decode/case in the subquery
SELECT DISTINCT E.ACC_ID,
P.EFFECTIVE_DATE,
P.UPDATE_DATE
(CHOOSE abc.def table in case RECON_ACC.partition_id is 1 for this acc_id
abc100.def if RECON_ACC.partition_id 2 table for this acc_id
) p
JOIN IN-HOUSE
(select * from RECON_ACC where id_partition is NOT NULL) e
ON P.ACC_ID = E.ACC_ID
AND TRUNC (P.UPDATE_DATE) > = December 31, 13 '
AND TRUNC (P.UPDATE_DATE) < = 2 January 14 ';Can someone help me to do a SQL query to do this?
Hello
If you had only a table of def, then it would be easy
. You need only a simple join, like this:
SELECT ud.acc_id, ud.effective_date, ud.update_date
Of unified_def ud
JOIN recon_acc r ON ra.partition_id = ud.partition_id
AND ra.acc_id = ud.acc_id - can - be
;
The only problem here is that you have 2 separate tables def. Assistance from the UNION, you can create a result set that makes these 2 tables appear as 1; for example:
WITH date_range AS
(
SELECT TO_DATE (November 1, 2013 00:00:00 ', 'HH24:MI:SS of Mon-DD-YYYY') AS first_date
, TO_DATE (November 20, 2013 23:59:59 ', 'HH24:MI:SS of Mon-DD-YYYY') AS last_date
OF the double
)
unified_def AS
(
SELECT d1.effective_date, d1.update_date, d1.acc_id
1 AS id_partition
To abc_def d1
JOIN date_range r1 WE d1.update_date BETWEEN r1.first_date
AND r1.last_date
UNION ALL
SELECT d2.effective_date, d2.update_date, d2.acc_id
2 AS id_partition,
Abc100_def D2
JOIN date_range r2 WE d2.update_date BETWEEN r2.first_date
AND r2.last_date
)
SELECT ud.acc_id, ud.effective_date, ud.update_date
Of unified_def ud
JOIN recon_acc r ON ra.partition_id = ud.partition_id
AND ra.acc_id = ud.acc_id - can - be
;
I called def small tables abc_def and abc100_def, just so I wouldn't have to create new patterns. Replace your real names when you run this.
I added the subquery date_range as a means of conveying the date settings. You can do something else, bind variable may be.
I guess just in between the recon_acc and other tables join conditions. Do you still need recon_acc at all with this problem?
Once more, this problem only occurs because you have 2 separate tables def. Why you store your data in a way that creates problems? Is there a reason why you can't use only 1 table unified_def?
-
get updated with the help of decode error
Hi gurus,
Your help is greatly appreciated.
IAM seen to deliver to decode using the below the update statement.
Can someone please help what Miss me here.
varSTMT: = "UPDATE PROD. PROCESS_COUNTER ';
varSTMT: = varSTMT | "SET LAST_COUNT_ADDED =" decode ('(change_date) trunc, trunc (sysdate), last_count_added + 1, 1) "';
varSTMT: = varSTMT | "WHERE NOM_PROCESSUS ="DAILY_FILE"';We know don't no what should look like your update statement, but the quotes are really'm. Assuming that update should be:
UPDATE PROD. PROCESS_COUNTER SET LAST_COUNT_ADDED = decode (trunc (change_date), trunc (sysdate), last_count_added + 1, 1) WHERE nom_processus = 'DAILY_FILE. '
change:
varSTMT: = varSTMT | "SET LAST_COUNT_ADDED =" decode ('(change_date) trunc, trunc (sysdate), last_count_added + 1, 1) "';
TO
varSTMT: = varSTMT | ' SET LAST_COUNT_ADDED = decode (trunc (change_date), trunc (sysdate), last_count_added + 1, 1)';
SY.
-
Need help to decode javascript tag for the release of HTML5.
Hi all
I'm working on a project in Adobe captivate 7 64 bit which consists of approximately 500 slides with most of the slides in text and image. The problem that I face is very unusual that I guess I'm the first to discover (according to my searches on google and the forums). So, after I publish my project the output works very well in html (local and online) BUT when I run index.html (i.e., out of HTML5) the course is not running and the screen is blank.
After spending a week on the search online and using the strategy of trail and error, I was able to know that it was the text of the URL "F:\usrnew\purchase" placed in the middle of the course which caused damage of all. However, the url has been removed and the project has been submitted.
After extra time, I discovered that the "\u" letter which is a JavaScript tag was causing the problem for the release of HTML5. I don't really know much to script, but discovered that the tag can be decoded using a programming strategy. Now, this is where my knowledge comes from a standby and needs a lift from you guys.
Any ideas, help, sharing of knowledge would be very useful to me and all who could deal with this problem in the future.
Looking forward for your point of view.
Kind regards
Mirza
Voila! The problem is resolved.
Solution: Change the single slash "------" to a double slash "\".
See you soon,.
Mirza
-
With the help of the Case clause with clause type
Hello PL SQL gurus
I used a few scripts I found on these forums to create an amortization of mortgage statement. What I'm trying to accomplish is to get the script to run a calculation or use a value in a table based on the value in this table.
Here are two tables:
CREATE TABLE mortgage_facts (customer VARCHAR2 (20), result VARCHAR2 (20),)
quantity NUMBER (10.3));
INSERT INTO mortgage_facts VALUES ('Smith', 'Ready', 131828.81);
INSERT INTO mortgage_facts VALUES ('Smith', 'Annual_Interest', 3,348);
INSERT INTO mortgage_facts VALUES ('Smith', 'Payments', 72);
INSERT INTO mortgage_facts VALUES ('Smith', 'PaymentAmt', 0);
Mortgage of CREATE TABLE (customer VARCHAR2 (20), pmt_num, no.4, principalp NUMBER (10.3), interestp NUMBER (10.3), mort_balance NUMBER (10.3));
INSERT INTO mortgage VALUES ('Smith', 0, 0, 0, 131828.81);
If the value in the mortgage_facts table is zero, I want the script runs a calculation to be used in a MODEL clause. If it is not zero, I would use this value instead of the calculation. Here is the script I am getting an error on (I have bolded the part in question):
SELECT c, p, to_char (round(m,2), 'fm$ 9999999.00') principal_balance,
TO_CHAR (Round(pp,2), 'fm$ 9999999.00') towards_principal,
TO_CHAR (Round(IP,2), 'fm$ 9999999.00') towards_interest,
TO_CHAR (Round(MP,2), 'fm$ 9999999.00') monthly_payment
MORTGAGE COMPANY
MODEL - see 1
IGNORE THE NAV
REFERENCES R ON
* (SOME customers, fact, amt - see 2 *)
FROM mortgage_facts
* MODEL SIZE (customer, done) MEASURES (amount amt) - see 3 *.
REGULATION SEQUENCE
*(*
CASE WHEN mortgage_facts.fact = 'PaymentAmt' AND mortage_facts.amt = 0 THEN
*(*
* amt [ALL, 'PaymentAmt'] = mortgage_facts.amt*
*)*
ON THE OTHER
*(*
* amt [everything, "PaymentAmt"] = (amt [CV (), "Ready"] *)
* Power (1 + (amt [CV (), 'Annual_Interest'] / 100/12), *)
(* AMT [CV (), 'Payments']) *.
(* AMT [CV (), 'Annual_Interest'] / 100/12)) / *.
* (Power (1 + (AMT [CV (), 'Annual_Interest'] / 100/12), *))
(* AMT [CV (), 'Payments'])-1) *.
*)*
END
*)*
*)*
SIZE OF (customer cust, made) measures (amt)
Amortization of PRINCIPAL
PARTITION BY (customer c)
DIMENSION (p) 0)
MEASURES (pp, interestp ip principalp, mort_balance m, mc, mp 0 customer)
REGULATION SEQUENCE
ITERATE (1000) UP TO (ITERATION_NUMBER + 1 =
r.AMT [MC [0], 'Payments'])
(ip [ITERATION_NUMBER + 1] = m [CV () - 1] *)
r.AMT [MC [0], 'Annual_Interest'] / 1200,.
MP [ITERATION_NUMBER + 1] = r.amt [mc [0], "PaymentAmt"],
pp [ITERATION_NUMBER + 1] = r.amt [mc [0], 'PaymentAmt']-ip [CV ()].
m [ITERATION_NUMBER + 1] = m [CV () - 1] - pp [CV ()]
)
ORDER BY c, p
Any help is very appreciated. Thank you!!OK, here we go, go with the iterative model:
select * from mortgage_facts model partition by (Customer) dimension by (1 p) measures(loan, payments, INTEREST, PAYMENTAMT, INTERESTPMT, PRINCIPALPMT, balance) rules iterate(1e9) until (iteration_number+2 >= payments[1]) (loan[iteration_number+2]=loan[1] ,payments[iteration_number+2]=cv(p)-1 ,interest[iteration_number+2]=interest[1] ,paymentamt[iteration_number+2]=ROUND( (LOAN[1] * (INTEREST[1]/12/100)*Power((1+INTEREST[1]/12/100), PAYMENTS[1])/(Power((1+INTEREST[1]/12/100),PAYMENTS[1])-1)), 2) ,INTERESTPMT[iteration_number+2]=round(balance[cv(p)-1]*interest[1]/1200, 2) ,PRINCIPALPMT[iteration_number+2]=paymentamt[cv()]-INTERESTPMT[cv()] ,balance[iteration_number+2]=balance[cv()-1]-PRINCIPALPMT[cv()] ) CUSTOMER P LOAN PAYMENTS INTEREST PAYMENTAMT INTERESTPMT PRINCIPALPMT BALANCE Smith 1 131828.81 72 3.348 0 0 0 131828.81 Smith 2 131828.81 1 3.348 2023.55 367.8 1655.75 130173.06 Smith 3 131828.81 2 3.348 2023.55 363.18 1660.37 128512.69 Smith 4 131828.81 3 3.348 2023.55 358.55 1665 126847.69 Smith 5 131828.81 4 3.348 2023.55 353.91 1669.64 125178.05 Smith 6 131828.81 5 3.348 2023.55 349.25 1674.3 123503.75 Smith 7 131828.81 6 3.348 2023.55 344.58 1678.97 121824.78 Smith 8 131828.81 7 3.348 2023.55 339.89 1683.66 120141.12 Smith 9 131828.81 8 3.348 2023.55 335.19 1688.36 118452.76 Smith 10 131828.81 9 3.348 2023.55 330.48 1693.07 116759.69 Smith 11 131828.81 10 3.348 2023.55 325.76 1697.79 115061.9 Smith 12 131828.81 11 3.348 2023.55 321.02 1702.53 113359.37 Smith 13 131828.81 12 3.348 2023.55 316.27 1707.28 111652.09 Smith 14 131828.81 13 3.348 2023.55 311.51 1712.04 109940.05 ....
-
With the help of DECODE in WHERE clause
Hi, I have a query which goes like this but does not work:
{
SELECT NVL (SUM (NVL(r.cload,0) * NVL(r.duration,0)), 0)
IN saidi_sum_trip_caused_by
SPM_REL_IND_TMP r
WHERE substr(r.scode_trip_caused_by,6,4) in ('N001', 'N002', 'N003', 'N004', 'N005', "N006", "N007")
AND (r.cload 0 GOLD r.cload IS NOT NULL)
AND DECODE (R.CLASSIFICATION_TRIP, 't', r.duration < = 5,)
r.Duration > 5);
}
It seems that there is a problem with my DECODE statement since I've noticed that when you use the DECODE function, a column is assimilated before the DECODE. However, in this case I can't equate the value of r.duration for DECODING since if the value of R.CLASSIFICATION_TRIP is ' t "then I should use < = I use >." How can I go about it? I tried to post in the forums of PL/SQL, but I think that very few people access this area. I get answers faster from here. Thank you.Fact
-
NULL in decode &; case
How to DECODE is able to detect the NULL and not CASES... as below
SQL > SELECT DECODE (NULL, NULL, 'NULL', 'NOT NULL') x
2 DOUBLE
3;
X
----
NULL VALUE
Elapsed time: 00:00:01.50
SQL > SELECT NULL CASE
2. WHEN NULL THEN 'NULL '.
ELSE 'ELSE' END x 3
4 DOUBLE
5;
X
----
ON THE OTHER
Elapsed time: 00:00:01.55
Kind regards
RKyou forgot to compare the value to null with the null value
as
SELECT CASE WHEN NULL is NULL THEN 'NULL' ELSE 'ELSE' END x FROM dual
-
Hello
I want to create a function box where column2 is based on the value of Column1.
For example, the table below
On the underside, I would ask something like
Select status, description, l3_days, (case when status = 'Open' and DEV_DAYS = null THEN L3_DAYS = 'LOGIN_DATE-SYSDATE' WHAT status = 'open' and DEV_DAYS! = NULL THEN DEV_DAYS = L3_DAYS ELSE LOGIN_DATE-L3_DAYS-SYSDATE, DEV_DAYS END)
Not sure so clearly. Basically, I want to L3_DAYS and DEV_DAYS to be updated automatically based on the login_date. I plan to add a DEV_START_DATE column, which would facilitate the calculation of DEV_DAYS
In any case I want to know how to write a case function, where denotes Column1 Column2?
Thank you
There are two CASE statements like this
select status , description , case when status = 'Open' and dev_days is null then LOGIN_DATE-SYSDATE else l3_days end l3_days , case when status = 'Open' and dev_days is not null then LOGIN_DATE-L3_DAYS-SYSDATE else dev_days end dev_days
If this isn't what you are looking for you need to explain your best condition. Provide a CREATE TABLE script and INSERT a TABLE for examples of data and provide a few example expected output.
Also please read Re: 2. How can I ask a question on the forums?
-
Help in the CASE statement with amount
Hello Experts
I amw Group on
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
I'm unable to solve this Case statement.
My requirement is that if the value of the attribute is greater than 50, then add 1 to the sum for attribute 4 the sum should be 4
WITH T AS
(
Select MATH_CONV_SCR 70, 68 MATH_PERC, writ_conv_scr 66, 67 writ_per Union double all the
Select MATH_CONV_SCR 70, MATH_PERC 48, writ_conv_scr 66, 67 writ_per Union double all the
Select MATH_CONV_SCR 70, 68 MATH_PERC, writ_conv_scr 66, 67 double writ_per
)
(
Select)
CASE
WHEN MATH_CONV_SCR > 50 THEN 1
WHEN MATH_PERC > 50 THEN 1
WHEN WRIT_CONV_SCR > 50 THEN 1
WHEN WRIT_PER > 50 THEN 1
TOTAL END)
T
)
The expected answer is
4
3
4
for the respective folders
Please give me the solution
Thank you
RBHello
Rb2000rb65 wrote:
Hello ExpertsI amw Group on
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production...
Thanks for posting the version and sample data; It is very useful.
... Select)
CASE
WHEN MATH_CONV_SCR > 50 THEN 1
WHEN MATH_PERC > 50 THEN 1
WHEN WRIT_CONV_SCR > 50 THEN 1
WHEN WRIT_PER > 50 THEN 1
TOTAL END)
TDon't forget that the WHEN of a CASE expression clauses are mutually exclusive. If none of them are evaluated to TRUE, then all of the following are not even tried.
)
The expected answer is
4
3
4
for the respective foldersPlease give me the solution
Here's one way:
SELECT CASE WHEN math_conv_scr > 50 THEN 1 ELSE 0 END + CASE WHEN math_perc > 50 THEN 1 ELSE 0 END + CASE WHEN writ_conv_scr > 50 THEN 1 ELSE 0 END + CASE WHEN writ_per > 50 THEN 1 ELSE 0 END AS total FROM t;
Maybe you are looking for
-
Playing World Golf Tour of WGT, the window of the game client will not settle by the typical click & drag operation. It opens the window, fill half the area of the screen and clicking on it to fill the window results making him as if he wants to go b
-
monitor display problem - says he will sleep when it is turned on.
Problem: the original title screen Turning on my computer - screen trying to start up then he said monitoring sleep - he brought once but the screen was skewed. my monitor is fine - I have it plugged into another computer and it works fine. would i
-
What is the slot under the battery
Just got my new T400 yesterday and was very excited about it. have a question here. I noticed a place where the mental battery seven pines touch laptop, in virtue of this place, there is a small plastic film with a similar size to a micro-sd card ca
-
Whenever I try to put my time at the time of the computer, using the sync thing, it says that an error has occurred. Why and how can I fix? Thank you
-
With Cisco Secure ACS for Windows GANYMEDE +, authentication fails with AD
I'll put up a Cisco Secure ACS 4.2 server to act as a RADIUS server for switches and routers I use Windows 2003 server for the candidate countries.and an Active Directory of Windows 2003 server. The ad server is very good, it is used for many other