From: A.Bhuvaneswaran <bhuvan@symonds.net>
To: Rod Taylor <rbt@rbt.ca>
Cc: Jomon Skariah <jomons@aztec.soft.net>
Cc: Kris Jurka <books@ejurka.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: MINUS & ROWNUM in PostGres
Date: Wed, 10 Sep 2003 18:27:10 +0530 (IST)
Message-ID: <Pine.LNX.4.44.0309101825080.1712-200000@Bhuvan.bksys.co.in> (raw)
In-Reply-To: <1063109954.65347.93.camel@jester>
> Anyway, you'll need to write your own replace() if you stick with that
> release.
>
You can use this replace function, if you stick with that release.
regards,
bhuvaneswaran
Attachments:replace.sql (text/plain, 1.0K) download
create or replace function replace (varchar, varchar, varchar) returns varchar as '
declare
string alias for $1;
find alias for $2;
replacement alias for $3;
match integer;
end_before integer;
start_after integer;
string_replaced varchar;
string_remainder varchar;
begin
string_remainder := string;
string_replaced := '''';
match := position(find in string_remainder);
while (match > 0) loop
end_before := match - 1;
start_after := match + length(find);
string_replaced := string_replaced || substr(string_remainder, 1, end_before) || replacement;
string_remainder := substr(string_remainder, start_after);
match := position(find in string_remainder);
raise notice ''replaced %, remainder %'', string_replaced, string_remainder;
end loop;
string_replaced := string_replaced || string_remainder;
return string_replaced;
end;
' LANGUAGE 'plpgsql';
-- rmello@fslc.usu.edu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: bhuvan@symonds.net, rbt@rbt.ca, jomons@aztec.soft.net, books@ejurka.com
Subject: Re: MINUS & ROWNUM in PostGres
In-Reply-To: <Pine.LNX.4.44.0309101825080.1712-200000@Bhuvan.bksys.co.in>
References: <1063109954.65347.93.camel@jester> <Pine.LNX.4.44.0309101825080.1712-200000@Bhuvan.bksys.co.in>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox