Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / October 2004

Tip: Looking for answers? Try searching our database.

get time in a sp

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Omar Vazquez - 21 Oct 2004 14:37 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.
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.