need to check different entry that runs in diffrent timing criteria

Need a java that code check the below table details and get the id and name .
Table name: Run
I am using query to check whether any entry that is currently in waiting status should not be more than 10min

Run id      Run name      Start_date      End_date      Intiated_by      status
45                Footjob      07-APR-15      07-APR-15      ramesh      Runned
21                 crcjob              27-JUL-16      27-JUL-16      suresh      Runned
88               kuljob             28-JUL-16      28-JUL-16      kullal      Runned
76             nanjob            28-JUL-16      28-JUL-16      jillu              Runned
89               harjob             28-FEB-18                           admin      waiting

Current query : select Run id,24*60*(SYSDATE - START_DATE) time from Run where STATUS ='WAITING’ and (24*60*(SYSDATE - START_DATE))>10,

I need to get the id and name of entry which is in below condition.
Problem here is I want get different entry data for example
Footjob should not run more than 2hours which is in waiting status, kuljob should not run more than 30min which is in waiting status
Time differs for each entry
Nandha Kumar BAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
There's no magic really - it's just a question of concatenating the strings of the query into one query
0
 
CEHJCommented:
Your question is unclear
0
 
Nandha Kumar BAuthor Commented:
how to check entries in table and set different criteria for each entries using java .

entry one should not be more than 10min, (i.e.,) the sysdate-(minus)startdate >10min
entry two should not be more than 15min,(i.e.,) the  sysdate-(minus)startdate >15min
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
CEHJCommented:
Are you saying if the results don't meet those criteria, you want to do an update or what?
0
 
Nandha Kumar BAuthor Commented:
if the result didt meet that criteria i wanna get respective Run id and name.

please find below JAVA code which i have already used, but i am able to get only the if the entry run more than 10min. i want to set different time criteria for different entries

entry one should not be more than 10min, (i.e.,) the sysdate-(minus)startdate >10min
entry two should not be more than 15min,(i.e.,) the  sysdate-(minus)startdate >15min

package com.philips.tam.dao;
import java.sql.Connection;
import java.sql.ResultSet;


import java.sql.Statement;

import com.philips.tam.configuration.TamConfiguration;

public class JobnotificationDAO {
      private String getNotificationJob(){
            String strQuery="select Run id,Name from Run where STATUS ='WAITING’ and (24*60*(SYSDATE - START_DATE))>10";
            return strQuery;
      }
            
public String executeNotificationjob(Connection con){
      String strResult="";
      try {
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery(getNotificationJob());
            String Name;
            int Run ID;
            int id;
            double time;      
            //Date created_date;
            strResult=strResult+"The long running\n";
            while(rs.next()){
                  Name=rs.getString(2);
                  Run id=rs.getInt(2);
                  //      expiryDays=rs.getInt(4);
                  strResult=strResult+"runName: "+Name+"\n";
                  strResult=strResult+"run Id: "+Run id+"\n";
                  //con.createStatement().executeQuery(getNotificationdeletion(recordId));
                  //strResult=strResult+"Notification records deleted\n";
            }
      
            rs.close();
            stmt.close();
      } catch (Exception e) {
            strResult=strResult+e.getMessage()+"\n";
      }
      return strResult;
}

}
0
 
CEHJCommented:
You can only really do that by ORing the criteria you're interested in into the query.
0
 
Nandha Kumar BAuthor Commented:
could you explain how to do that
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.