| From: | Rodrigo De León <rdeleonp(at)gmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: inner join problem with temporary tables |
| Date: | 2007-06-16 09:12:57 |
| Message-ID: | 1181985177.750508.66720@k79g2000hse.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Guillermo Arias ha escrito:
> Why it does not work???
> thanks for your help
What's wrong with:
CREATE OR REPLACE FUNCTION test1(
OUT art_cod character varying
, OUT art_descri character varying
, OUT exis_ubic character varying
, OUT exis_qty numeric
)
RETURNS SETOF record AS
$BODY$
SELECT a.art_cod, a.art_descri, e.exis_ubic, e.exis_qty
FROM articles a
INNER JOIN existences e
ON a.art_cod = e.art_cod;
$BODY$
LANGUAGE 'sql' STABLE;
SELECT * FROM test1();
art_cod | art_descri | exis_ubic | exis_qty
---------+------------+-----------+----------
1 | nails | new york | 100
2 | hammers | dallas | 130
3 | wood | miami | 1390
3 | wood | baltimore | 390
3 | wood | louisiana | 20
| From | Date | Subject | |
|---|---|---|---|
| Next Message | John Gunther | 2007-06-17 08:39:51 | joining a table whose name is stored in the primary record |
| Previous Message | chester c young | 2007-06-16 05:43:04 | Re: trigger firing order |