How to get the total number of rows in result set?
Using JDBC and mysql
There is no method to directly obtain the count of the resultset.
int count = 0;
while( rs.next() )
count++;
}Another way,
Use a [Scrollable ResultSet|http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html]
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
//Get the resultset
rs.last();
rs.getRow();
Similar Messages
-
How to get the total number of pages printed in a report?
Hi All,
I have a requirement where I need to print a frame of fields only in the last page. Unfortunately I cannot use the 'Print Object On' property as it doesnt work in my case. So, I am planning to write a format trigger on the frame to return TRUE if the page is the last physical page. Now, I need to know how to get the total number of physical pages that will get printed in the report so that I can use this to manipulate the frame. I was planning to use the 'Total Physical Pages' built-in, but it seems like I can just use it to print in a field and I can't use this field's value anywhere in the plsql code (formula column function/format trigger) in the report. Is there anyway to get the total number of pages printed in the report which can be used in the report plsql code?
Thanks,
Srini.i found the solution, thanks
-
How to get the total number of occurrences based on the value of a column.
Hello everyone,
This is the first time that I will ask question here on your forum but has been following several threads ever since. I guess that now is my turn to ask a question. So anyway here is the thing, I have a query that should return count the number of rows depending on the value of SLOT. Something like this:
WIPDATAVALUE SLOT N M
1-2 TRALTEST43S1 1 3
1-2 TRALTEST43S1 2 3
3 TRALTEST43S1 3 3
4-6 TRALTEST43S2 1 4
4-6 TRALTEST43S2 2 4
4-6 TRALTEST43S2 3 4
7 TRALTEST43S2 4 4-----
As you can see above, on the SLOT TRALTEST43S1, there are three occurrences so M (Total number of occurrences) should be three and that column N should count it. Same goes with the SLOT TRALTEST43S2. This is the query that I have so far:
SELECT DISTINCT
WIPDATAVALUE, SLOT
, LEVEL AS n
, m
FROM
SELECT
WIPDATAVALUE
, SLOT
, (dulo - una) + 1 AS m
FROM
SELECT
WIPDATAVALUE
, SLOT
, CASE WHEN INSTR(wipdatavalue, '-') = 0 THEN wipdatavalue ELSE SUBSTR(wipdatavalue, 1, INSTR(wipdatavalue, '-')-1) END AS una
, CASE WHEN INSTR(wipdatavalue, '-') = 0 THEN wipdatavalue ELSE SUBSTR(wipdatavalue, INSTR(wipdatavalue, '-') + 1) END AS dulo
FROM trprinting
WHERE (containername = :lotID OR SLOT= :lotID) AND WIPDATAVALUE LIKE :wip
) CONNECT BY LEVEL <= m
ORDER BY wipdatavalue;And that it results to something like this:
WIPDATAVALUE SLOT N M
1-2 TRALTEST43S1 1 2
1-2 TRALTEST43S1 2 2
3 TRALTEST43S1 1 1
4-6 TRALTEST43S2 1 3
4-6 TRALTEST43S2 2 3
4-6 TRALTEST43S2 3 3
7 TRALTEST43S2 1 1-----
I think that my current query is basing its M and N results on WIPDATAVALUE and not the SLOT that is why I get the wrong output. I have also tried to use the WITH Statement and it works well but unfortunately, our system cant accept subquery factoring.
I know you guys will be helping out because you are all awesome. Thanks everyone
Edited by: 1001275 on Apr 19, 2013 8:07 PM
Edited by: 1001275 on Apr 19, 2013 8:18 PMHi,
Sorry, it's still not clear what you want.
Are you saying that, given this table:
CREATE TABLE trprinting
WIPDATAVALUE VARCHAR2(255)
, SLOT VARCHAR2(255)
INSERT INTO trprinting (wipdatavalue, slot) VALUES ('1-2', 'TRALTEST43S1');
INSERT INTO trprinting (wipdatavalue, slot) VALUES ('3', 'TRALTEST43S1');
INSERT INTO trprinting (wipdatavalue, slot) VALUES ('4-6', 'TRALTEST43S2');
INSERT INTO trprinting (wipdatavalue, slot) VALUES ('7', 'TRALTEST43S2');you want to produce this output:
WIPDATAVALUE SLOT N M
1-2 TRALTEST43S1 1 3
1-2 TRALTEST43S1 2 3
3 TRALTEST43S1 3 3
4-6 TRALTEST43S2 1 4
4-6 TRALTEST43S2 2 4
4-6 TRALTEST43S2 3 4
7 TRALTEST43S2 4 4? If so, here's one way:
WITH got_numbers AS
SELECT wipdatavalue
, slot
, TO_NUMBER ( SUBSTR ( wipdatavalue
, 1
, INSTR ( wipdatavalue || '-'
) - 1
) AS low_number
, TO_NUMBER ( SUBSTR ( wipdatavalue
, 1 + INSTR ( wipdatavalue
) AS high_number
FROM trprinting
SELECT wipdatavalue
, slot
, ROW_NUMBER () OVER ( PARTITION BY slot
ORDER BY low_number
) AS n
, COUNT (*) OVER ( PARTITION BY slot ) AS m
FROM got_numbers
CONNECT BY LEVEL <= high_number + 1 - low_number
AND low_number = PRIOR low_number
AND PRIOR SYS_GUID () IS NOT NULL
ORDER BY low_number
, n
;Much of the complexity here is caused by storing 2 numbers in 1 VARCHAR2 column, wipdatavalue. Relational databases work best when there is no more than 1 item in any given column of any given row. This is so basic to datbase design that it is called First Normal Form. Also, numbers belong in NUMBER columns, not VARCHAR2. If you stored your data like that in the fist place, then you wouldn't need the sub-query I called got_numbers, which is about 60% of the code above. (That could be reduced by replacing SUSTR and INSTR with the less efficient REGEGP_SUBSTR.) -
Getting the total number of pages inside a report
Post Author: jportelas
CA Forum: .NET
Good afternoon:
How can I get the total number of pages inside a reportdocument object???
I'm currently using VS.NET 2005.
Thanks for the help.There's no public API to get this info directly from RAS.
Option is to either walk through pages in the CrystalReportViewer till you get to the end, or use the non-public not-for-public use API:
int lastPageNumber = ((com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource) reportClientDocument.getReportSource()).getLastPageNumber(new com.crystaldecisions.sdk.occa.report.reportsource.RequestContext());
Sincerely,
Ted Ueda -
Getting the total number of the parameters that are not null
hi,
i can get all the parameter names of a http request using this statement:
Enumeration e=request.getParameterNames();if i want to know how many parameters there are in the request
i just need to count the total number of elements in the enumeration
but how can i get the total number of parameters which are not null?
thanks in advancebut how can i get the total number of parameters
which are not null?Only one way that I know of... loop over the parameter names and check if they are null or not!!!!!!!!!!!!!!!!!!!!!
xH4x0r -
How To Get The Total Delivered Quantity of a Sales Order
Hello All,
I have a requirement of getting the total delivery quantity of the sales order .I have checked it in LIps table but I am getting partially delivered quantity for a schedule line item.Can any one tell me how to get the total delivered quantity.
Regards,
Pavani.Hi
Check the Table:
VBEP - Sales Document: Schedule Line Data.
Inside the table check the Quantity Fields.
Regards,
Sreeram -
Display the total number of rows for the report in OBIEE 11g
Hi, In obiee 11g, the pagination will be 1-25. Is there any possiblity in obiee to show the total rows count next to pagination. Ex: if the result contains 120 rows. it should display after the pagination
Records 1-25. Total of Records : 120
Is there any way we can display the total number of rows for the report.
Kindly help me.. Its very urgent requirement.
MAny Thank in advacneCheck this http://obiee100.blogspot.com/2011/07/display-total-number-of-records-in.html
and
http://docs.oracle.com/cd/E28280_01/bi.1111/e10544/appsql.htm#CHDCDIDA
You have to go something like as suggested in previous link.
Mark as correct/helpful -
How to get the page number in the break section?
Hi expert,
The user wants the page number came right after the Break group name if the break section contains more than 1 page. E.g.
ABC Compnay
XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX
BCD Company, p 1
XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX
BCD Company, p 2
XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX
CDE Company
XXXXXXXXXXX XXXXXXXX
XXXXXXXXXX XXXXXXXXXXXX
How to get the page number in section break level?Hi Wes
* Create a Field on the margin.
* Set its "Source" to "Page Number"/"Physical Page Number".
* Click "Page Numbering" button.
* In "Reset At" list box, choose the Repeating frame that surrounds your detail group in the layout.
This should cause Reports to increment the page number until the "Company" repeating frame resets.
Regards
Sripathy -
How to get the total pages in ALV report?
Hi guys,
Since I used page breaks can somebody please help me on how to get the total pages in ALV report?sincerely please...thanks guys.automatic display total page.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
r -
How to get the Page Number in CS3 with VB?
Hi, Everybody
I use the Visual Basic to read the words and their page number where the Words are at. I want to do it according to Story. Some TextFrame of the Story waw placed in other pages: How can I get the Page number according to the Word that is selected?
For myStoryCounter = 1 to Document.Stories.Count
Set myStory = Document.Stories.Item(myStoryCounter)
For myWordCounter = 1 to myStory.Words.Count
Set myWord = myStory.Words.Item(myWordCounter)
myWordContents = myWord.Contents
Rem ** How to Get the Page Number according to the Word ***
Next
Next> But I don't understand why Item(1) are set.
because Word can have more than one parent TextFrame - when split across TextFrames
only Character have one ParentTextFrame accessed also by ParentTextFrames.Item(1)
> why Story.TextFrames.Count alway is 0, Is it bug?
no - it's not bug
in older IDs - Story.TextFrames collection refer to all TextFrames as containers for Story text
but in CS3 - collection Story.TextFrames contain all TextFrames inserted as InLine/Anchored objects - same like Story.Rectangles or Story.Ovals
in CS3 - when you want to refer to TextFrames as containers for Story text - you need to use Story.TextContainers - because now you can link TextFrame and Text-On-Path as Story - Text-On-Path isn't TextFrame
robin
www.adobescripts.com -
I am trying to figure out how to get the total allocated CPUs, memory and storage in a particualr reservation through vRealize Automation Java SDK.
I am trying to figure out how to get the total allocated CPUs, memory and storage in a particualr reservation through vRealize Automation Java SDK.
-
How to get the document number for a ware house order.
Hello gurus,
how to get the document number for a ware house order. [if GI is posted refering that WH order] .. is there any report?
Thanks in advanceThere are several options. When you post a Goods Movement, you can use LB12 -display Transfer Requirement for material document or LB11 Display TR for material.
Depending on how your system is set up you may have gotten a Transfer Order automcatically. In this case you can look at LT24 - Transfer Order for material. -
I'm trying to load a student version of Acrobat XI Pro but not sure how to get the serial number to validate I'm a student
Hi ,
Could you please tell me form where did you purchase the Student version of Acrobat ?Is it through Adobe or some outside vendor ?
Is it the first time you are trying to access it ?
If yes ,then you must have received your serial number along with your product .
If not ,then how how did you manage to get your serial number and access Acrobat before ?
Regards
Sukrit Dhingra -
How to get the delivery number for the sales order
hi
how to get the delivery number for the sales orderHi,
1. IN VA03, enter the sales order and click on the document flow button. From there you can check the delivery document.
2. In SE11, enter VBFA(Document flow) table and enter the sales order in VBELV field and in VBTYP_N field enter 'J' to specify that you want to check if there is already a delivery document for that sales order.
Hope it helps...
P.S. Please award points if it helps... -
If I do not have the macbook with me and in the bill is not writing? How to get the Serial Number true Itunes?
https://support.apple.com/kb/HT2526
Maybe you are looking for
-
EasyMock 1.2 - working with static methods
Hi, I'm working in an application which was written in java1.4. So we are using EasyMock 1.2 version since higher versions doesn't support java 1.4. I need to expect and return an array for a static method which is in a Util class (No interfaces invo
-
Build Applicatio​n with all files inside .exe
Hello, I have a labview project consisting of a few classes and subvi's. Nothing really special. Now when i try to build an .exe file, i get the .exe, an application.ini, an Application.aliases and an data folder (has the classes and dll's within). W
-
Safari won't display a Bank website properly -
When Safari loads this Chinese Bank website - https://mybank.icbc.com.cn/icbc/perbank/index.jsp (BTW my Mac is set in English as major language): the 'Account Number' column shows ok, but the 'Password' & 'certify code' columns are closed and blocked
-
How to change security questions after adding a second email address?
I'm at a loss and really really frustrated with Apple for the first time in my life. I've added a second email address and tried over the last 3 days on my iPad and Mac to change my security questions. There is no option present that I can see that a
-
i just upgraded my software to OS X 10.9.2 (13C64) and i can no longer use my printer (epsun stylus sx235w). any ideas why this would happen?