From: James Kitambara <jameskitambara@yahoo.co.uk>
To: Kenichiro Arakaki <inek883@gmail.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Fw: Re: help
Date: Thu, 27 May 2010 13:55:21 +0000 (GMT)
Message-ID: <661576.31727.qm@web27907.mail.ukl.yahoo.com> (raw)
--- 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
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jameskitambara@yahoo.co.uk, inek883@gmail.com
Subject: Re: Fw: Re: help
In-Reply-To: <661576.31727.qm@web27907.mail.ukl.yahoo.com>
* 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