Multiple values for the same column in the columns of diffétent in the same row?
Hi allI wonder how you can display different values for the same column in different columns on the same line. For example, using a CASE statement, I can:
CASE WHEN CODE IN ('1 ', ' 3') THEN COUNT (ID) AS 'Y '.
CASE WHEN CODE NOT IN ('1 ', am') THEN COUNT (ID) AS "N".
Yes, that will produce two columns but will produce null values to empty and also two separate registers.
Any ideas?
Thank you
Are you sure that this code works for you?
Select ID
,CASE WHEN MODE_CODE IN ('1', '3') THEN COUNT( No) END as "Fulltime"
,CASE WHEN MODE_CODE NOT IN ('1', '3') THEN COUNT( No ) END as "Other"
From table
group by ID
I guess the code above fails because MODE_CODE is not in your group by?
My suggestion would be to put the CASE in the COUNT:
Select ID
,COUNT(CASE WHEN MODE_CODE IN ('1', '3') THEN No END) as "Fulltime"
,COUNT(CASE WHEN MODE_CODE NOT IN ('1', '3') THEN No END) as "Other"
From table
group by ID
CASE expressions return no. when the respective conditions are true and NULL otherwise.
COUNTY will have non-null values.
Tags: Database
Similar Questions
-
Hello
I have a report that uses apex_item.checkbox (...) to generate the check box. This report correctly displays a check box for each line. The source code that is generated in the html page is:
< input type = "checkbox" name = "f01" value = "202" id = "P1_CHECKBOX" / >
...
...
< input type = "checkbox" name = "f01" value = "220" id = "P1_CHECKBOX" / >
...
...
< input type = "checkbox" name = "f01" value = "210" id = "P1_CHECKBOX" / >
...
...
I want to use the javascript function $v () to get the values of the enabled check box. I thought that the return of this function all the checked values separated by ':' but I noticed that my code alert ($v ('P1_CHECKBOX')); return whenever the value of the first checkbox if it is checked.
It returns '202' if the first box is checked, but nothing, if only the second checkbox is checked and '202' if the box of the first and the second is checked.Hello
first of all, $v, $x and $s are supposed to not work for items on the page, not the columns in a table or manually generated HTML elements.
Secondly, I think that your HTML code is not correct, because each of your boxes has the same ID. But the ID must be unique in the DOM of the browser tree. Thus the different box should actually named P1_CHECKBOX_1... P1_CHECKBOX_3. Just look at what is actually generated for a page element real checkbox. BTW, I think that you should not name the checkbox as part of page elements, because they are not actually page elements. I think that this could be confusing for other developers.
Hope that helps
Patrick
-----------
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
BlackBerry Smartphones why do I get multiple contacts for the same person
Recently, when I add a new contact the 9700 creates several entries. When I delete these multiple inputs, then it leaves about 10 spaces. If I let multiple entries for the same person, the next person that I add only then indicates once
Why they appear more than once?
How can I delete multiple entries so they do not reappear when I create the following entry?
Help, please
Try a simple reboot and see if the empty entries remain.
With the BlackBerry device powered time, remove battery for a few seconds and then reinsert the battery to restart.
-
AcriveSync has created multiple numbers for the same contact
I recently had my transferred to my new pre phone book and set up my corp email.
A lot of my contacts are mixed up (last names starting with O come in T, and these records have multiple records for the same phone number. How can I fix?
Hey thanks - I thought about it. Turns out there have a lof of contacts in my constituency of corp I do not even know (or use). I went in a deleted them and now al is good. Thank you!
-
a problem in passing multiple values in the loop settings for
Hi all
I am facing a problem in passing multiple values in the loop settings for.
EX:
CREATE or REPLACE PROCEDURE (pr_id OUT NUMBER) HAVE
tab type is table of NUMBER;
TEMP_TAB TAB;
BEGIN
Select the COLLECT LOOSE pr temp_tab pr_id;
I'm in 1.TEMP_TAB. loop of COUNTING
PR_ID: = temp_tab (i);
end loop;
END TEST;
OUTPUT:-
pr_id = 234578
in the example above, I'm only a value as an out parameter. but I send you PR_ID of the loop.
why I don't get all the values that the parameters.please offer a solution for me.
Thank you my friend.More clarification, let's look at your code...
-- create a procedure and have a single numeric out variable CREATE OR REPLACE PROCEDURE TEST ( pr_id OUT NUMBER ) AS -- declare a type as an array of numbers type tab is table of NUMBER; -- declare a varianble of that array type TEMP_TAB TAB; BEGIN -- query all the values from the table into the array select pr_id BULK COLLECT INTO temp_tab from pr; -- loop through each value in the array for i in 1..TEMP_TAB.COUNT loop -- set the value of the single OUT parameter, OVERWRITING any previous value it has PR_ID := temp_tab(i); -- loop around to the next value end loop; -- end the procedure with the final value of PR_ID END TEST;
-
Default value for the select list of type of form elements
Hello
I do not work with Apex that mutch, so this may be a simple question... but I still need help.
I have a form, in this form, I have a question P19_ONTVANGER_ID, this is based on a LOV.
This LOV is on a table that has a field of username with the value of APP_USER.
The table looks like:
ONTVANGER_ID this is the PK and is going to be the return value from the LOV.
NAME is the display value for the LOV.
USERID is the column APP_USER.
What users would like to get is that if they create a new record, the default value for the P19_ONTVANGER_ID field is their own ONTVANGER_ID.
But they must also be able to select another user.
hope there is someone out there that can and will help me.
Kind regards
Rob
APEX 4.0.2 Oracle 10Rob-v-M-Gn-Nl wrote:
Until now, I had, but I need to select the value of the id of the table and the list of selection item appears the corresponding value.How can I do this?
You can select the Type of default value as the body of the PL/SQL function
and to add something like that
declare v_return number; begin select your_id into v_return from your_table where some_column = :APP_USER; return v_return; exception when no_data_found then return null; end;
http://www.asktheoracle.NET/PLSQL-function.html
-
NPL of multiple execution for the awr sql_id
Hi Experts,
NPL of multiple execution for the AWR sql_id,
I followed questions
1. What plan using opimizer tcurrently?
2. make sure optimizer to choose good plans
SQL > select * from table (dbms_xplan.display_awr ('fb0p0xv370vmb'));
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID fb0p0xv370vmb
--------------------
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hash value of plan: 417907468
---------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |
---------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 63353 (100) |
| 1. UPDATE |
| 2. SORT ORDER BY | 17133. 2978K | 3136K | 63353 (1) | 00:14:47 |
| 3. HASH JOIN RIGHT SEMI | 17133. 2978K | 62933 (1) | 00:14:42 |
| 4. COLLECTION ITERATOR PICKLER FETCH | |
| 5. HASH JOIN RIGHT SEMI | 68530 | 11 M | 62897 (1) | 00:14:41 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 6. VIEW | VW_NSO_1 | 5000 | 35000 | 33087 (1) | 00:07:44 |
| 7. COUNTY STOPKEY |
| 8. VIEW | 127K | 868K | 33087 (1) | 00:07:44 |
| 9. GROUP SORT BY STOPKEY | 127K | 2233K | 46 M | 33087 (1) | 00:07:44 |
| 10. TABLE ACCESS FULL | ASYNCH_REQUEST | 1741K | 29 M | 29795 (1) | 00:06:58 |
| 11. TABLE ACCESS FULL | ASYNCH_REQUEST | 1741K | 280 M | 29801 (1) | 00:06:58 |
---------------------------------------------------------------------------------------------------------------
SQL_ID fb0p0xv370vmb
--------------------
SELECT ASYNCH_REQUEST_ID, REQUEST_STATUS, REQUEST_TYPE, REQUEST_DATA, PRIORITY, SUBMIT_BY, SUBMIT_DATE.
Hash value of plan: 2912273206
--------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 45078 (100) |
| 1. UPDATE |
| 2. SORT ORDER BY | 1323. 257K | 45078 (1) | 00:10:32 |
| 3. TABLE ACCESS BY INDEX ROWID | ASYNCH_REQUEST | 1. 190. 3 (0) | 00:00:01 |
| 4. NESTED LOOPS | 1323. 257K | 45077 (1) | 00:10:32 |
| 5. THE CARTESIAN MERGE JOIN. 5000 | 45000 | 30069 (1) | 00:07:01 |
| 6. UNIQUE FATE |
| 7. COLLECTION ITERATOR PICKLER FETCH | |
| 8. KIND OF BUFFER. 5000 | 35000 | 30034 (1) | 00:07:01 |
| 9. VIEW | VW_NSO_1 | 5000 | 35000 | 30033 (1) | 00:07:01 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 10. UNIQUE FATE | 5000 | 35000 |
| 11. COUNTY STOPKEY |
| 12. VIEW | 81330 | 555K | 30033 (1) | 00:07:01 |
| 13. GROUP SORT BY STOPKEY | 81330 | 1 429 K | 2384K | 30033 (1) | 00:07:01 |
| 14. TABLE ACCESS FULL | ASYNCH_REQUEST | 86092 | 1513K | 29731 (1) | 00:06:57 |
| 15. INDEX RANGE SCAN | ASYNCH_REQUEST_SUB_IDX | 1 | | | 1 (0) | 00:00:01 |
--------------------------------------------------------------------------------------------------------------------------
Hash value of plan: 3618200564
--------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 59630 (100) |
| 1. UPDATE |
| 2. SORT ORDER BY | 4474 | 777K | 59630 (1) | 00:13:55 |
| 3. HASH JOIN RIGHT SEMI | 4474 | 777K | 59629 (1) | 00:13:55 |
| 4. VIEW | VW_NSO_1 | 5000 | 35000 | 30450 (1) | 00:07:07 |
| 5. COUNTY STOPKEY |
| 6. VIEW | 79526 | 543K | 30450 (1) | 00:07:07 |
| 7. GROUP SORT BY STOPKEY | 79526 | 1397K | 7824K | 30450 (1) | 00:07:07 |
| 8. TABLE ACCESS FULL | ASYNCH_REQUEST | 284K | 5003K | 29804 (1) | 00:06:58 |
| 9. TABLE ACCESS BY INDEX ROWID | ASYNCH_REQUEST | 71156 | 11 M | 29141 (1) | 00:06:48 |
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 10. NESTED LOOPS | 71156 | 11 M | 29177 (1) | 00:06:49 |
| 11. UNIQUE FATE |
| 12. COLLECTION ITERATOR PICKLER FETCH | |
| 13. INDEX RANGE SCAN | ASYNCH_REQUEST_EFFECTIVE_IDX | 327K | | 392 (1) | 00:00:06 |
--------------------------------------------------------------------------------------------------------------------------------
Thank you
-Raj
Published by: tt0008 on August 22, 2012 20:34Hello
(1) you can see what plan has been used lately by running this query:
select begin_interval_time, plan_hash_value from dba_hist_sqlstat st, dba_hist_snapshot sn where st.snap_id = sn.snap_id and sql_id = 'fb0p0xv370vmb' order by begin_interval_time desc;
However, there is no guarantee that the next time you run this query, the latest plan will be chosen.
Periodically, the plan is regenerated (for example when new statistics are collected, is the structure of a table referenced in)
the query is changed etc.), and you can get 4 plans, or even a new function of many factors
(statistics, bind variable values, the optimizer, NLS etc settings settings.)(2) this question is too large for the answer to fit into a thread, there are books written on the subject. The short answer is:
If you know which of the 4 plans is right for you, then you can use a stored outline to lock in (it seems that you are not on 11g so SQL Profiler are not an option for you).
Or you can try to find out why the optimizer generates different plans and address the underlying issue (the most common reason is to bind peeking - but to say
course, we need to know more, starting with the text of your query).Best regards
Nikolai -
How to find out the ASCII values for the Spanish character
Hello
I had an obligation to maintain the Spanish character and must also always records based on the Spanish character.
Kindly guide me for below.
To filter the records that contains Spanish characters?
To get the ASCII values for the particular column?
For example, we can find the ASCII value of 'a' using the select syntax ASCII('a') double.
But I want to find the value of the particular column ASCII values. That is to say. name.
For example, the customer name is 'Suresh', I want the ASCII values for the entire name of 'Suresh '.
Please do the necessary help / advice on that.
Thank you
OraharTo expand on what I said in my first post, you want to do something in this direction:
with t (thename) as ( select 'Suresh' from dual ) select thename , substr(TheName, level, 1) , ascii(substr(thename, level)) from t connect by level <= length(thename);
The result of the above query is:
THENAM S ASCII(SUBSTR(THENAME,LEVEL)) ------ - ---------------------------- Suresh S 83 Suresh u 117 Suresh r 114 Suresh e 101 Suresh s 115 Suresh h 104 6 rows selected.
Note that the WITH statement is only there to simulate a table for this example. With a table, all you do is get rid of the with and replace it with the name of "t" for your table name (also the name of the column with name column has in your table).
Finally, I suggest that you post your question with, an example of table and the output you want for PL/SQL forum. There are people out there who will give you all sorts of ways to solve this problem.
HTH,
John.
-
DEU-00014: invalid value for the setting, "include".
Hi, I need to do an export of paintings from a schema and a particular query executed will apply to all the specified tables in "INCLUDE = TABLE: '('TBL1', 'TBL2') IN' in the command expdp.»
Now, I get the question in this setting INCLUDE. I have about 200 paintings to be included and I add this parameter INCLUDE in a separate parameter with all table names 200 file in Informatics and with the help of this parameter file in the expdp command.
Error message I get:
DEU-00014: invalid value for the setting, "include".
When I use the same process for 2 tables, this works very well. I think that there is a limit to the number of characters that can be used in the INCLUDE parameter. If so, then how do I use expdp to select only those 200 tables of 500 paintings in my diagram. I'd appreciate any help on this. Thank you.Hello
I'm sure that the limit is 4000 characters, but there are fairly simple workaround.
Create the table my_tabs (a varchar2 (30));
insert into my_tabs values ('your_table_name');
Repeat this step for each of your 200 tablesinclude = TABLE: "in ((SELECT from MY_TABS)) '"
You may need to mess you with the quote, but the value you were using is just an expression. It is only by using a different expression.
Dean
-
Default value for the owner on a Service request
Hello
I want one who creates a Service request automatically becomes the owner.
I wanted to put a default on this field (something like "owner = created by") but it is not allowed.
Has anyone encountered the same problem? Or an idea?
Thank you very much.
JonJon, make the default value for the field equal to LoginId() owner
-
Best way to set the default values for the form elements
Hello
I have a form with a lot of defaults that is mentioned below...
I am currently using calculation-> after presents... then when we create/update a record... these computaion takes place and the default value for the inserted values get... THIS WORKS PERFECTLY WELL.Field value created by :APPL_USER creation_date SYSDATE last_updated_by :APPL_USER last_update_date SYSDATE item1 value1 item2 value2
I want to know... If this approach is fine OR we can have a better approach to achieve...?
Thank you
DeepakHello
I think it's good if it fits your need.
But why you have these fields in the form?
created by: APPL_USER
CREATION_DATE SYSDATE
last_updated_by: APPL_USER
last_update_date SYSDATEThe user can enter the ones?
I thought that those who are to audit and I would fill those drop with trigger in the database.
So that you get the same "correct" values if you need to manipulate the data with example of sql clientBR, Jari
-
Create a default value for the record button on
Hi all
Help me on what follows.
I have region with user name. I want to when I create a username it will automatically sets the value for the status to 'active '.
As I have status field in the table.
Thanks in advanceIf the status is a Page element, you can set the default value. If this isn't the case, you can have a base table, the default value of this column status.
alter table t1 modify status varchar2(6) default 'Active';
Tarraf
-
Definition of default values for the inputs of button and the cursor?
Hello
I use Labview 8.5.1 and have a few entries button and zipper-type on my front. How can I set some of them having specific (as opposed to zero) default values when the VI is executed?
Thanks for the help
The default value for the type of slide of entry (or button).
Right-click on the control.
Select "Operations on the data" > "default to the current value of doing."
-
How can you specify the default value for the undefined array elements
According to aid LV, the tables have two default values, the normal default value and the default value for the undefined array elements.
I assume that there must be a way to specify the default value for later, but I can't find it anywhere. Any ideas?
I know that you can drag the item out of the table container. Change the default value on this scalar element. Then drag the item in table tank.
-
failed to create value for the message Analyzer "at line 54.
I get the following error, can someone please?
failed to create value for the message Analyzer "at line 54.
Hi ejpeppjep,
Check if this article helps you fix the problem: http://support.microsoft.com/kb/823768
If the problem persists, we recommend that you try the following steps and check the result.
Step 1: a. Click Start, click Run, type cmd and click ok.
b. at the command prompt, type sfc/scannow and press ENTER.
c. once the analysis is complete, restart the computer and check if the problem persists.Note: You will be asked to insert the Windows XP disk, if a file is missing.
For more information, see Description of Windows XP System File Checker (Sfc.exe)
Step 2: If the problem persists, restore the computer to an earlier time
see How to restore Windows XP to a previous state .Visit our Microsoft answers feedback Forum and let us know what you think.
Maybe you are looking for
-
New tabs automatically go to Yahoo search in Firefox 39, I want to stop it.
I'm on Windows with Firefox version 39 10. Everytime I open a new tab, a Yahoo Search page comes up. I deleted all the stuff of Yahoo out of my laptop. I have no Yahoo toolbar, etc. left. I also removed Yahoo as a search engine option. DuckDuckGo is
-
Mozilla Firefox plug-ins crash
I use Modzilla Firefox, when ustreaming or display of certain items, my accident of plug-ins. Any thoughts to go to fix this?
-
Hi guys,. read the digital data of an automaton, using datasocket. The data is displayed in real time on one side before indiactor and historically face graphic Panel. I want to display the max, min and average data in real time on the front panel, I
-
All the data disappeared after the installation of updates! Help!
Hoping someone can help with thisLast night I installed updates KB961371, 973346 KB and KB 890830 for Vista Home Premium and they seemed to have been settled... my computer turns off fine. But when I started today and connected to my usual user, I go
-
List of compatible processors for dv2660se
Hi, can you give me a list of compatible processors for laptop model dv2660se. -Thank you