Skip site navigation (1) Skip section navigation (2)

Help with prepared statement

From: Bendik Rognlien Johansen <bendik(dot)johansen(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Help with prepared statement
Date: 2005-05-23 15:51:04
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
I am having some difficulty using a prepared statement.

PREPARE fooplan(int4, int4) AS SELECT * FROM records WHERE id = $1  
AND fax = $2;

Normally this works fine like this:
EXECUTE fooplan(42985, 12345678);

However, sometimes I need to match NULL values like this:

EXECUTE fooplan(42985, NULL);

This fails of course since "fax = NULL" is not the same as "fax IS  

Is there any way around this?



pgsql-novice by date

Next:From: Bruno Wolff IIIDate: 2005-05-23 17:52:16
Subject: Re: Problem restarting server
Previous:From: Agustín Caminero HerráezDate: 2005-05-23 14:20:23
Subject: Re: Problem restarting server

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group