i'm trying to get the time with a store procedure but i don't nkow how
to do it. can someone help me?? tanks in advance.
Serge Rielau - 21 Oct 2004 16:10 GMT
> i'm trying to get the time with a store procedure but i don't nkow how
> to do it. can someone help me?? tanks in advance.
Do you mean elapsed time in the proc or current time?
Cheers
Serge
Rhino - 21 Oct 2004 16:46 GMT
> i'm trying to get the time with a store procedure but i don't nkow how
> to do it. can someone help me?? tanks in advance.
If you are talking about the current clock time and if this is a Java stored
procedure, the following code will work, assuming you have already
instantiated your connection, which is called parmConn in this example:
ResultSet rs = null;
Statement stmt = null;
/* Get the current time. */
try {
String query = "Values(current time)";
stmt = parmConn.createStatement();
rs = stmt.executeQuery(query);
System.out.println("");
System.out.print(query + ": ");
while (rs.next()) {
System.out.print(rs.getTime(1)); //display time
System.out.println("");
}
stmt.close();
rs.close();
}
catch (SQLException sql_excp) {
sql_excp.printStackTrace();
}
The output I got when I ran it was:
Values(current time): 11:45:38
Rhino
Omar Vazquez - 25 Oct 2004 15:10 GMT
thanks a lot by the help. ok this is how i'm tryig, i'm using V.B. 6.0
DB2 8.1 on windows.