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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Question

Re: SQL Question

From: John C. <john_at_rte-asset.com>
Date: 1997/04/22
Message-ID: <335D51B1.2FAD@rte-asset.com>#1/1

Natter wrote:
>
> Does anybody know the answer to this or can
> you tell me where I can post this message?
> Thanks
>
> Here is the create code:
>
> create table bob(
> comp# number(5),
> c_name varchar2(25),
> c_address varchar2(50),
> c_city varchar2(15),
> c_zip number(5),
> constraint comp#_pk primary key (comp#));
>
> I want to add a secondary key that automatically uses
> the first 4 letters of the c_name and all 5 numbers of
> the c_zip fields. They need to be concatenated together.
>
> ex. c_name = HEWLETT PACKARD c_zip = 95688
> The secondary key called key would be HEWL95688
> This would be done automatically by the code.
>
> Is it possible??? I think it is I just don't know how to do it.
>
> tn
> natter_at_ecst.csuchico.edu

what you need to do is to create a trigger for that table. step 1.

        add that colume to the table
step 2.

        create the trigger before insert to populate that colume

hope this helps.         

-- 
John Chan
Manager, Data Services
RTE Asset Management (aka. Rightime Econometrics, Inc.)
1095 Rydal Rd.
Rydal, PA 19046-1711
215-572-7288 (Voice)
215-572-6254 (Fax)
Internet address:   john_at_rte-asset.com
Received on Tue Apr 22 1997 - 00:00:00 CDT

Original text of this message

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