Wow, thank you! I'll study your examples to learn as well!
I am using your fine program as a matter of fact, and when executing the
CREATE FUNCTION code below, I get the message:
ERROR: Unrecognized language specified in CREATE FUNCTION: 'plpgsql'.
Pre-installed languages are SQL,C, and internal.
Additional languages may be installed using 'createlang'.
I went to the pdocs and read about createlang script, and found createlang
script in my
/usr/local/pgsql/bin
but when I type various things to try to even list my installed languages -
let alone install plpgsql - which I thought came automatically installed? -
I keep getting
Command not found.
I ls and I see createlang in the dir I'm in.
I type things like: (my db is named rbl)
createlang -l rbl
createlang -l -drbl
createlang -l -d rbl
createlang -l template1
createlang -l
createlang
all return the same "Command not found"
Glad this is a newbie list... ????
Thank you,
- April
At 07:51 PM 4/14/2002 +0200, you wrote:
>Took me 10 min to complete
>
>CREATE FUNCTION substr_start(varchar,varchar,int4) RETURNS varchar AS '
>DECLARE
> original alias for $1;
> substring alias for $2;
> startpoint alias for $3;
> return_str varchar;
>BEGIN
> return strpos(substr(original,startpoint,length(original)),substring);
>END;'
>LANGUAGE 'plpgsql'
>
>
>CREATE FUNCTION reverse_str(varchar) RETURNS varchar AS '
>DECLARE
> original alias for $1;
> reverse_str varchar;
> i int4;
>BEGIN
> reverse_str = '''';
> FOR i IN REVERSE LENGTH(original)..1 LOOP
> reverse_str = reverse_str || substr(original,i,1);
> END LOOP;
> return reverse_str;
>END;'
>LANGUAGE 'plpgsql';
>
>
>
>http://www.pgexplorer.com
>GUI postgresql tool
>
>
>----- Original Message -----
>From: "April L" <april@i-netco.com>
>To: <pgsql-novice@postgresql.org>
>Sent: Sunday, April 14, 2002 7:02 PM
>Subject: [NOVICE] string functions
>
>
>> I have studied the Users Lounge and links off of it, looking for a place
>> where PG users are sharing extended functions they have created for PG.
>>
>> In particular I am looking for string functions such as being able to
>> specify a start point for finding a substring within a string. The
>existing
>> PGSQL function position(substring,string) nor strpos(string,substring)
>have
>> the option of specifying a start point for the search.
>>
>> Also I am looking for a function to reverse a string, so that for example
>> reverse("april") returns "lirpa"
>>
>> Can anyone point me to an area where users are sharing functions they
>> created, especially the ones I'm looking for? At this point I'm not able
>to
>> write one for myself. I am stuck using Cold Fusion which does include the
>> functions I need, but is so slow at it that it times out before completing
>> the update to all of my 250,000 records.
>>
>> Thank you,
>>
>> - April
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>