How to print sql request result to screen by page?
Hello,
I'm a beginer in java developpement. I'm looking for information for :
I want to print to screen the result of a sql request. but I don't know how many lines will be selected. so I want to cut the result in many pages.
1)how can I do this?
2)may I do this in Java? if yes in wich package may I search? and is this take a lot of place in memory?
3)or may I do this with SQL?
Thank you for your help
Hi,
This is a small code snippet, i believe this is more than enough...
String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=firstDB)))";
String username= "test";
String password = "test";
String GET_EMPLOYEE_DETAILS = "select name, age from managers";
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection con = DriverManager.getConnection(url, username, password1);
PreparedStatement pstmt =con.prepareStatement(GET_EMPLOYEE_DETAILS );
ResultSet rs = pstmt.executeQuery();
while ( rs.next())
System.out.println(rs.getString("name") + ":"+ rs.getInt("age") );
rs.close();
pstmt.close();
con.close
Similar Messages
-
How to print sql query results
how to print sqlplus query results
Hi,
Spool sql.txt
Execute the query
Spool off
And find the sql.txt file in the current directory.
Regards
Jafar -
How to print Spool requests for cheque printing sequentially
Dear All,
I am making vendor payments and printing cheques using F-58. It automatically creates a spool requests at the end of the transaction. When i complete all my payments and go to SP01 for viewing spool requests, the last request appears at the top of the list.
If i select 3 consecutive requests and print them at a time, the last request gets printed first on the first cheque number and the first request gets printed on the last cheque number.
This results in anomaly in the cheque number assigned in the system and the printed cheque as the last payment is printed on the first cheque.
I am using dot matrix printer with page format fixed for cheque specifications. The cheques are printed properly as per the format except the order of printing.
Kindly let me know how to print multiple requests sequentially from the spool requests list such that the spool request number printed matches with the serial cheque numbers.
Regards,
SAP_2009Hi,
I understod your issue.
Whenever you posted multiple payment documents, and after that if you want to take cheque printouts sequentially by using more spool requests.........there is a way to sort out this issue.
1) Select all of your spool requests and click on Sort in ascending Order (CtrlShiftF5) and click on Print directly (CtrlShiftF8). By doing this you will get the cheque printouts sequentially according to your payment document sequence.
Hope this will help you
Assign ********, if it solved your problem.
Thanks,
Srinu -
How to print the output of the screen in Dialog Programming
Hi,
Could anybody help how to print the output of a screen in the dialog programming. i can select 'Hard Copy' option in the 'Custumizing of Local Layout' Icon in the standard tool bar. but that prints the whole screen with the toolbar. i want to print only the output which is displayed on the screen. Please help..
Regards,
SwathiHi Swathi,
Ok. Do One thing. Go to menu bar and select Systems -> Own pool Request -> here you get the spool number. Select it and select the option "Print Directly" in tool bar.
Thanks. -
How to print text on back and back of page in smartforms
How to print text on back and back of page in smartforms.
Prince,
in page's output option you can set D for double-sided.
Default: No change of print mode
S Begin new page in SIMPLEX mode (single-sided)
D Begin new page in DUPLEX mode (double-sided)
T Begin new page in TUMBLE DUPLEX mode (double-sided)
Amit. -
How to print SOAP request at client program when program calls web service.
Hi friends,
While calling a web service, I am getting following error: javax.xml.rpc.JAXRPCException: Failed to parse WSDL
I believe it is due to an invalid parameter set for the request soap. I need to analysis this error. Can you help me to print SOAP request at client program when program calls web service.
Is there any way to print SOAP request XML?
Thanks.
JaykishanIs this question related to Oracle SOA suite? Which client are you using? Use SOAPUI to validate whether WSDL is correct.
Regards,
Anuj -
How to Print the Report Column headers on each page of any report
Can someone offer assistance on how I can go about achieving the ability to show and print the Report Column headers on each page of any report using the Print Attributes of APEX 3.0? These reports will be printed using Excel and Word.
I read a thread with a similar request but the answer seems vague for my level of understanding.
I am connected to a print server and using BI Publisher.
Thanks,
RicHello Ric,
>> These reports will be printed using Excel and Word.
I'm not sure I understand what you are trying to do. You are using a very powerful tool – BI Publisher – why do you need Excel or Word for printing? Is there a special need only Excel or Word can provide?
One of the major advantages of using BI Publisher is that it's taking care of all these tedious tasks like reasonable page breaking, headers and footers, and also table headers.
Regards,
Arie. -
How doi print Any variable at the end of page in ALV report?
Hi,
Anyone can tell me that How do i print Any variable at the end of page in ALV report?
Exmale: at the ende of alv report i want to print total no of employee who has taken house loan or education loan.Hi,
Go through these links
Thread in sdn regarding FOOTER IN ALV
[ALV FOOTER;
Wiki in sdn regarding HEADER AND FOOTER IN ALV
[https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Objects%20-%20ALV%20Model%20-%20Using%20Header%20and%20Footer]
Header and Footer in ALV
[http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm]
Hope this helps.
Thank you,
Pavan. -
How to send SQL query results to XML ?
Hey Guys, I am querying a DB with huge amount of traffic. A user select a particular lot and then details of the lot will be displayed in the following page. My concern here is that it takes really LONG to retrieve back the results coz it has to requiry in the following JSP page.
I was told to use XML to retrieve the dataset and store it. Hence, in the following query it will re-query only from the recordsets in the XML file (...Logically, should be faster rite ? ). Hence, how do parse my recordsets retrieved from the SQL query to an XML file ?
Any sort of suggestion , help, reference would be deeply appreciated ..Thanks !<HTML>
<BODY>
<H1>Manufacturing Summary beta </H1><BR>
<%@ page import="java.sql.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.text.*" %>
<jsp:include page="/index.html" flush="true"/>
<P><B>Returned result<B><BR>
<B>Query String :</B><%=request.getParameter("date") %>
<TABLE BORDER=1 cellpadding=0 cellspacing=0>
<%!
static double roundDouble(double toBeRounded, int fractionDigits)
NumberFormat format = NumberFormat.getInstance();
format.setMaximumFractionDigits(fractionDigits);
String tempDouble = format.format(toBeRounded);
return Double.parseDouble(tempDouble);
%>
<%
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@klmomnidb:1521:
OMNIDB","omni","omni");
Statement stmt = null;
ResultSet rset = null;
String S_date = new String();
String temp = new String();
String lot_id = new String();
String result = new String();
String SQL_String = new String();
double yield;
int bad_cnt;
S_date = request.getParameter("date");
lot_id = request.getParameter("lot_id");
temp = request.getParameter("TST_TEMP");
SQL_String = "SELECT LOT_ID, FLOW_ID, TST_TEMP, MODE_COD, RTST_COD, PART_CNT, GO
OD_CNT, OPER_NAM, JOB_REV, PROC_ID, START_T, FACIL_ID, TSTR_TYP, NODE_NAM FROM L
OT where START_T > TO_DATE('"+ S_date + "','MM/DD/YYYY') AND TST_TEMP <='" + tem
p+"' order by START_T";
out.println(SQL_String);
stmt = conn.createStatement();
rset = stmt.executeQuery (SQL_String);
out.println("<TR>");
out.println("<TD> Select Lot(s)</TD>");
out.println("<TD>Flow </TD>");
out.println("<TD>Temp </TD>");
out.println("<TD>Test Mode </TD>");
out.println("<TD>Retest</TD>");
out.println("<TD>Total </TD>");
out.println("<TD>Good</TD>");
out.println("<TD>Bad</TD>");
out.println("<TD>Yield </TD>");
out.println("<TD>UserID</TD>");
out.println("<TD>Program</TD>");
out.println("<TD>Mask</TD>");
out.println("<TD>Start Time </TD>");
out.println("<TD>Loc </TD>");
out.println("<TD>Tester</TD>");
out.println("<TD>System </TD>");
out.println("</TR>");
if (! rset.next()) {
result ="No records found matching seach criteria.";
while (rset.next()) {
bad_cnt = Integer.parseInt(rset.getString(6)) - Integer.parseInt(rset.getString(
7));
yield = (Double.parseDouble(rset.getString(7)) / Double.parseDouble(rset.getStri
ng(6))) * 100;
result= "<TR>";
result = result + "<TD><a href=coolpage.jsp?LOT_ID=" + rset.getString(1)+ ">" +
rset.getString(1) + "</A></TD>";
result = result + "<TD>" + rset.getString(2) + "</TD>";
result = result + "<TD>" + rset.getString(3) + "</TD>";
result = result + "<TD>" + rset.getString(4) + "</TD>";
result = result + "<TD>" + rset.getString(5) + "</TD>";
result = result + "<TD>" + rset.getString(6) + "</TD>";
result = result + "<TD>" + rset.getString(7) + "</TD>";
result = result + "<TD>" + bad_cnt + "</TD>";
result = result + "<TD>" + roundDouble(yield,2) + "% </TD>";
result = result + "<TD>" + rset.getString(8) + "</TD>";
result = result + "<TD>" + rset.getString(9) + "</TD>";
result = result + "<TD>" + rset.getString(10) + "</TD>";
result = result + "<TD>" + rset.getString(11) + "</TD>";
result = result + "<TD>" + rset.getString(12) + "</TD>";
result = result + "<TD>" + rset.getString(13) + "</TD>";
result = result + "<TD>" + rset.getString(14) + "</TD>";
result = result + "</TR>"; %>
<%=result%>
<% }
rset.close();
stmt.close();
conn.close();
%>
<%=result%>
</TABLE>
</BODY>
</HTML> -
How to print .sql file name in the same file using sqlplus
Oracle 10g on Linux platform.
I am trying to print the name of .sql script file in that file but could not. Following is the file:
test.sql
select '&0' from dual;But instead of printing, it is asking for input:
SQL> @test.sql
Enter value for 0: Can any body give me a hint as how can i print the file name.Use this
SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT
and see
SQL> create or replace procedure get_dir_list
2 (p_directory varchar2)
3 is
4 l_null varchar2(100);
5 l_directory varchar2(100);
6 BEGIN
7 l_directory := p_directory;
8 sys.dbms_backup_restore.searchfiles(l_directory, l_null);
9 FOR x IN (select fname_krbmsft fname from x$krbmsft) LOOP
10 dbms_output.put_line(x.fname);
11 END LOOP;
12
13 END;
14 /
Edited by: HuaMin Chen on Jun 26, 2012 12:26 PM -
How to present my request result a "nicer way" ?
Dear Expert,
Two tables:
- User: UserID, UserName, JobID (FK on Job)
- Job: JobID, JobDescription
The request:
Select JoBDescription, UserName
from Job j, User u
where j.JobID = u.JobID
returns
Clerk, Mary
Clerk, John
Section Manager, Bob
Section Manager, Samantha
Section Manager, Lorrie
I'd like to change the presentation of the result like:
Clerk, Mary
(blank), John
Section Manager, Bob
(blank), Samantha
(blank), Lorrie
assuming that the (blank) means the JobDescription is the same as the for the above employee.
Is there a way to do so using SQL ?
Hope you can get some advice on that.
Best Regards,
Guillaume.Re: duplicate column values in sort
-
How to obtain sql query result in JavaScript
hello, i want to know if this is possible : i have a Javascript function that make this:
var szPLANT = document.getElementById("hid_Plant").value;
var szLINE = document.brs_Line.getSelectedItem();
var cell = document.brs_Cell.getSelectedItem();
var GetLineDownload = document.GetLineDownload.getQueryObject();
document.GetLineDownload.getQueryObject().setParam(1,szLINE);
document.GetLineDownload.getQueryObject().setParam(2,cell);
document.GetLineDownload.executeCommand();
but i to catch the result of the sql ...to use in another things in this function...how to to this?..like this:
result = document.GetLineDownload.results
regards
MárioMario,
your script suggests that you are using a iCommand query. The iCommand is used to execute a query that does not return a value, like an update, insert or delete query.
If you are expecting a result, you would normally use an iGrid, and then you can use the functions that Suresh proposed to read out the result cells. If you do not want the iGrid to be displayed, but only need the values in your JavaScript, then you can omit the "DisplayTemplate" parameter in your iGrid so it won't be displayed on the web page.
You can however read the values from the iCommand also by using the function "iCommand.getValue(Col, Row)".
Please have a look at [http://help.sap.com/saphelp_xmii120/helpdata/en/44/d91ad2d06f3ee2e10000000a114a6b/content.htm].
Michael
Edited by: Michael Otto on Nov 13, 2009 1:25 PM -
How to order SQL query results in order given in IN Clause
Hi,
I Need to construct a query, which takes a string as input and results for those should be sorted in the order in which request was made.
Say, we have a couple of students, and the grades in different subjects to be the result of the query.
If John and Jane are the two students,
and if input is John,Jane
my output should be listing John, his subjects and grades
and then Jane, her subjects and grades.
I read somewhere in other posts, that i could use a query combined with regular expression to split a string into a temp table/array and use this as my input for my select query. Then use the rownum or level from this temp table to sort the data in order sent in.
But am not able to put together a query which would work for me.
Anyone with any pointers on this would be highly appreciated.
ThanksHi,
[This thread|http://forums.oracle.com/forums/thread.jspa?threadID=702891&tstart=0] is about splitting up delimited lists. You'll want to keep the n-th value from the user-supplied list, as well as n itself, in a result set, so you can use it in both your WHERE- and your ORDER BY clause.
If you're using SQL*Plus, you can also keep the whole list in a substriution variable, and use INSTR to see where individual values appeard in that list. Personally, I'd trust the first method (split and store) more. -
How to use SQL query result in DOS commands
Hi
Currently i am runnig below DOS commands manually
d:\apps\bin>TrueGridsCalc period="Aug 2010"
Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
Steps which i am taking are
1. connect DB from command line (using SQLPLUS)
2. run query to fetch result
3.How to use query result in "period" parameter ?
I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
Thank you
Sachin
Edited by: sachin.mali on Oct 26, 2010 4:39 PM
Edited by: sachin.mali on Oct 26, 2010 4:43 PMsachin.mali wrote:
Hi
Currently i am runnig below DOS commands manually
d:\apps\bin>TrueGridsCalc period="Aug 2010"
Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
Steps which i am taking are
1. connect DB from command line (using SQLPLUS)
2. run query to fetch result
3.How to use query result in "period" parameter ?
I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
Thank you
Sachin
Edited by: sachin.mali on Oct 26, 2010 4:39 PM
Edited by: sachin.mali on Oct 26, 2010 4:43 PMYOu'll have to have sqlplus spool the output to a file, then figure out some way of parsing that file. Too bad you're stuck with Windows. With any *nix you could do the file parsing with one line of code. -
How to Print SQL Azure V12 current DB Utilization SIZE.
Hi,
After upgrading SQL Azure Server from V11 to V12, I am not able to Print DB Size..
$dbname =Get-AzureSqlDatabase -ConnectionContext "Server credential"
Write-Output $db.SizeMB
In V11 I am able to print current utilized Size in MB but after V12 I am not able to Print.1. you may have to disable the triggers as they do really slowdown the performance.
2. it depends on your network bandwidth.
you can learn more in the BOL.
https://msdn.microsoft.com/en-us/library/hh456371.aspx
Maybe you are looking for
-
How can I get rid of the text and only have icons in the bookmarkfield?
Earlier the bookmarkfied only showed icons but after the upgrade they show icons and text. How can I get back to only icons so I can have the good old overwiw back?
-
Can't update because it wants a wrong id
All my ILife apps won't update because when I set up my mac book it want an account and I used my google email address which was fine when I set it up but now the apps want to update using my apple id which is a tottally different email address. What
-
Curve 8620 freezes. the watch icon pops up and it freezes up. needs a battery pull everytime Device info carrier: Cincinnati Bell Model info and OS version:curve 8620 v5.0.0.900 a battery pull will fix the issue but it will happen again a day or 2
-
DTW -- UDF does not appear in Serial Number
Hi All, I am trying to update a UDF in serial number transaction table for GR PO. I have prepared a template where I have added a column at the end with the name of the column as defined in database. when I map these fields in DTW, I dont find this U
-
Can you download adobe on iPad?
How do you download adobe flash drive. On your iPad?