CREATE OR REPLACE FUNCTION a_createlines() RETURNS void AS $BODY$ DECLARE lineId VARCHAR(32); BEGIN select m_brand_id into lineId from m_brand order by created desc limit 1; FOR x IN 1..200 LOOP raise notice '%', x; INSERT INTO m_brand (m_brand_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, name, description) (SELECT get_uuid(), ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, x, description FROM m_brand WHERE m_brand_id = lineId); END LOOP; END ; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION a_createlines() OWNER TO tad;