From: | Phillip Nelson <phillip(dot)nelson(at)ints(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Replace function question |
Date: | 2007-07-12 18:14:09 |
Message-ID: | 46966F71.2030609@ints.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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;
From | Date | Subject | |
---|---|---|---|
Next Message | Brian P Ford Sr | 2007-07-12 19:48:39 | dump restore help |
Previous Message | yanot panara | 2007-07-11 13:41:41 | Re: pam + PostgreSQL |