Using Select in Insert sql statement
You can use a select statement, filter the data using where clauses and insert into another table. Below is an example of using Select in Insert sql statement
INSERT
INTO PSUSERPRSNLOPTN
(
OPRID,
OPTN_CATEGORY_LVL,
USEROPTN,
USER_OPTION_CNTL,
USER_OPTION_VALUE
)
SELECT c.email_addr,
'PPTL',
'DFRMT',
'y',
'D'
FROM ps_email_addresses c
WHERE c.e_addr_type = 'LDAP'
INSERT
INTO PSUSERPRSNLOPTN
(
OPRID,
OPTN_CATEGORY_LVL,
USEROPTN,
USER_OPTION_CNTL,
USER_OPTION_VALUE
)
SELECT c.email_addr,
'PPTL',
'DFRMT',
'y',
'D'
FROM ps_email_addresses c
WHERE c.e_addr_type = 'LDAP'
Comments