Pick first three characters of a column for Join query in Oracle

This is in Oracle.

I have to write an Inner Join query between first set of query and the second set of query.

Second set of query has a column name pri_psl_cd. To this column i need to see the prefix 3 letters matching criteria to the upper join query for the prefix 3 letters of cte.pri_psl_cd. I wonder is there any way to read first three characters of the column and matching with first 3 characters of the second query for that column.


with cte as
(
select      A.ac_sys_nr,A.ac_nr,A.ac_na,
            trunc(A.ac_opn_dt) open_date,
            B.pri_psl_cd,B.customer_seg_cd,
            B.psl_job_cgy_elg_cd 
from        A55601.tacprof A
Inner Join  a55601.tacphas B
on          A.ac_sys_nr = B.ac_sys_nr
Inner Join  a55601.tactosr C
on          A.ac_sys_nr = C.ac_sys_nr
where       A.ac_ad_cny_cd = 'CA'
and         A.dat_cx_tm_prd_nr = 0
and         trunc(A.ac_opn_dt) >= '15-FEB-2015'
and         B.customer_seg_cd <> 'EN'
and         B.cny_cd = 'CA'
and         B.dat_cx_tm_prd_nr = 0
and         B.psl_job_cgy_elg_cd = '2'
and         C.svc_pvr_pyr_nr in ('S13CAEXNP','S13CAEXNA')
)
select          cte.ac_sys_nr,cte.ac_nr,cte.ac_na,cte.open_date,cte.pri_psl_cd,
                cte.customer_seg_cd,cte.psl_job_cgy_elg_cd
from            cte



/

select * from a55601.tpcplsr 
where  dat_cx_tm_prd_nr = 0
and cny_cd = 'CA'
-- and pri_psl_cd = Pick Prefix of first 3 Letters.

Open in new window

chokkaStudentAsked:
Who is Participating?
 
sdstuberCommented:
for ORACLE

SUBSTR(cte.pri_psl_cd,1,3)
0
 
chokkaStudentAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.