You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

sql

No replies
Guest's picture
Guest

insert into flag_cust
(CID,
LAST_NAME,
FIRST_NAME,
M_INIT,
ADD1,
ADD2,
CITY,
STATE,
ZIP,
DOB,
SEX,
ACCT_STATUS,
HH_INCOME,
FICA_SCORE,
NEW_IND,
SURROGATE_CID)
SELECT
MK.*
,CASE WHEN MK.new_IND = 'n'
THEN DW_SEQ.NEXTVAL
Else null
END as surrogate_cid
FROM
(SELECT
c.CID,
LAST_NAME,
FIRST_NAME,
M_INIT,
ADD1,
ADD2,
CITY,
STATE,
ZIP,
DOB,
SEX,
ACCT_STATUS,
HH_INCOME,
FICA_SCORE,
case when C.cid is null
THEN 'y' else 'n'
end as new_IND
from customer c
left join dw_cust_xrff r
on c.cid=R.cid
) mk

well hi i dont know if i should ask this but i am new to sql or etl
any help would be great

i am trying to insert data in to my flag_cust but i don't want to generate new sequence for my existing data....