mardi 9 juin 2020

Need to get error and id in the print statement in oracle sql query

I need a query to print some 4-5 errors in the if condition with id. need to check every error with its occurrence when it occurs 5 times then need to check id. if the same id for the error then need to print the error and associated id.

select id from table1  where
data like '% System is down%'
and date>= '05-SEP-15 07.55.00.000000000 PM' and date<= '05-SEP-15 07.59.00.000000000 PM'  
having count(id)>=2 group by id;

I need to write this in if statement. If "system down" occurs 5 time with same id "1" then it needs to print as system down with id:1. else communication error occurs with id 1 the it needs to print as "Communication error with id : 1" like this.

Aucun commentaire:

Enregistrer un commentaire