varchar return data split into int4?

From: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: varchar return data split into int4?
Date: 2002-07-19 04:42:56
Message-ID: OF129B1594.FDD0DFBB-ON88256BFB.0018DA50-88256BFB.0019EBDE@fds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I picked up a function from the Pg Cookbook that pulls back data in a tree
fashion
(http://www.brasileiro.net/postgres/cookbook/view-one-recipe.adp?recipe_id=15).

The end result of the data is returned as a VARCHAR in this fashion:
0,122,144,1,229.......
I would like to use the result of the function in a query that requires the
result to be an INT4. Is it possible to split the result into individual
numbers?

Here's how I would like to use the query:

Select * from mdc_products
where keyf_category_home IN (select category_code(160))

When I run this, I get 0 results. If I manually run the select
category_code(160) and paste the results within the IN statement, I get
data. This leads me to believe that because the return data from the
function is VARCHAR, it won't work.

TIA

Patrick Hatcher

Browse pgsql-novice by date

  From Date Subject
Next Message Pierre-Yves Landuré 2002-07-19 07:05:29 problem using ?# operator on polygon
Previous Message April L 2002-07-19 03:32:35 Re: mirroring databases