troubleshooting Question

Oracle - Insert into table issue

Avatar of Wilder1626
Wilder1626Flag for Canada asked on
Oracle DatabaseSQL
4 Comments1 Solution568 ViewsLast Modified:
Hello all

I have never created an SQL to insert into table but only to query.

I would like to know how to build that SQL to insert into table based on the query folowwing that column sequence:
    D.HOL_NAME,
    A.PICK_DC AS DC,
    A.STORE_NUM,
    A.XD_THRESHOLD,
    C.LANE_NUM,
    C.PICK_DC,
    C.RECEIVE_DC,
    C.SHIP_DAY AS RELEASE_DAY,
    C.ARRIVE_DAY,
    C.RECEIVE_ARRIVE_OPEN,
    C.RECEIVE_ARRIVE_CLOSE,
    C.REC_CREATE_ID,
    TO_CHAR(C.REC_CREATE_TMS,'yyyy-mm-dd HH24:MI:SS'),
    C.REC_CHNG_ID,
    TO_CHAR(C.REC_CHNG_TMS,'yyyy-mm-dd HH24:MI:SS'),
    TO_CHAR(D.EFFECTIVE_START_TMS,'yyyy-mm-dd HH24:MI:SS'),
    TO_CHAR(D.EFFECTIVE_END_TMS,'yyyy-mm-dd HH24:MI:SS')

Thanks again for your help.

SQL to query i use:
SELECT 
    D.HOL_NAME, 
    A.PICK_DC AS DC, 
    A.STORE_NUM, 
    A.XD_THRESHOLD, 
    C.LANE_NUM, 
    C.PICK_DC, 
    C.RECEIVE_DC, 
    C.SHIP_DAY AS RELEASE_DAY, 
    C.ARRIVE_DAY, 
    C.RECEIVE_ARRIVE_OPEN, 
    C.RECEIVE_ARRIVE_CLOSE, 
    C.REC_CREATE_ID, 
    TO_CHAR(C.REC_CREATE_TMS,'yyyy-mm-dd HH24:MI:SS'), 
    C.REC_CHNG_ID, 
    TO_CHAR(C.REC_CHNG_TMS,'yyyy-mm-dd HH24:MI:SS'), 
    TO_CHAR(D.EFFECTIVE_START_TMS,'yyyy-mm-dd HH24:MI:SS'),
    TO_CHAR(D.EFFECTIVE_END_TMS,'yyyy-mm-dd HH24:MI:SS')
    
FROM 
    LCLRPT.DC_STORE_SETTINGS A, 
    LCLRPT.LCL_STORE_LANE_REF B, 
    LCLRPT.XD_LANES C, LCLRPT.
    LCL_HOLIDAY_LANES D

WHERE 
    A.DC_STORE_SETTINGS_SEQ_NUM= B.DC_STORE_SETTINGS_SEQ_NUM 
    AND B.LANE_NUM= C.LANE_NUM
    AND B.LANE_GROUP=D.SEASONAL_LANE_NUM
    AND A.DC_STORE_SETTINGS_SEQ_NUM = D.DC_STORE_SETTINGS_SEQ_NUM
    AND HOL_NAME LIKE 'CANADA%2013%'
    GROUP BY D.HOL_NAME, 
    A.PICK_DC, 
    A.STORE_NUM, 
    A.XD_THRESHOLD, 
    C.LANE_NUM, 
    B.STORE_LANE_REF_SEQ_NUM, 
    C.PICK_DC, 
    C.RECEIVE_DC, 
    C.SHIP_DAY, 
    C.ARRIVE_DAY, 
    C.RECEIVE_ARRIVE_OPEN, 
    C.RECEIVE_ARRIVE_CLOSE, 
    C.REC_CREATE_ID, 
    TO_CHAR(C.REC_CREATE_TMS,'yyyy-mm-dd HH24:MI:SS'), 
    C.REC_CHNG_ID, 
    TO_CHAR(C.REC_CHNG_TMS,'yyyy-mm-dd HH24:MI:SS'), 
    TO_CHAR(D.EFFECTIVE_START_TMS,'yyyy-mm-dd HH24:MI:SS'),
    TO_CHAR(D.EFFECTIVE_END_TMS,'yyyy-mm-dd HH24:MI:SS')
    ORDER BY D.HOL_NAME, 
    A.PICK_DC, 
    A.STORE_NUM, 
    B.STORE_LANE_REF_SEQ_NUM;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros