From: | "MaDog" <istvan(dot)simon(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | PlPg/SQL |
Date: | 2007-03-31 22:40:56 |
Message-ID: | 1175380856.798109.285610@b75g2000hsg.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
How can i return one more row form a pgpl/sql function?
CREATE OR REPLACE FUNCTION GetRows(INTEGER, INTEGER, INTEGER) RETURNS
TEXT AS $$
DECLARE
Rows table_name%ROWTYPE;
BEGIN
SELECT * INTO Rows FROM table1_name WHERE id = $1;
-- Return (1, 'Smis', 'smis(at)gmail(dot)com')
SELECT * INTO Rows FROM table2_name WHERE id = $2;
-- Return (2, 'Ashle', 'Ashle(at)gmail(dot)com')
SELECT * INTO Rows FROM table3_name WHERE id = $3;
-- Return (1, 'Galaxy University', 'g-uni(at)gmail(dot)com')
RETURN Rows;
END;
$$ LANGUAGE 'plpgsql';
SELECT * FROM GetRows(1,2,3);
I want return for all 3 row in one table? How can i do that?
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathan Vanasco | 2007-03-31 22:51:41 | queries stop using indexes |
Previous Message | Justin Dearing | 2007-03-31 22:36:30 | Default value of column not respecting character length or domain restraints. |