How to get middle rows in a table
Hi,
if I have a table of 1000 records, I need to fetch 100 at a time. or say 200 to 300 records. Can anyone please suggest a best way of doing it? I am following the below approach.
select * from (select *,rownum num from table1 )where num >200 and num <300
is there any other better way (in terms of performance)??
Thanks
user10403630 wrote:
Hi,
if I have a table of 1000 records, I need to fetch 100 at a time. or say 200 to 300 records. Can anyone please suggest a best way of doing it? I am following the below approach.
select * from (select *,rownum num from table1 )where num >200 and num <300
is there any other better way (in terms of performance)??
Thanksrows in a table are like balls in a basket, which balls are balls between 200 & 300?
Edited by: sb92075 on Oct 19, 2011 6:34 AM
Similar Messages
-
How to get current row data in table control
Hi , expert ,
I am professional in oracle , but now I am a new guy in SAP ABAP .
I have a question in UI
How to get current row data and click pushbutton in table control to open next screen ?
I want to get the current data and open next screen to carry out detail detail .
Thansk for all your suggestion .GET CURSOR LINE SY-CUROW .
READ TABLE internal_table index SY-CUROW. -
How to find middle row in a table ?
Hi Friends,
Is it possible to find middle row in a table by SQL Query.
KarTiK.Solution: sort the rows in order to create an ordered
sequence and then there will be a "middle row".Well, not quite.
If there are an odd number of rows then, yes, there will be a middle row in an ordered sequence, however if there is an even number of rows then the middle is between two rows... or... you could take it as the two rows either side of the middle....
SQL> select * from emp order by empno;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17/12/1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20/02/1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22/02/1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02/04/1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28/09/1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01/05/1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09/06/1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
7839 KING PRESIDENT 17/11/1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08/09/1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23/05/1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03/12/1981 00:00:00 950 30
7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23/01/1982 00:00:00 1300 10
14 rows selected.
SQL> select e.empno, e.ename, e.job, e.mgr, e.hiredate, e.sal, e.comm, e.deptno
2 from (select emp.*, row_number() over (order by empno) as rn from emp) e
3 ,(select round(count(*)/2) as middle, round(((count(*)+1)/2)) as middle2 from emp) m
4 where e.rn in (m.middle, m.middle2)
5 /
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09/06/1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
SQL> insert into emp values (1111, 'WILLIS', 'CLERK', 7902, sysdate, 900, null, 20);
1 row created.
SQL> select * from emp order by empno;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
1111 WILLIS CLERK 7902 18/01/2008 12:18:14 900 20
7369 SMITH CLERK 7902 17/12/1980 00:00:00 800 20
7499 ALLEN SALESMAN 7698 20/02/1981 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 22/02/1981 00:00:00 1250 500 30
7566 JONES MANAGER 7839 02/04/1981 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 28/09/1981 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 01/05/1981 00:00:00 2850 30
7782 CLARK MANAGER 7839 09/06/1981 00:00:00 2450 10
7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
7839 KING PRESIDENT 17/11/1981 00:00:00 5000 10
7844 TURNER SALESMAN 7698 08/09/1981 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 23/05/1987 00:00:00 1100 20
7900 JAMES CLERK 7698 03/12/1981 00:00:00 950 30
7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
7934 MILLER CLERK 7782 23/01/1982 00:00:00 1300 10
15 rows selected.
SQL> select e.empno, e.ename, e.job, e.mgr, e.hiredate, e.sal, e.comm, e.deptno
2 from (select emp.*, row_number() over (order by empno) as rn from emp) e
3 ,(select round(count(*)/2) as middle, round(((count(*)+1)/2)) as middle2 from emp) m
4 where e.rn in (m.middle, m.middle2)
5 /
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09/06/1981 00:00:00 2450 10
SQL> -
How to get the rows from a table having some column has any letter
Hi All,
suppose i have a table having columns id(number), code(varchar).
code has alphanumeric characters (ex. ABC123, 67B56 etc).
some codes are only numbers (2344, 7898 etc).
how can i get the rows which have alphabets in the code.
ex:
id code
1 AB45
2 456
3 890
4 67B7
how can i write a query such that it should give me the ids 1 and 4 (as they have alphabets in code)
thanks in advance to allThanks to one and all.
i am gettig my required output.
But i have a doubt in the operator.
If i add or remove '[]' in the operator, i am getting different ouputs.
There is a count difference in the result of the operators used.
REGEXP_LIKE(<column>,'[[:lower:]]')
REGEXP_LIKE(<column>,'[[[:lower:]]]')
REGEXP_LIKE(<column>,'[:lower:]')
Can anybody please explain what is the difference in using '[]', in the operator?
What is the correct syntax, whether i have to use two '[]'s or one '[]'.
Also, can i use REGEXP_LIKE() in oracle 8i version.( I am unable to use the operator in 8i)?
Any query to get the required output in 8i version?
Thanks in advance to all. -
hi Friends,
I am Using ME_PROCESS_PO_CUST badi for validation in Purchase oreder (ME21N),
For that I implementaed PROCESS_ITEM method which fires during each row now i want to add another validation in same implimentation for that i need privious row's value so how to get that value ?
following is my current validation code.
method IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.
DATA:ls_poitem TYPE mepoitem.
DATA:ls_poheader TYPE MEPOHEADER.
DATA:lm_poheader TYPE ref to IF_PURCHASE_ORDER_MM.
DATA:w_mara TYPE mara.
DATA:IT_ZMMTBL039 TYPE STANDARD TABLE OF ZMMTBL039 ,
WA_ZMMTBL039 TYPE ZMMTBL039 .
DATA:ls_poitem1 TYPE mepoitem.
DATA:V_KUNNR1 TYPE KNA1-KUNNR.
DATA:V_KUNNR2 TYPE KNA1-KUNNR.
ls_poitem = im_item->get_data( ).
lm_poheader = im_item->GET_HEADER( ).
ls_poheader = lm_poheader->GET_DATA( ).
CLEAR: WA_ZMMTBL039,w_mara.
REFRESH:IT_ZMMTBL039[] .
SELECT *
INTO TABLE IT_ZMMTBL039
FROM ZMMTBL039
WHERE bsart EQ ls_poheader-bsart.
IF sy-subrc EQ 0.
CLEAR: WA_ZMMTBL039,w_mara.
SELECT SINGLE *
INTO w_mara
FROM mara
WHERE matnr EQ ls_poitem-MATNR.
IF SY-SUBRC EQ 0.
READ TABLE IT_ZMMTBL039 INTO WA_ZMMTBL039 WITH KEY bsart = ls_poheader-bsart
mtart = w_mara-mtart
spart = w_mara-spart.Hello
If you had searched the SDN forums you would have found plenty of answers to your question.
Following is some sample coding:
method IF_EX_ME_PROCESS_PO_CUST~POST.
DATA:
ls_header TYPE mepoheader,
lt_items TYPE purchase_order_items,
ls_item TYPE purchase_order_item,
ls_item TYPE mepoitem.
ls_header = im_header->get_data( ).
lt_items = im_header->get_items( ).
LOOP AT items INTO ls_item.
ls_item = line_item-item->getdata( ).
" process item data...
ENDLOOP.
ENDMETHOD.
Regards,
Uwe
PS: Do not use such kind of pseudonyms instead of your real name. Because my impression is that a nobody (in term of ABAP development competence) tries to claim to be a somebody who fills his knowledge gaps via SDN. Using pseudonyms significantly decreases your changes to get any answers at the SDN forums. -
How to get multiple rows from database table?
hello !
I need to get multiple rows from a OLEDB database table and display them on a table object.
I did "Wrap in subfrom" on the table, set subform of the table to "flowed", and checked "Repeat row for each data item" of Row1 of the table.
But I can get only one row on the table object.
I need your help.
ThanksHi,
best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
Frank -
How to get current row of Advanced table with no submit
I have an advanced table with an 'Add another button'. When an empty row is created by clicking this button, LOV is used on the first column to populate other fields of the row. The rows of the table carry a button called "Add dependencies" whose functionality is to take the user to a different table to add rows to a different VO. This button is just a button and not a submitButton. I am passing the row's primary key as part of the URI as Vo attribute FdTaskId={@FdTaskId}
The button works perfectly fine for database fetched rows (rows already present in the database), but, for the rows created using 'Add Another button', though LOV populates all fields including the primary key, the URI parameter passes null to the next page. That means, the VO attribute is not set. This works fine only when a 'submit' happens in the first page. For example, if I click Add another row again, then the previously inserted row passes the primary key fine as part of {@FdTaskId}.
Could you please help me how I can resolve this issue?
Thanks,
DattaI am doing exactly that. My issues is that, VO attribute is passed correct for the table rows which are fetched from the database. For the table rows which got created through 'Add Another button', the VO attribute passed through URI as {@FdTaskId} is returning null. The VO attribute sets only when a form submit happens. For example, after adding a row through 'Add another row' button, click the same button again to add one more row and now go back to previously added row and now you can see that its VO attribute is set ({@FdTaskId} carries value )
-
How to get current row value from table when press the submit button
Hi,
I want to get the current row value of SuccessionPlanId which is one of the column in a advanced table.
I created one button (created using personalization, action fired thru CO)in the table as column, so each row having one button, if i press the first row's button means then i want to fetch the first row's SuccessionPlanId and if it is 3rd means then i want to get the value of third row's value.
How to do it in controller extension?
Please reply soon, its urgent.
Thanks in advance,
SANPratap,
Yes, I tried with 'delete' button which is seeded one.
For this, our code using row reference is working too fine. it throws exact SuccessionPlanId value of corresponding row.
I created MessageStyledText, but here i need to give text value right, then only it 'll appear in the page.
Instead i created one image and fired explicitly from the controller processRequest method.
But the same problem remains..
here my code:
public void processRequest(OAPageContext pageContext, OAWebBean webBean){
super.processRequest(pageContext, webBean);
OAButtonBean oabb = (OAButtonBean)webBean.findChildRecursive("XXSubmit");
FireAction action = new FireAction("XXSubmit");
oabb.setAttributeValue(UIConstants.PRIMARY_CLIENT_ACTION_ATTR, action);
OAImageBean oaib=(OAImageBean)webBean.findChildRecursive("XXSubmitImage");
oaib.setFireActionForSubmit("XXSubmitImage", null, null, true);
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){
if("XXSubmitImage".equals(pageContext.getParameter("event"))){
String succIdI="";
String rowRefI = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
if(rowRefI != null && !("".equalsIgnoreCase(rowRefI ))){
PerSuccPlanSearchVORowImpl rowI = (PerSuccPlanSearchVORowImpl)oaam.findRowByRef(rowRefI);
if(rowI != null)
succIdI=rowI.getAttribute("SuccessionPlanId").toString();
}else{
throw new OAException("Row is null");
throw new OAException(succIdI, OAException.INFORMATION);
}else{
super.processFormRequest(pageContext, webBean);
If i run the page using this controller, it throws exception without any value, because for 'succIdI' i initialized without any string.
Can you please suggest me how to solve? -
How To get selected row in a table
Hi experts
I have been using a table in which I am using a column Tree by nesting . I have written code for dynamically expanding table tree . But I want to know current selected element of the table, for this i have done following
steps
1) created an action on Action <b>lead select </b> of the table .
which has a parameter with type node element .
2) now i need to use parameter mapping in domodify view .
as
IWDTable tab = (IWDTable) view.getElement("CatalogTable");
tab.mappingOfOnLeadSelect().addSourceMapping<b>("XYZ",</b> "element");
But i dont know what is correct parameter <b>XYZ</b> to be passed.
also if i am wrong in approach please let me know .
Regards
AbhayHi
I have used following code also but its not working
IWDTable table = (IWDTable) view.getElement("CatalogTable");
table.mappingOfOnLeadSelect().addSourceMappin ("IWDNodeElement", "LeadSelect");
and I have created an action
public void onActionOnleadSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogElement LeadSelect )
//@@begin onActionOnleadSelect(ServerEvent)
wdContext.currentContextElement().setDebug4(LeadSelect.getID());
//@@end
but when i select one row its giving error
<b>com.sap.tc.webdynpro.services.exceptions.WDIllegalArgumentException: Parameter IWDNodeElement not found</b> -
How to get current row from advanced table
Hi,
I have the following code to pick the value of columnA from one of the columns of an advanced table:
OAViewObject vo = (OAViewObject)am.findViewObject("AAALineVO2");
if (vo != null)
OARow vorow = (OARow)vo.getCurrentRow();
String ColA = (String)vorow.getAttribute("ColumnA");
String message = ColA; //to throw message so i can verify the value of ColumnA
throw new OAException(message, OAException.INFORMATION);
}It's picking up the first value of ColumnA of the first record correctly, however when I add a new row, it's not picking up the value of columnA anymore.
What am I doing wrong?
Thanks in advance,
NTry with this:
import oracle.apps.fnd.lookups.server.LookupCodeVORowImpl;
public void aaa (String row)
LookupCodeVORowImpl laborcreateeovorowimpl = (LookupCodeVORowImpl)findRowByRef(row);
}Thanks
--Anil -
How to get selected row index of a Table ?
hi gurus,I'm new to Webdynpro for abap
I'm displaying just Flight details in a Table so
how to get selected row index of a Table and need to be display in Message manager.Hi,
For getting the row index use the following code.
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA index TYPE i.
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lo_el_node = lo_nd_node->get_lead_selection( ).
index = lo_el_node->get_index( ).
node is the name of the node which is binded to the table.
For printing the message u can use code wizard.
Press ctrl-F7. Now Select generate message.
IN this select the method REPORT_SUCCESS
In the code now u can give index to Message text Exporting parameter. Comment receiving parameter.
Write the whole code in onLeadSelect of the table.
Regards,
Pankaj Aggarwal -
How to get selected Row Index in a table based ona VO?
Hi All,
I'm writing an ADF form wherein I use a VO based on a SQL query. I'd like to know how to get the index of a selected row. I havea selection Listener in place where I can print the selected Row's data using getSelectedRowData().toString() on the table.
How can I get certain Attributes from this selected row.
One solution I thought of is to get the row index and then read attributes. But I cant seem to figure out how to get rowIndex for a selected row. Any sugestions?
Using JDeveloper 11g.
Thanks
P.If your selected row is marked as current row you can use
// Get a attribute value of the current row of iterator
DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("testIterator");
String attribute = (String)iterBind.getCurrentRow().getAttribute("field1");Where 'testIterator' is the name of the iterator you use for the table and 'field1' is the name of an attribute you want to get.
Or you can iterate over the selected row keys (even if it's only one):
// get selected Rows of a table 2
for (Object facesRowKey : table.getSelectedRowKeys()) {
table.setRowKey(facesRowKey);
Object o = table.getRowData();
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o;
Row row = rowData.getRow();
TestRow testRow = (TestRow)((DCDataRow)row).getDataProvider() ;
}Where TestRow is the row type of the VO of your table.
Timo -
How to get all rows in table to red using alternate rows properties option
How to get all rows in table to red using alternate rows properties option
Hi Khrisna,
You can get all rows red by selecting the color red in the "Color" and "frequency" to 1 under the "Alternate Row/Column colors".
I tried doing it and the colors freaked me out (all red) :-D
Kindly tell me if im missing something.
Regards,
John Vincent -
How to get selected row data of an ADF table in HashMap?
Hi,
Can anyone please tell me how to selected row data of an ADF table in HashMap like :
Object obj = pageTable.getSelectedRowData();
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)obj;
Now in above code I want the convert rowData in HashMap.
Can anyone please tell me how to do that? Its urgent.
Thanks,
VikVik,
No need to ask the same question 3 times...
In [url http://forums.oracle.com/forums/message.jspa?messageID=4590586]this post, Nick showed you how to get the Row.
If it were so urgent, you could have done a little reading of the javadocs to come up with code like this (not tested, up to you to do that)
HashMap m = new HashMap();
Row r = get it like Nick showed you to;
Object values[]=r.getAttributeValues();
String names[]=r.getAttributeNames();
for (int i=0; i<r.getAttributeCount(); i++)
m.put(names, values[i]); -
How to get the row reference of inner table of an advance table
Hi Gurus,
Using R12.1.3, How to get the handle of inner table row reference of an advance table in controller.
Regards,
ZakirThe javadoc for oracle.jbo.Key is really helpful.
getAttributeNames()
getAttributeValues()
etc
Maybe you are looking for
-
I have a new macbook pro retina display with an hdmi port built in. I have connected it to my hd tv and have not been able to recieve any sound. I have gone through the settings under sound and changed the output from built in speakers to hdmi. Howev
-
Any audio filters to take out "hiss" noise?
I have recently done some quick interviews with a boom mic, and there happens to be a "hissing" sound that I wish to take out of the audio. I was just wondering if there is any audio filter or anything in Soundtrack (not Sountrack-Pro) that anyone wo
-
Oracle process ORA_PSP0 & Solaris 10 Memory at 100%
Oracle was gobbling 100% of system memory until I manually killed the "ora_psp0_IND" process and then Oracle's memory usage drops down to 0.4%. There were numerous "defunct" Oracle processes that listed the "ora_psp0_IND" process as it's owner. This
-
Windows 8 bootup crash, cause NVIDIA Driver.
Hello people, it's me again. I just used bootcamp assistant on OS X 10.9.1 and installed Windows 8.1 Pro. I installed the BootCamp 5 drivers and it said to restart, and I did so, but when it restarted back into windows it shows the windows bootup scr
-
Hi Experts, I've an issue with Clear-Channel codec. I've a SIP Trunk between an AS5400 HPX and a Cisco 1760. I would use this connection to manage ISDN data modem calls with 64 Kbit/s Unrestricted Digital Information capability. This is the scenario: