MySQL Forums
Forum List  »  PostgreSQL

PostgreSQL function into MySQL
Posted by: Dana Zon
Date: December 23, 2008 07:35AM

Hi there,

I need to convert the following code from PostgreSQL into MySQL

Code:

CREATE TYPE type_name AS
(
field_id INTEGER,
field_name VARCHAR(50)
);


CREATE FUNCTION function_name()
RETURNS SETOF type_name LANGUAGE plpgsql AS $$
DECLARE
variable_name type_name;
BEGIN
FOR variable_name IN
SELECT field_id, field_name
FROM table_name
ORDER BY field_id
LOOP
RETURN NEXT variable_name;
END LOOP;
END;
$$;


SELECT * FROM function_name();


Can anybody help?


Thanks in advance!

Options: ReplyQuote


Subject
Views
Written By
Posted
PostgreSQL function into MySQL
8698
December 23, 2008 07:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.