添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Getting Missing IN or OUT parameter at index :: 1 Vendor code 17041 error

Vemula Muni Aug 7 2019 — edited Aug 9 2019

SQL Developer Version : 1.5.5

DBA Version : Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

Query :  When i am executing below query i am getting Missing IN or OUT parameter at index :: 1 Vendor code 17041 error  .  Please Help on this.

WITH    parameters    AS

(

SELECT  TO_DATE ('01-JUN-2019', 'DD-MON-YYYY') AS pstartdt  -- Always use 4 digits for years

,       TO_DATE ('30-JUN-2019', 'DD-MON-YYYY') AS penddt

,       'CWR'                                  AS per_org

FROM    dual

)

,    got_business_unit   AS

(

SELECT  p.pstartdt, p.penddt

,       d1.emplid, d1.per_org, d1.effdt

,       CASE

WHEN  b.business_unit  IS NULL

THEN  'I'

ELSE  d1.hr_status

END         AS hr_status

,       b.business_unit

FROM    parameters       p

JOIN    ps_cts_job_dtl1  d1   ON  d1.per_org      = p.per_org

AND d1.effdt       <= p.penddt

OUTER APPLY (

SELECT  MAX (b.business_unit)  AS business_unit

FROM    ps_cts_job_dtl  d

JOIN    ps_cts_iqn_bu   b   ON  b.business_unit = d.business_unit

WHERE   d.emplid        = d1.emplid

AND     d.effdt         = d1.effdt

)            b

WHERE   d1.hr_status  IN ('A', 'I')  -- if necessary

)

SELECT    emplid

,         GREATEST (sdt, pstartdt)  AS startdt

,         LEAST  ( NVL (edt - 1, penddt)

, penddt

)                 AS enddt

,         per_org

,         'A'                      AS hr_status

,         'Employee is active as CWR and BU is in IQN_BU setup table'

AS reason

FROM      got_business_unit

MATCH_RECOGNIZE

(

PARTITION BY  emplid, pstartdt, penddt, per_org

ORDER BY      effdt

MEASURES      MIN (effdt)    AS sdt

,             i.effdt        AS edt

ONE ROW PER MATCH

PATTERN       (a+ i?)

DEFINE        a  AS   hr_status  = 'A'

,             i  AS   hr_status  = 'I'

)

WHERE     NVL (edt - 1, penddt)  > pstartdt

ORDER BY  emplid

,         sdt

;

Create Table and Insert scripts to execute above query.

  1. CREATE TABLE PS_CTS_JOB_DTL (EMPLID VARCHAR2(11) NOT NULL,
  2.    BUSINESS_UNIT VARCHAR2(5) NOT NULL,
  3.    EMPL_RCD INT NOT NULL,
  4.    EFFDT DATE,
  5.    EFFSEQ INT NOT NULL,
  6.    ACTION VARCHAR2(3) NOT NULL) ;
  7. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US410',0,to_date('27-MAY-2019','DD-MON-YYYY'),0,'ADD');
  8. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US410',0,to_date('02-JUN-2019','DD-MON-YYYY'),0,'DTA');
  9. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US410',0,to_date('04-JUN-2019','DD-MON-YYYY'),0,'TER');
  10. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US410',1,to_date('06-JUN-2019','DD-MON-YYYY'),0,'HIR');
  11. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US410',1,to_date('15-JUN-2019','DD-MON-YYYY'),0,'TER');
  12. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US410',2,to_date('15-JUN-2019','DD-MON-YYYY'),1,'ADD');
  13. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','US608',2,to_date('19-JUN-2019','DD-MON-YYYY'),0,'ASC');
  14. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733930','CN512',2,to_date('26-JUN-2019','DD-MON-YYYY'),0,'ASG');
  15. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','US410',0,to_date('26-APR-2019','DD-MON-YYYY'),0,'HIR');
  16. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','US410',0,to_date('05-JUN-2019','DD-MON-YYYY'),0,'TER');
  17. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN208',1,to_date('06-JUN-2019','DD-MON-YYYY'),1,'ADD');
  18. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN208',1,to_date('10-JUN-2019','DD-MON-YYYY'),0,'TER');
  19. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN208',2,to_date('12-JUN-2019','DD-MON-YYYY'),0,'HIR');
  20. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN408',2,to_date('18-JUN-2019','DD-MON-YYYY'),0,'ASC');
  21. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN408',2,to_date('19-JUN-2019','DD-MON-YYYY'),0,'TER');
  22. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN208',3,to_date('26-JUN-2019','DD-MON-YYYY'),0,'ADD');
  23. Insert into PS_CTS_JOB_DTL (EMPLID,BUSINESS_UNIT,EMPL_RCD,EFFDT,EFFSEQ,ACTION) values ('733931','IN208',3,to_date('28-JUN-2019','DD-MON-YYYY'),0,'DTA');

PS_CTS_JOB_DTL1 Table Build and Insert Scripts:

  1. CREATE TABLE PS_CTS_JOB_DTL1 (EMPLID VARCHAR2(11) NOT NULL,
  2.    EMPL_RCD INT NOT NULL,
  3.    EFFDT DATE,
  4.    EFFSEQ INT NOT NULL,
  5.    HR_STATUS VARCHAR2(1) NOT NULL,
  6.    PER_ORG VARCHAR2(3) NOT NULL) ;
  7. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',0,to_date('27-MAY-2019','DD-MON-YYYY'),0,'A','CWR');
  8. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',0,to_date('02-JUN-2019','DD-MON-YYYY'),0,'A','CWR');
  9. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',0,to_date('04-JUN-2019','DD-MON-YYYY'),0,'I','CWR');
  10. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',1,to_date('06-JUN-2019','DD-MON-YYYY'),0,'A','EMP');
  11. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',1,to_date('15-JUN-2019','DD-MON-YYYY'),0,'I','EMP');
  12. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',2,to_date('15-JUN-2019','DD-MON-YYYY'),1,'A','CWR');
  13. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',2,to_date('19-JUN-2019','DD-MON-YYYY'),0,'A','CWR');
  14. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733930',2,to_Date('26-JUN-2019','DD-MON-YYYY'),0,'A','CWR');
  15. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',0,to_date('26-APR-2019','DD-MON-YYYY'),0,'A','EMP');
  16. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',0,to_date('05-JUN-2019','DD-MON-YYYY'),0,'I','EMP');
  17. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',1,to_date('06-JUN-2019','DD-MON-YYYY'),0,'A','CWR');
  18. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',1,to_date('10-JUN-2019','DD-MON-YYYY'),0,'I','CWR');
  19. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',2,to_date('12-JUN-2019','DD-MON-YYYY'),0,'A','EMP');
  20. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',2,to_date('18-JUN-2019','DD-MON-YYYY'),0,'A','EMP');
  21. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',2,to_date('19-JUN-2019','DD-MON-YYYY'),0,'I','EMP');
  22. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',3,to_date('26-JUN-2019','DD-MON-YYYY'),0,'A','CWR');
  23. Insert into PS_CTS_JOB_DTL1 (EMPLID,EMPL_RCD,EFFDT,EFFSEQ,HR_STATUS,PER_ORG) values ('733931',3,to_date('28-JUN-2019','DD-MON-YYYY'),0,'A','CWR');

PS_CTS_IQN_BU Table Build and Insert Scripts: ( IQN business unit setup )

  1. CREATE TABLE PS_CTS_IQN_BU (COUNTRY VARCHAR2(3) NOT NULL,
  2.    BUSINESS_UNIT VARCHAR2(5) NOT NULL) ;
  3. Insert into PS_CTS_IQN_BU (COUNTRY,BUSINESS_UNIT) values ('USA','US410');
  4. Insert into PS_CTS_IQN_BU (COUNTRY,BUSINESS_UNIT) values ('USA','US412');
  5. Insert into PS_CTS_IQN_BU (COUNTRY,BUSINESS_UNIT) values ('CAN','CN512');
  6. Insert into PS_CTS_IQN_BU (COUNTRY,BUSINESS_UNIT) values ('IND','IN208');