Subject PSQL Query - Am I doing this right?
Author myles@techsol.org
I have a stored procedure that I wish to pass in a variable (varchar(200))
that contains the name of a field to use in a query, along with the search
value to search (varchar(200) also).

In trying to construct the query in the stored procedure, my WHERE clause
looks like this:

WHERE (ASSET.RECORD_INACTIVE <> 'Y') and (:V_SEARCH_FIELD LIKE
ASCII_CHAR(39) || :A_FOR || ASCII_CHAR(39))

My goal is to have the query read:

WHERE (ASSET.RECORD_INACTIVE <> 'Y') AND (ASSET_SERIAL_NO LIKE 'ABC123')

I've tried this query out, resolved as above and it works fine. But when I
attempt to execute it through the stored procedure, it always returns no
values.

Do I have the syntax for this type of thing wrong? If so, how should it
look?

Myles


============================
Myles Wakeham
Director of Engineering
Tech Solutions US, Inc.
Scottsdale, Arizona USA
Phone (480) 451-7440
www.techsol.org