MySQL Forums
Forum List  »  Newbie

no data found syntax
Posted by: Michael Chandler
Date: August 22, 2005 10:47AM

I need to know the syntax for handling a 'no rows' or 'no data found' from a select. The syntax in Oracle's SQL is:
begin
select col1
from table1
where col1 = 'A'
;
exception when no_data_found
then
insert into tabl1(col1)
values
('A');
end;
I'm running a select from a perl/cgi script to find out if I already have an IP address in a table. If I don't have it I want to insert it and kick my counter by 1. If I have it, I don't want to count that hit on the web page.
Any help is greytly appreciated.

Options: ReplyQuote


Subject
Written By
Posted
no data found syntax
August 22, 2005 10:47AM
August 22, 2005 12:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.