Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Concatenating and copying columns data

Re: Concatenating and copying columns data

From: <sybrandb_at_hccnet.nl>
Date: Mon, 09 Apr 2007 16:22:28 +0200
Message-ID: <1sik13515ei077m8sut9105ts0ucjv0k1s@4ax.com>


On 9 Apr 2007 05:49:59 -0700, "Usman" <khanusman_at_gmail.com> wrote:

>Hi,
>
>I am a newbee to Oracle SQL programming. I have a problem where I have
>three columns, A - varchar, B-varchar and C-numeric
>
>Column A can contain alphanumeric character.
>Column B will always contain numeric characters.
>
>I need to write a trigger that will on every row inserted,
>
>1. Check if column A exists then,
>2. If 1 is true, convert each alphabet in column A to its equivalent
>ASCII and leave the numeric characters as it is. Therefore, for
>example if I have 'A567', I should have 67567 as an end result,
>assuming ascii code of 'A' is 67.
>3. Concatenate converted string in 2 above with data inserted in
>column B.
>4. Convert to number/long in 3 above and store the data in column C.
>
>Example:
>
>column A = 'A567'
>column B= '1234'
>column C = 675671234
>
>Can anyone please help me implementing this logic?
>
>Any help in this regard will be appreciated.
>
>Thanks in anticipation,
>Usman

You have the algorithm, you have access to the manuals, you only need to look up how to convert an ascii character to it's numeric representation, and how to convert it to a string and to concatenate it to another string, so why don't do it yourself. Especially since I already gave away 80 percent of the solution.

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Mon Apr 09 2007 - 09:22:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US