Case statement using column Date calculated in responses
HelloI have a calculated column is column # 4, in the responses with the following code
"CASE WHEN 'Handmade'." Date of the project"is set to NULL THEN TIMESTAMP ' 1900-01-01 12:00" ELSE "Handmade" "." " The project 'END' date, so now I filled all Null values in the field to date with ' 1900 - 01 - 01 12:00 '.
I have another column with the following syntax, which only gives me an error, but the 'Undefined' values for the timestamp above is not met.
"BOX WHEN" @4 ' = ' 1900 - 01 - 01 12:00 ' THEN 'Undefined' OTHERWISE "Main Dim". " "Project name" END ".
Please let me know how to fix this. Thank you for your time and your help.
Hello
Try this
case when cast (CASE WHEN Time. "Day Date" "IS NULL THEN TIMESTAMP ' 1900-01-01 12:00 ' time else. '" (Date of the day' END as char) = TIMESTAMP ' 1900 - 01 - 01 12:00 ' then 'undefined' other end Products.Product
Replace your respective columns
Thank you
Saichand.v
Tags: Business Intelligence
Similar Questions
-
Generate the insert statement using columns in view all_tab_cols
I am trying to generate a dynamic insert statement using the columns of a table in the all_tab_cols view. If I do a select, I get the result as lines. How to convert the row of the columns so that I get something like this:
.INSERT INTO TABLE_NAME (COL1, COL2, COL3,COL4.....)
Any help will be appreciated!This can give you a tip.
SQL> ed Wrote file afiedt.buf 1 with tab_col 2 as 3 ( 4 select i.table_name, 5 column_name, 6 row_number() over(partition by i.table_name order by table_name) rno 7 from user_tab_cols i 8 ) 9 select 'INSERT INTO '||table_name||' ('||ltrim(sys_connect_by_path(column_name, ','), ',')||') 10 from tab_col 11 where connect_by_isleaf = 1 12 start with rno = 1 13 connect by rno = prior rno+1 14 and table_name = prior table_name 15* and rownum<4 SQL> / SQL_STATEMENT -------------------------------------------------------------------------------- INSERT INTO A (MAKER,TYPE) INSERT INTO ADAM_TEST (ACCT,CODE) INSERT INTO AREA_TBL (AREA_ID,ORG_ID,CLUSTER_ID) INSERT INTO B (MAKER) INSERT INTO BONUS (ENAME) INSERT INTO CLUSTER_TBL (CLUSTER_ID) INSERT INTO COMPANY (MANUFACTURER) INSERT INTO COUNTRIES (COUNTRY_ID)
-
error with the case statement use what void const query
Hi all.
I have found the error in the result set, and then use subqueries and cases of declaration.
Preparation for example.
2 examples of tables creation.
This statement returns NULL in subqueryCREATE TABLE T1 AS ( SELECT 1 ID , 1 F1 FROM DUAL UNION SELECT 2 ID , 1 F1 FROM DUAL UNION SELECT 3 ID , 1 F1 FROM DUAL ) ; CREATE TABLE T2 AS ( SELECT 2 ID FROM DUAL UNION SELECT 3 ID FROM DUAL ) ;
But this statement (with operator CASE) does NOT return null in subquerySELECT T1.ID, TT2.ID , TT2.ISBUG AS NO_BUG FROM T1 LEFT JOIN ( SELECT ID , -1 ISBUG FROM T2 )TT2 ON T1.ID = TT2.ID WHERE TT2.ID IS NULL
Why?SELECT CASE WHEN 1 = 1 THEN 1 END AS C1, T1.ID, TT2.ID , TT2.ISBUG FROM T1 LEFT JOIN ( SELECT ID , -1 ISBUG FROM T2 )TT2 ON T1.ID = TT2.ID WHERE TT2.ID IS NULL
Oracle 11.2.0.2.0
Published by: 927438 on 13.04.2012 03:27
Published by: 927438 on 13.04.2012 03:31Maybe it is related to this one
outer join of 11g with case - strange results statement.
seems to be a bug
-
Excel and the CASE statement.
Hello Experts,
I use a CASE statement on the column of CHAR type as follows:
CASE WHEN Sales.Ret = 'Y' THEN 'Return' END of OTHER 'new '.
It gives an error: Odbc driver returned an error (SQLExecDirectW).
Whereas, when I use another CASE statement with column Numrical it works perfectly.
CASE WHEN Sales.Amount < END If NOT 100 40 THEN 40
Am I missing an Excel data source definition related to the CHAR data type?
My source is MS Excel 2003 and OBIEE 10.1.3.4.1
Thank you for any comments, help.
~ Ash
PS: the details of the error are the following:*.
Error codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 16001] ODBC error state: 37000 code:-3100 message: error [Microsoft] [ODBC Excel Driver] syntax (missing operator) in query expression ' case when T46. [Retirement] = "Y" then "known" other "new" end "... [nQSError: 16014] Prepare the SQL statement failed. (HY000)
Publ. SQL: SELECT Sales.Tran_date, saw_0, CASE WHEN Sales.Ret = 'Y' THEN 'Return' ELSE 'New' END saw_1, network. "" Network name "saw_2, Sales.Amount saw_3 FROM P4UD ORDER BY saw_0, saw_1, saw_2Sorry, the button is 'Ask DBMS' (biee 10g)
-
call the statement box inside the case statement
I am writing a program which requires me to run a statement box inside another case statement. Although this sounds like a simple thing, I need to be able to call the case statement using a sequence structure, where s1 sends the true value to the case, s2, a fake. Then I need to record the results of this instruction box in a text file. Attatched is a simplified version of what I'm trying to do. Please note that the way my program runs may not call the case statement without using a sequence structure, two nesting box instructions is not feasible. I hope someone out there can help me because I was stuck trying to find this for awhile.
Thank you
LVStudent wrote:
[...] I can't call the case statement without using a sequence structure
Yes you can. You just need to be smart.
LVStudent wrote:
I don't think I can use a state machine to fix this.
I think you probably can.
With respect to your original post. What are these s1 and s2 are you talking about? My opinion on the matter, it is that you want to select a case based on the values of several controls Boolean. If this is correct, I do this:
Build your Boolean controls in a table, convert the table number and insert it into the structure of your business. No button pressed = 0, s1 = only 1, s2 = only 2 both = 3. This works for Boolean values as much as you want and is an easy way to make a decision that depends on many entries.
-
Use of data blackBerry Passport Standby mode
Hello, I have a problem with the use of data from the idle mode on my passport for BlackBerry. IT uses the largest amount of data, more than any other about 650 mb in 8 days. When I enter the application manager and tap the Standby Mode it constantly shows in any case "no use of data during the last 48 hours" and the leeks of data... could you explain what happens?
Probably, it is the synchronization of e-mail and other data for example, if you have a cloud service like box or dropbox sync to your device.
-
using a Case statement to display the values of column even as table headers
I have a database that has been set up kind of tricky, in that some tables are made up of columns that are field names and one link to another table that contain the data for these field... also names there ID displays as many lines instead of as a row of data. I would like to write a query to extract that information and display it as one line for each ID.
example: table 1
ID, name, itemresponse and itemcode, Description
Dee Jones Childrens Hospital 123 SITE location
123 dee Jones, Date of appointment next NEXTAPPT 22/04/2014
123 dee Jones was on bedrest NOSHOW reason do not show
I would like to have the display of data as a record on this same patient, instead of as 3 separate registers (with the Description column in table 1
Table 2
ID, name, place, Date of the next meeting, show no reason
123 dee Jones Childrens Hospital 22/04/2014 was the bed rest
I have included the code I worked on below my question, for me to get the desired results should I use the Case statement and it's the right way to do it below?
(SELECT
PAT.ID "PATIENT ID."
PAT. FIRST | » '|| PAT. "PATIENT FIRST NAME."
PAT. "PATIENT DOB," DATE_OF_BIRTH
DS. Date 'Date of inpatients ',.
Dai. ITEM_CODE "Item Code",
Dai. DESCRIPTION "Description."
Siad. ITEM_RESPONSE,Max (CASE WHEN dai. ITEM_CODE IS "SITE" THEN DAI. Decription
ANOTHER NULL
END) AS "name of the hospital."
Max (CASE WHEN DAI.) ITEM_CODE IS 'NEXTAPPT' THEN DAI. ITEM_Description
ANOTHER NULL
END) AS 'next Appt Date. "
Max (CASE WHEN DAI.) ITEM_CODE IS "LASTDATE" THEN DAI. Description
ANOTHER NULL
END) AS 'last visit Date.
Max (CASE WHEN DAI.) ITEM_CODE IS 'NOSHOW' THEN DAI. Description
ANOTHER NULL
END) THAT "the reason has not shown".
Of
(PAT.ID "IDENTIFYING PATIENT",
PAT. FIRST | » '|| PAT. "PATIENT FIRST NAME."
PAT. "PATIENT DOB," DATE_OF_BIRTH
DS. Date 'Date of inpatients ',.
Dai. ITEM_CODE "Item Code",
Dai. DESCRIPTION "Description."
Siad. ITEM_RESPONSEOf
dm_sessions Ds,
dm_session_assessments dsa,
DAS dm_admin_sections,
dm_session_assessment_items Siad,
Dai dm_admin_items,
Po Patient_Orders,
Inventory inv,
Patients_Table PAT
dm_admin_categories CAD
where dsa.session_Id = ds.session_Id
and PAT.ID = ds. Patient_ID
and dsa.excluded_assessment =' no
and dac.category_code = 'OPEN'and dsa.section_id = das.section_id
and das.category_id = dac.category_id
and das.section_code = 'northwest'
and dai.section_id = das.section_id
and dsai.item_id = dai.item_id
and dsai.session_assessment_Id = dsa.session_assessment_Id
and dsai.excluded =' no
- and Dai.ITEM_ID = Dsai.ITEM_ID
and Dai.ITEM_CODE IN ('SITE', 'NEXTAPPT', 'LASTDATE', 'NOSHOW')
and po.patient_ID = ds.patient_ID
and in. NDC_NO = inv. NDC_NO
and inv. TDRUG_ABBREV = in. DRUG_ABBREV
PAT.ID GROUP, PAT. FIRST | » '|| PAT. LAST, PAT. DATE_OF_BIRTH, ds. Date, dai. ITEM_CODE, dai. DESCRIPTION, Siad. ITEM_RESPONSE))Hello
DATE is not a very good name for a column. Use something like EVENT_DATE, that will not be confused with a keyword from Oracle, instead.
I don't see something like this column in the CREATE TABLE statement. He will always be the same value on all lines?
Here's a way to get the results you requested:
SELECT id
first name | ' ' || LastName AS name
Date of birth
MAX (CASE WHEN item_code = "NEXTAPPT", THEN item_response END) AS next_appointment,
MAX (CASE WHEN item_code = "LASTDATE" THEN item_response END) AS last_visit_date,
MAX (CASE WHEN item_code = "SITE" THEN item_response END) AS location
FROM mytable1
GROUP BY id, firstname, lastname, dob
;
Of course, I can't test it very well until you post INSERT statements for the sample data.
I guess that 2 or more lines of the entry have the same id, then they will necessarily be first name last name, the name and date of birth, too. No doubt they are standardized in your actual tables.
-
problem of data flow in the case structures (using a state machine)
Good day everyone.
I'm having a problem with the flow of data between the structures of the case.
I try to use an example of a state machine for this simple problem. but when I try to send data of a box structure to change the State of the code. It will change not in the desirable output, instead, it offers the possibility that the exit options emul.
could someone please point what I'm doing wrong here. Any kind of help would be very appreciated.
With a quick glance at your photos a question you have is that you use not data flow. You write your status updated in local variables value. Your State should pass through the case structures are a single wire. Playback of your order "Enum", happened in the register shift on the right side of your loop probably get running and reading before any processing occurs within the structure of your business. That's why you're reading the old value of the State and not the update. or have a classic case of a race condition in your code.
-
Case statement in the filter responses
Hello
I'm trying to build a query in the replies that filter the returned data based on the number of current month. If the current month is 1 then we want to show every 12 months, we want to show under the current months months. If I use the following:
Excerpt from WHEN (month of current_date) - CASE = 1 THEN 'calculated monthly values. "" MONTH "> = 1 ELSE 'calculated monthly values. "" MONTH "< extracted (current_date months) END
I get the error below. Everything works fine until I have add the CASE.
Error codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Geographical area: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool, saw.threadpool, saw.threads
ODBC driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 27002] Near <>= >: syntax error [nQSError: 26012]. (HY000)
You can use a case statement in a filter? If not, what are the other options, as appropriate?
THXziekc wrote:
HelloI'm trying to build a query in the replies that filter the returned data based on the number of current month. If the current month is 1 then we want to show every 12 months, we want to show under the current months months. If I use the following:
Excerpt from WHEN (month of current_date) - CASE = 1 THEN 'calculated monthly values. "" MONTH "> = 1 ELSE 'calculated monthly values. "" MONTH ".< extract="" (month="" from="" current_date)="">
I get the error below. Everything works fine until I have add the CASE.
Error codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Geographical area: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool, saw.threadpool, saw.threads
ODBC driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 27002] Near <> =>: syntax error [nQSError: 26012]. (HY000)You can use a case statement in a filter? If not, what are the other options, as appropriate?
THX
Depending on your needs, when the month is January, you want every 12 months. any other number and you want the month 1 "1 less than the number this month. Yes? Here's what to do:
In the filter on your date column, click the filter button, convert it to SQL and enter the following:
MONTH (TableName.date_column) BETWEEN 1 AND CASE WHEN MONTH (CURRENT_DATE) = 1-12 THEN end of MONTH else (CURRENT_DATE)-1
Here's the logic:
(a) when the month is January, and then the case statement will give 12 and the filter will be:
WHERE the MONTH (tablename.date_column) BETWEEN 1 AND 12... .or every 12 months.
(b) when the current month is any month, say June, then the case statement will give a less than is the number of months, or in this case, 5.
WHERE the MONTHS (tablename.date_column BETWEEN 1 AND 5 .or every 1 to 5 months (January to may))
This will give you what you want...
-
Case statement with a select &; date in
Hello everyone,
This is my first discussion, so please bare with me.
I am trying to write a case statement with a select statement that compares the dates.
When I write an instruction box with a select statement in it compares everything but dates it works fine. Once the date is there, he collapses.
Here is a super simple example of what I'm trying to do, "b.in_serv_dt" is a date
Select unit_no,
case when ((sélectionnez b.in_serv_dt de b unit_dept_comp_main où a.unit_id = b.unit_id et b.in_serv_dt) > = 1 January 2012 "") then "everybody wins."
When ((sélectionnez b.in_serv_dt dans l'unit_dept_comp_main b où a.unit_id = b.unit_id et b.in_serv_dt) < = 1 January 2012 "") then "Nobody wins".
end
of ottawa_unitmain_v one
Any help would be greatly appreciated
Thank you very much
Hello
your statement of formatting:
Select unit_no
case when ((select b.in_serv_dt
of unit_dept_comp_main b
where a.unit_id = b.unit_id
and b.in_serv_dt
") > = JANUARY 1, 2012"
) and then "everybody wins."
When ((select b.in_serv_dt
of unit_dept_comp_main b
where a.unit_id = b.unit_id
and b.in_serv_dt
)<=>=>
) and then "no winner".
end
of ottawa_unitmain_v oneI see "partial conditions": <... and="" b.in_serv_dt="">> that have no meaning.
I guess it's a kind of "typo" and I ignore them.
If the statement is:
Select unit_no
case when ((select b.in_serv_dt
of unit_dept_comp_main b
where a.unit_id = b.unit_id
") > = JANUARY 1, 2012"
) and then "everybody wins."
When ((select b.in_serv_dt
of unit_dept_comp_main b
where a.unit_id = b.unit_id
)<=>=>
) and then "no winner".
end
of ottawa_unitmain_v oneI guess that the "b select" retrieve one line, through the design of database (forced...)
As already written: be careful with data types: avoid "implicit conversions" (when you compare different data types, Oracle has convert the data type of the other side, a side example: "mystring = mynumber" is transformed into 'TO_NUMBER (mystring) = mynumber', or 'mydate = mystring' translates mydate = TO_DATE (mystring,
) ")
Even better: use explicit conversions, use explicit formats when necessary.
Best: use no conversion on columns from the constants, but use the correct data type for the constant.With this in mind:
Select unit_no
case when ((select b.in_serv_dt
of unit_dept_comp_main b
where a.unit_id = b.unit_id
) > DATE = ' 2012-01-01'
) and then "everybody wins."
When ((select b.in_serv_dt
of unit_dept_comp_main b
where a.unit_id = b.unit_id
)<= date="">=>
) and then "no winner".
end
of ottawa_unitmain_v one
But note that b.in_serv_dt EQUAL to 1 January 2012 (at 00:00:00) is OK for both WHEN the conditions; then the a "win."Now: the subselect statement is identical in the 2 options of the case... You could work differently: (I add the "ELSE" in case one line as NULL in_serv_dt;) I guess that an INNER JOIN is OK, maybe you need a LEFT OUTER JOIN (if some lines of A have no corresponding row in B)
SELECT a.unit_no
, CASE WHEN b.in_serv_dt > = DATE '' 2012-01-01
THEN "everyone wins"
WHEN b.in_serv_dt< date="">
While "Nobody wins".
ELSE ' who knows... ". »
END who_wins
Of ottawa_unitmain_v one
INNER JOIN unit_dept_comp_main b
ON a.unit_id = b.unit_id
;Best regards
Bruno Vroman
-
[8i] Case statement generates ORA-00932: inconsistent data types
Note: I work with a 8i database (Yes, he's old enough) and in this case, I have to deal with the types of data (e.g. TANK), I gives me to work with.
I am trying to calculate the amount of time product expected between manufacturing steps. As I found out though, sometimes I get a negative value then subtract the date the previous step ends the date of that ongoing stage begins. Since it is generally impossible to start a later stage before a previous step (imagine trying to screw a cap on a bottle that has no son Cup yet - it just may not happen), what I found is that sometimes two steps are started the same day and finished the same day (although not necessarily the day they started). This situation CAN occur when a person is two steps and connected to two steps at the same time, rather than log on to one, then the other. So what I need to do in these situations, is to replace the negative number by zero (I'll treat the stage as having no time-out).
Some examples of data:
(Note: the data set real is the result of a query and has about 200 K lines and columns more, but this should be representative enough to find a solution that works on my real application.)
Here's the query I use that sometimes returns negative values:CREATE TABLE steps ( item_id CHAR(25) , ord_nbr CHAR(10) , sub_nbr CHAR(3) , step_nbr CHAR(4) , start_date DATE , finish_date DATE ); INSERT INTO steps VALUES ('A','0000000001','001','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','001','0020',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','001','0030',TO_DATE('01/05/2011','mm/dd/yyyy'),TO_DATE('01/06/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','002','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','002','0020',TO_DATE('01/04/2011','mm/dd/yyyy'),TO_DATE('01/04/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('A','0000000001','002','0030',TO_DATE('01/06/2011','mm/dd/yyyy'),TO_DATE('01/07/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('B','0000000002','001','0005',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy')); INSERT INTO steps VALUES ('B','0000000002','001','0025',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
These are the results I want to see:SELECT item_id , ord_nbr , sub_nbr , step_nbr , start_date - last_step_finished FROM ( SELECT s.* , LAG (s.finish_date) OVER ( PARTITION BY s.item_id , s.ord_nbr , s.sub_nbr ORDER BY s.step_nbr ) AS last_step_finished FROM steps s ); Returns: ITEM_ID ORD_NBR SUB STEP START_DATE-LAST_STEP_FINISHED ------------------------- ---------- --- ---- ----------------------------- A 0000000001 001 0010 A 0000000001 001 0020 -1.000 A 0000000001 001 0030 3.000 A 0000000001 002 0010 A 0000000001 002 0020 2.000 A 0000000001 002 0030 2.000 B 0000000002 001 0005 B 0000000002 001 0025 -2.000
And that's what I tried to do to get these results (comment pointed out which line has generated the error):ITEM_ID ORD_NBR SUB STEP START_DATE-LAST_STEP_FINISHED ------------------------- ---------- --- ---- ----------------------------- A 0000000001 001 0010 A 0000000001 001 0020 0.000 A 0000000001 001 0030 3.000 A 0000000001 002 0010 A 0000000001 002 0020 2.000 A 0000000001 002 0030 2.000 B 0000000002 001 0005 B 0000000002 001 0025 0.000
I know that I had errors in data type incompatible before with case statements in this particular 8i database, but I can't seem to understand why I'm getting one this time. I think it has something to do with the NULL value which may occur for last_step_finished. Also, if I change the case statement to:SELECT item_id , ord_nbr , sub_nbr , step_nbr , CASE WHEN start_dt - last_step_finished < 0 THEN 0 ELSE start_dt - last_step_finished -- THIS LINE GENERATES THE ORA-00932 ERROR END AS days_in_queue FROM ( SELECT s.* , LAG (s.finish_date) OVER ( PARTITION BY s.item_id , s.ord_nbr , s.sub_nbr ORDER BY s.step_nbr ) AS last_step_finished FROM steps s );
the query works fine. But, I'm not NULL, I 0. In the level of this request, I'll take the averages by item_id/step_nbr, and I want that 0 s to be included in the average. (NULL values, as far as I know, would be excluded. AVG(null,_1,_2) = AVG (1,2) = 1.5 NOT AVG (0,1,2) = 1)., CASE WHEN start_dt - last_step_finished < 0 THEN NULL ELSE start_dt - last_step_finished -- THIS LINE GENERATES THE ORA-00932 ERROR END
Thanks in advance!CASE requires that all expressions to be of the same type. Numeric data type code is 2, then that date produced different internal datatype 14:
SQL> select dump(1) a,dump(sysdate) b,dump(sysdate - (sysdate - 1)) c from dual; A B C ------------------ ----------------------------------- ------------------------------ Typ=2 Len=2: 193,2 Typ=13 Len=8: 219,7,6,27,13,7,50,0 Typ=14 Len=8: 1,0,0,0,0,0,0,0 SQL>
Case is supposed to process until the number, but it does not--a bug in some versions. Use explicit to_number:
, CASE WHEN start_dt - last_step_finished < 0 THEN 0 ELSE to_number(start_dt - last_step_finished) END AS days_in_queue
SY.
-
Tuning - using the CASE statement in the WHERE clause of the query
Hi all
My request has been changed to use a CASE statement in the WHERE clause to examine the data to some columns based on a parameter value. This modified request is made a full table and constantly running scan. Please suggest what can be done to improve its performance:
Query:
Description of the table:SELECT LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS summary_date, os.acctnum, os.avieworigin_refid, COUNT(1) cnt_articleview, SUM(NVL(autocompletedterm,0)) cnt_autocompletedterm FROM TABLE1 os WHERE os.acctnum IS NOT NULL AND os.avieworigin_refid IS NOT NULL AND os.requestdatetime IS NOT NULL AND UPPER(os.success_ind) = 'S' AND CASE WHEN Param_ValueToCheck = 'FULL' AND get_date_timestamp(os.requestdatetime) BETWEEN TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') THEN 1 WHEN Param_ValueToCheck = 'INCR' AND os.entry_createddate BETWEEN TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') THEN 1 END = 1 AND CASE WHEN Param_ValueToCheck = 'FULL' AND os.entry_CreatedDate BETWEEN TO_DATE('01-APR-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('07-JUN-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') THEN 1 WHEN Param_ValueToCheck = 'INCR' THEN 1 END = 1 GROUP BY LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))), os.acctnum,os.avieworigin_refid;
(Number of lines: approx. > amount 600 000 000)
Explain PlanName Null Type ------------------------------ -------- ------------ ARTICLEID NOT NULL NUMBER(20) USERKEY NUMBER(10) AVIEWORIGIN_REFID VARCHAR2(10) SUCCESS_IND VARCHAR2(2) ENTRY_CREATEDDATE DATE CREATED_BY VARCHAR2(10) FILENUMBER NUMBER(10) LINENUMBER NUMBER(10) ACCTNUM VARCHAR2(10) AUTOCOMPLETEDTERM NUMBER(2) REQUESTDATETIME VARCHAR2(19)
Published by: Chaitanya on June 9, 2011 02:44SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 2224314832 ---------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ---------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 590 | 33040 | 2501K (1)| 08:20:15 | | | | 1 | HASH GROUP BY | | 590 | 33040 | 2501K (1)| 08:20:15 | | | | 2 | PARTITION RANGE ALL| | 590 | 33040 | 2501K (1)| 08:20:15 | 1 |1048575| |* 3 | TABLE ACCESS FULL | TABLE1 | 590 | 33040 | 2501K (1)| 08:20:15 | 1 |1048575| ---------------------------------------------------------------------------------------------------------- PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 3 - filter(UPPER("OS"."SUCCESS_IND")='S' AND CASE WHEN ('FULL'='FULL' AND "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' 2011-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN 'FULL'='INCR' THEN 1 END =1 AND "OS"."REQUESTDATETIME" IS NOT NULL AND CASE WHEN ('FULL'='FULL' AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")>=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")<=TO_DATE(' 2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN ('FULL'='INCR' AND "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 END =1 AND "OS"."ACCTNUM" IS NOT NULL AND "OS"."AVIEWORIGIN_REFID" IS NOT NULL)
Published by: Chaitanya on June 9, 2011 02:47When it is executed individually, MERGE LOGIC 1 and LOGIC of MERGE 2 take about ten for a daterange of 30 days data.
BUT FULL is to get the scores of APR - JUN, INCR becomes partitions for MAY so not both 30 days.
Are compare us like with like? -
Use the control of timing DAQmx as input in case statement
Hello
I'm building a VI aquire sampled under tension of a sensor in continuous mode or finished. I was going to do this, use a box with a cable of the sample mode of the VI DAQmx calendar entry to the terminal State, the idea being that I couldn't aeither a while looping the case for continuous or simple acquisition according to the setting of this command.
However, instead of the sample mode provided for in the case of the case statement, I just get 1 and 0.
It's a good way to achieve this, and if so how can I get my case structure working properly?
Thank you
Dave
Hi Dave,.
Apologies - I consider that the error is from the data acquisition function? I forgot that she was using the sample entry mode.
Perhaps, then, it will be preferable to continue using the control of the ring - cases will be numbered and will correspond to the numeric value of the selection of the ring (i.e. finite samples = 0). I have attached a small example if we know not.
Moreover, the structure of the case cannot automatically fill for each case, in which case you can right click on the structure of the case-> add the case after.
Best regards
-
Use the case of the Cluster data without DRS storage store?
Can someone tell me please the use case of the Cluster data without DRS storage store?
Virtually no,.
The only one that is useful is the aggregation of resources of data warehouses in a cluster data store. But it is aggregation of resources in its crudest form. When you create a virtual machine and the use of a cluster as the destination data store, you must always select the data store that will store the virtual machine.
Storage DRS off =
No calculation of initial investment
No space load balancing
No I/O load balancing
No rule affinity VMDK
No maintenance mode
For this purpose a group of data without active DRS storage store is a kind of a data store folder.
-
HelloHow can I convert a code for the below sql case statement:
If)
(length of (tmp_co_orig_val) < = 0 OR tmp_co_orig_val < = 0 OR tmp_co_orig_val == 1 OR tmp_co_orig_val > = 9999999)
OR
((tmp_co_orig_val == 999999 AND (length of (tmp_rcr_orgn_ltv_rt) < = 0 OR tmp_rcr_orgn_ltv_rt < tmp_rcr_orgn_ltv_rt > 1.3 GOLD 0.15)))
Start
tmp_collatvalue = «»
tmp_msg_cd = 115
end
Is the case statement below that I wrote is correct. I don't have an environment now to test. Please advice.
BOX WHEN (CHAR_LENGTH (tmp_co_orig_val) < = 0 OR tmp_co_orig_val < 0 OR tmp_co_orig_val = 1 OR tmp_co_orig_val = > = 9999999)
OR (tmp_co_orig_val = 999999 AND (CHAR_LENGTH (tmp_rcr_orgn_ltv_rt) < = 0 OR tmp_rcr_orgn_ltv_rt < tmp_rcr_orgn_ltv_rt > 1.3 GOLD 0.15))
THEN tmp_collatvalue IS NULL AND tmp_msg_cd = 115
END
Hello
937454 wrote:
Thanks Frank. Really helps. But I have to write a sql statement
But can you also specify, if I made a mistake in my code, or it's ok.
There are no CASES reported in Oracle SQL.
Oracle SQL has BOX expressions, but they only return a single value. You cannot set 2 columns in the same expression BOX.
Perhaps the best thing to do in pure SQL for you is to write a CASE expression, very similar to the CASE statement above, in a subquery and use the results of this in 2 separate expressions of BOX (very simple) in a Super application.
Maybe you are looking for
-
When you use Firefox, a new window opens suddenly with this URL:chrome://thefoxonlybetter/content/whatsnew. XHTML I would like to know where it comes from and how to stop it. Thank you
-
Firefox ends not tasks in Windows.
What is happening is that Firefox is rest as a process in the background in Windows 8.1 update 1. Whenever I run Firefox, there are no navigation and requires a reboot of the system to correct. There must be a better way to get around this. I have sc
-
An annoying pop up called Manager apps keep appearing, nothing to do with you?
Using Win7 Pro and Firefox 20.0.1. Get an "App Manager" application from suggesting that I have download three things to let me download some sites including Twatter.I did not want to use the apps, but cannot fing anything in professing be administra
-
How to move items from one profile to a local storage
original title: move items from one profile to a local storage How to move items from one profile to a local storage to free up space under this profile?
-
Signature as a Director & administrator password
I have Windows XP, Service Pack 3. While trying to solve some problems with my computer, it asks me to log on as an administrator and enter the administrator password. I don't know how to do this, or if an administrator password was already impleme