Select simple lines that correspond to a column in the output of function group
Writing a query that will search through a set of data that returns the codes bar of the CompoundNames who have a quantity amount > 500.Then if it ran against the sample table below the output would be
0005
0006
0007
0008
0009
0010
Code bars, CompoundName, BatchId, quantity
--------------------------------------------------------------
0001, XE 1000, 1000 100 XE, 100
0002, XE 1000, 101 1000 X 100
0003, 102 1000 XE, XE 1000, 100
0004, XE 1000, 1000 103 XE, 100
0005, 2000 XE, XE 2000 100, 100
0006, 2000 XE, XE 100, 2000 101
0007, 2000 XE, XE 2000 102, 100
0008, 2000 XE, XE 2000 103, 100
0009, 2000 XE, XE 2000 104, 100
0010, 2000 XE, XE 2000 105, 100
0011, XE 3000, 3000 100 XE, 100
I had this day
Select CompoundName, Sum (Quantity) OF Table
CompoundName GROUP
HAVING Sum (Quantity) > 500)
compoundname order;
But I need every barcode corresponding to each batchid, while the total amount of lots is > 500.
TIA
Welcome to the Forum,
The following approach will work for you.
select distinct * from
(
Select Barcode, CompoundName, SUM(QUANTITY) over (partition by CompoundName) sumqty
FROM Table
)
where sumqty > 500
order by compoundname;
TRN
Sudhakar B.
Tags: Database
Similar Questions
-
TARGET column in the output of crs_stat
That said to TARGET what doc oracle on the column in the output of crs_stat
http://docs.Oracle.com/CD/B19306_01/RAC.102/b14197/crsref.htm
The TARGET value shows the State in which Oracle Clusterware tries to define the resource. If the TARGET value is ONLINE and a cluster node fails, then Oracle Clusterware tries to restart the application on another node if possible. Is there a condition requiring a resource STATE of being offline, as a required resource is offline, then the TARGET value remains online and Oracle Clusterware tries to start the application or an application resource once the problem is corrected.
Don't quite understand. So, if
Question2.TARGET = ONLINE , then that means this particular resourse should be up mandatorily ? and if TARGET = OFFLINE , then that means this particular resourse does not have to be up ?
Can someone tell me a scenario for a standard implementation of CARS, where you can find the TARGET = OFFLINEGarryB wrote:
So, ifTARGET = ONLINE , then that means this particular resourse should be up mandatorily ? and if TARGET = OFFLINE , then that means this particular resourse does not have to be up ?
It's also the way I understand it.
>
>
>Question2.
Can someone tell me a scenario for a standard implementation of CARS, where you can find the TARGET = OFFLINESuch as in the 11.2 CARS:
-ora.gsd is in offline mode by default because it is only necessary if you are using an Oracle 9.2 database according to http://docs.oracle.com/cd/E11882_01/install.112/e24616/postinst.htm#BABDAFGD.
-ora.oc4j is offline because it has not been implemented by Oracle. For example in http://docs.oracle.com/cd/E11882_01/rac.112/e17264/install_rac.htm#TDPRC175. -
Selecting a line to <; af:table >; triggers continuously refresh the page
Hello
I have a table that reflects the State of some data. When loading the page view fills correctly and sets the initial value on a detail panel.
When I select a line the page goes into a constant loop (post). The detail panel updates with the selection, but the loop continues.
We are doing something wrong or that someone has encountered this problem?
Thank you.
-Bill
Env: Build JDEVADF_11.1.2.4.0_GENERIC_130421.1600.6436.1
EDIT - cut any additional data that were not relevant to the response.Hello
on the link layer (PageDef) go to the iterator and set the property "ChangeEventPolicy" to "PPR" 'None '.
Frabnk
-
Control width of column in the output of the Script?
I want to use the button "Run the Script" (NOT execute statement) to run a SQL. I want an output text is easier to read (fixed-width fonts!) and save. The problem is that it is impossible to control the column width. SQLPlus style 'column' does not work. And even a few substr(), trim(), the column is completed up to the length (?) original.
For example, I want to display code source PLSQL USER_SOURCE:
SQLDeveloper pads the output to 4,000 characters (?), which makes the unusable output (for example, to save or even look at one). Using functions like the function rtrim(), substr() does not help.select text from user_source order by name, type, line
Because SQLDeveloper is displayed not correctly output of SQL, SQLPlus is still irreplaceable. But you need everything to prevent it kicked away from the buffer to the coil.
(OK I know that I can use dbms_metadata in this case.) But this is just one example...)
SQLDeveloper: 2.1.0.63
OS: Windows XP SP2
Published by: thtsang on July 13, 2010 11:43As you say, it's impossible.
However, I suggest that you get 2.1.1 with a fixed-width font in the grid of statement Run As. Then use the export of the grid (menu) or CTRL-+ A CTRL + C (or CTRL-SHIFT-C with position) If you want to save.Have fun
K. -
Alignments of column in the output HTM
Hello. I have a SQL script below which shows 3 columns in a HTM file. It works without error, but I noticed that when the display the output HTM column names are centered, but the column values are all justified to the left. Despite everything I've tried I can't seem to get the names of the columns to align left or column values to focus. Note that in the code below, I tried to use the option JUSTIFY opition on every column, but he seems to have no effect in the output.
Can anyone help?
fixed term
trigger the echo;
Set feedback off;
game check
put in head
set of 99 pages;
set pagesize 50;
set linesize 80;
SET MARKUP HTML ON SPOOL ON HEAD 'report ADDS < TITLE > < /title >-
"< STYLE TYPE =" TEXT/CSS"> <!-BODY {background: ffffc6}-> < / STYLE >.
coil/usr/IBM/WebSphere/AppServerCommunityEdition/repository/default/TTMSWeb/12
22365662123/TTMSWeb-1222365662123.war/scanner_returns_report.htm;
TTITLE "Scan Returns";
Col Device_Status format a13 HEADING "Device status" JUSTIFY LEFT;
Col Total format a5 HEADING "Total" JUSTIFY CENTER;
Col format a15 SECTION staff "Staff" JUSTIFY RIGHT;
Select b.device_status Device_Status, rtrim (count (a.reporter)) Total, c.first_na
me | » '|| c.last_name |' ('| c.Guid |') ' Staff
of scanner_assignment a, scanner_inventory b, pwc_employee c
where a.manufacturer_nm = b.manufacturer_nm
and a.serial_num = b.serial_num
and a.modify_by = c.guid
and trunc (a.return_dt) = trunc(sysdate-1)
and a.modify_by = '& 1' '.
and b.device_status = '0'
and b.device_status in ('0 ','8 ')
Group of c.first_name |' '|| c.last_name |' ('| c.Guid |') ", b.device_status
order of c.first_name |' '|| c.last_name |' ('| c.Guid |') ', b.device_status;
spool off;
output
/I can't get the names of the columns to align left or column values to focus.
Extend your style orders of sheet with the direction of alignment, for example
for example:
SQL> set markup html on entmap off head "" spool on
-
Ask the lines that correspond fully to another column
Hi all
Take into consideration the following 11 g:
CREATE TABLE X_A (COL1 NUMBER, COL2 NUMBER); create table x_b (col1 number); INSERT INTO X_A VALUES (1,2); insert into x_a values (1,3); INSERT INTO X_A VALUES (2,2); INSERT INTO X_B VALUES (2); insert into x_b values (3);
I want to interview table X_A only these col1 that match all records in X_B (i.e. value equal to '1').
If I join the 2 tables by x_a.col2 - x_b.col1 I have two values 1 and 2 col1. But I want only 1 to appear because it contains 2.3 in x_b.col2
Any ideas?
Kind regards
Stoyanov
Join partition using
select col1, col2 from ( select a.col1, a.col2, count(a.col2) over(partition by a.col1) cnt1, count(b.col1) over(partition by a.col1) cnt2 from x_b b left join x_a a partition by (a.col1) on a.col2 = b.col1 ) where cnt1 = cnt2
-
ToolTip for the report header classic of report column using the PL/SQL function
Good afternoon
I need to add tooltips to my report header, when a user points to the topic title column I need to display the full title.
Theme 101, Apex 4.2, Oracle 11g
code below:
{code}
DECLARE
CLOBL V_HEADINGS
vusr VARCHAR2 (5);
V_ERR_MSG VARCHAR2 (15);
BEGIN
SELECT SME_C
IN vusr
OF SME_LU
WHERE SUPERIOR (SME_LU. SME_USERID) = v ('APP_USER');
V_HEADINGS: = ' ';
SELECT 'UTC' |': ' |' UIC' | ' :'|| SUBSTR (HEADING1, 1, INSTR(HEADING1,'-',1)-1) |': ' | TITLE2 |': ' |' TITRE3 |': ' | CHAPTER 4: ': ' | ... AT HEADING25
IN V_HEADING
OF FORCE_GEN_UNIT_REPORT_HEADINGS
WHERE FORCE_GEN_SME_CREATOR_C = vusr;
RETURN V_HEADINGS;
EXCEPTION
WHEN NO_DATA_FOUND THEN
V_ERR_MSG: = ' ';
END;
{code}
The header will display like this 4.1 4.0 MCT MCT...
The substr () /instr () in the first section, that's what I want to display. I looked at other messages and I am confused on how to do it. Any help is greatly appreciated.
Thank you
Mary
It's the great Mary.
Please report the thread as "Correctly answered" so that others can benefit from this information.
Thank you
-Jorge
-
Index on two columns becomes the index of function?
Hello, I create a unique index with two columns, a number (9) and a date.
It becomes an index of feature based with the number column and a column sys hidden (date).
When I do queries that use this index the autotrace tells me it does things like this:
sys_nc00001$ > SYS_OP_DESCEND (datevalue)
sys_nc00001$ IS NOT NULL
How is he did not have a normal index?Use of ESCR does this.
Of http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm
Oracle database processes Index descending as if they were focused on the index function.
-
Column for the 11 g function Pivot number formatting
Hello
I have a question regarding the formatting of data in a PivotTable.
I have the pivot:
Select * from
(
Select
ENAME,
EMPLOYMENT,
Sal Sum (SAL)
from EMP
Group by ename, job
)
Pivot
(
Sum (SAL) as salary for (JOB) in ('SELLER', 'MANAGER')
)
and the results:
-------------------------------------------------------------------------------
'SELLER' _SALARY 'MANAGER' _SALARY ENAME
JONES - 2975
ALLEN 1600-
FORD-
CLARK - 2450
MILLER-
WARD - 1250
How can I format the results of the Pivot to have salary format as for thousands comma ',' as: 'select TO_CHAR(500000000000,'999G999G999G999G999G999G990','NLS_NUMERIC_CHARACTERS=.,') from dual; Is this possible?
I can't use to_char() function is central, because it is not an aggregate work so TO_CHAR (SUM (.)) is not possible and the base SUM (TO_CHAR (.)) because its a mistake?
Help, please.
Kind regards
Alexselect ENAME, TO_CHAR("'SALESMAN'_SALARY",'999G999G999G999G999G999G990','NLS_NUMERIC_CHARACTERS=.,') salary from ( select ENAME, JOB, sum(SAL) sal from EMP group by ename, job ) pivot ( sum(sal) as Salary for (JOB) in ('SALESMAN','MANAGER') )
-
> Now I'm unlable to select more number of lines that are not a sequence in a single page to copy the data rows and paste somewhere in one fell swoop.
> Is this concept implemented in Windows 7. ?
> Is there a provision (method) to select several lines that are not continuous across the keyboard or the mouse in windows 7?Byagaris,
It depends on what program you are trying to copy and paste into. You are able to select continuous, multiple lines, by using the Ctrl Key and clicking, or by highlighting the desired line. For example, I held the Ctrl key and then, using the mouse, has highlighted several different phrases in the various paragraphs, and could then copy them. This feature is available for several versions of windows.
If you are not able to perform this action then post what happens when you try and what program you try it.
Mike - Engineer Support Microsoft Answers
Visit our Microsoft answers feedback Forum and let us know what you think. -
selection of lines AF:table after sorting
Hello
If I select a line to an af:table and then to sort a column, the first line in the sorted table is selected.
Is there a way to keep the selection while sorting?
jdev versions:
-11.1.1.4.
-11.1.2.0.
Edited by: Fortega January 25, 2012 0:47Please mention your version jdev 11g being ambiguous...
A sorting table normally means that the query is executed again with the selected sorting criteria. It also means that the current line that you checked before disappeared and the first line is marked as the current line.
You can save the key to the current line before the sort and place after sorting (using a managed bean).
However, you should be aware of the impact:
lets assume your table has 1000 rows and is sorted by Crescent after the default name column. Now select you the first line and click Descending in the same column. In this case the selected line will now be the last line. This line is not visible, then you need to scroll in the view with the effect that all the lines are read into memory. If you have 100000 lines that get worse (more memory and more time).Timo
-
Hello
I need a JTable where selection of lines is allowed, but not only with the entire line, but individual cells in a single line interval.
When the user has pressed the mouse button and move the mouse inside the line cells get added or released to the selection.
When he leaves the current line and releases the mouse button outside the line, that nothing is selected.
In addition, it would be when the user leaves the line with the mouse button down and enters the line again, select the cell containing the user started
is highlighted again.
I tried a lot of things with the SelectionModel, the JTable.rowSelectionAllowed () and the JTable.columnSelectionAllowed (), but I do not have the behavior that I want to have.import javax.swing.*; import javax.swing.event.*; public class TestTable extends JPanel{ private JTable table; private JFrame frame; /** * @param args */ public TestTable(JFrame frame) { this.frame = frame; this.table = new JTable(10, 10); this.table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); //this.table.setRowSelectionAllowed( false ); //this.table.setColumnSelectionAllowed( true ); this.table.setCellSelectionEnabled(true); ListSelectionModel rowSelMod = this.table.getSelectionModel(); rowSelMod.addListSelectionListener( (new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel)e.getSource(); System.out.println(lsm.getAnchorSelectionIndex()); } })); this.add(this.table); } public static void main(String[] args) { TableView.setMetalLookAndFeel(); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame frame = new JFrame("Example"); //frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TestTable newContentPane = new TestTable(frame); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); frame.pack(); frame.setVisible(true); frame.setLocation(10, 20); } }
The ListSelectionModel model in the valueChanged method has just information about the index of the current column, but no information on the row index.
Kind regards
ChangHi Chang,
This allows you to select cells in a row and a single row:
import javax.swing.*; import javax.swing.event.*; public class TestTable extends JPanel { private JTable table; private JFrame frame; private int selectedRow = -1; private final ListSelectionListener columnSelectionListener; public TestTable(JFrame frame) { this.frame = frame; this.table = new JTable(10, 10); this.table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); this.table.setCellSelectionEnabled(true); this.add(this.table); //row selection listener: ListSelectionListener rowSelectionListener = new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); selectedRow = lsm.getAnchorSelectionIndex(); } } }; table.getSelectionModel().addListSelectionListener(rowSelectionListener); //column selection listener: columnSelectionListener = new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { final int row = selectedRow; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); int anchorSelectionIndex = lsm.getAnchorSelectionIndex(); int leadSelectionIndex = lsm.getLeadSelectionIndex(); lsm.removeListSelectionListener(columnSelectionListener); table.changeSelection(row, anchorSelectionIndex, false, false); table.changeSelection(row, leadSelectionIndex, false, true); lsm.addListSelectionListener(columnSelectionListener); } } }; table.getColumnModel().getSelectionModel().addListSelectionListener(columnSelectionListener); } public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame frame = new JFrame("Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TestTable newContentPane = new TestTable(frame); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); frame.pack(); frame.setVisible(true); frame.setLocation(10, 20); } }
It will be useful.
See you soon,.
André -
I have a ListField in my application and I want to allow the user to select several lines that are not necessarily side by side. Selection of lines 0, 3, 5, 9 and 10 for example. How can I allow this behavior with a ListField?
Thank you.
It is not supported, but you can implement it yourself (as selected by hand, paint lines create a method getSelected etc.)
-
How to convert multiple lines in 1 row of columns across
Hello
My DB 10g
My data as below,
I've already tilt it by84A8E46E9366 20111008133638 84A8E46E9366 20111112000531 84A8E46E9366 20111212004432 84A8E46E9366 20120127173533 84A8E46E9366 20120226235444
and get the result as below with only 2 columnselect msid, rtrim (xmlagg (xmlelement (e, fee || '|')).extract ('//text()'), '|') fee from aaa_bill where msid='84A8E46E9366' and fee is not null group by msid;
but I need the result to be on multiple columns.84A8E46E9366 20111008133638|20111112000531|20111212004432|20120226235444|20120127173533
so I tried the following
but the result, only the first stringselect msid,REGEXP_SUBSTR ( fee , '^[^|]*' ) from ( select msid, rtrim (xmlagg (xmlelement (e, fee || '|')).extract ('//text()'), '|') fee from aaa_bill where msid='84A8E46E9366' and fee is not null group by msid ) ;
84A8E46E9366 20111008133638
is it possible to get Thos on several columns each string on column separated automatically because I have about 20000 msid separateHello
See the FAQ forum: {message identifier: = 9360005}
In Oracle 10, you can do this:
WITH got_c_num AS ( SELECT msid , fee , ROW_NUMBER () OVER ( PARTITION BY msid ORDER BY fee -- or whatever ) AS r_num FROM aaa_bill WHERE ... ) SELECT msid , MIN (CASE WHEN c_num = 1 THEN fee END) AS col_1 , MIN (CASE WHEN c_num = 2 THEN fee END) AS col_2 , MIN (CASE WHEN c_num = 3 THEN fee END) AS col_3 ... , MIN (CASE WHEN c_num = n THEN fee END) AS col_n FROM got_c_num GROUP BY msid ORDER BY msid -- If wanted ;
Note that you must specify the number of columns in the output. If you are unsure, do a high hypothesis. The query works always; unused columns will be NULL.
Published by: Frank Kulash on 12 March 2012 14:45
-
How can disable us the selection of lines under condition
Hi Experts,
JDEV version 12.1.3.0
How can disable us the selection of lines under certain conditions.
As the lines newly unregistered should be allowing the selection of lines.
Saved lines should be disabled from the selection.
Can achieve us.
Please me advice accrdingly
Thank you
Roy
You are implementing a generic selection as shown here http://www.oracle.com/technetwork/developer-tools/adf/learnmore/23-generic-table-selection-listener-169162.pdf Manager in this handler, you check and validate the selection of our not.
Timo
Maybe you are looking for
-
How to preview the message in mail on the mac sierra?
I just upgraded to sierra and now I've lost the message preview pane in mail. I just message headers and the first 3 lines, which is normally only on the left side of the screen. He now saw there panal which shows the body of the email without having
-
must continue to move the mouse to completely open a website, what can I do to reslove?
I have to keep moving the mouse backward for a site Web opens if I do not have the site stalls.Is that what I can do to fix this?
-
About 100 names in my Hotmail received a phony call for money. Then someone changed my password. I reported to Hotmail twice and told me to check the private forum, but never said how/where. It's maddening. Thanks for any help.
-
Green screen no display video but audio available
When you try to watch a video online or through netflix, all I get is a green white screen though I can hear the audio he. How can I solve this problem? or is it a question of manufacturer and maybe I'd come back just portable th.? I only got it for
-
Change StandardListItem, rebuild it as ListItemComponent
Hello I like the look and feel of a StandardListItem in a ListView. Unfortunately, it cannot be changed easily. Now, I'm trying to rebuild this StandardListItem like a ListItemComponent of several containers and labels. The layout of the dispute tags