Home » RDBMS Server » Server Administration » How do I check whether a returned record is empty?
How do I check whether a returned record is empty? [message #371047] Thu, 17 August 2000 10:36 Go to next message
Mike S.
Messages: 1
Registered: August 2000
Junior Member
I'm using Tcl as a scripting language on my web page. I've been trying to test whether or not Oracle finds records matching my SELECT statement...

EX: SELECT * FROM table WHERE var LIKE %y%

I have an IF statment that tests whether or not var comes back empty, but I haven't been able to find the right test to return TRUE when the record is actually "empty" or includes no matching records...

I've test like this: IF {var == NULL} ...and... IF {var <= -1} ...and... IF {var == ""} ...etc., but none of these tests returns TRUE, even when I'm absolutely sure that no records matched my SELECT.

I guess the data type for Oracle "empty" recordsets is something special... Can any one help with a simple expression that will test for "empty" recordsets?

Thanks,

Mike
Re: How do I check whether a returned record is empty? [message #371049 is a reply to message #371047] Thu, 17 August 2000 12:17 Go to previous messageGo to next message
Ahuja
Messages: 3
Registered: August 2000
Junior Member
I thing u should do ......

If var IS NULL then .......

Hope this helps.
Re: How do I check whether a returned record is empty? [message #371072 is a reply to message #371049] Tue, 22 August 2000 23:13 Go to previous message
mahaveer
Messages: 16
Registered: July 2000
Junior Member
Hi,

You just go through the following procedure. I have given exception to find the empty records.

declare
a number;
begin
select sal into a from emp where ename='maha';
exception
when no_data_found then
dbms_output.put_line('No Records');
end;

I hope it will helpful

Mahaveer
Previous Topic: Database archivelog mode
Next Topic: UNIX versus NT,
Goto Forum:
  


Current Time: Sat Oct 24 04:31:43 CDT 2020