Home » SQL & PL/SQL » SQL & PL/SQL » Exist Value in a table (12c)
Exist Value in a table [message #677873] Fri, 18 October 2019 07:18 Go to previous message
deepakdot
Messages: 89
Registered: July 2015
Member
What is the Best way to find if there is at lease one row exist in a table.

select * from TABLE1
where exists (select 1 from TABLE1 where COL1 = 'TEST');

This list down all the Rows matching this filter. I am getting thousand of rows where COL1= 'TEST'.
But I just want to see if at least 1 row exist , it should stop the execution and come out.

select 1 from TABLE1 where COL1 = 'TEST' fetch first rows only;

I can use "fetch first rows only" in oracle, But we have a restriction of using this.

Thanks
Deepak

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with questions i'm tying to validate from interview
Next Topic: Two digit decimal
Goto Forum:
  


Current Time: Fri Apr 19 11:44:11 CDT 2024