stored procedure NULL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

stored procedure NULL

Post by ddragas »

Hi all

I'm kind new in stored procedures, so I would appreciate some help

What I want to accomplish is to check if search criteria is null or not, and based on this criteria - to return results.

Code: Select all

 
select table1.*, table2.* 
from some table1, table2 
where table1.client = table2.id 
and (table1.id = searchID or searchID = null)
 
now this is not working.

can somebody suggest me other solution?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: stored procedure NULL

Post by John Cartwright »

Code: Select all

.. searchID IS NULL
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Re: stored procedure NULL

Post by ddragas »

ok I couldn't see tree from woods

thank you

have a nice day

ddragas
Post Reply