Replace function question
Replace function question
От:
Phillip Nelson <phillip.nelson@ints.com>
Дата:
In the following insert_oicc function I need to replace and embedded ascii character back into a comma. The following code seems to work. However, I need to do this same thing on another table that has 70 columns. I am wondering if there is a way to do this globally so I don't have to type the replace function on every column name in the select. Any help would be appreciated! CREATE OR REPLACE FUNCTION insert_oicc() RETURNS void AS $BODY$ BEGIN BEGIN INSERT INTO store (store_number, store_name, short_name) SELECT lpad(storenum, 5, '0'), replace(name, '', ','), replace(short_name, '', ',') FROM oicc_tmp WHERE storenum NOT IN (SELECT store_number FROM store); END; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION insert_oicc() OWNER TO postgres;