Column selection
Hey ho!
I have a JTable which has an x number of rows and columns. Each of the table's columns as a JComboBox as it's header, with multiple options. I need an option where the user can select all rows in the column when selecting a "select all" option from the combobox.
How do I do this ? I couldn't find any suitable methods for it.
Thanks.
Hi,
2 proper calls to the changeSelection-method of the JTable should do that, I guess:
1. set the first row in the column to be selected
2. extend this selection to the last row in the column
this 2 things can be done by calls to the changeSelection-methode.
greetings Marsian
Similar Messages
-
Hi All,
Suppose I have table, whose structure changes frequently on daily basis.
For eg. desc my_table gives you following column name on Day 1
SQL > desc my_table;
Output
Name
Age
Phone
On Day 2, two more columns are added, viz, Address and Salary.
SQL > desc my_table;
Output
Name
Age
Phone
Address
Salary
Now I want to create an Dynnamic RTF report which would fetch data from ALL columns from my_table on daily basis. For that I have defined a concurrent program with XML as output type and have attached a data template/data definition to it which takes in XML as input and gives final output of conc program in EXCEL layout. I am able to do this for constant number of columns, but dont know how to do it when the number of columns to be displayed changes dynamically.
For Day 1 my XML file should be like this.
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
SELECT Name
,Age
,Phone
FROM my_table
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_my_table" source="Q2">
<element name="Name" value="Name" />
<element name="Age" value="Age" />
<element name="Phone" value="Phone" />
</group>
</dataStructure>
</dataTemplate>
And my Day 1, EXCEL output from RTF template should be like this.
Name Age Phone
Swapnill 23 12345
For Day 2 my XML file should be like this. With 2 new columns selected in SELECT clause.
<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XYZ" description="iExpenses Report" Version="1.0">
<dataQuery>
<sqlStatement name="Q2">
<![CDATA[
SELECT Name
,Age
,Phone
,Address
,Salary
FROM my_table
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_my_table" source="Q2">
<element name="Name" value="Name" />
<element name="Age" value="Age" />
<element name="Phone" value="Phone" />
<element name="Address" value="Address" />
<element name="Salary" value="Salary" />
</group>
</dataStructure>
</dataTemplate>
And my Day 2, EXCEL output from RTF template should be like this.
Name Age Phone Address Salary
Swapnill 23 12345 Madrid 100000
Now, I dont know below things.
Make the XML dynamic as in on Day 1 there must be 3 columns in the SELECT statement and on Day 2, 5 columns. I want to create one dynamic XML which should not be required to be changed if new columns are added in my_table. I dont know how to create this query and also create their corresponding elements below.
Make the RTF template dyanamic as in Day1 there must 3 columns in EXCEL output and on Day 2, 5 columns. I want to create a Dynamic RTF template which would show all the columns selected in Dynamic XML.I dont know how the RTF will create new XML tags and how it will know where to place it in the report. Means, I can create RTF template on Day 1, by loading XML data for 3 columns and placing 3 XML tags in template. But how will it create and place tags for new columns on Day 2?
Hope, you got my requirement, its a challenging one. Please let me know how I can implement the required solution using RTF dynamically without any manual intervention.
Regards,
Swapnil K.
Message was edited by: SwapnilKHi All,
I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
Please let me know if there is any oracle functionality to do this.
If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
For eg, /$APPL_TOP/ar/1.0/sql or something.
Regards,
Swapnil K. -
How to generate a second csv file with different report columns selected?
Hi. Everybody:
How to generate a second csv file with different report columns selected?
The first csv file is easy (report attributes -> report export -> enable CSV output Yes). However, our users demand 2 csv files with different report columns selected to meet their different needs.
(The users don't want to have one csv file with all report columns included. They just want to get whatever they need directly, no extra columns)
Thank you for any help!
MZHello,
I'm doing it usually. Typically example would be in the report only the column "FIRST_NAME" and "LAST_NAME" displayed whereas
in the csv exported with the UTL_FILE the complete address (street, housenumber, additions, zip, town, state ... ) is written, these things are needed e.g. the form letters.
You do not need another page, just an additional button named e.g. "export_to_csv" on your report page.
The csv export itself is handled from a plsql procedure "stored procedure" ( I like to have business logic outside of apex) which is invoked by pressing the button "export_to_csv". Of course the stored procedure can handle also parameters
An example code would be something like
PROCEDURE srn_brief_mitglieder (
p_start_mg_nr IN NUMBER,
p_ende_mg_nr IN NUMBER
AS
export_file UTL_FILE.FILE_TYPE;
l_line VARCHAR2(20000);
l_lfd NUMBER;
l_dateiname VARCHAR2(100);
l_datum VARCHAR2(20);
l_hilfe VARCHAR2(20);
CURSOR c1 IS
SELECT
MG_NR
,TO_CHAR(MG_BEITRITT,'dd.mm.yyyy') AS MG_BEITRITT ,TO_CHAR(MG_AUFNAHME,'dd.mm.yyyy') AS MG_AUFNAHME
,MG_ANREDE ,MG_TITEL ,MG_NACHNAME ,MG_VORNAME
,MG_STRASSE ,MG_HNR ,MG_ZUSATZ ,MG_PLZ ,MG_ORT
FROM MITGLIEDER
WHERE MG_NR >= p_start_mg_nr
AND MG_NR <= p_ende_mg_nr
--WHERE ROWNUM < 10
ORDER BY MG_NR;
BEGIN
SELECT TO_CHAR(SYSDATE, 'yyyy_mm_dd' ) INTO l_datum FROM DUAL;
SELECT TO_CHAR(SYSDATE, 'hh24miss' ) INTO l_hilfe FROM DUAL;
l_datum := l_datum||'_'||l_hilfe;
--DBMS_OUTPUT.PUT_LINE ( l_datum);
l_dateiname := 'SRNBRIEF_MITGLIEDER_'||l_datum||'.CSV';
--DBMS_OUTPUT.PUT_LINE ( l_dateiname);
export_file := UTL_FILE.FOPEN('EXPORTDIR', l_dateiname, 'W');
l_line := '';
--HEADER
l_line := '"NR"|"BEITRITT"|"AUFNAHME"|"ANREDE"|"TITEL"|"NACHNAME"|"VORNAME"';
l_line := l_line||'|"STRASSE"|"HNR"|"ZUSATZ"|"PLZ"|"ORT"';
UTL_FILE.PUT_LINE(export_file, l_line);
FOR rec IN c1
LOOP
l_line := '"'||rec.MG_NR||'"';
l_line := l_line||'|"'||rec.MG_BEITRITT||'"|"' ||rec.MG_AUFNAHME||'"';
l_line := l_line||'|"'||rec.MG_ANREDE||'"|"'||rec.MG_TITEL||'"|"'||rec.MG_NACHNAME||'"|"'||rec.MG_VORNAME||'"';
l_line := l_line||'|"'||rec.MG_STRASSE||'"|"'||rec.MG_HNR||'"|"'||rec.MG_ZUSATZ||'"|"'||rec.MG_PLZ||'"|"'||rec.MG_ORT||'"';
-- DBMS_OUTPUT.PUT_LINE (l_line);
-- in datei schreiben
UTL_FILE.PUT_LINE(export_file, l_line);
END LOOP;
UTL_FILE.FCLOSE(export_file);
END srn_brief_mitglieder;Edited by: wucis on Nov 6, 2011 9:09 AM -
How can I get two column selection list in my html form
I required to have two column selection list in my jsp page to show name and description of a product. How can i achieve this functionality or is there any other alternative to do so.
If i understand correctly: you can't actually create two columns in a list because it can only hold one value. The only way to achieve what you want is by concatenating the two values you want to display and put this as the value of the listbox.
-
Webdynpro ABAP ALV in SAP ECC6 - EHP4: To disable Column Selection
Hi All,
We are using SAP ECC6 EHP4 and for Webdynpro ABAP application, after each column a vertical white line is appearing, and I need to hide this..
SAP suggested us to disable COLUMN SELECTION I have tried the below code but still I am not able to get this done..
Can you please suggest the appropriate method to achieve the same.
Code:
* show tab COLUMN SELECTION in Settings page
CALL METHOD wd_this->alv_conf_table->if_salv_wd_std_functions~set_column_selection_allowed
EXPORTING value = ABAP_false..
here alv_conf_table refers to CL_SALV_WD_CONFIG_TABLE.
Thanks in advance.
Thanks
Srinivas
Edited by: Srinivas Manchi on Apr 22, 2010 11:35 AM
Edited by: Srinivas Manchi on Apr 22, 2010 1:06 PMYou have to disable the DDic binding on the column before your override text will show up:
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data l_salv_wd_table type ref to iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv( ).
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data l_column type ref to cl_salv_wd_column.
l_column = l_table->if_salv_wd_column_settings~get_column( 'POSTING_DATE' ).
data l_header type ref to cl_salv_wd_column_header.
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_text( `Posting Date` ). -
XL-Reporter - Financial Periods specified in row and column selections
Hello to all,
again I have no idea how to solve an XLR problem after I tried different ways with unwanted results and after trying to find suggestions in the samples and help files.
As a result I need a report which looks roughly like this
2007 2006 2005 ...
Jan.
Feb.
Mar.
Dec.
where each cell of the matrix is the total of invoices of a selected customer over the month in the specified year.
I mainly tried to solve this in two different ways.:
1.)
Definition of a parameter for finacial period: name=fp, dimension, type=financial period, attribute=code
Column selection summary for each year: PER(code=YearAll(@fp)) resp. PER(code=YearAll(@fp-12)) ...
Row selection expansion: BPA(CardCode=@customer) ARDT(Code=Invoice) PER(PeriodInYear=1:12) Group By PER.PeriodInYear
In each cell of the matrix the data attribute =ixGet(SO_LineTotal) is specified.
The cell in the first colum (month) of the matrix is =ixDimGet(PER; PeriodInYear).
2.)
No parameter for the financial period is defined;
Column selection summary for each year: PER(Year=2007) resp. PER(Year=2006) ...
The rest is the same as in 1.)
As a result I actually get a matrix with a column for each year and a row for each month, where the first column is 1, 2, ..., 12 (this is OK).
But for all 12 month I get the same value, which is the (correct) total value for the whole year!
Where is the failure in my intuition?
Many thanks for your help!
Regards,
Frank RomeniI found it works if I don't set the selection to period in the Column and row. Here are my selections
Row
Row 8-9 Expanding
PER( * ) Group By PER.PeriodInYear
Row 9 Expanding
FACT BPA( CardCode = @BPCode ) ARDT( Code = "Invoice" )
Column
Column C Expanding
FACT FIG( SO_TaxDate >= "01/01/2007" ) PER( * ) Group By PER.Year
then I use a Column total to total the row expansion of the SO_LineTotal with =SUM( ixRef(C9,2) ) were C9 is the expanding SO_LineTotal. Then I hide Row 9 in excel to hide the details.
If you post your email I can send you the IXR report definition
Dan -
Multiple column selection in ssrs report
Hi all
I am developing one report
which would be based on column selection combo
what i want to achieve...
i will use Store procedure
and in my report i want multi select parameter called @Column_To_Select
i want available values for combobox as total column names which is return by store procedure
and when i select column1 is should only display column1 from tablix
can one help how can i get column names from store procedure
Dilip Patil..You cant alter dataset like this. metadata has to be constant for SSRS report to work properly.
I think your requirement should be implemented as follows. Always bring all columns from query inside dataset. Then in your report container (tablix/matrix) set an expression for columns visibility property to show only when select parameter value has the
column name.
The expression would be like below for hidden property each column
=IIF(InStr("," & Join(Parameters!Columnnames.Value,",") & ",",",ColumnName,")>0,False,True)
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Is there any way to do text column selection and editing with JDeveloper? Why is column selection so often overlooked in editors such as JDeveloper and Eclipse while editors I've used years ago (Brief, UltraEdit, MultiEdit, etc) had great support for column editing?
Editing text. Not HTML, not db columns. The ability to highlight and mark a rectangular section of text. Also known as block editing. The ability to highlight a vectical column as opposed to a horizontal column.
-
Hi Experts,
Can you please help me in setting the ALV column selectable ?
I have set the column selection state at no selected at the initialization.
But when I am trying to select the column selecting the column header,. the column is not getting selected?
Am I missing something ?
Please suggest.
Thanks,
SoniaHi,
Refer http://scn.sap.com/thread/1455658 also refer standard help http://help.sap.com/saphelp_erp60_sp/helpdata/en/38/c5bacc91a345eda17f2903491c391d/content.htm
Regards,
Chandra -
As I can capture or recognize a column selected in a ALV ?
I'm not sure if you can recognize more selected colums, but you can definitely read the column name which is selected as the first in the field catalog.
If it runs to user_command form, you'll find it in the rs_selfield-fieldname. The rs_selfield structure itself will provide you with more information what might be useful, check it yourself.
Filip -
How to create column selection variant for VA05?
Hi Experts,
How do I create column selection variant for VA05?
Thanks,
SachinHi,
Goto SU3, enter user name and press enter
goto parameters tab, enter parameter ID SD_VARIANT_MAINTAIN and parameter value 'A' and save.
Now check in VA05, you will get save button in active mode.
Regards,
Chandra -
Why request "afr/column-select.cur" when move mouse?
I runed a ADF page with a ADF table component, and I notice a strange phenomenon:
When I moved mouse on the ADF table each time, it would send a reqeust "afr/column-select.cur".
I guess it is the cursor defination file for ADF table, but why send reqeusts to the server for this file each time?
Does it affect the performance?Hi,
I think you should "clean-All" your project first and then rebuilt.Make sure you have not applied any clientListener on the form.
Hope it helps.
Regards,
Shah -
Multiple Rows and Columns selection on ALV
Hi all,
What is the best solution to allow the multiple selection or combination of selection (rows and columns) on an ALV ?
I would like to be able to select some rows and some columns and to get the result cells in order to update them.
Thanks in advance for your help.
DavidThanks Srinivas and Seela,
I forgot to precise that my ALV is dynamic, I used the method 'add_new_child_node'.
I tried the different possibilties with method attributes but I don't find the good attributes combination to allow columns selection.
I add also that I have to be able to select several no adjacent columns.
What do you think about this workaround :
Is it possible to add a line on my ALV with checkbox between the header line (with column title) and data line.
I will search using the method add_cell_variant but I don't know if it's possible with dynamic ALV.
Thanks.
David -
Table Sorting based on Column Selection
Dear All,
I am using an AbstractTableModel. I would like to implement the sorting based on Column selection. Could anyone help me in this please.
Thanks in advance,
Regards
Irfaancheck this
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Hashtable;
public class TableSorter extends JPanel
private boolean DEBUG = false;
private Object[] columnNames = { "First Name", "Last Name", "Sport", "# of Years",
"Vegetarian"};
private Object[][] data = { { "Mary", "Campione", "Snowboarding", 1, 2 },
{ "Alison", "Huml", "Rowing", 3, 4 }, { "Kathy", "Walrath", "Knitting", 5, 9 },
{ "Sharon", "Zakhour", "Speed reading", 6, 10 }, { "Philip", "Milne", "Pool", 7, 11 },
{ "Isaac", "Rabinovitch", "Nitpicking", 8, 12 }, };
private SortFilterModel m_modSortFilterModel;
private TableColumnModel m_modColumnModel;
private TableHeaderRenderer m_btnSorterRenderer;
protected boolean m_bAbCOC = true;
JTable table = new JTable();
public TableSorter()
super(new GridLayout(1, 0));
m_modSortFilterModel = new SortFilterModel();
m_modSortFilterModel.addMouseListener(table);
table.setModel(m_modSortFilterModel);
m_btnSorterRenderer = new TableHeaderRenderer();
m_modColumnModel = table.getColumnModel();
for (int i = 0; i < columnNames.length; i++)
m_modColumnModel.getColumn(i).setHeaderRenderer(m_btnSorterRenderer);
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
private class SortFilterModel extends AbstractTableModel
int[] indexes;
ATSTableSorter sorter;
public String[] tableHeadersArray;
boolean isAscent = true;
public void addMouseListener(final JTable table)
table.getTableHeader().addMouseListener(new MouseAdapter()
public void mouseClicked(MouseEvent event)
int tableColumn = table.columnAtPoint(event.getPoint());
m_btnSorterRenderer.setPressedColumn(tableColumn);
m_btnSorterRenderer.setSelectedColumn(tableColumn);
if (TableHeaderRenderer.DOWN == m_btnSorterRenderer.getState(tableColumn))
isAscent = true;
else
isAscent = false;
// translate to table model index and sort
int modelColumn = table.convertColumnIndexToModel(tableColumn);
sortByColumn(modelColumn, isAscent);
public Object getValueAt(int row, int col)
int rowIndex = row;
if (indexes != null)
rowIndex = indexes[row];
return data[rowIndex][col];
public void setValueAt(Object value, int row, int col)
int rowIndex = row;
if (indexes != null)
rowIndex = indexes[row];
super.setValueAt(value, rowIndex, col);
public void sortByColumn(int column, boolean isAscent)
if (sorter == null)
sorter = new ATSTableSorter(this);
sorter.sort(column, isAscent);
fireTableDataChanged();
public int[] getIndexes()
int n = getRowCount();
if (indexes != null)
if (indexes.length == n)
return indexes;
indexes = new int[n];
for (int i = 0; i < n; i++)
indexes[i] = i;
return indexes;
public int getRowCount()
return data.length;
public String getColumnName(int c)
return columnNames[c].toString();
public int getColumnCount()
return columnNames.length;
public Class getColumnClass(int col)
switch (col)
case 0:
return String.class;
case 1:
return String.class;
case 2:
return String.class;
case 3:
return Integer.class;
case 4:
return Integer.class;
default:
return Object.class;
class ATSTableSorter
SortFilterModel model;
public ATSTableSorter(SortFilterModel model)
this.model = model;
public void sort(int column, boolean isAscent)
int n = model.getRowCount();
int[] indexes = model.getIndexes();
for (int i = 0; i < n - 1; i++)
int k = i;
for (int j = i + 1; j < n; j++)
if (isAscent)
if (compare(column, j, k) < 0)
k = j;
else
if (compare(column, j, k) > 0)
k = j;
int tmp = indexes;
indexes[i] = indexes[k];
indexes[k] = tmp;
public int compare(int column, int row1, int row2)
Object o1 = model.getValueAt(row1, column);
Object o2 = model.getValueAt(row2, column);
if (o1 == null && o2 == null)
return 0;
else if (o1 == null)
return -1;
else if (o2 == null)
return 1;
else
Class type = model.getColumnClass(column);
if (type.getSuperclass() == Number.class)
return compare((Number) o1, (Number) o2);
else if (type == String.class)
return ((String) o1).compareTo((String) o2);
else
return ((String) o1).compareTo((String) o2);
public int compare(Number o1, Number o2)
double n1 = o1.doubleValue();
double n2 = o2.doubleValue();
if (n1 < n2)
return -1;
else if (n1 > n2)
return 1;
else
return 0;
class TableHeaderRenderer extends JButton implements TableCellRenderer
public static final int NONE = 0;
public static final int DOWN = 1;
public static final int UP = 2;
int pushedColumn;
Hashtable state;
public TableHeaderRenderer()
pushedColumn = -1;
state = new Hashtable();
setMargin(new Insets(0, 0, 0, 0));
setHorizontalTextPosition(LEFT);
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus,
int row, int column)
setText((value == null) ? "" : value.toString());
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
boolean isPressed = (column == pushedColumn);
getModel().setPressed(isPressed);
getModel().setArmed(isPressed);
return this;
public void setPressedColumn(int col)
pushedColumn = col;
public void setSelectedColumn(int col)
if (col < 0)
return;
Integer value = null;
Object obj = state.get(new Integer(col));
if (obj == null)
value = new Integer(DOWN);
else
if (((Integer) obj).intValue() == DOWN)
value = new Integer(UP);
else
value = new Integer(DOWN);
state.clear();
state.put(new Integer(col), value);
public int getState(int col)
int retValue;
Object obj = state.get(new Integer(col));
if (obj == null)
retValue = NONE;
else
if (((Integer) obj).intValue() == DOWN)
retValue = DOWN;
else
retValue = UP;
return retValue;
private static void createAndShowGUI()
JFrame frame = new JFrame("TableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
TableSorter newContentPane = new TableSorter();
newContentPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
public static void main(String[] args)
javax.swing.SwingUtilities.invokeLater(new Runnable()
public void run()
createAndShowGUI(); -
Index usage depends on columns selected
Hi, somehow cannot understand why index is not used, please help.
in Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
1. Included only indexed column and got a perfect plan
explain plan for2 select s.x_cnt
3 from reported_summary s
4 where s.x_cnt>0;
PLAN_TABLE_OUTPUT
Plan hash value: 2674489506
| Id | Operation | Name | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 306 (8)|
|* 1 | INDEX FAST FULL SCAN| S_NUI01 | 306 (8)|
Predicate Information (identified by operation id):
1 - filter("s"."x_CNT">0)
2. Included some other column and got TABLE ACCESS FULL
explain plan for2 select s.x_cnt,s.ru_id
3 from reported_summary s
4 where s.x_cnt>0;
PLAN_TABLE_OUTPUT
Plan hash value: 2142873335
| Id | Operation | Name | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 2421 (3)|
|* 1 | TABLE ACCESS FULL| REPORTED_SUMMARY | 2421 (3)|
Predicate Information (identified by operation id):
1 - filter("s"."x_CNT">0)
3. Included all other columns and got TABLE ACCESS FULL as well
explain plan for2 select s.x_cnt,s.*
3 from reported_summary s
4 where s.x_cnt>0;
PLAN_TABLE_OUTPUT
Plan hash value: 2142873335
| Id | Operation | Name | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 2421 (3)|
|* 1 | TABLE ACCESS FULL| REPORTED_SUMMARY | 2421 (3)|
Predicate Information (identified by operation id):
1 - filter("s"."x_CNT">0)
Thanks a lotThanks all, just to clarify
"select s.x_cnt from reported_summary s..." is using index;
"select 'Y' y from reported_summary s..." is using index;
"select <any ohter column> from reported_summary s..." is causing TABLE ACCESS FULL;
no differences in where clause, no order by at all
the index script is
CREATE INDEX S_NUI01 ON REPORTED_SUMMARY (OFFSET_CNT) TABLESPACE X_INDEXES;
jgarry, thanks for the answer, the only problem that I have clone of the database (32 bit) with same CBO parameters
where it does not behave this way:
explain plan for2 select s.offset_cnt
3 from reported_summary s
4 where s.offset_cnt>0;
PLAN_TABLE_OUTPUT
Plan hash value: 2359470296
| Id | Operation | Name | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 9 (0)|
|* 1 | INDEX RANGE SCAN| S_NUI01 | 9 (0)|
Predicate Information (identified by operation id):
1 - access("s"."OFFSET_CNT">0)
explain plan for2 select s.offset_cnt,s.ru_id
3 from reported_summary s
4 where s.offset_cnt>0;
PLAN_TABLE_OUTPUT
Plan hash value: 3732627180
| Id | Operation | Name | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 67 (0)|
| 1 | TABLE ACCESS BY INDEX ROWID| REPORTED_SUMMARY | 67 (0)|
|* 2 | INDEX RANGE SCAN | S_NUI01 | 9 (0)|
Predicate Information (identified by operation id):
2 - access("s"."OFFSET_CNT">0)
Thanks again. -
Get OLD&NEW value of an UPDATED column selected dynamically in a Trigger
Hi All,
I am writting a trigger which take column name dynamically. And on the basis of that column it should give me old value as well as updated value of a column corresponding to a modified row.
OOO_SCHEDULE is my table name;
Note: This is only for test so I am writting only for update not for insert and delete.
create or replace trigger "OOO_SCHEDULE_AUDIT"
BEFORE
insert or update or delete on "OOO_SCHEDULE"
for each row
begin
DECLARE
v_username varchar2(30);
AUDIT_EMP_ID varchar2(30);
AUDIT_EMP_ID_NEW varchar2(30);
v_Column_name VARCHAR(30);
v_stmt1 VARCHAR(40);
v_stmt2 VARCHAR(40);
CURSOR C1 is
select COLUMN_NAME from user_tab_columns where table_name='OOO_SCHEDULE';
BEGIN
OPEN c1;
LOOP
FETCH c1 into v_Column_name;
EXIT WHEN c1%NOTFOUND;
v_stmt1:=('OLD.'||v_Column_name);
v_stmt2:=('NEW.'||v_Column_name);
AUDIT_EMP_ID:=v_stmt1;
AUDIT_EMP_ID_NEW:=v_stmt2;
INSERT INTO TEMPTEST VALUES(v_stmt1);
INSERT INTO TEMPTEST VALUES(AUDIT_EMP_ID);
END LOOP;
CLOSE c1;
END;
end;
Suppose OOO_EMP_NAME is the column name where user made the change.
If i do like this..
AUDIT_EMP_ID:=OLD.OOO_EMP_NAME;
AUDIT_EMP_ID_NEW:=NEW.OOO_EMP_NAME;
Then it is working fine because I have given column name statically. But I want the column name to be selected dynamically and I am able to do it through cursor. Also I am able to fetch all column names in v_Column_name variable one by one dyanamically for the cursor.
But by executing these statements
AUDIT_EMP_ID:=v_stmt1;
AUDIT_EMP_ID_NEW:=v_stmt2;
I am getting OLD.OOO_EMP_NAME and NEW.OOO_EMP_NAME rather then old and new values of the updated column.
Please help me identifying the problem, where I am doing the mistake? What is the correct way to execute these statements? So that I can get old and new values of the column (updated column).
I have tried it by passing in a procedure also but don't know how to execute this dynamic statement to get the old and new values.
Thanks,
Ishrat.In the given link, column name has been selected statically. But i want that column name should be selected daynamically throgh loop and then check the
condition for any update corresponding to that column value. I don't want to write as many if condition as the no. of column name. I just want one if condition for all column namesDon't be lazy. Write all column names into your trigger. Or use a way to create the trigger "dynamically".
What is the problem that you have with static column names? "I don't want to write many..." is not a problem, but an opinion.
Maybe you are looking for
-
TS1814 how do i update my old iphone? into a new version
please help me how to update my iphone
-
ADF, JSF in Weblogic Portal 10.3.2
Hi, We are designing new portal application on weblogic portal. Per Oracle recommendations, use ADF, JSF instead of using legacy JPF, NetUI (BEA technologies). If we use ADF, JSF; My questions are (1) How do we add ADF taskflows, JSF in to weblogic p
-
hi expert Account 300012 1000 is blocked for posting Message no. F5351 remark:300012 is my vendor regard nabil
-
Fastest way to calculate total sales per material?
I'm creating a report where I need the total sum of sales per material. Is the fastest & most efficient / only way to do this by querying VBAP? We're talking about millions of lines. I guess I'm hoping that there is a FM already in place or that so
-
Can we use BPM inside ESR in SAP PO Java Stack?
Hi All, I had worked in dual stack SAP PO 7.3 also where I've used ccBPM. Now, I'm working in SAP PO 7.31 single stack environment. In ESR, under Process Integration Scenerio Objects -> i'm seeing 'Integration Process' and 'Monitoring Process'. Is i