Re: [SQL] variables with SELECT statement

2008-09-05 Thread Frank Bax
Kevin Duffy wrote: No looks like I have 8.2 This works on 8.2: String_to_array(regexp_replace(description,E'\\s+',' ','g'),' ') -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Kevin Duffy
When was 8.3 released? But for today I could do string_to_array(regexp_replace(description, E'\\s+', ' '), ' ') as desc and get what I need to survive. Many thanks for all the replys. Would not have made progress on this by myself. kd -Original Message- From: Scott Marlowe [mailto:

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Scott Marlowe
On Fri, Sep 5, 2008 at 3:28 PM, Kevin Duffy <[EMAIL PROTECTED]> wrote: > No looks like I have 8.2 I can attest that all of 8.3's performance improvements as well all of the really useful new functions like the one mentioned here make it well worth the effort to upgrade. I haven't been as excited

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Kevin Duffy
Thanks Mr. Lane for catching that. If I run SELECT regexp_split_to_array('the quick brown fox jumped over the lazy dog', \\s+'); Straight out of the documentation I get ERROR: function regexp_split_to_array("unknown", "unknown") does not exist Let me guess I have to upgrade. kd -Origina

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Kevin Duffy
No looks like I have 8.2 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Frank Bax Sent: Friday, September 05, 2008 5:13 PM Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] variables with SELECT statement Kevin Duffy wrote: > Just testing the regexp_stri

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Tom Lane
Frank Bax <[EMAIL PROTECTED]> writes: > Kevin Duffy wrote: >> ERROR: function regexp_string_to_array(text, text) does not exist > Are you running 8.3? Also, it's regexp_split_to_array ... regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Frank Bax
Kevin Duffy wrote: Just testing the regexp_string_to_array This SQL select description, regexp_string_to_array(description::text , E'\\s+' ) as optdesc, securitytype from xx where type = 'B' order by 1 produced this error: ERROR: function regexp_string_to_array(text, text) does n

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Kevin Duffy
Just testing the regexp_string_to_array This SQL select description, regexp_string_to_array(description::text , E'\\s+' ) as optdesc, securitytype from xx where type = 'B' order by 1 produced this error: ERROR: function regexp_string_to_array(text, text) does not exist SQL state: 4

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Frank Bax
Kevin Duffy wrote: Noticed that string_to_array does not handle double spaces very well. If there are double space between the tokens, there is "" (empty string) in the array returned. Not exactly what I expected. Try regexp_replace http://www.postgresql.org/docs/8.3/interactive/functions-st

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Kevin Duffy
OK that is a syntax I have never seen. But correct we are getting close. Noticed that string_to_array does not handle double spaces very well. If there are double space between the tokens, there is "" (empty string) in the array returned. Not exactly what I expected. KD -Original Message-

Re: [SQL] variables with SELECT statement

2008-09-05 Thread Frank Bax
Kevin Duffy wrote: Within my table there is a field DESCRIPTION that I would like to parse and split out into other fields. Within DESCRIPTION there are spaces that separate the data items. String_to_array(description, ‘ ‘) does the job very well. I need something like this to work.

[SQL] variables with SELECT statement

2008-09-05 Thread Kevin Duffy
Hello All: I have a simple issue. Within my table there is a field DESCRIPTION that I would like to parse and split out into other fields. Within DESCRIPTION there are spaces that separate the data items. String_to_array(description, ' ') does the job very well. I need something like

Re: [SQL] Correct Insert SQL syntax?

2008-09-05 Thread Scott Marlowe
On Fri, Sep 5, 2008 at 10:11 AM, Lennin Caro <[EMAIL PROTECTED]> wrote: > --- On Thu, 9/4/08, Ruben Gouveia <[EMAIL PROTECTED]> wrote: >> ) (select >> p_date, >> >> fcn_stats1(p_date,'basic'), >> >> fcn_stats2(p_date,'basic',0) >>

Re: [SQL] Correct Insert SQL syntax?

2008-09-05 Thread Lennin Caro
--- On Thu, 9/4/08, Ruben Gouveia <[EMAIL PROTECTED]> wrote: > From: Ruben Gouveia <[EMAIL PROTECTED]> > Subject: [SQL] Correct Insert SQL syntax? > To: "pgsql-sql" > Date: Thursday, September 4, 2008, 10:16 PM > Will this syntax work: > > fcn_stats are all in the same schema > > CREATE OR R

Re: [SQL] Correct Insert SQL syntax?

2008-09-05 Thread Bart Degryse
You might wanna check out the PostgreSQL manual. http://www.postgresql.org/docs/ There's definitely an answer in it to all your questions. Especially chapter 38 on migrating from Oracle to PostgreSQL might be helpful. http://www.postgresql.org/docs/8.3/interactive/plpgsql-porting.html >>> "Rube