How to store resultset value to Some other variable
ResultSet rset1=stmt1.executeQuery("SELECT count(*) FROM
user_details_table" );
while(rset1.next())
System.out.println("No.of Connected Users In UserDetails Table: " + rset1.getInt(1));
int x=rset1.getInt(1);
to store tht resultset value into integer variable.Bt tht statement is giving error. Pls help me.
Thanks....
try
ResultSet rset1=stmt1.executeQuery("SELECT count(*) FROM
user_details_table" );
while(rset1.next())
int x=rset1.getInt(1);
System.out.println("No.of Connected Users In UserDetails Table: " + x);
}
Similar Messages
-
How to store report data in some other tale
Hi All,
I have one requirement from client but i don't know whether it is possible or not?
Any one give me an idea if it is possible.
EX:
I run the report with EMP table with SCOTT schema.i got the output.Now i want that output to be stored in some other table called TEST_EMP.
how i can store data from the report.I have to write any PL/SQL code in AFTER REPORT TRIGGER.
Please give me reply ASAP.Hi,
I would do this in group filter (in the lowest group of the query)
Regards
Rainer -
How to Open URL value stored in a variable in JSP
Hi all,
I want to know how i can use value of a string variable in a JSP as url to open.
<% String abc="some url value" ; %>
then i want to open abc as URL in JSP
Please suggest something on this.
any help in advance will be highly appreciated.
thanks,
savdeep.thanks rahul but,
I want to open the URL in
<% String URLvariable="abc.htm" ; %>
<% out.println("< a href=URLvariable>"+rs.getString("Some JSP value")+"</a>"); %>
please suggest how should i open the above URL value stored in JSP variable.
any help will be highly appreciated.
thanks,
savdeep. -
How do I pass value to 'getURL' url variable
Howdy,
I`m trying to launch a popup from a flash form using MX 7
The popup works fine but I cant for the life of me work out how to pass 'theid' value to the url variable for the popup window.
I think somthing like this can be done with action script and maybe a cfc but I really dont know how.
You will notice I referenced 'theid' value directly, I know this will never work but just wanted to show what i was trying to acheive. If I were using a HTML form I could use some javascrip to get the element by id and append the value to the url. Is there away to do this in action script?
<cfform format = "flash">
<cfsavecontent variable="ticketpopup">
getURL("javascript:window.open('supportdetails.cfm?id=#theid#' , 'TicketDetails', 'width=900,height=630, Scrollbars=1, resizable=0'); void(0);"); </cfsavecontent>
<cfselect name="selectbox" query="thequery" value="id" display="whatever"></select>
<cfinput type="hidden" name="theid" bind="{selectbox.selectItem.data}">
<cfinput type="button" name="mybutton" value="whatever" onClick="#ticketpopup#>
</cfform>
Any help, much appreciated :-)
ThanksI answered my own question, heres is a solution if anyone is interested..
You can add the following actionscript to the onChange attribute of the select box. Its passes the value of the selected index to the URL and opens in a new window :-)
No there is no need for a hidden field or a button either
<cfform format ="flash">
<cfselect name="name" query="thequery" value="thevalue" display="whatever">
onChange="getUrl('supportdetails.cfm?ticketnumber=' + categorysubject.dataProvider[categorysubject.selectedIndex]['data'],'_blank');
</cfselect>
</cfform> -
Use a Java Script variable's value in some other jsp ....how?
Please help me.................
<%@ page import="java.util.*" %>
<%@ page language = "java" import="java.sql.*,javax.servlet.*,javax.servlet.http.*,java.util.*" session = "true" %>
<HTML>
<HEAD>
<TITLE>Create Employee</TITLE>
</HEAD>
<BODY>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://10.203.143.55:3306/bdaymgr" ,"root","mysql");
stmt = conn.createStatement();
rs = stmt.executeQuery("Select emp_id,emp_name From employee_info ");
System.out.println("rs " + rs);
%>
<script language="JavaScript">
function OnSubmitForm(){
var box = document.form2.UserList;
var where_to = box.options[box.options.selectedIndex].value;
if(where_to =="")
{document.write("Please select something");}
else {Dont know what to do here }
</script>
</script>
<center>
<FORM NAME = "form2" onSubmit="OnSubmitForm();">
<table>
<TR>
<TD width="11%">User ID : </TD>
<TD width="180%"><select name="UserList" size="1">
<option>-- Select A User ID --<option>
<% while (rs.next()) {
%>
<option value='<%= rs.getString("EMP_ID")%>' ><%=rs.getString("EMP_ID") %></option>
<% } %>
</select>
<input type="hidden" name="score" value="">
<INPUT TYPE="SUBMIT" name="Submit" VALUE="Submit">
</TD></TR>
</TABLE>
</FORM>
</Center>
<%
stmt.close();
rs.close();
catch(Exception e){
System.out.println("Error : "+ e);
response.sendRedirect("errorcreateSession.jsp");
%>
</BODY>
</HTML>
As u can see i have extracted emp_id from the employee_info table and populated it in my drop down list
In the javascript i have used a variable "where_to" which keeps track of what the user has selected in the drop down list
I want to use this value of "where_to" in some other other jsp(say Admin.jsp) to carry out an insert query
how can i retrieve this value of "where_to" from Admin.jsp so that i can carry out my insert query
Thanx in advance i certainly hope that u will help meI made these changes in my Guest.jsp page(as u mentioned):
<FORM NAME = "form2" onSubmit="return OnSubmitForm();" action="Admin.jsp">
<select name="UserList" size="1">
<option>-- Select A User ID --<option>
</select>
<INPUT TYPE="SUBMIT" name="Submit" VALUE="Submit">
<script language="JavaScript">
function OnSubmitForm(){
var box = document.form2.UserList;
var where_to = box.options[box.options.selectedIndex].value;
if(where_to =="")
document.write("Please select something");
return false;
else
return true;
</script>
Now have a look at my Admin.jsp page:
<%@ page import="java.util.*" %>
<%@ page language = "java" import="java.sql.*,javax.servlet.*,javax.servlet.http.*,java.util.*" session = "true" %>
<HTML>
<HEAD>
<TITLE>Create Employee</TITLE>
</HEAD>
<BODY>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
PreparedStatement ps = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://10.203.143.55:3306/bdaymgr" ,"root","mysql");
String s=request.getParameter("UserList");
String m=request.getParameter("month");
String y=request.getParameter("year");
String a=request.getParameter("amount");
String sql="insert into contribution_info values(?,?,?,?)";
ps=conn.prepareStatement(sql);
ps.setString(1,s);
ps.setString(2,m);
ps.setString(3,y);
ps.setString(4,a);
ps.executeUpdate();
System.out.print("Values Entered");
%>
<center>
<FORM NAME = "form3" action="canBeAnyPage.jsp">
Month :<br><input type=\"text\" name="month"><br>
Year :<br><input type=\"text\" name="year"><br>
Amount Paid :<br><input type=\"text\" name="amount"><br>
<INPUT TYPE="SUBMIT" name="Submit" VALUE="Submit">
</FORM>
</center>
<% stmt.close();
rs.close();
catch(SQLException e){
System.out.println("Error : "+ e);
//response.sendRedirect("errorcreateSession.jsp");
%>
</BODY>
</HTML>
I dont know why but when i select one of the emp_id from the drop down list and press submit it does not show anything
I can see the value of "UserList" in the url which is correct
Probably there is some problem in my Admin.jsp page
Please find time to have a look at my code
Help would be really appreciated
thanx -
How to store Multiple values with restriction in Oracle 9i
Hi,
I am using oracle 9i R2 and i would like to know that how can i store multiple values and restrict some of values into oracle table?
ex.
I need to create table or inserting into existing table like below:
ID will be Primary/Unique key and each ID has multiple dept but each ID to have only 1 “X” dept, only 1 “Y” dept and only 1 “Z” dept… but, can have multiple “W” dept
What will be the best option to create/store data like this?
Like Table level Constraint (Unique or Check), Triggers or pl/sql?
ID DEPT
1 X
1 Y
1 Z
1 W
2 X
2 Y
2 Z
2 W
2 W
2 WHi,
Other solution:
Function:
CREATE OR REPLACE FUNCTION my_unique_function(p_dep IN VARCHAR2) RETURN VARCHAR2
DETERMINISTIC AS
BEGIN
IF (p_dep = 'X' OR p_dep = 'Y' OR p_dep = 'Z') THEN
RETURN p_dep;
ELSE
RETURN NULL;
END IF;
END;
/Test:
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> create table emp(id number, dept varchar2(30));
Table created
SQL>
Function created
SQL> CREATE unique index ix_emp on emp(my_unique_function(dept));
Index created
SQL> insert into emp(id,dept) values (1, 'X');
1 row inserted
SQL> insert into emp(id,dept) values (2, 'X');
insert into emp(id,dept) values (2, 'X')
ORA-00001: unique constraint (HR.IX_EMP) violated
SQL> insert into emp(id,dept) values (3, 'Y');
1 row inserted
SQL> insert into emp(id,dept) values (4, 'Y');
insert into emp(id,dept) values (4, 'Y')
ORA-00001: unique constraint (HR.IX_EMP) violated
SQL> insert into emp(id,dept) values (5, 'Z');
1 row inserted
SQL> insert into emp(id,dept) values (6, 'Z');
insert into emp(id,dept) values (6, 'Z')
ORA-00001: unique constraint (HR.IX_EMP) violated
SQL> insert into emp(id,dept) values (7, 'W');
1 row inserted
SQL> insert into emp(id,dept) values (8, 'W');
1 row inserted
SQL> Regards, -
How to store japanese values in cookies
Hi,
How to store japanese character stored/reterive in cookies..
I am using Windows XP..
Kindly help me if you know..
When i run the progrem the following exception will coming...
javax.servlet.ServletException: P�e���r���c�V�X�e��
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
����
java.lang.IllegalArgumentException: P�e���r���c�V�X�e��
org.apache.tomcat.util.http.ServerCookie.maybeQuote(ServerCookie.java:276)
org.apache.tomcat.util.http.ServerCookie.appendCookieValue(ServerCookie.java:209)
org.apache.coyote.tomcat5.CoyoteResponse.addCookie(CoyoteResponse.java:949)
org.apache.coyote.tomcat5.CoyoteResponseFacade.addCookie(CoyoteResponseFacade.java:290)
ims.co.jp.common.login.LoginAction.execute(LoginAction.java:242)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/Cookie.html#setValue(java.lang.String)
Assigns a new value to a cookie after the cookie is created. If you use a binary value, you may want to use BASE64 encoding.
With Version 0 cookies, values should not contain white space, brackets, parentheses, equals signs, commas, double quotes, slashes, question marks, at signs, colons, and semicolons. Empty values may not behave the same way on all browsers.
I didn't know that either... I guess you don't have much of a chance, you need to apply some sort of encoding. -
How to store this value in date variable?
Hi sir,
i am having one query which is
select to_char(date '1900-01-01' + 1439/(24*60),'DD/MM/YYYY HH24:MI:ss')from dual;
when i am running this query i am getting this value: 01/01/1900 23:59:00
and this value i am inserting in one variable which has date datatype.
here i am storing like this:
v_nshiftmax := to_char(date '1900-01-01' + 1439/(24*60),'DD/MM/YYYY HH24:MI:SS');
while storing getting error: not a valid month
how to store it in this variable?
thanks964430 wrote:
why using TO_DATE (), to improve performance avoid function calling if you can do without it, just use v_nshiftmax := date '1900-01-01' + 1439/(24*60); remove TO_CHAR() function only, as you already converted it to date.Please prove to us that TO_DATE(...) is slower that using DATE '...'
Both are internal functions that take a string and turn it into a date. -
How to store the value to variable?
hi
plz c the below code...
my prblm is i want to store the value of wa_final-preis into new_xeipa-preis if there is only one ebeln...
if there are more procss orders then i want to save the first value to new_xeipa-preis wn second record comes then new_xeipa-preis should be replaced by new value and old_xeipa-preis replaced by old value....
how to do this?
LOOP AT xeipa INTO wa_xeipa.
idx = sy-tabix.
CLEAR: wa_xeina.
READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
IF sy-subrc is INITIAL.
wa_final-infnr = wa_xeipa-infnr.
wa_final-ebeln = wa_xeipa-ebeln.
wa_final-bedat = wa_xeipa-bedat.
wa_final-matnr = wa_xeina-matnr.
wa_final-lifnr = wa_xeina-lifnr.
wa_final-peinh = wa_xeipa-peinh.
wa_final-preis = wa_xeipa-preis. "net price
wa_final-bprme = wa_xeipa-bprme.
wa_final-bwaer = wa_xeipa-bwaer.
IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
ENDIF.
append wa_final to it_final.
ENDIF.Hi Smitha,
Check the below given code.
LOOP AT xeipa INTO wa_xeipa.
idx = sy-tabix.
CLEAR: wa_xeina.
READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
IF sy-subrc is INITIAL.
wa_final-infnr = wa_xeipa-infnr.
wa_final-ebeln = wa_xeipa-ebeln.
wa_final-bedat = wa_xeipa-bedat.
wa_final-matnr = wa_xeina-matnr.
wa_final-lifnr = wa_xeina-lifnr.
wa_final-peinh = wa_xeipa-peinh.
wa_final-preis = wa_xeipa-preis. "net price
wa_final-bprme = wa_xeipa-bprme.
wa_final-bwaer = wa_xeipa-bwaer.
" First time this value is not populated. When the second value comes in,
" New value gets populated in OLD variable and New value is replaced with the latest.
*IF idx NE 1.*
*old_xeipa-preis = new_xeipa-preis.*
*ENDIF.*
*new_xeipa-preis = wa_xeipa-preis.*
IF ( wa_final-infnr is NOT INITIAL ) AND ( wa_final-ebeln is NOT INITIAL ) .
ABWEICHUNG = ( new_xeipa-preis / old_xeipa-preis ) * 100 .
ENDIF.
append wa_final to it_final.
ENDIF.
ENDLOOP.
I hope this is what you were looking for.
Thanks & Regards,
Ram.
Edited by: ram Kumar on Jun 12, 2009 5:16 PM -
How to store the value in table
Hi All,
I ve a requirement where im adding a check box on a seeded supplier_create page via personalization. The seeded page contains only a root AM and a root controller.The table which stores the supplier details does not have a dff.so i have to store a yes or no value and a foreign key ref into a custom table to map both the tables. the rootAM is actually calling the underlying seededVO to create a row in the database.Now how can I insert the yes/no and the foreign key values into my custom table??
Thanks.Isn't there any other column in the table which you can use?
Anyway you can call a PLSQL API (to create a row in the Custom Table and store the value and also to make a foreign key join therein). This PLSQL can be called from the Controller (extend the standard Controller).
Now when you come to the Page, either you substitute the standard VO, or easier still (since I assume checkbox is on the Page and not in the table), you can call a PLSQL function and get the value of the checkbox. May be you can also create a dymanic VO and get the value from the Custom table for the current standard table row.
Please do a compete thinking on the idea above and do let me know where you forsee issues. The above solution focusses more on PLSQL API invocations and thus decreases the need for Substitutions.
Thanks
Sumit -
How to store the value of sum of group in Crystal Report at the runtime!
Hello all,
I creates a Formula Field that hold the value of Sum of Group in Crystal Report. I would like to know how to store it in a variable and pass it to store procedure. Is it an option in Crystal report to do it. I knew that Crystal Report can cache the report for sharing. My detailed issue as following:
- Created a Formula Field named TOTAL AMOUNT that calculated the complex expression. This TOTAL AMOUNT is dynamic based on group and variables.
- I would like to store that value from TOTAL AMOUNT and pass it to the stored procedure parameter IN.
Any helps are much appreciated. Thanks.I doubt that this is possible since it would only calculate this value once the report has data. This sounds more like a report design question that should be asked over [here|SAP Crystal Reports;
-
How to store global values for the whole application to use ?
Hi,
In our application, we have global values that is store in a parameter table, I want only to query it once, and it will be used every where from the whole application.
e.g :
I have general parameter tables that store :
% Tax
Current Period
etc..
Then these values will be used in our business rules in the whole application.
How can I do that in ADF BC ?
Thank you,
xtantoI would go ahead and create a transient VO with an attribute called "userLanguage" and store the value at the initialization step.
We generally call this type of VO as PVO which is a transient VO and contains only 1 record at any point of time. Keep this VO inside the RootAM and you can write a static util method as below..
public static String getUserLanguageFromPVO()
PVOImpl pvo = (PVOImpl)am.findViewObject("MyPVO");
if(pvo != null)
Row row = pvo.first(); //Always returns the one record
return (row == null ? null :
(String)row.getAttribute("UserLanguage"));
return null;
} -
How to store three values in a suitable data structure?
Hi Friends!
Usually, if we want to store a single value we choose vector/set data structure.
And for two values we prefer map<int, vector<int>> or multimap<int, vector<int>>.
If I want to store three values like;
1=>3=>2 4 5
1=>5=>7
2=>3=>10 12
Then, which data structure is suitable for it?
And how to insert entry into it?
Could anyone help me?You could try
typedef vector<int> INTVEC;
typedef map<int, INTVEC> INTMAP;
typedef multimap<int, INTMAP> INTMULT;
You should convince yourself that the above is equivalent to (but hopefully easier to understand)
typedef multimap<int, map<int, vector<int>>> INTMULT;
When you try to store values in an object of this type, remember to build it from the inside out:
Build an INTVEC with the values you want (such as 2 4 5 per your first example).
Assign that INVEC to an INTMAP with a suitable key (3 in your example).
Insert that INTMAP into an INTMULT with its appropriate key (1 per your example).
Repeat these three steps using 7, 5, 1, respectively.
Repeat again using 10 12, 3, 2, respectively.
Alternately, you could define a structure like
struct INTSTRUCT{
int key;
vector<int> vec;};
and then define your multimap as <int, INSTSTRUC>. This allows you to assign values to both members of a structure object directly and then insert the structure into the multimap with the appropriate key.
On the other hand, if you change your concept by removing the second => and always put the "second" int as the first element of the vector, as in
1 => 3 2 4 5
1 => 5 7
2 => 3 10 12
you could simplify things to a multimap<int, vector<int>> you are already familiar with.
A slightly different concept change to
1 => 3 => 2 4 5
5 => 7
2 => 3 => 10
would allow you to use map<int, map<int, vector<int>>> where element [1] of this object contains a map with two elements and element [2] contains a map with a single element.
Or you could tell us how you intend to use the data and maybe somebody can suggest a more practical approach.
Yes, I could understand the way you explained as
typedef multimap<int, map<int, vector<int>>> INTMULT;
and I used typedef
multimap<int, map<int, set<int>>> INTMULT;
but, when I used it, I get,
1=>3=>2
1=>3=>4
1=>3=>5
1=>5=>7
2=>3=>10
2=>3=>12 -
After upgrading to IOS7, my camera disappeared, app store is gone and some other apps
I upgraded from iphone 4 to 4S. it was working one evening and asked me to upgrade operating system. After it dounloaded and installed, I don't have my camera, or the app store, and some other apps are missing. wanted to synk with itunes, it asked me to upgrade itunes to latest version, it is not installing anything, but says thank you for dounloading latest itunes.....
Frustrated. help please?Margarita4 wrote:
... After it dounloaded and installed, I don't have my camera, or the app store, ...
Check in Restrictions...
Settings > General > Restrictions
Understanding Restrictions > http://support.apple.com/kb/HT4213 -
How to store multiple values associated to one key
hello all
In my program I need to store "multiple values associated to one key".
for example : key would be ="T"
Values are = 2,4,5,1,2Plz tell me which data structure I can use for this purpose.
I have tried Hashtable for it, unfortunately it does not support duplicate keys in one Hashtable.
Thanx.
RakeshThe easiest thing to do, is store another data structure as your value for a
particular key. So "T" being your your key, you would associate the value
to be an int[] (if you know the number of sub values) or create a new Vector
for each key, then you don't have to worry about the number of values at
compile time. All the while still using the Hashtable for constant time
look up. So like this:
public void storeMultValues(int[] arr)
Vector v = new Vector();
v.add(new Integer(1));
v.add(new Integer(2));
v.add(new Integer(3));
this.hashtable.put("T", v);
}See if you can work with that.
-Cludge
Maybe you are looking for
-
CS4 - how to transfer photos in bridge to new laptop (CS4 has been installed)
Purchased a new laptop (pc). The technician told me to deactivate CS4 on my old laptop before activating it on my new laptop. Did so. I asked that all my raw photos located in bridge be transferred over to my new laptop. It appears this did not t
-
I have mobil me where the icloud icon should be, how do I find and download icloud?
Currently my macbook pro has mobil me, how do I convert to icloud?
-
This precedure is not consistent!
I have this precedure, but it is not consistent, the idea is if the count Coming from the get_the_count_cur is = 1 then I update the Table with the result of get_the_race_cur otherwise if the Count s > 1 then I update the table with T, it works but i
-
I am experiencing a problem where the response from my component is empty. I have performed tracing and I noticed that the thread simply stops. No exception is raised. Not in my logs and not in any of the portal logs. I though that this occurs only i
-
Repeat calendar appointments - can the default settings be changed?
I happened to pass the O2 shop in Oxford Street yesterday and went in to look at the new 3G iPhone. Lots of display models available to play with, so I tried to create a sample calendar entry and repeat it every 32 days, which is my shift pattern at