Hi, I don't know why my following simple Java codes can't be complied. Would you experienced programmers teach me? Thanks
---------------------
ResultSet result = sql.executeQuery("select (to_char(sysdate,'hh24')*60 to_char(sysdate,'mi')) - (to_char(ANOTHERTIME,'hh24')*60 + to_char(ANOTHERTIME,'mi')) as
diff from TABLE ");
while ( result.next() ) {
String diff = result.getString("diff");
int diff2 = Integer.parseInt(diff);
}
conn.close();
if ( diff2 > 60 ) {
System.out.println("Over an hour");
}
--------
Test.java:29: cannot resolve symbol
symbol : variable diff2
location: class Test
if ( diff2 > 60 ) {
^
1 error
---------------------
ResultSet result = sql.executeQuery("select (to_char(sysdate,'hh24')*60 to_char(sysdate,'mi')) - (to_char(ANOTHERTIME,'hh24')*60 + to_char(ANOTHERTIME,'mi')) as
diff from TABLE ");
while ( result.next() ) {
String diff = result.getString("diff");
int diff2 = Integer.parseInt(diff);
}
conn.close();
if ( diff2 > 60 ) {
System.out.println("Over an hour");
}
--------
Test.java:29: cannot resolve symbol
symbol : variable diff2
location: class Test
if ( diff2 > 60 ) {
^
1 error