Exist Value in a table [message #677873] |
Fri, 18 October 2019 07:18 |
|
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
|
|
|