Added the column total count.
HelloI face 9.2.0.8, certain restrictions may apply :).
This is the case
SQL> create table t (id number) ;
Table created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(1);
1 row created.
SQL> insert into t values(2);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID
----------
1
1
1
2
SQL> select count(*), id , ratio_to_report(count(*)) over () *100 pct , count(*) over () from t group by id;
COUNT(*) ID PCT COUNT(*)OVER()
---------- ---------- ---------- --------------
3 1 75 2
1 2 25 2
but I need last column as all rows in table so should be
SQL> select count(*), id , ratio_to_report(count(*)) over () *100 pct , count(*) over () from t group by id;
COUNT(*) ID PCT COUNT(*)OVER()
---------- ---------- ---------- --------------
3 1 75 4
1 2 25 4
how to rewrite that, ratio_to_report gives percentage which is quite good but need all rows .
ConcerningGregG
Hello
Do you need this?
select count(*)
,id
,ratio_to_report(count(*)) over () *100 as pct
,sum(count(*)) over()
from t
group by id;
Tags: Database
Similar Questions
-
Gets the error ORA-01779 after I added the column
Hi, I'm a total newbie in APEX but collaborated with ordinary development Oracle (tables, views, packages, triggers, etc) for a number of years.
I ve been assigned in order to respect an existing application to APEX. One task is to add a column to a single character named 'ACTIVE' to a database table and also present on a current project list page. The value can be 'Y' or 'n'. In the view which is the source of data for the project page ad 'Y' turned into 'Yes' and 'n' turned into 'no '. So far so good, everything works well.
There is another page on which it is possible to create new or modify existing projects. This page uses a view as a source of data. On this page, I added a group of radiobutton that contains two options: 'Yes' and 'no '. When I select to edit a project in the project list page the second page is loaded and the correct option, 'yes' or 'No', is marked on the page. This group of radiobutton works exactly like a couple of other groups of radiobutton also represented with a single character column in the database. So far so good!
However, when I try to save the project file by clicking on "Apply Changes" I get this error:
ORA-20001: DML error: p_rowid = 50, ID = p_alt_rowid, p_rowid2 =, p_alt_rowid2 is. ORA-01779: cannot modify a column that is mapped to a table not preserved key
What is the problem here? The new 'ACTIVE' column is added to the view, when I run the view I Don t get all records in duplicate, the underlying table has a column id as the primary key.
Since I Don t know that APEX is under the hood it s hard tp what's wrong. Anyone knows the solution to this problem?
/ MagnusHello Magnus,
Is there an INSTEAD OF trigger defined on the view? Have you added the new column ACTIVE there too?
Greetings,
Roel
http://roelhartman.blogspot.com/
You can reward this response in marking it as useful or Correct ;-) -
Deriving from the value of the column totals
BI Publisher 11g:
I have the next report, that I generated:
BOX TYPE NUMBER OF BOXES COST COST PER BOX A 10 $100 $10 B 20 $140 $7 TOTAL 30 $240 $17 My problem is that in the TOTAL row in the column COST PER BOX, the value shouldn't be that is to say $17 ($10 + $7) it should be actually IE $8 ($240 / $30). Does anyone know how to calculate the correct value.
Assuming that this structure of xml data:
A 10 100 B 20 140 You can use the following code to get the values:
row1:
row2:
Thank you
Bipuser
-
Hello
I do sub total total on some columns but my requirement, it is I want to change the subtotal to my name is required and the total general at my name is required. Is this possible?Click the sigma (total application) > Format labels... give your name here...
-
How to sort the column total in pivot view
Hello guys
I have a report in pivot mode, where I put the call on the section of the column type. So the report looks to below with the AMOUNT applied to the section of the column:
My question, how can I sort the data in the field "TOTAL"? The challenge, seems, is that, since 'TOTAL' is not a column of the table, but just a screen of pivot Sum, it cannot be sorted H - L or L.-H...Call Type1 Call Type2 Call Type3 TOTAL ID SALES TOTAL A 100 200 300 500 B 200 200 400 800 C D E
But I would like to get some advice from you guys before you do my conclusion
Thank you
Published by: user7276913 on January 11, 2010 10:05You can't have sorting on the PivotTable total.
On a workaround solution.
You can create a column in the criteria that calculate the sumSUM (sales_total by ID)
Assign the sorting on this column order
You can exclude this column in the PivotTableKind regards
Rambeau -
PL/SQL Query return function, adding the column links
Hi all
I'm working on a SQL report with the area type = function from PL/SQL Query to return
All columns are generated dynamically based on my mapping table and a column of ID.
So whenever the page is loaded, according to the ID mapping table returns a set of columns in a particular order.
So not only the columns are dynamic, but the order of the columns varies also.
But the first 1 column is standard (it doesn't come from the mapping table) and is coded in my pl/sql block hard.
I'm fighting with the addition of a link to this column. The link must be a Javascript function which takes the parameters in the form of 2 columns in the mapping table.
My pl/sql block is something like that...
Now, I'm not able to transmit the values of this #map_id # and #comments # correctly. I tried so many different combinations of channels, but could not make it work.v_select := 'SELECT <g href=javascript:f_report1(#map_id#,#comments#)><img src=""></a> as report1, '; // g=a v_cols := 'contains all columns from the mapping table based on a ID(hidden item)'; v_from := 'FROM table'; v_where := 'where condition is put in here'; v_query := v_select||v_from||v_where; return v_query;
I'm not sure that the order of this map_id and commentscolumn and therefore cannot connect through the report attributes.
How can I go to a column value to the function?
Thank you
DippyThis should work if all goes well:
v_select := q'[ SELECT '' as chart, ]';
Published by: Dimitri Gielis on May 20, 2010 20:10
-
I wonder why there are stars / astericks against 15 and 562 in the clip of the screen. Thank you.
- Means that the number displayed is a summary of the case, as well as the contents of all subfolders
-
Need help adding a column.
I have a traditional look Bill made up I want to be the sum of all values in a column. Is this possible? Here is an example. The column total added to the citation field city plus tax. Thank you!
With domain names, it is quite difficult sum up the values of the field.
Have you looked at the 'Calculate' options for the total field?
There is an option to "Field is the _____ of the fields" and you can select the operation and fields.
If you need to write a custom script, then you must get a copy of the reference API JS Acrobat from the Adobe Developer site.
-
Can be used with aggregate functions on large total rollup of the column
Hi all
I'm trying manipulate/aggregate on the grand total of the columns in the rollup package, can I do this? I use ROLL upward to avoid many groups nested clauses as below.
GROUP OF base.campaign, cij.avordertype, cij.invoiceaccount
)
)
Campaign of GROUP BY, invoiceaccount
) campaign group;
with
base_t as
(CHECK THE ICJ. AVBILLINGCAMPAIGN CAMPAIGN, ICJ. ORDERTYPE AVORDERTYPE,
NVL (SUM (CASE WHEN ICJ. (AVORDERTYPE = '01' THEN AVAMOUNT END CH.), 0) SUMAVAMOUNT_01,
SUM (CH. SUMAVAMOUNT_ALL AVAMOUNT),
CIJ.avordertype,
CIJ.invoiceaccount,
MIN (CIJ.invoiceid) firstinvoice_inrange,
COUNT (SEPARATE ICJ. REFFACTURE bills),
Sum (ch.avamount) invoicesamount
NVL (SUM (CASE
WHEN cij.avordertype = '01' CAN
COUNT (SEPARATE ICJ. REFFACTURE)
(END), 0)
OF CUSTINVOICEJOUR ICJ JOIN AVCOURIERHIST CH
ON substr (nls_lower (ICJ. DATAAREAID), 1, 7) = substr (nls_lower (CH. DATAAREAID), 1, 7)
AND SUBSTR (NLS_LOWER (ICJ. REFFACTURE), 1, 43) = SUBSTR (NLS_LOWER (CH. AVINVNUMBER), 1, 43)
WHERE substr (nls_lower (CH. DATAAREAID), 1, 7) = "201" AND SUBSTR (NLS_LOWER(CIJ.)) AVORDERTYPE), 1: 21) IN ('01 ', ' 09')
AND SUBSTR (NLS_LOWER (CH. AVCARGOCOMPANYID), 1: 25) = '06333675'
AND CH. AVINITIALDATE BETWEEN to_date ("'31.03.2014', ' dd.mm.yyyy") AND to_date ("'31.03.2014', ' dd.mm.yyyy")
GROUP BY ROLLUP (ICJ. AVBILLINGCAMPAIGN, ICJ. AVORDERTYPE, ICJ. INVOICEACCOUNT))
Select * from base_t;
Moreover, I can do anything with the help of ROLL UP clause instead of the bottom?
GROUP OF base.campaign, cij.avordertype, cij.invoiceaccount
)
)
Campaign of GROUP BY, invoiceaccount
) campaign group;
Concerning
Charlie
ROLLUP is used to obtain the aggregate more or less value. Here is an example
For the subtotal of wages to each level of deptno.
SQL > select deptno, empno, sum (sal)
2 of PEM
Group 3
4 by deptno, rollup (empno);DEPTNO EMPNO SUM (SAL)
---------- ---------- ----------
10 7782 12450
10-7839-5000
10 17450
20 7369 12975
20 7566 12975
20 7788 13000
20 7876 11101
20 50051
30 7499 11600
30 7521 11250
30 7654 11250
30 7698 12850
30 7844 11500
30 5845014 selected lines.
To get the subtotal of wages to each level of deptno and finally get a grand total
SQL > select deptno, empno, sum (sal)
2 of PEM
Group 3
4 by cumulative (deptno, empno);DEPTNO EMPNO SUM (SAL)
---------- ---------- ----------
10 7782 12450
10-7839-5000
10 17450
20 7369 12975
20 7566 12975
20 7788 13000
20 7876 11101
20 50051
30 7499 11600
30 7521 11250
30 7654 11250
30 7698 12850
30 7844 11500
30 58450
12595115 selected lines.
-
I am working on a form with three columns, one column is "Yes" = green, a column is 'No' = red and the other "current" yellow =.
The goal is to have control of the "NO" box when chosen turns red background. The other goal is also count all the boxes 'NO' in the column.
Currently, all the checkbox values '1' so I can count.
Ok. In this case, you can use something like this as action MouseUp-check boxes:
if (event.target.value=="1") event.target.fillColor = color.green; else if (event.target.value=="2") event.target.fillColor = color.red; else if (event.target.value=="3") event.target.fillColor = color.yellow; else event.target.fillColor = color.white;
To count all the answers not use this code as the calculation script custom of the text field where you want to display this number:
var total = 0; for (var i=1; i<=9; i++) { if (this.getField("standard_"+i).valueAsString=="2") total++; } event.value = total;
-
Help please SQL... Adding a column of total accumulated in a table
Tonight... I have the task of adding a column of total cumulative to a table that contains a list of transactions. The table contains entries for several accounts.
for example
create the table adam_test1
(
account char (4),
date of entry_date,
amount number 4,
Balance number 4
);
insert into adam_test1 values ('1000', January 1, 2000 ", 50", null);
insert into adam_test1 values ('1000', January 2, 2000 ', 40', null);
insert into adam_test1 values ('1000', 3 January 2000', '-50', null ");
insert into adam_test1 values ('1000', January 4, 2000 ', 10', null);
insert into adam_test1 values ('1000', 5 January 2000', '-250', null ");
insert into adam_test1 values ('1000', January 6, 2000', '100', null);
insert into adam_test1 values ('1000', January 7, 2000 ", 50", null);
insert into adam_test1 values ('2000,' 1 January 2000 ', 30', null);
insert into adam_test1 values ('2000', January 2, 2000 ', 10', null);
insert into adam_test1 values ('2000', 3 January 2000', '-520', null ");
insert into adam_test1 values ('2000', January 4, 2000', '140', null);
insert into adam_test1 values ('2000', 5 January 2000', '-4', null ");
insert into adam_test1 values ('2000', January 6, 2000 "," 120", null);
insert into adam_test1 values ('2000', January 7, 2000 ', 57', null);
SQL > select * from adam_test1;
ACCO ENTRY_DAT BALANCE AMOUNT
---- --------- ---------- ----------
1000 1 JANUARY 00 50
1000 2 JANUARY 00 40
1000 3 JANUARY 00-50
1000 4 JANUARY 00 10
1000 5 JANUARY 00-250
1000 6 JANUARY 00 100
1000 7 JANUARY 00 50
2000 1 JANUARY 00 30
2000 2 JANUARY 00 10
2000 3 JANUARY 00-520
2000 4 JANUARY 00 140
2000 JANUARY 5, 00-4
2000-6 JANUARY 00 120
2000-7 JANUARY 00 57
.. I tried a few things to fill the values using rowid, but I was not able to get anything to work - ideas?
Thank you!
AdamUse MERGE:
merge into adam_test1 t1 using ( select rowid, sum(amount) over(partition by account order by entry_date) balance from adam_test1 ) t2 on (t1.rowid = t2.rowid) when matched then update set t1.balance = t2.balance / ACCO ENTRY_DAT AMOUNT BALANCE ---- --------- ---------- ---------- 1000 01-JAN-00 50 50 1000 02-JAN-00 40 90 1000 03-JAN-00 -50 40 1000 04-JAN-00 10 50 1000 05-JAN-00 -250 -200 1000 06-JAN-00 100 -100 1000 07-JAN-00 50 -50 2000 01-JAN-00 30 30 2000 02-JAN-00 10 40 2000 03-JAN-00 -520 -480 2000 04-JAN-00 140 -340 ACCO ENTRY_DAT AMOUNT BALANCE ---- --------- ---------- ---------- 2000 05-JAN-00 -4 -344 2000 06-JAN-00 120 -224 2000 07-JAN-00 57 -167 14 rows selected. SQL>
SY.
-
Totals based on values that are generated by the formula in the column
For a report of historic opportunity, we have made a new column that generates a value (the type of contract) by the calculation of the duration of the contract. For example "Short term" (less than 12 months) or "Long term" (over 3 years). We do this by the CASE statement. Now, we want to have an overview by country of the number of possibilities of "short-term" contract, the number of contract opportunities 'Long term' etc. However, it seems that we can not display the metric of opportunity 'number of possibilities' as a total according to the result of the column that shows the type of contract. Someone knows how to fix this?Create another column and use the formula Count (possibility." The opportunity ID").
Once you create this form - use a pivot and view the results
-
How to create the default user interface is newly added to the columns in the table
I added the new columns to the database table existed who got the default values for the user interface to the columns existed.
How to create the default UI for the new columns.
I couldn't see the newly added columns change the default UI (object browser-> database-> default UI - Edit-> Table).
Using APEX 5.0.3
Can you please help.
Thank you.
Find the option "Synchronize with database" under tasks on the interface's default user - Edit
-
is it possible to apply the sort on the columns added to a dynamic display object?
Hi all
We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.
We have created a dynamic display object in the AM Impl, all objects in view columns are added dynamically.
All lines are displayed correctly, but when sorting columns data disappear. (point of view are being refreshed, of course).
is it possible to apply the sort on the columns added to a dynamic display object?
This is how we show data in the JSF page:
< af:table lines = ' #{bindings. " DynamicVO.rangeSize}' fetchSize = "#{bindings." DynamicVO.rangeSize}.
emptyText = "#{bindings." DynamicVO.viewable? "{'No data to display.': 'Access Denied.'}".
var = 'row' rowBandingInterval = '0' value = ' #{bindings. " DynamicVO.collectionModel}.
selectedRowKeys = ' #{bindings. " DynamicVO.collectionModel.selectedRow}.
selectionListener = "#{bindings." DynamicVO.collectionModel.makeCurrent}.
rowSelection = "single" id = "t1" >
< af:forEach elements = "#{bindings." Var DynamicVOIterator.attributeDefs}' = 'def' varStatus = 'vs' >
"< af:column headerText =" #{def.propertyMap.label} "sortable ="true"sortProperty =" #{def.name} ".
ID = "clmn$ {vs.index}" >
< af:outputText value = "#{row [def.name]}" id = "ot1" / > "
< / af:column >
< / af:forEach >
< / af:table >
Thanks guys, I created a custom class that contains a model that can be sorted in a pod of support and I have to the adf work table it and it is very good about sorting.
JSF:
Rows = "#{pageFlowScope.crudBean.dynamicTable.collectionModel.RowCount} '"
contentDelivery = 'immediate' var = 'row' rendered = 'true '.
Binding = "#{backingBeanScope.crudBackingBean.tasksTable} '"
selectionListener = "#{backingBeanScope.crudBackingBean.customListener} '"
"rowSelection ="single"id ="t1"partialTriggers =": pt_gr2 "columnStretching =" column: clmn0 ">
inlineStyle = "width: 100px;" ID = "clmn$ {vs.index}" > "
-
I have a table of the adf, I added a column that contains a button that I created, when I click it must remove this row in the table, but it is not, please help
I don't understand. You use vo and eo for you to use business components.
Again, this kind of code call in trouble.
You must post the changes to make them visible to the eo find vo. You must then run the query for the changes in the business layer strips then you must update the iterator he table is based on.
In your code I see that happen, hooch maybe because it is more often than not formatted and undocumented.
My advice is to do a small test case that you can manage with easy sql. Once you get it to run transfer you the results to the actual application.
Timo
Maybe you are looking for
-
Unwanted on the desktop folder
A new folder is on my desk that contains copies of all other folders located on my desktop. If I didn't put on my desk, it is also copied to this new mystery folder. Do not just throw it in the trash and l see what happens. Anyone has any idea where
-
Why have I not a fashion reader icon?
I tried to activate the drive Mode, as say the advice, but there is no icon next to the URL.
-
Re: Satellite L655-146 - start screen shaking when I play any game
Hello I bought this laptop about 5 months ago and since I'm doing that I had the same problem all the time. Tried a few things to do something, find some ideas on the internet but still nothing. It has Windows 7 Home premium 64 bit, 3 GB of Ram, Inte
-
Digital I/o, the use of P0.0 for 5V output
On my data acquisition device (USB-6009), I already use the pinout + 5V and ground to control a sensor. I need to put another of the same sensor in my test set-up. Can I use the P0.0 as one + 5V out? and just ground the same pinout (32) of the load?
-
Taken Max memory supported by HP G62-b50SQ.
Hello. 4 months ago I needed a laptop, and my choice was HP G62-b50sq. I am happy with my choice, but it came with only 3 GB of memory, and it is simply not enough for me. I read a lot of reviews and specifications of this particular configuration, a