Replace function question - Mailing list pgsql-novice

From Phillip Nelson
Subject Replace function question
Date
Msg-id 46966F71.2030609@ints.com
Whole thread Raw
List 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;

pgsql-novice by date:

Previous
From: "yanot panara"
Date:
Subject: Re: pam + PostgreSQL
Next
From: "Brian P Ford Sr"
Date:
Subject: dump restore help