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: Allen Kirby <akirby_at_att.com>
Date: 1997/04/22
Message-ID: <335D1057.6DAE@att.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

sure - create the additional column and index it appropriately. Then create triggers to derive the column value from the other two before inserts and updates.

-- 
---
Allen Kirby			AT&T ITS Production Services
akirby_at_att.com			Alpharetta, GA.
Received on Tue Apr 22 1997 - 00:00:00 CDT

Original text of this message

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