Fw: Re: help - Mailing list pgsql-sql

From James Kitambara
Subject Fw: Re: help
Date
Msg-id 661576.31727.qm@web27907.mail.ukl.yahoo.com
Whole thread Raw
List pgsql-sql

--- On Thu, 27/5/10, James Kitambara <jameskitambara@yahoo.co.uk> wrote:

From: James Kitambara <jameskitambara@yahoo.co.uk>
Subject: Re: [SQL] help
To: "Nicholas I" <nicholas.domnic.i@gmail.com>
Date: Thursday, 27 May, 2010, 14:50


Hello Mr. Nicholas,
 
You can try the following:
 
THIS IS WHAT I TRIED TO SOLVE YOUR PROBLEM, BUT IN ORACLE DBMS
(SORRY I DON'T HAVE POSTGRESQL INSTALL ON MY COMPUTER)
i GUESS YOU CAN TRY TO CHANGE THE SQL COMMANDS IN POSTGRESQL

create table numbers (
 id number not null primary key,
 description varchar2(100)
);

insert into numbers values (300, 'Three hundred (300)');
insert into numbers values (350, 'Three hundred fifty (350)');
insert into numbers values (6709, 'Six thousand seven hundred and nine (6709)');
 

select id, description, substr(description, instr(description, '(') +1, instr(description, ')')-(instr(description, '(') +1)) extracted_character
from numbers;
This is the Results:
ID     DESCRIPTION                              EXTRACTED_CHARACTERS
----------------------------------------------------------------------------------------------------------------
300    Three hundred                                       300
350    Tree hundred fifty                                  350
6709   Six thousand seven hundred and nine     6709
 
But if you run the following query you will get exactlly what:
select substr(description, instr(description, '(') +1, instr(description, ')')-(instr(description, '(') +1)) extracted_character
from numbers:
This is the Results:
EXTRACTED_CHARACTERS
-------------------------
  300
  350
  6709

 
James Kitambara
B.Sc. With Computer Science and Statistics (Hons),
 


--- On Wed, 5/5/10, Nicholas I <nicholas.domnic.i@gmail.com> wrote:

From: Nicholas I <nicholas.domnic.i@gmail.com>
Subject: [SQL] help
To: pgsql-sql@postgresql.org
Date: Wednesday, 5 May, 2010, 4:05

Hi,

I have a table in which the data's are entered like,

Example:

One (1)
Two (2)
Three (3)

I want to extract the data which is only within the parentheses.

that is
1
2
3


Thank You
Nicholas I



pgsql-sql by date:

Previous
From: Harrie Rodenbach
Date:
Subject: Do not understand "SETOF RECORD" - therefore can not use ODBC-link
Next
From: Tom Lane
Date:
Subject: Re: Question about slow queries...