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
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match