--- On Thu, 27/5/10, James Kitambara <jameskitamb...@yahoo.co.uk> wrote:
From: James Kitambara <jameskitamb...@yahoo.co.uk> Subject: Re: [SQL] help To: "Nicholas I" <nicholas.domni...@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.domni...@gmail.com> wrote: From: Nicholas I <nicholas.domni...@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