-- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TAXABLE_AMT ( p_tran_id IN VARCHAR2, p_line_no IN NUMBER ) RETURN NUMBER IS v_taxable_amt NUMBER; BEGIN SELECT taxtran.taxable_amt INTO v_taxable_amt FROM taxtran INNER JOIN tax ON TAXTRAN.TAX_CODE = TAX.TAX_CODE LEFT JOIN sreturndet ON taxtran.TRAN_ID = sreturndet.TRAN_ID AND taxtran.LINE_NO = FN_RCON_LINENO_NUM(sreturndet.line_no) AND NVL(sreturndet.ret_rep_flag, 'P') = 'R' WHERE taxtran.TRAN_ID = p_tran_id AND trim(taxtran.LINE_NO) = trim(p_line_no) AND TAXTRAN.TRAN_CODE = 'S-RET' AND tax.print_tax = 'Y' AND taxtran.tax_amt <> 0; RETURN v_taxable_amt; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TAXTRAN_SUM ( p_site_code IN VARCHAR2, p_tran_date_start IN DATE, p_tran_date_end IN DATE, p_item_ser_start IN VARCHAR2, p_item_ser_end IN VARCHAR2, p_cust_code_start IN VARCHAR2, p_cust_code_end IN VARCHAR2, p_confirmed IN VARCHAR2 ) RETURN NUMBER IS v_sum_tax_amt NUMBER; BEGIN SELECT SUM(taxtran.tax_amt) INTO v_sum_tax_amt FROM taxtran JOIN tax ON taxtran.tax_code = tax.tax_code JOIN sreturn ON taxtran.tran_id = sreturn.tran_id JOIN sreturndet ON sreturn.tran_id = sreturndet.tran_id AND taxtran.line_no = fn_rcon_lineno_num(sreturndet.line_no) WHERE taxtran.tran_code = 'S-RET' AND NVL(sreturndet.ret_rep_flag, 'P') = 'R' AND sreturn.confirmed = p_confirmed AND sreturn.site_code IN ( SELECT COLUMN_VALUE FROM TABLE(fn_get_site_input(p_site_code)) ) AND sreturn.tran_date BETWEEN p_tran_date_start AND p_tran_date_end AND sreturn.item_ser BETWEEN p_item_ser_start AND p_item_ser_end AND sreturn.cust_code BETWEEN p_cust_code_start AND p_cust_code_end AND tax.print_tax = 'Y' AND taxtran.tax_amt <> 0; RETURN v_sum_tax_amt; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 0; WHEN OTHERS THEN RAISE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_ROUT_PLAN (as_sales_pers varchar2,as_locality varchar2,as_option varchar2) RETURN varchar2 IS route varchar2(60); plan number(5,0); BEGIN IF as_option='C' THEN select route_id into route from sprs_route where sprs_code=as_sales_pers and locality_code=as_locality ; RETURN NVL(route,'Not Defined'); ELSIF as_option='D' THEN select descr into route from sprs_route where sprs_code=as_sales_pers and locality_code=as_locality ; RETURN NVL(route,'Not Defined'); END IF ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'Route Not Defined'; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UC_PHASEPROJ ON PROJ_PHASE (PHASE_CODE, PROJ_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SITE_ADDRESS (msite_Code char) return varchar is ls_address varchar(500); begin select nvl(site.add1,' ')||',' ||nvl(site.add2,' ')||', '|| nvl(site.city,' ')||', '|| chr(10) || 'DIST : '|| site.city ||', '|| 'STATE : ' || state.descr ||', '|| 'PIN CODE : ' || site.pin ||', '|| chr(10) || 'Telephone No.: ' || nvl(site.tele1, ' ')||', '|| 'Fax : ' || nvl(site.fax, ' ') || ', '|| 'Email : ' || nvl(site.email_addr, ' ') into ls_address from site, state, finent where site.state_code = state.state_code and site.fin_entity = finent.fin_entity and site.site_code = msite_code; return ls_address; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CPP_HR (AS_EMP_CODE CHAR) return char is as_emp_code__hr char(10); emp_work_site CHAR(5); emp_dept_code CHAR(5); as_fin_entity char(10); as_item_ser char(5); begin select work_site, dept_code into emp_work_site, emp_dept_code from employee where emp_code = AS_EMP_CODE; select fin_entity into as_fin_entity from site where site_code =emp_work_site; select item_ser into as_item_ser from sales_pers where sales_pers = AS_EMP_CODE; select emp_code__hr into as_emp_code__hr from adm_env where fin_entity = as_fin_entity and site_code = emp_work_site and app_type='CPP' and dept_code = emp_dept_code and sysdate between valid_from and valid_to; return as_emp_code__hr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE TBL_EMP_WISE_HIERARCHY_NEW AS TABLE OF OBJ_EMP_WISE_HIERARCHY_NEW ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WORKDAYS (AS_EMP_CODE CHAR , AS_PRD_CODE CHAR) RETURN NUMBER IS AL_DAYS number(14,3); A number(14,3); B number(14,3); D Date; E number(14,3) := 0; H employee.hol_tblno%type; begin select fr_date,(to_date-fr_date+1) into D,A from period where code = AS_PRD_CODE; for i in 1..A loop select ddf_get_holtblno(AS_EMP_CODE,(D+i-1)) into H from dual; select nvl(count(hol_date),0) into B from holiday where hol_tblno = H and hol_type = 'W' and hol_date = (D+i-1); E := E + B; end loop; AL_DAYS := A - E; return AL_DAYS; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_AVAIL_DAYS1 ( AS_EMP in char,AS_MON_FR in char,AS_MON_TO in char,AS_YEAR in char) return number is lc_avail_days number(14,3) ; tot_days number(14,3); hol_days number(14,3); begin select LAST_DAY(to_date(AS_MON_TO||AS_YEAR,'MMYYYY'))-(to_date(AS_MON_FR||AS_YEAR,'MMYYYY'))+1 into tot_days FROM DUAL; SELECT COUNT(*) into hol_days FROM HOLIDAY,EMPLOYEE WHERE HOLIDAY.HOL_TBLNO=EMPLOYEE.hol_tblno AND HOL_TYPE IN ('W','H') AND HOL_DATE BETWEEN (to_date(AS_MON_FR||AS_YEAR,'MMYYYY')) AND LAST_DAY(to_date(AS_MON_TO||AS_YEAR,'MMYYYY')) AND EMPLOYEE.EMP_CODE=AS_EMP ; lc_avail_days :=tot_days-hol_days ; -- tot_amt - adj_amt return lc_avail_days ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PRD_DESCR (as_prd_code char) return varchar2 is ls_prd_descr varchar2(40); begin begin select descr into ls_prd_descr from period where code = (select min(code) from period where code > as_prd_code); exception when no_data_found then ls_prd_descr := null; end; return ls_prd_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_JV_IBCA (as_tran_id char, an_line_no number, as_acct_code char) RETURN NUMBER IS LL_CNT NUMBER(4); ll_line number(3); ls_acct_code char(10); as_rev_opt char(1); as_site_from char(5); as_site_to char(5); ls_acct_code1 char(10); begin select reversible, site_code, site_code__rev into as_rev_opt, as_site_from, as_site_to from journal where tran_id = as_tran_id; if as_rev_opt = 'N' or as_rev_opt is null or as_site_to is null or rtrim(as_site_from) = rtrim(as_site_to) then LL_CNT := 1; return ll_cnt; end if; select min(line_no) into ll_line from jourdet where tran_id = as_tran_id; if ll_line is null or ll_line=an_line_no then ls_acct_code1:=as_acct_code; else select acct_code into ls_acct_code1 from jourdet where tran_id=as_tran_id and line_no=ll_line; end if; select acct_code__pay into ls_acct_code from ibca_pay_ctrl where site_code__from = as_site_from and site_code__to = as_site_to; if rtrim(ls_acct_code) <> rtrim(ls_acct_code1) then ll_cnt := 0; return ll_cnt; end if; ll_cnt:=1; RETURN LL_CNT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INVNETAMT (as_invoiceid in invoice.invoice_id%type) return number is lc_newnetamt number(14,3) := 0; lc_newgrossamt number(14,3) := 0; begin begin select sum(quantity * ddf_pick_rate_mslkt('','',invoice_trace.item_code,invoice_trace.lot_no,'B')) into lc_newgrossamt from invoice_trace where invoice_id = as_invoiceid; exception when others then lc_newgrossamt := 0; end; if lc_newgrossamt > 0 then lc_newnetamt := lc_newgrossamt + (lc_newgrossamt * 8 / 100); end if; return lc_newnetamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX OLE_FORMATS_X ON OLE_FORMATS (FORMAT_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAGE_AMT (as_tranid in char, as_workorder in char ) return number is lc_wage number(14,3) := 0; lc_quantity number(14,3) := 0; begin begin select QTY_REPORTED into lc_quantity from workorder_feedback where tran_id = as_tranid; exception when others then lc_quantity := 0 ; end; lc_wage := lc_quantity * 125 ; return lc_wage; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_POS_DESCR4 ( AS_EMP_CODE EMPLOYEE.EMP_CODE%TYPE, AS_DEPT_CODE EMPLOYEE.DEPT_CODE%TYPE, AS_POS_CODE EMPLOYEE.POS_CODE%TYPE, AS_GRADE_CODE EMPLOYEE.GRADE%TYPE) RETURN VARCHAR2 IS A_POS_DESCR ORG_STRUCTURE.DESCR%TYPE; A_VERSION_ID ORG_STRUCTURE.VERSION_ID%TYPE; A_TABLE_NO ORG_STRUCTURE.TABLE_NO%TYPE; A_DEPT_CODE DEPARTMENT.DEPT_CODE%TYPE; A_LEVEL_NO ORG_STRUCTURE.LEVEL_NO%TYPE; BEGIN IF (AS_POS_CODE IS NULL OR AS_EMP_CODE IS NULL) THEN RETURN A_POS_DESCR; END IF; A_DEPT_CODE := AS_DEPT_CODE; IF (A_DEPT_CODE IS NULL) THEN SELECT DEPT_CODE INTO A_DEPT_CODE FROM EMPLOYEE WHERE EMP_CODE = AS_EMP_CODE; END IF; IF (A_DEPT_CODE IS NULL) THEN RETURN A_POS_DESCR; END IF; SELECT VERSION_ID INTO A_VERSION_ID FROM VERSION WHERE TRUNC(SYSDATE) BETWEEN EFF_FROM AND VALID_UPTO; SELECT ITEM_SER INTO A_TABLE_NO FROM DEPARTMENT WHERE DEPT_CODE = A_DEPT_CODE; IF AS_GRADE_CODE IS NULL OR LENGTH(TRIM(AS_GRADE_CODE)) = 0 THEN SELECT B.LEVEL_NO INTO A_LEVEL_NO FROM EMPLOYEE A,GRADE B WHERE B.GRADE_CODE = A.GRADE AND A.EMP_CODE = AS_EMP_CODE; ELSE SELECT B.LEVEL_NO INTO A_LEVEL_NO FROM GRADE B WHERE B.GRADE_CODE = AS_GRADE_CODE; END IF; IF (A_TABLE_NO IN ('ET','OL','OT','IS','OC','OD','OE','AR','ST')) THEN A_LEVEL_NO := A_LEVEL_NO + 1; END IF; SELECT DESCR INTO A_POS_DESCR FROM ORG_STRUCTURE WHERE VERSION_ID = A_VERSION_ID AND TABLE_NO = A_TABLE_NO AND POS_CODE = AS_POS_CODE AND LEVEL_NO = A_LEVEL_NO; RETURN A_POS_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PIPE_QTY ( as_sitecode in site.site_code%type, as_itemcode in item.item_code%type, adt_asondate in date) return number is lc_pipeqty number(14,3); lc_rcpqty number(14,3); lc_qcqty number(14,3); begin select sum(nvl(a.quantity__stduom,0)) into lc_rcpqty from porcpdet a, porcp b where a.tran_id = b.tran_id and b.site_code = as_sitecode and a.item_code = as_itemcode and nvl(b.confirmed,'N') = 'N' ; if lc_rcpqty is null then lc_rcpqty := 0 ; end if; select sum(nvl(quantity,0)) into lc_qcqty from qc_order where site_code = as_sitecode and item_code = as_itemcode and nvl(status,'U') = 'U' ; if lc_qcqty is null then lc_qcqty := 0 ; end if; lc_pipeqty := lc_rcpqty + lc_qcqty ; return lc_pipeqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_INV_CUSTITM_DSC (ls_inv_id CHAR,ls_ITEM_CODE CHAR,ls_cust_item__ref char) return varchar is ls_cust_code char(10); ls_itmdescr customeritem.descr%type; begin select cust_code into ls_cust_code from invoice where invoice_id = ls_inv_id ; select descr into ls_itmdescr from customeritem where cust_code =ls_cust_code and item_code =ls_item_code and item_code__ref = ls_cust_item__ref ; RETURN ls_itmdescr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX GENERALISE_COPY_X ON GENERALISE_COPY (WIN_NAME, HEAD_DET, FIELD_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DIST_DEMAND_SITE_ITEM_STATUS ON DIST_DEMAND (SITE_CODE, ITEM_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PENDORD (AS_SITE_CODE SORDITEM.SITE_CODE%TYPE, AS_ITEM_CODE SORDITEM.ITEM_CODE%TYPE) RETURN NUMBER IS PENDING_QTY NUMBER(14,3); BEGIN SELECT SUM ( SORDITEM.QUANTITY - SORDITEM.QTY_DESP ) INTO PENDING_QTY FROM SORDER, SORDITEM WHERE ( SORDER.SALE_ORDER = SORDITEM.SALE_ORDER ) AND ( SORDER.CONFIRMED = 'Y' ) AND ( SORDITEM.STATUS = 'P' ) AND ( SORDITEM.SITE_CODE = AS_SITE_CODE) AND ( SORDITEM.ITEM_CODE = AS_ITEM_CODE ); IF PENDING_QTY IS NULL THEN PENDING_QTY := 0 ; END IF; RETURN PENDING_QTY; EXCEPTION WHEN OTHERS THEN RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01031: insufficient privileges -- CREATE OR REPLACE TRIGGER DT_SCTYPE_ADD BEFORE INSERT ON SCONTR_TYPE referencing old as old new as new FOR EACH ROW declare ldt_excutdate date; BEGIN raise_application_error( -20601, 'Item Series addition not allowed and it depends on other configuration'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PRIMARY_SALES_VAL (ls_site_code in char, ls_prd_code in char, ls_item_code in char, ls_item_ser in char, ls_cust_code in char) return number is lc_net_sales_val number(14,3); begin select nvl(sales_val,0) - nvl(return_val,0) + nvl(repl_val,0) net_sales_val into lc_net_sales_val from sm_sales_cust where site_code = ls_site_code and prd_code = ls_prd_code and item_code = ls_item_code and item_ser = ls_item_ser and cust_code = ls_cust_code ; return(lc_net_sales_val); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE LOCALITYCODERETAILPOPHELP AS FUNCTION getlocalityRetailPophelpData (empCode in char) RETURN localityCodeRetailMasterTABLE PIPELINED; END localityCodeRetailPophelp; CREATE OR REPLACE PACKAGE BODY LOCALITYCODERETAILPOPHELP AS FUNCTION getlocalityRetailPophelpData (empCode in char) RETURN localityCodeRetailMasterTABLE PIPELINED IS ls_cnt number(35); ls_trans_db varchar2(30); BEGIN select trans_db into ls_trans_db from users where emp_code=empCode; if (ls_trans_db = 'CHCSFA') THEN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; ELSE SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; END IF; if(ls_cnt > 0) then if (ls_trans_db = 'CHCSFA') THEN for x in( SELECT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM , (CASE WHEN GET_SER_CLASS_COUNT(Sp.Sales_Pers)=1 THEN SP.ITEM_SER ELSE ' ' END) AS ITEM_SER,SR.ROUTE_ID AS ROUTE_ID ,SR.STATION_TYPE AS STATION_TYPE,S.DESCR AS STATION_DESCR,SR.ROUTE_TYPE FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR, EMPLOYEE EMP,SALES_PERS SP,STATION S WHERE SR.SPRS_CODE IN ( SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SR.STATUS ='Y' AND S.STAN_CODE=SR.STAN_CODE AND EMP.EMP_CODE = SR.SPRS_CODE and emp.emp_code = Sp.Sales_Pers and sr.sprs_code=sp.sales_pers AND EMP.RELIEVE_DATE IS NULL ) LOOP PIPE ROW (localityCodeRetailMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ITEM_SER,x.ROUTE_ID,x.STATION_TYPE,x.STATION_DESCR,x.ROUTE_TYPE)); END LOOP; RETURN; ELSE for x in( SELECT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM , (CASE WHEN GET_SER_CLASS_COUNT(Sp.Sales_Pers)=1 THEN SP.ITEM_SER ELSE ' ' END) AS ITEM_SER,SR.ROUTE_ID AS ROUTE_ID ,SR.STATION_TYPE AS STATION_TYPE,S.DESCR AS STATION_DESCR,SR.ROUTE_TYPE FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR, EMPLOYEE EMP,SALES_PERS SP,STATION S WHERE SR.SPRS_CODE IN ( SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SR.STATUS ='Y' AND S.STAN_CODE=SR.STAN_CODE AND EMP.EMP_CODE = SR.SPRS_CODE and emp.emp_code = Sp.Sales_Pers and sr.sprs_code=sp.sales_pers AND EMP.RELIEVE_DATE IS NULL ) LOOP PIPE ROW (localityCodeRetailMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ITEM_SER,x.ROUTE_ID,x.STATION_TYPE,x.STATION_DESCR,x.ROUTE_TYPE)); END LOOP; RETURN; END IF; end if; if(ls_cnt <= 0) then if (ls_trans_db = 'CHCSFA') THEN for x in( SELECT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM , (CASE WHEN GET_SER_CLASS_COUNT(Sp.Sales_Pers)=1 THEN SP.ITEM_SER ELSE ' ' END) AS ITEM_SER,SR.ROUTE_ID AS ROUTE_ID ,SR.STATION_TYPE AS STATION_TYPE,S.DESCR AS STATION_DESCR,SR.ROUTE_TYPE FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR, EMPLOYEE EMP,SALES_PERS SP,STATION S WHERE SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND SR.STATUS ='Y' AND S.STAN_CODE=SR.STAN_CODE AND EMP.EMP_CODE = SR.SPRS_CODE and emp.emp_code = Sp.Sales_Pers and sr.sprs_code=sp.sales_pers ) LOOP PIPE ROW (localityCodeRetailMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ITEM_SER,x.ROUTE_ID,x.STATION_TYPE,x.STATION_DESCR,x.ROUTE_TYPE)); END LOOP; RETURN; ELSE for x in( SELECT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM , (CASE WHEN GET_SER_CLASS_COUNT(Sp.Sales_Pers)=1 THEN SP.ITEM_SER ELSE ' ' END) AS ITEM_SER,SR.ROUTE_ID AS ROUTE_ID ,SR.STATION_TYPE AS STATION_TYPE,S.DESCR AS STATION_DESCR,SR.ROUTE_TYPE FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR, EMPLOYEE EMP,SALES_PERS SP,STATION S WHERE SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND SR.STATUS ='Y' AND S.STAN_CODE=SR.STAN_CODE AND EMP.EMP_CODE = SR.SPRS_CODE and emp.emp_code = Sp.Sales_Pers and sr.sprs_code=sp.sales_pers) LOOP PIPE ROW (localityCodeRetailMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ITEM_SER,x.ROUTE_ID,x.STATION_TYPE,x.STATION_DESCR,x.ROUTE_TYPE)); END LOOP; RETURN; END IF; end if; END; END localityCodeRetailPophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LAB_BOOKING_AMD_X ON LAB_BOOKING_AMD (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHEMMET_COUNT (ls_emp IN VARCHAR2,ls_month IN char, ls_year IN char ) return number is chem_met_count number(3); BEGIN begin SELECT NVL(COUNT(distinct STRG_code),0) into chem_met_count from strg_meet Inner Join Fieldactivity On Fieldactivity.Activity_Code = strg_meet.Event_Type and Fieldactivity.Activity_Type = 'FW' where strg_meet.strg_type = 'C' and (sales_pers) = ls_emp and to_char(event_date,'mm') = ls_month and to_char(event_date,'YYYY') = ls_year; exception when no_data_found then chem_met_count:=0; end; RETURN chem_met_count ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_KRA ON KRA (KRA) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRIGG_PAYVOUDT before insert or update on misc_paydet for each row declare ls_vouch_dt Date; begin ls_vouch_dt := :new.vouch_date; if ls_vouch_dt <= '01-Jan-1900' then raise_application_error (-20000 , 'voucher date mismatch'); end if; if :new.NET_PAY_AMT is null then :new.NET_PAY_AMT := :new.pay_amt; end if; if :new.TAX_AMT is null then :new.TAX_AMT := 0; end if; if :new.DISCOUNT is null then :new.DISCOUNT := 0; end if; if :new.DISCOUNT_AMT is null then :new.DISCOUNT_AMT := 0; end if; if :new.exch_rate is null then :new.exch_rate := :new.EXCH_RATE__VOUCH; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_NO_PERS_TEST (llevel_code in char) return number is ll_tot number(14); ll_sel number(14); --declare cursor c1 is select level_code from hierarchy where level_code__parent = llevel_code and level_no <= 4 and sysdate between eff_from and valid_upto; begin select count(*) into ll_sel from hierarchy_det a, hierarchy b where a.level_code = b.level_code and a.level_code__parent = b.level_code__parent and a.table_no = b.table_no and b.level_no = 4 and b.level_code = llevel_code and sysdate between b.eff_from and b.valid_upto; ll_tot := ll_sel; for ls_parent in c1 loop begin select ddf_no_pers_test(ls_parent.level_code) into ll_sel from dual; ll_tot := ll_tot + ll_sel; end; end loop; return ll_tot; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER PRETURN_CHKSRETURN BEFORE UPDATE OF CONFIRMED ON PORCP REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE ll_errcode number; ls_errmsg VARCHAR2(255); chk_partner CHAR (1); ls_cnt NUMBER :=0; ls_dis_link CHAR (1); BEGIN if :old.confirmed='N' and :new.confirmed='Y' and trim(:new.TRAN_SER) = 'P-RET' and :new.channel_partner = 'Y' THEN begin select dis_link into ls_dis_link from site_supplier where supp_code = :new.supp_code and site_code = :new.site_code and channel_partner = 'Y'; exception when others then ls_dis_link := ''; end; if ls_dis_link <> 'E' then begin select count(1) into ls_cnt from sreturn where trim(cust_ref)=trim(:new.tran_id); exception when others then ls_cnt :=0; end; if ls_cnt = 0 then raise_application_error( -20601, 'Transation Cannot be Confirmed,sales return not generated...' ); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SOLVANT_STAGEWISE ( as_tranid expr_hdr.expr_no%type, as_qtytyp char, as_opr_from expr_bill.operation%type,as_opr_to expr_bill.operation%type) return number is ll_solvant number; ls_itemcd expr_bill.item_code%type; ls_grpcd item.grp_code%type; ls_varval mfgparm.var_value%type; begin select var_value into ls_varval from mfgparm where prd_code = '999999' and var_name = 'SOLVENT_GRP' ; if as_qtytyp = 'Q' then select nvl(sum(a.qty_per_unit),0) into ll_solvant from expr_bill a,item b where a.item_code = b.item_code and a.expr_no = as_tranid and a.operation >= as_opr_from and a.operation <= as_opr_to and instr( ls_varval,b.grp_code) > 0 ; else select nvl(sum( A.quantity__alt + (A.quantity__alt * A.over_perc /100) + A.potency_adj ),0) into ll_solvant from expr_bill a,item b where a.item_code = b.item_code and a.expr_no = as_tranid and a.operation >= as_opr_from and a.operation <= as_opr_to and instr( ls_varval,b.grp_code) > 0 ; end if; return ll_solvant; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_SUMM_NEW_HSN (ls_tran_code in char, ls_tran_id in char, ls_disparm_code in char, ls_disparm_code_1 in char, ls_disparm_code_2 in char, ls_type in char, ls_tax_chap in char) return number is lc_tax_amt number(14,3); LS_VAR_VALUE VARCHAR(2000); LS_VAR_VALUE1 VARCHAR(2000); LS_VAR_VALUE2 VARCHAR(2000); lc_exch_rate number(17,6); begin begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = LS_DISPARM_CODE; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND SUBSTR(TAXTRAN.TAX_CHAP,INSTR(TAXTRAN.TAX_CHAP,'-')+1,2)=LS_TAX_CHAP AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); --end if; -- taxable amt ELSIF ls_type = 'B' then select nvl(sum(nvl(Taxable_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code AND TRAN_ID = LS_TRAN_ID AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); --end if; -- tax % ELSIF ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND SUBSTR(TAXTRAN.TAX_CHAP,INSTR(TAXTRAN.TAX_CHAP,'-')+1,2)=LS_TAX_CHAP AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) AND TAX_AMT <>0 ; --end if; -- taxable amt ELSIF ls_type = 'A' then select (rtrim(var_value)) INTO LS_VAR_VALUE1 from disparm WHERE PRD_CODE = '999999' AND VAR_NAME = ls_disparm_code_1; SELECT (RTRIM(VAR_VALUE)) INTO LS_VAR_VALUE2 from disparm WHERE PRD_CODE = '999999' AND VAR_NAME = LS_DISPARM_CODE_2; select coalesce(SUM(taxable_amt), 0) into lc_tax_amt from taxtran,tax WHERE tax.tax_code = taxtran.tax_code and tran_code = ls_tran_code and tran_id = ls_tran_id and SUBSTR(TAXTRAN.TAX_CHAP,INSTR(TAXTRAN.TAX_CHAP,'-')+1,2)=ls_tax_chap And tax_perc <> 0 AND (TAX.TAX_TYPE) IN ('H','I','J') AND ( TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE1)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE2)) ) ); end if; exception when no_data_found then lc_tax_amt := 0 ; end ; RETURN LC_TAX_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CALC_QTY (lref_ser in char,lref_id in char,llineno in char) return varchar2 is ls_retval varchar2(1000); ls_param varchar2(100); ls_value varchar2(100); ls_strval varchar2(200); cursor cur_cal_qty is SELECT PARAMETER, VALUE FROM CAL_QTY WHERE REF_SER = lref_ser AND REF_ID = lref_id AND trim(LINE_NO) = trim(llineno); begin ls_retval := ''; open cur_cal_qty; LOOP fetch cur_cal_qty into ls_param,ls_value; EXIT when cur_cal_qty%notfound; ls_strval := ls_param || '=' || ls_value; ls_retval := ls_retval || ls_strval || ','; END LOOP; close cur_cal_qty; return (ls_retval); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIVABLES_SITE_ITEM_SER ON RECEIVABLES (SITE_CODE, TRAN_DATE, ITEM_SER, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ASSET_REGISTER_SITE_URDATE ON ASSET_REGISTER (SITE_CODE, GRP_CODE, ASSET_CODE, USE_DATE, REM_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PAYMENT_INFO ( as_tran_id in char) return varchar2 is ls_return_str varchar2(300); ls_bank_code char(10); ls_bank_name varchar2(50); ls_net_amt number; ls_ref_no varchar2(40); ls_ref_date date; begin select b.bank_name,m.bank_code,m.net_amt,m.ref_no,m.ref_date into ls_bank_name,ls_bank_code, ls_net_amt, ls_ref_no, ls_ref_date from misc_payment m , bank b where m.bank_code = b.bank_code and m.tran_id = as_tran_id; ls_return_str := 'Payment done to bank : ' || ls_bank_name || ' for amount of Rs : ' || ls_net_amt || ' through cheque no : ' || ls_ref_no || 'dated : ' || ls_ref_date ; return ls_return_str; exception when no_data_found then ls_return_str := null; return ls_return_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LAB_BOOKING_X ON LAB_BOOKING (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIVABLES_REF_SITE_ACCT_SER ON RECEIVABLES (REF_NO, SITE_CODE, ACCT_CODE, TRAN_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPRES_INIT_APPDT ON EMP_RESIG_INIT (APPL_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DWH_PURCH ( AS_FR_DATE DATE, AS_TO_DATE DATE) AS BEGIN IF (AS_TO_DATE >= AS_FR_DATE) THEN /*========== INSERT for DWH_PURCHASE Started ==========*/ INSERT INTO DWH_PURCHASE ( RECEIPT_NO, RECEIPT_DATE, SUPPLIER_CODE , SUPPLIER_NAME , CITY, ITEM_CODE , QUANTITY , LOT_NO, LOT_SL , DISC_AMT , RATE, TAX_AMT , NET_AMT , INVOICE_NO , INVOICE_DATE , CHALLAN_NO , CHALLAN_DATE , TRANSPORTER_NAME , LR_NO , LR_DATE, TRAN_TYPE , PO_NO, PO_DATE , ITEM_SER , TRAN_CODE , NO_ART , NET_WEIGHT , REMARKS , BATCH_NO , MFG_DATE , EXP_DATE , QC_REQD , SITE_CODE , LINE_NO , TRAN_SER , CGST_RATE , CGST_TAXABLE_AMT , CGST_AMT , SGST_RATE , SGST_TAXABLE_AMT , SGST_AMT , IGST_RATE , IGST_TAXABLE_AMT , IGST_AMT , CESS_RATE , CESS_TAXABLE_AMT , CESS_AMT, TAX_CHARGES ) SELECT PR.TRAN_ID AS RECEIPT_NO, PR.TRAN_DATE AS RECEIPT_DATE, PR.SUPP_CODE AS SUPPLIER_CODE, S.SUPP_NAME AS SUPPLIER_NAME, S.CITY, PRD.ITEM_CODE, PRD.QUANTITY , NVL(PRD.LOT_NO,'NA') AS LOT_NO, NVL(PRD.LOT_SL,'NA') AS LOT_SL, PR.DISCOUNT AS DISC_AMT, PRD.RATE AS RATE, PRD.TAX_AMT, PRD.NET_AMT, PR.INVOICE_NO, PR.INVOICE_DATE, PR.DC_NO AS CHALLAN_NO, PR.DC_DATE AS CHALLAN_DATE, NVL((SELECT TRAN_NAME FROM TRANSPORTER T WHERE PR.TRAN_CODE =T.TRAN_CODE),'NA') AS TRAN_NAME, PR.LR_NO, PR.LR_DATE, PR.TRAN_TYPE, PR.PURC_ORDER AS PO_NO, (SELECT PORD.ORD_DATE FROM PORDER PORD WHERE PR.PURC_ORDER =PORD.PURC_ORDER) AS PO_DATE, PR.ITEM_SER, PR.TRAN_CODE, PRD.NO_ART, PRD.NET_WEIGHT, PR.REMARKS, PRD.BATCH_NO, PRD.MFG_DATE, PRD.EXPIRY_DATE AS EXP_DATE, PRD.QC_REQD, PR.SITE_CODE, PRD.LINE_NO, PR.TRAN_SER, NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'CGST_PUR_REG',' ',' ','P'),0) * (PR.EXCH_RATE) AS CGST_RATE , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'CGST_PUR_REG',' ',' ','B'),0) * (PR.EXCH_RATE) AS CGST_TAXABLE_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'CGST_PUR_REG',' ',' ','T'),0) * (PR.EXCH_RATE) AS CGST_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'SGST_PUR_REG',' ',' ','P'),0) * (PR.EXCH_RATE) AS SGST_RATE , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'SGST_PUR_REG',' ',' ','B'),0) * (PR.EXCH_RATE) AS SGST_TAXABLE_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'SGST_PUR_REG',' ',' ','T'),0) * (PR.EXCH_RATE) AS SGST_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'IGST_PUR_REG',' ',' ','P'),0) * (PR.EXCH_RATE) AS IGST_RATE , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'IGST_PUR_REG',' ',' ','B'),0) * (PR.EXCH_RATE) AS IGST_TAXABLE_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'IGST_PUR_REG',' ',' ','T'),0) * (PR.EXCH_RATE) AS IGST_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'CESS_PUR_REG',' ',' ','P'),0) * (PR.EXCH_RATE) AS CESS_RATE , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'CESS_PUR_REG',' ',' ','B'),0) * (PR.EXCH_RATE) AS CESS_TAXABLE_AMT , NVL(FN_RGET_TAX_NEW(PR.TRAN_SER,PR.TRAN_ID,CAST(PRD.LINE_NO AS CHAR(3)),'CESS_PUR_REG',' ',' ','T'),0) * (PR.EXCH_RATE) AS CESS_AMT, (SELECT SUM(TAX_AMT) FROM taxtran ti, tax tx WHERE tx.tax_code = ti.tax_code AND ti.tran_code = PR.TRAN_SER AND TI.TRAN_ID = PR.TRAN_ID AND TX.TAX_TYPE NOT IN ('H','I','J') AND TI.LINE_NO = PRD.LINE_NO ) AS TAX_CHARGES FROM PORCPDET PRD INNER JOIN PORCP PR ON PR.TRAN_ID =PRD.TRAN_ID INNER JOIN SUPPLIER S ON PR.SUPP_CODE =S.SUPP_CODE WHERE PR.CONFIRMED ='Y' AND PR.TRAN_DATE >= AS_FR_DATE AND PR.TRAN_DATE <= AS_TO_DATE ; /*========== INSERT for DWH_SALES_SUM Ended ==========*/ COMMIT ; /* ==================== DWH_SALES_SUM Data Insertion END ==================== */ END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MAINTENANCE_DESCR ( as_role_code__main char) return varchar2 is ls_descr varchar2(60); begin begin select descr into ls_descr from wf_role where role_code = as_role_code__main; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_CHEQUE_NO (as_ref_id in char, as_refser in char, as_sundry_code in char , as_tran_id in char ) return char is ls_fieldvalue char(50); li_cnt number := 0; begin begin ls_fieldvalue := '' ; if rtrim(as_refser) = 'M-PAY' then select rtrim(ref_no) into ls_fieldvalue from misc_payment where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'P-IBCA' then select count(*) into li_cnt from pay_ibca_det where tran_id = as_ref_id and sundry_code = as_sundry_code and abs(tot_amt) = ( select abs( (dr_amt * exch_rate) - ( cr_amt * exch_rate) ) from gltrace where tran_id = as_tran_id ) ; if li_cnt = 1 then select rtrim(ref_no) into ls_fieldvalue from pay_ibca_det where tran_id = as_ref_id and sundry_code = as_sundry_code and abs(tot_amt) = ( select abs( (dr_amt * exch_rate) - ( cr_amt * exch_rate) ) from gltrace where tran_id = as_tran_id ) ; li_cnt := 0; end if; end if; if rtrim(as_refser) = 'RCP' then select ref_no into ls_fieldvalue from receipt where tran_id = as_ref_id; end if; exception when no_data_found then ls_fieldvalue := '' ; end; return LTRIM(RTRIM(ls_fieldvalue)); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE SET_TRANSACTION as begin set transaction use rollback segment rb_own; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SUPPLIER_SITE_CODE ON SUPPLIER (SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SRETURN_TRAN_ID__CRN ON SRETURN (TRAN_ID__CRN) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CUST_APPL_FOR_SITE (as_custcode in customer.cust_code%type, as_sitecode in site.site_code%type) return char is --RETURN BOOLEAN IS --b_retval BOOLEAN := FALSE; ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_CUST'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from site_customer where site_code = as_sitecode and cust_code = as_custcode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WITHHELD (as_emp in char) return char is ls_with char(1); begin select with_held into ls_with from employee where employee.emp_code = as_emp ; return ls_with; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MRP_PLIST return varchar2 is ls_pricelist varchar2(10); begin begin select var_value into ls_pricelist from mfgparm where prd_code = '999999' and var_name = 'MRP_PRICELIST' ; exception when no_data_found then ls_pricelist := ' ' ; end; return ls_pricelist; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_AREA_DESCR (marea_code in char) return char is marea_descr varchar2(40); begin select level_descr into marea_descr from hierarchy where level_code = marea_code; return marea_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SALES_PERS_NAME ( as_sales_pers char) return varchar2 is ls_sp_name varchar2(40); begin begin select sp_name into ls_sp_name from sales_pers where sales_pers = as_sales_pers; exception when no_data_found then ls_sp_name := null; end; return ls_sp_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ATTANN_LINES (AS_TRANID VARCHAR,AS_FLAG CHAR,AS_TRAN_FLAG CHAR) RETURN NUMBER IS LINENO_MIN NUMBER(3):=0; LINENO_MAX NUMBER(3):=0; BEGIN IF AS_TRAN_FLAG ='D-ISS' THEN SELECT min(LINE_NO),MAX(LINE_NO) INTO LINENO_MIN,LINENO_MAX FROM distord_issdet WHERE TRAN_ID = AS_TRANID AND (CASE WHEN LINE_NO IS NULL THEN 1 ELSE 0 END) = 0; ELSIF AS_TRAN_FLAG ='S-DSP' THEN SELECT min(LINE_NO),MAX(LINE_NO) INTO LINENO_MIN,LINENO_MAX FROM DESPATCHDET WHERE DESP_ID = AS_TRANID AND (CASE WHEN LINE_NO IS NULL THEN 1 ELSE 0 END) = 0; END IF; IF AS_FLAG ='I' THEN RETURN LINENO_MIN; ELSIF AS_FLAG ='X' THEN RETURN LINENO_MAX; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_OUTST_REPO_APRV_NAME (as_transer char,as_tranid char) return char is ls_apprv_name char(60); begin if as_transer='VOUCH' then select nvl(short_name,' ') into ls_apprv_name from employee,voucher where tran_id=as_tranid and voucher.emp_code__aprv=employee.emp_code ; elsif as_transer='M-VOUC' then select nvl(short_name,' ') into ls_apprv_name from employee,misc_voucher where tran_id=as_tranid and misc_voucher.emp_code__aprv=employee.emp_code; elsif as_transer='P-VOUC'then select nvl(short_name,' ') into ls_apprv_name from employee,payr_voucher where tran_id=as_tranid and payr_voucher.emp_code__aprv=employee.emp_code; elsif as_transer='P-IBCA' then select nvl(short_name,' ') into ls_apprv_name from employee , pay_ibca where tran_id=as_tranid and pay_ibca.emp_code__aprv = employee.emp_code; elsif as_transer = 'DRNPAY' then select nvl(short_name,' ') into ls_apprv_name from employee , DRCR_PAY where tran_id=as_tranid and DRCR_PAY.emp_code__aprv = employee.emp_code; elsif as_transer='CRNPAY' then select nvl(short_name,' ') into ls_apprv_name from employee , DRCR_PAY where tran_id=as_tranid and DRCR_PAY.emp_code__aprv = employee.emp_code; end if; return ls_apprv_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_DISPARM ( as_var_name in char, ad_tran_date in date, as_item_code in char, as_lot_no in char) return number is mrate number(14,3); ls_type pricelist.list_type%type; as_var_value pricelist.price_list%type; begin select var_value into as_var_value from disparm where var_name = as_var_name; select list_type into ls_type from pricelist where trim(price_list) = trim(as_var_value) and rownum = 1; if ls_type = 'L' then select nvl(rate,0) into mrate from pricelist where trim(price_list) = trim(as_var_value) and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif ls_type = 'B' then select max(nvl(rate,0)) into mrate from pricelist where trim(price_list) = trim(as_var_value) and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no ; /* and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; */ end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUM_SPRSROUTE1 (as_sales_pers in char,as_route_id in char ) return number is as_sum_cust number(14); begin select nvl(sum(no_cust_type1),0)+nvl(sum(no_cust_type2),0)+nvl(sum(no_cust_type3),0) into as_sum_cust from sprs_route where sprs_code=as_sales_pers and route_id=as_route_id; return as_sum_cust; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DEPT_HIER_DESC (as_dept_code char) return varchar2 is ls_dept_hierarchy varchar2(4000); ls_connect_col NUMBER(4); ls_maxlevel number(4); ls_connectmax_col number(4); begin ls_dept_hierarchy := ''; select max(level), CONNECT_BY_ISCYCLE into ls_maxlevel, ls_connectmax_col from DEPARTMENT where dept_code = as_dept_code AND DEPT_CODE__PARENT IS NOT NULL AND DEPT_CODE__PARENT <> DEPT_CODE group by CONNECT_BY_ISCYCLE connect by NOCYCLE prior dept_code = dept_code__parent; select sys_connect_by_path(descr,'>>'), CONNECT_BY_ISCYCLE into ls_dept_hierarchy, ls_connect_col from DEPARTMENT where dept_code = as_dept_code AND DEPT_CODE__PARENT IS NOT NULL AND DEPT_CODE__PARENT <> DEPT_CODE and level in (ls_maxlevel) connect by NOCYCLE prior dept_code=dept_code__parent; ls_dept_hierarchy := substr(ls_dept_hierarchy,3); return nvl(ls_dept_hierarchy , ' '); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ANYFIELD_VALUE (as_sundry_type in char,as_sundry_code in char ,as_fld_name in varchar2) return char is ls_retval varchar2(120); ls_tableName varchar2(30); ls_WhereCols varchar2(30); ls_descr varchar2(120); ls_sql varchar2(1000); begin begin if as_sundry_type = 'E' then ls_tableName := 'employee'; ls_WhereCols := 'emp_code'; elsif as_sundry_type = 'R' then ls_tableName := 'strg_customer'; ls_WhereCols := 'sc_code'; elsif as_sundry_type = 'C' then ls_tableName := 'customer'; ls_WhereCols := 'cust_code'; elsif as_sundry_type = 'S' then ls_tableName := 'SUPPLIER'; ls_WhereCols := 'SUPP_code'; end if; ls_descr := ''; ls_sql := 'select ' || as_fld_name ; ls_sql := ls_sql || ' From ' || ls_tableName ; ls_sql := ls_sql || ' Where '|| ls_WhereCols ; ls_sql := ls_sql || ' = ''' || as_sundry_code || ''''; execute immediate ls_sql into ls_descr; EXCEPTION WHEN NO_DATA_FOUND THEN ls_descr := '' ; return ls_descr ; WHEN OTHERS THEN ls_descr := '' ; return ls_descr ; end; return trim(ls_descr); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_SRETQTY (as_sitecode in char, as_itemcode in char, as_lotno in char, ac_quantity in number) RETURN NUMBER IS lc_saleqty number(14,3) := 0; lc_srqty number(14,3) := 0; ll_retval number(1) := 0; begin begin select sum(t.quantity__stduom) into lc_saleqty from invoice i, invoice_trace t where t.invoice_id = i.invoice_id and i.site_code = as_sitecode and t.item_code = as_itemcode and t.lot_no = as_lotno ; exception when others then lc_saleqty := 0; end; begin select sum(t.quantity__stduom) into lc_srqty from sreturn i, sreturndet t where t.tran_id = i.tran_id and i.site_code = as_sitecode and t.item_code = as_itemcode and t.lot_no = as_lotno ; exception when others then lc_srqty := 0; end; if lc_srqty is null then lc_srqty := 0; end if; if lc_saleqty is null then lc_saleqty := 0; end if; if lc_srqty + nvl(ac_quantity,0) > lc_saleqty then ll_retval := 1; end if; RETURN ll_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_TRANS_CR (ldate_fr in date,ldate_to in date,lsundry_code in char,lsundry_type in char, lsite_code in char,lacct_code in char) return number is lc_cr_sum number(14,3); begin Select nvl(Sum(cr_amt * exch_rate),0) into lc_cr_sum from gltrace where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_FSTRCP_TRAN_ID (ls_item_code stock.item_code%type, ls_lot_no stock.lot_no%type) return char is ls_ref_id char(15); cursor c1 is select ref_id from invtrace where item_code=ls_item_code and lot_no=ls_lot_no and ref_ser in('P-RCP','W-RCP','R-BFS','S-RET','D-RCP','ADJRCP') order by tran_date; begin open c1; fetch c1 into ls_ref_id; close c1; return ls_ref_id; exception when no_data_found then return ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_DAILY_EXCESS_HRS (AS_EMP_CODE char,AS_DATE date) return number is cursor c1 is select lve_code,lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and AS_DATE between lve_date_fr and lve_date_to and status = 'A' and use_flag = 'C' order by lve_date_fr,lve_date_to; cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and AS_DATE between date_from and date_to and status = 'A' order by date_from,date_to; a_count number(5); a_count1 number(5); a_minutes number(5) := 0; a_min_fd number(5); a_in_actual number(5); a_out_actual number(5); a_in_shift number(5); a_out_shift number(5); a_hdin_shift number(5); a_fd_hrs number(5); a_hd_hrs number(5); a_tour_in number(5); a_tour_out number(5); a_tour_hrs number(5) := 0; a_first varchar2(1); a_second varchar2(1); a_hol_tblno holiday.hol_tblno%type := ddf_get_holtblno(AS_EMP_CODE,AS_DATE); begin select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE and (in_time is null or out_time is null or trim(replace(in_time,':','')) is null or trim(replace(out_time,':','')) is null); if (a_count <> 0) then return a_minutes; end if; select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count = 0) then a_min_fd := 0; else select (ddf_time_in_mm(out_time) - ddf_time_in_mm(in_time)) into a_min_fd from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'H'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 = 0) then a_minutes := a_min_fd; return a_minutes; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 <> 0) then a_minutes := a_min_fd; return a_minutes; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'W'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 = 0) then a_minutes := a_min_fd; return a_minutes; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 <> 0) then a_minutes := a_min_fd; return a_minutes; end if; for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> AS_DATE and i.lve_date_to <> AS_DATE) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = AS_DATE and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_minutes := a_min_fd; return a_minutes; else if (i.lve_date_fr = AS_DATE and i.leave_starts = 'B') then a_first := 'L'; elsif (i.lve_date_fr = AS_DATE and i.leave_starts = 'M') then a_second := 'L'; elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'M') then a_first := 'L'; elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_second := 'L'; end if; end if; end loop; for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> AS_DATE and i.date_to <> AS_DATE) or (i.date_from <> i.date_to and i.date_from = AS_DATE and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = AS_DATE and i.tour_ends = 'E') then -- Excess hours should not get calculated if there's full day tour. Mail by Rashmi Pokade on 17-Nov-10. -- select count(*) into a_count from attendance_day -- where attd_date = AS_DATE -- and emp_code = AS_EMP_CODE; -- if (a_count <> 0) then -- select ddf_time_in_mm(a.in_time),ddf_time_in_mm(a.out_time),ddf_time_in_mm(b.in_time),ddf_time_in_mm(b.out_time), -- b.fd_hrs*60 into a_in_actual,a_out_actual,a_in_shift,a_out_shift,a_fd_hrs -- from attendance_day a,workshft b -- where b.day_no = a.day_no -- and b.shift = a.shift -- and a.attd_date = AS_DATE -- and a.emp_code = AS_EMP_CODE; -- if (a_out_shift < a_in_shift) then -- a_out_shift := a_out_shift + 1440; -- end if; -- if (a_in_actual <= a_out_shift) and (a_out_actual >= a_in_shift) then -- a_tour_in := a_in_actual; -- a_tour_out := a_out_actual; -- if (a_tour_in < a_in_shift) then -- a_tour_in := a_in_shift; -- end if; -- if (a_tour_out > a_out_shift) then -- a_tour_out := a_out_shift; -- end if; -- a_tour_hrs := a_tour_out-a_tour_in; -- end if; -- if (((a_out_actual-a_in_actual)-a_tour_hrs+a_fd_hrs) > a_fd_hrs) then -- a_minutes := ((a_out_actual-a_in_actual)-a_tour_hrs+a_fd_hrs) - a_fd_hrs; -- end if; -- end if; return a_minutes; else if (i.date_from = AS_DATE and i.tour_starts = 'S') then a_first := 'T'; elsif (i.date_from = AS_DATE and i.tour_starts = 'B') then a_second := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'B') then a_first := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'E') then a_second := 'T'; end if; end if; end loop; if (a_first is null) and (a_second is null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and ((ddf_time_in_mm(a.out_time) - ddf_time_in_mm(a.in_time)) / 60) > b.fd_hrs; if (a_count = 0) then return a_minutes; else select (ddf_time_in_mm(a.out_time) - ddf_time_in_mm(a.in_time)) - (b.fd_hrs * 60) into a_minutes from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE; return a_minutes; end if; elsif (a_first is not null) and (a_second is not null) then -- Excess hours should not get calculated if there's half day tour and half day leave. Mail by Rashmi Pokade on 17-Nov-10. -- select count(*) into a_count from attendance_day -- where attd_date = AS_DATE -- and emp_code = AS_EMP_CODE; -- if (a_count <> 0) then -- select ddf_time_in_mm(a.in_time),ddf_time_in_mm(a.out_time),ddf_time_in_mm(b.in_time),ddf_time_in_mm(b.out_time), -- ddf_time_in_mm(b.hd_in_time),b.fd_hrs*60,b.hd_hrs*60 into a_in_actual,a_out_actual,a_in_shift,a_out_shift, -- a_hdin_shift,a_fd_hrs,a_hd_hrs -- from attendance_day a,workshft b -- where b.day_no = a.day_no -- and b.shift = a.shift -- and a.attd_date = AS_DATE -- and a.emp_code = AS_EMP_CODE; -- if (a_out_shift < a_in_shift) then -- a_out_shift := a_out_shift + 1440; -- end if; -- if (a_hdin_shift < a_in_shift) then -- a_hdin_shift := a_hdin_shift + 1440; -- end if; -- if (a_first = 'T') then -- if (a_in_actual <= (a_in_shift+a_hd_hrs)) and (a_out_actual >= a_in_shift) then -- a_tour_in := a_in_actual; -- a_tour_out := a_out_actual; -- if (a_tour_in < a_in_shift) then -- a_tour_in := a_in_shift; -- end if; -- if (a_tour_out > (a_in_shift+a_hd_hrs)) then -- a_tour_out := a_in_shift+a_hd_hrs; -- end if; -- a_tour_hrs := a_tour_out-a_tour_in; -- end if; -- end if; -- if (a_second = 'T') then -- if (a_in_actual <= a_out_shift) and (a_out_actual >= a_hdin_shift) then -- a_tour_in := a_in_actual; -- a_tour_out := a_out_actual; -- if (a_tour_in < a_hdin_shift) then -- a_tour_in := a_hdin_shift; -- end if; -- if (a_tour_out > a_out_shift) then -- a_tour_out := a_out_shift; -- end if; -- a_tour_hrs := a_tour_out-a_tour_in; -- end if; -- end if; -- a_minutes := (a_out_actual-a_in_actual) - a_tour_hrs; -- end if; return a_minutes; elsif (a_first = 'L' or a_second = 'L') then select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count <> 0) then select ddf_time_in_mm(a.in_time),ddf_time_in_mm(a.out_time),ddf_time_in_mm(b.in_time),ddf_time_in_mm(b.out_time), ddf_time_in_mm(b.hd_in_time),b.hd_hrs*60 into a_in_actual,a_out_actual,a_in_shift,a_out_shift,a_hdin_shift,a_hd_hrs from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE; if (a_out_shift < a_in_shift) then a_out_shift := a_out_shift + 1440; end if; if (a_hdin_shift < a_in_shift) then a_hdin_shift := a_hdin_shift + 1440; end if; if (a_first = 'L') then a_hd_hrs := a_out_shift - a_hdin_shift; end if; if ((a_out_actual-a_in_actual) > a_hd_hrs) then a_minutes := (a_out_actual-a_in_actual) - a_hd_hrs; end if; return a_minutes; end if; return a_minutes; elsif (a_first = 'T' or a_second = 'T') then select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count <> 0) then select ddf_time_in_mm(a.in_time),ddf_time_in_mm(a.out_time),ddf_time_in_mm(b.in_time),ddf_time_in_mm(b.out_time), ddf_time_in_mm(b.hd_in_time),b.fd_hrs*60,b.hd_hrs*60 into a_in_actual,a_out_actual,a_in_shift,a_out_shift, a_hdin_shift,a_fd_hrs,a_hd_hrs from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE; if (a_out_shift < a_in_shift) then a_out_shift := a_out_shift + 1440; end if; if (a_hdin_shift < a_in_shift) then a_hdin_shift := a_hdin_shift + 1440; end if; if (a_first = 'T') then if (a_in_actual <= (a_in_shift+a_hd_hrs)) and (a_out_actual >= a_in_shift) then a_tour_in := a_in_actual; a_tour_out := a_out_actual; if (a_tour_in < a_in_shift) then a_tour_in := a_in_shift; end if; if (a_tour_out > (a_in_shift+a_hd_hrs)) then a_tour_out := a_in_shift+a_hd_hrs; end if; a_tour_hrs := a_tour_out-a_tour_in; end if; if (((a_out_actual-a_in_actual)-a_tour_hrs+a_hd_hrs) > a_fd_hrs) then a_minutes := ((a_out_actual-a_in_actual)-a_tour_hrs+a_hd_hrs) - a_fd_hrs; end if; return a_minutes; end if; if (a_second = 'T') then if (a_in_actual <= a_out_shift) and (a_out_actual >= a_hdin_shift) then a_tour_in := a_in_actual; a_tour_out := a_out_actual; if (a_tour_in < a_hdin_shift) then a_tour_in := a_hdin_shift; end if; if (a_tour_out > a_out_shift) then a_tour_out := a_out_shift; end if; a_tour_hrs := a_tour_out-a_tour_in; end if; if (((a_out_actual-a_in_actual)-a_tour_hrs+(a_out_shift-a_hdin_shift)) > a_fd_hrs) then a_minutes := ((a_out_actual-a_in_actual)-a_tour_hrs+(a_out_shift-a_hdin_shift)) - a_fd_hrs; end if; return a_minutes; end if; end if; return a_minutes; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_STATUS ( as_refser char, as_tranid char, as_role char,as_full CHAR) return varchar2 is ls_retstring varchar2(250) ; ls_sign_Status char(1) ; ls_sign_remarks varchar2(250); ld_sign_Date date; ls_empfname varchar2(50); ls_emplname varchar2(50); ls_entity_code varchar2(10); begin if as_full='Y' THEN select a.entity_code,a.sign_Status,a.sign_remarks,a.sign_date,b.emp_fname,b.emp_lname into ls_entity_code,ls_sign_Status,ls_sign_remarks,ld_sign_Date,ls_empfname,ls_emplname from obj_sign_TRANS a,employee b where RTRIM(b.emp_code)=RTRIM(a.entity_code) and a.ref_ser=as_refser and a.ref_id=rtrim(as_tranid) and RTRIM(a.role_code__sign)=as_role; if RTRIM(ls_entity_code)='C12210' then ls_emplname:='PESHKAR'; end if; If ls_sign_Status='S' then ls_retstring:= 'Approved by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' ' ||'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks; elsif ls_sign_Status='U' then ls_retstring:= 'Awaiting Approval by' ||' ' ||ls_empfname|| ' ' ||ls_emplname ; else ls_retstring:= 'Rejected by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '|| 'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks ; End if ; ELSE if as_role='REC'THEN select a.entity_Code,a.sign_Status,a.sign_remarks,a.sign_date,b.emp_fname,b.emp_lname into ls_entity_Code,ls_sign_Status,ls_sign_remarks,ld_sign_Date,ls_empfname,ls_emplname from obj_sign_TRANS a,employee b where RTRIM(b.emp_code)=RTRIM(a.entity_code) and a.ref_ser=as_refser and a.ref_id=as_tranid and RTRIM(a.role_code__sign)=as_role ; if RTRIM(ls_entity_code)='C12210' then ls_emplname:='PESHKAR'; end if; If ls_sign_Status='S' then ls_retstring:= 'Approved by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '|| 'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks ; elsif ls_sign_Status='U' then ls_retstring:= 'Awaiting Approval by' ||' ' ||ls_empfname|| ' ' ||ls_emplname ; else ls_retstring:= 'Rejected by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '||'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks ; End if ; ELSIF as_role='APR' THEN select a.entity_Code,a.sign_Status,a.sign_remarks,a.sign_date,b.emp_fname,b.emp_lname into ls_entity_code,ls_sign_Status,ls_sign_remarks,ld_sign_Date,ls_empfname,ls_emplname from obj_sign_TRANS a,employee b where RTRIM(b.emp_code)=RTRIM(a.entity_code) and a.ref_ser=as_refser and a.ref_id=as_tranid and RTRIM(a.role_code__sign)='REC'; if RTRIM(ls_entity_code)='C12210' then ls_emplname:='PESHKAR'; end if; If ls_sign_Status='S' then ls_retstring:= 'Approved by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '||'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks; elsif ls_sign_Status='U' then ls_retstring:= 'Awaiting Approval by' ||' ' ||ls_empfname|| ' ' ||ls_emplname ; else ls_retstring:= 'Rejected by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '||'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks ; End if ; ELSIF as_role='HR' THEN select a.entity_code,a.sign_Status,a.sign_remarks,a.sign_date,b.emp_fname,b.emp_lname into ls_entity_Code,ls_sign_Status,ls_sign_remarks,ld_sign_Date,ls_empfname,ls_emplname from obj_sign_TRANS a,employee b where RTRIM(b.emp_code)=RTRIM(a.entity_code) and a.ref_ser=as_refser and a.ref_id=as_tranid and RTRIM(a.role_code__sign)='APR'; if RTRIM(ls_entity_code)='C12210' then ls_emplname:='PESHKAR'; end if; If ls_sign_Status='S' then ls_retstring:= 'Approved by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '||'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks ; elsif ls_sign_Status='U' then ls_retstring:= 'Awaiting Approval by' ||' ' ||ls_empfname|| ' ' ||ls_emplname ; else ls_retstring:= 'Rejected by' ||' ' ||ls_empfname|| ' ' ||ls_emplname || ' '||'on '||to_char(ld_sign_date,'dd-mm-yy')||' '||'Remarks :- '||ls_sign_remarks ; End if ; END IF ; eND IF; return ls_retstring ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CHANNEL_ITEMSER (as_sale_order in sorder.sale_order%type) return char is ls_itemser itemser.item_ser%type; begin begin select item_ser into ls_itemser from sorder where sale_order = as_sale_order; exception when others then ls_itemser := 'ERRORDS000'; end; return ls_itemser; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PODET_INDENT_NO ON PORDDET (IND_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_PL_PARENT (as_price_list in char, as_item_code in char, as_lot_no in char) return number is mrate number(14,3); ls_type char(1); mpl_parent char(5); begin begin select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and as_lot_no between lot_no__from and lot_no__to; exception when no_data_found then select price_list__parent into mpl_parent from pricelist_mst_det where price_list = 'MRP' and price_list__tar = as_price_list; select rate into mrate from pricelist where price_list = mpl_parent and item_code = as_item_code and as_lot_no between lot_no__from and lot_no__to; when others then mrate := 0; end; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SM_SALES_SITE_SITE_PARENT ON SM_SALES_SITE (SITE_CODE, ITEM_CODE, PRD_CODE, ITEM_SER, LEVEL_CODE__PARENT, TABLE_NO, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_SER_CLASS_COUNT (as_sales_pers char) return number is ln_count number(3); as_count number(38); begin SELECT COUNT(*) INTO as_count FROM STRG_CLASS C ,STRG_SER_CLASS SSC WHERE c.class_code= SSc.class_code AND c.active_yn='Y' AND SSC.ITEM_SER=(SELECT ITEM_SER FROM SALES_PERS WHERE SALES_PERS = as_sales_pers); IF(as_count > 0) THEN ln_count := 1; ELSE ln_count :=0; END IF; RETURN ln_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ROLEPROF_DESCR (as_role_profiles char) return varchar2 is ls_descr varchar2(4000); ls_profile ROLE_PROFILE.ROLE_PROFILE%type; li_pos number(5); li_no number(5); ls_descr_1 ROLE_PROFILE.DESCR%type; ls_role_profiles varchar2(4000); begin li_no := 0; ls_descr := ''; li_pos := 0; ls_descr_1 := ''; ls_role_profiles := as_role_profiles; while length(trim(ls_role_profiles)) > 0 loop li_pos := instr(ls_role_profiles,','); if li_pos > 0 then ls_profile := trim(substr(ls_role_profiles,1,li_pos-1)); ls_role_profiles := trim(substr(ls_role_profiles , li_pos + 1)); else ls_profile := trim(ls_role_profiles); ls_role_profiles := ''; end if; if length(trim(ls_profile)) <= 0 then continue; end if; ls_descr_1 := ''; select trim(descr) into ls_descr_1 from role_profile where role_profile = ls_profile; li_no := li_no + 1; if li_no = 1 then ls_descr := '* [' || trim(ls_profile) || '] ' || ls_descr_1; else ls_descr := ls_descr || chr(10) || '* [' || trim(ls_profile) || '] ' || ls_descr_1 ; end if; end loop; return trim(ls_descr); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WORKORDISS_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON WORKORDER_ISS referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; BEGIN if :new.confirmed = 'Y' then begin --workorder isse and return begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_WISS'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_worder in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM WORKORDER_ISSDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id ) loop if cur_worder.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from workorder_issdet where tran_id = :new.tran_id; exception when others then ll_count:= 0; end; --if (:new.tran_type = 'I') then if (:new.tran_type <> 'R' ) then -- in ('I','D','O') begin select count(1) into ll_glcount from gltrace where ref_ser = 'W-ISS' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; end if; if (:new.tran_type = 'R') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'W-IRTN' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; end if; if ll_count > 0 then begin SELECT sum(rate * quantity) into lc_rate FROM workorder_issdet where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR -- if (:new.tran_type = 'I') then if (:new.tran_type in ('I','D')) then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'W-ISS' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if (:new.tran_type = 'R') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'W-IRTN' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if;--end rate end if; -- count end end; end if ;-- end of varvalue if end if; end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ACTIVITY_STRG_LISTED ( ls_tran_id char) return varchar2 is ls_strg_listed varchar2(2000); li_cnt number(7); CURSOR l_listed is select trim(sc.first_name) || ' ' || trim(sc.middle_name) || ' ' || trim(sc.last_name) || ' (' || trim(sc.sc_code) || ')' as listed_customer from strg_customer sc left outer join event_exe_part ee on sc.sc_code=ee.participant_code where ee.tran_id=ls_tran_id; l_cur_rec l_listed%ROWTYPE; begin li_cnt :=0; OPEN l_listed; LOOP li_cnt := li_cnt + 1; FETCH l_listed INTO l_cur_rec; EXIT WHEN l_listed%NOTFOUND; if(li_cnt = 1) then ls_strg_listed := l_cur_rec.listed_customer; else ls_strg_listed := ls_strg_listed || ',' || l_cur_rec.listed_customer ; end if; END LOOP; return ls_strg_listed; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPAD_DATEWISE ON EMPLOYEE_AD (EMP_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_TRANS_DR (ldate_fr in date,ldate_to in date,lsundry_code in char,lsundry_type in char, lsite_code in char,lacct_code in char) return number is lc_dr_sum number(14,3); begin Select nvl(Sum(dr_amt * exch_rate),0) into lc_dr_sum from gltrace where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE STOCKISTCODERETAILMASTER AS OBJECT ( STOCKIST_CODE CHAR(10), STOCKIST_NAME VARCHAR2(120) ); -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE DAILYSALESMASTER AS OBJECT ( TC NUMBER(5), PC NUMBER(5), NPC NUMBER(5), NA NUMBER(5), AMOUNT NUMBER(14,3), QUANTITY NUMBER(5), COLUMNAME VARCHAR2(15) , THEME_COLOR VARCHAR2(15) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PROJECT_LINK_EMP_CODES ( as_login_emp_code char, as_PROJ_code char) return number is retVal number(1) := 0; cursor C_PROJ_code is select a.emp_code__head EMP_CODE from proj_team a, proj_team_det b where a.team_code = b.team_code and a.team_code in (select team_code from project where proj_code=as_PROJ_code ) union select b.emp_code EMP_CODE from proj_team a, proj_team_det b where a.team_code = b.team_code and a.team_code in (select team_code from project where proj_code=as_PROJ_code ); begin BEGIN FOR I IN C_PROJ_code LOOP if ( as_login_emp_code = i.EMP_CODE) then retVal := 1; exit; end if; END LOOP; END; return retVal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DATETIMEDIFF (as_datefr date, as_dateto date) return char is ls_time varchar2(10); -- rahul k k -- pass two dates with time and -- it will give difference in minutes begin select trunc(decode(to_date(as_dateto,'dd/mm/yyyy') - to_date(as_datefr,'dd/mm/yyyy'),0 , ((to_char(as_dateto,'hh24') * 60) + (to_char(as_dateto,'mi'))) - ((to_char(as_datefr,'hh24') * 60) + (to_char(as_datefr,'mi'))) , (((trunc(((24*60) - (to_char(as_datefr,'hh24') * 60 +(to_char(as_datefr,'mi'))))/60)) * 60) + (mod(((24*60) - (to_char(as_datefr,'hh24') * 60 +(to_char(as_datefr,'mi')))),60)) + ((trunc(((to_char(as_dateto,'hh24') * 60 +(to_char(as_dateto,'mi'))))/60))*60) + (mod(((to_char(as_dateto,'hh24') * 60 +(to_char(as_dateto,'mi')))),60))) + ((trunc(to_date(as_dateto,'dd/mm/yyyy') - to_date(as_datefr,'dd/mm/yyyy')) - 1)* (24*60)) )/60) ||'.'|| rtrim(ltrim(to_char(mod(decode(to_date(as_dateto,'dd/mm/yyyy') - to_date(as_datefr,'dd/mm/yyyy'),0 , ((to_char(as_dateto,'hh24') * 60) + (to_char(as_dateto,'mi'))) - ((to_char(as_datefr,'hh24') * 60) + (to_char(as_datefr,'mi'))) , (((trunc(((24*60) - (to_char(as_datefr,'hh24') * 60 +(to_char(as_datefr,'mi'))))/60)) * 60) + (mod(((24*60) - (to_char(as_datefr,'hh24') * 60 +(to_char(as_datefr,'mi')))),60)) + ((trunc(((to_char(as_dateto,'hh24') * 60 +(to_char(as_dateto,'mi'))))/60))*60) + (mod(((to_char(as_dateto,'hh24') * 60 +(to_char(as_dateto,'mi')))),60))) + ((trunc(to_date(as_dateto,'dd/mm/yyyy') - to_date(as_datefr,'dd/mm/yyyy')) - 1)* (24*60)) ),60),'00'))) into ls_time from dual; return ls_time; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CST_GST_IMI (ls_tran_id char,tab_type char,type char) return char is ls_return varchar2(200); begin if tab_type='INV' THEN IF type='GRW' then SELECT sum(inv_pack_rcp.gross_weight) into ls_return from inv_pack_rcp,inv_pack where inv_pack.tran_id = inv_pack_rcp.tran_id and inv_pack.tran_id =ls_tran_id; end if; if type='NART' then SELECT sum(inv_pack_rcp.no_art) into ls_return from inv_pack_rcp,inv_pack where inv_pack.tran_id = inv_pack_rcp.tran_id and inv_pack.tran_id =ls_tran_id; end if; if type='QTY' then select sum(inv_pack_rcp.quantity) into ls_return from inv_pack_rcp,inv_pack where inv_pack.tran_id = inv_pack_rcp.tran_id and inv_pack.tran_id =ls_tran_id; end if; if type='NWT' then select sum(inv_pack_rcp.net_weight) into ls_return from inv_pack_rcp,inv_pack where inv_pack.tran_id = inv_pack_rcp.tran_id and inv_pack.tran_id =ls_tran_id; end if; if type='PWT' then select sum(inv_pack_rcp.pallet_wt) into ls_return from inv_pack_rcp,inv_pack where inv_pack.tran_id = inv_pack_rcp.tran_id and inv_pack.tran_id =ls_tran_id; end if; ELSIF tab_type='DESP'then IF type='GRW' then SELECT sum(despatchdet.gross_weight) into ls_return from despatch,despatchdet where despatch.desp_id = despatchdet.desp_id and despatch.desp_id =ls_tran_id; end if; if type='NART' then SELECT sum(despatchdet.no_art) into ls_return from despatch,despatchdet where despatch.desp_id = despatchdet.desp_id and despatch.desp_id =ls_tran_id; end if; if type='QTY' then select sum(despatchdet.quantity) into ls_return from despatch,despatchdet where despatch.desp_id = despatchdet.desp_id and despatch.desp_id =ls_tran_id; end if; if type='NWT' then select sum(despatchdet.nett_weight) into ls_return from despatch,despatchdet where despatch.desp_id = despatchdet.desp_id and despatch.desp_id =ls_tran_id; end if; if type='PWT' then select sum(despatchdet.pallet_wt) into ls_return from despatch,despatchdet where despatch.desp_id = despatchdet.desp_id and despatch.desp_id =ls_tran_id; end if; END IF; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LAST_SAL ( as_period char, as_emp char, as_adcode char ) return number is ll_salary number(14,3); begin ll_salary := 0; if length(trim(as_emp)) <> 0 then begin select amount into ll_salary from payroll_projdet where prd_code = as_period and emp_code = as_emp and ad_code = as_adcode; exception when NO_DATA_FOUND then ll_salary := 0; end; end if; return ll_salary; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_PLD before insert on PRICELIST_DET referencing old as old new as new FOR EACH ROW declare ls_tempstr PRICELIST_DET.LOT_NO__FROM%type; ls_tempstr1 PRICELIST_DET.LOT_NO__FROM%type; begin ls_tempstr := trim(:new.LOT_NO__FROM); select Replace(translate(ls_tempstr,' ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-.','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_tempstr1 from dual; if (ls_tempstr1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in lot number From [' || ls_tempstr1 ||']' ); end if; ls_tempstr := trim(:new.LOT_NO__TO); select Replace(translate(ls_tempstr,' ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-.','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_tempstr1 from dual; if (ls_tempstr1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in lot number To [' || ls_tempstr1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VENDOR_STATUS (AS_SITE_CODE CHAR, AS_ITEM_CODE CHAR, AS_SUPP_CODE__MNFR CHAR, AS_TRANDATE date) RETURN CHAR AS /*Function created by Anand Desai as on 12/05/2014, for Details of Receipts Report,in VQM */ as_output CHAR(1); /*the function will return status of manufacturer based on data found in any of the tables*/ BEGIN SELECT stat into as_output FROM ( select status as stat --- FOR APPRV_SCOPE 'S' from supp_apprv_site where trim(site_code) = as_site_code and SUPP_CODE__MNFR = AS_SUPP_CODE__MNFR and AS_TRANDATE between EFF_FROM and VALID_UPTO UNION select status as stat --- FOR APPRV_SCOPE 'I' from supp_apprv_item where item_Code = as_item_code and TRIM(SITE_CODE) = AS_SITE_CODE and supp_code__mnfr = as_supp_code__mnfr and AS_TRANDATE between EFF_FROM and VALID_UPTO UNION select status as stat --- FOR APPRV_SCOPE 'T' from itemmnfr where item_Code = as_item_code and SUPP_CODE__MNFR = AS_SUPP_CODE__MNFR and AS_TRANDATE between EFF_FROM and VALID_UPTO UNION select status as stat --- FOR APPRV_SCOPE 'V' from supp_apprv_site where TRIM(SITE_CODE) is null and supp_code__mnfr =as_supp_code__mnfr and AS_TRANDATE between EFF_FROM and VALID_UPTO ); RETURN(as_output); EXCEPTION when NO_DATA_FOUND then as_output := ' ' ; RETURN as_output; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BUDGET_CODE (as_purc_order porddet.purc_order%type) return varchar2 is ls_cctr_code porddet.cctr_code__dr%type; begin select cctr_code__dr into ls_cctr_code from porddet where purc_order = as_purc_order and line_no = ( select MIN(line_no) from porddet where purc_order = as_purc_order); return ls_cctr_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_TRANDATE (ldate_fr in date,lsundry_code in char,lsundry_type in char,lsite_code in char,lacct_code in char) return number is lc_day_op_bal number(14,3); lc_prd_op_bal number(14,3); ls_prd char(6); ls_acct_prd char(6); ls_fr_date date; begin select code, acct_prd ,fr_date into ls_prd ,ls_acct_prd,ls_fr_date from period where ldate_fr between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and site_code = lsite_code and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Select nvl(Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)),0) into lc_day_op_bal from gltrace where site_code = lsite_code and tran_date >= ls_fr_date and tran_date < ldate_fr and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EF_GET_QCREQD_DIST_RCP (as_sitecode_dlv in char, as_tran_type in varchar2) return char is ls_qcreqd char(1); ls_sitetype char(3) := ' '; begin begin select qc_reqd into ls_qcreqd from distorder_type where tran_type = as_tran_type ; exception when others then ls_qcreqd := ' '; end; if ls_qcreqd is null or length(trim(ls_qcreqd)) = 0 then begin select case when site_type is null then ' ' else site_type end into ls_sitetype from site where site_code = as_sitecode_dlv ; exception when others then ls_sitetype := ' '; end; if trim(ls_sitetype) = 'F' or trim(ls_sitetype) = 'L' or trim(ls_sitetype) = 'T' then ls_qcreqd := 'Y'; else ls_qcreqd := 'N'; end if; end if; return ls_qcreqd; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITE_REGNO ( as_site_code CHAR, as_ref_code CHAR) RETURN VARCHAR2 IS ls_reg_no varchar2(40); as_fin_entity CHAR(10); BEGIN BEGIN SELECT fin_entity into as_fin_entity from site where site_code = as_site_code; if as_site_code = '99999' then Select reg_no into ls_reg_no from siteregno where site_code = '99999' and ref_code = as_ref_code and fin_entity = as_fin_entity; else BEGIN Select reg_no into ls_reg_no from siteregno where site_code = as_site_code and ref_code = as_ref_code and fin_entity = as_fin_entity; EXCEPTION when no_data_found then Select reg_no into ls_reg_no from siteregno where site_code = '99999' and ref_code = as_ref_code and fin_entity = as_fin_entity; END; end if; EXCEPTION when no_data_found then ls_reg_no := null; END; return ls_reg_no; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVALLOC_WORK_ORDER ON INV_ALLOCATE (WORK_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 10485760 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BACKGROUND_JOB_X ON BACKGROUND_JOB (JOB_ID, OBJ_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SECOND_ACTVT_APRV (as_emp_code char) return char is EMP_CODE_APRV char(10) ; as_report_to_second char(10); as_report_to_third char(10); a_count number(1); begin select report_to into as_report_to_second from employee where emp_code = (select report_to from employee where trim(emp_code) = trim(as_emp_code) ); SELECT COUNT(*) into a_count FROM EMPLOYEE WHERE trim(EMP_CODE)= trim(as_report_to_second) AND RELIEVE_DATE IS NULL; IF(a_count = 0 )then select report_to into as_report_to_third from employee where trim(emp_code) =trim(as_report_to_second); EMP_CODE_APRV :=as_report_to_third; ELSE EMP_CODE_APRV :=as_report_to_second; end if; return EMP_CODE_APRV; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAV_COUP_PURCH_X ON TRAV_COUP_PURCH (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_TRANDATE_FIN (ldate_fr in date,lsundry_code in char,lsundry_type in char,l_fin_entity in char,lacct_code in char) return number is lc_day_op_bal number(14,3); lc_prd_op_bal number(14,3); ls_prd char(6); ls_acct_prd char(6); ls_fr_date date; begin select code, acct_prd ,fr_date into ls_prd ,ls_acct_prd,ls_fr_date from period where ldate_fr between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and fin_entity = l_fin_entity and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Select nvl(Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)),0) into lc_day_op_bal from gltrace where fin_entity = l_fin_entity and tran_date >= ls_fr_date and tran_date < ldate_fr and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_USER_INFO (as_code char,as_flag char) return varchar2 is ls_flg varchar2(100); ls_code users.emp_code%type; ls_name users.name%type; ls_entity users.entity_code%type; ls_profile users.profile_id%type; begin select emp_code,name,entity_code,profile_id into ls_code,ls_name,ls_entity,ls_profile from users where code = as_code; IF as_flag = 'EMPCD' then ls_flg := ls_code; ElsIf as_flag = 'NAME' then ls_flg := ls_name; ElsIf as_flag = 'ENTITY' then ls_flg := ls_entity; ElsIf as_flag = 'PROFILE' then ls_flg := ls_profile; END IF; return ls_flg; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVALLOC_ITEM ON INV_ALLOCATE (ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 10485760 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NO_ART_UP (as_tran_id char, as_phy_attrib char,flag char) return number is as_no_art number (14,3); begin if flag='A' then if as_phy_attrib is not null then select sum(no_art) into as_no_art from porcpdet,item where porcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib); else select sum(no_art) into as_no_art from porcpdet,item where porcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 is null); end if ; elsif flag='B' then if as_phy_attrib is not null then select sum(no_art) into as_no_art from distord_issdet,item where distord_issdet.item_code =item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib ); else select sum(no_art) into as_no_art from distord_issdet,item where distord_issdet.item_code =item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 is null ); end if; elsif flag='C' then if as_phy_attrib is not null then select sum(no_art) into as_no_art from Distord_rcpdet ,item where Distord_rcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib ); else select sum(no_art) into as_no_art from Distord_rcpdet ,item where Distord_rcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 IS NULL); end if; end if; return as_no_art; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TRAN_NAME (AS_TRAN_CODE CHAR) RETURN CHAR IS AS_TRAN_NAME VARCHAR2(100); BEGIN SELECT TRAN_NAME INTO AS_TRAN_NAME FROM Transporter WHERE TRAN_CODE=AS_TRAN_CODE; RETURN AS_TRAN_NAME; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_MEET_UNI_I ON STRG_MEET (STRG_CODE, SALES_PERS, EVENT_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PORECP_DET_TRANFLOW (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); v_str_tmp5 varchar2(1000); v_str_tmp6 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.quantity ,b.rate ,b.discount ,(select sum(tax_amt) from taxtran t, tax tm where tm.tax_code = t.tax_code and tm.tax_type in ('G','H','I') and t.tran_code = 'P-RCP' and t.tran_id=as_tran_id) as gst_amt , (select sum(tax_amt) from taxtran t, tax tm where tm.tax_code = t.tax_code and tm.tax_type not in ('G','H','I') and t.tran_code = 'P-RCP' and t.tran_id=as_tran_id) as other_tax ,b.net_amt from item a ,porcpdet b where a.item_code = b.item_code and b.tran_id=as_tran_id and rownum <= 20; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4,v_str_tmp5,v_str_tmp6; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''||''||v_str_tmp5||''||''||v_str_tmp6||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity Received'||''||''||'Rate'||''||''||'Discount Amount'||''||''||'GST Amount'||''||''||'Others Tax and Charges'||''||''||'Net Amount'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_ITPROOF_PRESAVE (AS_TRAN_ID CHAR, AS_EMP_CODE__DECL CHAR, AS_DECL_TYPE CHAR, AS_QTR_NO CHAR, AS_OPT_TYPE CHAR, AS_LOGIN_EMP_CODE CHAR, AS_OBJ_NAME CHAR) RETURN VARCHAR2 IS LS_RETURN VARCHAR2(4000); LS_CONFIRMED EMP_ITDECL_HDR.CONFIRMED%TYPE; BEGIN LS_RETURN := ''; IF NVL(AS_DECL_TYPE,' ') = 'P' AND AS_TRAN_ID IS NOT NULL AND LENGTH(TRIM(AS_TRAN_ID)) > 0 THEN SELECT CONFIRMED INTO LS_CONFIRMED FROM EMP_ITDECL_HDR WHERE TRAN_ID = AS_TRAN_ID; IF LS_CONFIRMED IS NOT NULL AND LS_CONFIRMED = 'Y' THEN RETURN 'VTITPRFS15'; END IF; END IF; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STKREV1 ( ls_distorder in char,ls_qty in number, ls_rate in number) RETURN NUMBER is ls_siteship_fin site.fin_entity%type; ls_sitedlv_fin site.fin_entity%type; ls_site_fin site.fin_entity%type; lcrterm customer.cr_term%type; LS_VALUE NUMBER(14,3) := 0; ls_site__dlv char(5); ls_site_code char(5); BEGIN begin select site_code__ship, site_code__dlv into ls_site__dlv,ls_site_code from distorder where dist_order =ls_distorder; exception when others then ls_siteship_fin := '0'; end; begin select fin_entity into ls_sitedlv_fin from site where site_code =ls_site__dlv; exception when others then ls_sitedlv_fin := '0'; end; begin select fin_entity into ls_site_fin from site where site_code =ls_site_code; exception when others then ls_site_fin := '0'; end; if trim(ls_sitedlv_fin)= trim(ls_site_fin) then LS_VALUE:= 0 ; else LS_VALUE:= 100;--ls_qty * ls_rate; end if ; return LS_VALUE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SLPERS_APPL_FOR_SITE (as_salespers in SALES_PERS.SALES_PERS%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_SPERS'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from SITE_SALES_PERS where site_code = as_sitecode and SALES_PERS = as_salespers; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUPPLIER_NAME ( p_lot_no IN qc_Order.lot_no%TYPE, p_item_code IN qc_Order.item_code%TYPE ) RETURN VARCHAR2 IS v_supp_name supplier.supp_name%TYPE; v_supp_code varchar(10); BEGIN select v_supp_code into v_supp_code from qc_order where item_code=p_lot_no and lot_no=p_item_code; select v_supp_name into v_supp_name from supplier where supp_code=v_supp_code ; RETURN v_supp_name; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; WHEN TOO_MANY_ROWS THEN RETURN NULL; END fn_get_supplier_name; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RATE_TYPE ( p_tran_id IN VARCHAR2, p_line_no IN NUMBER ) RETURN VARCHAR2 IS v_rate_type VARCHAR2(50); BEGIN SELECT distinct taxtran.rate_type INTO v_rate_type FROM taxtran INNER JOIN tax ON TAXTRAN.TAX_CODE = TAX.TAX_CODE LEFT JOIN sreturndet ON taxtran.TRAN_ID = sreturndet.TRAN_ID AND taxtran.LINE_NO = FN_RCON_LINENO_NUM(sreturndet.line_no) AND NVL(sreturndet.ret_rep_flag, 'P') = 'R' WHERE trim(taxtran.TRAN_ID) = trim(p_tran_id) AND trim(taxtran.LINE_NO) = trim(p_line_no) AND TAXTRAN.TRAN_CODE = 'S-RET' AND tax.print_tax = 'Y' AND taxtran.tax_amt <> 0; RETURN v_rate_type; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROF_WSHEET_MSTDET_X ON PROF_WSHEET_MSTDET (HIER_KEY, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MAINTCD_DESCR ( as_maint_code char) return varchar2 is ls_maint_type varchar2(3); begin begin select maint_type into ls_maint_type from maintenance where maint_code = as_maint_code; exception when no_data_found then ls_maint_type := null; end; return ls_maint_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF__PRICELIST_SYMBOL (as_pricelist char,as_lotno char,as_itemcode char) return varchar is ls_sym varchar2(50); ls_lotno1 varchar2(10); ls_itemcode1 varchar2(10); ls_pricelist1 varchar2(5); ls_chgref varchar2(10); ls_var varchar2(300); begin select chg_ref_no into ls_chgref from pricelist where price_list =as_pricelist and pricelist.item_code = as_itemcode and as_lotno >= pricelist.lot_no__from and as_lotno <= pricelist.lot_no__to ; select var_value into ls_var from disparm where var_name = 'PRICELIST_STATUS'; if ls_chgref = 'MRP' and ls_var = 'Y' then ls_sym :='#'; else ls_sym := ' '; end if; return ls_sym; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PAYDET (as_refid char , as_type varchar2) return varchar2 is ls_return varchar2(200) ; ls_tran_id varchar2(50) ; ls_cancid varchar2(50) ; ldt_date date ; ld_amt decimal(14,3); ls_tran_id1 varchar2(50); ldt_date1 varchar2(200); ld_amt1 varchar2(200); ls_prd_qtr varchar2(200); ls_bank_acknow_ref varchar2(200); ls_prd_qtr1 varchar2(200) ; ls_bank_acknow_ref1 varchar2(200); cursor cur1 is select a.tran_id,b.tran_date,a.pay_amt,b.PRD_QTR, b.bank_acknow_ref from misc_paydet a,misc_payment b where a.tran_ser in ('M-VOUC','VOUCH','P-VOUC','DRNPAY','CRNPAY','CRNINV','P-IBCA','P-IBC1','P-IBC2', 'P-IBC3','P-IBC4','P-IBC5','P-IBC6','P-IBC7','P-IBC8','P-IBC9','RCVCN','RCVCN1', 'RCVCN2','RCVCN3','RCVCN4','RCVCN5') and a.vouch_no = as_refid and a.tran_id =b.tran_id and b.confirmed = 'Y' and a.tran_id not in (select c.payment_no from misc_payment_canc c where c.confirmed='Y' and c.payment_no =a.tran_id ); begin open cur1 ; loop fetch cur1 into ls_tran_id,ldt_date,ld_amt,ls_prd_qtr,ls_bank_acknow_ref ; exit when cur1%notfound; ls_tran_id1 := ls_tran_id1|| ls_tran_id||' |' ; ldt_date1 := ldt_date1||to_char(ldt_date)||' |'; ld_amt1 := ld_amt1||to_char(ld_amt)||' |'; ls_prd_qtr1 := ls_prd_qtr1||ls_prd_qtr||' |'; ls_bank_acknow_ref1 :=ls_bank_acknow_ref1 ||ls_bank_acknow_ref||' |'; end loop ; close cur1; if as_type ='T' then ls_return := ls_tran_id1 ; elsif as_type='D' then ls_return := to_char(ldt_Date1) ; elsif as_type='A' then ls_return := to_char(ld_amt1) ; elsif as_type ='Q' then ls_return := ls_prd_qtr1 ; elsif as_type ='R' then ls_return := ls_bank_acknow_ref1; end if ; IF ls_return IS NULL THEN ls_return := ' '; END IF ; return ls_return ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PUR_RET_TAX_PERC (as_tran_id taxtran.tran_id%type, as_line_no taxtran.line_no%type , as_tran_code taxtran.tran_code%type , as_tax_code taxtran.tax_code%type ) return decimal is ldec_excise taxtran.tax_perc%type; begin select nvl(tax_perc,0) into ldec_excise from taxtran where tran_id = as_tran_id and trim(line_no) = as_line_no /*Trim used as value contains space at lne no and tax code column in database*/ and tran_code = as_tran_code and trim(tax_code) like as_tax_code and rownum = 1; return ldec_excise; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DRCR_RCP_X ON DRCR_RCP (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DEALER ( ref_ser in char, ref_id in char, flag in char) return char is ls_dealer char(40); begin if ref_ser = 'S-DSP' and flag = 'C' then select cust_code into ls_dealer from despatch where desp_id = ref_id ; elsif ref_ser = 'S-DSP' and flag = 'N' then select customer.cust_name into ls_dealer from despatch, customer where despatch.desp_id = ref_id and despatch.cust_code = customer.cust_code ; elsif ref_ser = 'S-RET' and flag = 'C' then select cust_code into ls_dealer from sreturn where tran_id = ref_id ; elsif ref_ser = 'S-RET' and flag = 'N' then select customer.cust_name into ls_dealer from sreturn, customer where sreturn.tran_id = ref_id and sreturn.cust_code = customer.cust_code ; elsif (ref_ser = 'P-RCP' or ref_ser = 'P-RET') and flag = 'C' then select supp_code into ls_dealer from porcp where tran_id = ref_id; elsif (ref_ser = 'P-RCP' or ref_ser = 'P-RET') and flag = 'N' then select supplier.supp_name into ls_dealer from porcp, supplier where porcp.tran_id = ref_id and porcp.supp_code = supplier.supp_code; end if; return ls_dealer; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LEGAL_AGR_EXT_X ON LEGAL_AGR_EXT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE QC_ORDER_PACK AS -- TODO enter package declarations (types, exceptions, methods etc) here TYPE supp_row IS RECORD(supp_code varchar2(100),supp_name VARCHAR2(100),status char(1)); TYPE supp_rows IS TABLE OF supp_row; function get_porcpno(limitrows IN PLS_INTEGER,AS_PORCP_NO IN VARCHAR2) return supp_rows pipelined; END QC_ORDER_PACK; CREATE OR REPLACE PACKAGE BODY QC_ORDER_PACK IS function get_porcpno(limitrows IN PLS_INTEGER,AS_PORCP_NO IN VARCHAR2) return supp_rows pipelined AS starttime number := sys.dbms_utility.get_time; endtime number; m number; supp_rec supp_rows; type cur_lvl_idx_tab is ref cursor; v_cur_lvl_idx_tab cur_lvl_idx_tab; BEGIN -- DBMS_OUTPUT.PUT_LINE('started: ' ||starttime); open v_cur_lvl_idx_tab for SELECT DISTINCT P.SUPP_CODE__MNFR AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,ITM.STATUS AS STATUS FROM QC_ORDER Q, PORCPDET P,SUPPLIER G,ITEM I,ITEMMNFR ITM, SUPP_APPRV SHEADER ,PORCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND Q.ITEM_CODE=I.ITEM_CODE AND Q.ITEM_CODE=ITM.ITEM_CODE AND G.SUPP_CODE = ITM.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = ITM.SUPP_CODE__MNFR and P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = ITM.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='T' AND I.ITEM_CODE = ITM.ITEM_CODE AND Q.PORCP_NO=AS_PORCP_NO AND RCP.TRAN_ID=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MFG AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,ITM.STATUS AS STATUS FROM QC_ORDER Q, DISTORD_RCPDET P,SUPPLIER G,ITEM I,ITEMMNFR ITM, SUPP_APPRV SHEADER ,DISTORD_RCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND G.SUPP_CODE = ITM.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = ITM.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = ITM.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='T' AND Q.ITEM_CODE=I.ITEM_CODE AND Q.ITEM_CODE=ITM.ITEM_CODE AND RCP.TRAN_ID=AS_PORCP_NO AND I.ITEM_CODE = ITM.ITEM_CODE AND Q.PORCP_NO=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MNFR AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,VS.STATUS AS STATUS FROM QC_ORDER Q, PORCPDET P,SUPPLIER G,SITE S,SUPP_APPRV_SITE VS, SUPP_APPRV SHEADER ,PORCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND Q.SITE_CODE=S.SITE_CODE AND Q.SITE_CODE=VS.SITE_CODE AND G.SUPP_CODE = VS.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = VS.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = VS.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='S' AND RCP.TRAN_ID=AS_PORCP_NO AND S.SITE_CODE = VS.SITE_CODE AND Q.PORCP_NO=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MFG AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,VS.STATUS AS STATUS FROM QC_ORDER Q, DISTORD_RCPDET P,SUPPLIER G,SITE S,SUPP_APPRV_SITE VS, SUPP_APPRV SHEADER ,DISTORD_RCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND G.SUPP_CODE = VS.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = VS.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = VS.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='S' AND Q.SITE_CODE=S.SITE_CODE AND Q.SITE_CODE=VS.SITE_CODE AND RCP.TRAN_ID=AS_PORCP_NO AND S.SITE_CODE = VS.SITE_CODE AND Q.PORCP_NO=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MNFR AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,VS.STATUS AS STATUS FROM QC_ORDER Q, PORCPDET P,SUPPLIER G,SUPP_APPRV_SITE VS, SUPP_APPRV SHEADER ,PORCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND G.SUPP_CODE = VS.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = VS.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = VS.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='V' AND RCP.TRAN_ID=AS_PORCP_NO AND Q.PORCP_NO=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MFG AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,VS.STATUS AS STATUS FROM QC_ORDER Q, DISTORD_RCPDET P,SUPPLIER G,SUPP_APPRV_SITE VS, SUPP_APPRV SHEADER ,DISTORD_RCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND G.SUPP_CODE = VS.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = VS.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = VS.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='V' AND RCP.TRAN_ID=AS_PORCP_NO AND Q.PORCP_NO=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MNFR AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,ITM.STATUS AS STATUS FROM QC_ORDER Q, PORCPDET P,SUPPLIER G,ITEM I,SITE S,SUPP_APPRV_ITEM ITM, SUPP_APPRV SHEADER ,PORCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND Q.ITEM_CODE=I.ITEM_CODE AND Q.ITEM_CODE=ITM.ITEM_CODE AND Q.SITE_CODE=S.SITE_CODE AND Q.SITE_CODE=ITM.SITE_CODE AND G.SUPP_CODE = ITM.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MNFR = ITM.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = ITM.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='I' AND I.ITEM_CODE = ITM.ITEM_CODE AND S.SITE_CODE = ITM.SITE_CODE AND RCP.TRAN_ID=AS_PORCP_NO AND Q.PORCP_NO=AS_PORCP_NO UNION SELECT DISTINCT P.SUPP_CODE__MFG AS SUPP_CODE, G.SUPP_NAME AS SUPP_NAME,ITM.STATUS AS STATUS FROM QC_ORDER Q, DISTORD_RCPDET P,SUPPLIER G,ITEM I,SITE S,SUPP_APPRV_ITEM ITM, SUPP_APPRV SHEADER ,DISTORD_RCP RCP WHERE G.SUPP_CODE = SHEADER.SUPP_CODE__MNFR AND G.SUPP_CODE = ITM.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = SHEADER.SUPP_CODE__MNFR AND P.SUPP_CODE__MFG = ITM.SUPP_CODE__MNFR AND P.TRAN_ID = RCP.TRAN_ID AND SHEADER.SUPP_CODE__MNFR = ITM.SUPP_CODE__MNFR AND SHEADER.APPRV_SCOPE='I' AND Q.ITEM_CODE=I.ITEM_CODE AND Q.ITEM_CODE=ITM.ITEM_CODE AND I.ITEM_CODE = ITM.ITEM_CODE AND Q.SITE_CODE=S.SITE_CODE AND Q.SITE_CODE=ITM.ITEM_CODE AND S.SITE_CODE = ITM.SITE_CODE AND RCP.TRAN_ID=AS_PORCP_NO AND Q.PORCP_NO=AS_PORCP_NO; loop fetch v_cur_lvl_idx_tab BULK COLLECT INTO supp_rec limit limitrows; EXIT WHEN supp_rec.COUNT = 0; for i in supp_rec.first .. supp_rec.last loop exit when supp_rec.count=0; pipe row(supp_rec(i)); end loop; end loop; CLOSE v_cur_lvl_idx_tab; endtime := sys.dbms_utility.get_time; -- DBMS_OUTPUT.Put_line('end: ' || endtime); -- this bit returns the elapsed difference in hundreths of a second m := mod ( ((endtime-starttime)+power(2,32)), power(2,32) ); dbms_output.put_line('Start: '||to_char(starttime)); dbms_output.put_line('End: '||to_char(endtime)); dbms_output.put_line('Mod: '||to_char(m)); -- return v_cur_lvl_idx_tab; END get_porcpno; END QC_ORDER_PACK ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUM_SPRSROUTE (as_sales_pers in char) return number is as_sum_cust number(14); begin select nvl(sum(no_cust_type1),0)+nvl(sum(no_cust_type2),0)+nvl(sum(no_cust_type3),0) into as_sum_cust from sprs_route where sprs_code=as_sales_pers; return as_sum_cust; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_EMP_QUALIFICATION (AS_EMP_CODE CHAR) return varchar2 is a_qual_det varchar2(500); a_count number(13) := 0; cursor c1 is select b.sh_descr descr from empqual a,qualification b where a.emp_code = AS_EMP_CODE and a.qlf_code = b.qlf_code order by a.seq_no; begin for i in c1 loop a_count := a_count + 1; if (a_count = 1) then a_qual_det := a_qual_det || i.descr; else a_qual_det := a_qual_det || ', ' || i.descr; end if; end loop; return a_qual_det; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFF_DOC_NOTMET_MST force AS OBJECT ( SC_CODE VARCHAR2(30), DR_NAME VARCHAR2(120), SPECIALITY VARCHAR2(120), PLANNED_VISIT NUMBER(4), CLASS_DESCR VARCHAR2(60), CATEGORY VARCHAR2(60), LOCALITY VARCHAR2(120), ROUTE_TYPE VARCHAR2(60), LAST_VISIT_DT VARCHAR2(60), VISIT_SINCE NUMBER(4), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), DIVISION VARCHAR2(30), EMP_CODE VARCHAR2(30), EMP_NAME VARCHAR2(50), HEAD_QUAT VARCHAR2(50), DESIGN VARCHAR2(30) ); -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083820 ON COURSE_CHAPTERS (COURSE_CHAPTER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDIFF_DATES (ARG1 DATE , ARG2 DATE) RETURN NUMBER IS RET_DATE NUMBER; BEGIN RET_DATE := TO_DATE(ARG1) - TO_DATE(ARG2); RETURN RET_DATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CREATE_PRIM (ls_tname varchar2) return varchar2 is ls_prim varchar2(500) ; begin declare cursor c1 ( ls_tname varchar2 ,ls_const varchar2 )is select column_name from user_cons_columns where table_name = UPPER(ls_tname) and constraint_name = UPPER(ls_const) order by position ; ls_col varchar2(255); ls_const varchar2(100); ctr number ; begin select constraint_name into ls_const from user_constraints where table_name = upper(ls_tname) and CONSTRAINT_TYPE = 'P' ; open c1(ls_tname ,ls_const); ls_prim:='' ; loop fetch c1 into ls_col ; exit when c1%notfound ; ls_prim := ls_prim || ls_col || ' , ' ; end loop ; close c1; return(substr(ls_prim,1,length(rtrim(ls_prim)) - 2)); end ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITE_CODE__MFG (as_item_code in char) return char is ls_site_code__mfg char(5); ls_descr char(60); ls_city char(20); begin select site_code into ls_site_code__mfg from item where item_code = as_item_code; select sh_descr,city into ls_descr,ls_city from site where site_code = ls_site_code__mfg; return(ls_site_code__mfg || ' '|| ls_descr ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_SPRS_EMP (msales_pers in char, memp_code in char, msp_type in char) return number is ls_retval varchar2(1) := 0; begin if msp_type <> 'E' then ls_retval := '1'; elsif msales_pers = memp_code and msp_type ='E' then ls_retval := '1'; else ls_retval := '0'; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SMPL_CRTYP ( LR_NO VARCHAR ) RETURN CHAR is CREATE_TYPE CHAR ( 1 ) ; begin select case when COALESCE ( LENGTH ( TRIM ( LR_NO ) ), 0 )=0 then 'I' else 'F' end into CREATE_TYPE from dual; RETURN CREATE_TYPE ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_YEARLY_SALES_FLASH (an_divisor in number,as_custcode_fr in varchar2,as_custcode_to in varchar2,as_itemser_fr in varchar2,as_itemser_to in varchar2,adt_fr in date,adt_to in date,as_invacct in varchar2, as_sites in varchar2, as_ref_ser in char ) return number is is_ret_val number(15,3); order_val number(15,3); pend_val number(15,3); sret_val number(15,3); inv_val number(15,3); rcpamt number(15,3); collamt number(15,3); outamt number(15,3); salespers number(15,3); net_inv_val number(15,3); gr_collamt number(15,3); dishnr number(15,3); begin if as_ref_ser = 'S-INV' THEN SELECT sum(NVL(A.cm_inv_val,0))/ an_divisor into is_ret_val FROM ( SELECT INVDET.QUANTITY__stduom * INVDET.RATE__stduom cm_inv_val FROM INVOICE, INVDET WHERE ( INVOICE.INVOICE_ID = INVDET.INVOICE_ID ) and ( INVOICE.TRAN_DATE >= adt_fr ) AND ( INVOICE.TRAN_DATE <= adt_to ) AND ( INVOICE.SITE_CODE IN ( as_sites)) AND ( INVOICE.ITEM_SER >= as_itemser_fr ) AND ( INVOICE.ITEM_SER <= as_itemser_to ) AND ( INVOICE.CUST_CODE >= as_custcode_fr) AND ( INVOICE.CUST_CODE <= as_custcode_to) AND (INVOICE.CONFIRMED = 'Y') ) A ; ELSIF as_ref_ser = 'S-RET' then SELECT sum(NVL(A.cm_sret_val,0))/ an_divisor INTO is_ret_val FROM ( SELECT DECODE(RET_OPT,'C',1,'D',-1) * (SRETURNDET.QUANTITY * SRETURNDET.RATE) cm_sret_val FROM SRETURN, SRETURNDET WHERE ( SRETURN.TRAN_ID = SRETURNDET.TRAN_ID ) and ( SRETURN.TRAN_DATE >= adt_fr ) AND ( SRETURN.TRAN_DATE <= adt_to ) AND ( SRETURN.SITE_CODE IN ( as_sites)) AND ( SRETURN.ITEM_SER >= as_itemser_fr ) AND ( SRETURN.ITEM_SER <= as_itemser_to ) AND ( SRETURN.CUST_CODE >= as_custcode_fr) AND ( SRETURN.CUST_CODE <= as_custcode_to) AND (SRETURN.RET_OPT IN ('C','D')) AND (SRETURN.CONFIRMED = 'Y') UNION ALL select (decode(MISC_DRCR_RCP.TRAN_SER,'MDRCRC',1,'MDRCRD',-1) * MISC_DRCR_RDET.AMOUNT) cm_SRET_VAL from MISC_DRCR_RDET, MISC_DRCR_RCP where MISC_DRCR_RCP.TRAN_ID = MISC_DRCR_RDET.TRAN_ID and ( MISC_DRCR_RCP.TRAN_DATE >= adt_fr ) AND ( MISC_DRCR_RCP.TRAN_DATE <= adt_to ) AND ( MISC_DRCR_RCP.SITE_CODE IN ( as_sites)) AND ( nvl(MISC_DRCR_RCP.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(MISC_DRCR_RCP.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( MISC_DRCR_RCP.SUNDRY_CODE >= as_custcode_fr) AND ( MISC_DRCR_RCP.SUNDRY_CODE <= as_custcode_to) AND ( instr(MISC_DRCR_RDET.ACCT_CODE, as_invacct) > 0) AND ( MISC_DRCR_RCP.CONFIRMED = 'Y') AND ( MISC_DRCR_RCP.SUNDRY_TYPE = 'C') ) A ; elsif as_ref_ser = 'MRCP' then SELECT sum(NVL(A.cm_rcpamt,0))/ an_divisor rcpamt into is_ret_val FROM ( select (decode(MISC_DRCR_RCP.TRAN_SER,'MDRCRC',1,'MDRCRD',-1) * MISC_DRCR_RDET.AMOUNT) cm_rcpamt from MISC_DRCR_RDET, MISC_DRCR_RCP where MISC_DRCR_RCP.TRAN_ID = MISC_DRCR_RDET.TRAN_ID and ( MISC_DRCR_RCP.TRAN_DATE >= adt_fr ) AND ( MISC_DRCR_RCP.TRAN_DATE <= adt_to ) AND ( MISC_DRCR_RCP.SITE_CODE IN ( as_sites)) AND ( nvl(MISC_DRCR_RCP.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(MISC_DRCR_RCP.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( MISC_DRCR_RCP.SUNDRY_CODE >= as_custcode_fr) AND ( MISC_DRCR_RCP.SUNDRY_CODE <= as_custcode_to) AND ( instr(MISC_DRCR_RDET.ACCT_CODE, as_invacct) <= 0) AND ( MISC_DRCR_RCP.CONFIRMED = 'Y') AND ( MISC_DRCR_RCP.SUNDRY_TYPE = 'C') ) A ; elsif as_ref_ser = 'COL' THEN SELECT sum(NVL(A.cm_gr_collamt,0))/ an_divisor gr_collamt INTO is_ret_val FROM ( SELECT RCPDET.RCP_AMT cm_gr_collamt FROM RECEIPT, RCPDET, RECEIVABLES WHERE (RECEIPT.TRAN_ID = RCPDET.TRAN_ID) and (RCPDET.REF_SER = RECEIVABLES.TRAN_SER ) AND (RCPDET.REF_NO = RECEIVABLES.REF_NO ) AND ( RECEIPT.TRAN_DATE >= adt_fr ) AND ( RECEIPT.TRAN_DATE <= adt_to ) AND ( RECEIPT.SITE_CODE IN ( as_sites)) AND ( nvl(receivables.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(receivables.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( RECEIVABLES.CUST_CODE >= as_custcode_fr) AND ( RECEIVABLES.CUST_CODE <= as_custcode_to) AND (RECEIPT.CONFIRMED = 'Y') UNION ALL SELECT ((RECEIVABLES.TOT_AMT) * -1) cm_gr_collamt FROM RECEIVABLES WHERE (RECEIVABLES.TRAN_SER = 'R-ADV') AND ( RECEIVABLES.REF_DATE >= adt_fr ) AND ( RECEIVABLES.REF_DATE <= adt_to ) AND ( RECEIVABLES.SITE_CODE IN ( as_sites)) AND ( nvl(receivables.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(receivables.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( RECEIVABLES.CUST_CODE >= as_custcode_fr) AND ( RECEIVABLES.CUST_CODE <= as_custcode_to) UNION ALL SELECT MISC_RECEIPT.NET_AMT cm_gr_collamt FROM MISC_RECEIPT, MISC_RCPDET, ITEM, CUSTOMER WHERE ( MISC_RECEIPT.TRAN_ID = MISC_RCPDET.TRAN_ID ) and ( MISC_RECEIPT.ITEM_SER = ITEM.ITEM_SER ) AND ( MISC_RECEIPT.TRAN_DATE >= adt_fr ) AND ( MISC_RECEIPT.TRAN_DATE <= adt_to ) AND ( MISC_RECEIPT.SITE_CODE IN ( as_sites)) AND ( nvl(MISC_RECEIPT.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(MISC_RECEIPT.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( MISC_RECEIPT.CONFIRMED = 'Y' ) AND (( ( MISC_RECEIPT.SUNDRY_TYPE__FOR = 'C') and ( MISC_RECEIPT.SUNDRY_CODE__FOR = customer.cust_code ) AND ( MISC_RECEIPT.SUNDRY_CODE__FOR >= as_custcode_fr ) AND ( MISC_RECEIPT.SUNDRY_CODE__FOR <= as_custcode_to ) ) OR ( ( MISC_RCPDET.SUNDRY_TYPE = 'C') and ( MISC_RCPDET.LINE_NO = 1 ) and ( MISC_RCPDET.SUNDRY_CODE = customer.cust_code ) AND ( MISC_RCPDET.SUNDRY_CODE >= as_custcode_fr ) AND ( MISC_RCPDET.SUNDRY_CODE <= as_custcode_to ) )) ) A ; ELSIF as_ref_ser = 'DHNR' then SELECT sum(NVL(A.cm_dishnr,0))/ an_divisor dishnr into is_ret_val FROM ( SELECT RCPDET.RCP_AMT cm_dishnr FROM RCPDISHNR, RECEIPT, RCPDET, RECEIVABLES WHERE ( RECEIPT.TRAN_ID = RCPDISHNR.RECEIPT_NO) AND ( RECEIPT.TRAN_ID = RCPDET.TRAN_ID) and ( RCPDET.REF_SER = RECEIVABLES.TRAN_SER ) AND ( RCPDET.REF_NO = RECEIVABLES.REF_NO ) AND ( RCPDISHNR.TRAN_DATE >= adt_fr ) AND ( RCPDISHNR.TRAN_DATE <= adt_to ) AND ( RCPDISHNR.SITE_CODE IN ( as_sites)) AND ( nvl(receivables.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(receivables.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( RECEIVABLES.CUST_CODE >= as_custcode_fr) AND ( RECEIVABLES.CUST_CODE <= as_custcode_to) AND ( RCPDISHNR.CONFIRMED = 'Y') UNION ALL SELECT (RECEIVABLES.TOT_AMT * -1 ) cm_dishnr FROM RCPDISHNR, RECEIVABLES WHERE ( RCPDISHNR.RECEIPT_NO = RECEIVABLES.REF_NO) AND ( RECEIVABLES.TRAN_SER = 'R-ADV' ) AND ( RCPDISHNR.TRAN_DATE >= adt_fr ) AND ( RCPDISHNR.TRAN_DATE <= adt_to ) AND ( RCPDISHNR.SITE_CODE IN ( as_sites)) AND ( nvl(receivables.item_ser, RPAD('00',5)) >= rpad( as_itemser_fr,5) ) AND ( nvl(receivables.item_ser, RPAD('ZZ ',5)) <= rpad( as_itemser_to,5) ) AND ( RECEIVABLES.CUST_CODE >= as_custcode_fr) AND ( RECEIVABLES.CUST_CODE <= as_custcode_to) AND ( RCPDISHNR.CONFIRMED = 'Y') ) A ; END IF; return NVL(is_ret_val,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ENTITY_CODE (po_number varchar2) RETURN Employee.Emp_Code%type IS ref_id1 varchar2(10) := po_number; max_line_no number:=0 ; last_appr_emp_code Employee.Emp_Code%type := ''; BEGIN Select Entity_Code , Max(Line_No) Into Last_Appr_Emp_Code , Max_Line_No from obj_sign_trans where TRIM(ref_id) = TRIM(ref_id1) and ref_Ser = 'P-ORD' and sign_status = 'S' and line_no = (select max(line_no) from obj_sign_trans where TRIM(ref_id) = TRIM(ref_id1) ) GROUP BY entity_code ; Return last_appr_emp_code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_DET_TCS (ls_tran_code in char, ls_tran_id in char, ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; --as_line_no char(3); lc_exch_rate number(17,6); begin begin select (','||rtrim(var_value)||',') into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; end if; -- tax % if ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 AND TAX_AMT <>0 ; end if; exception when no_data_found then lc_tax_amt := 0 ; end ; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER AUDIT_ALLWDEDN after insert or update or delete on ALLWDEDN_BKP for each row declare time_now date; terminal char(10); userid char(10); begin time_now := sysdate; terminal := userenv('terminal'); if inserting then insert into audit_table values (audit_seq.nextval, user, terminal, time_now, 'ALLWDEDN', 'insert', :new.AD_CODE); else if deleting then insert into audit_table values (audit_seq.nextval, user, terminal, time_now, 'ALLWDEDN', 'delete', :old.AD_CODE); insert into audit_table_values values (audit_seq.currval, 'ACCT_CODE__SAL', :old.ACCT_CODE__SAL, '' ); insert into audit_table_values values (audit_seq.currval, 'AD_CODE', :old.AD_CODE, '' ); insert into audit_table_values values (audit_seq.currval, 'BAL_OPT', :old.BAL_OPT, '' ); insert into audit_table_values values (audit_seq.currval, 'BASE_FORMULA', :old.BASE_FORMULA, '' ); insert into audit_table_values values (audit_seq.currval, 'CCTR_CODE__SAL', :old.CCTR_CODE__SAL, '' ); insert into audit_table_values values (audit_seq.currval, 'COST_COMPANY', :old.COST_COMPANY, '' ); insert into audit_table_values values (audit_seq.currval, 'DESCR', :old.DESCR, '' ); insert into audit_table_values values (audit_seq.currval, 'DROP_YN', :old.DROP_YN, '' ); insert into audit_table_values values (audit_seq.currval, 'FOR_CONDN', :old.FOR_CONDN, '' ); insert into audit_table_values values (audit_seq.currval, 'IT_PROJ', :old.IT_PROJ, '' ); insert into audit_table_values values (audit_seq.currval, 'IT_SECTION', :old.IT_SECTION, '' ); insert into audit_table_values values (audit_seq.currval, 'MAX_VAL', :old.MAX_VAL, '' ); insert into audit_table_values values (audit_seq.currval, 'MIN_VAL', :old.MIN_VAL, '' ); insert into audit_table_values values (audit_seq.currval, 'PAYABLE', :old.PAYABLE, '' ); insert into audit_table_values values (audit_seq.currval, 'PAY_TAX', :old.PAY_TAX, '' ); insert into audit_table_values values (audit_seq.currval, 'POST_YN', :old.POST_YN, '' ); insert into audit_table_values values (audit_seq.currval, 'PROP_ON', :old.PROP_ON, '' ); insert into audit_table_values values (audit_seq.currval, 'PROP_YN', :old.PROP_YN, '' ); insert into audit_table_values values (audit_seq.currval, 'PRT_SEQ', :old.PRT_SEQ, '' ); insert into audit_table_values values (audit_seq.currval, 'RES_FORMULA', :old.RES_FORMULA, '' ); insert into audit_table_values values (audit_seq.currval, 'RND_OFF', :old.RND_OFF, '' ); insert into audit_table_values values (audit_seq.currval, 'RND_TO', to_char(:old.RND_TO), '' ); insert into audit_table_values values (audit_seq.currval, 'SEQ_NO', :old.SEQ_NO, '' ); insert into audit_table_values values (audit_seq.currval, 'SH_DESCR', :old.SH_DESCR, '' ); insert into audit_table_values values (audit_seq.currval, 'SLAB_FORMULA', :old.SLAB_FORMULA, '' ); insert into audit_table_values values (audit_seq.currval, 'SLAB_OPTION', :old.SLAB_OPTION, '' ); insert into audit_table_values values (audit_seq.currval, 'SPLIT_YN', :old.SPLIT_YN, '' ); insert into audit_table_values values (audit_seq.currval, 'SQL_EXPR', :old.SQL_EXPR, '' ); insert into audit_table_values values (audit_seq.currval, 'SQL_INPUT', :old.SQL_INPUT, '' ); insert into audit_table_values values (audit_seq.currval, 'TAUTH_CODE', :old.TAUTH_CODE, '' ); insert into audit_table_values values (audit_seq.currval, 'TYPE', :old.TYPE, '' ); else insert into audit_table values (audit_seq.nextval, user, terminal, time_now, 'ALLWDEDN', 'update', :old.AD_CODE); if updating ('ACCT_CODE__SAL') then insert into audit_table_values values (audit_seq.currval, 'ACCT_CODE__SAL', :old.ACCT_CODE__SAL, :new.ACCT_CODE__SAL); end if; if updating ('AD_CODE') then insert into audit_table_values values (audit_seq.currval, 'AD_CODE', :old.AD_CODE, :new.AD_CODE); end if; if updating ('BAL_OPT') then insert into audit_table_values values (audit_seq.currval, 'BAL_OPT', :old.BAL_OPT, :new.BAL_OPT); end if; if updating ('BASE_FORMULA') then insert into audit_table_values values (audit_seq.currval, 'BASE_FORMULA', :old.BASE_FORMULA, :new.BASE_FORMULA); end if; if updating ('CCTR_CODE__SAL') then insert into audit_table_values values (audit_seq.currval, 'CCTR_CODE__SAL', :old.CCTR_CODE__SAL, :new.CCTR_CODE__SAL); end if; if updating ('COST_COMPANY') then insert into audit_table_values values (audit_seq.currval, 'COST_COMPANY', :old.COST_COMPANY, :new.COST_COMPANY); end if; if updating ('DESCR') then insert into audit_table_values values (audit_seq.currval, 'DESCR', :old.DESCR, :new.DESCR); end if; if updating ('DROP_YN') then insert into audit_table_values values (audit_seq.currval, 'DROP_YN', :old.DROP_YN, :new.DROP_YN); end if; if updating ('FOR_CONDN') then insert into audit_table_values values (audit_seq.currval, 'FOR_CONDN', :old.FOR_CONDN, :new.FOR_CONDN); end if; if updating ('IT_PROJ') then insert into audit_table_values values (audit_seq.currval, 'IT_PROJ', :old.IT_PROJ, :new.IT_PROJ); end if; if updating ('IT_SECTION') then insert into audit_table_values values (audit_seq.currval, 'IT_SECTION', :old.IT_SECTION, :new.IT_SECTION); end if; if updating ('MAX_VAL') then insert into audit_table_values values (audit_seq.currval, 'MAX_VAL', :old.MAX_VAL, :new.MAX_VAL); end if; if updating ('MIN_VAL') then insert into audit_table_values values (audit_seq.currval, 'MIN_VAL', :old.MIN_VAL, :new.MIN_VAL); end if; if updating ('PAYABLE') then insert into audit_table_values values (audit_seq.currval, 'PAYABLE', :old.PAYABLE, :new.PAYABLE); end if; if updating ('PAY_TAX') then insert into audit_table_values values (audit_seq.currval, 'PAY_TAX', :old.PAY_TAX, :new.PAY_TAX); end if; if updating ('POST_YN') then insert into audit_table_values values (audit_seq.currval, 'POST_YN', :old.POST_YN, :new.POST_YN); end if; if updating ('PROP_ON') then insert into audit_table_values values (audit_seq.currval, 'PROP_ON', :old.PROP_ON, :new.PROP_ON); end if; if updating ('PROP_YN') then insert into audit_table_values values (audit_seq.currval, 'PROP_YN', :old.PROP_YN, :new.PROP_YN); end if; if updating ('PRT_SEQ') then insert into audit_table_values values (audit_seq.currval, 'PRT_SEQ', :old.PRT_SEQ, :new.PRT_SEQ); end if; if updating ('RES_FORMULA') then insert into audit_table_values values (audit_seq.currval, 'RES_FORMULA', :old.RES_FORMULA, :new.RES_FORMULA); end if; if updating ('RND_OFF') then insert into audit_table_values values (audit_seq.currval, 'RND_OFF', :old.RND_OFF, :new.RND_OFF); end if; if updating ('RND_TO') then insert into audit_table_values values (audit_seq.currval, 'RND_TO', to_char(:old.RND_TO), to_char(:new.RND_TO)); end if; if updating ('SEQ_NO') then insert into audit_table_values values (audit_seq.currval, 'SEQ_NO', :old.SEQ_NO, :new.SEQ_NO); end if; if updating ('SH_DESCR') then insert into audit_table_values values (audit_seq.currval, 'SH_DESCR', :old.SH_DESCR, :new.SH_DESCR); end if; if updating ('SLAB_FORMULA') then insert into audit_table_values values (audit_seq.currval, 'SLAB_FORMULA', :old.SLAB_FORMULA, :new.SLAB_FORMULA); end if; if updating ('SLAB_OPTION') then insert into audit_table_values values (audit_seq.currval, 'SLAB_OPTION', :old.SLAB_OPTION, :new.SLAB_OPTION); end if; if updating ('SPLIT_YN') then insert into audit_table_values values (audit_seq.currval, 'SPLIT_YN', :old.SPLIT_YN, :new.SPLIT_YN); end if; if updating ('SQL_EXPR') then insert into audit_table_values values (audit_seq.currval, 'SQL_EXPR', :old.SQL_EXPR, :new.SQL_EXPR); end if; if updating ('SQL_INPUT') then insert into audit_table_values values (audit_seq.currval, 'SQL_INPUT', :old.SQL_INPUT, :new.SQL_INPUT); end if; if updating ('TAUTH_CODE') then insert into audit_table_values values (audit_seq.currval, 'TAUTH_CODE', :old.TAUTH_CODE, :new.TAUTH_CODE); end if; if updating ('TYPE') then insert into audit_table_values values (audit_seq.currval, 'TYPE', :old.TYPE, :new.TYPE); end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_PDP before insert or update on pdc_given referencing old as old new as new FOR EACH ROW declare refno pdc_given.ref_NO%type; refno1 pdc_given.ref_NO%type; begin refno := trim(:new.ref_no); select Replace(translate(trim(refno),'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into refno1 from dual; if (refno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in reference number [' || refno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_PDR before insert or update on pdc_received referencing old as old new as new FOR EACH ROW declare refno pdc_received.ref_NO%type; refno1 pdc_received.ref_NO%type; begin refno := trim(:new.ref_no); select Replace(translate(trim(refno),'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into refno1 from dual; if (refno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in reference number [' || refno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CUST_APPL_FOR_LOGINSITE (as_custcode in customer.cust_code%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_CUST'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then select count(1) into ll_count from site_customer where site_code = as_sitecode and cust_code = as_custcode; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN ls_retval;-- (ll_count); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_MRPTAB_I ON MRPBOMITEMS (ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_PRICE_LIST_NEW (As_Item_Code Char,As_Unit Char,As_Lot_No Char, As_Site_Code Char,As_Trandate Date,As_Cust_Code Char) RETURN NUMBER IS AS_PRICE_LIST NUMBER(12,3); BEGIN SELECT PRICELIST.RATE INTO AS_PRICE_LIST FROM PRICELIST WHERE PRICELIST.ITEM_CODE= as_item_code --AND PRICELIST.UNIT= as_unit And (As_Lot_No Between Pricelist.Lot_No__From And Pricelist.Lot_No__To) And trim(Pricelist.Price_List) = 'AIPTR' --AND PRICELIST.PRICE_LIST=TRIM(AS_STATE_CODE)||'PTR' AND AS_TRANDATE BETWEEN PRICELIST.EFF_FROM AND PRICELIST.VALID_UPTO; Return As_Price_List; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_MPR_VACANCY ON MPR_VACANCY (MPR_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INCIDENT_SITE_CODE ON INCIDENT (SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_SUPPBNK_ACTIVE BEFORE INSERT or UPDATE ON supplier_bank referencing old as old new as new FOR EACH ROW DECLARE BEGIN if :new.active_yn is null then :new.active_yn := 'Y'; if :new.confirmed is null then :new.confirmed := 'Y'; end if; if :new.eff_from is null then :new.eff_from := trunc(sysdate); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_AT_TRANID ON AUDIT_TRAIL (TRAN_ID, CHG_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE VISTEMGRDARMASTERTABLE AS TABLE OF visteMGRDARMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_UDTT_SITEINFOCHNG ( AS_SITE_CODE SITE_INFO_CHANGE.SITE_CODE%TYPE, AD_ASON_DATE DATE ) RETURN UDT_SITE_INFO_CHANGE PIPELINED IS OUT_REC UDTT_SITE_INFO_CHANGE := UDTT_SITE_INFO_CHANGE( NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); LS_DESCR SITE_INFO_CHANGE.DESCR%TYPE; LS_ADD1 SITE_INFO_CHANGE.ADD1%TYPE ; LS_ADD2 SITE_INFO_CHANGE.ADD2%TYPE ; LS_ADD3 SITE_INFO_CHANGE.ADD3%TYPE ; LS_CITY SITE_INFO_CHANGE.CITY%TYPE ; LS_PIN SITE_INFO_CHANGE.PIN%TYPE ; LS_STATE_CODE SITE_INFO_CHANGE.STATE_CODE%TYPE ; LS_TELE1 SITE_INFO_CHANGE.TELE1%TYPE ; LS_TELE2 SITE_INFO_CHANGE.TELE2%TYPE ; LS_TELE3 SITE_INFO_CHANGE.TELE3%TYPE ; LS_STAN_CODE SITE_INFO_CHANGE.STAN_CODE%TYPE ; LS_STAN_DESCR STATION.DESCR%TYPE ; LS_STATE_DESCR STATE.DESCR%TYPE ; LS_COUNT_CODE STATE.COUNT_CODE%TYPE; LS_COUNT_DESCR VARCHAR2(40); LI_CNT NUMBER(6); BEGIN LI_CNT := 0; SELECT COUNT(1) INTO LI_CNT FROM SITE_INFO_CHANGE WHERE SITE_CODE = AS_SITE_CODE AND EFF_DATE <= AD_ASON_DATE; IF LI_CNT > 0 THEN SELECT A.DESCR AS DESCR, A.ADD1 AS ADD1, A.ADD2 AS ADD2, A.ADD3 AS ADD3, A.CITY AS CITY, A.PIN AS PIN, A.STATE_CODE AS STATE_CODE, A.TELE1 AS TELE1, A.TELE2 AS TELE2, A.TELE3 AS TELE3, A.STAN_CODE AS STAN_CODE, B.DESCR AS STAN_DESCR, C.DESCR AS STATE_DESCR, C.COUNT_CODE AS COUNT_CODE, TRIM(D.DESCR) AS COUNT_DESCR INTO LS_DESCR, LS_ADD1, LS_ADD2, LS_ADD3, LS_CITY, LS_PIN, LS_STAN_CODE, LS_TELE1, LS_TELE2, LS_TELE3, LS_STATE_CODE, LS_STAN_DESCR, LS_STATE_DESCR, LS_COUNT_CODE, LS_COUNT_DESCR FROM SITE_INFO_CHANGE A, STATION B, STATE C , COUNTRY D WHERE A.SITE_CODE = AS_SITE_CODE AND EFF_DATE = (SELECT MAX(EFF_DATE) FROM SITE_INFO_CHANGE WHERE SITE_CODE = AS_SITE_CODE) AND A.STAN_CODE = B.STAN_CODE (+) AND A.STATE_CODE = C.STATE_CODE (+) AND C.COUNT_CODE = D.COUNT_CODE (+) AND ROWNUM = 1; ELSE SELECT A.DESCR AS DESCR, A.ADD1 AS ADD1, A.ADD2 AS ADD2, A.ADD3 AS ADD3, A.CITY AS CITY, A.PIN AS PIN, A.STATE_CODE AS STATE_CODE, A.TELE1 AS TELE1, A.TELE2 AS TELE2, A.TELE3 AS TELE3, A.STAN_CODE AS STAN_CODE, B.DESCR AS STAN_DESCR, C.DESCR AS STATE_DESCR, C.COUNT_CODE AS COUNT_CODE, D.DESCR AS COUNT_DESCR INTO LS_DESCR, LS_ADD1, LS_ADD2, LS_ADD3, LS_CITY, LS_PIN, LS_STAN_CODE, LS_TELE1, LS_TELE2, LS_TELE3, LS_STATE_CODE, LS_STAN_DESCR, LS_STATE_DESCR, LS_COUNT_CODE, LS_COUNT_DESCR FROM SITE A, STATION B, STATE C , COUNTRY D WHERE A.SITE_CODE = AS_SITE_CODE AND A.STAN_CODE = B.STAN_CODE (+) AND A.STATE_CODE = C.STATE_CODE (+) AND C.COUNT_CODE = D.COUNT_CODE (+); END IF; OUT_REC.DESCR := LS_DESCR; OUT_REC.ADD1 := LS_ADD1; OUT_REC.ADD2 := LS_ADD2; OUT_REC.ADD3 := LS_ADD3; OUT_REC.CITY := LS_CITY; OUT_REC.STATE_CODE := LS_STATE_CODE; OUT_REC.STAN_CODE := LS_STAN_CODE; OUT_REC.TELE1 := LS_TELE1; OUT_REC.TELE2 := LS_TELE2; OUT_REC.TELE3 := LS_TELE3; OUT_REC.STAN_DESCR := LS_STAN_DESCR; OUT_REC.STATE_DESCR := LS_STATE_DESCR; OUT_REC.COUNT_CODE := LS_COUNT_CODE; OUT_REC.COUNT_DESCR := LS_COUNT_DESCR; pipe row ( out_rec ); RETURN ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_PF_CALC (AS_PRD_CODE char,AS_EMP_CODE char,AS_PRD_CODE_ACC char,AS_AD_CODE char,AS_PROC_TYPE char,AS_AMOUNT number,AS_BASE_MAX number, AS_EFPF_ELIG number) return number is a_amount payrolldet.amount%type := 0; a_base_value payrolldet.amount%type; a_amt payrolldet.amount%type; a_prev_amt payrolldet.amount%type; a_prev_base payrolldet.amount%type; begin if (AS_AD_CODE = 'EFPF1') then if (AS_PROC_TYPE = 'PY') then select nvl(sum(amount),0) into a_amt from arreardet where emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE and ad_code = AS_AD_CODE; a_base_value := a_amt; if (a_base_value >= AS_BASE_MAX) then a_base_value := 0; else if (a_base_value + AS_AMOUNT <= AS_BASE_MAX) then a_base_value := AS_AMOUNT; else a_base_value := AS_BASE_MAX - a_base_value; end if; end if; elsif (AS_PROC_TYPE = 'AR') then select nvl(sum(amount),0) into a_amt from payrolldet where prd_code = AS_PRD_CODE_ACC and emp_code = AS_EMP_CODE and ad_code = AS_AD_CODE; a_base_value := a_amt; select nvl(sum(amount),0) into a_amt from arreardet where prd_code != AS_PRD_CODE and emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE_ACC and ad_code = AS_AD_CODE; a_base_value := a_base_value + a_amt; select sum(amt) into a_amt from ( select nvl(sum(a.base_amt),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code in ('PF','PF1','PF3') and b.voucher_no is not null union all select nvl(sum(a.diff_base_amt),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code in ('PF','PF1','PF3') and b.voucher_no is not null ); if (a_base_value >= AS_BASE_MAX) then a_base_value := 0; else if (a_base_value + (AS_AMOUNT - a_amt) <= AS_BASE_MAX) then a_base_value := (AS_AMOUNT - a_amt); else a_base_value := AS_BASE_MAX - a_base_value; end if; end if; elsif (AS_PROC_TYPE = 'PP') then if (AS_AMOUNT <= AS_BASE_MAX) then a_base_value := AS_AMOUNT; else a_base_value := AS_BASE_MAX; end if; end if; a_amount := a_base_value * AS_EFPF_ELIG; elsif (AS_AD_CODE = 'EFPF2') then if (AS_PROC_TYPE = 'AR') then select sum(amt) into a_amt from ( select nvl(sum(a.base_amt),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'EFPF' and b.voucher_no is not null union all select nvl(sum(a.diff_base_amt),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'EFPF' and b.voucher_no is not null ); a_amount := AS_AMOUNT + a_amt; else a_amount := AS_AMOUNT; end if; elsif (AS_AD_CODE = 'EFPF') then if (AS_PROC_TYPE = 'PY') then select nvl(sum(amount),0) into a_amt from arreardet where emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE and ad_code = 'EFPF1'; a_base_value := a_amt; elsif (AS_PROC_TYPE = 'AR') then select nvl(sum(amount),0) into a_amt from payrolldet where prd_code = AS_PRD_CODE_ACC and emp_code = AS_EMP_CODE and ad_code = 'EFPF1'; a_base_value := a_amt; select nvl(sum(amount),0) into a_amt from arreardet where prd_code != AS_PRD_CODE and emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE_ACC and ad_code = 'EFPF1'; a_base_value := a_base_value + a_amt; elsif (AS_PROC_TYPE = 'PP') then a_base_value := 0; end if; a_base_value := a_base_value + AS_AMOUNT; a_base_value := round(a_base_value * AS_BASE_MAX / 100); if (AS_PROC_TYPE = 'PY') then select nvl(sum(diff_amt),0) into a_amt from arreardet where emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE and ad_code = AS_AD_CODE; a_base_value := a_base_value - a_amt; elsif (AS_PROC_TYPE = 'AR') then select nvl(sum(amount),0) into a_amt from payrolldet where prd_code = AS_PRD_CODE_ACC and emp_code = AS_EMP_CODE and ad_code = AS_AD_CODE; a_base_value := a_base_value - a_amt; select nvl(sum(diff_amt),0) into a_amt from arreardet where prd_code != AS_PRD_CODE and emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE_ACC and ad_code = AS_AD_CODE; a_base_value := a_base_value - a_amt; end if; if (AS_PROC_TYPE = 'AR') then select sum(amt) into a_amt from ( select nvl(sum(a.amount),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null union all select nvl(sum(a.diff_amt),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null ); else a_amt := 0; end if; a_amount := a_base_value + a_amt; elsif (AS_AD_CODE = 'PF3I') then if (AS_PROC_TYPE = 'PY') then select nvl(sum(diff_base_amt),0) into a_amt from arreardet where emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE and ad_code in ('PF','PF1','PF3'); a_amount := round(AS_AMOUNT + a_amt) - a_amt; if (a_amount < 0) then a_amount := 0; end if; elsif (AS_PROC_TYPE = 'AR') then select sum(amt) into a_base_value from ( select nvl(sum(base_amt),0) amt from payrolldet where prd_code = AS_PRD_CODE_ACC and emp_code = AS_EMP_CODE and ad_code in ('PF','PF1','PF3') union all select nvl(sum(diff_base_amt),0) amt from arreardet where prd_code != AS_PRD_CODE and emp_code = AS_EMP_CODE and prd_code__acc = AS_PRD_CODE_ACC and ad_code in ('PF','PF1','PF3') ); select sum(prev_amt) into a_prev_amt from ( select nvl(sum(a.amount),0) prev_amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null union all select nvl(sum(a.diff_amt),0) prev_amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null ); a_amount := round(a_base_value + (AS_AMOUNT - a_prev_amt)) - a_base_value + a_prev_amt; if (a_amount < a_prev_amt) then a_amount := a_prev_amt; end if; elsif (AS_PROC_TYPE = 'PP') then a_amount := round(AS_AMOUNT); if (a_amount < 0) then a_amount := 0; end if; end if; elsif (AS_AD_CODE = 'PF3') then if (AS_PROC_TYPE = 'PY') then select nvl(sum(a.diff_base_amt*b.amount/100),0),nvl(sum(a.diff_amt),0) into a_base_value,a_amt from arreardet a,arreardet b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.emp_code = AS_EMP_CODE and a.prd_code__acc = AS_PRD_CODE and a.ad_code = AS_AD_CODE and b.ad_code = 'PFPER' and b.amount = b.prev_amt; a_amount := round(a_base_value + (AS_AMOUNT * AS_BASE_MAX / 100)) - a_amt; elsif (AS_PROC_TYPE = 'AR') then select sum(amt) into a_amt from ( select nvl(sum(a.amount),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'PFPER' and b.voucher_no is not null union all select nvl(sum(a.diff_amt),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'PFPER' and b.voucher_no is not null ); if (AS_BASE_MAX != a_amt) then select sum(amt) into a_amt from ( select nvl(sum(a.amount),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null union all select nvl(sum(a.diff_amt),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null ); a_amount := round((AS_AMOUNT * AS_BASE_MAX / 100) - a_amt) + a_amt; else select sum(base_value),sum(amt) into a_base_value,a_amt from ( select nvl(sum(a.diff_base_amt*b.amount/100),0) base_value,nvl(sum(a.diff_amt),0) amt from arreardet a,arreardet b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code != AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.prd_code__acc = AS_PRD_CODE_ACC and a.ad_code = AS_AD_CODE and b.ad_code = 'PFPER' and b.amount = b.prev_amt union all select nvl(sum(a.base_amt*b.amount/100),0) base_value,nvl(sum(a.amount),0) amt from payrolldet a,payrolldet b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE_ACC and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.ad_code = 'PFPER' ); select sum(prev_amt),sum(prev_base) into a_prev_amt,a_prev_base from ( select nvl(sum(a.amount),0) prev_amt,nvl(sum(a.base_amt),0) prev_base from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null union all select nvl(sum(a.diff_amt),0) prev_amt,nvl(sum(a.diff_base_amt),0) prev_base from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null ); a_amount := round(a_base_value + ((AS_AMOUNT - a_prev_base) * AS_BASE_MAX / 100)) - a_amt + a_prev_amt; end if; elsif (AS_PROC_TYPE = 'PP') then a_amount := round(AS_AMOUNT * AS_BASE_MAX / 100); end if; elsif (AS_AD_CODE = 'PF3A') then if (AS_PROC_TYPE = 'AR') then a_amount := ROUND(AS_AMOUNT * AS_BASE_MAX / 100); select sum(amt) into a_amt from ( select nvl(sum(a.amount),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'PF3' and b.voucher_no is not null union all select nvl(sum(a.diff_amt),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'PF3' and b.voucher_no is not null ); if (a_amount > a_amt) then a_amount := a_amt; end if; end if; elsif (AS_AD_CODE = 'EFPFA') then if (AS_PROC_TYPE = 'AR') then a_amount := ROUND(AS_AMOUNT * AS_BASE_MAX / 100); select sum(prev_amt),sum(amt) into a_prev_amt,a_amt from ( select nvl(sum(case a.ad_code when 'EPF' then a.amount else 0 end),0) prev_amt,nvl(sum(case a.ad_code when 'EFPF' then a.amount else 0 end),0) amt from payrolldet a,payroll b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code in ('EPF','EFPF') and b.voucher_no is not null union all select nvl(sum(case a.ad_code when 'EPF' then a.diff_amt else 0 end),0) prev_amt,nvl(sum(case a.ad_code when 'EFPF' then a.diff_amt else 0 end),0) amt from arreardet a,arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc = a.prd_code__acc and a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code in ('EPF','EFPF') and b.voucher_no is not null ); if ((AS_EFPF_ELIG - a_amount) > a_prev_amt) then a_amount := a_amount + (AS_EFPF_ELIG - a_amount - a_prev_amt); end if; if (a_amount > a_amt) then a_amount := a_amt; end if; end if; end if; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FT_BENEFIT_APPLDET_X ON FT_BENEFIT_APPLDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_UPD_PORCP_PASSWD BEFORE INSERT ON PORCP FOR EACH ROW BEGIN :NEW.CONF_PASSWD := NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FUNDTRANSFR_HDR_X ON FUNDTRANSFER_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RET_DISC_AMT (as_purcorder in char) return varchar is ls_stringval varchar2(200); ls_line_no porddet.line_no%type ; lc_amt number(14,3) ; lc_discount porddet.discount%type ; ll_line_ord_cnt number(6,0); ll_disc_cnt number(6,0); ls_ret_amt varchar2(200); begin ls_ret_amt := ' ' ; select count(*) into ll_line_ord_cnt from porddet where purc_order = as_purcorder; if ll_line_ord_cnt > 0 then select min(line_no) into ls_line_no from porddet where purc_order = as_purcorder ; select nvl(discount,0) into lc_discount from porddet where purc_order = as_purcorder and line_no = ls_line_no; if (lc_discount is not null) and (lc_discount > 0) then select count(*) into ll_disc_cnt from porddet where purc_order = as_purcorder and discount = lc_discount ; if ll_line_ord_cnt = ll_disc_cnt then select sum((nvl(quantity,0) * nvl(rate,0) * nvl(discount,0)) / 100) into lc_amt from porddet where purc_order = as_purcorder ; ls_ret_amt := to_char(lc_amt,'99999990.00') ; else ls_ret_amt := ' ' ; end if; end if; end if; return ls_ret_amt ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_ALLOC_DET_ITEM_LOTNO_EXP ON INV_ALLOC_DET (ITEM_CODE, LOT_NO, EXP_LEV, DEALLOCATED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TOKEN ( as_string CHAR, as_sep CHAR) RETURN VARCHAR2 IS ls_string VARCHAR2(500) := as_string; ls_retstr VARCHAR2(100); li_pos NUMBER; BEGIN li_pos := instr(ls_string,as_sep); IF li_pos = 0 THEN ls_retstr := ls_string; ls_string := ''; ELSE ls_retstr := SUBSTR(ls_string,1,li_pos -1); ls_string := SUBSTR(ls_string,li_pos ,LENGTH(ls_string)); END IF; RETURN ls_retstr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SEXDESCR ( AS_SC_CODE CHAR) RETURN CHAR IS SEX_DESCR VARCHAR2(40); SEX_VALUE varchar2(40); BEGIN SELECT SEX INTO SEX_VALUE FROM STRG_CUSTOMER WHERE SC_CODE = AS_SC_CODE; SELECT DISTINCT DESCR INTO SEX_DESCR FROM GENCODES WHERE MOD_NAME='W_WSFA_STRG_CUSTOMER' AND FLD_NAME='SEX' AND FLD_VALUE= SEX_VALUE; RETURN SEX_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCP_SUPP_DC ON PORCP (SUPP_CODE, DC_NO, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_MPS_SITEITEM ON MPS_ORDER (SITE_CODE, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_WORDER_RCP (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PALLET_COUNT (ls_desp_id VARCHAR2) RETURN NUMBER IS ls_cnt_tot NUMBER(10); ls_pack_instr varchar(100); li_instr NUMBER(10) ; li_min NUMBER(10) ; li_max NUMBER(10); li_tot NUMBER(10); li_stot NUMBER(10); li_disc NUMBER(10); TYPE cur_pallet IS REF CURSOR; BEGIN li_stot :=0; li_tot :=0; li_max :=0; li_min :=0; DECLARE CURSOR cur_pallet IS select distinct pack_instr from despatchdet where desp_id in (ls_desp_id) and instr(pack_instr,'-') > 0; BEGIN FOR i IN cur_pallet LOOP ls_pack_instr := (i.pack_instr); select instr(pack_instr,'-') into li_instr from despatchdet where desp_id = ls_desp_id AND pack_instr = ls_pack_instr; SELECT substr(pack_instr,2,INSTR(pack_instr,'-')-2),substr(pack_instr,INSTR(pack_instr,'-')+2) into li_min,li_max from despatchdet where desp_id = ls_desp_id AND pack_instr = ls_pack_instr; li_tot := li_max - li_min + 1; li_stot := li_stot + li_tot; END LOOP; END; select count(distinct pack_instr) into li_disc from despatchdet where desp_id = ls_desp_id and instr(pack_instr,'-') = 0; ls_cnt_tot := li_stot + li_disc; RETURN (ls_cnt_tot); EXCEPTION WHEN NO_DATA_FOUND THEN ls_cnt_tot := 0; RETURN ls_cnt_tot; WHEN OTHERS THEN ls_cnt_tot := 0; RETURN ls_cnt_tot; END DDF_GET_PALLET_COUNT; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_AMD_ITEM_X ON SALES_QUOT_AMD_ITEM (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_FREIGHT_VOUCH_AMT (MINV_ID IN CHAR, MINV_DATE IN DATE, MSITE IN CHAR, MFRT_TYPE IN CHAR) RETURN NUMBER IS MAMT NUMBER(14,3) := 0; BEGIN IF MFRT_TYPE = 'F' THEN SELECT ROUND(SUM(MISC_VOUCHDET.AMOUNT), 0) INTO MAMT FROM MISC_VOUCHER, MISC_VOUCHDET WHERE MISC_VOUCHER.TRAN_DATE >= MINV_DATE AND MISC_VOUCHER.SITE_CODE = MSITE AND MISC_VOUCHER.CONFIRMED = 'Y' AND TRIM(MISC_VOUCHER.ORDER_REF) = MINV_ID AND MISC_VOUCHDET.TRAN_ID = MISC_VOUCHER.TRAN_ID AND MISC_VOUCHDET.ACCT_CODE = '3484'; ELSIF MFRT_TYPE = 'L' THEN SELECT ROUND(SUM(MISC_VOUCHDET.AMOUNT), 0) INTO MAMT FROM MISC_VOUCHER, MISC_VOUCHDET WHERE MISC_VOUCHER.TRAN_DATE >= MINV_DATE AND MISC_VOUCHER.SITE_CODE = MSITE AND MISC_VOUCHER.CONFIRMED = 'Y' AND TRIM(MISC_VOUCHER.ORDER_REF) = MINV_ID AND MISC_VOUCHDET.TRAN_ID = MISC_VOUCHER.TRAN_ID AND MISC_VOUCHDET.ACCT_CODE IN ('3485', '3022', '3023', '3028'); END IF; RETURN MAMT; EXCEPTION WHEN OTHERS THEN RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX POREF_ADV_OS ON MISC_PAYABLES (TRAN_SER, PURC_ORDER, SITE_CODE, TOT_AMT, ADJ_AMT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CONV_QTY (msite_code in varchar, tran_type in varchar, mwork_order in varchar,mtran_id in varchar,mdate in date) return varchar is as_var varchar(1000); begin select case when coalesce(stock.conv__qty_stduom,0) <> 1 then stock.unit__alt || ' = ' || '( '|| (coalesce(workorder_issdet.quantity,0) + coalesce(workorder_issdet.potency_adj,0)) || ' / ' || round(coalesce(stock.conv__qty_stduom,0),3) || ' = ' || round( case when (case when fn_SUBSTR(lower(rtrim(workorder_bill.item_code__ref)),fn_length(rtrim(workorder_bill.item_code__ref)) - 3, 4) = '-rec' then 'YES' else 'NO' end) = 'NO' then (workorder_issdet.quantity + workorder_issdet.potency_adj)/(case when stock.conv__qty_stduom = 0 then 1 else stock.conv__qty_stduom end) else (workorder_issdet.quantity + workorder_issdet.potency_adj) * stock.conv__qty_stduom end , 3) || ' )' else '' end into as_var FROM workorder_iss , workorder_issdet left outer join stock on ( workorder_issdet.item_code = stock.item_code ) and ( workorder_issdet.loc_code = stock.loc_code ) and ( workorder_issdet.lot_no = stock.lot_no ) and ( workorder_issdet.lot_sl = stock.lot_sl ) , workorder_bill WHERE workorder_iss.tran_id = workorder_issdet.tran_id and workorder_iss.site_code = stock.site_code and workorder_iss.work_order = workorder_bill.work_order and workorder_iss.operation = workorder_bill.operation and workorder_issdet.exp_lev = workorder_bill.exp_lev and workorder_iss.site_code = msite_code and workorder_iss.tran_type = tran_type and workorder_iss.work_order = mwork_order and workorder_iss.tran_id = mtran_id and workorder_iss.tran_date = mdate and rownum = 1; RETURN as_var; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RATE_GROSS_RATE ( as_site stock.site_code%type, as_item stock.item_code%type, as_loc stock.loc_code%type, as_lot stock.lot_no%type, as_option char ) return number is ll_rate stock.rate%type; begin if as_option = 'G' then begin select nvl(gross_rate,0) into ll_rate from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and rownum = 1; end; else begin select nvl(rate,0) into ll_rate from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and rownum = 1; end; end if; return ll_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TAXABLEVALUE_INV_EXCH ( as_curr_code char,as_order_date date, as_eff_date date) RETURN number is ls_ret_perc number(14,6); begin IF as_order_date is not null then select exch_rate__buy into ls_ret_perc from daily_exch_rate_sell_buy where as_order_date between from_date and to_date and curr_code = as_curr_code; else select exch_rate__buy into ls_ret_perc from daily_exch_rate_sell_buy where as_eff_date between from_date and to_date and curr_code = as_curr_code; end if; return ls_ret_perc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01031: insufficient privileges -- CREATE OR REPLACE TRIGGER DT_SOTYPE_ADD BEFORE INSERT ON SORDERTYPE referencing old as old new as new FOR EACH ROW declare ldt_excutdate date; BEGIN raise_application_error( -20601, 'Item Series addition not allowed and it depends on other configuration'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082542 ON SF_PLAN_PARAM (PARAM_TABLE, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_FREQUENCY_OF_VISIT ( P_STRG_CODE CHAR, P_MONTH VARCHAR2, P_YEAR VARCHAR2 ) RETURN NUMBER IS V_COUNT NUMBER ; BEGIN select count(*) as frequency_of_visit INTO V_COUNT from strg_meet sm inner join strg_customer sc on sm.strg_code = sc.sc_code inner join sales_pers sp on sm.sales_pers = sp.sales_pers where sm.event_date between trunc(to_date(P_MONTH||P_YEAR,'MONYYYY'),'MON') AND last_day(to_date(P_MONTH ||P_YEAR,'MONYYYY')) and sm.strg_code=P_STRG_CODE ; RETURN V_COUNT; END FN_FREQUENCY_OF_VISIT; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CONFIRMED_BY (ls_refser in char, ls_refid in char) return char is ls_user char(10); begin ls_user := ' '; select chg_user into ls_user from gltrace where ref_ser = ls_refser and ref_id = ls_refid and rownum = 1; return ls_user; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DO_LOC_CODE__CONS (as_dist_order in char,as_dist_iss_loc_code in char) return char is ls_loc_code__cons char(8); begin SELECT case when LOC_CODE__CONS is null then as_dist_iss_loc_code else LOC_CODE__CONS end into ls_loc_code__cons from distorder where dist_order = as_dist_order; return ls_loc_code__cons; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX JOBEMP_X ON JOBEMP (JOB_ID, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE SP_STOCK_PLAN is begin delete from stock_plan; commit; insert into stock_plan (site_code, item_code, loc_code, inv_stat, quantity, alloc_qty) select site_code, item_code, loc_code, inv_stat, quantity, alloc_qty from stock_summary where quantity <> 0 ; update stock_plan set alloc_qty = 0 where alloc_qty <> 0 ; commit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_QC_LOCATION (as_qorder_no in char,AS_LOCODE IN CHAR,AS_LOCODE_APPR IN CHAR,AS_QTY_PASSED IN NUMBER,as_item_code in char,as_item_code_new in char,as_lot_no in char,as_lot_no_new in char) return varchar2 is ls_sitecode site.site_code%type; ls_bomcOde bom.bom_code%type; ll_count number(6,0) := 0; ls_retval varchar2(1) := '0'; BY_count number(6,0) := 0; LL_RECcount number(6,0) := 0; MQTY NUMBER(6,0) :=0; mloc char(15); mlocaprv char(15); begin if (AS_LOCODE is NOT NULL AND AS_LOCODE_APPR IS NOT NULL AND AS_QTY_PASSED>0 and as_item_code=as_item_code_new and as_lot_no=as_lot_no_new) then SELECT LOC_CODE,LOC_CODE__APRV INTO MLOC,MLOCAPRV FROM QC_ORDER WHERE QORDER_NO=AS_QORDER_NO; select (count(distinct inv_stat)) INTO LL_COUNT from location where loc_code in (MLOC,MLOCAPRV); if LL_COUNT=1 then ls_retval:= 1; else ls_retval:= 0; end if; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_VOUCHRCP_TRAN_ID (as_tran_id varchar2) return varchar2 is ls_tran_id varchar2(4000); begin begin select listagg(prcp_id, ',') within group (order by tran_id) into ls_tran_id from (select distinct prcp_id, tran_id from vouchrcp where tran_id = as_tran_id) group by tran_id; exception when no_data_found then ls_tran_id := null; end; return ls_tran_id; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LAST_COMM_DATE (p_sorg_code CHAR, p_cont_code CHAR default null) RETURN DATE AS last_comm_date DATE; BEGIN SELECT max(cc.comm_date) INTO last_comm_date FROM contact_comm cc, STRG_CUSTOMER SC WHERE CC.STRG_CODE = CASE WHEN TRIM(p_cont_code) IS NULL THEN CC.STRG_CODE ELSE p_cont_code END AND SC.SC_CODE = CC.STRG_CODE AND NVL(SC.SORG_CODE,'*') = CASE WHEN TRIM(p_sorg_code) IS NULL THEN NVL(SC.SORG_CODE,'*') ELSE p_sorg_code END ORDER BY cc.comm_date DESC, cc.comm_id DESC; RETURN last_comm_date; END DDF_LAST_COMM_DATE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALC_CHRG_AMT (as_charg_type in char, as_rate_factor in number, base_rate in number, saleable_area in number ) return number is sub_amount number(14,3); begin begin if as_charg_type='F' then sub_amount := as_rate_factor*saleable_area; elsif as_charg_type='P' then sub_amount :=((as_rate_factor * base_rate)/100)*(saleable_area); elsif as_charg_type='U' then sub_amount :=as_rate_factor*saleable_area; else sub_amount :=0.0; end if; exception when no_data_found then sub_amount := 0; end; return sub_amount ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INVOICE_CHK BEFORE INSERT OR UPDATE OF confirmed ON invoice referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_detcount number(3) := 0; lc_hdrdr number(17,3) := 0; lc_hdrcr number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; ll_despcount number(3) := 0; ls_diffstr varchAR2(20); lc_limit number(14,3) := 1.0 ; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_detcount from invdet where invoice_id = :new.invoice_id and net_amt <> 0; exception when others then ll_detcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'S-INV' and ref_id = :new.invoice_id; exception when others then ll_glcount := 0; end; if ll_glcount = 0 and ll_detcount > 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_detcount) || '] invoice detail rows exists' ); end if; -- 2. check header DR, CR and gltrace DR, CR begin --select net_amt into lc_hdrdr from invoice --where invoice_id = :new.invoice_id; lc_hdrdr := :new.net_amt; exception when others then lc_hdrdr := 0; end; begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'S-INV' and ref_id = :new.invoice_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; begin select var_value into ls_diffstr from finparm where prd_code = '999999' and var_name = 'COIN_DIFF_LIMIT'; exception when others then ls_diffstr := '1.0'; end; lc_limit := to_number(ls_diffstr); if lc_hdrdr <> 0 and abs(lc_gldr - lc_glcr) > lc_limit then ---1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; -- 18-dec-2018 manoharan check all the despatchdet.status become 'I' begin select count(1) into ll_despcount from despatchdet where case when status is null then ' ' else status end <> 'I' and desp_id = :new.desp_id; exception when others then ll_despcount := 0; end; if ll_despcount > 0 then raise_application_error( -20601, to_char(ll_despcount) || '] Despatch line items having blank status instead of I for deapatch [' || :new.desp_id || ']' ); end if; -- end 18-dec-2018 manoharan end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INT_CALC (AS_SCHEME_TYPE char,AS_EMP_CODE char,AS_LOAN_TYPE char,AS_ACCT_PRD char,AS_MIN_LOANAMT number) return number is cursor c1 is select a.loan_no,a.loan_amt,a.date__interest,a.interest,a.start_reco,a.int_term,a.issue_date from loans a,loan_scheme b where a.scheme_no = b.scheme_no and a.emp_code = AS_EMP_CODE and (a.status = 'A' or a.loan_no in (select c.loan_no from loan_reg c,acctprd d where a.loan_no = c.loan_no and c.tran_date between d.fr_date and d.to_date and d.code = AS_ACCT_PRD)) and a.start_dedn = 'Y' and instr(AS_SCHEME_TYPE,rtrim(b.scheme_type)) > 0; acct_date_fr date; acct_date_to date; acct_date_fr1 date; a_start_date date; a_relieve_date date; lc_calc_int number(14,2) := 0; lc_calc_int1 number(14,2):= 0; lc_calc_int2 number(14,2):= 0; lc_loan_amt NUMBER(14,3) := 0; diff_rate_int NUMBER(5,2) := 0; lc_recovered number(12,2) := 0; lc_balance number(12,2) := 0; lc_dedn number(12,2) := 0; li_lineno number(3) := 0; a_loan_years number(2); ls_intadd char(1); ls_calbase char(1); ls_days_month number(2); ls_prd char(6); ls_max_prd char(6); a_base_int ad_slabs.amount%type; begin begin select relieve_date into a_relieve_date from employee where emp_code = AS_EMP_CODE; select fr_date,to_date into acct_date_fr,acct_date_to from acctprd where code = AS_ACCT_PRD; acct_date_fr1 := acct_date_fr; select nvl(max(prd_code),' ') into ls_max_prd from payroll where emp_code = AS_EMP_CODE and voucher_no is not null; for i in c1 loop lc_loan_amt := lc_loan_amt + i.loan_amt; end loop; if (lc_loan_amt > AS_MIN_LOANAMT) then for i in c1 loop diff_rate_int := 0; lc_calc_int2 := 0; -- Added by vishal on 13-Jul-2011 for different base interest rate, based on year of loan completion and loan amount select min(date__from) into a_start_date from loans_interest_det where loan_no = i.loan_no; if (a_start_date is null) then select max(c.tran_date) into a_start_date from payr_voucher a,misc_paydet b,misc_payment c where c.tran_id = b.tran_id and a.emp_code = AS_EMP_CODE and a.ref_no = i.loan_no and a.tran_type = 'LN' and b.tran_ser = 'P-VOUC' and b.vouch_no = a.tran_id and c.confirmed = 'Y' and c.tran_id || b.vouch_no not in (select d.payment_no || e.vouch_no from misc_payment_canc d,misc_payment_cancdet e where d.payment_no = c.tran_id and e.tran_id = d.tran_id and e.tran_ser = b.tran_ser and e.vouch_no = b.vouch_no and d.confirmed = 'Y'); end if; if (a_start_date is null) then a_start_date := i.issue_date; end if; a_loan_years := ceil(months_between(acct_date_to,(a_start_date-1))/12); -- Defination in ad_slabs table for slab to be as follows -- first character in slab_no field will be for the type of loan i.e. 1 for housing, 2 for car, etc. value is passed to the function i.e. AS_LOAN_TYPE -- Financial year wise defination to be done through effective and expiry date -- loan amount checking to be done in min_base_amt and max_base_amt -- no of years of the loan to be checked in min_amt and max_amt. Years will be calculated financial year wise -- percentage of base interest rate is stored in amount field select nvl(sum(amount),0) into a_base_int from ad_slabs where ad_code = 'ITINT' and substr(slab_no,1,1) = AS_LOAN_TYPE and acct_date_to between eff_date and exp_date and i.loan_amt between min_base_amt and max_base_amt and a_loan_years between min_amt and max_amt; -- End of Added by vishal on 13-Jul-2011 for different base interest rate, based on year of loan completion and loan amount if (a_base_int > i.interest) then diff_rate_int := a_base_int - i.interest; end if; select nvl(sum(nvl(amount,0)),0) into lc_recovered from loan_reg where loan_no = i.loan_no and tran_date < acct_date_fr; lc_balance := i.loan_amt - lc_recovered; select cal_base into ls_calbase from interestterm where int_term = i.int_term; ls_intadd := 'N'; if (ls_calbase = 'E') then ls_intadd := 'Y'; end if; while (acct_date_fr <= acct_date_to) loop lc_calc_int1 := 0; select code,(case when a_relieve_date is not null and a_relieve_date between fr_date and to_date then (a_relieve_date-fr_date+1) else (to_date-fr_date+1) end) into ls_prd,ls_days_month from period where acct_date_fr between fr_date and to_date; if (acct_date_fr <= i.date__interest) then -- changed by vishal on 25-jan-2010 -- select nvl(sum(nvl(amount,0)),0) into lc_recovered from loan_reg where loan_no = i.loan_no and tran_date < acct_date_fr; select nvl(sum(nvl(amount,0)),0) into lc_recovered from loan_reg where loan_no = i.loan_no and tran_date <= (select to_date from period where code = ls_prd); lc_balance := i.loan_amt - lc_recovered; declare cursor int_det is select no_days,amount,int_perc from loans_interest_det where loan_no = i.loan_no and prd_code = ls_prd; begin for j in int_det loop diff_rate_int := a_base_int - nvl(j.int_perc,0); if (diff_rate_int > 0) then lc_calc_int := lc_calc_int + round(nvl((j.amount * diff_rate_int / 100 / 365 * j.no_days),0),2); end if; end loop; exception when no_data_found then ls_prd := null; end; else if (acct_date_fr >= i.start_reco) and (lc_balance > 0) and (diff_rate_int > 0) and (a_relieve_date is null or a_relieve_date >= acct_date_fr) then -- changed by vishal on 29-jan-2010 for calculating interest on no. of days -- lc_calc_int1 := round((lc_balance * diff_rate_int/100/12),2); lc_calc_int1 := round((lc_balance * diff_rate_int / 100 / 365 * ls_days_month),2); if ls_prd <= ls_max_prd then select nvl(sum(nvl(amount,0)),0) into lc_recovered from loan_reg where loan_no = i.loan_no and tran_date <= (select to_date from period where code = ls_prd); lc_balance := i.loan_amt - lc_recovered; else -- changed by vishal on 29-jan-2010 for calculating interest on no. of days -- lc_calc_int2 := round((lc_balance * i.interest/100/12),2); lc_calc_int2 := round((lc_balance * i.interest / 100 / 365 * ls_days_month),2); select min(line_no) into li_lineno from loans_schedule where loan_no = i.loan_no and (no_inst <> no_inst_ded or no_inst is null); begin select amount into lc_dedn from loans_schedule where loan_no = i.loan_no and line_no = li_lineno; exception when no_data_found then select mon_inst into lc_dedn from loans where loan_no = i.loan_no; end; if (ls_intadd = 'Y') then lc_dedn := lc_dedn - lc_calc_int2; end if; if (lc_dedn > lc_balance) then lc_dedn := lc_balance; end if; lc_balance := lc_balance - lc_dedn; end if; end if; end if; acct_date_fr := add_months(acct_date_fr,1); lc_calc_int := lc_calc_int + lc_calc_int1; end loop; acct_date_fr := acct_date_fr1; end loop; end if; exception when no_data_found then lc_calc_int := 0; end; return lc_calc_int; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SITEITEM_PLAN ON SITEITEM (ITEM_CODE, SITE_CODE__PLAN, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SOLVANT_STAGE ( as_tranid expr_hdr.expr_no%type, as_qtytyp char, as_opr expr_bill.operation%type ) return number is ll_solvant number; ls_itemcd expr_bill.item_code%type; ls_grpcd item.grp_code%type; ls_varval mfgparm.var_value%type; begin select var_value into ls_varval from mfgparm where prd_code = '999999' and var_name = 'SOLVENT_GRP' ; if as_qtytyp = 'Q' then select nvl(sum(a.qty_per_unit),0) into ll_solvant from expr_bill a,item b where a.item_code = b.item_code and a.expr_no = as_tranid and a.operation <= as_opr and instr( ls_varval,b.grp_code) > 0 ; else select nvl(sum( A.quantity__alt + (A.quantity__alt * A.over_perc /100) + A.potency_adj ),0) into ll_solvant from expr_bill a,item b where a.item_code = b.item_code and a.expr_no = as_tranid and a.operation <= as_opr and instr( ls_varval,b.grp_code) > 0 ; end if; return ll_solvant; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NONPAYABLE_TAXCODE (as_taxcode tax.tax_code%type ) return varchar2 is ls_non_payable tax.non_payable%type; begin select nvl(non_payable,'N') into ls_non_payable from tax where tax_code = as_taxcode; return ls_non_payable; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CADRE_DESCR ON CADRE (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_SCHM_ITEM (AS_DESPID IN CHAR) RETURN NUMBER AS AS_VAR_VAL VARCHAR2(10); CNT number(10) := 0; ll_soitemcnt number := 0; ll_despcnt number := 0; BEGIN begin SELECT COUNT(*) INTO CNT from DISPARM where var_name='PLSCHM_ITEM'; exception when others then CNT := 0; end; if CNT = 0 then return 1; end if; for cur_refno in ( select distinct sord_no,line_no__sord from despatchdet where desp_id = AS_DESPID ) loop begin select count(distinct exp_lev) into ll_soitemcnt from sorditem where sale_order = cur_refno.sord_no and line_no = cur_refno.line_no__sord and line_type = 'I'; exception when others then ll_soitemcnt := 1; end; if ll_soitemcnt > 1 then begin select count(distinct exp_lev) into ll_despcnt from despatchdet where sord_no = cur_refno.sord_no and line_no__sord = cur_refno.line_no__sord; exception when others then ll_despcnt := 1; end; if ll_soitemcnt <> ll_despcnt then return 0; end if; end if; end loop; RETURN 1; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_WISE_HIERARCHY_NEW ( AS_DIV CHAR, AS_USER_CODE CHAR ) RETURN TBL_EMP_WISE_HIERARCHY_NEW AS V_OBJ_EMP_WISE_HIERARCHY_NEW TBL_EMP_WISE_HIERARCHY_NEW; AS_BHR EXCEPTION; BEGIN WITH EMP AS (SELECT ITEMSER.SH_DESCR DIV , SALES_PERS.ITEM_SER , EMPLOYEE.EMP_CODE , GET_EMPLOYEE_NAME(EMPLOYEE.EMP_CODE) as SO_NAME , EMPLOYEE.GRADE , EMPLOYEE.DATE_JOIN AS DOJ , EMPLOYEE.WITH_HELD AS WITH_HELD, EMPLOYEE.RELIEVE_DATE AS RELIEVE_DATE, DDF_GET_STATION_DESCR(EMPLOYEE.EMP_CODE) AS HQ , EMPLOYEE.REPORT_TO FROM EMPLOYEE, SALES_PERS, ITEMSER WHERE EMPLOYEE.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and -- EMPLOYEE.WITH_HELD = 'N' -- AND EMPLOYEE.RELIEVE_DATE IS NULL AND SALES_PERS.SALES_PERS = EMPLOYEE.EMP_CODE AND ITEMSER.ITEM_SER = SALES_PERS.ITEM_SER AND SALES_PERS.ITEM_SER = AS_DIV AND EMPLOYEE.EMP_CODE IN (SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.CODE FROM USERS B WHERE B.CODE = AS_USER_CODE AND B.ACC_PARM1 = 'HIERARCHY' ) START WITH A.EMP_CODE = AS_USER_CODE CONNECT BY PRIOR A.EMP_CODE = A.REPORT_TO UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.CODE FROM USERS B WHERE B.CODE = AS_USER_CODE AND B.ACC_PARM1 = 'ALL' ) UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.CODE FROM USERS B, SALES_PERS C WHERE C.SALES_PERS = A.EMP_CODE AND B.CODE = AS_USER_CODE AND B.ACC_PARM1 != 'HIERARCHY' AND B.ACC_PARM1 != 'ALL' AND B.ACC_PARM1 IS NOT NULL AND INSTR(',' ||TRIM(B.ACC_PARM1) ||',',',' ||TRIM(C.ITEM_SER) ||',') > 0 ) UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.EMP_CODE FROM USERS B WHERE B.EMP_CODE = AS_USER_CODE AND B.ACC_PARM1 = 'HIERARCHY' ) START WITH A.EMP_CODE = AS_USER_CODE CONNECT BY PRIOR A.EMP_CODE = A.REPORT_TO UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.EMP_CODE FROM USERS B WHERE B.EMP_CODE = AS_USER_CODE AND B.ACC_PARM1 = 'ALL' ) UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.EMP_CODE FROM USERS B, SALES_PERS C WHERE C.SALES_PERS = A.EMP_CODE AND B.EMP_CODE = AS_USER_CODE AND B.ACC_PARM1 != 'HIERARCHY' AND B.ACC_PARM1 != 'ALL' AND B.ACC_PARM1 IS NOT NULL AND INSTR(',' ||TRIM(B.ACC_PARM1) ||',',',' ||TRIM(C.ITEM_SER) ||',') > 0 ) ) AND 'N' = (SELECT ( CASE WHEN L.WITH_HELD = 'Y' OR L.RELIEVE_DATE IS NOT NULL OR L.RESI_DATE IS NOT NULL THEN 'Y' ELSE 'N' END) FROM EMPLOYEE L WHERE L.EMP_CODE = (select EMP_CODE from users where code = AS_USER_CODE) ) ) SELECT OBJ_EMP_WISE_HIERARCHY_NEW(A.DIV , A.TLM_HQ , A.SLM_HQ , A.FLM_HQ , A.SO_HQ , A.SO_DESG_CODE, A.EMP_CODE, A.DATE_JOIN, A.WITH_HELD, A.RELIEVE_DATE, A.ISR_NAME, A.TLM_CODE, A.SLM_CODE , A.FLM_CODE ) BULK COLLECT INTO V_OBJ_EMP_WISE_HIERARCHY_NEW FROM ( SELECT EMP.DIV , ( CASE WHEN EMP.GRADE IN ('179','180','181') THEN DDF_GET_STATION_DESCR(EMP.EMP_CODE) WHEN FLM.GRADE IN ('179','180','181') THEN DDF_GET_STATION_DESCR(FLM.EMP_CODE) WHEN SLM.GRADE IN ('179','180','181') THEN DDF_GET_STATION_DESCR(SLM.EMP_CODE) WHEN TLM.GRADE IN ('179','180','181') THEN DDF_GET_STATION_DESCR(TLM.EMP_CODE) ELSE 'V A C A N T' END) AS TLM_HQ , ( CASE WHEN EMP.GRADE IN ('220','224','226','228') THEN DDF_GET_STATION_DESCR(EMP.EMP_CODE) WHEN FLM.GRADE IN ('220','224','226','228') THEN DDF_GET_STATION_DESCR(FLM.EMP_CODE) WHEN SLM.GRADE IN ('220','224','226','228') THEN DDF_GET_STATION_DESCR(SLM.EMP_CODE) WHEN TLM.GRADE IN ('220','224','226','228') THEN DDF_GET_STATION_DESCR(TLM.EMP_CODE) ELSE 'V A C A N T' END) AS SLM_HQ , ( CASE WHEN EMP.GRADE IN ('219','223','229','227') THEN DDF_GET_STATION_DESCR(EMP.EMP_CODE) WHEN FLM.GRADE IN ('219','223','229','227') THEN DDF_GET_STATION_DESCR(FLM.EMP_CODE) WHEN SLM.GRADE IN ('219','223','229','227') THEN DDF_GET_STATION_DESCR(SLM.EMP_CODE) WHEN TLM.GRADE IN ('219','223','229','227') THEN DDF_GET_STATION_DESCR(TLM.EMP_CODE) ELSE 'V A C A N T' END) AS FLM_HQ , EMP.HQ as SO_HQ, DDF_SMKT_GEN_DET( EMP.EMP_CODE,NULL,NULL,NULL,'DESG') AS SO_DESG_CODE , (CASE WHEN EMP.GRADE IN ('314','317','315','322','323','327','324','326','325', '328','329' ) THEN EMP.EMP_CODE ELSE '' END) AS EMP_CODE , EMP.DOJ AS DATE_JOIN, EMP.WITH_HELD, EMP.RELIEVE_DATE, ( CASE WHEN EMP.GRADE IN ('314','317','315','322','323','327','324','326','325' ,'328','329') THEN EMP.SO_NAME ELSE '' END) AS ISR_NAME , ( CASE WHEN EMP.GRADE IN ('179','180','181') THEN EMP.EMP_CODE WHEN FLM.GRADE IN ('179','180','181') THEN FLM.EMP_CODE WHEN SLM.GRADE IN ('179','180','181') THEN SLM.EMP_CODE WHEN TLM.GRADE IN ('179','180','181') THEN TLM.EMP_CODE ELSE 'VC0001' END) AS TLM_CODE , ( CASE WHEN EMP.GRADE IN ('220','224','226','228') THEN EMP.EMP_CODE WHEN FLM.GRADE IN ('220','224','226','228') THEN FLM.EMP_CODE WHEN SLM.GRADE IN ('220','224','226','228') THEN SLM.EMP_CODE WHEN TLM.GRADE IN ('220','224','226','228') THEN TLM.EMP_CODE ELSE 'VC0001' END) AS SLM_CODE , ( CASE WHEN EMP.GRADE IN ('219','223','229','227') THEN EMP.EMP_CODE WHEN FLM.GRADE IN ('219','223','229','227') THEN FLM.EMP_CODE WHEN SLM.GRADE IN ('219','223','229','227') THEN SLM.EMP_CODE WHEN TLM.GRADE IN ('219','223','229','227') THEN TLM.EMP_CODE ELSE 'VC0001' END) AS FLM_CODE FROM EMP , EMPLOYEE FLM, EMPLOYEE SLM, EMPLOYEE TLM WHERE FLM.EMP_CODE = EMP.REPORT_TO AND FLM.REPORT_TO = SLM.EMP_CODE AND SLM.REPORT_TO = TLM.EMP_CODE AND EMP.GRADE IN ('314','317','315','322','323','327','324','326','325', '328','329' ) ) A; RETURN V_OBJ_EMP_WISE_HIERARCHY_NEW; RAISE AS_BHR; EXCEPTION WHEN AS_BHR THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DISPARM_VALUE (as_varname disparm.var_name%type, as_prdcode disparm.prd_code%type) return char is as_value disparm.var_value%type; begin select var_value into as_value from disparm where var_name = as_varname and prd_code = as_prdcode; return as_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INV_PACK_NO_ART (as_tranid inv_pack_rcp.tran_id%type) return number is li_no_art inv_pack_rcp.no_art%type; begin select distinct sum(max(nvl(no_art,0))) into li_no_art from inv_pack_rcp where tran_id = as_tranid group by pack_instr; --> Why this is require return li_no_art; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_DEALLOCATED (VI_REF_SER IN CHAR ,VI_REF_Id IN VARCHAR) RETURN VARCHAR2 IS DEALLOCATED VARCHAR2(5); flagRepl BOOLEAN := true; flagPick BOOLEAN := true; cursor C1 is SELECT nvl(repl_ord_det.cancel_mode,'N') as DEALLOCATIOM1 from repl_ord_det where repl_ord_det.repl_order = VI_REF_Id; cursor C2 is SELECT (nvl(Quantity,0)-nvl(dealloc_qty,0)) as DEALLOCATIOM1 from pick_ord_det where pick_ord_det.pick_order = VI_REF_Id; BEGIN --FOR PICK IF(VI_REF_SER = 'P-PICK' OR VI_REF_SER = 'C-PICK' OR VI_REF_SER = 'A-PICK' OR VI_REF_SER = 'M-PICK') THEN FOR deallcatTaskPick in C2 LOOP IF(flagPick) Then IF(deallcatTaskPick.DEALLOCATIOM1>0) Then DEALLOCATED :='N'; flagPick := false; ELSE DEALLOCATED :='Y'; End IF; End IF; END LOOP; RETURN DEALLOCATED; ELSIF(VI_REF_SER = 'R-TASK' OR VI_REF_SER = 'RP-PND' OR VI_REF_SER = 'R-CPA' OR VI_REF_SER = 'R-PND' OR VI_REF_SER = 'S-DOC' OR VI_REF_SER = 'RP-ACT' OR VI_REF_SER = 'RR-DSA' OR VI_REF_SER = 'RD-DSA' OR VI_REF_SER = 'R-DSO' OR VI_REF_SER = 'RS-DSO' OR VI_REF_SER = 'RN-DSA') THEN --FOR REPL FOR deallcatTaskRepl in C1 LOOP IF( flagRepl) Then IF(deallcatTaskRepl.DEALLOCATIOM1='Y') Then DEALLOCATED :='Y'; ELSE DEALLOCATED := 'N'; flagRepl :=false; End IF; End IF; END LOOP; RETURN DEALLOCATED; ELSE DEALLOCATED := ' '; RETURN DEALLOCATED; End IF; EXCEPTION WHEN NO_DATA_FOUND THEN DEALLOCATED :=' '; RETURN DEALLOCATED; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_CUST_TRAN_DATE_TEM ON INVOICE (CUST_CODE, TRAN_DATE, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DECODE_STRING (ls_range in char,lc_amount in number) return number is lc_factor number(14,3); ll_pos number(3); ls_part_range varchar2(100); ls_bal_range varchar2(100); ll_len number(30); ll_sep_pos number(20); ll_numb number(14,3); ls_min_range varchar2(20); ls_max_range varchar2(20); ll_part_pos number(3); ll_sep_part_pos number(20); ll_min_range number(14,3); ll_max_range number(14,3); ls_bal_part_range varchar2(100); ll_bal_part_range number(14,3); begin ls_bal_range := ls_range; ll_pos := 1; ll_part_pos := 1; --0,100000,1.5|100001,500000,3|9 ll_len := length(rtrim(ls_bal_range)); while ll_len > 1 loop select instr(rtrim(ls_bal_range),'|',ll_pos) into ll_sep_pos from dual; select substr(ls_bal_range,ll_pos,ll_sep_pos - 1) into ls_part_range from dual; -- check part range for factor ll_part_pos := 1; select instr(rtrim(ls_part_range),',',ll_part_pos) into ll_sep_part_pos from dual; -- return ll_sep_part_pos; select substr(rtrim(ls_part_range),ll_part_pos,ll_sep_part_pos - 1) into ls_min_range from dual; ll_min_range := to_number(ls_min_range); ll_part_pos := ll_sep_part_pos + 1; -- max range select instr(rtrim(ls_part_range),',',ll_part_pos) into ll_sep_part_pos from dual; select substr(rtrim(ls_part_range),ll_part_pos,ll_sep_part_pos - ll_part_pos) into ls_max_range from dual; ll_max_range := to_number(ls_max_range); ll_part_pos := ll_sep_part_pos + 1; -- separating factor select substr(rtrim(ls_part_range),ll_part_pos) into ls_bal_part_range from dual; ll_bal_part_range := ls_bal_part_range; -- Checking for factor for the passed amount if ll_min_range <= lc_amount and ll_max_range >= lc_amount then lc_factor := ll_bal_part_range; exit; end if; -- end of breaking of part range select substr(ls_bal_range,ll_sep_pos + 1) into ls_bal_range from dual; ll_len := length(rtrim(ls_bal_range)); select isnumber(ls_bal_range) into ll_numb from dual; if ll_numb = 0 then ll_len := 1; end if; end loop; select isnumber(ls_bal_range) into ll_numb from dual; if ll_numb = 0 then lc_factor := to_number(ls_bal_range); end if; return (lc_factor); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WF_PRC_STATUS_PIDREF ON WF_PRC_STATUS (PROCESS_ID, ACTIVITY_ID, REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 196608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EMP_APPROVE_NAME (lsref_ser char ,lsref_id char, ls_call char) return char is ls_name char(80); ls_chgcode char(20); ls_empcode char(20); begin if lsref_ser = 'JOUR' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from journal where tran_id = lsref_id; elsif lsref_ser = 'VOUCH' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from voucher where tran_id = lsref_id; elsif lsref_ser = 'F-XFR ' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from fundtransfer where tran_id = lsref_id; elsif lsref_ser = 'S-INV' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from invoice where invoice_id = lsref_id; elsif lsref_ser = 'M-GEN' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_vouch_gen where tran_id = lsref_id; elsif lsref_ser = 'M-VOUC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_voucher where tran_id = lsref_id; elsif lsref_ser = 'M-PAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_payment where tran_id = lsref_id; elsif lsref_ser = 'DRNPAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_pay where tran_id = lsref_id; elsif lsref_ser = 'CRNPAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_pay where tran_id = lsref_id; elsif lsref_ser = 'DRNRCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'CRNRCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'MDRCRD' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'MDRCRC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'E-PAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from payment_exp where tran_id = lsref_id; elsif lsref_ser = 'MPCANC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_payment_canc where tran_id = lsref_id; elsif lsref_ser = 'M-RCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_receipt where tran_id = lsref_id; elsif lsref_ser = 'P-RCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from PORCP where tran_id = lsref_id; elsif lsref_ser = 'P-RET' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from PORCP where tran_id = lsref_id; elsif lsref_ser = 'P-VOUC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from payr_voucher where tran_id = lsref_id; elsif lsref_ser = 'RCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from receipt where tran_id = lsref_id; elsif lsref_ser = 'R-DIS' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from rcpdishnr where tran_id = lsref_id; elsif lsref_ser = 'R-IBCA' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from rcp_ibca where tran_id = lsref_id; elsif lsref_ser = 'P-IBCA' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from pay_ibca where tran_id = lsref_id; end if; if ls_call = 'E' then -- selecting user name from user table select emp_code into ls_empcode from users where code = ls_chgcode; end if; select ltrim(rtrim(NVL(emp_fname,''))) ||' '|| ltrim(rtrim(NVL(emp_mname,'')))||' '||ltrim(rtrim(NVL(emp_lname,''))||' ' ||'('||ltrim(rtrim(emp_code))||')') into ls_name from employee where emp_code = ls_empcode ; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MAINT_PA_SCH_MONTHWISE (as_site char, as_mcCode char,as_maintCd char,as_mnt char,flag char,as_frdate date, as_todate date) return varchar2 is ls_day char(150); ls_comp_month char(2); ls_comp_date char(2); ls_lastdday char(2); ls_datas char(10); begin begin --Created By Brijesh Soni 22.09.2009 dbms_output.put_line('FROM DATE -> ' || as_frdate || ' <[---------------------]> ' ||' TO DATE -> ' || as_todate ); if sqlcode = 0 then if as_mnt = 'APR' then begin declare cursor curApr is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-Apr-'|| to_char(as_frdate,'YYYY')) and to_date('30-Apr-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curApr; loop fetch curApr into ls_datas , ls_comp_date , ls_comp_month; exit when curApr%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curApr; dbms_output.put_line('closing curApr'); end; end; elsif as_mnt = 'MAY' then begin declare cursor curMay is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-May-'|| to_char(as_frdate,'YYYY')) and to_date('31-may-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curMay; loop fetch curMay into ls_datas , ls_comp_date , ls_comp_month; exit when curMay%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curMay; dbms_output.put_line('closing curMay'); end; end; elsif as_mnt = 'JUN' then begin declare cursor curJun is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-jun-'|| to_char(as_frdate,'YYYY')) and to_date('30-jun-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curJun; loop fetch curJun into ls_datas , ls_comp_date , ls_comp_month; exit when curJun%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curJun; dbms_output.put_line('closing curJun'); end; end; elsif as_mnt = 'JUL' then begin declare cursor curJul is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-Jul-'|| to_char(as_frdate,'YYYY')) and to_date('31-Jul-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curJul; loop fetch curJul into ls_datas , ls_comp_date , ls_comp_month; exit when curJul%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curJul; dbms_output.put_line('closing curJul'); end; end; elsif as_mnt = 'AUG' then begin declare cursor curAug is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-aug-'|| to_char(as_frdate,'YYYY')) and to_date('31-aug-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curAug; loop fetch curAug into ls_datas , ls_comp_date , ls_comp_month; exit when curAug%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curAug; dbms_output.put_line('closing curAug'); end; end; elsif as_mnt = 'SEP' then begin declare cursor curSep is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-sep-'|| to_char(as_frdate,'YYYY')) and to_date('30-sep-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curSep; loop fetch curSep into ls_datas , ls_comp_date , ls_comp_month; exit when curSep%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curSep; dbms_output.put_line('closing curSep'); end; end; elsif as_mnt = 'OCT' then begin declare cursor curOct is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-Oct-'|| to_char(as_frdate,'YYYY')) and to_date('31-OCT-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curOct; loop fetch curOct into ls_datas , ls_comp_date , ls_comp_month; exit when curOct%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curOct; dbms_output.put_line('closing curOct'); end; end; elsif as_mnt = 'NOV' then begin declare cursor curNov is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-nov-'|| to_char(as_frdate,'YYYY')) and to_date('30-nov-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curNov; loop fetch curNov into ls_datas , ls_comp_date , ls_comp_month; exit when curNov%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curNov; dbms_output.put_line('closing curNov'); end; end; elsif as_mnt = 'DEC' then begin declare cursor curDec is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-dec-'|| to_char(as_frdate,'YYYY')) and to_date('31-dec-'|| to_char(as_frdate,'YYYY')) and start_date between as_frdate and as_todate; begin open curDec; loop fetch curDec into ls_datas , ls_comp_date , ls_comp_month; exit when curDec%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curDec; dbms_output.put_line('closing curDec'); end; end; elsif as_mnt = 'JAN' then begin declare cursor curJan is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-jan-'|| to_char(as_todate,'YYYY')) and to_date('31-jan-'|| to_char(as_todate,'YYYY')) and start_date between as_frdate and as_todate; begin open curJan; loop fetch curJan into ls_datas , ls_comp_date , ls_comp_month; exit when curJan%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curJan; dbms_output.put_line('closing curJan'); end; end; elsif as_mnt = 'FEB' then select to_char(last_day('01-feb'||to_char(as_todate,'YYYY')),'dd') into ls_lastdday from dual; begin declare cursor curFeb is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-feb'||to_char(as_todate,'YYYY')) and to_date(ls_lastdday||'-feb-'||to_char(as_todate,'YYYY')) and start_date between as_frdate and as_todate; begin open curFeb; loop fetch curFeb into ls_datas , ls_comp_date , ls_comp_month; exit when curFeb%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curFeb; dbms_output.put_line('closing curFeb'); end; end; elsif as_mnt = 'MAR' then begin declare cursor curMar is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-mar-'|| to_char(as_todate,'YYYY')) and to_date('31-mar-'|| to_char(as_todate,'YYYY')) and start_date between as_frdate and as_todate; begin open curMar; loop fetch curMar into ls_datas , ls_comp_date , ls_comp_month; exit when curMar%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curMar; dbms_output.put_line('closing curMar'); end; end; end if; end if; EXCEPTION WHEN NO_DATA_FOUND THEN ls_day := ' '; WHEN OTHERS THEN ls_day := ' '; end; dbms_output.put_line('Day Returning ::::: ' || trim(ls_day) || '[]'); return ls_day; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CALL_DETAILS (ad_date dr_main.work_date%type, emp_code dr_main.sales_pers%type,toplace tourdet.to_place%type,detailtype char,localityCode sprs_route.locality_code%type, stationTo dr_travel_details.work_stan_code%type ,stationFrom dr_travel_details.from_stan_code%type) return char is ls_details varchar(5000); call_details varchar(60); no_of_doctors number(3); no_of_stockist number(3); no_of_chemist number(3); remarks varchar(3500); cnt number(3); min_call_details VARCHAR(60); max_call_details varchar(60); begin IF detailtype IS NOT NULL AND LENGTH(TRIM(detailtype)) > 0 AND detailtype= 'D' THEN select count(*) into cnt from dr_doctor_visit where work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo and sc_code not in ('0000000000'); if cnt > 0 then --select (''||min(event_time_start)||', '|| max(event_time_end)) into call_details from strg_meet where event_date=ad_date and sales_pers=emp_code and locality_code=localityCode and strg_type='C'; SELECT MIN(doctor_visit_time) INTO min_call_details FROM dr_doctor_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND doctor_visit_time LIKE '%AM%' and sc_code not in ('0000000000'); IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(doctor_visit_time) INTO min_call_details FROM dr_doctor_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND doctor_visit_time LIKE '%12:%PM' and sc_code not in ('0000000000'); IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(doctor_visit_time) INTO min_call_details FROM dr_doctor_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND doctor_visit_time LIKE '%PM%' and sc_code not in ('0000000000'); END IF; END IF; SELECT MAX(doctor_visit_time) INTO max_call_details FROM dr_doctor_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND doctor_visit_time NOT LIKE '%12:%PM' AND doctor_visit_time LIKE '%PM%' and sc_code not in ('0000000000'); IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(doctor_visit_time) INTO max_call_details FROM dr_doctor_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND doctor_visit_time LIKE '%PM%' and sc_code not in ('0000000000'); IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(doctor_visit_time) INTO max_call_details FROM dr_doctor_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND doctor_visit_time LIKE '%AM%' and sc_code not in ('0000000000'); END IF; END IF; call_details := min_call_details||', ' ||max_call_details; select count(*) into no_of_doctors from dr_doctor_visit where work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo and sc_code not in ('0000000000'); select LISTAGG(to_char(remark), ',') WITHIN GROUP(ORDER BY remark ) into remarks from dr_doctor_visit where work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo and sc_code not in ('0000000000'); if remarks is null then ls_details := call_details||', '||no_of_doctors; else if cnt > 9 then ls_details := call_details||', '||no_of_doctors||' , * '||remarks; else ls_details := call_details||', '||no_of_doctors||' , * '||remarks; END IF; END IF; else ls_details := ''; END IF; ELSIF detailtype IS NOT NULL AND LENGTH(TRIM(detailtype)) > 0 AND detailtype = 'U' THEN select count(*) into cnt from dr_doctor_visit where sales_pers = emp_code and work_date = ad_date and sc_code = '0000000000'; IF cnt > 0 THEN --select (''||first_visit_time||', '||last_visit_time) into call_details --FROM dr_doctor_visit WHERE sales_pers = emp_code AND work_date = ad_date AND sc_code = '0000000000'; SELECT MIN(first_visit_time) INTO min_call_details FROM dr_doctor_visit WHERE sales_pers = emp_code AND work_date = ad_date AND sc_code = '0000000000' AND first_visit_time LIKE '%AM%'; IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(first_visit_time) INTO min_call_details FROM dr_doctor_visit WHERE sales_pers = emp_code AND work_date = ad_date AND sc_code = '0000000000' AND first_visit_time LIKE '%PM%'; END IF; SELECT MAX(last_visit_time) INTO max_call_details FROM dr_doctor_visit WHERE sales_pers = emp_code AND work_date = ad_date AND sc_code = '0000000000' AND last_visit_time LIKE '%PM%'; IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(last_visit_time) INTO max_call_details FROM dr_doctor_visit WHERE sales_pers = emp_code AND work_date = ad_date AND sc_code = '0000000000' AND last_visit_time LIKE '%AM%'; end if; call_details := min_call_details||', ' ||max_call_details; select noof_doct into no_of_doctors from dr_doctor_visit where sales_pers = emp_code and work_date = ad_date and sc_code = '0000000000'; ls_details := call_details||', ' ||no_of_doctors; else ls_details := ''; END IF; ELSIF detailtype IS NOT NULL AND LENGTH(TRIM(detailtype)) > 0 AND detailtype = 'S' THEN select count(*) into cnt from dr_stockist_visit where work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo; IF cnt > 0 THEN --select (''||min(event_time_start)||', '|| max(event_time_end)) into call_details from strg_meet where event_date=ad_date and sales_pers=emp_code and locality_code=localityCode and strg_type='S'; SELECT MIN(stockist_visit_time) INTO min_call_details FROM dr_stockist_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND stockist_visit_time LIKE '%AM%'; IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(stockist_visit_time) INTO min_call_details FROM dr_stockist_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND stockist_visit_time LIKE '%12:%PM'; IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(stockist_visit_time) INTO min_call_details FROM dr_stockist_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND stockist_visit_time LIKE '%PM%'; end if; end if; SELECT MAX(stockist_visit_time) INTO max_call_details FROM dr_stockist_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND stockist_visit_time NOT LIKE '%12:%PM' AND stockist_visit_time LIKE '%PM%'; IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(stockist_visit_time) INTO max_call_details FROM dr_stockist_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND stockist_visit_time LIKE '%PM%'; IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(stockist_visit_time) INTO max_call_details FROM dr_stockist_visit WHERE work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo AND stockist_visit_time LIKE '%AM%'; END IF; END IF; call_details := min_call_details||', ' ||max_call_details; select count(*) into no_of_stockist from dr_stockist_visit where work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo; select LISTAGG(to_char(remark), ',') WITHIN GROUP(ORDER BY remark ) into remarks from dr_stockist_visit where work_date=ad_date and sales_pers=emp_code and work_stan_code=stationTo; if remarks is null then ls_details := call_details||', ' ||no_of_stockist; else if cnt > 9 then ls_details := call_details||', ' ||no_of_stockist|| ' , * '||remarks; else ls_details := call_details||', ' ||no_of_stockist|| ' , * '||remarks; END IF; END IF; else ls_details := ''; END IF; ELSIF detailtype IS NOT NULL AND LENGTH(TRIM(detailtype)) > 0 AND detailtype = 'C' THEN select count(*) into cnt from strg_meet where event_date=ad_date and sales_pers=emp_code and locality_code=localityCode and strg_type IN ('C','W','A') and STRG_CODE not in ('UR00000000'); if cnt > 0 then --select (''||min(event_time_start)||', '|| max(event_time_end)) into call_details from strg_meet where event_date=ad_date and sales_pers=emp_code and locality_code=localityCode and strg_type='C'; SELECT MIN(event_time_start) INTO min_call_details FROM strg_meet WHERE event_date=ad_date AND sales_pers=emp_code AND locality_code=localityCode AND strg_type IN ('C','W','A') AND event_time_start LIKE '%AM%' and STRG_CODE not in ('UR00000000'); IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(event_time_start) INTO min_call_details FROM strg_meet WHERE event_date=ad_date AND sales_pers=emp_code AND locality_code=localityCode AND strg_type IN ('C','W','A') AND event_time_start LIKE '%12:%PM' and STRG_CODE not in ('UR00000000'); IF min_call_details IS NULL OR min_call_details = '' THEN SELECT MIN(event_time_start) INTO min_call_details FROM strg_meet WHERE event_date=ad_date AND sales_pers=emp_code AND locality_code=localityCode AND strg_type IN ('C','W','A') AND event_time_start LIKE '%PM%' and STRG_CODE not in ('UR00000000'); END IF; END IF; SELECT MAX(event_time_start) INTO max_call_details FROM strg_meet WHERE event_date=ad_date AND sales_pers=emp_code AND locality_code=localityCode AND strg_type IN ('C','W','A') AND event_time_start NOT LIKE '%12:%PM' AND event_time_start LIKE '%PM%' and STRG_CODE not in ('UR00000000'); IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(event_time_start) INTO max_call_details FROM strg_meet WHERE event_date=ad_date AND sales_pers=emp_code AND locality_code=localityCode AND strg_type IN ('C','W','A') AND event_time_start LIKE '%PM%' and STRG_CODE not in ('UR00000000'); IF max_call_details IS NULL OR max_call_details = '' THEN SELECT MAX(event_time_start) INTO max_call_details FROM strg_meet WHERE event_date=ad_date AND sales_pers=emp_code AND locality_code=localityCode AND strg_type IN ('C','W','A') AND event_time_start LIKE '%AM%' and STRG_CODE not in ('UR00000000'); END IF; END IF; call_details := min_call_details||', ' ||max_call_details; select count(*) into no_of_chemist from strg_meet where event_date=ad_date and sales_pers=emp_code and locality_code=localityCode and strg_type IN ('C','W','A') and STRG_CODE not in ('UR00000000'); select LISTAGG(to_char(remarks), ',') WITHIN GROUP(ORDER BY remarks ) into remarks from strg_meet where event_date=ad_date and sales_pers=emp_code and locality_code=localityCode and strg_type IN ('C','W','A') and STRG_CODE not in ('UR00000000'); if remarks is null then ls_details := call_details||', ' ||no_of_chemist; else if cnt > 9 then ls_details := call_details||', ' ||no_of_chemist || ' , * '||remarks; else ls_details := call_details||', ' ||no_of_chemist || ' , * '||remarks; END IF; END IF; else ls_details := ''; END IF; END IF; ls_details := ls_details; RETURN LS_DETAILS; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FORECASTDET_X ON LVEBAL_FORECASTDET (EMP_CODE, LVE_CODE, EFF_DATE, UPTO_DATE, FROM_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_EMPLOYEE_EMAIL_ID (as_emp_email_id in char ) return char is ls_email_id varchar2(100) ; begin IF as_emp_email_id = NULL OR LENGTH(as_emp_email_id) =0 THEN ls_email_id := ' '; RETURN ls_email_id; ELSE select email_id_off into ls_email_id from employee where emp_code = as_emp_email_id; return ls_email_id; end if; exception when NO_DATA_FOUND then ls_email_id := ' '; return ls_email_id; when others then ls_email_id := ' '; return ls_email_id; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_IS_SPECINSTR (as_workorder in char) return char is ls_retval char(1) := ' '; ls_custcode customer.cust_code%type; ls_saleorder sorder.sale_order%type; ls_itemcode item.item_code%type; ls_remarks varchar2(500); begin select item_code, sale_order, remarks into ls_itemcode, ls_saleorder, ls_remarks from workorder where work_order = as_workorder; if (ls_remarks is not null) and length(ltrim(rtrim(ls_remarks))) > 0 then return 'Y' ; end if; if (ls_saleorder is not null) and length(ltrim(rtrim(ls_saleorder))) > 0 then select cust_code, nvl(remarks2,' ') || nvl(remarks3,' ') into ls_custcode, ls_remarks from sorder where sale_order = ls_saleorder; if (ls_remarks is not null) and length(ltrim(rtrim(ls_remarks))) > 0 then return 'Y' ; end if; if (ls_custcode is not null) and length(ltrim(rtrim(ls_custcode))) > 0 then select msg_specs into ls_remarks from customeritem where cust_code = ls_custcode and item_code = ls_itemcode; if (ls_remarks is not null) and length(ltrim(rtrim(ls_remarks))) > 0 then return 'Y' ; end if; end if; end if; return ls_retval ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DRCRINVDETAIL (as_invoice char,as_site char ,ls_flag char) return varchar2 is as_drcrinv_det varchar2(100); as_tranid varchar2(20); as_trandt date; as_drcr_amt number(14,2); as_curr_code varchar2(10); as_exch number(14,2); ctr number(2); cursor c1 is select drcr_invdet.tran_id , drcr_inv.tran_date, ROUND(drcr_invdet.DRCR_AMT,2), drcr_inv.curr_code, ROUND(drcr_inv.exch_rate,2) from drcr_invdet,drcr_inv where drcr_inv.invoice_id =as_invoice and drcr_inv.site_code = as_site and drcr_invdet.tran_id =drcr_inv.tran_id ; begin open c1 ; ctr:=1; loop fetch c1 into as_tranid,as_trandt,as_drcr_amt,as_curr_code,as_exch ; exit when c1%notfound ; if ls_flag = 'I' then if ctr =1 then as_drcrinv_det:= as_tranid; else as_drcrinv_det:= as_drcrinv_det||' | '|| as_tranid; end if ; elsif ls_flag = 'D' then if ctr =1 then as_drcrinv_det:= to_char(as_trandt); else as_drcrinv_det:= as_drcrinv_det||' | '|| to_char(as_trandt); end if ; elsif ls_flag = 'A' then if ctr = 1 then as_drcrinv_det:= to_char(as_drcr_amt); else as_drcrinv_det:= as_drcrinv_det||' | '|| to_char(as_drcr_amt); end if ; elsif ls_flag = 'C' then if ctr = 1 then as_drcrinv_det:= to_char(as_curr_code); else as_drcrinv_det:= as_drcrinv_det||' | '|| to_char(as_curr_code); end if ; elsif ls_flag = 'R' then if ctr = 1 then as_drcrinv_det:= to_char(as_exch); else as_drcrinv_det:= as_drcrinv_det||' | '|| to_char(as_exch); end if ; end if ; ctr := 0; end loop; close c1; return as_drcrinv_det; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LEAVESTATUS (VI_STATUS IN CHAR, VI_WRKFLW_STATUS IN CHAR ) RETURN VARCHAR2 IS L_STATUS VARCHAR2(30); BEGIN Begin If ( Vi_Status = 'R' And Vi_Wrkflw_Status = 'R') Then L_Status := 'Pending with Recommender'; Elsif ( Vi_Status = 'R' And Vi_Wrkflw_Status = 'A') Then L_Status := 'Pending with Approver'; Elsif ( Vi_Status = 'R' And Vi_Wrkflw_Status = 'H') Then L_Status := 'Pending with HR'; Elsif ( Vi_Status = 'A' And Vi_Wrkflw_Status = 'R') Then L_Status := 'Recomender approved'; Elsif ( Vi_Status = 'A' And Vi_Wrkflw_Status = 'A') Then L_STATUS := 'Approved'; Elsif ( Vi_Status = 'A' And Vi_Wrkflw_Status = 'H') Then L_Status := 'HR approved'; Elsif ( Vi_Status = 'C' And Vi_Wrkflw_Status = 'R') Then L_Status := 'Rejected by Recomender'; Elsif ( Vi_Status = 'C' And Vi_Wrkflw_Status = 'A') Then L_Status := 'Rejected by Approver'; Elsif ( Vi_Status = 'C' And Vi_Wrkflw_Status = 'H') Then L_STATUS := 'Rejected by HR'; ELSIF ( VI_STATUS = 'C' AND VI_WRKFLW_STATUS = 'X') THEN L_Status := 'Cancelled by Employee'; ELSE L_STATUS := ' '; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN L_STATUS :=' '; END; Return L_Status; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE INSTRUMENTNOTABLE AS TABLE OF instrumentNo; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DUMMYDATE (as_date_from date) return date is added_date date; begin select add_months(as_date_from, 1) into added_date from dual; return added_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SUPPLIER_SITE_CHAN_DIS ON SUPPLIER (SITE_CODE, CHANNEL_PARTNER, DIS_LINK) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DD123 (lsref_ser char,lsref_id char) return varchar2 is ls_no varchar2(5000); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SEP_CLOSE_X ON SEPARATION_CLOSE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDITEM_ODATE_SITE_TYPE_SNLQ ON SORDITEM (ORDER_DATE, SITE_CODE, ORDER_TYPE, STATUS, NATURE, LINE_TYPE, QUANTITY, QTY_DESP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_VOUC_BANKTRAN_LOG (as_tranid in char,as_tran_ser in char) return char is as_tran varchar2(12); begin select min(banktran_log.tran_id) into as_tran from banktran_log where tran_no = as_tranid and tran_ser = as_tran_ser ; Return as_tran; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_BALANCES (as_code IN CHAR, as_date IN DATE) RETURN NUMBER IS ls_amt number(14,3); BEGIN SELECT NVL((SUM( CASE WHEN A.TRAN_TYPE='P' THEN A.ADD_AMT END)),0)+ NVL(((SUM(CASE WHEN A.TRAN_TYPE='R' THEN A.LESS_AMT END) ) * (-1)),0) INTO ls_amt from ( SELECT BANKTRAN_LOG.TRAN_TYPE, (CASE WHEN(BANKTRAN_LOG.TRAN_TYPE='P') THEN BANKTRAN_LOG.AMOUNT else 0 END) AS ADD_AMT, (CASE WHEN(BANKTRAN_LOG.TRAN_TYPE='R') THEN BANKTRAN_LOG.AMOUNT ELSE 0 END) AS LESS_AMT FROM BANKTRAN_LOG LEFT OUTER JOIN BANKRECO_TRACE ON BANKTRAN_LOG.TRAN_ID = BANKRECO_TRACE.TRAN_ID__LOG LEFT OUTER JOIN bank_statement ON bankreco_trace.tran_id__stat = bank_statement.tran_id, BANK WHERE ( BANKTRAN_LOG.BANK_CODE = BANK.BANK_CODE) AND ( BANKTRAN_LOG.BANK_CODE = as_code) AND ( BANKTRAN_LOG.TRAN_DATE <= as_date) AND BANKTRAN_LOG.TRAN_SER NOT IN ( 'R-DIS ', 'MPCANC' ) AND( BANKTRAN_LOG.STATUS <> 'R' OR ( banktran_log.status = 'R' AND BANK_STATEMENT.EFF_DATE > as_date) AND banktran_log.tran_date < bank_statement.stat_date ) AND banktran_log.amount != '0' UNION ALL SELECT bank_statement.TRAN_TYPE, (CASE WHEN(bank_statement.TRAN_TYPE='P') THEN bank_statement.AMOUNT else 0 END) AS ADD_AMT, (CASE WHEN(bank_statement.TRAN_TYPE='R') THEN bank_statement.AMOUNT ELSE 0 END) AS LESS_AMT FROM bank_statement LEFT OUTER JOIN BANKRECO_TRACE ON BANK_STATEMENT.TRAN_ID = BANKRECO_TRACE.TRAN_ID__STAT LEFT OUTER JOIN BANKTRAN_LOG ON bankreco_trace.tran_id__log = banktran_log.tran_id, BANK WHERE( BANK_STATEMENT.BANK_CODE = BANK.BANK_CODE) AND((BANK_STATEMENT.BANK_CODE = as_code) AND( BANK_STATEMENT.EFF_DATE <= as_date) AND( BANK_STATEMENT.TRAN_TYPE IN ('P','R')) AND( BANK_STATEMENT.AMOUNT <> 0 ) ) AND( BANK_STATEMENT.STATUS NOT IN ('R','P') OR( bank_statement.status = 'R' AND BANK_STATEMENT.EFF_DATE > as_date ) AND bank_statement.stat_date < banktran_log.tran_date ) AND bank_statement.amount != '0' union all SELECT BANKTRAN_LOG.TRAN_TYPE, (CASE WHEN(BANKTRAN_LOG.TRAN_TYPE='P') THEN BANKTRAN_LOG.AMOUNT else 0 END) AS ADD_AMT, (CASE WHEN(BANKTRAN_LOG.TRAN_TYPE='R') THEN BANKTRAN_LOG.AMOUNT ELSE 0 END) AS LESS_AMT FROM BANKTRAN_LOG LEFT OUTER JOIN BANKRECO_TRACE ON BANKTRAN_LOG.TRAN_ID = BANKRECO_TRACE.TRAN_ID__LOG LEFT OUTER JOIN BANK_STATEMENT ON BANKRECO_TRACE.TRAN_ID__STAT = BANK_STATEMENT.TRAN_ID LEFT OUTER JOIN BANK ON BANKTRAN_LOG.BANK_CODE = BANK.BANK_CODE WHERE ( BANKTRAN_LOG.BANK_CODE = as_code) AND ( banktran_log.tran_date <= as_date) AND BANKTRAN_LOG.TRAN_SER IN ( 'R-DIS ', 'MPCANC' ) AND ( BANKTRAN_LOG.STATUS <> 'R' OR ( banktran_log.status = 'R' AND bank_statement.eff_date > as_date ) AND BANKTRAN_LOG.TRAN_DATE < BANK_STATEMENT.STAT_DATE) AND BANKTRAN_LOG.AMOUNT != '0') A ; return ls_amt; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMP_STATUSCHG_EFF_DATE ON EMP_STATUSCHG (EMP_CODE, DATE__EFFCHG, STATUS_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001196270 ON NET_PRINTERS_LOG (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RCPBKFLUSH_LOC_CODE BEFORE INSERT ON receipt_backflush_det REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE v_loc_count NUMBER; BEGIN SELECT COUNT(*) INTO v_loc_count FROM location WHERE loc_code = :NEW.loc_code; IF v_loc_count = 0 THEN RAISE_APPLICATION_ERROR('-20001', 'Entered location not defined in location master'); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_HOLIDAY (AS_EMP_CODE CHAR,AS_PRD_CODE_FR CHAR,AS_PRD_CODE_TO CHAR,AS_EMP_WORK_DATE DATE) return char is a_hol_date char(11); begin SELECT distinct to_char(hol_date,'DD-MON-YYYY') into a_hol_date FROM holiday H WHERE H.HOL_DATE NOT IN( SELECT HOL_DATE_FOR FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND H.HOL_TBLNO=HOL_TBLNO AND HOL_DATE_FOR =AS_EMP_WORK_DATE) AND HOL_DATE =AS_EMP_WORK_DATE AND HOL_TBLNO=ddf_get_holtblno(AS_EMP_CODE,AS_EMP_WORK_DATE); return a_hol_date; exception when no_data_found then begin SELECT DISTINCT to_char(HOL_DATE_TO,'DD-MON-YYYY') into a_hol_date FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND HOL_TBLNO = ddf_get_holtblno(AS_EMP_CODE,AS_EMP_WORK_DATE) AND HOL_DATE_FOR =AS_EMP_WORK_DATE; return a_hol_date; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_COUNT_CUST (as_sales_pers char, as_type char, as_date date) return number is ls_count number(9); begin select count(strg_code) into ls_count from strg_meet where trim(sales_pers)=trim(as_sales_pers) and trim(strg_type)=trim(as_type) and to_date(event_date)=to_date(as_date); return nvl(ls_count,'0'); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION REPORTING_TO (E_Code IN Employee.Emp_Code%type, GRADE_CD Employee.GRADE%type) RETURN Employee.Emp_Code%type IS D_Code Employee.GRADE%type := ''; T_Code Employee.Emp_Code%type := E_Code; iterations number :=0; BEGIN -- Loop till designation is found or the loop count has reached max limit WHILE D_Code != GRADE_CD and iterations < 50 LOOP Select M.Emp_Code, M.GRADE into T_Code, D_Code From Employee E, Employee M Where E.Report_To = M.Emp_Code and E.Emp_Code = T_Code; iterations := iterations + 1; End LOOP; if iterations = 50 then return ''; else return T_Code; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_PRICELIST_SYMBOL ( as_price_list char, as_item_code char, as_lot_no char) return char is ls_sym char(1); ls_chgref char(5); ls_var char(5); begin select chg_ref_no into ls_chgref from pricelist where price_list = as_price_list and pricelist.item_code = as_item_code and (as_lot_no between pricelist.lot_no__from and pricelist.lot_no__to) ; select var_value into ls_var from disparm where var_name = 'PRICELIST_STATUS' ; if ls_chgref='RP' and ls_var = 'Y' then ls_sym := '#' ; else ls_sym := ' ' ; end if; return ls_sym ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_PROJ_FT ON PROJ_CONST_ITEM (PROJ_CODE, PHASE_CODE, CLSTR_CODE, BLDG_CODE, WING_ID, CONFIG_UNIT, FLOOR_ID_FR, FLOOR_ID_TO, ACTIVITY_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALIDATE_EXP_RES ( EXP_RES IN VARCHAR2, SPEC_REPR IN CHAR ) RETURN NUMBER AS MIN_VAL NUMBER; MAX_VAL NUMBER; RESULT NUMBER := 0; BEGIN IF SPEC_REPR = 'R' THEN IF REGEXP_LIKE(EXP_RES, '^\s*\d+(\.\d+)?\s*-\s*\d+(\.\d+)?\s*$') THEN MIN_VAL := TO_NUMBER(REGEXP_SUBSTR(EXP_RES, '^\s*(\d+(\.\d+)?)\s*-', 1, 1, NULL, 1)); MAX_VAL := TO_NUMBER(REGEXP_SUBSTR(EXP_RES, '-\s*(\d+(\.\d+)?)\s*$', 1, 1, NULL, 1)); IF MIN_VAL <= MAX_VAL THEN RESULT := 1; ELSE RESULT := 0; END IF; ELSE RESULT := 0; END IF; ELSIF SPEC_REPR = 'N' THEN IF REGEXP_LIKE(EXP_RES, '^-?\d+(\.\d+)?$') THEN RESULT := 1; ELSE RESULT := 0; END IF; ELSE RESULT := 1; END IF; RETURN RESULT; EXCEPTION WHEN NO_DATA_FOUND THEN RESULT := 0; WHEN VALUE_ERROR THEN RESULT := 0; WHEN OTHERS THEN RESULT := 0; RETURN RESULT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INDENT_TRAN_DATE_SITE_CONF ON INDENT (IND_DATE, SITE_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_STK_LOT_SL ON STOCK (LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_CHG_NO ( as_item_code in char , as_lot_no in char, al_rate in number) return NUMBER is lL_chg_no NUMBER; ls_chg_no varchar2(10); begin select CHG_REF_NO into ls_chg_no from pricelist where price_list = 'MRP' AND item_code = as_item_code and as_lot_no between lot_no__from and lot_no__to ; if ls_chg_no = 'MRP' Then lL_chg_no := 1 ; else lL_chg_no := 0 ; end if ; if al_rate = 0 then lL_chg_no := 9 ; end if; return lL_chg_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DRCR_PAY_CHK BEFORE INSERT OR UPDATE OF confirmed ON drcr_pay referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; ls_drcrflag drcr_pay.DRCR_FLAG%type; ls_refser gltrace.ref_ser%type; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin --select amount, DRCR_FLAG into lc_hdramt,ls_drcrflag from drcr_pay --where tran_id = :new.tran_id; lc_hdramt := :old.amount ; ls_drcrflag := :old.DRCR_FLAG; exception when others then lc_hdramt := 0; end; if ls_drcrflag = 'D' then ls_refser := 'DRNPAY'; else ls_refser := 'CRNPAY'; end if; begin select count(1) into ll_glcount from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if lc_hdramt <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but net amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE TBL_EMPLOYEE_WISE_HIERARCHY AS TABLE OF OBJ_EMPLOYEE_WISE_HIERARCHY; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHAPHEADING ( AS_ITEM_CODE CHAR) -- Function which returns chap heading with parmater of item code RETURN VARCHAR IS LS_VAL VARCHAR ( 50 ) ; BEGIN SELECT CHAP_HEADING INTO LS_VAL FROM TAXCHAP WHERE TAX_CHAP = ( SELECT TAX_CHAP FROM ITEM WHERE ITEM_CODE = AS_ITEM_CODE); rETURN LS_VAL ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STATION_DESCR (ls_site_code char, ls_stan_code char) return varchar2 is ls_descr VARCHAR2(40); begin select descr into ls_descr from station where stan_code = (select stan_code from site where site_code = ls_site_code) and rownum =1; return (nvl(ls_descr,'')); exception when no_data_found then select descr into ls_descr from station where stan_code = ls_stan_code and rownum = 1; return (nvl(ls_descr,'')); end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082581 ON AUDIT_TRAIL_DOC (CHG_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_QUALIFY_GRP__SITE ( as_qualify_grp__site CHAR ) RETURN NUMBER IS FLAG NUMBER(1); as_grp_site number(1); BEGIN IF as_qualify_grp__site = NULL OR NVL (LENGTH(TRIM(as_qualify_grp__site)),0) =0 THEN FLAG := 1; RETURN FLAG; ELSE select count(*) into as_grp_site from site where site_code =as_qualify_grp__site ; IF as_grp_site > 0 THEN FLAG := 1; RETURN FLAG; ELSE FLAG := 0; RETURN FLAG; END IF; END IF; EXCEPTION when others then Flag :=3; return FLAG; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PORDER_RECOAMT (as_porder in char , as_lineno in int, as_type char ,as_band in char) return number is lc_amt number(14,3) ; lc_taxdiff number(14,3) ; begin lc_taxdiff := 0 ; if as_type = 'S' and as_band = 'D' then select nvl(quantity*rate__std,0) into lc_amt from sorddet where sale_order = as_porder and line_no = as_lineno ; elsif as_type = 'S' and as_band = 'H' then select nvl(quantity*rate__std,0) into lc_amt from sorddet where sale_order = as_porder; elsif as_type = 'S' and as_band ='D' then select nvl(net_amt,0) into lc_amt from sorddet where sale_order = as_porder and line_no = as_lineno ; select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and a.line_no = as_lineno and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_amt + lc_taxdiff ; elsif as_type = 'R' and as_band = 'D' then -- reco amt select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and a.line_no = as_lineno and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_taxdiff ; elsif as_type = 'R' and as_band = 'H' then -- reco amt select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_taxdiff ; elsif as_type = 'P' and as_band = 'H' then -- std cost select sum(nvl(quantity,0) * nvl(std_rate ,0)) into lc_amt from porddet where purc_order = as_porder; end if ; lc_amt := NVL(lc_amt,0) ; return lc_amt ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SITE_HOLTBL_MAP_X ON SITE_HOLTBL_MAP (SITE_CODE, HOL_TBLNO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WOD_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from workorder_iss where tran_id=as_tran_id and tran_type='O'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STRG_QUAL (msc_code in char, mqlf_code in char) return char is mqual_descr varchar2(20); begin select sh_descr into mqual_descr from qualification a, strg_qualification b where b.qlf_code = a.qlf_code and b.sc_code = msc_code and b.qlf_code = mqlf_code; return mqual_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_ROUT (as_tran_id varchar2,as_sales_pers varchar2,as_locality varchar2,as_option varchar2) RETURN varchar2 IS route varchar2(60); plan number(5,0); BEGIN select count(plan_id) into plan from strg_meet where tran_id=as_tran_id ; IF plan >0 THEN IF as_option='C' THEN select route_id into route from sprs_route where sprs_code=as_sales_pers and locality_code=as_locality ; RETURN NVL(route,'Not Defined'); ELSIF as_option='D' THEN select descr into route from sprs_route where sprs_code=as_sales_pers and locality_code=as_locality ; RETURN NVL(route,'Not Defined'); END IF ; ELSIF plan=0 THEN RETURN '-' ; END IF ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN '-'; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEM_APPL_FOR_ITEM_SER (as_cust_code CHAR,as_itemser in itemser.item_ser%type,as_itemcode item.item_code%type, ls_itemser itemser.item_ser%type) return char is ls_othseries itemser.OTH_SERIES%type; ls_retval char(1) := 'N'; ls_cnt number := 0; BEGIN begin --raise_application_error( -20601, 'value of as_itemser is.. [' || as_itemser || ']'); if as_itemser = null or as_itemser ='' or trim(length(as_itemser)) = 0 then ls_retval := 'Y'; return ls_retval; end if; end; begin --raise_application_error( -20601, 'value of as_itemser is.. [' || as_itemser || ']'); select OTH_SERIES into ls_othseries from itemser where item_ser = as_itemser; exception when others then ls_othseries := 'N'; end; if ls_othseries = 'Y' or trim(ls_itemser) = trim(as_itemser) then ls_retval := 'Y'; return ls_retval; end if; if ls_othseries = 'N' and as_cust_code is not null and length(trim(as_cust_code)) > 0 then --raise_application_error( -20601, 'value of ls_itemser is.. [' || ls_itemser || ']'); select count(*) into ls_cnt from customer_series where cust_code = as_cust_code and item_ser = ls_itemser; --raise_application_error( -20601, 'value of ls_cnt is.. [' || ls_cnt || ']'); if(ls_cnt > 0) then ls_retval := 'Y'; return ls_retval; else ls_retval := 'N'; end if; end if; RETURN (ls_retval); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIPT_TRAN_DATE_SITE_CODE ON RECEIPT (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER QC_ORDER_LOT_CHECK BEFORE INSERT ON qc_order FOR EACH ROW DECLARE v_count NUMBER := 0; v_loc_code stock.loc_code%TYPE; v_lot_sl stock.lot_sl%TYPE; BEGIN IF :NEW.SOURCE_APP = 'RETEST' THEN SELECT COUNT(*) INTO v_count FROM stock WHERE site_code = :NEW.site_code AND item_code = :NEW.item_code AND lot_no = :NEW.lot_no AND quantity > 0; IF v_count = 1 THEN SELECT loc_code, lot_sl INTO v_loc_code, v_lot_sl FROM stock WHERE site_code = :NEW.site_code AND item_code = :NEW.item_code AND lot_no = :NEW.lot_no AND quantity > 0 AND ROWNUM = 1; IF :NEW.loc_code IS NULL OR :NEW.lot_sl IS NULL OR :NEW.loc_code <> v_loc_code OR :NEW.lot_sl <> v_lot_sl THEN RAISE_APPLICATION_ERROR(-20001, 'For single stock record, loc_code and lot_sl must be provided and match stock.'); END IF; ELSIF v_count > 1 THEN IF :NEW.loc_code IS NOT NULL OR :NEW.lot_sl IS NOT NULL THEN RAISE_APPLICATION_ERROR(-20002, 'For multiple stock records, loc_code and lot_sl must be NULL.'); END IF; END IF; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ADSLABS_DATEWISE ON AD_SLABS (AD_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_STRG_CUST_ADDR (as_CUST in char ) return char is ls_name varchar2(120) ; begin IF as_CUST = NULL OR LENGTH(as_CUST) =0 THEN ls_name := ' '; RETURN ls_name; ELSE select addr1 ||', ' ||addr2 ||', '|| addr3 INTO LS_NAME FROM STRG_CUSTOMER WHERE SC_CODE = AS_CUST; IF LS_NAME =', , ' THEN RETURN ''; ELSE RETURN LS_NAME; end if; end if; exception when NO_DATA_FOUND then ls_name := ' '; return ls_name; when others then ls_name := ' '; RETURN LS_NAME; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WOI_RATE BEFORE INSERT ON workorder_issdet referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; lc_rate number(15,4) := 0; ls_stkopt char(1); BEGIN begin select stk_opt into ls_stkopt from item where item_code = :new.item_code; exception when others then ls_stkopt := '0'; end; if :new.rate is null and ls_stkopt <> '0' then begin select rate into lc_rate from item_lot_info where item_code = :new.item_code and lot_no = :new.lot_no; exception when others then lc_rate := 0; end; :new.rate := lc_rate; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVS_SOSTK (as_cust_code__bil in sorder.cust_code__bil%type,as_cust_code in sorder.cust_code%type) return number is FLAG NUMBER(1); ls_count number(10,0); ls_cust_code__bil CHAR(10); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_CUST_DRUGLIC'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then select CUST_CODE__BIL into ls_cust_code__bil from customer where cust_code=as_cust_code; if as_cust_code__bil <> ls_cust_code__bil then RETURN 0 ; Else RETURN 1; end if; else RETURN 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INVOICE_TRACE_X ON INVOICE_TRACE (INVOICE_ID, INV_LINE_NO, DESP_ID, DESP_LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_PATCH_EXCIPIENT (mexci_per_patch in number, mnon_volatile_mass_form in number, mexpr_process_size in number, mtot_non_volatile_mass_form in number) return number is mpotency number(14,6) := 0; begin -- if any independent value in the denominator is ZERO, Potency Adjusted will be set as ZERO if mtot_non_volatile_mass_form = 0 then mpotency := 0; else mpotency := round( (mexci_per_patch * (mnon_volatile_mass_form /100) * mexpr_process_size) / (mtot_non_volatile_mass_form * 100), 6); end if; return mpotency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUSTOMER_STAN ON CUSTOMER (STAN_CODE, BLACK_LISTED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDATEDIFF (arg2 date,arg1 date ) return number is month number(10); begin select months_between(arg1,arg2) into month from dual; return month; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082568 ON ROUTE_STATUS_HIST (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_TERM_AMD_X ON SALES_QUOT_TERM_AMD (AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALIDATE_NAME ( as_fullname in varchar2,as_customer_type in varchar2) return number is result_value number(14); ls_customer_type varchar2(20); count_1 number(10); sum_1 number(10); begin select substr(as_customer_type,'1',INSTR(as_customer_type,'-')-1) INTO ls_customer_type FROM DUAL; if(ls_customer_type = 'UNLISTED') then with customer_name as ( select trim(regexp_substr ( as_fullname, '[^ ]+', 1, level )) names from dual connect by level <= length ( trim(as_fullname) ) - length ( replace (trim(as_fullname), ' ' ) ) + 1) select COUNT(customer_name.names) into count_1 from customer_name; if(count_1<4) then with customer_name as ( select trim(regexp_substr ( as_fullname, '[^ ]+', 1, level )) names from dual connect by level <= length ( trim(as_fullname) ) - length ( replace (trim(as_fullname), ' ' ) ) + 1) select sum(FN_GET_NAME_LENGTH(customer_name.names)) into sum_1 from customer_name; if(sum_1= 0) then result_value := 0; else result_value := 1; end if; else result_value := 1; end if; else result_value := 0; end if; return result_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DR_CONS_RECIEVED_X ON DR_CONS_RECIEVED (SALES_PERS, WORK_DATE, CONS_ISSUE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_TOUR_EMP_CONF (AS_TOUR_ID char,AS_EMP_CODE char,AS_FROM_DATE date,AS_TO_DATE date,AS_TOUR_START char,AS_TOUR_END char, AS_NO_DAYS number) return varchar is ls_return varchar2(100); a_cnt number(1); as_emp_site employee.emp_site%type; cursor c1 is select b.adate,c.sno,a.date_from,a.date_to from tour a,nsrno b,nsrno c where a.emp_code = AS_EMP_CODE and (a.date_from between AS_FROM_DATE and AS_TO_DATE or a.date_to between AS_FROM_DATE and AS_TO_DATE or AS_FROM_DATE between a.date_from and a.date_to or AS_TO_DATE between a.date_from and a.date_to) and a.tour_id <> nvl(AS_TOUR_ID,' ') and a.status != 'C' and b.adate between a.date_from and a.date_to and c.sno between 1 and 2 and instr((case when (a.tour_starts = 'S' and a.tour_ends = 'E') or (a.date_from <> b.adate and a.date_to <> b.adate) or (a.date_from <> a.date_to and a.date_from = b.adate and a.tour_starts = 'S') or (a.date_from <> a.date_to and a.date_to = b.adate and a.tour_ends = 'E') then '12' when (a.date_from = b.adate and a.tour_starts = 'S') or (a.date_to = b.adate and a.tour_ends = 'B') then '1' when (a.date_from = b.adate and a.tour_starts = 'B') or (a.date_to = b.adate and a.tour_ends = 'E') then '2' end),c.sno) != 0 order by b.adate,c.sno; cursor c2 (c1date date,c1sno number) is select b.adate,c.sno from nsrno b,nsrno c where b.adate between AS_FROM_DATE and AS_TO_DATE and c.sno between 1 and 2 and instr((case when (AS_TOUR_START = 'S' and AS_TOUR_END = 'E') or (AS_FROM_DATE <> b.adate and AS_TO_DATE <> b.adate) or (AS_FROM_DATE <> AS_TO_DATE and AS_FROM_DATE = b.adate and AS_TOUR_START = 'S') or (AS_FROM_DATE <> AS_TO_DATE and AS_TO_DATE = b.adate and AS_TOUR_END = 'E') then '12' when (AS_FROM_DATE = b.adate and AS_TOUR_START = 'S') or (AS_TO_DATE = b.adate and AS_TOUR_END = 'B') then '1' when (AS_FROM_DATE = b.adate and AS_TOUR_START = 'B') or (AS_TO_DATE = b.adate and AS_TOUR_END = 'E') then '2' end),c.sno) != 0 and b.adate = c1date and c.sno = c1sno order by b.adate,c.sno; begin /* -- 25032022 added select emp_site,(case when (AS_TO_DATE < '01-APR-2022') then 1 else 0 end) into as_emp_site,a_cnt from employee where emp_code = AS_EMP_CODE; if (a_cnt = 0 and as_emp_site != 'SP834') then ls_return := 'Based on HR Communication, entry effective 01/Apr/2022 restricted.'; return ls_return; end if; */ for i in c1 loop for ii in c2 (i.adate,i.sno) loop return 'Tour already exist for selected days'; end loop; if (AS_FROM_DATE = AS_TO_DATE and i.date_from = i.date_to) then return 'For a particular day, two entries of respective half are not allowed. Need to enter one entry of full day.'; end if; end loop; return null; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER AUDIT_APRLEV after insert or update or delete on APRLEV for each row declare time_now date; terminal char(10); userid char(10); begin time_now := sysdate; terminal := userenv('terminal'); if inserting then insert into audit_table values (audit_seq.nextval, user, terminal, time_now, 'APRLEV', 'insert', :new.APR_CODE); else if deleting then insert into audit_table values (audit_seq.nextval, user, terminal, time_now, 'APRLEV', 'delete', :old.APR_CODE); insert into audit_table_values values (audit_seq.currval, 'APR_CODE', :old.APR_CODE, '' ); insert into audit_table_values values (audit_seq.currval, 'AUTO_APR', :old.AUTO_APR, '' ); insert into audit_table_values values (audit_seq.currval, 'DESCR', :old.DESCR, '' ); insert into audit_table_values values (audit_seq.currval, 'LEVEL', to_char(:old.LEVEL), '' ); else insert into audit_table values (audit_seq.nextval, user, terminal, time_now, 'APRLEV', 'update', :old.APR_CODE); if updating ('APR_CODE') then insert into audit_table_values values (audit_seq.currval, 'APR_CODE', :old.APR_CODE, :new.APR_CODE); end if; if updating ('AUTO_APR') then insert into audit_table_values values (audit_seq.currval, 'AUTO_APR', :old.AUTO_APR, :new.AUTO_APR); end if; if updating ('DESCR') then insert into audit_table_values values (audit_seq.currval, 'DESCR', :old.DESCR, :new.DESCR); end if; if updating ('LEVEL') then insert into audit_table_values values (audit_seq.currval, 'LEVEL', to_char(:old.LEVEL), to_char(:new.LEVEL)); end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_TRANS_HIERARCHY_DET ON TRANS_HIERARCHY_DET (REF_ID, REF_SER, REF_TYPE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RCPDET_LINENOUPD before insert on rcpdet for each row declare max_line_no number(4); begin max_line_no := 0; if :new.line_no is null or :new.line_no = 0 then select max(line_no) into max_line_no from rcpdet where tran_id = :new.tran_id; :new.line_no := nvl(max_line_no , 0) + 1; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_WOBATCHQTY (as_routecode workorder.route_code%type, as_operation workorder_iss.operation%type, ai_woqty workorder.quantity%type, as_wo workorder.work_order%type) return number is li_process_size number(14,3); begin select process_size into li_process_size from procroute where route_code = as_routecode and operation = as_operation and rownum = 1; return li_process_size; exception when NO_DATA_FOUND then return ai_woqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_SALESORDER_DET ( as_invoice_id CHAR ) return varchar2 is ls_return varchar2(500) ; ls_cust_order_dt varchar2(4000) ; counter number(10); begin declare cursor cur1 is SELECT (sord_no||':'||ord_dt) AS ord_date FROM (select distinct invoice_trace.sord_no,to_char(sorder.order_date,'dd/mm/yy') as ord_dt from invoice_trace,sorder where ( invoice_trace.sord_no = sorder.sale_order ) and invoice_trace.invoice_id = as_invoice_id order by invoice_trace.sord_no,to_char(sorder.order_date,'dd/mm/yy') ); begin counter := 0; for i in cur1 loop counter := counter + 1; if counter = 1 then ls_cust_order_dt:= i.ord_date ; else if i.ord_date is not null then ls_cust_order_dt := TRIM(ls_cust_order_dt) ||','|| i.ord_date ; end if; end if; end loop ; end ; IF ls_cust_order_dt IS NULL THEN ls_return := ' ' ; ELSE ls_return := ls_cust_order_dt ; END IF; return ls_return ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_SITEITEM_RB (as_itemcode in char, as_sitecode in char,as_bk_type in char) return varchar2 is ls_retval varchar2(1) := '0'; by_count number(6,0) := 0; begin if as_bk_type = 'C' then begin select count(1) into by_count from siteitem where item_code=as_itemcode and site_code=as_sitecode ; if by_count >0 then ls_retval:= 0; else ls_retval:= 1; end if; end ; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_POD_CHK ( as_saleorder in sorder.sale_order%type) RETURN number IS TYPE InvCurTyp IS REF CURSOR; TYPE DtlCurTyp IS REF CURSOR; TYPE ItemCurTyp IS REF CURSOR; inv_cur InvCurTyp; cnumber number ; inv_type varchar2(3); inv_type_list varchar2(600); pod_cnt number; ls_invoiceid char(10); ls_sql_stmt varchar2(3000); ls_custCodeBill customer.cust_code%type; ls_siteCode site.site_code%type; -- 17 Sep 2013 hdr_sql_stmt varchar2(3000); dtl_sql_stmt varchar2(3000); podqty_sum number; inv_qty number; dtl_cur DtlCurTyp; item_cur ItemCurTyp; ls_podtranid char(10); itemcode char(10); lineno number; ls_itemSerSO char(5); itemSerCnt number; last_day_of_month number; -- 29-Nov-2013 curr_date varchar2(2); curr_mon varchar2(2); curr_yr varchar2(2); invoice_mnth varchar2(2); begin_date varchar2(8); end_date varchar2(8); BEGIN cnumber := 0; begin select '''' || replace(var_value,',',' '',''') || ' ''' into inv_type_list from disparm where var_name = 'POD_INV_TYPE' and prd_code = '999999'; exception when others then return -1; end; begin --select site_code, cust_code__bil into ls_siteCode, ls_custCodeBill FROM sorder where sale_order = as_saleorder and order_type in(inv_type_list); --select site_code, cust_code__bil, item_ser into ls_siteCode, ls_custCodeBill, ls_itemSerSO FROM sorder where sale_order = as_saleorder and order_type in(select '''' || replace(var_value,',',''',''') || '''' from disparm where var_name = 'POD_INV_TYPE' and prd_code = '999999'); select site_code, cust_code__bil, item_ser into ls_siteCode, ls_custCodeBill, ls_itemSerSO FROM sorder where sale_order = as_saleorder and order_type in('DM','IS'); exception when NO_DATA_FOUND then return 0; end; --ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = ''' || ls_custCodeBill ||''' and site_code = ''' || ls_siteCode ||''' and inv_type in ('||inv_type_list||') and sysdate - conf_date > 29'; -- commented as per new requirement --ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = :ls_custCodeBill and site_code = :ls_siteCode and inv_type in ('||inv_type_list||') and sysdate - conf_date > 29'; ls_sql_stmt := 'select invoice_id from invoice where cust_code__bil = ''' || ls_custCodeBill || ''' and site_code = ''' || ls_siteCode || ''' and inv_type in (''DM'',''IS'') and (sysdate - last_day(conf_date)) > 30'; begin -- cursor for multiple invoices against passed cust_code OPEN inv_cur FOR ls_sql_stmt ;--USING ls_custCodeBill, ls_siteCode; -- Fetch rows from result set one at a time: <> LOOP FETCH inv_cur INTO ls_invoiceid; EXIT WHEN inv_cur%NOTFOUND; begin select count(1) into pod_cnt from spl_sales_por_hdr where invoice_id = ls_invoiceid and confirmed='Y'; exception when others then return -2; end; if pod_cnt > 0 then hdr_sql_stmt := 'select sum(d.quantity__resale),sum(d.quantity__inv) from spl_sales_por_hdr h,spl_sales_por_det d where h.tran_id=d.tran_id and h.invoice_id = '''||ls_invoiceid||''' and h.confirmed =''Y'' group by d.item_code,d.line_no__trace,d.lot_no,d.lot_sl'; begin open dtl_cur for hdr_sql_stmt;-- for check invoice amt and resale amt match or not. <> Loop FETCH dtl_cur INTO podqty_sum,inv_qty; EXIT WHEN dtl_cur%NOTFOUND; if dtl_cur%FOUND then if podqty_sum < inv_qty then return 1; else goto continue2; end if; end if; end LOOP; end; CLOSE dtl_cur; --exit else begin cnumber := fn_miscdrcr_chk(ls_invoiceid) ; if cnumber = 0 then goto continue1 ; else return cnumber; end if; end; end if; -- end of else for partial POD END LOOP; -- Close cursor: CLOSE inv_cur; exception when others then return -1; end; return cnumber; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX QC_ORDER_SITE_LOC_ITEM ON QC_ORDER (SITE_CODE, LOC_CODE, ITEM_CODE, LOT_NO, LOT_SL, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LOTNO_ON_CREATESTAB (as_item_code char,ad_ord_date date, as_site_code char) return varchar2 is ls_lot_no varchar2(100); ld_tran_date date; ls_tranid workorder_receipt.tran_id%type; ldt_trandt workorder_receipt.tran_date%type; begin select max(lot_no) , max(tran_id) , max(tran_date) into ls_lot_no , ls_tranid , ldt_trandt from workorder_receipt where tran_date >= ad_ord_date and tran_date <= (select max(ord_date + 365) from workorder where item_code = as_item_code and site_code = as_site_code and ord_date = ad_ord_date) and create_stab = 'Y'; dbms_output.put_line('sqlcode :::::: ' || sqlcode ); dbms_output.put_line('ls_lot_no :::::: ' || ls_lot_no ); dbms_output.put_line('ldt_trandt :::::: ' || ldt_trandt ); if length(trim(ls_lot_no)) > 0 and to_char(ldt_trandt,'dd/mm/yy') <> '01/01/00' then ls_lot_no := 'Last Batch No of Stability : '||trim(ls_lot_no) ||' Receipt date : ' || to_char(ldt_trandt); else ls_lot_no := null; end if; return ls_lot_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_HOLIDAY (as_tran_id char ,as_sales_pers char, as_date date, as_option char) return number is HolTblno char(5); Mth varchar2(2); Yr varchar2(4); MaxDt date; MinDt date; MaxMeetDt date; CntMeet Number(4); Cnt Number(4); CntTran Number(4); MaxTranId char(10); begin select hol_tblno into HolTblNo from employee where trim(emp_code) = (select trim(emp_code) from sales_pers where trim(sales_pers)=trim(as_sales_pers)); select to_char(to_date(as_date),'MM'), to_char(to_date(as_date),'YYYY') into Mth, Yr from dual; select max(dt),min(dt) into MaxDt, MinDt from sfa_time where Year=to_number(Yr) and Month_no=to_number(Mth); select max(event_date), count(event_date) into MaxMeetDt, CntMeet from strg_meet where trim(sales_pers)=trim(as_sales_pers) and event_date between MinDt and MaxDt; if(as_option='H') then if(CntMeet >=1) then if(MaxMeetDt = as_date) then select count(tran_id),max(tran_id) into CntTran,MaxTranId from strg_meet where event_date = MaxMeetDt and trim(sales_pers)=trim(as_sales_pers); if (CntTran >= 1 and trim(as_tran_id) =trim(MaxTranId)) then select count(hol_date) into Cnt from holiday where to_char(to_date(hol_date),'MM')=Mth and to_char(to_date(hol_date),'YYYY')=Yr and trim(hol_tblno)=trim(HolTblNo) and hol_type='H'; elsif (trim(as_tran_id) <>trim(MaxTranId)) then Cnt:= 0; end if; elsif(MaxMeetDt != as_date) then Cnt:= 0; end if; else Cnt:= 0; end if; elsif(as_option='W') then if(CntMeet >=1) then if(MaxMeetDt = as_date) then select count(tran_id),max(tran_id) into CntTran,MaxTranId from strg_meet where event_date = MaxMeetDt and trim(sales_pers)=trim(as_sales_pers); if (CntTran >= 1 and trim(as_tran_id) =trim(MaxTranId)) then select count(hol_date) into Cnt from holiday where to_char(to_date(hol_date),'MM')=Mth and to_char(to_date(hol_date),'YYYY')=Yr and trim(hol_tblno)=trim(HolTblNo) and hol_type='W'; elsif (trim(as_tran_id) <>trim(MaxTranId)) then Cnt:= 0; end if; elsif(MaxMeetDt != as_date) then Cnt:= 0; end if; else Cnt:= 0; end if; elsif(as_option='M') then if(CntMeet >=1) then if(MaxMeetDt = as_date) then select count(tran_id),max(tran_id) into CntTran,MaxTranId from strg_meet where event_date = MaxMeetDt and trim(sales_pers)=trim(as_sales_pers); if (CntTran >= 1 and trim(as_tran_id) =trim(MaxTranId)) then select count(distinct dt) into Cnt from sfa_time where month_no=to_number(Mth) and year=to_number(Yr); elsif (trim(as_tran_id) <>trim(MaxTranId)) then Cnt:= 0; end if; elsif(MaxMeetDt != as_date) then Cnt:= 0; end if; else Cnt:= 0; end if; end if; return nvl(Cnt,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ACCT_BUDGET (macct_code in char, mcctr_code in char) return number is mbud_amt number(14,3) := 0; begin select budget_amt into mbud_amt from acctbudget where acct_code = macct_code and cctr_code = mcctr_code and trunc(sysdate) between from_date and to_date; return mbud_amt; exception when others then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFF_DOC_MET_MST force AS OBJECT ( SC_CODE VARCHAR2(30), DR_NAME VARCHAR2(120), SPECIALITY VARCHAR2(120), PLANNED_VISIT VARCHAR2(4), CLASS_DESCR VARCHAR2(60), CATEGORY VARCHAR2(60), LOCALITY VARCHAR2(120), ROUTE_TYPE VARCHAR2(60), MET_DATES VARCHAR2(120), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), DIVISION VARCHAR2(30), EMP_CODE VARCHAR2(30), EMP_NAME VARCHAR2(50), HEAD_QUAT VARCHAR2(50), DESIGN VARCHAR2(30) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FT_BENEFIT_LINKDET_X ON FT_BENEFIT_LINKDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUD_GRP_ALLO_X ON BUD_GRP_ALLO (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ACCT_YTD (AS_ACCT_CODE CHAR) Return number is acct_ytd_bal number(14,3); op_bal number(14,3); ld_dr_cr number(14,3); Begin select nvl(SUM(DR_AMT__BASE - CR_AMT__BASE),0) into op_bal from acctbal where acct_code = AS_ACCT_CODE AND ACCT_PRD = (Select Code From Acctprd where to_date(sysdate) between fr_date and to_date) AND PRD_CODE < (Select Code From Period where to_date(sysdate) between fr_date and to_date); Select nvl(Sum(dr_amt - cr_amt),0) into ld_dr_cr from gltran where acct_code = AS_ACCT_CODE and tran_date >= (Select fr_date From Period where to_date(sysdate) between fr_date and to_date) and tran_date <= to_date(sysdate); acct_ytd_bal := nvl((op_bal+ld_dr_cr),0); return acct_ytd_bal; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CMEMEET_COUNT (ls_emp IN CHAR,ls_month IN char,ls_year IN char,ls_activity in char) return number is cme_meet_count number(14,3); BEGIN begin if ls_activity = 'CME' THEN SELECT SUM(cme_meet_count) INTO cme_meet_count FROM ( SELECT NVL(Count(sat.activity_code),0) AS cme_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'MKTEV' and instr((select ','||trim(prop_value)||','from properties where prop_name='CME_ACTIVITY'), ',' || TRIM(fa.activity_code) ||',')>0 AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year UNION ALL SELECT NVL(Count(sat.activity_code)/2,0) AS cme_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'MKTEV' and instr((select ','||trim(prop_value)||','from properties where prop_name='HLF_CME_ACTIVITY'), ',' || TRIM(fa.activity_code) ||',')>0 AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year ) ; ELSIF ls_activity = 'RTM' THEN SELECT SUM(cme_meet_count) INTO cme_meet_count FROM ( SELECT NVL(Count(sat.activity_code),0) AS cme_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'MKTEV' and instr((select ','||trim(prop_value)||','from properties where prop_name='RTM_ACTIVITY'), ',' || TRIM(fa.activity_code) ||',')>0 AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year UNION ALL SELECT NVL(Count(sat.activity_code)/2,0) AS cme_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'MKTEV' and instr((select ','||trim(prop_value)||','from properties where prop_name='HLF_RTM_ACTIVITY'), ',' || TRIM(fa.activity_code) ||',')>0 AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year ) ; ELSIF ls_activity = 'RTM_OTH' THEN SELECT SUM(cme_meet_count) INTO cme_meet_count FROM ( SELECT NVL(Count(sat.activity_code),0) AS cme_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'MKTEV' and (instr((select ','||trim(prop_value)||','from properties where prop_name='RTM_ACTIVITY'), ',' || TRIM(fa.activity_code) ||',')>0 or instr((select ','||trim(prop_value)||','from properties where prop_name='OTH_ACTIVITY'), ',' || TRIM(fa.activity_code) ||',')>0) AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year UNION ALL SELECT NVL(Count(sat.activity_code)/2,0) AS cme_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'MKTEV' and (instr((select ','||trim(prop_value)||','from properties where prop_name='HLF_RTM_ACTIVITY'), ','||TRIM(fa.activity_code)||',')>0 or instr((select ','||trim(prop_value)||','from properties where prop_name='HLF_OTH_ACTIVITY'), ','||TRIM(fa.activity_code)||',')>0) AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year ) ; END IF; exception when no_data_found then cme_meet_count:=0; end; RETURN cme_meet_count ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE MIN_RATE_UPD_NONSCHEME (as_sitecode in invoice.site_code%type, adt_trandate in date) is begin declare ln_inv_rate invoice_trace.rate%type; ls_cust_code invoice.cust_code%type; ls_cust_code__bil invoice.cust_code%type; ln_eff_cost min_rate_history.eff_cost%type; ls_doc_key min_rate_history.doc_key%type; ls_doc_key2 min_rate_history.doc_key%type; ls_doc_key3 min_rate_history.doc_key%type; ls_doc_key4 min_rate_history.doc_key%type; ls_doc_key5 min_rate_history.doc_key%type; ls_invoice_id invoice.invoice_id%type; ld_tran_date invoice.tran_date%type; ls_site_code invoice.site_code%type; ll_cnt number; ls_item_code stock.item_code%type; ls_lot_no stock.lot_no%type; ls_sitecode stock.site_code%type; ll_scheme number := 0; ls_sordno invoice_trace.SORD_NO%type; ls_sordline invoice_trace.SORD_LINE_NO%type; ll_ctr number(6) := 0; ll_ctr1 number(6) := 0; begin for cur_invtrace in ( select it.invoice_id, it.SORD_NO, it.SORD_LINE_NO, it.exp_lev, it.item_code,i.site_code,i.cust_code,i.cust_code__bil,i.tran_date,count(distinct it.lot_no) from invoice_trace it, invoice i where i.invoice_id = it.invoice_id and i.tran_date >= adt_trandate group by it.invoice_id, it.SORD_NO, it.SORD_LINE_NO, it.exp_lev, it.item_code,i.site_code,i.cust_code,i.cust_code__bil,i.tran_date having count(distinct it.lot_no) > 1) loop begin ls_invoice_id := cur_invtrace.invoice_id ; ll_ctr1 := ll_ctr1 + 1; dbms_output.put_line('counter [' || to_char(ll_ctr1) || ']') ; ll_scheme := 0; select count(distinct EXP_LEV) into ll_scheme from invoice_trace where invoice_id = cur_invtrace.invoice_id and SORD_NO = cur_invtrace.SORD_NO and SORD_LINE_NO = cur_invtrace.SORD_LINE_NO and item_code = cur_invtrace.item_code ; exception when others then ll_scheme := 0; end; dbms_output.put_line('ll_scheme [' || to_char(ll_scheme) || ']') ; if ll_scheme = 1 then ll_ctr := ll_ctr + 1; ls_site_code := cur_invtrace.site_code; ls_cust_code := cur_invtrace.cust_code; ls_cust_code__bil := cur_invtrace.cust_code__bil; ld_tran_date := cur_invtrace.tran_date; for cur_lot in ( select lot_no,Round(sum((quantity * rate) - ( ((quantity * rate)*discount)/100)) / sum(quantity),2) as inv_rate from invoice_trace where invoice_id = cur_invtrace.invoice_id and SORD_NO = cur_invtrace.SORD_NO and SORD_LINE_NO = cur_invtrace.SORD_LINE_NO and item_code = cur_invtrace.item_code group by lot_no ) loop ln_inv_rate := cur_lot.inv_rate; ----------------------------------------------------------------------------------- dbms_output.put_line('counter [' || to_char(ll_ctr) || '] inv_rate [' || to_char(cur_lot.inv_rate) || '] item_code [' || cur_invtrace.item_code ||'] lot_no [' || trim(cur_lot.lot_no) || ']') ; if ln_inv_rate > 0 then ls_doc_key := trim(ls_site_code)||','||trim(ls_cust_code)||','||trim(cur_invtrace.item_code)||','||trim(cur_lot.lot_no)||','||trim(ls_invoice_id); ---checking if record present for the doc key select count(1) into ll_cnt from min_rate_history where doc_key = ls_doc_key; ---if record found than rate will be updated for existing key dbms_output.put_line('counter [' || to_char(ll_ctr) || '] ls_doc_key [' || to_char(ls_doc_key) || '] item_code [' || cur_invtrace.item_code ||'] lot_no [' || trim(cur_lot.lot_no) || ']') ; if ll_cnt = 1 then --update of min_rate_history for new lower rate for the doc key update min_rate_history set eff_cost=ln_inv_rate, invoice_id=ls_invoice_id, invoice_date=ld_tran_date, chg_date = fn_sysdate(), chg_user = 'SYSTEM', chg_term = 'SYS'||to_char(sysdate,'ddmmyy') where doc_key = ls_doc_key; end if; ---KEY 2 ---creating the doc key for site_code, cust_code, item_code, lot_no, invoice_id --ls_doc_key2 := trim(ls_site_code)||','||trim(ls_cust_code)||','||trim(ls_item_code)||','||trim(ls_lot_no)||','||trim(ls_invoice_id); ls_doc_key2 := trim(ls_site_code)||','||trim(ls_cust_code)||','||trim(cur_invtrace.item_code)||','||trim(cur_lot.lot_no); ---checking if record present for the doc key select count(1) into ll_cnt from min_rate_history where doc_key = ls_doc_key2; ---if record found than rate will be updated for existing key if ll_cnt = 1 then --update of min_rate_history for new lower rate for the doc key update min_rate_history set eff_cost=ln_inv_rate, invoice_id=ls_invoice_id, invoice_date=ld_tran_date, chg_date = fn_sysdate(), chg_user = 'SYSTEM', chg_term = 'SYS'||to_char(sysdate,'ddmmyy') where doc_key = ls_doc_key2; end if; ----key3 ---creating the doc key for site_code, cust_code__bil, item_code, lot_no --ls_doc_key3 := trim(ls_site_code)||','||trim(ls_cust_code__bil)||','||trim(ls_item_code)||','||trim(ls_lot_no); ls_doc_key3 := trim(ls_cust_code)||','||trim(cur_invtrace.item_code)||','||trim(cur_lot.lot_no); ---checking if record present for the doc key select count(1) into ll_cnt from min_rate_history where doc_key = ls_doc_key3; ---if record found than rate will be updated for existing key if ll_cnt = 1 then --update of min_rate_history for new lower rate for the doc key update min_rate_history set eff_cost=ln_inv_rate, invoice_id=ls_invoice_id, invoice_date=ld_tran_date, chg_date = fn_sysdate(), chg_user = 'SYSTEM', chg_term = 'SYS'||to_char(sysdate,'ddmmyy') where doc_key = ls_doc_key3; end if; ----KEY4 ---creating the doc key for site_code, cust_code, item_code, lot_no --ls_doc_key4 := trim(ls_site_code)||','||trim(ls_cust_code)||','||trim(ls_item_code)||','||trim(ls_lot_no); ls_doc_key4 := trim(ls_site_code)||','||trim(cur_invtrace.item_code)||','||trim(cur_lot.lot_no); ---checking if record present for the doc key select count(1) into ll_cnt from min_rate_history where doc_key = ls_doc_key4; ---if record found than rate will be updated for existing key if ll_cnt = 1 then --update of min_rate_history for new lower rate for the doc key update min_rate_history set eff_cost=ln_inv_rate, invoice_id=ls_invoice_id, invoice_date=ld_tran_date, chg_date = fn_sysdate(), chg_user = 'SYSTEM', chg_term = 'SYS'||to_char(sysdate,'ddmmyy') where doc_key = ls_doc_key4; end if; ----key 5 ---creating the doc key for site_code, item_code, lot_no --ls_doc_key5 := trim(ls_site_code)||','||trim(ls_item_code)||','||trim(ls_lot_no); ls_doc_key5 := trim(ls_cust_code)||','||trim(cur_invtrace.item_code); ---checking if record present for the doc key select count(1) into ll_cnt from min_rate_history where doc_key = ls_doc_key5; ---if record found than rate will be updated for existing key if ll_cnt = 1 then --update of min_rate_history for new lower rate for the doc key update min_rate_history set eff_cost=ln_inv_rate, invoice_id=ls_invoice_id, invoice_date=ld_tran_date, chg_date = fn_sysdate(), chg_user = 'SYSTEM', chg_term = 'SYS'||to_char(sysdate,'ddmmyy') where doc_key = ls_doc_key5; end if; end if; ----------------------------------------------------------------------------------- end loop; end if; end loop; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CHANGE_HOLIDAY_X ON CHANGE_HOLIDAY (EMP_CODE, HOL_DATE_FOR, HOL_DATE_TO, HOL_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_REFUNDCLAIM (as_refser in char, as_refid in char) RETURN CHAR IS ls_taxclass taxclass.tax_class%type; ls_refundclaim char(1); ls_refid invoice.invoice_id%type; ls_refser taxtran.tran_code%type; begin ls_refser := trim(as_refser); ls_refid := trim(as_refid); if trim(ls_refser) = 'S-INV' then begin select tax_class into ls_taxclass from invoice where invoice_id = ls_refid; exception when others then ls_taxclass := ' '; end; if ls_taxclass is null or length(trim(ls_taxclass)) is null or length(trim(ls_taxclass)) = 0 then begin select tax_class into ls_taxclass from invoice_trace where invoice_id = ls_refid and line_no = 1; exception when others then ls_taxclass := ' '; end; end if; end if; if ls_taxclass is not null and length(trim(ls_taxclass)) is not null and length(trim(ls_taxclass)) > 0 then begin select refund_claim into ls_refundclaim from taxclass where tax_class = ls_taxclass; exception when others then ls_refundclaim := 'N'; end; if ls_refundclaim is null or ls_refundclaim = ' ' then ls_refundclaim := 'N'; end if; else ls_refundclaim := 'N'; end if; return ls_refundclaim; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CONSISSRETN_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON consume_iss referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_consissretncount number(3) := 0; ll_count number(6) := 0; lc_allocqty number(14,3) := 0; ls_msg varchar2(2000); BEGIN if :new.confirmed = 'Y' and :old.tran_type = 'R' then begin select count(1) into ll_consissretncount from consume_iss_det w, item i where w.item_code = i.item_code and w.cons_issue = :new.cons_issue and i.stk_opt <> '0'; exception when others then ll_consissretncount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'C-IRTN' and ref_id = :new.cons_issue and eff_qty > 0 ; exception when others then ll_invcount := 0; end; end if; if :new.confirmed = 'Y' and :old.tran_type = 'I' then begin select count(1) into ll_consissretncount from consume_iss_det w, item i where w.item_code = i.item_code and w.cons_issue = :new.cons_issue and i.stk_opt <> '0'; exception when others then ll_consissretncount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'C-ISS' and ref_id = :new.cons_issue and eff_qty < 0 ; exception when others then ll_invcount := 0; end; end if; if ll_invcount <> ll_consissretncount then ls_msg := ' missing lines ' ; for cur_tran in ( select line_no from consume_iss_det w, item i where w.item_code = i.item_code and w.cons_issue = :new.cons_issue and i.stk_opt <> '0' minus select to_number(trim(ref_line)) from invtrace where ref_ser = 'C-ISS' and ref_id = :new.cons_issue ) loop ls_msg := ls_msg || '[' || to_char (cur_tran.line_no) ||']'; end loop; raise_application_error( -20601, 'Invtrace not updated for all the details trace count [' || to_char(ll_invcount) || '] det count [' || to_char(ll_consissretncount) ||']' || ls_msg ); end if; -- 01-Apr-15 to check invalloc_trace net allocation is 0 if :new.confirmed = 'Y' and :old.tran_type = 'I' then select sum(ALLOC_QTY) into lc_allocqty from invalloc_trace where ref_ser = 'C-ISS' and ref_id = :new.cons_issue; if lc_allocqty <> 0 then raise_application_error( -20601, 'Allocation trace net quantity is non-zero, invalloc_trace not updated for all the details lc_allocqty [' || to_char(lc_allocqty) ||']'); end if; ------------- here flag to be updated end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_HOLIDAY_FOR_DATE (AS_EMP_CODE char,AS_DATE date) return char is a_hol_tblno holiday.hol_tblno%type := ddf_get_holtblno(AS_EMP_CODE,AS_DATE); a_hol_type char(1); a_count number(5); a_count1 number(5); begin select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'H'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 = 0) then a_hol_type := 'H'; return a_hol_type; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 <> 0) then a_hol_type := 'H'; return a_hol_type; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'W'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 = 0) then a_hol_type := 'W'; return a_hol_type; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 <> 0) then a_hol_type := 'W'; return a_hol_type; end if; return a_hol_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WORETN_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed, status ON workorder_iss referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_woretncount number(3) := 0; ll_count number(6) := 0; ls_msg varchar2(4000) := ''; ll_scanned number(14,3) := 0; ll_total number(14,3) := 0; ll_pending number(14,3) := 0; ll_detailcount number(6) := 0; BEGIN -- 28-05-2015 manoharan to check detail not deleted but status become X if :new.status = 'X' and :old.tran_type in ( 'I','D','O') then select count(1) into ll_detailcount from workorder_issdet where tran_id = :new.tran_id; if ll_detailcount > 0 then raise_application_error( -20601, '[' || to_char(ll_detailcount) ||'] detail lines are not deleted, cannot cancel the issue'); end if; end if; if :new.confirmed = 'Y' and :old.tran_type in ( 'I','D','O') then for cur_det in ( select line_no,lot_no,lot_sl, no_art from workorder_issdet where tran_id = :new.tran_id and item_code in (select item_code from siteitem where site_code = :old.site_code and ( nvl(scanned_barcode,'0') = '1' or nvl(scanned_barcode,'0') = '2') ) ) loop select count(distinct d.line_no_sl) into ll_scanned from woi_scan_hdr h, workorder_issdet_sl d where h.tran_id = d.tran_id and d. LINE_NO__ISS = cur_det.line_no and d.lot_no = cur_det.lot_no and d.lot_sl= cur_det.lot_Sl and d.tran_id__iss = :new.tran_id and h.confirmed='Y' ; if cur_det.no_art <> ll_scanned then ls_msg := ls_msg || 'line_no [' || cur_det.line_no ||'] lot_no [' || cur_det.lot_no || '] lot_sl [' || cur_det.lot_Sl || '] no_art [' || cur_det.no_art || '] scanned [' || ll_scanned || '] '; end if; end loop; if ls_msg is null or length(trim(ls_msg)) = 0 then select count(1) into ll_total from workorder_issdet d, siteitem s where s.item_code = d.item_code and s.site_code = :old.site_code and d.tran_id = :new.tran_id and ( nvl(s.scanned_barcode,'0') = '1' or nvl(s.scanned_barcode,'0') = '2' ) ; select count(1) into ll_pending from workorder_issdet d, siteitem s where s.item_code = d.item_code and s.site_code = :old.site_code and d.tran_id = :new.tran_id and ( nvl(s.scanned_barcode,'0') = '1' or nvl(s.scanned_barcode,'0') = '2' ) and nvl(d.scanned,'N') = 'N' ; if ll_pending > 0 then ls_msg := ls_msg || ' Total liness [' || ll_total ||'] pending [' || ll_pending || '] '; end if; end if; ------------- allocation check to be added here end if; if ls_msg is not null and length(trim(ls_msg)) > 0 then raise_application_error( -20601, 'Weighing/scanning not complete ' || ls_msg); else if :new.confirmed = 'Y' and :old.tran_type = 'R' then begin select count(1) into ll_woretncount from workorder_issdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_woretncount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'W-IRTN' and ref_id = :new.tran_id and eff_qty > 0 ; exception when others then ll_invcount := 0; end; end if; if :new.confirmed = 'Y' and :old.tran_type in ( 'I','D','O') then begin select count(1) into ll_woretncount from workorder_issdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_woretncount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'W-ISS' and ref_id = :new.tran_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; end if; if ll_invcount <> ll_woretncount then raise_application_error( -20601, 'Invtrace not updated for all the details invtrace [' || ll_invcount || '] issue line [' || ll_woretncount || ']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOC (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char, lloc_code in char, lgetQV in char, lexc_opt in char) return number is ld_eff_qty NUMBER(17,3); ldt_crea_date date; ls_available varchar2(2); begin if lavailable = 'B' then ls_available := 'YN' ; else ls_available := lavailable ; end if; if ltype = 'I' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and instr(ls_available,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT decode(lgetQV,'Q', sum( a.quantity), sum( a.quantity * decode(lexc_opt, 'E',nvl(a.rate,0), nvl(a.gross_rate,0)))) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.loc_code = lloc_code and a.item_code = litem_code and instr(ls_available,b.available) > 0 union all -- select decode(lgetQV,'Q',nvl((sum( nvl(a.eff_qty,0)) * -1),0), -- nvl((sum((nvl(a.eff_qty,0) * decode(lexc_opt, 'E',nvl(d.rate,0),nvl(d.gross_rate,0)) ) * -1) ),0) ) qty select decode(lgetQV,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * decode(lexc_opt,'E',nvl(d.rate,0),nvl(d.gross_rate,0))) * -1),0) ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.tran_date > ad_from_date and instr(ls_available,c.available) > 0); end if; if ltype = 'B' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and a.lot_no = llot_no and instr(ls_available, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (SELECT decode(lgetQV,'Q', sum( a.quantity), sum( a.quantity * decode(lexc_opt, 'E',nvl(a.rate,0), nvl(a.gross_rate,0)))) qty -- (select sum(a.quantity) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_no = llot_no and instr(ls_available, b.available) > 0 union all --select nvl((sum(eff_qty) * -1),0) qty select decode(lgetQV,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * decode(lexc_opt,'E',nvl(a.rate,0),nvl(a.gross_rate,0))) * -1),0) ) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and a.loc_code = lloc_code and b.inv_stat = c.inv_stat and a.tran_date > ad_from_date and instr(ls_available,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX FXFR_TRANIDREF ON FUNDTRANSFER (TRAN_ID__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MISC_VOUCHER_EFFDATE (as_tran_id misc_voucher.tran_id%type) return date is ld_eff_date misc_voucher.eff_date%type; begin select to_date(misc_voucher.eff_date,'DD/MM/YY') into ld_eff_date from misc_voucher where misc_voucher.tran_id = as_tran_id ; return ld_eff_date ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ITI_WFAPPROVER5 ( as_tran_id CHAR, as_aprv_lev NUMBER ) RETURN CHAR IS ls_ret_emp_code CHAR(10); finhead1 CHAR(10); finhead2 CHAR(10); ls_riskhd CHAR(10); lc_actceo CHAR(10); as_user_code CHAR(10); totamt number := 0; loweramt number := 0; upperamt number := 0; BEGIN ls_ret_emp_code := ''; BEGIN select chg_user,tot_amt into as_user_code,totamt from misc_voucher where tran_id = as_tran_id; EXCEPTION when no_data_found then return null; END; IF as_aprv_lev =2 THEN BEGIN select fld_value,udf_str1,udf_str2 INTO finhead1,loweramt,upperamt from gencodes where MOD_NAME='W_MISC_VOUCHER' and ACTIVE = 'Y' and FLD_NAME='SMGRFAC_L2_' ||(select trim(fin_entity) from site where site_code= (select site_code__def from users where code = as_user_code)); EXCEPTION WHEN NO_DATA_FOUND THEN finhead1 := 'NA'; END; --CHECK LESS THE 10000 IF finhead1 <> 'NA' AND totamt <= upperamt THEN ls_ret_emp_code := finhead1; ELSE ls_ret_emp_code := 'NA'; END IF; ELSIF as_aprv_lev = 3 THEN BEGIN select fld_value,udf_str1,udf_str2 INTO finhead2,loweramt,upperamt from gencodes where MOD_NAME='W_MISC_VOUCHER' and ACTIVE = 'Y' and FLD_NAME='SMGRFAC_2A_' ||(select trim(fin_entity) from site where site_code= (select site_code__def from users where code = as_user_code)); EXCEPTION WHEN NO_DATA_FOUND THEN finhead2 := 'NA'; END; --CHECK GREATER THEN 10001 AND LESS THEN 99999 IF finhead2 <> 'NA' AND totamt >= loweramt AND totamt <= upperamt THEN ls_ret_emp_code := finhead2; ELSE ls_ret_emp_code := 'NA'; END IF; ELSIF as_aprv_lev = 4 THEN BEGIN select fld_value,udf_str1,udf_str2 INTO ls_riskhd,loweramt,upperamt from gencodes where MOD_NAME='W_MISC_VOUCHER' and ACTIVE = 'Y' and FLD_NAME='RISKHD_2B_' ||(select trim(fin_entity) from site where site_code= (select site_code__def from users where code = as_user_code)); EXCEPTION WHEN NO_DATA_FOUND THEN ls_riskhd := 'NA'; END; --CHECK GREATER THEN 10001 AND LESS THEN 99999 IF ls_riskhd <> 'NA' AND totamt >= loweramt AND totamt <= upperamt THEN ls_ret_emp_code := ls_riskhd; ELSE ls_ret_emp_code := 'NA'; END IF; ELSIF as_aprv_lev = 5 THEN BEGIN select fld_value,udf_str1,udf_str2 INTO lc_actceo,loweramt,upperamt from gencodes where MOD_NAME='W_MISC_VOUCHER' and ACTIVE = 'Y' and FLD_NAME='ACTCEO_2C_' ||(select trim(fin_entity) from site where site_code= (select site_code__def from users where code = as_user_code)); EXCEPTION WHEN NO_DATA_FOUND THEN lc_actceo := 'NA'; END; --CHECK GREATER THEN 10001 AND LESS THEN 99999 IF lc_actceo <> 'NA' AND totamt >= upperamt THEN ls_ret_emp_code := lc_actceo; ELSE ls_ret_emp_code := 'NA'; END IF; ELSIF as_aprv_lev = 9 THEN SELECT var_value INTO lc_actceo FROM finparm WHERE var_name = 'WF_HRSPOC'; ls_ret_emp_code := lc_actceo; END IF; RETURN ls_ret_emp_code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PACKISSRCP_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON inv_pack referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_packissrcpcount number(3) := 0; ll_count number(6) := 0; BEGIN if :new.confirmed = 'Y' and trim(:new.order_type) <> 'I' then begin select count(*) into ll_packissrcpcount from inv_pack_iss p, item i where p.item_code = i.item_code and p.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_packissrcpcount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser ='I-PKI' and ref_id = :new.tran_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_packissrcpcount then raise_application_error( -20601, 'Invtrace not updated for all the details'); ELSE begin select count(*) into ll_packissrcpcounT from inv_pack_rcp p, item i where p.item_code = i.item_code and p.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_packissrcpcount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser ='I-PKR' and ref_id = :new.tran_id and eff_qty > 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_packissrcpcount then raise_application_error( -20601, 'Invtrace not updated for all the details'); end if; end if; ------------- allocation check to be added here END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VOUCH_REF_ID_1423 (lsref_ser char,lsref_id char) return varchar2 is ls_no varchar2(5000); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX HIERARCHY_COPY_X ON HIERARCHY_COPY (LEVEL_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE LOTSLMASTER AS OBJECT ( LOT_SL CHAR(15), ITEM_CODE CHAR(10), ITEM_DESCR VARCHAR2(130), LOC_CODE CHAR(8), LOT_NO CHAR(15) , QUANTITY NUMBER(14,3) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_NEW_NL (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_disparm_code in char, ls_disparm_code_1 in char, ls_disparm_code_2 in char, ls_type in char) return number is lc_tax_amt number(14,3); LS_VAR_VALUE VARCHAR(2000); LS_VAR_VALUE1 VARCHAR(2000); LS_VAR_VALUE2 VARCHAR(2000); as_line_no char(3); lc_exch_rate number(17,6); begin begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then AS_LINE_NO := ' ' || RTRIM(LTRIM(LS_LINE_NO)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 3 then as_line_no := rtrim(ltrim(ls_line_no)); end if; select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = LS_DISPARM_CODE; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND LINE_NO = AS_LINE_NO --and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); -- taxable amt ELSIF ls_type = 'B' then select nvl(sum(nvl(Taxable_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND LINE_NO = AS_LINE_NO --and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); -- tax % ELSIF ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND LINE_NO = AS_LINE_NO --AND INSTR(LS_VAR_VALUE,(','||RTRIM(TAX_CODE)||',')) > 0 AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) AND TAX_AMT <>0 ; -- taxable amt ELSIF ls_type = 'A' then select (rtrim(var_value)) INTO LS_VAR_VALUE1 from disparm where prd_code = '999999' and var_name = ls_disparm_code_1; SELECT (RTRIM(VAR_VALUE)) into LS_VAR_VALUE2 FROM DISPARM where prd_code = '999999' and var_name = ls_disparm_code_2; select nvl(sum(CASE WHEN tax_type = 'H' THEN nvl(taxable_amt, 0) WHEN tax_type = 'I' THEN nvl(taxable_amt, 0) WHEN tax_type = 'J' THEN nvl(taxable_amt, 0) ELSE 0 END), 0) into lc_tax_amt from taxtran,tax WHERE tax.tax_code = taxtran.tax_code and tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no And tax_perc <> 0 AND (TAX.TAX_TYPE) IN ('H','I','J') AND ( TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE1)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE2)) ) ); end if; EXCEPTION WHEN NO_DATA_FOUND THEN lc_tax_amt := 0 ; END ; RETURN LC_TAX_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PYR_CUMQTY (adt_date in date,as_geoloc in site.geo_loc%type,as_unitto uom.unit%type ) return number is lc_pyrdayqty number(14,3) := 0; ldt_monthstart date; begin begin select trunc(adt_date,'Month') into ldt_monthstart from dual; end; begin select sum(fn_qty_form(p.item_code,p.unit,as_unitto, p.quantity)) into lc_pyrdayqty from dwh_production_day_events p, item i, item_type t, site s where p.site_code = s.site_code and p.item_code = i.item_code and t.item_type = i.item_type and s.geo_loc = as_geoloc and p.tran_date >= ldt_monthstart and p.tran_date <= adt_date and p.ref_type like 'P%' and p.ref_ser = 'W-RCP' and t.unit__form = as_unitto; exception when others then lc_pyrdayqty := 0; end; return lc_pyrdayqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_AD_TRANID ON EMPLOYEE_AD (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_CHANNEL_PARTNER ( as_custcode in customer.cust_code%type, as_sitecode in site.site_code%type) return char is ls_channel_partner char(1) := 'N'; ls_dis_link char(1) := 'N'; begin begin select channel_partner, dis_link into ls_channel_partner, ls_dis_link from site_customer where cust_code = as_custcode and site_code = as_sitecode ; exception when others then ls_channel_partner := null; end; if ls_channel_partner is null then begin select channel_partner, dis_link into ls_channel_partner, ls_dis_link from customer where cust_code = as_custcode; exception when others then ls_channel_partner := 'N'; end; end if; if ls_channel_partner = 'Y' and ls_dis_link = 'A' then ls_channel_partner := 'N'; end if; return ls_channel_partner; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TEAM_DET_X ON PROJ_TEAM_DET (TEAM_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RCHQ_NAME_UML (AS_TRAN_SER IN VARCHAR2, AS_TRAN_ID IN VARCHAR2) RETURN VARCHAR2 IS AS_VALUE VARCHAR2(500); BEGIN IF RTRIM(AS_TRAN_SER) = 'F-XFR' THEN SELECT FUNDTRANSFER.CHQ_NAME INTO AS_VALUE FROM FUNDTRANSFER WHERE TRAN_ID = AS_TRAN_ID AND ROWNUM =1; ELSIF RTRIM(AS_TRAN_SER) = 'E-PAY' THEN SELECT PAYMENT_EXP.CHQ_NAME INTO AS_VALUE FROM PAYMENT_EXP WHERE TRAN_ID = AS_TRAN_ID AND ROWNUM =1; ELSIF RTRIM(AS_TRAN_SER) = 'M-PAY' THEN SELECT MISC_PAYMENT.CHQ_NAME INTO AS_VALUE FROM MISC_PAYMENT WHERE TRAN_ID = AS_TRAN_ID AND ROWNUM =1; END IF; RETURN AS_VALUE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MEET_DT (AS_SC_CODE CHAR,AS_SPRS CHAR, FR_DT DATE,TO_DT DATE) RETURN VARCHAR2 IS DT_CNT NUMBER(3,0); AS_DESCR VARCHAR2(1000); CURSOR C1 IS SELECT EVENT_DATE FROM STRG_MEET WHERE EVENT_DATE BETWEEN FR_DT AND TO_DT AND STRG_CODE=AS_SC_CODE AND SALES_PERS=AS_SPRS; BEGIN SELECT COUNT(EVENT_DATE) INTO DT_CNT FROM STRG_MEET WHERE EVENT_DATE BETWEEN FR_DT AND TO_DT AND STRG_CODE=AS_SC_CODE AND SALES_PERS=AS_SPRS; IF DT_CNT = 1 THEN SELECT TO_CHAR(TO_DATE(EVENT_DATE),'DD-MON') INTO AS_DESCR FROM STRG_MEET WHERE EVENT_DATE BETWEEN FR_DT AND TO_DT AND STRG_CODE=AS_SC_CODE AND SALES_PERS=AS_SPRS; RETURN NVL(AS_DESCR,'N/A'); ELSIF DT_CNT > 1 THEN AS_DESCR:=''; FOR I IN C1 LOOP AS_DESCR:=AS_DESCR||TO_CHAR(TO_DATE(I.EVENT_DATE),'DD-MON')||','; END LOOP; END IF; AS_DESCR:=SUBSTR(AS_DESCR,1,LENGTH(TRIM(AS_DESCR))-1); RETURN NVL(AS_DESCR,'N/A'); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUNDRY_NAME ( ls_sundry_code in char,ls_sundry_type in char ) return varchar2 is ls_val varchar2(300); ls_name varchar2(50); begin if ls_sundry_type = 'C' then select cust_name into ls_name from customer where cust_code = ls_sundry_code; ElsIf ls_sundry_type = 'S' then Select supp_name into ls_name From supplier Where supp_code = ls_sundry_code; ElsIf ls_sundry_type = 'L' Then Select party_name Into ls_name From loanparty Where party_code = ls_sundry_code; ElsIf ls_sundry_type = 'X' Then Select tauth_name Into ls_name From tax_authority Where tauth_code = ls_sundry_code; ElsIf ls_sundry_type = 'P' Then Select sp_name Into ls_name From sales_pers Where sales_pers = ls_sundry_code; ElsIf ls_sundry_type = 'T' Then Select tran_name Into ls_name From transporter Where tran_code = ls_sundry_code; ElsIf ls_sundry_type = 'R' then Select FIRST_NAME || ' ' ||MIDDLE_NAME || ' '|| LAST_NAME into ls_name From STRG_CUSTOMER Where SC_CODE = ls_sundry_code; ElsIf ls_sundry_type = 'B' then Select BANK_NAME into ls_name From BANK Where BANK_CODE = ls_sundry_code; ElsIf ls_sundry_type = 'E' then Select EMP_FNAME || ' ' ||EMP_MNAME || ' '|| EMP_LNAME into ls_name From EMPLOYEE Where EMP_CODE = ls_sundry_code; ElsIf ls_sundry_type = 'O' then ls_name := 'NOT APPLICABLE'; End If; ls_name := nvl(ls_name, ' '); ls_val := ls_name ; RETURN LS_VAL; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REMK_ITPROOF ( AS_AD_CODE EMP_ITDECL_DET.AD_CODE%TYPE, AS_AD_DESCR ALLWDEDN.DESCR%TYPE, AS_REMARKS EMP_ITDECL_DET.REMARKS%TYPE) RETURN VARCHAR2 IS LS_FORMAT_REMARKS VARCHAR2(4000); BEGIN LS_FORMAT_REMARKS := chr(10) || trim(AS_AD_CODE) || chr(9) || ' - ' || chr(9) || trim(AS_AD_DESCR) || chr(10) || 'REASON FOR REJECTION: ' || trim(AS_REMARKS) || chr(10); RETURN LS_FORMAT_REMARKS; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETDATE return date is ld_today DATE ; begin return sysdate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PCONTRACT_TERM_X ON PCONTRACT_TERM (CONTRACT_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MPS_ORDER_DUE_DATE ON MPS_ORDER (DUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_INVCUSTNAME (as_invoiceid in char) return char is ls_custname varchar2(150); begin begin select cust_name into ls_custname from customer where cust_code = (select cust_code from invoice where invoice_id = as_invoiceid ); end; return ls_custname; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX REPL_DLV_SCH_DET_X ON REPL_DLV_SCH_DET (REPL_DLV_SCH, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE VISTEDARMASTER AS OBJECT ( Report_to char(10), Designation VARCHAR2(25) , Visited_with VARCHAR2(80), LEVEL_NO NUMBER(3) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_TAXABLE_AMT (as_refser in char, as_refid in char) RETURN NUMBER IS ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_taxtype char(1); lc_quantity number(14,3) := 0; lc_rate number(17,6) := 0; lc_discount number(14,3) := 0; lc_taxableamt number(14,3) := 0; lc_dettaxamt number(14,3) := 0; lc_taxtrantaxamt number(14,3) := 0; ll_count number(3) := 0; lc_othchrg number(14,3) := 0; begin if as_refser = 'S-RET' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env,tax_amt from sreturndet where tran_id = :tran_id'; end if; if as_refser = 'S-DSP' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env,tax_amt from despatchdet where desp_id = :tran_id'; end if; if as_refser = 'P-RCP' or as_refser = 'P-RET' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env, tax_amt from porcpdet where tran_id = :tran_id'; end if; if as_refser = 'P-ORD' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env, tax_amt from porddet where purc_order = :tran_id'; end if; if as_refser = 'D-ISS' then ls_sql := 'Select line_no,quantity,rate,discount,tax_env, tax_amt from distord_issdet where tran_id = :tran_id'; end if; if as_refser = 'D-RCP' then ls_sql := 'Select line_no,quantity,rate,discount,tax_env, tax_amt from distord_rcpdet where tran_id = :tran_id'; end if; OPEN cur_out FOR ls_sql USING as_refid ; LOOP FETCH cur_out INTO ls_lineno, lc_quantity,lc_rate,lc_discount,ls_taxenv,lc_dettaxamt ; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then ll_mismatch_cnt := 0; if lc_quantity is null then lc_quantity := 0; end if; if lc_rate is null then lc_rate := 0; end if; if lc_discount is null then lc_discount := 0; end if; ls_lineno := lpad(trim(ls_lineno),3,' '); for cur_taxableamt in ( select t.taxable_amt, t.tax_base, t.tran_id, t.line_no from taxtran t, tax tm where tm.tax_code = t.tax_code and t.tran_code = as_refser and t.tran_id = as_refid and t.line_no = ls_lineno and tm.tax_type in ('G','H','I') and instr(lower(tm.descr),'round') = 0 ) loop begin select count(1) into ll_count from tbasseq where tax_base = cur_taxableamt.tax_base; exception when others then ll_count := 0; end; if ll_count > 0 then begin select sum(tax_amt) into lc_othchrg from taxtran where tran_id = cur_taxableamt.tran_id and line_no = cur_taxableamt.line_no and tax_code in (select tax_code from tbasseq where tax_base = cur_taxableamt.tax_base); exception when others then lc_othchrg := 0; end; end if; if lc_othchrg is null then lc_othchrg := 0; end if; if lc_discount is null then lc_discount := 0; end if; lc_taxableamt := round( ((lc_quantity * lc_rate) - ((lc_quantity * lc_rate) * lc_discount / 100 )) + lc_othchrg,3); --round((lc_quantity * lc_rate) - ((lc_quantity * lc_rate) * lc_discount / 100 ),3); if lc_taxableamt is null then lc_taxableamt := 0; end if; if abs(cur_taxableamt.taxable_amt - lc_taxableamt) > 1 and trim(ls_taxenv) <> 'PIMP01' then -- 08-Jul-2022 import cannot use this formula ll_mismatch_cnt := 1; exit; end if; select sum(tax_amt) into lc_taxtrantaxamt from taxtran t where t.tran_code = as_refser and t.tran_id = as_refid and t.line_no = ls_lineno and effect <> 'N'; if abs(lc_dettaxamt - lc_taxtrantaxamt) > 1 then ll_mismatch_cnt := 1; exit; end if; end loop; if ll_mismatch_cnt> 0 then exit; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then ll_retval := 1; end if; RETURN ll_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_RETURN_QTY (as_wo_no in char , as_item_cd in char,as_lot_no in char) return number is lc_retval number (14,3) ; begin select quantity into lc_retval from WORKORDER_ISSDET,WORKORDER_ISS where WORKORDER_ISSDET.tran_id=WORKORDER_ISS.tran_id and WORKORDER_ISS.WORK_ORDER=as_wo_no and WORKORDER_ISSDET.item_code=as_item_cd and WORKORDER_ISSDET.lot_no=as_lot_no and WORKORDER_ISSDET.quantity < 0; if lc_retval is null then lc_retval := 0 ; end if; lc_retval := abs(lc_retval); return lc_retval; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHECK_PRINT (AS_DATE_CHECK IN DATE,AS_SYS_DATE IN DATE,AS_NO_VISIT IN NUMBER) RETURN NUMBER IS AS_SUM NUMBER(10) ; AS_DATE DATE; J NUMBER(1); BEGIN AS_SUM :=0; AS_DATE :=LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1 ; FOR I IN 1..AS_NO_VISIT LOOP IF (AS_DATE_CHECK>=AS_DATE AND AS_DATE_CHECK<=AS_DATE+ (30/AS_NO_VISIT) ) AND AS_DATE_CHECK<=AS_SYS_DATE THEN AS_SUM :=AS_SUM +1; EXIT; END IF; AS_DATE :=AS_DATE+ (30/AS_NO_VISIT); END LOOP; RETURN AS_SUM ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MFG_LOTSL_TRACE_X ON MFG_LOTSL_TRACE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_PROPQTY ( as_BOMCODE IN VARCHAR, al_operation IN NUMBER, as_itemcode IN VARCHAR, as_itemref IN VARCHAR, ls_altitem IN VARCHAR, as_workorder IN VARCHAR) RETURN NUMBER IS lc_proportionate_qty NUMBER(14,3); --return varchar is lc_proportionate_qty varchar(100); lc_bom_batchqty NUMBER(14,3); lc_wo_batchqty NUMBER(14,3); ls_reqtype VARCHAR(1); lc_min_qty NUMBER(14,3); lc_qtyper NUMBER(14,3); as_altitem VARCHAR(100); BEGIN SELECT batch_qty INTO lc_bom_batchqty FROM bom WHERE bom_code = as_bomcode ; SELECT quantity INTO lc_wo_batchqty FROM workorder WHERE work_order = as_workorder ; SELECT req_type, min_qty INTO ls_reqtype, lc_min_qty FROM bomdet WHERE bom_code = as_bomcode AND operation = al_operation AND item_code = as_itemcode AND item_ref = as_itemref; IF lc_min_qty IS NULL THEN lc_min_qty := 0; END IF; IF lc_bom_batchqty IS NULL THEN lc_bom_batchqty := 0; END IF; IF lc_wo_batchqty IS NULL THEN lc_wo_batchqty := 0; END IF; lc_qtyper :=0; SELECT NVL(quantity,0) INTO lc_qtyper FROM bom_alt WHERE bom_code = as_bomcode AND item_code = as_itemcode AND item_ref = as_itemref AND item_code__alt = as_altitem; IF lc_qtyper IS NULL THEN lc_qtyper := 0; END IF; IF ls_reqtype = 'S' THEN -- slab lc_proportionate_qty := (lc_wo_batchqty / lc_bom_batchqty) * lc_qtyper; elsif ls_reqtype = 'P' THEN -- proportionate lc_proportionate_qty := (lc_qtyper / lc_bom_batchqty) * lc_wo_batchqty; elsif ls_reqtype = 'F' THEN -- fixed lc_proportionate_qty := lc_qtyper; END IF; IF lc_proportionate_qty < lc_min_qty THEN lc_proportionate_qty := lc_min_qty; END IF; --lc_proportionate_qty :='1'|| as_bomcode || '2' || as_itemcode ||'3' || as_itemref || '4' -- || as_altitem || '5' || lc_qtyper; lc_proportionate_qty :=lc_qtyper; RETURN lc_proportionate_qty; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION IS_NUMBER (NUM_STR char) return number is lb_number number(1); LC_NUMB NUMBER; begin LB_NUMBER := 1; begin IF NUM_STR IS NULL OR LENGTH(LTRIM(RTRIM(NUM_STR))) = 0 OR RTRIM(NUM_STR) IS NULL THEN LB_NUMBER := -1; ELSE LC_NUMB := TO_NUMBER(NUM_STR); END IF; EXCEPTION WHEN OTHERS THEN LB_NUMBER := -1; end; return LB_NUMBER; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_SORDERDET_SCHEME ON SORDERDET_SCHEME (TRAN_ID, AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER SPRSTRAVEL_SETPKVAL before insert on sprs_travel for each row declare noof_row number(10); trv_tran_id char(10); a_activity_type VARCHAR2(5); begin if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then select substr( '0000000000' || sprstravel_seq.nextval , -10 ) into :new.tran_id from dual; end if; select activity_type into a_activity_type from fieldactivity where activity_code=:new.activity_code; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0) then begin select count(*) into noof_row from sprs_act_tran where event_date = :new.travel_date and sales_pers = :new.sales_pers; if noof_row > 0 then select dcr_id into :new.dcr_id from sprs_act_tran where event_date = :new.travel_date and sales_pers = :new.sales_pers; end if; --raise_application_error (-20001,'Mismatch in Data , other than leave data : ' || noof_row || ' : ' || :new.dcr_id); if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select substr( '0000000000' || sprsactttran_seq.nextval , -10 ) into :new.dcr_id from dual; :new.line_no := 1; insert into sprs_act_tran(tran_id , event_date , activity_code , sales_pers , sprs_code__ww , chg_date , chg_user , chg_term , dcr_id) values(:new.dcr_id , :new.travel_date , :new.activity_code , :new.sales_pers , :new.sprs_code__ww , :new.chg_date , :new.chg_user , :new.chg_term , :new.dcr_id); end; else begin if (a_activity_type ='LEAVE') then :new.line_no := nvl(:new.line_no , 0) + 1; else select max(line_no) into :new.line_no from sprs_travel where dcr_id = :new.dcr_id; :new.line_no := nvl(:new.line_no , 0) + 1; end if; end; end if; end; end if; :new.line_no := 0; if (a_activity_type ='LEAVE') then :new.line_no := nvl(:new.line_no , 0) + 1; else select max(line_no) into :new.line_no from sprs_travel where dcr_id = :new.dcr_id; :new.line_no := nvl(:new.line_no , 0) + 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUPP_APPL_FOR_SITE (as_suppcode in supplier.supp_code%type, as_sitecode in site.site_code%type) return char is --RETURN BOOLEAN IS --b_retval BOOLEAN := FALSE; ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_SUPP'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from site_supplier where site_code = as_sitecode and supp_code = as_suppcode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QUERY_CONTEXT_X ON SMS_QUERY_SECURITY (PROFILE_ID, CONTEXT_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION MFG_GETISSUEQTY ( quantity number , overPerc number) return number is issue_qty number( 14 , 6); ls_quantity number(14,6); ls_overperc number(14,6); begin issue_qty := 0; if quantity is null then ls_quantity:=0; else ls_quantity :=quantity; end if; if overPerc is null then ls_overperc:=0; else ls_overperc:=overPerc; end if; issue_qty := (ls_quantity * ls_overperc / 100); issue_qty := ls_quantity + issue_qty; return( issue_qty ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BANK_STAN_SERV_X ON BANK_STAN_SERV (BANK_CODE, STAN_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QCITEM_SPEC_DET_X ON QCITEM_SPEC_DET (ITEM_CODE, SPEC_REF, ROUTE_CODE, OPERATION, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPRS_PLAN_HDR_X ON SPRS_PLAN_HDR (PLAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE FIELDACTIVITYMASTER AS OBJECT ( ACTIVITY_CODE CHAR(2), ACTIVITY_DESCR VARCHAR2(60), ACTIVITY_TYPE VARCHAR2(5) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_CANC_STATUS ( as_TRANID char ) return varchar2 is ls_status varchar2(45); MCOUNT NUMBER(1); begin SELECT STATUS INTO ls_status FROM EMPLEAVE WHERE TRAN_ID=AS_TRANID; IF ls_status='C' THEN ls_status:='Approved' ; ELSE ls_status:='Pending' ; END IF; return ls_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_SRETURN_TAX_ENV (as_invoice_id sreturn.invoice_id%type,as_tax_class sreturndet.tax_env%type,as_status sreturndet.status%type) return number is ls_count number(10,0); ls_var_value varchar2(600); begin begin ls_count :=0; SELECT count(1) into ls_count FROM DISPARM WHERE var_name='LY_SRETURN_TAX_ENV' and var_value='Y'; exception when no_data_found then ls_count :=0; end; IF ls_count >0 THEN if trim(as_invoice_id) is null THEN IF as_tax_class <> 'TENVFDESR' AND as_status IN ('D','E') THEN RETURN 0; END IF; IF as_tax_class = 'TENVFDESR' AND as_status NOT IN ('D','E') THEN RETURN 0; ELSE RETURN 1; END IF; ELSE RETURN 1; END IF; else return 1; END IF; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TASK_RES_X ON TASK_RES (TASK_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TOUR_SUMMARY_EMP ON TOUR_SUMMARY (EMP_CODE, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WO_ALLOC_CHK BEFORE UPDATE OF status ON workorder referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_alloccount number(6) := 0; lc_allocqty number(14,3) := 0; ls_msg varchar2(2000); BEGIN if :new.status in ('C','X','U') then begin select count(1) into ll_alloccount from ( select ref_ser,ref_id,item_code,loc_code,lot_no,lot_sl,round(sum(alloc_qty),3) alloc_qty from ( select ref_ser,ref_id,item_code,loc_code,lot_no,lot_sl,alloc_qty alloc_qty,tran_id from ( select (case when ref_ser in( 'W-ISS','W-ORO') then 'W-ORD' else trim(ref_ser) end) ref_ser, (case when ref_ser = 'W-ISS' then (select trim(i.work_order) from workorder_iss i where i.tran_id = ref_id) else trim(ref_id) end ) ref_id, item_code,loc_code,lot_no,lot_sl,alloc_qty, tran_id from invalloc_trace where ref_ser in ('W-ORD','W-ISS','W-ORO') ) where trim(ref_id) = trim(:new.work_order) ) group by ref_ser,ref_id,item_code,loc_code,lot_no,lot_sl having round(sum(alloc_qty),3) > 0 ) ; exception when others then ll_alloccount := 0; end; if ll_alloccount <> 0 then raise_application_error( -20601, 'Allocation trace net quantity is non-zero, need to deallocate all allocation against the order count [' || to_char(ll_alloccount) ||']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CITY_NAME (as_sundry_type CHAR,as_code CHAR) RETURN VARCHAR2 IS ls_city VARCHAR2(40); AS_BHR EXCEPTION; BEGIN BEGIN if as_sundry_type = 'S' then SELECT city INTO ls_city FROM supplier WHERE supp_code = as_code; ELSE if as_sundry_type = 'R' then SELECT city INTO ls_city FROM strg_customer WHERE sc_code = as_code; end if; end if; RETURN ls_city; RAISE AS_BHR; EXCEPTION WHEN AS_BHR THEN RETURN NULL; END; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_DET_LINE (ls_tran_code in char,ls_tran_id in char, ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value char(30); as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(abs(tax_amt),0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select avg(abs(tax_perc )) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select sum(abs(taxable_amt)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then select exch_rate into lc_exch_rate from invoice where invoice_id = ls_tran_id ; if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CALCULATE_INTEREST ( p_ref_type IN VARCHAR2, p_amount IN NUMBER, p_outstanding_amt IN NUMBER, p_no_days_delayed IN NUMBER ) RETURN VARCHAR2 IS v_interest_amount NUMBER(14,4); v_return_json VARCHAR2(4000); v_interest_percentage NUMBER(5,2); BEGIN v_interest_amount := 0; BEGIN SELECT VAR_VALUE INTO v_interest_percentage FROM FINPARM WHERE VAR_NAME = 'INTEREST_CALC_PERC'; EXCEPTION WHEN NO_DATA_FOUND THEN v_interest_percentage := NULL; WHEN OTHERS THEN v_interest_percentage := NULL; END; IF v_interest_percentage IS NULL THEN v_return_json := '{error: Interest percentage not found in FINPARM.}'; RETURN v_return_json; END IF; IF p_ref_type = 'R' THEN v_interest_amount := p_amount * v_interest_percentage * p_no_days_delayed / 365; ELSIF p_ref_type IN ('B', 'I') THEN v_interest_amount := p_outstanding_amt * v_interest_percentage * p_no_days_delayed / 365; ELSE v_return_json := '{error: Invalid ref_type provided}'; RETURN v_return_json; END IF; v_return_json := '{' || 'data:{' || 'INTEREST_AMT:' || TO_CHAR(v_interest_amount, '9999999999.9999') || '' || '}}'; RETURN v_return_json; EXCEPTION WHEN OTHERS THEN v_return_json := '{error: An error occurred while calculating interest.}'; RETURN v_return_json; END CALCULATE_INTEREST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_CHQ_NO (VTRAN_ID IN VARCHAR2, TRAN_SERIES IN VARCHAR2, VSITE_CODE IN VARCHAR2) RETURN VARCHAR2 IS AS_VALUE VARCHAR2(50); BEGIN SELECT REF_NO INTO AS_VALUE FROM BANKTRAN_LOG WHERE TRAN_SER = RPAD(TRAN_SERIES,6, ' ') AND TRAN_NO = RPAD(VTRAN_ID,10, ' ') AND SITE_CODE = VSITE_CODE AND REF_MODE = 'Q' AND ROWNUM =1; RETURN(AS_VALUE); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SYS_C0081265 ON SCOPE_TYPE (SCOPE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCH_RATE (ls_tran_id in char,ls_tran_code in char) return number is lc_exch_rate number(17,6); begin if rtrim(ls_tran_code) = 'P-RCP' or rtrim(ls_tran_code) = 'P-RET' then select exch_rate into lc_exch_rate from porcp where tran_id = ls_tran_id; elsif rtrim(ls_tran_code) = 'S-DSP' then select exch_rate into lc_exch_rate from despatch where desp_id = ls_tran_id; elsif rtrim(ls_tran_code) = 'D-ISS' then select exch_rate into lc_exch_rate from distord_iss where tran_id = ls_tran_id; elsif rtrim(ls_tran_code) = 'D-RCP' then select exch_rate into lc_exch_rate from DISTORD_RCP where tran_id = ls_tran_id; elsif rtrim(ls_tran_code) = 'S-INV' then select exch_rate into lc_exch_rate from INVOICE where invoice_id = ls_tran_id; elsif rtrim(ls_tran_code) = 'S-ORD' then select exch_rate into lc_exch_rate from SORDER where sale_order = ls_tran_id; end if; return lc_exch_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_RCP_ITEM_SER (as_item_ser in receipt.item_ser%type) return number is ls_count number(10,0); begin begin ls_count :=0; SELECT count(1) into ls_count FROM FINPARM WHERE var_name='LY_CHK_ITMSER_RCP' and var_value='Y'; exception when no_data_found then ls_count :=0; end; if ls_count >0 then IF as_item_ser is not null or trim(as_item_ser)='' THEN return 1; ELSE RETURN 0; END IF; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_LVE_CARD_X ON EMP_LVE_CARD (EMP_CODE, TRAN_ID__LVE, CALANDER_DATE, LVE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_TOT_AMOUNT ( as_invoice_id CHAR , as_lot_sl char ) return number is ld_amount number(17,2) ; begin select sum(case when nvl(rate,0)=0 then (quantity__stduom * rate) + tax_amt else (quantity__stduom * rate) end )amount into ld_amount from ( SELECT invoice_trace.quantity__stduom, invoice_trace.tax_amt, ddf_inv_free_qty(invoice.invoice_id,invoice_trace.item_code,invoice_trace.lot_no)free_qty, CASE WHEN NVL(invoice_trace.rate__stduom,0) = 0 THEN invoice_trace.rate__stduom WHEN invoice_trace.lot_sl = as_lot_sl AND SUBSTR(invoice_trace.tax_env,1,2)=SUBSTR(invoice_trace.tax_env,3,2) THEN round(invoice_trace.net_amt,2)/invoice_trace.quantity__stduom ELSE invoice_trace.rate__stduom END rate FROM invoice_trace, item, sorditem, site, invoice, itemser, sorder, item_lot_packsize WHERE ( item_lot_packsize.site_code__MFG = site.site_code (+)) and ( invoice_trace.item_code = item.item_code ) and ( invoice_trace.item_code = item_lot_packsize.item_code(+) ) and ( item_lot_packsize.lot_no__from(+) <= invoice_trace.lot_no ) and ( item_lot_packsize.lot_no__to(+) >= invoice_trace.lot_no ) and ( invoice_trace.sord_line_no = sorditem.line_no ) and ( invoice_trace.sord_no = sorditem.sale_order ) and ( invoice_trace.invoice_id = invoice.invoice_id ) and ( invoice_trace.exp_lev = sorditem.exp_lev ) and ( invoice_trace.sord_no = sorder.sale_order ) and ( decode(invoice_trace.item_ser__prom,null,item.item_ser,invoice_trace.item_ser__prom) = itemser.item_ser ) and ( ( invoice_trace.invoice_id = as_invoice_id ) and invoice_trace.rate__stduom <> 0 )); if ld_amount <> 0 then return ld_amount ; else ld_amount := 0 ; return ld_amount ; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ROPBAL_BANK_TRS__SITE ( as_sundrytype in sundrybal.sundry_type%type, as_sundrycode in sundrybal.sundry_code%type, ad_bal_upto_date in date ) return number as ls_yr period.acct_prd%type; ls_prdcode period.code%type; ld_frst_date period.fr_date%type; ld_dramt sundrybal.dr_amt__base%type; ld_cramt sundrybal.cr_amt__base%type; ld_opbal sundrybal.dr_amt__base%type; begin Select acct_prd, code , fr_date into ls_yr , ls_prdcode, ld_frst_date from period where fr_date <= ad_bal_upto_date and to_date >= ad_bal_upto_date ; select (case when sum(dr_amt__base) is null then 0 else sum(dr_amt__base) end), (case when sum(cr_amt__base) is null then 0 else sum(cr_amt__base) end) into ld_dramt, ld_cramt from sundrybal where acct_prd = ls_yr and prd_code < ls_prdcode and sundry_type = as_sundrytype and sundry_code = as_sundrycode ; ld_opbal := fn_rday_op_bal__site(ld_frst_date,ad_bal_upto_date,as_sundrycode) ; return ld_opbal + ld_dramt - ld_cramt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ALLOW_DESCR (ls_allow_code VARCHAR2, ls_emp_code char) return varchar2 is ls_descr VARCHAR2(60); begin SELECT DESCR into ls_descr FROM TRV_ALLOWANCE WHERE ITEM_SER=(select item_ser from sales_pers where sales_pers= ls_emp_code) AND UPPER(ALLOW_TYPE)='CAMP' and active='Y' AND ALLOW_CODE=ls_allow_code; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_ST_RATE_NEGATIVE BEFORE INSERT OR UPDATE OF RATE ON STOCK referencing old as old new as new FOR EACH ROW declare ls_available char(1); ls_inv_stat char(5); ls_msg varchar2(2000); ls_stattype char(1); trace_alloc number(18,7); ls_stkopt char(1); begin if :old.rate < 0 then ls_msg := ' site [' || :new.site_code || '] item [' || trim(:new.item_code) || '] location [' || trim(:new.loc_code) || '] Lot no [' || trim(:new.lot_no) || '] Lot sl [' || trim(:new.lot_sl) || '] rate [' || to_char(:new.rate) || ']'; raise_application_error( -20602, 'Stock rate cannot be negative ' || ls_msg); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_HDMEET_CNT (ls_emp IN CHAR,ls_month IN char,ls_year IN char) return number is hdfw_meet_count number(14,3); BEGIN begin SELECT NVL(Count(sat.activity_code)/2,0) into hdfw_meet_count FROM SPRS_ACT_TRAN SAT INNER JOIN FIELDACTIVITY FA ON FA.ACTIVITY_CODE = SAT.ACTIVITY_CODE WHERE (FA.ACTIVITY_TYPE) = 'FW' and instr((select ','||trim(prop_value)||','from properties where prop_name='HLF_DAY_FW'), ',' || TRIM(fa.activity_code) ||',')>0 AND (SAT.sales_pers) = ls_emp and to_char(SAT.event_date,'mm') = ls_month and to_char(SAT.event_date,'YYYY') = ls_year ; exception when no_data_found then hdfw_meet_count:=0; end; RETURN hdfw_meet_count ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LAB_COST_RATE (as_site_code in char,as_item_code in char) RETURN number is lc_ret_rate number(14,3); begin select nvl(cost_rate,0) into lc_ret_rate from siteitem where site_code = as_site_code and item_code = as_item_code; if lc_ret_rate = 0 then select cost_rate into lc_ret_rate from item where item_code = as_item_code; end if; return lc_ret_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CCTR_DESCR (as_cctr_code char) return char is ls_cctr_descr costctr.descr%type; begin begin select descr into ls_cctr_descr from costctr where cctr_code = as_cctr_code; Exception when OTHERS then ls_cctr_descr := ' '; end; return ls_cctr_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PO_CUSTCODE (as_purcorder in char) return varchar2 is ls_retval varchar2(10); ls_saleorder varchar2(10); ls_saleorderend varchar2(10); ls_custcodeend varchar2(10); begin select cust_code__end into ls_custcodeend from porder where purc_order = as_purcorder; if (ls_custcodeend is null) or (length(ltrim(rtrim(ls_custcodeend))) = 0) then select sale_order, sale_order__end into ls_saleorder, ls_saleorderend from porder where purc_order = as_purcorder ; if (ls_saleorderend is not null) and (length(ltrim(rtrim(ls_saleorderend))) > 0) then --return ls_saleorderend; ls_saleorderend := ltrim(rtrim(ls_saleorderend)); else if (ls_saleorder is not null) and (length(ltrim(rtrim(ls_saleorder))) > 0) then ls_saleorderend := ls_saleorder; else ls_saleorderend := ' '; end if; end if; if (ls_saleorderend is not null) and (length(ltrim(rtrim(ls_saleorderend))) > 0) then select cust_code into ls_custcodeend from sorder where sale_order = ls_saleorderend; return nvl(ls_custcodeend,'X'); end if; else return nvl(ls_custcodeend,'X'); end if; return nvl(ls_custcodeend,'X') ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RECP_BCR_TRAN_ID_LINE_NO__X ON RECEIPT_BCR_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083028 ON MERGE1 (WIN_NAME, OBJ_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_MOVEMENT_X ON STOCK_MOVEMENT (SITE_CODE, PERIOD_CODE, ITEM_CODE, LOT_NO, INV_STAT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_ADJISS_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON ADJ_ISSRCP referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; --CURSOR ad_adjissrate is BEGIN if :new.confirmed = 'Y' then begin if (:new.REF_SER = 'ADJISS') then begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_AISS'; exception when others then varvalue:= 'N'; end; end if; if (:new.REF_SER = 'ADJRCP') then begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_ARCP'; exception when others then varvalue:= 'N'; end; end if; if varvalue = 'S' then varvalue:='Y'; for cur_adjrcp in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM ADJ_ISSRCPDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id ) loop if cur_adjrcp.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from adj_issrcpdet where tran_id = :new.tran_id; exception when others then ll_count:= 0; end; if (:new.REF_SER = 'ADJISS') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'ADJISS' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; end if; if (:new.REF_SER = 'ADJRCP') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'ADJRCP' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; end if; if ll_count > 0 then begin SELECT sum(rate * quantity) into lc_rate FROM adj_issrcpdet where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR if (:new.REF_SER = 'ADJISS') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'ADJISS' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if (:new.REF_SER = 'ADJRCP') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'ADJRCP' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; -- count end end; end if ;-- end of varvalue if end if; end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_EMPLOYEE_NAME (as_emp_code char) return varchar2 is ls_name varchar2(45); ls_fname varchar2(15); ls_mname varchar2(15); ls_lname varchar2(15); begin begin select emp_fname,emp_mname,emp_lname into ls_fname,ls_mname,ls_lname from employee where emp_code = as_emp_code; exception when no_data_found then ls_name := null; end; ls_name := ls_fname||' '||ls_mname||' ' ||ls_lname; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PERMISSION_FR_ITDECL (AS_ACCTPRD char,AS_DECL_TYPE char,AS_EMPCODE char) return varchar2 is a_fr_date date; a_to_date date; a_is_allow_prd char(1); a_acctprd char(6); a_no_of_days char(4); a_allow_days char(4); begin a_is_allow_prd:='N'; select code into a_acctprd from acctprd where sysdate between fr_date and to_date ; if(a_acctprd != AS_ACCTPRD)then select fr_date , to_date into a_fr_date , a_to_date from acctprd where code = AS_ACCTPRD ; select ddf_hr_site_env_value(AS_EMPCODE,a_to_date,'IS_ALLOW_IT_ACCT_PRD') into a_is_allow_prd from dual; if(a_is_allow_prd = 'Y')then select round(sysdate - to_date) into a_no_of_days from acctprd where code = AS_ACCTPRD; select ddf_hr_site_env_value(AS_EMPCODE,a_to_date,'IT_ACCTPRD_ALLOWDAYS') into a_allow_days from dual; if(a_no_of_days <= a_allow_days) then a_is_allow_prd :='Y'; return a_is_allow_prd; else a_is_allow_prd :='N'; return a_is_allow_prd; end if; else a_is_allow_prd :='N'; return a_is_allow_prd; end if; else a_is_allow_prd:='Y'; end if; return a_is_allow_prd; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_X ON MISC_PAYABLES (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMPCD_SAS (AS_LOGIN_EMP char,AS_ROLE_CODE char) return varchar2 is a_emp_code employee.emp_code%type; begin select b.emp_code into a_emp_code from ( select a.emp_code,a.grade from employee a where a.relieve_date is null start with a.emp_code = AS_LOGIN_EMP connect by prior a.report_to = a.emp_code ) b,grade c where c.grade_code = b.grade and c.level_no = (case AS_ROLE_CODE when 'SO' then 4 when 'FLM' then 3 when 'SLM' then 2 when 'TLM' then 1 end); return a_emp_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BANK_CHARGES_X ON BANK_CHARGES (BANK_CODE, PAY_MODE, MIN_AMT, EFF_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PRDFRDATE (as_code in char) return date is ldt_frdate date; begin begin select fr_date into ldt_frdate from period where code = as_code; exception when others then ldt_frdate := trunc(sysdate); end; return ldt_frdate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_OPBAL_CENVAT (msite_code char,macct_prd char,mprd_code char,mbal_group char) return number is op_bal number ; begin select sum(cr_amt - dr_amt) into op_bal from tax_process_bal a,site b where a.site_code = b.site_code and b.site_code__exc = msite_code and acct_prd = macct_prd and bal_prd <= mprd_code and bal_group = mbal_group --and bal_prd <> '000000' and bal_prd <> 'ZZZZZZ'; return (op_bal) ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_COUNT_ULCUST (as_sales_pers char, as_type char, as_date date) return number is ls_count number(9); begin select count(strg_name) into ls_count from strg_meet where trim(sales_pers)=trim(as_sales_pers) and trim(strg_type)=trim(as_type) and to_date(event_date)=to_date(as_date) and strg_code is null; return nvl(ls_count,'0'); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_KRATABLE ON KRATABLE (KRA_TABLE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION YEAR (ls_date timestamp) return number is ls_char number(4); begin SELECT TO_CHAR(ls_date,'YYYY') into ls_char from DUAL; return ls_char; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DATEFORMAT (dt date,format integer) return varchar2 as DtFormat varchar2(30); --format 1: mon-yyyy --format 2: dd/mm/yy --format 3: dd-mon-yy --format 4: yyyymmdd --format 5: yyyymm begin if format=1 then SELECT upper(to_char(dt , 'mon-yyyy')) into DtFormat from dual; elsif format=2 then SELECT upper(to_char(dt , 'dd/mm/yy')) into DtFormat from dual; elsif format=3 then SELECT upper(to_char(dt , 'dd-mon-yy')) into DtFormat from dual; elsif format=4 then select upper(to_char(dt,'yyyymmdd'))into dtformat from dual; elsif format=5 then SELECT upper(to_char(dt , 'yyyymm')) into DtFormat from dual; end if; return DtFormat; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SALES_USP_DESCR ( as_usp_code char) return varchar2 is ls_descr varchar2(60); begin begin select descr into ls_descr from sales_usp where usp_code = as_usp_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MANUAL_STOCK_FOR_EACHITEM (SI_SALE_ORDER IN CHAR, SI_LINE_NO IN CHAR) RETURN char is FLAG char; CNT NUMBER; CNT1 NUMBER; BEGIN BEGIN SELECT count(*) INTO CNT FROM SORDALLOC WHERE SALE_ORDER = SI_SALE_ORDER AND LINE_NO = SI_LINE_NO AND (CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END) = 'N'; IF (CNT > 0 ) THEN FLAG := 'M'; ELSE FLAG := 'N'; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG :='E'; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRG_UPD_EMPNAMES Before Insert Or Update On Employee REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN IF :NEW.EMP_FNAME_LONG IS NULL AND :NEW.EMP_FNAME IS NOT NULL THEN :NEW.EMP_FNAME_LONG := :NEW.EMP_FNAME; ELSIF :NEW.EMP_FNAME_LONG IS NOT NULL AND :NEW.EMP_FNAME IS NULL THEN :NEW.EMP_FNAME := TRIM(SUBSTR(:NEW.EMP_FNAME_LONG,1,15)) ; ELSIF :NEW.EMP_FNAME_LONG <> :OLD.EMP_FNAME_LONG AND :NEW.EMP_FNAME = :OLD.EMP_FNAME THEN :NEW.EMP_FNAME := TRIM(SUBSTR(:NEW.EMP_FNAME_LONG,1,15)) ; ELSIF :NEW.EMP_FNAME_LONG = :OLD.EMP_FNAME_LONG AND :NEW.EMP_FNAME <> :OLD.EMP_FNAME THEN :NEW.EMP_FNAME_LONG := :NEW.EMP_FNAME; END IF; IF :NEW.EMP_MNAME_LONG IS NULL AND :NEW.EMP_MNAME IS NOT NULL THEN :NEW.EMP_MNAME_LONG := :NEW.EMP_MNAME; ELSIF :NEW.EMP_MNAME_LONG IS NOT NULL AND :NEW.EMP_MNAME IS NULL THEN :NEW.EMP_MNAME := TRIM(SUBSTR(:NEW.EMP_MNAME_LONG,1,15)) ; ELSIF :NEW.EMP_MNAME_LONG <> :OLD.EMP_MNAME_LONG AND :NEW.EMP_MNAME = :OLD.EMP_MNAME THEN :NEW.EMP_MNAME := TRIM(SUBSTR(:NEW.EMP_MNAME_LONG,1,15)) ; ELSIF :NEW.EMP_MNAME_LONG = :OLD.EMP_MNAME_LONG AND :NEW.EMP_MNAME <> :OLD.EMP_MNAME THEN :NEW.EMP_MNAME_LONG := :NEW.EMP_MNAME; END IF; IF :NEW.EMP_LNAME_LONG IS NULL AND :NEW.EMP_LNAME IS NOT NULL THEN :NEW.EMP_LNAME_LONG := :NEW.EMP_LNAME; ELSIF :NEW.EMP_LNAME_LONG IS NOT NULL AND :NEW.EMP_LNAME IS NULL THEN :NEW.EMP_LNAME := TRIM(SUBSTR(:NEW.EMP_LNAME_LONG,1,15)) ; ELSIF :NEW.EMP_LNAME_LONG <> :OLD.EMP_LNAME_LONG AND :NEW.EMP_LNAME = :OLD.EMP_LNAME THEN :NEW.EMP_LNAME := TRIM(SUBSTR(:NEW.EMP_LNAME_LONG,1,15)) ; ELSIF :NEW.EMP_LNAME_LONG = :OLD.EMP_LNAME_LONG AND :NEW.EMP_LNAME <> :OLD.EMP_LNAME THEN :NEW.EMP_LNAME_LONG := :NEW.EMP_LNAME; END IF; IF :NEW.STATUS IS NULL THEN :NEW.STATUS := ' '; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER SRETURN_AFTER_INS_UPD AFTER UPDATE of confirmed ON SRETURN FOR EACH ROW DECLARE CONFVAL CHAR(1); REFCOUNT NUMBER(10,2) DEFAULT 0; BEGIN SELECT COUNT(REF_ID) INTO REFCOUNT FROM DWH_TRAN_LOAD WHERE REF_ID=:NEW.TRAN_ID AND REF_SER='S-RET' ;-- AND REF_DATE=:NEW.TRAN_DATE AND UPDATE_STAT='P' ; CONFVAL:=:NEW.CONFIRMED; IF(CONFVAL = 'Y' AND REFCOUNT = 0) THEN -- Insert record into DWH_TRAN_LOAD table INSERT INTO DWH_TRAN_LOAD ( REF_ID, REF_SER, REF_DATE, UPDATE_STAT ) VALUES ( :new.TRAN_ID, 'S-RET', :new.TRAN_DATE, 'P' ); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SOLVANT ( as_tranid expr_hdr.expr_no%type, as_qtytyp char ) return number is ll_solvant number; ls_itemcd expr_bill.item_code%type; ls_grpcd item.grp_code%type; ls_varval mfgparm.var_value%type; begin select var_value into ls_varval from mfgparm where prd_code = '999999' and var_name = 'SOLVENT_GRP' ; if as_qtytyp = 'Q' then select nvl(sum(a.qty_per_unit),0) into ll_solvant from expr_bill a,item b where a.item_code = b.item_code and a.expr_no = as_tranid and instr( ls_varval,b.grp_code) > 0 ; else select nvl(sum( A.quantity__alt + (A.quantity__alt * A.over_perc /100) + A.potency_adj ),0) into ll_solvant from expr_bill a,item b where a.item_code = b.item_code and a.expr_no = as_tranid and instr( ls_varval,b.grp_code) > 0 ; end if; return ll_solvant; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_REPORTING_EMP_CODES_NEW ( as_login_emp_code char, as_expr_emp_code char) return number is retVal number(1) := 0; cursor rep_emp_code is select emp_code from employee where report_to=as_login_emp_code; begin BEGIN FOR I IN rep_emp_code LOOP if ( as_expr_emp_code = i.emp_code or as_expr_emp_code = as_login_emp_code) then retVal := 1; exit; end if; END LOOP; END; return retVal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TAX_BOND (as_tran_code char,as_tran_id char, as_tax_code char,as_acct_code char) return VARCHAR2 is ls_tax_form VARCHAR2(30); ls_var_value VARCHAR2(30); ls_errcode VARCHAR2(30); begin select distinct tax_form into ls_tax_form from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code; return ls_tax_form; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DRCR_INVDET_X ON DRCR_INVDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CONS_AMT ( as_tran_code in char, as_site_cd in char, as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_dept_code in char, as_flag in char) return number is ac_con_amt number(14,3); ld_tran_date date; ls_var_value char(30); ls_fin_ent char(10); ll_count number(3); begin if as_tran_code = 'M-VOUC' then -- select tran_date , substr(site_code,1,2) into ld_tran_date,ls_fin_ent from misc_voucher where tran_id = as_tran_id; ld_tran_date := to_date(sysdate); select fin_entity into ls_fin_ent from site where site_code = as_site_cd; else -- select tran_date, substr(site_code,1,2) into ld_tran_date , ls_fin_ent from voucher where tran_id = as_tran_id; ld_tran_date := to_date(sysdate); select fin_entity into ls_fin_ent from site where site_code = as_site_cd; end if ; if ld_tran_date is null then ac_con_amt := -1; return ac_con_amt; end if; select var_value into ls_var_value from finparm where var_name = 'ACTIVE_BUDGET'; if ls_var_value is null then ac_con_amt := -1; return ac_con_amt; end if; select count(*) into ll_count from budgets where budget_id = ls_var_value; if ll_count <> 1 then ac_con_amt := -1; return ac_con_amt; end if; begin if ltrim(rtrim(as_flag)) = 'A' then select con_amt into ac_con_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code and anal_code = as_anal_code; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; elsif ltrim(rtrim(as_flag)) = 'D' then select con_amt into ac_con_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code and dept_code = as_dept_code; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; else select SUM(con_amt) into ac_con_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code ; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; end if; EXCEPTION WHEN NO_DATA_FOUND then ac_con_amt := 0; return ac_con_amt; end; return ac_con_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STOCK_PICK_RATE (as_price_list in char, ad_tran_date in date, as_item_code in char, as_loc_code in char, as_lot_no in char, as_lot_sl in char, as_site_code in char) return number is mrate number(14,3); as_type char(1); begin if as_price_list is null or length(trim(nvl(as_price_list,''))) = 0 then select nvl(rate,0) into mrate from stock where item_code = as_item_code and site_code = as_site_code and lot_sl = as_lot_sl and lot_no = as_lot_no and loc_code = as_loc_code; elsif as_price_list is not null and length(trim(as_price_list)) > 0 then select list_type into as_type from pricelist where item_code = as_item_code and (lot_no__from <= as_lot_no or as_lot_no = ' ' ) and (lot_no__to >= as_lot_no or as_lot_no = ' ') and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and price_list = as_price_list; if as_type = 'L' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif as_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER UPD_EMPLANG_LINENO BEFORE INSERT ON EMPLANG FOR EACH ROW DECLARE MAX_LINE_NO EMPLANG.LINE_NO%TYPE; BEGIN MAX_LINE_NO := 0; IF :NEW.LINE_NO IS NULL OR :NEW.LINE_NO = 0 THEN SELECT MAX(LINE_NO) INTO MAX_LINE_NO FROM EMPLANG WHERE EMP_CODE = :NEW.EMP_CODE; :NEW.LINE_NO := NVL(MAX_LINE_NO , 0) + 1; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_COMMENTS (as_refser comments.ref_ser%type , as_refid comments.ref_id%type) return varchar2 is ls_comm_text comments.comm_text%type := null; begin select comm_text into ls_comm_text from comments where ref_ser = as_refser and ref_id = as_refid; if sqlcode = 0 then return ls_comm_text; elsif sqlcode = 100 then return ls_comm_text; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INVTRACE_AMOUNT (AS_TRAN_ID IN char) return number as lc_amount number(14,2); begin select NVL(SUM(QUANTITY*RATE),0) into lc_amount from ADJ_ISSRCPDET where ADJ_ISSRCPDET.TRAN_ID = AS_TRAN_ID; return(lc_amount); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SITEREGNOUSAGE ( as_site_code CHAR, as_ref_code CHAR) RETURN VARCHAR2 IS ls_usage siteregno.usage%type; as_fin_entity CHAR(10); BEGIN BEGIN SELECT fin_entity into as_fin_entity from site where site_code = as_site_code; if as_site_code = '99999' then Select usage into ls_usage from siteregno where site_code = '99999' and ref_code = as_ref_code and fin_entity = as_fin_entity; else BEGIN Select usage into ls_usage from siteregno where site_code = as_site_code and ref_code = as_ref_code and fin_entity = as_fin_entity; EXCEPTION when no_data_found then Select usage into ls_usage from siteregno where site_code = '99999' and ref_code = as_ref_code and fin_entity = as_fin_entity; END; end if; EXCEPTION when no_data_found then ls_usage := null; END; return ls_usage; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GL_ALLAC (m_frst_date in date, m_date_from in date, m_sundry_type in char, m_sundry_code in char, m_site_code in char) return number is ld_day_op_bal number(14,3); begin Select Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)) into ld_day_op_bal from gltrace where site_code= m_site_code and tran_date >= m_frst_date and tran_date < m_date_from and sundry_type = m_sundry_type and sundry_code= m_sundry_code; if ld_day_op_bal is null then ld_day_op_bal := 0; end if; Return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETRNDAMT (as_newQty number,as_round char,as_roundto number ) Return NUMBER As --lcMultiply number(10) :=1; newQty number(20,4); Begin if as_newQty < 0 then -- lcMultiply := -1; newQty := abs(as_newQty); elsif as_newQty = 0 then newQty := as_newQty; elsif as_round ='N' then newQty := as_newQty; elsif as_round = 'X' then newQty := (as_newQty - (mod(as_newQty,as_roundto)) + as_roundto); elsif as_round = 'P' then newQty := (as_newQty - (mod(as_newQty,as_roundto))); elsif as_round = 'R' then if (mod(as_newQty,as_roundto)) < (as_roundto / 2) then newQty := (as_newQty - (mod(as_newQty,as_roundto))); end if; else newQty :=(as_newQty - (mod(as_newQty,as_roundto)) + as_roundto); return newQty; end if; if as_roundto = 0 then newQty := ROUND(newQty); elsif as_roundto = 1 then newQty := ROUND(newQty); elsif as_roundto = .1 then newQty := ROUND(newQty,1); elsif as_roundto = .01 then newQty := ROUND(newQty,2); elsif as_roundto =.001 then newQty := ROUND(newQty,3); elsif as_roundto = .0001 then newQty := ROUND(newQty,4); end if; return newQty; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_IS_LICENCE_ISSRET (AS_TRAN_ID IN CHAR) RETURN VARCHAR AS FLAG VARCHAR(1); COUNTER NUMBER(3); BEGIN FLAG:='N'; COUNTER :=0; BEGIN SELECT COUNT(1) INTO COUNTER FROM LICENCE A,LICENCE_ISS_RET B WHERE A.LICENCE_NO = B.LICENCE_NO AND B.TRAN_ID=AS_TRAN_ID AND (A.STATUS_DATE + B.REMINDER) <= SYSDATE AND B.TRAN_TYPE='I'; IF COUNTER > 0 THEN FLAG:='Y'; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG:='N'; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUPP_PAY_DET (as_voucher_no CHAR,param CHAR ) RETURN VARCHAR2 is param_res VARCHAR2(40) ; ll_count number(3); BEGIN select count(1) into ll_count from misc_payment where tran_id in(select tran_id from misc_paydet where vouch_no = as_voucher_no); IF(ll_count > 1) THEN param_res := '' ; RETURN param_res; END IF; IF(param='REF_NO') THEN select ref_no into param_res from misc_payment where tran_id in(select tran_id from misc_paydet where vouch_no = as_voucher_no); END IF; IF(param = 'REF_DATE') THEN select TO_CHAR(ref_date,'mm/dd/yy') into param_res from misc_payment where tran_id in(select tran_id from misc_paydet where vouch_no = as_voucher_no); END IF; IF(param ='STATUS') THEN select status into param_res from misc_payment where tran_id in(select tran_id from misc_paydet where vouch_no = as_voucher_no); END IF; RETURN param_res; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_APO_APPV (apo_number varchar2 ) RETURN varchar2 IS last_appr_emp_code varchar2(10) := ''; max_lines number ; emp_grade varchar2(10) := ''; next_apprv_code varchar2(10) := '' ; reporting_emp_code varchar2(10) := ''; rep_emp_code varchar2(10) := ''; flag boolean :=false ; flag_LV1 number; BEGIN select get_entity_code_apo(apo_number) into last_appr_emp_code from dual ; select emp_code into reporting_emp_code from employee where emp_code = last_appr_emp_code; select report_to into rep_emp_code from employee where emp_code = last_appr_emp_code; select TRIM(grade) into emp_grade from employee where emp_code = rep_emp_code; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV1'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(last_appr_emp_code , emp_grade ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV2'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV2'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV3'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV3'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV4'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV4'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV5'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV5'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; return next_apprv_code ; end if; -- level 6 if flag = false then flag := true; select get_next_po_auth(reporting_emp_code, trim(emp_grade)) into next_apprv_code from dual ; IF next_apprv_code is NULL or next_apprv_code = '' then Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV1'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; END IF; IF next_apprv_code is NULL or next_apprv_code = '' then RETURN ''; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INDENT_HDR_TRAN_DATE_SITE ON INDENT_HDR (IND_DATE, SITE_CODE__ORI) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CAST_DESCR (AS_CAST_CODE In EMPLOYEE.CAST_CATEGORY%TYPE) RETURN VARCHAR2 IS CAST_DESCR VARCHAR2(200); BEGIN CAST_DESCR := ''; begin SELECT DESCR INTO CAST_DESCR FROM GENCODES WHERE FLD_NAME='CAST_CATEGORY' AND FLD_VALUE = TRIM(AS_CAST_CODE); EXCEPTION WHEN NO_DATA_FOUND THEN CAST_DESCR := ''; END; return cast_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUPP_ITEM_DESCR ( as_supp_code in varchar2, as_item_code in varchar2 ) return varchar2 IS ls_descr varchar2(250); begin select descr into ls_descr from supplieritem where supp_code = as_supp_code and item_code = as_item_code ; if ls_descr is NULL OR Length(Ltrim(Rtrim(ls_descr))) = 0 then select descr into ls_descr from item where item_code = as_item_code ; end if; return ls_descr; Exception When NO_DATA_FOUND then begin select descr into ls_descr from item where item_code = as_item_code ; return ls_descr ; end; When OTHERS then begin return ls_descr ; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ITMSTK (as_item_code CHAR, as_site_code CHAR) return number is ll_stkqty number(14,3); begin SELECT sum(quantity - alloc_qty) into ll_stkqty from invstat,stock,location where location.inv_stat = invstat.inv_stat and location.loc_code = stock.loc_code and stock.item_code = as_item_code and stock.site_code = as_site_code and invstat.stat_type <> 'S' and stock.quantity <> 0 and invstat.available = 'Y' ; If ll_stkqty is null then ll_stkqty := 0 ; end if; return ll_stkqty ; Exception when OTHERS then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DIST_ROUTE_DESCR ( AS_DIST_ROUTE CHAR, as_value CHAR) RETURN CHAR IS ls_return CHAR(40) ; as_STatION_CODE CHAR(5); BEGIN BEGIN IF(as_value='L' ) THEN SELECT STAN_CODE INTO as_STatION_CODE FROM (SELECT STAn_CODE__TO AS STAN_CODE FROM DISTROUTEDET WHERE DIST_ROUTE=AS_DIST_ROUTE ORDER BY LINE_NO ) VW WHERE ROWNUM=1; SELECT DESCR ||' , ' ||district INTO ls_return FROM STAtioN WHERE STAN_CODE=as_STatION_CODE; END IF; IF(as_value='LC') THEN SELECT STAN_CODE INTO as_STatION_CODE FROM (SELECT STAn_CODE__TO AS STAN_CODE FROM DISTROUTEDET WHERE DIST_ROUTE=AS_DIST_ROUTE ORDER BY LINE_NO ) VW WHERE ROWNUM=1; SELECT c.DESCR INTO ls_return FROM STAtioN a, state b, country c WHERE a.state_code=b.state_code AND b.count_code =c.count_code AND a.STAN_CODE =as_STatION_CODE; END IF; IF(as_value='H' ) THEN SELECT STAN_CODE INTO as_STatION_CODE FROM (SELECT STAn_CODE__TO AS STAN_CODE FROM DISTROUTEDET WHERE DIST_ROUTE=AS_DIST_ROUTE ORDER BY LINE_NO DESC )VW WHERE ROWNUM=1; SELECT DESCR INTO ls_return FROM STATION WHERE STAN_CODE=as_STatION_CODE; END IF; IF(as_value='HC' ) THEN SELECT STAN_CODE INTO as_STatION_CODE FROM (SELECT STAn_CODE__TO AS STAN_CODE FROM DISTROUTEDET WHERE DIST_ROUTE=AS_DIST_ROUTE ORDER BY LINE_NO DESC )VW WHERE ROWNUM=1; SELECT c.DESCR INTO ls_return FROM STAtioN a, state b, country c WHERE a.state_code=b.state_code AND b.count_code =c.count_code AND a.STAN_CODE =as_STatION_CODE; END IF; EXCEPTION WHEN no_data_found THEN ls_return:=' '; END; RETURN NVL(LS_RETURN,' '); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WO_CANCEL BEFORE INSERT or UPDATE OF STATUS ON workorder referencing old as old new as new FOR EACH ROW DECLARE BEGIN if :new.status = 'X' and :old.status <> 'X' then :new.lot_no := null; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_POAMD_DET_TRANFLOW (as_amd_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); v_str_tmp5 varchar2(1000); v_str_tmp6 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.purc_order,b.quantity ,b.rate ,b.tot_amt from item a ,poamd_det b where a.item_code = b.item_code and b.amd_no=as_amd_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Purchase Order'||''||''||'Quantity'||''||''||'Rate'||''||''||'Total Amount'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ALOC_ISSQTY ( as_workorder in char, as_sitecode in char, as_itemcode in char, as_explev in char, as_loccoode in char, as_lotno in char, as_lotsl in char, as_deallocated in char) Return Number is ld_qty number(14,3); ld_alloc_qty number(14,3); ls_deallocated char(1); ld_inv_alloc_qty number(14,3); ld_alloc_woiss_othqty number(14,3); Begin Begin BEGIN If as_deallocated is null then ls_deallocated := 'N' ; elsif as_deallocated = 'Y' THEN ls_deallocated := 'Y' ; ELSE ls_deallocated := 'N' ; end if; Select ( case ls_deallocated when 'N' then alloc_qty else 0 end ) Into ld_alloc_qty From stock where site_code = as_sitecode And item_code = as_itemcode and loc_code = as_loccoode And lot_no = as_lotno And lot_sl = as_lotsl; If ld_alloc_qty is null then ld_alloc_qty := 0 ; end if; END; BEGIN Select case ls_deallocated when 'N' then (sum(case when B.quantity is null then 0 else B.quantity end + case when B.potency_adj is null then 0 else B.potency_adj end )) else 0 end Into ld_alloc_woiss_othqty From workorder_iss A, workorder_issdet B Where A.tran_id = B.tran_id And ((A.work_order <> as_workorder) OR (A.work_order = as_workorder AND B.exp_lev <> as_explev)) And A.site_code = as_sitecode And B.item_code = as_itemcode And B.loc_code = as_loccoode And B.lot_no = as_lotno And B.lot_sl = as_lotsl And case when A.confirmed is null then 'N' else A.confirmed end = 'N' and case when a.status is null then 'N' else a.status end <> 'X'; If ld_alloc_woiss_othqty is null then ld_alloc_woiss_othqty := 0 ; end if; END; ld_qty := ld_alloc_qty - ld_alloc_woiss_othqty; BEGIN select (case when a.alloc_qty is null then 0 else a.alloc_qty end) into ld_inv_alloc_qty from inv_alloc_det a, inv_allocate b where b.tran_id = a.tran_id and a.site_code = as_sitecode and b.work_order = as_workorder and a.exp_lev = as_explev and a.item_code = as_itemcode And a.loc_code = as_loccoode And a.lot_no = as_lotno And a.lot_sl = as_lotsl AND A.DEALLOCATED = 'N'; if ld_qty > ld_inv_alloc_qty then Return ld_inv_alloc_qty; end if; END; Exception When others then return 0; END; Return ld_qty; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GRACE_DAYS (as_tran_id VARCHAR2, as_line_no long ) RETURN DECIMAL IS lc_grace number(5); BEGIN begin SELECT b.GRACE_DAYS into lc_grace FROM QC_STABILITY_TESTSCH_DET a, QC_STAB_TEST_PATTERN_DET b, QC_STABILITY_HDR c WHERE ( a.TRAN_ID = c.TRAN_ID ) and ( b.TEST_PATTERN_ID = c.TEST_PATTERN ) and ( a.line_no = b.line_no ) and ( a.TRAN_ID = as_tran_id ) and ( a.LINE_NO = as_line_no ) ; EXCEPTION WHEN NO_DATA_FOUND then return 0 ; end; RETURN lc_grace; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VOUCHER_BILL_NO_SUPP_DATE ON VOUCHER (BILL_NO, SUPP_CODE, BILL_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_INV AFTER UPDATE OF CONFIRMED ON INVOICE REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ----PRAGMA AUTONOMOUS_TRANSACTION;set echo on; BEGIN --IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN IF ((:old.confirmed = 'N' and :new.confirmed = 'Y') or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y') ) THEN begin delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser = 'S-INV' and ref_id = :new.invoice_id); delete from e_invoice where ref_ser = 'S-INV' and ref_id = :new.invoice_id; select count(1) into ll_count from e_invoice where ref_ser = 'S-INV' and ref_id = :new.invoice_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, TRAN_gstn, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, SUPPLY_TYPE, gst_port, refund_claim, gst_currency, count_code, export_duty, tran_name ) SELECT ls_seq as tran_id, :new.TRAN_DATE as tran_date, :new.inv_type as tran_type, buyer.einv_reqd as einv_opt, 'S-INV' as ref_ser, :new.invoice_id ref_id , :new.tran_date as ref_date, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) as gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, so.SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= ship.site_code AND ref_code='GSTIN_NO' ) gstn_ship, ship.descr trade_name_ship, ship.descr legal_name_ship, ship.ADD1 add1_ship, ship.ADD2 add2_ship, ship.CITY city_ship, ship.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = ship.STATE_CODE) state_ship, ship.TELE1 tele_ship, ship.EMAIL_ADDR email_id_ship, :new.cust_code cust_code, case when buyer.TAX_REG_2='UNREGISTER' then 'URP' else buyer.TAX_REG_2 end gstn_buy, buyer.CUST_NAME trade_name_buy, buyer.CUST_NAME legal_name_buy, case when fn_supplytype('S-INV', trim(:new.invoice_id), trim(buyer_state.count_code), trim(seller_state.count_code),:new.site_code) = 'B2B' then (SELECT GST_CODE FROM STATE WHERE STATE_CODE = ship.STATE_CODE) else '96' end as pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.CITY city_buy, buyer.state_code state_code__buy, buyer.drug_lic_no drug_lic_no_buy, buyer.PIN pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.TELE1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.CUST_CODE__BIL CUST_CODE__BIL, so.CUST_CODE__DLV CUST_CODE__DLV, dlv.CUST_NAME name_dlv, dlv.ADDR1 add1_dlv, dlv.ADDR2 add2_dlv, dlv.PIN pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = dlv.STATE_CODE) state_dlv, dlv.state_code state_code__dlv, dlv.drug_lic_no drug_lic_no_dlv, round(((select sum(quantity * rate) from invoice_trace where invoice_id = :new.invoice_id) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id --and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, ---- 02-sep-2022 and tax_code in ('FRS01','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, round(((select sum(quantity * rate) from invoice_trace where invoice_id = :new.invoice_id)- (select sum(quantity__stduom * rate__stduom * discount / 100) from invoice_trace where invoice_id = :new.invoice_id) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','K')) and tax_perc <> 0 and tax_amt <> 0),0)+nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type IN ('D')) and tax_perc < 0 and tax_amt < 0),0) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in ('FRS01','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) AS NET_AMT, round(((select sum(quantity * rate) from invoice_trace where invoice_id = :new.invoice_id) +(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) - (select sum((it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT) from invoice_trace it where it.invoice_id = :new.invoice_id ) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id --and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) AS ASSESABLE_VALUE, and tax_code in ('FRS01','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) AS ASSESABLE_VALUE, --round(:new.DISC_AMT,2), 0, --(select sum(( it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT) from invoice_trace it where it.invoice_id = :new.invoice_id ) disc_amt, :new.SALE_ORDER ORDER_NO, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, ----additional round bracket added before the *.:new.exch_rate round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='K') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, ----additional round bracket added before the *.:new.exch_rate --0 as OTHER_AMT,select * from aldevis.invoice where desp_id = 'TEDI0019'; 'N' proc_stat, sysdate proc_date, 'P' resp_stat, --0 distance, (select nvl(distance,0) from site_customer where site_code = :new.site_code and cust_code = :new.cust_code) as distance, (select case when trans_mode = 'R' then '1' when trans_mode = 'L' then '2' when trans_mode = 'A' then '3' when trans_mode = 'S' then '4' else '1' end from despatch where desp_id = :new.desp_id) Trans_Mode, -- Road-1, Rail-2, Air-3, Ship-4 (select case when t.tax_reg_2 = 'UNREGISTER' then ' ' else t.tax_reg_2 end from transporter t, despatch d where d.tran_code = t.tran_code and d.desp_id = :new.desp_id) Tran_gstn, --:new.lr_date, --:new.lr_no, (select lr_date from despatch where desp_id = :new.desp_id), (select lr_no from despatch where desp_id = :new.desp_id), --:new.lorry_no, (select lorry_no from despatch where desp_id = :new.desp_id), 'R' Vehicle_Type, null DOC_NO, null DOC_DATE, fn_supplytype('S-INV', trim(:new.invoice_id), trim(buyer_state.count_code), trim(seller_state.count_code),:new.site_code) as SUPPLY_TYPE, --nvl(station.gst_port,' ') gst_port, (select nvl(st.gst_port,' ') from station st where st.stan_code = (select stan_code__init from despatch where despatch.desp_id = :new.desp_id) ) as gst_port, fn_refundclaim('S-INV', trim(:new.invoice_id)) refund_claim, 'INR' gst_currency, country.iso3166 as count_code, nvl(((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and tax_code in (select tax_code from tax where tax_type ='L') and tax_perc <> 0 and tax_amt <> 0)) * :new.exch_rate,0) as export_duty, ----additional round bracket added before the *.:new.exch_rate (select t.tran_name from transporter t, despatch d where d.tran_code = t.tran_code and d.desp_id = :new.desp_id) Tran_name FROM --INVOICE INV, SORDER SO, CUSTOMER BUYER, CUSTOMER DLV, site seller, site ship, state seller_state, state buyer_state, currency, country --, --station, --despatch WHERE SO.sale_order = :new.sale_order -- inv.sale_order and buyer.cust_code = :new.CUST_CODE__BIL --cust_code --inv.CUST_CODE and DLV.cust_code = so.CUST_CODE__DLV and seller.site_code = :new.site_code --inv.site_code and ship.site_code = so.site_code__ship and seller_state.state_code = seller.state_code and buyer_state.state_code = buyer.state_code and currency.curr_code = buyer.curr_code and country.count_code = buyer_state.count_code; --and station.stan_code = despatch.stan_code --and despatch.desp_id = :new.desp_id; --and INV.INVOICE_ID = :new.invoice_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.ITEM_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, it.LINE_TYPE AS LINE_TYPE, round(((it.quantity__stduom * it.RATE__STDUOM) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id --and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, -- 02-sep-2022 and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, round((case when it.DISCOUNT > 0 then round(((it.quantity__stduom * it.RATE__STDUOM) -((it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT)) * :new.exch_rate,2) +round(( (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) else round((it.quantity__stduom * it.RATE__STDUOM) + round(( (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) ,2) END + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SOTH','SFRGT','SINSR') ) ) * :new.exch_rate,2) --------additional round bracket with *.:new exch_rate added as ASS_AMT, abs(round(((it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT) + ((nvl( -1 * (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0))) * :new.exch_rate,2)) AS DISCOUNT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in('C') ) and tax_code not in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=it.unit ) AS UNIT, it.quantity__stduom AS QUANTITY, it.RATE__STDUOM * :new.exch_rate AS RATE, item.hsn_no AS HSN_CODE, case when length(trim(it.LOT_NO)) = 0 or trim(it.LOT_NO) is null then 'NOT-APPLICABLE' else it.LOT_NO end as LOT_NO, it.EXP_DATE as EXP_DATE, it.MFG_DATE as MFG_DATE, round( (case when it.DISCOUNT > 0 then round(((it.quantity__stduom * it.RATE__STDUOM) -((it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT)) * :new.exch_rate,2) +round(( (nvl((select sum( tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) else round((it.quantity__stduom * it.RATE__STDUOM) + round(( (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) ,2) END + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=:new.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SOTH','SFRGT','SINSR') ) +nvl((select tax_amt from taxtran where taxtran.tran_code = 'S-INV' and taxtran.tran_id=it.invoice_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0) )* :new.exch_rate,2) as TOT_ITEM_VAL, fn_gst_rate_amt('S-INV',it.invoice_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt('S-INV',it.invoice_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt('S-INV',it.invoice_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt('S-INV',it.invoice_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate('S-INV',it.invoice_id, it.line_no) as GST_RATE, --(select case when item.stk_opt = '0' then 'Y' else 'N' end from item where item.item_code = it.item_code) (select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code and item.item_ser = itemser.item_ser) FROM invoice_trace it, item WHERE item.item_code= it.item_code AND it.invoice_id = :new.invoice_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; -- end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_VOUCH_IBCA BEFORE INSERT OR UPDATE OF confirmed ON voucher referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_ibcacount number(3) := 0; ls_sitecodepay char(5); ll_mcount number := 0; BEGIN if :new.confirmed = 'Y' and :new.net_amt <> 0 then -- 1. check pay site begin select count(1) into ll_mcount from site_supplier where site_code = :new.site_code and supp_code = :new.supp_code; exception when others then ll_mcount := 0 ; end; if ll_mcount > 0 then begin select site_code__pay into ls_sitecodepay from site_supplier where site_code = :new.site_code and supp_code = :new.supp_code; exception when others then null; end; else begin select s.site_code__pay into ls_sitecodepay from supplier s where s.supp_code = :new.supp_code; exception when others then ls_sitecodepay := :new.site_code; end; end if; if ls_sitecodepay is null or length(trim(ls_sitecodepay)) = 0 then ls_sitecodepay := :new.site_code; end if; if trim(:new.site_code) <> trim(ls_sitecodepay) then begin select count(1) into ll_ibcacount from misc_payables where tran_ser = 'P-IBCA' and ref_no = :new.tran_id and site_code = ls_sitecodepay ; exception when others then ll_ibcacount := 0; end; if ll_ibcacount = 0 then raise_application_error( -20601, 'IBCA not created pay site [' || ls_sitecodepay || '] voucher site [' || :new.site_code || ']' ); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_COMMUNICATION_DATE (p_sorg_code IN VARCHAR2) RETURN VARCHAR2 AS v_result VARCHAR2(1000); BEGIN BEGIN SELECT 'Last communicated cn ' || TO_CHAR(cc.comm_date , 'DD-MON-YYYY') || ' by ' || SP.sp_name INTO v_result FROM contact_comm cc, sales_pers sp , strg_customer sc WHERE sp.sales_pers = cc.sales_pers AND CC.strg_code = sc.sc_code and sc.sorg_code = p_sorg_code order by cc.comm_date desc,cc.comm_id desc fetch first row only; v_result := NVL(v_result , 'Yet no communication done'); EXCEPTION WHEN NO_DATA_FOUND THEN v_result := 'Yet no communication done'; END; /* SELECT LISTAGG( 'Last Communicated On ' || TRUNC(comm_date) || ' BY ' || (SELECT MAX(sp_name) FROM sales_pers sp WHERE sp.sales_pers = cc.sales_pers) || ' (' || TRIM(cc.sales_pers) || ')', ';' ) WITHIN GROUP (ORDER BY comm_date, sales_pers) INTO v_result FROM contact_comm cc WHERE strg_code IN ( SELECT sc_code FROM strg_customer WHERE sorg_code IN ( SELECT sorg_code FROM strg_org WHERE sorg_code = p_sorg_code ) ); */ RETURN v_result; END DDF_GET_COMMUNICATION_DATE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SITE_RCP_OUTST (as_site_fr in char,as_site_to in char,as_date_fr in date,as_date_to in char ,as_flag in char) return number is ret_val number(14,3); begin if(as_flag='R') then select sum(rcp) into ret_val from ( SELECT SUM(NVL(DDF_RECV_CUSTADV('ALL',as_date_fr,as_date_TO,SITE_CODE,'R'),0)) * -1 rcp FROM SITE WHERE SITE_CODE >= as_site_fr AND SITE_CODE <= as_site_to UNION ALL select sum(nvl(rcpdet.rcp_amt,0)) rcp from receipt,rcpdet where (RECEIPT.TRAN_ID = RCPDET.TRAN_ID) and (receipt.site_code >= as_site_fr) and (receipt.site_code <= as_site_to) and (receipt.tran_date >= as_date_fr) and (receipt.tran_date <= as_date_to) and (receipt.confirmed = 'Y') union all select sum(nvl(RCPADV.ADJ_AMT,0)) rcp from receipt,RCPADV where (RECEIPT.TRAN_ID = rcpadv.TRAN_ID) and (receipt.site_code >= as_site_fr) and (receipt.site_code <= as_site_to) and (receipt.tran_date >= as_date_fr) and (receipt.tran_date <= as_date_to) and (receipt.confirmed = 'Y') ); elsif(as_flag='D') then select sum(rcpdish) into ret_val from ( SELECT SUM(NVL(DDF_RECV_CUSTADV('ALL',as_date_fr,as_date_TO,SITE_CODE,'D'),0)) * -1 rcpdish FROM SITE WHERE SITE_CODE >= as_site_fr AND SITE_CODE <= as_site_to UNION ALL SELECT SUM(NVL(PAYDET_EXP.AMOUNT,0)) rcpdish FROM PAYDET_EXP, PAYMENT_EXP WHERE ( PAYDET_EXP.TRAN_ID = PAYMENT_EXP.TRAN_ID ) AND (PAYMENT_EXP.sundry_TYPE = 'C' ) and (PAYMENT_EXP.tran_date >= as_date_fr) and (PAYMENT_EXP.tran_date <= as_date_to) and (PAYMENT_EXP.site_code >= as_site_fr) and (PAYMENT_EXP.site_code <= as_site_to) and (PAYMENT_EXP.confirmed = 'Y') UNION ALL select sum(nvl(RCPDISHNR_DET.RCP_AMT,0)) rcpdish from rcpdishnr,RCPDISHNR_DET where (RCPDISHNR.TRAN_ID = RCPDISHNR_DET.TRAN_ID) and (rcpdishnr.tran_date >= as_date_fr) and (rcpdishnr.tran_date <= as_date_to) and (rcpdishnr.site_code >= as_site_fr) and (rcpdishnr.site_code <= as_site_to) and (rcpdishnr.confirmed = 'Y') ); else select sum(nvl(fdf_recv_report_fld1( receivables.tran_ser,receivables.ref_no, as_date_FR , receivables.tot_amt - receivables.adj_amt, receivables.site_code ),0)) into ret_val from receivables where (receivables.tran_date <= as_date_FR ) and (receivables.site_code >= as_site_fr ) and (receivables.site_code <= as_site_to ) ; end if; return ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_OPENING_STOCK (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, llot_sl in char, as_qtyvalue in char, lreporttype_fr in char, lreporttype_to in char, lloc_code in char ) return number is ld_eff_qty number(18,3); ldt_crea_date date; begin if ltype = 'S' then select sum(qty) into ld_eff_qty from ( Select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code= litem_code and a.site_code= lsite_code and a.loc_code in (SELECT LOC_CODE FROM LOCATION WHERE SITE_CODE = lsite_code and loc_TYPE='IL') union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code ); end if; if ltype = 'B' then select sum(qty) into ld_eff_qty from ( Select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code= litem_code and a.site_code= lsite_code and a.lot_no=llot_no and a.lot_sl=llot_sl and a.loc_code in (SELECT LOC_CODE FROM LOCATION WHERE SITE_CODE = lsite_code and loc_TYPE='IL') union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no=llot_no and a.lot_sl=llot_sl ); end if; if ltype = 'W' then select sum(qty) into ld_eff_qty from ( Select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code= litem_code and a.site_code= lsite_code and a.loc_code=lloc_code union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code ); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_CUSTOMER_NAME (as_emp_code char, as_cust_code char, as_cust_type char) return varchar is custName varchar2(50); ls_parm_value varchar2(30); ls_dcr_group char(1); noof_row number(10); begin SELECT GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',as_emp_code) INTO ls_parm_value FROM DUAL; noof_row := 0; select count(*) into noof_row from strg_cust_type where type = as_cust_type; if noof_row > 0 then SELECT DCR_GROUP INTO ls_dcr_group FROM STRG_CUST_TYPE WHERE TYPE = as_cust_type; end if; if (ls_parm_value = 'SPRS_STOCKIST' and ls_dcr_group = 'S') THEN select cust_name into custName from customer where cust_code = as_cust_code; return custName; else select first_name || ' ' || middle_name || ' ' || last_name into custName from strg_customer where sc_code = as_cust_code; return custName; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAXAMT_SUM (ls_tran_code in char,ls_tran_id in char,AS_ITEM_CODE IN CHAR, as_lot_no in CHAR,as_rate IN Number,ls_disparm_code in char) return number is AS_TAX_SUM number(14,3); ls_var_value disparm.var_value%type; BEGIN select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; SELECT NVL(sum(nvl(TAXTRAN.TAX_AMT,0)),0) INTO AS_TAX_SUM FROM TAXTRAN,INVOICE_TRACE WHERE TAXTRAN.TRAN_CODE=ls_tran_code and TAXTRAN.TRAN_ID=ls_tran_id AND TAXTRAN.TRAN_ID=INVOICE_TRACE.INVOICE_ID AND INVOICE_TRACE.ITEM_CODE=AS_ITEM_CODE and INVOICE_TRACE.line_no=taxtran.line_no and INVOICE_TRACE.rate=as_rate and INVOICE_TRACE.lot_no=as_lot_no and instr(ls_var_value,rtrim(tax_code)) > 0 GROUP BY INVOICE_TRACE.ITEM_CODE,INVOICE_TRACE.LOT_NO,INVOICE_TRACE.RATE; RETURN AS_TAX_SUM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETNEXTSCHEDULEDATE (ls_type in char, lastFiredOn in Date ) return timestamp is ls_time timestamp; begin if ls_type = 'H' then select lastFiredOn + 1/24 into ls_time from dual; if( ls_time< sysdate ) then select sysdate + 1/24 into ls_time from dual; end if; elsif ls_type = 'D' then select ( TO_DATE(sysdate || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') ) +1 into ls_time from dual; elsif ls_type = 'M' then select add_months( TO_DATE(sysdate || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') ,1) into ls_time from dual; elsif ls_type = 'F' then select TO_DATE(sysdate || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') +15 into ls_time from dual; elsif ls_type = 'W' then select TO_DATE(sysdate || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') +7 into ls_time from dual; elsif ls_type = 'L' then select last_day( TO_DATE(sysdate || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') ) into ls_time from dual; elsif ls_type = 'S' then select last_day( TO_DATE(add_months(sysdate,1) || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') ) - to_number(to_char(last_day( TO_DATE(add_months(sysdate,1) || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') ),'DD')) +1 into ls_time FROM DUAL; elsif ls_type = 'O' then select ( TO_DATE(sysdate || ' ' || TO_CHAR(lastFiredOn, 'HH24:MI:SS'), 'dd/mm/yy HH24:MI:SS') ) into ls_time from dual; else select lastFiredOn + to_number( (1 / 24) * ls_type ) into ls_time from dual; if( ls_time< sysdate ) then select sysdate + to_number( (1 / 24) * ls_type ) into ls_time from dual; end if; end if; return ls_time; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_ANHYDROUS (Label_claim number,actual_assay number, water number, equi_factor number) return number is potency_adj number(14,6); potency number(14,6); begin potency :=((Label_claim*100*100)/((actual_assay)*(100-water))) * equi_factor; potency_adj := (potency - Label_claim); return( potency_adj ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MFGLICNO (as_sitecode char) return varchar2 is ls_mfglicno varchar2(100); begin select reg_no into ls_mfglicno from siteregno where site_code = as_sitecode and ref_code = 'MFG_LIC_NO' ; return ls_mfglicno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX QC_ORDER_TRAN_DATE ON QC_ORDER (QORDER_DATE, SITE_CODE, STATUS, LOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_RETEN_REFUND (AS_EMP_CODE char,AS_PRD_CODE char,AS_TYPE char,AS_AMOUNT number) return number is a_amount number(13,2) := 0; a_payarr_amt number(13,2) := 0; a_payroll_amt number(13,2) := 0; a_period_fr char(6); a_period_to char(6); a_relieve_date date; a_prd_todate date; begin select relieve_date into a_relieve_date from employee where emp_code = AS_EMP_CODE; select to_date into a_prd_todate from period where code = AS_PRD_CODE; if (a_relieve_date is not null) and (a_relieve_date <= a_prd_todate) then a_amount := 0; return a_amount; end if; if (substr(AS_PRD_CODE,5,2) = '03') then if (AS_TYPE = 'PY') then select to_char(add_months(to_date+1,-12),'YYYYMM') into a_period_fr from period where code = AS_PRD_CODE; select nvl(sum(amount),0) into a_payarr_amt from payarr_det where prd_code >= a_period_fr and prd_code <= AS_PRD_CODE and emp_code = AS_EMP_CODE and ad_code = 'RETEN'; a_amount := a_amount + AS_AMOUNT + a_payarr_amt; a_amount := a_amount * 30 / 100; elsif (AS_TYPE = 'AR') then select nvl(sum(a.amount),0) into a_amount from payrolldet a,payroll b where a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.ad_code = 'RETRF' and a.prd_code = b.prd_code and a.emp_code = b.emp_code and b.voucher_no is not null; end if; elsif (substr(AS_PRD_CODE,5,2) = '07') then select to_char(add_months(to_date+1,-16),'YYYYMM') into a_period_fr from period where code = AS_PRD_CODE; select to_char(add_months(to_date,-4),'YYYYMM') into a_period_to from period where code = AS_PRD_CODE; select nvl(sum(amount),0) into a_payarr_amt from payarr_det where prd_code >= a_period_fr and prd_code <= a_period_to and emp_code = AS_EMP_CODE and ad_code = 'RETEN'; select nvl(sum(a.amount),0) into a_payroll_amt from payrolldet a,payroll b where a.prd_code = a_period_to and a.emp_code = AS_EMP_CODE and a.ad_code = 'RETRF' and a.prd_code = b.prd_code and a.emp_code = b.emp_code and b.voucher_no is not null; a_amount := a_amount + a_payarr_amt - a_payroll_amt; end if; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TOUR_EXP_DUP_CHK BEFORE INSERT ON tour FOR EACH ROW DECLARE pragma autonomous_transaction; ls_tour_cnt number(1); BEGIN ls_tour_cnt:=0; select COUNT (*) into ls_tour_cnt from tour where emp_code = :new.emp_code and date_from = :new.date_from and date_to = :new.date_to and trans_mode ='F' ; if ls_tour_cnt > 0 then raise_application_error( -20601, 'Expense already processed for [' || :new.emp_code || '] dated of [' || :new.date_from || ']' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SPRS_WORK_STAN_TYPE ( ls_sales_pers sprs_travel.sales_pers%type, ld_travel_date sprs_travel.travel_date%type) return varchar2 is ls_stan_type stantype.stan_type%type; begin select a.stan_type into ls_stan_type from fieldactivity a where a.activity_code = (select max(activity_code) from sprs_travel where sales_pers = ls_sales_pers and travel_date = ld_travel_date); if ls_stan_type is null then select distinct(g.stan_type) into ls_stan_type from sprs_travel e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.travel_date = ld_travel_date and f.sprs_code = e.sales_pers and f.locality_code = e.locality_code and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from sprs_travel b, sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.travel_date = e.travel_date and c.sprs_code = b.sales_pers and c.locality_code = b.locality_code and d.stan_type = c.station_type); end if; return ls_stan_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SODET_DUEDATE ( as_saleorder in char, as_lineno in char) return date is ldt_duedate date; begin select dsp_date into ldt_duedate from sorddet where sale_order = as_saleorder and ltrim(rtrim(line_no)) = ltrim(rtrim(as_lineno)) ; return ldt_duedate ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TERRITORY_DESCR (ls_emp_code in char,ls_login_code in char) return VARCHAR2 is ls_territory_descr VARCHAR2(40); BEGIN select trim(upper(STN.DESCR)) INTO ls_territory_descr from EMPLOYEE EMP left OUTER JOIN STATION STN on EMP.STAN_CODE__HQ = STN.STAN_CODE where EMP.EMP_CODE = (SELECT EMP_CODE FROM users WHERE CODE = ls_login_code); return ls_territory_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GST_GP_RATE (as_trancode in taxtran.tran_code%type,as_tranid in taxtran.tran_id%type, al_lineno number,as_taxgroup in char) return number is lc_gstrate number(6,2) := 0; ls_lineno char(3); begin begin -- get IGST rate select lpad(trim(to_char(al_lineno)),3, ' ') into ls_lineno from dual; exception when others then ls_lineno := ' '; end; begin -- get IGST rate select tax_perc into lc_gstrate from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type = 'I' and tt.tran_code = as_trancode and tm.tax_group = as_taxgroup and tt.tran_id = as_tranid and tt.line_no = ls_lineno; exception when others then lc_gstrate := 0; end; if lc_gstrate = 0 then -- if IGST rate is 0 then get sum of SGST and CGST rate begin select sum(tax_perc) into lc_gstrate from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type in ('G','H') and tt.tran_code = as_trancode and tm.tax_group = as_taxgroup and tt.tran_id = as_tranid and tt.line_no = ls_lineno; exception when others then lc_gstrate := 0; end; end if; return lc_gstrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SPECIALITY (as_sc_code CHAR) RETURN VARCHAR2 IS spl VARCHAR2(1000); spl_cnt number(1,0); CURSOR C1 IS select descr from speciality where trim(spl_code) in (select trim(spl_code) from strg_series where trim(sc_code)=trim(as_sc_code)); BEGIN select count(distinct spl_code) into spl_cnt from strg_series where trim(sc_code)=trim(as_sc_code); IF spl_cnt =1 THEN select descr into spl from speciality where trim(spl_code)= (select distinct trim(spl_code) from strg_series where trim(sc_code)=trim(as_sc_code)); RETURN spl; ELSIF spl_cnt >1 THEN spl:='' ; FOR I IN C1 LOOP spl:=spl||I.descr||' , ' ; END LOOP; END IF; spl:=substr(spl,1,length(trim(spl))-1); RETURN spl; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'Not Defined in STRG_SERIES' ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PUNCH_BUFFER_EMCD_USD_PREF ON PUNCH_BUFFER (EMP_CODE__USED, PREFIX) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_SITEITEM_PO_DEL (ls_sitecodedlv in char, ls_sitecodesupp in char, ls_item_ser in char, ls_item_code in char, ls_errcode out char) as ls_supp_code char(10); ls_purc_order char(10); BEGIN -- main ls_errcode := ' '; IF ls_sitecodedlv is null OR ls_item_ser is null OR ls_sitecodesupp is null THEN ls_errcode := ''; RETURN; END IF; IF length(ltrim(rtrim(ls_sitecodedlv))) = 0 OR length(ltrim(rtrim(ls_item_ser))) = 0 OR length(ltrim(rtrim(ls_sitecodesupp))) = 0 THEN ls_errcode := ''; RETURN; END IF; -- check for channel partner record select supp_code into ls_supp_code from supplier where site_code = ls_sitecodesupp and channel_partner = 'Y'; BEGIN -- po existance -- checking po existance select purc_order into ls_purc_order from porder where site_code__dlv = ls_sitecodedlv and item_ser = ls_item_ser and supp_code = ls_supp_code ; BEGIN -- get max line no BEGIN -- close po detail record update porddet set status = 'C' where purc_order = ls_purc_order and item_code = ls_item_code; commit; EXCEPTION WHEN NO_DATA_FOUND THEN ls_errcode := 'NOCPDET'; RETURN; WHEN TOO_MANY_ROWS THEN ls_errcode := 'MORECPDET'; RETURN; WHEN OTHERS THEN ls_errcode := 'CLOSEDET'; RETURN; END; END; -- max line_no -- exception handle for po exitance EXCEPTION WHEN NO_DATA_FOUND THEN ls_errcode := 'NOCPARPO'; RETURN; WHEN TOO_MANY_ROWS THEN ls_errcode := 'MORECPARPO'; RETURN; END; -- po existance -- exception handle for channel parner EXCEPTION WHEN NO_DATA_FOUND THEN ls_errcode := 'NOCPART'; RETURN; WHEN TOO_MANY_ROWS THEN ls_errcode := 'MORECPART'; RETURN; END; -- eof main -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INV_ITEMDESCR_QTY (as_invoice_id invoice.invoice_id%type) return varchar2 is ls_data nvarchar2(4000); -- ll_qty varchar2(4000) := ''; -- ls_descr varchar2(120) := ''; ls_descrComa nvarchar2(4000); cursor curdata1(minv_no in char) is select item.descr as item_descr, sum(invoice_trace.quantity) as inv_quantity from item, invoice_trace where invoice_trace.invoice_id = minv_no and item.item_code = invoice_trace.item_code group by item.descr; begin for x in curdata1(as_invoice_id) loop ls_descrComa := ls_descrComa||trim(x.item_descr)||' - '||to_char(x.inv_quantity)||chr(10) ; -- ll_qty := to_char(ll_qty)|| to_char(x.inv_quantity) || chr(10); end loop; return ls_descrComa; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_DRCP (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUBMISSION_GRADE (as_grade_allow varchar2,as_emp_code char) RETURN varchar2 IS grade varchar2(20); a_count number(3); grade_whitespace varchar2(200); begin select regexp_replace(as_grade_allow,'\s') into grade_whitespace from dual; select INSTR(grade_whitespace,',') into a_count from dual; if a_count = 0 then select (case when instr(','||grade_whitespace||',',','||(select TRIM(grade) from employee where emp_code = as_emp_code )||',') > 0 then 'exists' else 'not exists' end) into grade FROM DUAL; else select (case when instr(','||grade_whitespace||',',','||(select TRIM(grade) from employee where emp_code = as_emp_code )||',') > 0 then 'exists' else 'not exists' end) into grade FROM DUAL; end if; return grade; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LVEPRK_DESCR (ls_tran_type IN EMP_LVEPRKBAL_TRFHDR.tran_type%TYPE, ls_balance_code IN EMP_LVEPRKBAL_TRFDET.balance_code%TYPE) return varchar2 is ls_descr varchar2(30); begin if(ls_tran_type = 'LVE') then select descr into ls_descr from leaves where lve_code = ls_balance_code; return ls_descr; elsif ls_tran_type = 'PRK' then select descr into ls_descr from allwdedn where ad_code = ls_balance_code; return ls_descr; end if; RETURN LS_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PO_DO_CHK BEFORE UPDATE OF confirmed ON porder referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_docount number(6) := 0; ls_msg varchar2(2000); jobWorkType char(3); subcontractType char(3); pordTypeImpService char(3); begin if :new.confirmed = 'Y' and :old.confirmed = 'N' then begin select var_value into jobWorkType from disparm where prd_code = '999999' and var_name = 'JOBWORK_TYPE'; exception when others then jobWorkType := ' '; end; begin select var_value into subcontractType from disparm where prd_code = '999999' and var_name = 'SUBCONTRACT_TYPE'; exception when others then subcontractType := ' '; end; begin select var_value into pordTypeImpService from disparm where prd_code = '999999' and var_name = 'PORD_TYP_IMP_SERVICE'; exception when others then pordTypeImpService := ' '; end; if trim(jobWorkType)= trim(:new.pord_type) or trim(subcontractType)= trim(:new.pord_type) or trim(pordTypeImpService)= trim(:new.pord_type) then begin select count(1) into ll_docount from distorder where purc_order = :new.purc_order; exception when others then ll_docount := 0; end; if ll_docount = 0 then raise_application_error( -20601, 'Distribution order not generated against jobwork order'); end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_PO_SAMETAX (as_po porder.purc_order%type) return char is ls_flag varchar2(20); li_pocnt number; li_taxcnt number; ls_taxcode char(20); ls_taxclass char(20); ls_taxbase char(20); ls_taxenv char(20); lc_perc number(14,2); cursor c1 is select tax_code,tax_class,tax_base,tax_env,tax_perc, count(*) from taxtran where tran_code = 'P-ORD' and tran_id = as_po and tax_amt <> 0 group by tax_code,tax_class,tax_base,tax_env,tax_perc ; begin ls_flag := 'SAMETAX'; select count(*) into li_pocnt from porddet where purc_order = as_po ; if li_pocnt > 1 then open c1 ; loop fetch c1 into ls_taxcode, ls_taxclass, ls_taxbase, ls_taxenv, lc_perc, li_taxcnt ; exit when c1%notfound; if li_pocnt <> li_taxcnt then ls_flag := 'NOTSAMETAX'; return ls_flag; end if; end loop; close c1; end if; return ls_flag; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEM_SER_USAGE ON ITEM (ITEM_SER, ITEM_USAGE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORDER_ORDER_DATE ON DISTORDER (ORDER_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_LIC_DATE_VALID (as_var_name char , as_fin_ent char, as_site_code char) return date is mreg_date date; mvar_value char (25); merrcode char (100); begin select var_value into mvar_value from disparm where prd_code = '999999' and var_name = as_var_name; select valid_upto into mreg_date from siteregno where fin_entity = as_fin_ent and site_code = as_site_code and ref_code = mvar_value; return mreg_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SER_REQUEST_X ON SER_REQUEST (REQ_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_GET_BILL_AMT (AS_TRAN_SER VARCHAR2, AS_TRAN_ID VARCHAR2 ) RETURN DECIMAL IS LC_AMT DECIMAL(14,3); BEGIN IF AS_TRAN_SER = 'M-VOUC' THEN SELECT NVL(SUPP_BILL_AMT, 0) into lc_amt FROM misc_voucher WHERE tran_id = AS_TRAN_ID; ELSIF AS_TRAN_SER = 'VOUCH' THEN SELECT NVL(SUPP_BILL_AMT, 0) into lc_amt FROM voucher WHERE tran_id = AS_TRAN_ID; ELSIF AS_TRAN_SER = 'P-VOUC' THEN SELECT NVL(tot_amt, 0) into lc_amt FROM payr_voucher WHERE tran_id = AS_TRAN_ID; END IF; RETURN LC_AMT; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MAINT_PA_SCH_DAYS (as_site char, as_mcCode char,as_maintCd char,as_mnt char,flag char,as_year char) return varchar2 is ls_day char(150); ls_comp_month char(2); ls_comp_date char(2); ls_lastdday char(2); ldt_frdt date; ldt_todt date; ls_datas char(10); begin begin --Created By Brijesh Soni 16.06.2008 select fr_date , to_date into ldt_frdt, ldt_todt from acctprd where code = as_year; dbms_output.put_line('FROM DATE -> ' || ldt_frdt || ' <[---------------------]> ' ||' FROM DATE -> ' || ldt_todt); if sqlcode = 0 then if as_mnt = 'APR' then begin declare cursor curApr is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-Apr-'|| to_char(ldt_frdt,'YYYY')) and to_date('30-Apr-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curApr; loop fetch curApr into ls_datas , ls_comp_date , ls_comp_month; exit when curApr%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curApr; dbms_output.put_line('closing curApr'); end; end; elsif as_mnt = 'MAY' then begin declare cursor curMay is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-May-'|| to_char(ldt_frdt,'YYYY')) and to_date('31-may-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curMay; loop fetch curMay into ls_datas , ls_comp_date , ls_comp_month; exit when curMay%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curMay; dbms_output.put_line('closing curMay'); end; end; elsif as_mnt = 'JUN' then begin declare cursor curJun is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-jun-'|| to_char(ldt_frdt,'YYYY')) and to_date('30-jun-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curJun; loop fetch curJun into ls_datas , ls_comp_date , ls_comp_month; exit when curJun%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curJun; dbms_output.put_line('closing curJun'); end; end; elsif as_mnt = 'JUL' then begin declare cursor curJul is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-Jul-'|| to_char(ldt_frdt,'YYYY')) and to_date('31-Jul-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curJul; loop fetch curJul into ls_datas , ls_comp_date , ls_comp_month; exit when curJul%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curJul; dbms_output.put_line('closing curJul'); end; end; elsif as_mnt = 'AUG' then begin declare cursor curAug is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-aug-'|| to_char(ldt_frdt,'YYYY')) and to_date('31-aug-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curAug; loop fetch curAug into ls_datas , ls_comp_date , ls_comp_month; exit when curAug%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curAug; dbms_output.put_line('closing curAug'); end; end; elsif as_mnt = 'SEP' then begin declare cursor curSep is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-sep-'|| to_char(ldt_frdt,'YYYY')) and to_date('30-sep-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curSep; loop fetch curSep into ls_datas , ls_comp_date , ls_comp_month; exit when curSep%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curSep; dbms_output.put_line('closing curSep'); end; end; elsif as_mnt = 'OCT' then begin declare cursor curOct is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-Oct-'|| to_char(ldt_frdt,'YYYY')) and to_date('31-OCT-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curOct; loop fetch curOct into ls_datas , ls_comp_date , ls_comp_month; exit when curOct%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curOct; dbms_output.put_line('closing curOct'); end; end; elsif as_mnt = 'NOV' then begin declare cursor curNov is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-nov-'|| to_char(ldt_frdt,'YYYY')) and to_date('30-nov-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curNov; loop fetch curNov into ls_datas , ls_comp_date , ls_comp_month; exit when curNov%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curNov; dbms_output.put_line('closing curNov'); end; end; elsif as_mnt = 'DEC' then begin declare cursor curDec is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-dec-'|| to_char(ldt_frdt,'YYYY')) and to_date('31-dec-'|| to_char(ldt_frdt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curDec; loop fetch curDec into ls_datas , ls_comp_date , ls_comp_month; exit when curDec%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curDec; dbms_output.put_line('closing curDec'); end; end; elsif as_mnt = 'JAN' then begin declare cursor curJan is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-jan-'|| to_char(ldt_todt,'YYYY')) and to_date('31-jan-'|| to_char(ldt_todt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curJan; loop fetch curJan into ls_datas , ls_comp_date , ls_comp_month; exit when curJan%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curJan; dbms_output.put_line('closing curJan'); end; end; elsif as_mnt = 'FEB' then select to_char(last_day('01-feb'||to_char(ldt_todt,'YYYY')),'dd') into ls_lastdday from dual; begin declare cursor curFeb is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-feb'||to_char(ldt_todt,'YYYY')) and to_date(ls_lastdday||'-feb-'||to_char(ldt_todt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curFeb; loop fetch curFeb into ls_datas , ls_comp_date , ls_comp_month; exit when curFeb%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curFeb; dbms_output.put_line('closing curFeb'); end; end; elsif as_mnt = 'MAR' then begin declare cursor curMar is select to_char(start_date,'DD') , to_char(comp_date,'DD') , to_char(comp_date,'mm') from maintenance_sch where mc_code = as_mcCode and maint_code = as_maintCd and site_code = as_site and sch_status not in ('X') and start_date between to_date('01-mar-'|| to_char(ldt_todt,'YYYY')) and to_date('31-mar-'|| to_char(ldt_todt,'YYYY')) and start_date between ldt_frdt and ldt_todt; begin open curMar; loop fetch curMar into ls_datas , ls_comp_date , ls_comp_month; exit when curMar%notFound; if flag = 'P' then ls_day := trim(ls_day) || trim(ls_datas) || chr(10); else if ls_comp_month <> as_mnt then ls_day := trim(ls_day) || trim(ls_comp_date) || '/' || TRIM(ls_comp_month) || chr(10); else ls_day := trim(ls_day) || trim(ls_comp_date); end if; end if; end loop; close curMar; dbms_output.put_line('closing curMar'); end; end; end if; end if; EXCEPTION WHEN NO_DATA_FOUND THEN ls_day := ' '; WHEN OTHERS THEN ls_day := ' '; end; dbms_output.put_line('Day Returning ::::: ' || trim(ls_day) || '[]'); return ls_day; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GLTRACE_DESCR (as_code char,as_flag char) return Varchar2 is ls_descr Varchar2(200); begin if as_flag='VE' then select nvl(employee.emp_fname,'')||' '||nvl(employee.emp_mname,'')||' '||nvl(employee.emp_lname,'') into ls_descr from employee where emp_code = as_code ; elsif as_flag='GA' then select analysis.sh_descr into ls_descr from analysis where analysis.anal_code =as_code; elsif as_flag='GC' then select costctr.sh_descr into ls_descr from costctr where costctr.cctr_code =as_code; elsif as_flag='AG' then select accounts.descr into ls_descr from accounts where accounts.acct_code =as_code; end if; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MONTH (as_frdate date, as_todate date,as_first number,as_last number) return varchar2 is ls_month varchar2(2000); LS_DAY varchar2(2000); LS_return varchar2(2000); cursor c1 is select substr(descr,1,3) as Mnts from period where fr_date >=as_frdate and to_date <= as_todate order by fr_date , to_date; begin OPEN C1; LOOP FETCH C1 INTO LS_DAY; EXIT WHEN C1%NOTFOUND; if C1%rowcount=1 then ls_month:= ls_day; else ls_month:=trim(ls_month)||trim(ls_day); end if; end loop; select substr(ls_month,as_first,as_last) into ls_return from dual; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_AMT (vouchno char,taxgroup char) return number is srtax number; begin srtax := 0; SELECT NVL(SUM(TAXTRAN.TAX_AMT),0) INTO srtax FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE IN ('S-INV','S-DSP','S-ORD','I-PKR') AND TAXTRAN.TRAN_ID= VOUCHNO AND TAX.TAX_GROUP IN (taxgroup) AND TAXTRAN.TAX_AMT <> 0; return srtax; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ITEM_TYPE (ls_item_code IN char) return VARCHAR2 is as_item_type VARCHAR2 (3); BEGIN select item_type into as_item_type from item_own where item_code=ls_item_code; RETURN as_item_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_COUNT_REG_PO (as_purc_order porder.purc_order%type) return number is ll_count number(4,0); begin select nvl(count(*), 0) into ll_count from porder where provi_tran_id = as_purc_order and ltrim(pord_type) <> 'P '; return ll_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_INIT_TIME_X ON PROJ_INIT_TIME (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MISCDRCR_CHECK (as_invoiceId in invoice_trace.invoice_id%type) RETURN varchar2 IS TYPE cursor1 IS REF CURSOR; TYPE cursor2 IS REF CURSOR; invtrace_cur cursor1; miscdrcr_cur cursor2; miscdrcr_sql_stmt varchar2(3000); invtrace_sql_stmt varchar2(3000); invtrace_qty number; invtrace_itemcode char(10); invtrace_lot_sl varchar2(15); invtrace_lot_no char(15); miscdrcr_qty number; miscdrcr_itemcode char(10); miscdrcr_lot_sl varchar2(15); miscdrcr_lot_no char(15); cnumber varchar2(3000); begin invtrace_sql_stmt :='select sum(quantity),item_code,lot_no,lot_sl from invoice_trace where invoice_id = '''||as_invoiceId||''' group by item_code,lot_no, lot_sl'; cnumber:=0; dbms_output.put_line('--- Begin function miscdrcr_check-------'); open invtrace_cur for invtrace_sql_stmt; LOOP FETCH invtrace_cur INTO invtrace_qty,invtrace_itemcode,invtrace_lot_no,invtrace_lot_sl; IF invtrace_cur%FOUND THEN miscdrcr_sql_stmt := 'select sum(nvl(d.quantity,0)) as Quantity,d.item_code,d.lot_sl, d.lot_no from misc_drcr_rcp h,misc_drcr_rdet d where h.tran_id=d.tran_id and h.remarks like ''%POD%'||as_invoiceId||''' and Quantity <> 0 group by d.item_code,d.lot_sl,d.lot_no'; open miscdrcr_cur for miscdrcr_sql_stmt; loop FETCH miscdrcr_cur INTO miscdrcr_qty,miscdrcr_itemcode,miscdrcr_lot_sl,miscdrcr_lot_no; --return 'miscdrcr_lot_sl : ' || miscdrcr_lot_sl || ' invtrace_lot_sl : ' || invtrace_lot_sl; IF miscdrcr_cur%FOUND THEN if (miscdrcr_qty < invtrace_qty AND invtrace_itemcode = miscdrcr_itemcode AND miscdrcr_lot_no = invtrace_lot_no AND miscdrcr_lot_sl = invtrace_lot_sl) THEN -- if ('ABCDE0123456789' = 'ABCDE0123456789') then cnumber:= '1'; return cnumber; -- end if; END IF; END IF; end loop; close miscdrcr_cur; ELSE dbms_output.put_line('--- No Records found for sql --->'+invtrace_sql_stmt); EXIT; END IF; END LOOP; close invtrace_cur; exception when others then return '-1'; return cnumber; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_IS_PO_SPECINSTR (as_purcorder in char,as_lineno in char) return char is ls_retval char(1) := ' '; ls_remarks varchar2(800); begin select nvl(a.remarks,' ') || nvl(b.specific_instr, ' ') into ls_remarks from porder a, porddet b where a.purc_order = b.purc_order and a.purc_order = as_purcorder and b.line_no = as_lineno; if (ls_remarks is not null) and length(ltrim(rtrim(ls_remarks))) > 0 then return 'Y' ; end if; return ls_retval ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_QV_STK (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char, as_qtyvalue in char, lreporttype_fr in char, lreporttype_to in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then select sum(qty) into ld_eff_qty from (Select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a, invstat b , location c where a.loc_code= c.loc_code and b.inv_stat= c.inv_stat and a.site_code= lsite_code and a.item_code= litem_code and b.report_type >= lreporttype_fr and b.report_type <= lreporttype_to and instr(lavailable,b.available) > 0 union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a, location b, invstat c , refser d where a.loc_code= b.loc_code and a.ref_ser= d.ref_ser and b.inv_stat= c.inv_stat and a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and c.report_type >= lreporttype_fr and c.report_type <= lreporttype_to and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then select sum(qty) into ld_eff_qty from (select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a, invstat b , location c where a.loc_code= c.loc_code and b.inv_stat= c.inv_stat and b.report_type >= lreporttype_fr and b.report_type <= lreporttype_to and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no= llot_no and instr(lavailable, b.available) > 0 union all select nvl( decode(as_qtyvalue,'Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a,location b, invstat c , refser d where a.loc_code = b.loc_code and a.ref_ser = d.ref_ser and b.inv_stat = c.inv_stat and a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and c.report_type >= lreporttype_fr and c.report_type <= lreporttype_to and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITDECL_MNTHS_BETN (as_emp_code employee.emp_code%type, as_join_date date, as_relieve_date date, as_acct_prd acctprd.code%type) return number is ld_date date; a_months number(10); b_months number(10); begin a_months:= 0; ld_date := as_relieve_date; if ld_date is null then select to_date into ld_date from acctprd where code = AS_ACCT_PRD; end if; select ceil(months_between(ld_date,as_join_date)) into a_months from dual; select ceil(months_between(ld_date,fr_date)) into b_months from acctprd where code = AS_ACCT_PRD; if(a_months < b_months) then a_months:= (a_months + 1); end if; return a_months; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_OPBAL (msite_code in char, macct_prd in char, mfrom_date in date, macct_code in char) return number is op_bal number ; begin select sum(dr_amt__base) - sum(cr_amt__base) into op_bal from acctbal where site_code = msite_code and acct_prd = macct_prd and acct_code = macct_code and prd_code = '000000'; select nvl(sum(dr_amt - cr_amt),0) + op_bal into op_bal from gltran where acct_code = macct_code and site_code = msite_code and tran_date <= mfrom_date and acct_prd = macct_prd; return (op_bal); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ANALYSIS_CLASS (as_site_code char, as_item_code char) return char is as_anal_class char ; begin begin select analysis_class into as_anal_class from siteitem where site_code = as_site_code and item_code = as_item_code; if trim(as_anal_class) is null then select analysis_class into as_anal_class from item where item_code = as_item_code; return as_anal_class; else return as_anal_class; end if; exception when no_data_found then select analysis_class into as_anal_class from item where item_code = as_item_code; return as_anal_class; end; return as_anal_class; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WISS_DET_TRANFLOW (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select b.exp_lev,a.descr,sum(b.QUANTITY + b.potency_adj) quantity from item a ,workorder_issdet b where a.item_code = b.item_code and b.tran_id=as_tran_id group by a.descr,b.exp_lev order by b.exp_lev ; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Exp Level '||''||''||'Item Description'||''||''||'Quantity'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_ALLOW_X ON EMP_ALLOW (EMP_CODE, AMOUNT, EFFECTIVE_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLEAVE_EMP_DATE_LVE ON EMPLEAVE (EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TASK_RES_X ON PROJ_TASK_RES (PROJ_CODE, LINE_NO, ROLE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LONG_ABSENT_STATUS (AS_EMP_CODE char,AS_FR_DATE date,AS_TO_DATE date,AS_DAYS number) return char is a_status char(1) := 'N'; a_count1 number(1); a_count number(3) := 0; a_fr_date date := (AS_FR_DATE-AS_DAYS+1); a_to_date date := AS_TO_DATE; a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; begin select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (a_date_join <= AS_TO_DATE) and (a_relieve_date >= AS_FR_DATE or a_relieve_date is null) then null; else return a_status; end if; if (a_fr_date < a_date_join) then a_fr_date := a_date_join; end if; if (a_to_date > a_relieve_date) then a_to_date := a_relieve_date; end if; for i in 1..(a_to_date-a_fr_date+1) loop if (ddf_hr_preproc_attd_status(AS_EMP_CODE,(a_fr_date+i-1)) = 'A') then select count(*) into a_count1 from attendance_day where attd_date = (a_fr_date+i-1) and emp_code = AS_EMP_CODE; if (a_count1 <> 0) then a_count := 0; else a_count := a_count + 1; end if; else a_count := 0; end if; if (a_count = AS_DAYS) then a_status := 'Y'; exit; end if; end loop; return a_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_REMARKS (AS_REFID VARCHAR2, AS_BALGROUP CHAR,as_drcr_flag char ) RETURN VARCHAR2 IS AS_DETAILS VARCHAR2(200) ; BEGIN IF AS_DRCR_FLAG='D' THEN SELECT DETAILS INTO AS_DETAILS FROM TAX_OTH_CREDITS, TAX_PROCESSED WHERE TAX_PROCESSED.REF_ID = TAX_OTH_CREDITS.ref_id AND TAX_PROCESSED.REF_SER = 'DIRCT' and TAX_OTH_CREDITS.ref_ID = AS_REFID and TAX_OTH_CREDITS.BAL_GROUP = AS_BALGROUP AND ROWNUM=1; ELSIF as_DRCR_FLAG='C' THEN SELECT DETAILS INTO AS_DETAILS FROM TAX_OTH_CREDITS, TAX_PROCESSED WHERE TAX_PROCESSED.REF_ID = TAX_OTH_CREDITS.REF_ID AND TAX_PROCESSED.REF_SER = 'DIRCT' and TAX_OTH_CREDITS.REF_ID = AS_REFID and TAX_OTH_CREDITS.BAL_GROUP = AS_BALGROUP AND ROWNUM=1; END IF ; RETURN AS_DETAILS ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TOKEN_MRP (as_string char, as_sep char) return varchar2 is ls_string nvarchar2(4000) := as_string; ls_retstr Nvarchar2(4000); li_pos number; begin li_pos := instr(ls_string,as_sep); if li_pos = 0 then ls_retstr := ls_string; ls_string := ''; else ls_retstr := substr(ls_string,1,li_pos -1); ls_string := substr(ls_string, length(ls_string) - (li_pos + length(as_sep) - 1)); end if; return ls_retstr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_QCORDER (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX','BSRX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE PROC_UPD_RATE_INSU (assitecode char,astrandtfr date,astrandtto date, aspricelist char) is begin --start main declare cursor currepot is select tran_date, item_code,lot_no,site_code,tran_id from invtrace where site_code = assitecode and tran_date >= astrandtfr and tran_date <= astrandtto ; toddt invtrace.tran_date%type; itemcode invtrace.item_code%type; lotno invtrace.lot_no%type; sitecode invtrace.site_code%type; prate invtrace.rate_insu%type; tranid invtrace.tran_id%type; begin --Cursour Begin open currepot; loop fetch currepot into toddt,itemcode,lotno,sitecode,tranid; dbms_output.put_line('toddt is.... ' || toddt); dbms_output.put_line('lotno is.... ' || lotno); dbms_output.put_line('itemcode is.... ' || itemcode); dbms_output.put_line('sitecode is.... ' || sitecode); exit when currepot%notfound; --checking data begin select nvl(rate,0) into prate from pricelist where toddt between pricelist.eff_from and pricelist.valid_upto and lotno between pricelist.lot_no__from and pricelist.lot_no__to and pricelist.item_code = itemcode and pricelist.price_list = aspricelist and pricelist.rate > 0; dbms_output.put_line('Rate is.... ' || prate); if sqlcode = 100 then prate := -999999; end if; dbms_output.put_line('Rate from ddf_get_prclst_rate ('''||toddt||''','''||trim(lotno)||''','''||trim(itemcode)||''','''||trim(sitecode)||''''||') is.... ' || prate); update invtrace set rate_insu = prate where tran_id = tranid; end; end loop; --end loop close currepot; -- close commit; dbms_output.put_line('commited.'); exception when others then dbms_output.put_line('rollbacked. Due to Error Code ::::: '||sqlcode||' Error Message ::::: ' ||sqlerrm); rollback; end; end; --eof main -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_DESP_COSTRATE BEFORE insert or update ON despatchdet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; lc_invrate stock.rate%type := 0; ls_sitecode char(5); BEGIN begin select site_code into ls_sitecode from sorddet where sale_order = :new.sord_no and line_no = :new.line_no__sord; exception when others then ls_sitecode := ' '; end; if length(trim(ls_sitecode)) > 0 then begin select ROUND(rate, 4) into lc_invrate from stock where item_code = :new.item_code and site_code = ls_sitecode and loc_code = :new.loc_code and lot_no = :new.lot_no and lot_sl = :new.lot_sl; exception when others then lc_invrate := 0; end; if nvl(:new.cost_rate,0) <> nvl(lc_invrate,0) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] cost_rate [' || to_char(:new.cost_rate) || '] not matching with stock rate [' || to_char(lc_invrate) || ']' ); end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_RECISS_QTY ( as_sitecode in site.site_code%type, as_itemcode in item.item_code%type, adt_fromdate in date, adt_todate in date, as_type in char, as_available in char ) return number is lc_recissqty number(14,3); begin if as_type = 'I' then select sum(a.quantity) into lc_recissqty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and instr(as_available,c.available) > 0 and a.eff_qty < 0 and a.site_code = as_sitecode and a.item_code = as_itemcode and a.tran_date between adt_fromdate and adt_todate ; elsif as_type = 'R' then select sum(a.quantity) into lc_recissqty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and instr(as_available,c.available) > 0 and a.eff_qty > 0 and a.site_code = as_sitecode and a.item_code = as_itemcode and a.tran_date between adt_fromdate and adt_todate ; end if; return lc_recissqty ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX COSTINGMETHOD_DET_X ON COSTINGMETHOD_DET (COST_METHOD) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_STOCK_TRAN_DATE ON CUST_STOCK (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LEAVES (AS_STRING IN VARCHAR2, AS_SEP IN VARCHAR2, AS_POS IN INT ) RETURN VARCHAR2 IS TYPE TYPE_STR IS TABLE OF VARCHAR2(200) INDEX BY BINARY_INTEGER; LI_STR_TBL TYPE_STR; LI_IDX BINARY_INTEGER := 1; LI_POS_NO INT; LI_STR VARCHAR2(1000); LI_WORD VARCHAR2(100); BEGIN LI_STR := LTRIM(RTRIM(AS_STRING, AS_SEP),AS_SEP)||AS_SEP; LI_POS_NO := INSTR(LI_STR, AS_SEP); WHILE(LI_POS_NO > 0) LOOP LI_WORD := SUBSTR(LI_STR, 1, (LI_POS_NO - 1)); LI_STR_TBL(LI_IDX):= LI_WORD; LI_STR := SUBSTR(LI_STR, (LI_POS_NO + 1)); LI_POS_NO := INSTR(LI_STR, AS_SEP); LI_IDX := LI_IDX + 1; END LOOP; IF LI_STR_TBL.COUNT < AS_POS THEN RETURN 'Invalid No entered.'; ELSE RETURN LI_STR_TBL(AS_POS); END IF; EXCEPTION WHEN OTHERS THEN RETURN 'Err '||SQLERRM; END DDF_GET_LEAVES; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SOCUSTDUE ON SORDER (CUST_CODE, DUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_D1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ALLRIGHTS ( as_Obj_Name IN varchar2,IN_string IN varchar2,as_form_no in varchar2 ) RETURN varchar2 is ll_count number(10):= 0; v_length number(10); v_out varchar2(20):= ''; ls_ret_val varchar2(500):= ''; Begin v_length := length(IN_string); for i in 1..v_length Loop v_out := substr(IN_string,i,1) ; ls_ret_val := ls_ret_val || v_out ||':'; IF IN_string != '*' then ls_ret_val := ls_ret_val || FN_GET_RIGHTCHAR_TITLE(as_Obj_Name,v_out,as_form_no); else ls_ret_val := ls_ret_val || FN_GET_RIGHTCHAR_STAR_TITLE(as_Obj_Name,v_out,as_form_no); end if; End loop; Return ls_ret_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_TAGGED_ADDRESS (as_sc_code char,as_sprs_code char) return varchar is geoPosAddr varchar2(250); begin SELECT GEO_POS_ADDR INTO geoPosAddr FROM PLACE_TIME_ENT WHERE ENTITY_CODE = as_sc_code and chg_date = (SELECT max(chg_date) FROM PLACE_TIME_ENT WHERE ENTITY_CODE = as_sc_code ) and TRIM(user_id)=TRIM(as_sprs_code) AND ROWNUM=1; if(geoPosAddr is null or length(trim(geoPosAddr)) = 0 ) then SELECT ADDR1 INTO geoPosAddr FROM STRG_CUSTOMER WHERE SC_CODE = as_sc_code; end if; return geoPosAddr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_TAGGED_LOCATION (as_sc_code char,as_sprs_code char) return varchar is geoPos varchar2(45); begin SELECT GEO_POS INTO geoPos FROM PLACE_TIME_ENT WHERE ENTITY_CODE = as_sc_code and chg_date = (SELECT max(chg_date) FROM PLACE_TIME_ENT WHERE ENTITY_CODE = as_sc_code ) and TRIM(user_id)=TRIM(as_sprs_code) AND ROWNUM=1; if(geoPos is null or length(trim(geoPos)) = 0 ) then SELECT GEO_POS INTO geoPos FROM STRG_CUSTOMER WHERE SC_CODE = as_sc_code; end if; return geoPos; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_BR before insert or update on receipt referencing old as old new as new FOR EACH ROW declare refno receipt.ref_NO%type; refno1 receipt.ref_NO%type; begin refno := trim(:new.ref_no); select Replace(translate(refno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into refno1 from dual; if (refno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in ref number [' || refno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE LOCALITYDARCODEPOPHELP AS FUNCTION getlocalityDARPophelpData (empCode in char) RETURN localityDARCodeMasterTABLE PIPELINED; END localityDARCodePophelp; CREATE OR REPLACE PACKAGE BODY LOCALITYDARCODEPOPHELP AS FUNCTION getlocalityDARPophelpData (empCode in char) RETURN localityDARCodeMasterTABLE PIPELINED IS ls_cnt number(35); ls_trans_db varchar2(30); BEGIN select trans_db into ls_trans_db from users where emp_code=empCode; if (ls_trans_db = 'payroll') THEN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; ELSE SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; END IF; if(ls_cnt > 0) then if (ls_trans_db = 'payroll') THEN for x in( SELECT DISTINCT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS DESCR, L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, SR.ROUTE_ID AS ROUTE_ID,TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR WHERE SR.SPRS_CODE in (SELECT EMP_CODE FROM ORG_STRUCTURE START WITH EMP_CODE = empCode CONNECT BY PRIOR POS_CODE = POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND ACTIVE = 'Y' AND SYSDATE BETWEEN EFF_DATE AND VALID_UPTO) AND SR.STATUS ='Y' ) LOOP PIPE ROW (localityDARCodeMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ROUTE_ID)); END LOOP; RETURN; ELSE for x in( SELECT DISTINCT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS DESCR, L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, SR.ROUTE_ID AS ROUTE_ID,TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR WHERE SR.SPRS_CODE in (SELECT EMP_CODE FROM ORG_STRUCTURE START WITH EMP_CODE = empCode CONNECT BY PRIOR POS_CODE = POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND ACTIVE = 'Y' AND SYSDATE BETWEEN EFF_DATE AND VALID_UPTO) AND SR.STATUS ='Y' ) LOOP PIPE ROW (localityDARCodeMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ROUTE_ID)); END LOOP; RETURN; END IF; end if; if(ls_cnt <= 0) then if (ls_trans_db = 'payroll') THEN for x in( SELECT DISTINCT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, SR.ROUTE_ID AS ROUTE_ID,TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR WHERE SR.SPRS_CODE in (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND SR.STATUS ='Y' ) LOOP PIPE ROW (localityDARCodeMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ROUTE_ID)); END LOOP; RETURN; ELSE for x in( SELECT DISTINCT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, SR.ROUTE_ID AS ROUTE_ID,TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR WHERE SR.SPRS_CODE in (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND SR.STATUS ='Y' ) LOOP PIPE ROW (localityDARCodeMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.VISITED_WITH_TEAM,x.ROUTE_ID)); END LOOP; RETURN; END IF; end if; END; END localityDARCodePophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_FUNDTRANSFER_REFNO before insert on fundtransfer referencing old as old new as new for each row Declare ls_rcpid char(10); ls_refno receipt.ref_no%type; Begin If :new.ref_no is not null and length(trim(:new.ref_no)) > 0 and instr(:new.remarks,'-DS#') > 0 then ls_rcpid := substr(:new.remarks,10,10) ; begin select ref_no into ls_refno from receipt where tran_id = ls_rcpid ; exception when others then ls_refno := null; end; :new.ref_no := ls_refno; end if; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX QC_PORCP_LINE_NO_STATUS ON QC_ORDER (PORCP_NO, PORCP_LINE_NO, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CUST_STOCK_INV_X ON CUST_STOCK_INV (TRAN_ID, INVOICE_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DWH_SALES_NEW ( AS_FR_DATE DATE, AS_TO_DATE DATE) AS BEGIN IF (AS_TO_DATE >= AS_FR_DATE) THEN /*========== INSERT for DWH_SALES_SUM Started ==========*/ INSERT INTO dwh_sales_sum ( tran_id, site_code, cust_code, cust_code__bil, item_code, lot_no, line_type, doc_date, pos_code, sales_qty, gross_sales_value, sales_value, free_qty, free_sales_value, net_sales_qty, net_sales_value, repl_qty, repl_value, saleable_return_qty, saleable_return_amt, breakage_return_qty, breakage_return_amt, expiry_return_qty, expiry_return_amt, correction_return_qty, correction_return_amt, repl_return_qty, repl_return_value, return_qty, gross_return_value, return_value, net_return_value, cgst_rate, cgst_amt, sgst_rate, sgst_amt, igst_rate, igst_amt, disc_amt, mrp, ptr, pts, hsn_code, pack, due_date, ref_ser, city, item_brand, item_ser, line_no, load_date, order_ref, shipment_ref, avg_rate, tax_disc_1, tax_disc_1_amt, tax_disc_2, tax_disc_2_amt, tax_disc_3, tax_disc_3_amt, prd_code, prd_qtr ) SELECT dssv.tran_id, dssv.site_code AS site_code, dssv.cust_code AS cust_code, dssv.cust_code_bill AS cust_code__bil, dssv.item_code AS item_code, dssv.lot_no AS lot_no, dssv.line_type AS line_type, dssv.tran_date AS doc_date, dssv.pos_code AS pos_code, SUM(dssv.sales_qty) AS sales_qty, SUM(dssv.gross_sales_value - dssv.disc_amt_inv) AS gross_sales_value, SUM(dssv.gross_sales_value) AS sales_value, SUM(dssv.free_qty) AS free_qty, SUM(dssv.free_sales_value) AS free_sales_value, SUM(dssv.sales_qty + dssv.free_qty + dssv.repl_qty - dssv.return_qty + dssv.repl_return_qty) AS net_sales_qty, SUM((dssv.gross_sales_value - dssv.disc_amt_inv) -(dssv.gross_return_value - dssv.disc_amt_ret) +(dssv.repl_return_value - dssv.disc_amt_repl_ret)) AS net_sales_value, SUM(dssv.repl_qty) AS repl_qty, SUM(dssv.repl_value - dssv.disc_amt_repl) AS repl_value, SUM(dssv.saleable_return_qty) AS saleable_return_qty, SUM(dssv.saleable_return_amt) AS saleable_return_amt, SUM(dssv.breakage_return_qty) AS breakage_return_qty, SUM(dssv.breakage_return_amt) AS breakage_return_amt, SUM(dssv.expiry_return_qty) AS expiry_return_qty, SUM(dssv.expiry_return_amt) AS expiry_return_amt, SUM(dssv.correction_return_qty) AS correction_return_qty, SUM(dssv.correction_return_amt) AS correction_return_amt, SUM(dssv.repl_return_qty) AS repl_return_qty, SUM(dssv.repl_return_value - dssv.disc_amt_repl_ret) AS repl_return_value, SUM(dssv.return_qty) AS return_qty, SUM(dssv.gross_return_value - dssv.disc_amt_ret) AS gross_return_value, SUM(dssv.gross_return_value) AS return_value, SUM(dssv.net_return_value) AS net_return_value, dssv.cgst_rate, SUM(dssv.cgst_amt) AS cgst_amt, dssv.sgst_rate, SUM(dssv.sgst_amt) AS sgst_amt, dssv.igst_rate, SUM(dssv.igst_amt) AS igst_amt, SUM(dssv.disc_amt_inv + dssv.disc_amt_ret + dssv.disc_amt_repl + dssv.disc_amt_repl_ret) AS disc_amt, dssv.mrp, dssv.ptr, dssv.pts, dssv.hsn_code, ( SELECT descr FROM packing WHERE pack_code = dssv.pack_code ) AS pack, dssv.due_date, dssv.ref_ser, nvl(dssv.city, 'NOTSPECIFIED') AS city, dssv.item_brand, dssv.item_ser, dssv.line_no, sysdate AS load_date, dssv.order_ref, dssv.shipment_ref, dssv.avg_rate, dssv.tax_disc_1, dssv.tax_disc_1_amt, dssv.tax_disc_2, dssv.tax_disc_2_amt, dssv.tax_disc_3, dssv.tax_disc_3_amt, ( SELECT code FROM period WHERE dssv.tran_date BETWEEN fr_date AND to_date ) AS prd_code, ( SELECT prd_qtr FROM period WHERE dssv.tran_date BETWEEN fr_date AND to_date ) AS prd_qtr FROM ( SELECT 'S-INV ' AS ref_ser, item.item_ser, invoice_trace.line_no, invoice.invoice_id AS tran_id, invoice.site_code, invoice.cust_code, invoice.cust_code__bil AS cust_code_bill, invoice_trace.item_code, nvl(invoice_trace.lot_no, 'NA') AS lot_no, nvl(invoice_trace.line_type, 'NA') AS line_type, invoice.tran_date, nvl(( SELECT org.pos_code FROM org_structure_cust org WHERE org.cust_code = invoice.cust_code__bil AND org.version_id IN( SELECT v.version_id FROM version v WHERE to_date(sysdate) BETWEEN v.eff_from AND v.valid_upto ) AND org.table_no = item.item_ser ), 'NA') AS pos_code, invoice.inv_type AS tran_type, item.hsn_no AS hsn_code, item.pack_code AS pack_code, nvl(dc.city, 'NOTSPECIFIED') AS city, item.phy_attrib_2 AS item_brand, to_char(nvl(invoice.due_date, invoice.tran_date)) AS due_date, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') IN ( 'F', 'V' ) AND invoice_trace.rate__stduom = 0 THEN 0 ELSE invoice_trace.quantity__stduom END ) AS sales_qty, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') = 'F' AND invoice_trace.rate__stduom = 0 THEN 0 ELSE invoice_trace.quantity__stduom * invoice_trace.rate__stduom END ) AS gross_sales_value, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') IN ( 'I', 'V' ) THEN invoice_trace.quantity__stduom ELSE 0 END ) AS repl_qty, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') = 'F' AND invoice_trace.rate__stduom = 0 THEN invoice_trace.quantity__stduom ELSE 0 END ) AS free_qty, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') = 'F' AND invoice_trace.rate__stduom = 0 THEN invoice_trace.quantity__stduom * nvl(fn_rpick_rate_pl(dc.price_list, invoice.tran_date, invoice_trace .item_code, invoice_trace.lot_no), 0) ELSE 0 END ) AS free_sales_value, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') IN ( 'I', 'V' ) AND invoice_trace.rate__stduom = 0 THEN invoice_trace.quantity__stduom * nvl(fn_rpick_rate_pl(dc.price_list, invoice.tran_date, invoice_trace .item_code, invoice_trace.lot_no), 0) ELSE 0 END ) AS repl_value, invoice_trace.net_amt AS net_sales_value, 0 AS saleable_return_qty, 0 AS saleable_return_amt, 0 AS breakage_return_qty, 0 AS breakage_return_amt, 0 AS expiry_return_qty, 0 AS expiry_return_amt, 0 AS correction_return_qty, 0 AS correction_return_amt, 0 AS repl_return_qty, 0 AS repl_return_value, 0 AS return_qty, 0 AS gross_return_value, 0 AS net_return_value, 0 AS free_return_qty, 0 AS free_ret_value, nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace.line_no AS CHAR(3)), 'CGST_TAX', ' ' , ' ', 'P'), 0) AS cgst_rate, nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace.line_no AS CHAR(3)), 'CGST_TAX', ' ' , ' ', 'T'), 0) AS cgst_amt, nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace.line_no AS CHAR(3)), 'SGST_TAX', ' ' , ' ', 'P'), 0) AS sgst_rate, nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace.line_no AS CHAR(3)), 'SGST_TAX', ' ' , ' ', 'T'), 0) AS sgst_amt, nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace.line_no AS CHAR(3)), 'IGST_TAX', ' ' , ' ', 'P'), 0) AS igst_rate, nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace.line_no AS CHAR(3)), 'IGST_TAX', ' ' , ' ', 'T'), 0) AS igst_amt, ( ( nvl((((nvl(invoice_trace.quantity, 0) * nvl(invoice_trace.rate__stduom, 0) * nvl(invoice.exch_rate, 0)) * nvl(invoice_trace.discount, 0)) / 100), 0) + nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id, CAST(invoice_trace .line_no AS CHAR(3)), 'DISC_GST', ' ', ' ', 'T') *(- 1), 0) ) ) AS disc_amt_inv, 0 AS disc_amt_ret, ( CASE WHEN coalesce(invoice_trace.line_type, 'C') IN ( 'I', 'V' ) AND invoice_trace.rate__stduom = 0 THEN ( ( nvl((((nvl(invoice_trace.quantity, 0) * nvl(invoice_trace.rate__stduom, 0) * nvl(invoice.exch_rate , 0)) * nvl(invoice_trace.discount, 0)) / 100), 0) + nvl(fn_rget_tax_new('S-INV', invoice_trace.invoice_id , CAST(invoice_trace.line_no AS CHAR(3)), 'DISC_GST', ' ', ' ', 'T') *(- 1), 0) ) ) ELSE 0 END ) AS disc_amt_repl, 0 AS disc_amt_repl_ret, nvl(fn_rpick_mrp_ptr(invoice_trace.item_code, invoice.tran_date, invoice_trace.lot_no, 'MRP_GST'), 0) AS mrp, nvl(fn_rpick_mrp_ptr(invoice_trace.item_code, invoice.tran_date, invoice_trace.lot_no, 'PTR_GST'), 0) AS ptr, nvl(fn_rpick_mrp_ptr(invoice_trace.item_code, invoice.tran_date, invoice_trace.lot_no, 'PTS_GST'), 0) AS pts, invoice.sale_order AS order_ref, invoice.desp_id AS shipment_ref, ( SELECT ( SUM(it.quantity * it.rate) / SUM(it.quantity) ) AS avg_rate FROM invoice_trace it WHERE invoice_id = invoice_trace.invoice_id AND item_code = invoice_trace.item_code AND lot_no = invoice_trace.lot_no ) AS avg_rate, nvl(fn_rget_disc_tax_new('S-INV', invoice_trace.invoice_id, invoice_trace.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'DAMAGE_DISC_TAX'), 'P'), 0) AS tax_disc_1, nvl(fn_rget_disc_tax_new('S-INV', invoice_trace.invoice_id, invoice_trace.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'DAMAGE_DISC_TAX'), 'A'), 0) AS tax_disc_1_amt, nvl(fn_rget_disc_tax_new('S-INV', invoice_trace.invoice_id, invoice_trace.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'CASH_DISC_TAX'), 'P'), 0) AS tax_disc_2, nvl(fn_rget_disc_tax_new('S-INV', invoice_trace.invoice_id, invoice_trace.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'CASH_DISC_TAX'), 'A'), 0) AS tax_disc_2_amt, nvl(fn_rget_disc_tax_new('S-INV', invoice_trace.invoice_id, invoice_trace.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'TRANS_DISC_TAX'), 'P'), 0) AS tax_disc_3, nvl(fn_rget_disc_tax_new('S-INV', invoice_trace.invoice_id, invoice_trace.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'TRANS_DISC_TAX'), 'A'), 0) AS tax_disc_3_amt FROM invoice INNER JOIN invoice_trace ON invoice.invoice_id = invoice_trace.invoice_id INNER JOIN site ON invoice.site_code = site.site_code INNER JOIN item ON invoice_trace.item_code = item.item_code LEFT OUTER JOIN customer dc ON invoice.cust_code = dc.cust_code WHERE INVOICE.CONFIRMED = 'Y' AND INVOICE.TRAN_DATE >= AS_FR_DATE AND INVOICE.TRAN_DATE <= AS_TO_DATE UNION ALL SELECT 'S-RET' AS ref_ser, item.item_ser, sreturndet.line_no, sreturn.tran_id, sreturn.site_code, sreturn.cust_code, sreturn.cust_code__bill AS cust_code_bill, sreturndet.item_code, nvl(sreturndet.lot_no, 'NA') AS lot_no, nvl(sreturndet.line_type, 'NA') AS line_type, sreturn.tran_date, nvl(( SELECT org.pos_code FROM org_structure_cust org WHERE org.cust_code = sreturn.cust_code__bill AND org.version_id IN( SELECT v.version_id FROM version v WHERE to_date(sysdate) BETWEEN v.eff_from AND v.valid_upto ) AND org.table_no = item.item_ser ), 'NA') AS pos_code, sreturn.tran_type, item.hsn_no AS hsn_code, item.pack_code AS pack_code, item.phy_attrib_2 AS item_brand, nvl(dc.city, 'NOTSPECIFIED') AS city, to_char(sreturn.tran_date) AS due_date, 0 AS sales_qty, 0 AS gross_sales_value, 0 AS repl_qty, 0 AS free_qty, 0 AS free_sales_value, 0 AS repl_value, 0 AS net_sales_value, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type IN ( 'SR' ) THEN sreturndet.quantity__stduom ELSE 0 END ) AS saleable_return_qty, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type IN ( 'SR' ) THEN sreturndet.quantity__stduom * sreturndet.rate__stduom ELSE 0 END ) AS saleable_return_amt, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type IN ( 'BR', 'DR' ) THEN sreturndet.quantity__stduom ELSE 0 END ) AS breakage_return_qty, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type IN ( 'BR', 'DR' ) THEN sreturndet.quantity__stduom * sreturndet.rate__stduom ELSE 0 END ) AS breakage_return_amt, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type = 'ER' AND sreturndet.discount <> 100 THEN sreturndet.quantity__stduom ELSE 0 END ) AS expiry_return_qty, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type = 'ER' AND sreturndet.discount <> 100 THEN sreturndet.quantity__stduom * sreturndet.rate__stduom ELSE 0 END ) AS expiry_return_amt, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type IN ( 'IC' ) THEN sreturndet.quantity__stduom ELSE 0 END ) AS correction_return_qty, ( CASE WHEN sreturndet.ret_rep_flag = 'R' AND sreturn.tran_type IN ( 'IC' ) THEN sreturndet.quantity__stduom * sreturndet.rate__stduom ELSE 0 END ) AS correction_return_amt, decode(sreturndet.ret_rep_flag, 'P', sreturndet.quantity__stduom, 0) AS repl_return_qty, decode(sreturndet.ret_rep_flag, 'P', sreturndet.quantity__stduom * sreturndet.rate__stduom, 0) AS repl_return_value , ( CASE WHEN sreturndet.ret_rep_flag = 'R' THEN sreturndet.quantity__stduom ELSE 0 END ) AS return_qty, ( CASE WHEN sreturndet.ret_rep_flag = 'R' THEN sreturndet.quantity__stduom * sreturndet.rate__stduom ELSE 0 END ) AS gross_return_value, sreturndet.net_amt AS net_return_value, ( CASE WHEN sreturndet.ret_rep_flag = 'R' THEN decode(invoice_trace.invoice_id, NULL, 0,( CASE WHEN coalesce(invoice_trace.line_type, 'C') = 'F' AND invoice_trace.rate__stduom = 0 THEN sreturndet.quantity__stduom ELSE 0 END )) ELSE 0 END ) AS free_return_qty, ( CASE WHEN sreturndet.ret_rep_flag = 'R' THEN decode(invoice_trace.invoice_id, NULL, 0,( CASE WHEN coalesce(invoice_trace.line_type, 'C') = 'F' AND invoice_trace.rate__stduom = 0 THEN sreturndet.quantity__stduom * invoice_trace.rate__stduom ELSE 0 END )) ELSE 0 END ) AS free_ret_value, nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'CGST_TAX', ' ', ' ', 'P'), 0) AS cgst_rate, nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'CGST_TAX', ' ', ' ', 'T'), 0) AS cgst_amt, nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'SGST_TAX', ' ', ' ', 'P'), 0) AS sgst_rate, nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'SGST_TAX', ' ', ' ', 'T'), 0) AS sgst_amt, nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'IGST_TAX', ' ', ' ', 'P'), 0) AS igst_rate, nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'IGST_TAX', ' ', ' ', 'T'), 0) AS igst_amt, 0 AS disc_amt_inv, ( ( nvl((((nvl(sreturndet.quantity__stduom, 0) * nvl(sreturndet.rate__stduom, 0) * nvl(sreturn.exch_rate, 0)) * nvl(sreturndet.discount, 0)) / 100), 0) + nvl(fn_rget_tax_new('S-RET', sreturn.tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'DISC_GST', ' ', ' ', 'T') *(- 1), 0) ) ) AS disc_amt_ret, 0 AS disc_amt_repl, decode(sreturndet.ret_rep_flag, 'P',((nvl((((nvl(sreturndet.quantity__stduom, 0) * nvl(sreturndet.rate__stduom , 0) * nvl(sreturn.exch_rate, 0)) * nvl(sreturndet.discount, 0)) / 100), 0) + nvl(fn_rget_tax_new('S-RET', sreturn .tran_id, CAST(sreturndet.line_no AS CHAR(3)), 'DISC_GST', ' ', ' ', 'T') *(- 1), 0))), 0) AS disc_amt_repl_ret, nvl(fn_rpick_mrp_ptr(sreturndet.item_code, sreturn.tran_date, sreturndet.lot_no, 'MRP_GST'), 0) AS mrp, nvl(fn_rpick_mrp_ptr(sreturndet.item_code, sreturn.tran_date, sreturndet.lot_no, 'PTR_GST'), 0) AS ptr, nvl(fn_rpick_mrp_ptr(sreturndet.item_code, sreturn.tran_date, sreturndet.lot_no, 'PTS_GST'), 0) AS pts, (case when nvl(sreturndet.invoice_id, sreturndet.invoice_ref) is null then '' else (select sale_order from invoice where invoice_id = nvl(sreturndet.invoice_id, sreturndet.invoice_ref)) end) AS order_ref, nvl(sreturndet.invoice_id, sreturndet.invoice_ref) AS shipment_ref, sreturndet.rate AS avg_rate, nvl(fn_rget_disc_tax_new('S-RET', sreturn.tran_id, sreturndet.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'DAMAGE_DISC_TAX' ), 'P'), 0) AS tax_disc_1, nvl(fn_rget_disc_tax_new('S-RET', sreturn.tran_id, sreturndet.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'DAMAGE_DISC_TAX'), 'A'), 0) AS tax_disc_1_amt, nvl(fn_rget_disc_tax_new('S-RET', sreturn.tran_id, sreturndet.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'CASH_DISC_TAX'), 'P'), 0) AS tax_disc_2, nvl(fn_rget_disc_tax_new('S-RET', sreturn.tran_id, sreturndet.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'CASH_DISC_TAX'), 'A'), 0) AS tax_disc_2_amt, nvl(fn_rget_disc_tax_new('S-RET', sreturn.tran_id, sreturndet.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'TRANS_DISC_TAX'), 'P'), 0) AS tax_disc_3, nvl(fn_rget_disc_tax_new('S-RET', sreturn.tran_id, sreturndet.line_no,(select trim(var_value) from disparm where prd_code = '999999' and var_name = 'TRANS_DISC_TAX'), 'A'), 0) AS tax_disc_3_amt FROM sreturn INNER JOIN sreturndet ON sreturn.tran_id = sreturndet.tran_id INNER JOIN site ON sreturn.site_code = site.site_code INNER JOIN item ON sreturndet.item_code = item.item_code LEFT OUTER JOIN customer dc ON sreturn.cust_code = dc.cust_code LEFT OUTER JOIN invoice_trace ON sreturn.invoice_id = invoice_trace.invoice_id AND sreturndet.invoice_id = invoice_trace.invoice_id AND sreturndet.line_no__invtrace = invoice_trace.line_no WHERE SRETURN.CONFIRMED = 'Y' AND SRETURN.TRAN_DATE >= AS_FR_DATE AND SRETURN.TRAN_DATE <= AS_TO_DATE ) DSSV GROUP BY dssv.tran_id, dssv.site_code, dssv.cust_code, dssv.cust_code_bill, dssv.item_code, dssv.lot_no, dssv.line_type, dssv.tran_date, dssv.pos_code, dssv.mrp, dssv.ptr, dssv.pts, dssv.hsn_code, dssv.pack_code, dssv.due_date, dssv.item_brand, nvl(dssv.city, 'NOTSPECIFIED'), dssv.cgst_rate, dssv.sgst_rate, dssv.igst_rate, dssv.ref_ser, dssv.item_ser, dssv.line_no, dssv.order_ref, dssv.shipment_ref, dssv.avg_rate, dssv.tax_disc_1, dssv.tax_disc_1_amt, dssv.tax_disc_2, dssv.tax_disc_2_amt, dssv.tax_disc_3, dssv.tax_disc_3_amt; /*========== INSERT for DWH_SALES_SUM Ended ==========*/ COMMIT ; /* ==================== DWH_SALES_SUM Data Insertion END ==================== */ /* ==================== DWH_SALES_SUM Data Updation START ==================== */ UPDATE DWH_SALES_SUM t1 SET (t1.TARGET_QTY, t1.TARGET_VALUE) = ( SELECT t2.TARGET_QTY, t2.TARGET_VALUE FROM ( select SITE_CODE, CUST_CODE, POS_CODE, ITEM_CODE, ITEM_SER, SUM(H_NET_AMT) as TARGET_VALUE, SUM(QUANTITY) as TARGET_QTY from ( select SBC.TRAN_ID, SBCD.LINE_NO, SBC.SITE_CODE, SBC.CUST_CODE, SBC.POS_CODE, SBCD.ITEM_CODE, SBC.ITEM_SER, SBC.NET_AMT as H_NET_AMT, SBCD.RATE, SBCD.QUANTITY, SBCD.NET_AMT as D_NET_AMT from SALES_BUDGET_CUST SBC LEFT JOIN SALES_BUDGET_CUST_DET SBCD ON SBC.TRAN_ID = SBCD.TRAN_ID ) where SITE_CODE is not null And CUST_CODE is not null And POS_CODE is not null And ITEM_CODE is not null And ITEM_SER is not null group by SITE_CODE, CUST_CODE, POS_CODE, ITEM_CODE, ITEM_SER ) t2 WHERE t1.SITE_CODE = t2.SITE_CODE and t1.CUST_CODE = t2.CUST_CODE and t1.POS_CODE = t2.POS_CODE and t1.ITEM_CODE = t2.ITEM_CODE and t1.ITEM_SER = t2.ITEM_SER ); COMMIT ; /* ==================== DWH_SALES_SUM Data Updation END ==================== */ END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(' Error occured '); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALCBACKTAX (ls_invoice_id in char, ls_line_no in char) return number is ld_tax_amt number(14,3); begin SELECT SUM(taxtran.tax_amt) into ld_tax_amt FROM tax, taxtran WHERE ( tax.tax_code = taxtran.tax_code ) AND ( ( taxtran.tran_code = 'S-INV' ) AND ( taxtran.tran_id = ls_invoice_id ) AND ( TRIM(taxtran.line_no) = TRIM(ls_line_no ) )AND ( taxtran.tax_amt <> 0 ) AND ( tax.print_tax = 'Y' ) ) ; return ld_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_HOLIDAY_TYPE (AS_EMP_CODE CHAR, AS_EMP_HOL_DATE DATE) return char is lc_holiday_type char(1); begin select distinct HOL_TYPE into lc_holiday_type from holiday where hol_tblno = ddf_get_holtblno(AS_EMP_CODE,AS_EMP_HOL_DATE) and hol_date = AS_EMP_HOL_DATE; return lc_holiday_type; exception when no_data_found then begin SELECT distinct H.HOL_TYPE into lc_holiday_type FROM CHANGE_HOLIDAY B, HOLIDAY H WHERE H.HOL_TYPE = B.HOL_TYPE And H.HOL_TBLNO = B.HOL_TBLNO and B.HOL_DATE_FOR = H.HOL_DATE AND B.HOL_TBLNO=ddf_get_holtblno(AS_EMP_CODE,AS_EMP_HOL_DATE) AND B.HOL_DATE_TO=AS_EMP_HOL_DATE AND B.EMP_CODE=AS_EMP_CODE AND ROWNUM=1; return lc_holiday_type; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ZONE3 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_zone_descr varchar2(25); begin SELECT DESCR into as_zone_descr FROM ( SELECT GENCODES.DESCR FROM GENCODES, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE GENCODES.FLD_VALUE=TRIM(SITE.GEO_LOC) AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND GENCODES.FLD_NAME='GEO_LOC' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_3.POOL_CODE) = TRIM(as_pool_code) UNION select GENCODES.DESCR FROM GENCODES, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_3.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE GENCODES.FLD_VALUE=TRIM(SITE.GEO_LOC) AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND GENCODES.FLD_NAME='GEO_LOC' ); return as_zone_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ZONE2 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_zone_descr varchar2(25); begin SELECT DESCR into as_zone_descr FROM ( SELECT GENCODES.DESCR FROM GENCODES, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE GENCODES.FLD_VALUE=TRIM(SITE.GEO_LOC) AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND GENCODES.FLD_NAME='GEO_LOC' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_2.POOL_CODE) = TRIM(as_pool_code) UNION select GENCODES.DESCR FROM GENCODES, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_2.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE GENCODES.FLD_VALUE=TRIM(SITE.GEO_LOC) AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND GENCODES.FLD_NAME='GEO_LOC' ); return as_zone_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ZONE4 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_zone_descr varchar2(25); begin SELECT DESCR into as_zone_descr FROM ( SELECT GENCODES.DESCR FROM GENCODES, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE GENCODES.FLD_VALUE=TRIM(SITE.GEO_LOC) AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND GENCODES.FLD_NAME='GEO_LOC' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_4.POOL_CODE) = TRIM(as_pool_code) UNION select GENCODES.DESCR FROM GENCODES, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_4.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE GENCODES.FLD_VALUE=TRIM(SITE.GEO_LOC) AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND GENCODES.FLD_NAME='GEO_LOC' ); return as_zone_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083090 ON VQ_PROC_RET (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_DISHNR_CRTERM (as_tran_type rcpdishnr.tran_type%type,as_cr_term rcpdishnr.cr_term%type,as_cr_term__old rcpdishnr.cr_term__old%type,as_tran_ser rcpdishnr.tran_ser%type) return number is ls_count number(10,0); ls_var_value varchar2(600); begin begin ls_count :=0; SELECT count(1) into ls_count FROM FINPARM WHERE var_name='LY_RCPDIS_CRCHECK' and var_value='Y'; exception when no_data_found then ls_count :=0; end; if as_tran_ser <> 'M' then -- conDition added to bypass series misc receipt 020421 Prashant P IF ls_count >0 THEN IF as_tran_type ='C' then if as_cr_term <> as_cr_term__old THEN RETURN 0; else return 1; end if; END IF; IF as_tran_type ='D' THEN SELECT VAR_VALUE into ls_var_value FROM FINPARM WHERE VAR_NAME='DISHONOUR_CR_TERM'; if trim(as_cr_term) <> trim(ls_var_value) then return 0; else return 1; end if; END IF; else return 1; END IF; else -- conDition added to bypass series misc receipt 020421 Prashant P return 1; end if ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TRIMED_STR (as_str in varchar2) return varchar2 is ls_length number(4); ls_pos number(2); ls_str1 varchar2(25); ls_str2 varchar2(25); ls_str varchar2(60); begin ls_length:= length(as_str); ls_pos:= instr(as_str,' '); ls_str1:= substr(as_str,1,ls_pos); ls_str2:= substr(as_str,ls_pos+1,ls_length); ls_str:= trim(ls_str1)||' '||trim(ls_str2); return ls_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BANKBOOK_DET ( ls_ref_ser in char , ls_ref_no in char) return varchar2 is ls_det char(33); ls_sopo_no char(10); ls_vouch_no char(10); ls_bill_no char(10); begin if ls_ref_ser = 'RCP' then select a.sale_order , b.ref_no , c.cust_pord into ls_sopo_no , ls_vouch_no , ls_bill_no from receipt a, rcpdet b , sorder c where a.tran_id = b.tran_id and a.sale_order = c.sale_order (+) and a.tran_id = ls_ref_no and rownum = 1 ; ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; elsif ls_ref_ser = 'M-RCP' then ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; elsif ls_ref_ser = 'R-DIS' then select a.sale_order , b.ref_no , c.cust_pord into ls_sopo_no , ls_vouch_no , ls_bill_no from receipt a, rcpdet b , sorder c, rcpdishnr d where d.ref_no (+) = a.tran_id and a.tran_id = b.tran_id and a.sale_order = c.sale_order (+) and d.tran_id = ls_ref_no and rownum = 1; ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; elsif ls_ref_ser = 'E-PAY' then ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; elsif ls_ref_ser = 'M-PAY' then select a.purc_order , a.bill_no , a.ref_no into ls_sopo_no , ls_vouch_no , ls_bill_no from misc_payables a, misc_paydet b where a.tran_id = b.vouch_no (+) and b.tran_id = ls_ref_no and rownum = 1; ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; elsif ls_ref_ser = 'MPCANC' then select a.purc_order , a.bill_no , a.ref_no into ls_sopo_no , ls_vouch_no , ls_bill_no from misc_payables a, misc_paydet b , misc_payment_canc c where a.tran_id = b.vouch_no (+) and c.payment_no(+) = b.tran_id and b.tran_id = ls_ref_no and rownum = 1; ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; elsif ls_ref_ser = 'F-XFR' then ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; else ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; end if; exception when no_data_found then ls_det :=nvl(ls_sopo_no,' ')||' ' ||nvl(ls_vouch_no,' ')||' ' ||nvl(ls_bill_no,' '); return ls_det; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_ENTRY_BATCH_BANK ON MISC_PAYABLES (ENTRY_BATCH_NO, BANK_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_BOM (as_bomcode in char,as_mfgtype in char) return varchar2 is ls_retval varchar2(1) := '0'; ll_reccount number(6,0) := 0; begin if as_bomcode is not null and as_mfgtype in ('F','P') then select count(1) into ll_reccount from bom a,bomdet b where a.bom_code = as_bomcode and a.bom_code=b.bom_code and a.item_code=b.item_code and a.active='Y' and a.confirmed='Y'; if ll_reccount = 0 then ls_retval:= 0; else ls_retval:= 1; end if; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_POS_DESCR (AS_EMP_CODE char,AS_DEPT_CODE char,AS_POS_CODE char) return varchar2 is a_pos_descr org_structure.descr%type; a_version_id org_structure.version_id%type; a_table_no org_structure.table_no%type; a_dept_code department.dept_code%type; a_level_no org_structure.level_no%type; begin if (AS_POS_CODE is null or AS_EMP_CODE is null) then return a_pos_descr; end if; a_dept_code := AS_DEPT_CODE; if (a_dept_code is null) then select dept_code into a_dept_code from employee where emp_code = AS_EMP_CODE; end if; if (a_dept_code is null) then return a_pos_descr; end if; select version_id into a_version_id from version where trunc(sysdate) between eff_from and valid_upto; select item_ser into a_table_no from department where dept_code = a_dept_code; select b.level_no into a_level_no from employee a,grade b where b.grade_code = a.grade and a.emp_code = AS_EMP_CODE; if (a_table_no in ('ET','OL','OT')) then a_level_no := a_level_no + 1; end if; select descr into a_pos_descr from org_structure where version_id = a_version_id and table_no = a_table_no and pos_code = AS_POS_CODE and level_no = a_level_no; return a_pos_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_DLV_LOC_AMD_X ON SALES_QUOT_DLV_LOC_AMD (AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_FRX_GET_CURR_AMT_FOR_EMP (as_tran_id in char) return varchar2 is ls_curr_code_with_amt varchar2(10000); ls_curr_amt forex_req_hdr.curr_code%type; s_curr_code varchar2(10); amt number(14,2):=0; ret varchar2(1000); ret_all varchar2(10000); cursor c is SELECT CURR_CODE ,SUM(AMT) as amt FROM ( SELECT curr_code__cash as curr_code,amount_cash as amt FROM forex_req_det WHERE tran_id =as_tran_id AND curr_code__cash is not null UNION ALL SELECT curr_code__tc as curr_code,amount_tc as amt FROM forex_req_det WHERE tran_id =as_tran_id AND curr_code__tc is not null UNION ALL SELECT curr_code__card as curr_code,amount_card as amt FROM forex_req_det WHERE tran_id =as_tran_id AND curr_code__card is not null ) GROUP BY CURR_CODE; begin ls_curr_amt :=' '; s_curr_code :=' '; amt := 0; for crow in c loop begin exit when c%notfound; amt := crow.amt; if crow.curr_code = 'EURO' THEN ls_curr_amt:= '?' ; elsif crow.curr_code = 'POUND' THEN ls_curr_amt:= '#' ; elsif crow.curr_code = 'USD' THEN ls_curr_amt:= '$' ; end if; ret :=ret || to_char(crow.curr_code)||' : ' ||to_char(trim(ls_curr_amt))|| to_char(trim(crow.amt)) || chr(10); end; end loop; ls_curr_code_with_amt := ret ; return ls_curr_code_with_amt ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PLANDATE ( ls_tran_id__plan char) return varchar2 is ls_plan_date varchar2(15); begin select to_char(start_date,'dd-Mon-yyyy') into ls_plan_date from strg_event_plan where tran_id =ls_tran_id__plan; return ls_plan_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_GET_CUST_ITEM_DSCR (ls_CUST_CODE VARCHAR2,ls_ITEM_CODE CHAR,ls_cust_item__ref char) return varchar2 is ls_itmdescr varchar2(40); begin select distinct descr into ls_itmdescr from customeritem where trim(cust_code) =ls_cust_code and item_code =ls_item_code and item_code__ref = ls_cust_item__ref ; RETURN ls_itmdescr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_BUSINPARTNER_TAXENV (ls_state_code In Char, ls_site_code In Char, ls_tax_env in char ,ls_contact_type in char) return number Is ls_sitestate CHAR(5); ls_type CHAR(5); ls_udftype CHAR(5); ls_count Number(10); Begin --get site statecode begin select trim(state_code) Into ls_sitestate From site where site_code = ls_site_code; select trim(UDF_STR1) into ls_udftype from gencodes where mod_name ='W_BUSINESS_PARTNER' and fld_name='CONTACT_TYPE' and FLD_VALUE = ls_contact_type; SELECT REGEXP_SUBSTR(ls_udftype, '[^,]+', 1, level) into ls_type FROM dual CONNECT BY REGEXP_SUBSTR(ls_udftype, '[^,]+', 1, level) IS NOT NULL and rownum = 1; end; if trim(ls_type) in ('S', 'T', 'TA' ,'SP') then if length(trim(ls_tax_env)) > 0 then If ls_state_code <> ls_sitestate and ls_tax_env in ('PINC01','PIWC01','PRCMI01','PIMP01','EINC01','EIWC01','ERCMI01') then return 0; elsIf ls_state_code = ls_sitestate and ls_tax_env in ('PLNC01','PLWC01','PRCML01','ELNC01','ELWC01','ERCML01') Then return 0; else return 1; end If;--end of statecode else return 0; end if;--end of taxenv elsif trim(ls_type) in ('C', 'CS') then if length(trim(ls_tax_env)) > 0 then If ls_state_code <> ls_sitestate and ls_tax_env in ('SEP01','SEPDEEM','NOGST1','SIGST02','SPRI01','SIGST01') then return 0; elsIf ls_state_code = ls_sitestate and ls_tax_env in ('SDN','SLD','SAN','SAS','SAR','SCG','SJH','SML','SMN','SMZ','SNL','SOR','SSK','STR','SWB','SBR','SCH','SDL','SHP','SHR','SJK','SMP','SPB','SUP','SUA','SAP','SKL','SKA','SPY','STN','STS','SDD','SGJ','SGA','SMH','SRJ','SRCMI01','SRCML01','NOGST1','SPRL01') then return 0; else return 1; end If;--end of statecode else return 0; end if;--end of taxenv else return 0; end if; End FN_GET_BUSINPARTNER_TAXENV; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BANKTRAN_LOG_BANK_REF_TYPE_SER ON BANKTRAN_LOG (BANK_CODE, TRAN_TYPE, TRAN_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_DUP_PAY_OPENING (as_ref_no in payables_dtl.ref_no%type,as_tran_ser in payables_dtl.tran_ser%type) return number is ls_count number(10,0); ls_ref_count number(10,0); begin begin ls_count :=0; SELECT count(1) into ls_count FROM FINPARM WHERE var_name='LY_DUPPAY_NO' and var_value='Y'; exception when no_data_found then ls_count :=0; end; if ls_count >0 then SELECT COUNT(1) into ls_ref_count FROM MISC_PAYABLES WHERE REF_NO=as_ref_no AND TRAN_SER=as_tran_ser ; IF ls_ref_count >0 THEN return 0; ELSE RETURN 1; END IF; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LATE_ARRIVAL (AS_EMP_CODE char,AS_DATE_FR date,AS_DATE_TO date,AS_TYPE char,AS_CONS_GRACE char,AS_DAILY_MIN number) return number is a_minutes number(5); a_ret_value number(5) := 0; a_no_times number(2) := 0; a_curr_date date; a_start_date date := to_date('01' || to_char(AS_DATE_FR,'mmyyyy'),'ddmmyyyy'); a_fr_date date := AS_DATE_FR; a_to_date date := AS_DATE_TO; a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; a_grace_time workshft.grace_time%type; a_grace_no_time workshft.grace_no_time%type; begin select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (a_date_join > a_start_date) then a_start_date := a_date_join; end if; if (a_date_join > a_fr_date) then a_fr_date := a_date_join; end if; if (a_relieve_date is not null and a_relieve_date < a_to_date) then a_to_date := a_relieve_date; end if; if (a_fr_date > a_to_date) then return a_ret_value; end if; for i in 1..(a_to_date-a_start_date+1) loop a_curr_date := (a_start_date+i-1); if (to_char(a_curr_date,'dd') = '01') then a_no_times := 0; end if; select nvl(sum(ddf_time_in_mm(a.in_time)-ddf_time_in_mm(b.in_time)),0),nvl(sum(b.grace_time),0),nvl(sum(b.grace_no_time),0) into a_minutes,a_grace_time,a_grace_no_time from attendance_day a,workshft b where b.shift = a.shift and b.day_no = a.day_no and a.attd_date = a_curr_date and a.emp_code= AS_EMP_CODE and (ddf_time_in_mm(a.in_time)-ddf_time_in_mm(b.in_time)) > 0; if (a_minutes != 0) then if (nvl(ddf_get_holiday_for_date(AS_EMP_CODE,a_curr_date),' ') in ('W','H')) then a_minutes := 0; end if; end if; if (a_minutes != 0) then declare cursor c1 is select lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and a_curr_date between lve_date_fr and lve_date_to and use_flag = 'C' and status = 'A' order by lve_date_fr,lve_date_to; begin for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> a_curr_date and i.lve_date_to <> a_curr_date) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = a_curr_date and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = a_curr_date and i.leave_ends = 'E') or (i.lve_date_fr = a_curr_date and i.leave_starts = 'B') or (i.lve_date_to = a_curr_date and i.leave_ends = 'M') then a_minutes := 0; end if; end loop; end; end if; if (a_minutes != 0) then declare cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and a_curr_date between date_from and date_to and status = 'A' order by date_from,date_to; begin for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> a_curr_date and i.date_to <> a_curr_date) or (i.date_from <> i.date_to and i.date_from = a_curr_date and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = a_curr_date and i.tour_ends = 'E') or (i.date_from = a_curr_date and i.tour_starts = 'S') or (i.date_to = a_curr_date and i.tour_ends = 'B') then a_minutes := 0; end if; end loop; end; end if; if (a_minutes > AS_DAILY_MIN) then if (a_minutes <= a_grace_time) then a_no_times := a_no_times + 1; end if; if (a_curr_date >= a_fr_date and ((AS_CONS_GRACE = 'N') or (a_minutes > a_grace_time) or (a_minutes <= a_grace_time and a_no_times > a_grace_no_time))) then if (AS_TYPE = 'M') then a_ret_value := a_ret_value + a_minutes; elsif (AS_TYPE = 'T') then a_ret_value := a_ret_value + 1; end if; end if; end if; end loop; return a_ret_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RCP_IBCA_DET_REF_SER_NO ON RCP_IBCA_DET (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVALLOC_TRAN_DATE_SITE_CODE ON INVALLOC_TRACE (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PAN_DTL ( as_emp_code CHAR, as_date DATE, as_var_name CHAR ) RETURN VARCHAR2 IS as_name VARCHAR2(50); a_value site_env.par_value%TYPE; a_cadre candidate.cadre%TYPE; a_grade candidate.grade%TYPE; a_site candidate.emp_site%TYPE; as_pan_no candidate.it_no%TYPE; a_count NUMBER(5); BEGIN SELECT emp_site, cadre, grade, it_no INTO a_site, a_cadre, a_grade, as_pan_no FROM candidate WHERE candidate_id = as_emp_code; SELECT COUNT(*) INTO a_count FROM site_env WHERE site_code = a_site AND module_code = 'ADM' AND level_type = 'G' AND level_code = a_grade AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( a_count <> 0 ) THEN SELECT par_value INTO a_value FROM site_env WHERE site_code = a_site AND module_code = 'ADM' AND level_type = 'G' AND level_code = a_grade AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( TRIM(a_value) IS NOT NULL OR trim(a_value) <> '' ) THEN IF trim(a_value) = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM site_env WHERE site_code = a_site AND module_code = 'ADM' AND level_type = 'C' AND level_code = a_cadre AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( a_count <> 0 ) THEN SELECT par_value INTO a_value FROM site_env WHERE site_code = a_site AND module_code = 'ADM' AND level_type = 'C' AND level_code = a_cadre AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM site_env WHERE site_code = a_site AND module_code = 'ADM' AND level_type = 'X' AND level_code = 'ZZZZZ' AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( a_count <> 0 ) THEN SELECT par_value INTO a_value FROM site_env WHERE site_code = a_site AND module_code = 'ADM' AND level_type = 'X' AND level_code = 'ZZZZZ' AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM site_env WHERE site_code = '99999' AND module_code = 'ADM' AND level_type = 'G' AND level_code = a_grade AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( a_count <> 0 ) THEN SELECT par_value INTO a_value FROM site_env WHERE site_code = '99999' AND module_code = 'ADM' AND level_type = 'G' AND level_code = a_grade AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM site_env WHERE site_code = '99999' AND module_code = 'ADM' AND level_type = 'C' AND level_code = a_cadre AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( a_count <> 0 ) THEN SELECT par_value INTO a_value FROM site_env WHERE site_code = '99999' AND module_code = 'ADM' AND level_type = 'C' AND level_code = a_cadre AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM site_env WHERE site_code = '99999' AND module_code = 'ADM' AND level_type = 'X' AND level_code = 'ZZZZZ' AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF ( a_count <> 0 ) THEN SELECT par_value INTO a_value FROM site_env WHERE site_code = '99999' AND module_code = 'ADM' AND level_type = 'X' AND level_code = 'ZZZZZ' AND par_name = as_var_name AND as_date BETWEEN eff_date AND upto_date; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM payrparm WHERE prd_code = to_char(as_date, 'YYYYMM') AND var_name = as_var_name; IF ( a_count <> 0 ) THEN SELECT var_value INTO a_value FROM payrparm WHERE prd_code = to_char(as_date, 'YYYYMM') AND var_name = as_var_name; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE IF a_value = 'N' THEN as_name := 'NA'; END IF; END IF; END IF; END IF; IF ( a_count = 0 OR a_value IS NULL OR a_value = '' ) THEN SELECT COUNT(*) INTO a_count FROM payrparm WHERE prd_code = '999999' AND var_name = as_var_name; IF ( a_count <> 0 ) THEN SELECT var_value INTO a_value FROM payrparm WHERE prd_code = '999999' AND var_name = as_var_name; IF a_value = 'Y' THEN SELECT y.name INTO as_name FROM panapidetails y, candidate c WHERE y.pan_no = as_pan_no AND c.candidate_id = as_emp_code AND y.pan_no = c.it_no AND add_pan_date = ( SELECT MAX(x.add_pan_date) FROM panapidetails x WHERE x.pan_no = y.pan_no ); ELSE as_name := 'NA'; END IF; END IF; END IF; IF ( as_name IS NULL ) THEN as_name := 'NA'; END IF; RETURN as_name; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DYN_POTENCY_CAL (f_req_qty in number ,f_bal_qty in number ,f_site_code in char , f_item_code in char , f_loc_code in char , f_lot_no in char ,f_lot_sl in char ) return number is --lc_baqty number(14,3); lc_quantity number(14,3) := 0.00; ld_stockpotencyperc number(14,3); ld_itemstdpotency number(14,3); ld_quantity number(14,3); ld_moisture_content number(5,3); ls_loctype char(3); ls_qc_no char(10); ls_actual_rs char(1000); ls_var_val char(100); lc_tmpqty number(14,3) := 0.00; cursor c1 is select a.qorder_no from qc_order a , qc_order_lots b where a.qorder_no = b.qc_order and a.site_code = f_site_code and b.item_code = f_item_code and b.loc_code = f_loc_code and b.lot_no = f_lot_no and b.lot_sl = f_lot_sl ; begin lc_quantity := 0 ; select nvl(potency_perc,100) into ld_itemstdpotency from item where item_code = f_item_code; select potency_perc into ld_stockpotencyperc from stock where item_code = f_item_code and site_code = f_site_code and loc_code = f_loc_code and lot_no = f_lot_no and lot_sl = f_lot_sl ; if f_req_qty < f_bal_qty then -- insufficient stock case lc_quantity := f_req_qty - (round(f_req_qty * ld_stockpotencyperc /ld_itemstdpotency,2)) ; else lc_quantity :=round( (( round(f_bal_qty / ld_stockpotencyperc * ld_itemstdpotency,2)) - f_bal_qty ),2); end if; return lc_quantity; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFF_DOC_MET_TB force AS TABLE OF EFF_DOC_MET_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_POSCODE_DESCR (as_poscode char) return Varchar2 is ls_descr org_structure.descr%type; begin IF as_poscode IS NULL OR LENGTH(LTRIM(RTRIM(as_poscode))) = 0 OR RTRIM(as_poscode) IS NULL THEN ls_descr := ''; ELSE select descr||' ('||RTRIM(pool_code)||')' into ls_descr from org_structure where pos_code =as_poscode and version_id = (select fn_get_version_id from dual); END IF; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOCALITYDESCR (LS_LOCALITY_CODE CHAR) return char is LS_LOCALITYDESCR varchar2(40); begin select descr into LS_LOCALITYDESCR from LOCALITY where LOCALITY_CODE =LS_LOCALITY_CODE ; RETURN LS_LOCALITYDESCR; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETMAILSUBJ_SIGNFOR_TREQ (tran_id trequest.tran_id%type, tran_date trequest.tran_date%type, travel_type trequest.travel_type%type, site_code trequest.site_code%type, purpose_visit trequest.purpose_visit%type, emp_code__req trequest.emp_code__req%type, status trequest.status%type, status_date trequest.status_date%type, confirmed trequest.confirmed%type, cctr_code trequest.cctr_code%type, emp_code__rate_aprv trequest.emp_code__rate_aprv%type, acct_code trequest.acct_code%type, flag varchar,apprv_flag varchar) return char Is retrun_string varchar(1000); e_r_name varchar(100); begin retrun_string := 'Travel request '; if flag = 'M' then if apprv_flag = 'R' then retrun_string := retrun_string || 'approval of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; end if; select trim(fn_get_emp_name(emp_code__req,'F')) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' dated '|| initcap(TO_CHAR(TO_DATE(tran_date,'DD-MM-YY'),'DD-Mon-YYYY')); elsif flag = 'S' then if apprv_flag = 'R' then retrun_string := retrun_string || 'approval of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; end if; select trim(fn_get_emp_name(emp_code__req,'F')) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' dated '|| initcap(TO_CHAR(TO_DATE(tran_date,'DD-MM-YY'),'DD-Mon-YYYY')); end if; return trim(retrun_string); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_ADDYEARS (AS_DATE date,AS_YEARS number) return date is a_date date; begin a_date := add_months(AS_DATE,(AS_YEARS*12)); return a_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_PC_MST force AS OBJECT ( SC_CODE VARCHAR2(30), CHEM_NAME VARCHAR2(150), SPECIALITY VARCHAR2(120), PLANNED_VISIT VARCHAR2(10), CLASS_DESCR VARCHAR2(60), CATEGORY VARCHAR2(60), LOCALITY VARCHAR2(120), ROUTE_TYPE VARCHAR2(60), MET_DATES VARCHAR2(120), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), DIVISION VARCHAR2(30), EMP_CODE VARCHAR2(30), EMP_NAME VARCHAR2(50), HEAD_QUAT VARCHAR2(50), DESIGN VARCHAR2(30), CHEM_ADDR VARCHAR2(500) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER OBJ_SIGN_STATUS_CHG_TRIGGER AFTER INSERT ON OBJ_SIGN_STATUS_CHG FOR EACH ROW BEGIN UPDATE OBJ_SIGN_TRANS SET SIGN_STATUS = :NEW.SIGN_STATUS__NEW WHERE REF_SER = :NEW.REF_SER AND REF_ID = :NEW.REF_ID AND LINE_NO = :NEW.LINE_NO; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UNIQUE_ACTION_INFO_IDX ON OBJ_FOLLOWUP_ACT (OBJ_NAME, ACTION_ID, ACTION_INFO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CHAAT_ITEM_QTY (ls_site_code IN CHAR ,as_item_code IN CHAR ) return char is li_qty_sample NUMBER(11); begin begin select qty_sample into li_qty_sample from siteitem where site_code =ls_site_code and item_code=as_item_code; EXCEPTION WHEN NO_DATA_FOUND THEN SELECT qty_sample into li_qty_sample from ITEM where item_code=as_item_code; end; if li_qty_sample <= 0 then SELECT qty_sample into li_qty_sample from ITEM where item_code=as_item_code; end if; return li_qty_sample; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_PAR_CCTR ( lsite_code in char, litem_code in char, lcctr_code in char, lgetQV in char, ad_from_date in date, lavailable in char, as_excl_loc in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select sum(qty) into ld_eff_qty from (SELECT decode(lgetQV,'Q',sum(a.quantity),sum(a.quantity * a.rate)) qty from stock a, invstat b, location c, costctr cctr_a, costctr cctr_b where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 and cctr_a.cctr_code = a.cctr_code__inv and cctr_b.cctr_code = cctr_a.cctr_code__par and cctr_b.cctr_code = lcctr_code and c.loc_code not in (as_excl_loc) union all SELECT decode(lgetQV,'Q',sum(nvl(a.eff_qty,0) * -1),sum(nvl(a.eff_qty,0) * -1 * a.rate)) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.tran_date > ad_from_date and instr(lavailable,c.available) > 0 and b.loc_code not in (as_excl_loc)); if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SER_ACT_PLANED ON SER_REQ_ACT_DETL (ACTION_ID, PLANENDDATE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ACCTINV_ONLINE ( as_REF_SER char , as_REF_ID char ,as_site_code char) return char is ls_RET_VAL char; Begin IF as_REF_SER = 'P-RCP' then select ACCT_INV_ONLINE into ls_RET_VAL from porcp where tran_id= as_REF_ID and site_code = as_site_code ; ElsIf as_REF_SER = 'P-RET' then select ACCT_INV_ONLINE into ls_RET_VAL from porcp where tran_id= as_REF_ID and site_code = as_site_code ; ELSIF as_REF_SER = 'QC-ORD' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'M-VOUC' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'MDRCRD' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'ADJISS' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'W-IRTN' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'ADJRCP' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'MDRCRC' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'CRNRCP' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'C-IRTN' THEN ls_RET_VAL := 'N'; ELSIF as_REF_SER = 'DRNRCP' THEN ls_RET_VAL := 'N'; end IF; return ls_RET_VAL; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYABLES_VAL (as_tran_id CHAR) return number IS ls_retval NUMBER(1) :=1; ls_ref_no CHAR(12); ls_tran_ser CHAR(6); ls_sundry_code CHAR(10); ls_line_no number(3); ls_site_code CHAR(5); lc_cnt number(3) :=0; pay_cnt number :=0; miscpay_cnt number :=0; begin declare cursor c_payable IS select a.line_no as ls_line_no,a.tran_ser as ls_tran_ser,a.ref_no as ls_ref_no,a.sundry_code as ls_sundry_code,b.site_code as ls_site_code from payables_dtl a , payables_hdr b where a.tran_id = b.tran_id and a.tran_id = as_tran_id; begin for i in c_payable loop --raise_application_error( -20601, 'value of as_item_code is.. [' || as_item_code || ']'); select count(*) into pay_cnt from payables_dtl a , payables_hdr b where trim(a.tran_ser) = trim(i.ls_tran_ser) and trim(a.ref_no) = trim(i.ls_ref_no) and trim(b.site_code) = trim(i.ls_site_code) and trim(a.sundry_code) <> trim(i.ls_sundry_code) and trim(a.line_no) <> trim(i.ls_line_no) and a.tran_id = b.tran_id and a.tran_id = as_tran_id; --raise_application_error( -20601, 'value of ls_lot_no is.. [' || i.ls_ref_no || ']--[' || i.ls_tran_ser || ']--[' || i.ls_site_code || ']---[' || i.ls_sundry_code || ']---[' || i.ls_line_no || ']'); if(pay_cnt>0)then ls_retval := 0; RETURN ls_retval; else select count(*) into miscpay_cnt from misc_payables where trim(tran_ser) = trim(i.ls_tran_ser) and trim(ref_no) = trim(i.ls_ref_no) and trim(site_code) = trim(i.ls_site_code) and trim(sundry_code)<> trim(i.ls_sundry_code); --raise_application_error( -20601, 'value of ls_lot_no is.. [' || i.ls_ref_no || ']--[' || i.ls_tran_ser || ']--[' || i.ls_site_code || ']---[' || i.ls_sundry_code || ']'); if(miscpay_cnt>0)then ls_retval := 0; RETURN ls_retval; else ls_retval :=1; end if; end if; end loop; END; RETURN ls_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINV_CLSTK (LSITE_CODE in VARCHAR2 , LITEM_CODE in VARCHAR2 , LLOT_NO in VARCHAR2 ,AD_FROM_DATE in date, LTYPE in VARCHAR2 , LAVAILABLE in VARCHAR2 ) RETURN number is LC_TOTAL_QTY number (17, 6) ; LD_EFF_QTY number ( 17 , 6 ) ; LD_INVTRACE_QTY number ( 17 , 6 ) ; LDT_CREA_DATE date ; BEGIN IF LTYPE = 'I' THEN SELECT MIN ( A . CREA_DATE ) into LDT_CREA_DATE FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT SUM ( A . QUANTITY ) into LD_EFF_QTY FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT NVL ( ( SUM ( EFF_QTY ) * - 1 ) , 0 ) into LD_INVTRACE_QTY FROM INVTRACE A , LOCATION B , INVSTAT C WHERE A . LOC_CODE = B . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( C . STAT_TYPE , ' ' ) <> 'S' AND A . ITEM_CODE = LITEM_CODE AND A . SITE_CODE = LSITE_CODE AND A . TRAN_DATE > AD_FROM_DATE AND INSTR ( LAVAILABLE , C . AVAILABLE ) > 0 ; END IF ; IF LTYPE = 'B' THEN SELECT MIN ( A . CREA_DATE ) into LDT_CREA_DATE FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT SUM ( A . QUANTITY ) into LD_EFF_QTY FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT NVL ( ( SUM ( EFF_QTY ) * - 1 ) , 0 ) into LD_INVTRACE_QTY FROM INVTRACE A , LOCATION B , INVSTAT C WHERE A . LOC_CODE = B . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( C . STAT_TYPE , ' ' ) <> 'S' AND A . ITEM_CODE = LITEM_CODE AND A . SITE_CODE = LSITE_CODE AND A . EFF_DATE > AD_FROM_DATE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , C . AVAILABLE ) > 0 ; END IF ; LC_TOTAL_QTY := LD_EFF_QTY + LD_INVTRACE_QTY ; RETURN LC_TOTAL_QTY ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ADF_LOAN_MIN_INST (as_empcode in char, ac_inst_amt in number) return number is lc_retval number(1); lc_val number(3); ls_bom_code1 char(5) ; ls_bom_code2 char(5) ; ls_work_site char(5) ; begin lc_retval := 1 ; select var_value into ls_bom_code1 from payrparm where prd_code = '999999' and var_name = 'STAN_CODE_LOAN' ; select stan_code__hq into ls_bom_code2 from employee where emp_code = as_empcode ; if ls_bom_code2 is null then select work_site into ls_work_site from employee where emp_code = as_empcode; if ls_work_site is not null then select stan_code into ls_bom_code2 from site where site_code = ls_work_site; end if; end if; if rtrim(ls_bom_code1) = rtrim(ls_bom_code2) then lc_val := 500 ; else lc_val := 250 ; end if ; if ac_inst_amt < lc_val then lc_retval := 0; end if; return lc_retval ; exception when no_data_found then lc_retval := 0 ; return lc_retval ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_VOUCHRCP ON VOUCHRCP (TRAN_ID, PRCP_ID, LINE_NO__RCP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_OBSERVATION_NAME ( as_route_code procroute_oper_observ.ROUTE_CODE%type, an_opration procroute_oper_observ.OPERATION%type, an_line_instr procroute_oper_observ.SEQ_NO__INSTR%type, an_line_no procroute_oper_observ.SEQ_NO%type , as_flag char ) return varchar2 is ls_data procroute_oper_INSTR.INSTRUCTION%type; begin if as_flag = 'A' then --A for OBSERV_NAME select trim(observ_name) observ_name into ls_data from procroute_oper_observ where route_code = as_route_code and operation = an_opration and seq_no__instr = an_line_instr and seq_no = an_line_no; elsif as_flag = 'B' then --B for Instruction select trim(Instruction) Instru into ls_data from procroute_oper_instr where route_code = as_route_code and operation = an_opration and seq_no = an_line_instr ; end if; return ls_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_SUNDRY_TRAN_SER ON MISC_PAYABLES (SUNDRY_CODE, TRAN_SER, SUNDRY_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_POAMD_GET_AMD_DESCR (as_amdno varchar2 ) return varchar2 is lc_rec number; lc_ctr1 number; lc_ctr2 number; lc_ctr3 number; lc_ctr4 number; lc_qty number; lc_qty_o number; lc_rate number; lc_rate_o number; ls_term varchar2(250); ls_term_o varchar2(250); ld_dlv_date date; ld_dlv_date_o date; ls_amd_descr varchar2(250); ls_str char(1) := '&'; cursor c1 is SELECT nvl(b.quantity,0), nvl(b.quantity__o,0), nvl(b.rate,0), nvl(b.rate__o,0), nvl(c.term_code,''), nvl(c.term_code__o,''), nvl(b.dlv_date,sysdate), nvl(b.dlv_date__o,sysdate) FROM poamd_hdr a, poamd_det b, poamd_term c WHERE a.amd_no = b.amd_no AND b.amd_no = c.amd_no (+) AND a.amd_no = as_amdno AND ( nvl((b.quantity-b.dlv_qty),0) > 0 ) AND ( (nvl(b.rate,0) <> nvl(b.rate__o,0) ) OR (nvl(b.quantity,0)<> nvl(b.quantity__o,0)) OR (to_date(b.dlv_date,'dd/mm/yy') <> to_date(b.dlv_date__o,'dd/mm/yy')) OR (c.term_code <> c.term_code__o) ) ; begin ls_amd_descr := ''; lc_ctr1 := 0; lc_ctr2 := 0; lc_ctr3 := 0; lc_ctr4 := 0; Open c1; loop fetch c1 into lc_qty ,lc_qty_o ,lc_rate ,lc_rate_o , ls_term ,ls_term_o,ld_dlv_date,ld_dlv_date_o ; exit when c1%notfound; if lc_qty <> lc_qty_o then if lc_ctr1 = 0 then if length(ls_amd_descr) > 0 then ls_amd_descr := ls_amd_descr || ls_str ||' QUANTITY' ; else ls_amd_descr := ls_amd_descr || 'QUANTITY' ; end if; lc_ctr1 := 1; end if; end if; if lc_rate <> lc_rate_o then if lc_ctr2 = 0 then if length(ls_amd_descr) > 0 then ls_amd_descr := ls_amd_descr || ls_str ||' RATE' ; else ls_amd_descr := ls_amd_descr || 'RATE' ; end if; lc_ctr2 := 1; end if; end if; if ls_term <> ls_term_o then if lc_ctr3 = 0 then if length(ls_amd_descr) > 0 then ls_amd_descr := ls_amd_descr || ls_str ||' TERMS' ; else ls_amd_descr := ls_amd_descr || 'TERMS' ; end if; lc_ctr3 := 1; end if; end if; if to_date(ld_dlv_date,'dd/mm/yy') <> to_date(ld_dlv_date_o,'dd/mm/yy') then if lc_ctr4 = 0 then if length(ls_amd_descr) > 0 then ls_amd_descr := ls_amd_descr || ls_str ||' SCHEDULE' ; else ls_amd_descr := ls_amd_descr || 'SCHEDULE' ; end if; lc_ctr4 := 1; end if; end if; end loop; if length(ls_amd_descr) > 0 then ls_amd_descr := 'PURCHASE ORDER AMENDED FOR ' || ls_amd_descr ; else ls_amd_descr := 'PURCHASE ORDER AMENDED FOR OTHERS' ; end if; close c1; return ls_amd_descr; EXCEPTION when NO_DATA_FOUND then begin return ls_amd_descr; end; when OTHERS then begin return ls_amd_descr; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_PORATE_CLG (as_rate in porddet.rate%type,as_rate_clg in porddet.rate__clg%type) return number is FLAG NUMBER(1); ls_count number(10,0); begin begin ls_count :=0; SELECT count(1) into ls_count FROM DISPARM WHERE var_name='LY_PO_RATE' and var_value='Y'; exception when no_data_found then ls_count :=0; end; if ls_count >0 then IF as_rate = as_rate_clg THEN return 0; ELSE RETURN 1; END IF; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_HEADQUATER_STNTYPE (AS_EMP_CODE char,as_EXT_STN_TYP char,as_NT_REQ_STN_TYPE char) return char is RE_STN_TYPE char(5); LL_LOC_TYPE char(1); begin SELECT LOCALITY_TYPE INTO LL_LOC_TYPE FROM LOCALITY WHERE STAN_CODE =(SELECT STAN_CODE__HQ FROM EMPLOYEE WHERE EMP_CODE = AS_EMP_CODE) AND ROWNUM=1; if (LL_LOC_TYPE is not null AND LL_LOC_TYPE = 'M' ) then select a.station_Type into RE_STN_TYPE from grade_allow a, stantype b where a.grade_code = (select grade from employee where emp_code = AS_EMP_CODE) and a.station_type = b.stan_type and a.valid_upto > sysdate and b.stan_type = as_EXT_STN_TYP and b.stan_type like 'M%' and b.stan_type <> nvl(as_NT_REQ_STN_TYPE,' ') AND ROWNUM=1; else select a.station_Type into RE_STN_TYPE from grade_allow a, stantype b where a.grade_code = (select grade from employee where emp_code = AS_EMP_CODE) and a.station_type = b.stan_type and a.valid_upto > sysdate and b.stan_type = as_EXT_STN_TYP and b.stan_type like 'N%' and b.stan_type <> nvl(as_NT_REQ_STN_TYPE,' ') AND ROWNUM=1; end if; return RE_STN_TYPE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE FIELDACTIVITYMASTERTABLE AS TABLE OF FIELDACTIVITYMASTER; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_BILL_NO_PAY (as_ref_id in char, as_refser in char, as_sundry_code in char , as_tran_id in char ) RETURN CHAR IS LS_FIELDVALUE varCHAR2(6000); AS_REFSER_1 varCHAR2(250); li_cnt number := 0; as_count number; begin begin IF TRIM(AS_REFSER) = 'P-IBCA' THEN SELECT MISC_PAYABLES.TRAN_SER INTO AS_REFSER_1 FROM MISC_PAYABLES WHERE MISC_PAYABLES.REF_NO=(SELECT MP.REF_NO FROM MISC_PAYABLES MP WHERE MP.TRAN_SER='P-IBCA' AND MP.TRAN_ID = AS_REF_ID) AND MISC_PAYABLES.TRAN_SER <> 'P-IBCA' ; elsif TRIM(AS_REFSER) = 'R-IBCA' THEN SELECT RECEIVABLES.TRAN_SER INTO AS_REFSER_1 FROM RECEIVABLES WHERE RECEIVABLES.REF_NO=(SELECT RC.REF_NO FROM RECEIVABLES RC WHERE RC.TRAN_SER='R-IBCA' AND RC.TRAN_ID = AS_REF_ID) AND RECEIVABLES.TRAN_SER <> 'R-IBCA' ; ELSE AS_REFSER_1 := as_refser; END IF; if TRIM(as_refser_1) = 'CRNRCP' then SELECT NVL(DRCR_RCP.SRETURN_NO,'') || ' - ' || NVL(SRETURN.CUST_REF,DRCR_RCP.CUST_REF_NO) || ' - ' || NVL(SRETURN.CLAIM_DATE,DRCR_RCP.CUST_REF_DATE) || ' - ' || NVL((SELECT DESCR FROM GENCODES WHERE FLD_NAME='REAS_CODE' AND MOD_NAME='W_SALESRETURN' AND FLD_VALUE=SRETURN.REAS_CODE),'') into ls_fieldvalue from DRCR_RCP LEFT OUTER JOIN SRETURN ON SRETURN.TRAN_ID=DRCR_RCP.SRETURN_NO where DRCR_RCP.tran_id = as_ref_id; end if; if TRIM(as_refser_1) = 'F-XFR' then SELECT BANK_CODE__FROM || ' - ' || BANK_CODE__TO || ' - ' || XFR_MODE || ' - ' || NVL(TRIM(REF_NO),'') || ' - ' || NVL(TO_CHAR(REF_DATE),'') into ls_fieldvalue FROM fundtransfer WHERE fundtransfer.TRAN_ID = as_ref_id; end if; if TRIM(as_refser_1) = 'M-PAY' then select count(*) into as_count FROM MISC_PAYMENT INNER JOIN MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID GROUP BY MISC_PAYMENT.REF_NO; if as_count<50 then --SELECT --NVL(TRIM(MISC_PAYMENT.BANK_CODE),'') || ' - ' || NVL(TRIM(MISC_PAYMENT.REF_NO),'') || ' - ' || 'Agst : ' || --LISTAGG(TRIM(MISC_PAYDET.VOUCH_NO||' - '|| MISC_PAYDET.PAY_AMT ),', ' ON OVERFLOW TRUNCATE '...' WITHOUT COUNT) WITHIN GROUP (ORDER BY MISC_PAYDET.TRAN_ID) AS VOUCH_NO --INTO ls_fieldvalue --FROM MISC_PAYMENT INNER JOIN --MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID --WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID --AND MISC_PAYMENT.SUNDRY_CODE=as_sundry_code --GROUP BY MISC_PAYMENT.REF_NO,MISC_PAYMENT.BANK_CODE; SELECT NVL(TRIM(MISC_PAYMENT.BANK_CODE),'') || ' - ' || NVL(TRIM(MISC_PAYMENT.REF_NO),'') || ' - ' || 'Agst : ' || LISTAGG(TRIM(misc_payables.bill_no||' - '|| MISC_PAYDET.PAY_AMT ),', ' ON OVERFLOW TRUNCATE '...' WITHOUT COUNT) WITHIN GROUP (ORDER BY MISC_PAYDET.TRAN_ID) AS VOUCH_NO INTO ls_fieldvalue FROM MISC_PAYMENT INNER JOIN MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID LEFT OUTER JOIN MISC_PAYABLES ON MISC_PAYABLES.REF_NO=MISC_PAYDET.VOUCH_NO WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID AND MISC_PAYMENT.SUNDRY_CODE=as_sundry_code And MISC_PAYABLES.REF_NO IN (SELECT VOUCH_NO FROM MISC_PAYDET mdet,MISC_PAYMENT mpay WHERE mpay.TRAN_ID=mdet.TRAN_ID AND mpay.TRAN_ID=AS_REF_ID) GROUP BY MISC_PAYMENT.REF_NO,MISC_PAYMENT.BANK_CODE; else SELECT NVL(TRIM(MISC_PAYMENT.BANK_CODE),'') || ' - ' || NVL(TRIM(MISC_PAYMENT.REF_NO),'') || ' Too Many Vouchers :' ||as_count INTO ls_fieldvalue FROM MISC_PAYMENT INNER JOIN MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID GROUP BY MISC_PAYMENT.REF_NO,MISC_PAYMENT.BANK_CODE; end if ; end if; if TRIM(as_refser_1) = 'M-RCP' then SELECT BANK_CODE || ' - ' || NVL(PARTY_BANK_REF,'') || ' - ' || (CASE WHEN MISC_RECEIPT.RCP_MODE='Q' THEN 'Cheque' WHEN MISC_RECEIPT.RCP_MODE='D' THEN 'Draft' WHEN MISC_RECEIPT.RCP_MODE='C' THEN 'Cash' WHEN MISC_RECEIPT.RCP_MODE='P' THEN 'Pay Order' WHEN MISC_RECEIPT.RCP_MODE='E' THEN 'Electronic' WHEN MISC_RECEIPT.RCP_MODE='R' THEN 'Credit Card' WHEN MISC_RECEIPT.RCP_MODE='Y' THEN 'Payment Advice' END) || ' - ' || NVL(TRIM(REF_NO),'')|| ' - ' || NVL(TO_CHAR(REF_DATE),'') INTO ls_fieldvalue FROM MISC_RECEIPT WHERE MISC_RECEIPT.TRAN_ID = as_ref_id; end if; if TRIM(as_refser_1) = 'M-VOUC' then SELECT NVL(BILL_NO,'')|| ' - ' ||BILL_DATE|| ' - ' ||NVL(SUPP_BILL_AMT,0) INTO ls_fieldvalue FROM MISC_VOUCHER WHERE MISC_VOUCHER.TRAN_ID = as_ref_id; end if; if TRIM(as_refser_1) = 'MDRCRC' then SELECT NVL(MISC_DRCR_RCP.SRETURN_NO,'')|| ' - ' || NVL(SRETURN.CUST_REF,MISC_DRCR_RCP.CUST_REF_NO) || ' - ' || NVL(SRETURN.CLAIM_DATE,MISC_DRCR_RCP.CUST_REF_DATE) into ls_fieldvalue from MISC_DRCR_RCP LEFT OUTER JOIN SRETURN ON SRETURN.TRAN_ID=MISC_DRCR_RCP.SRETURN_NO WHERE MISC_DRCR_RCP.TRAN_ID = AS_REF_ID ; end if; if TRIM(as_refser_1) = 'MDRCRD' then SELECT NVL(CUST_REF_NO,'')|| ' - ' ||CUST_REF_DATE INTO ls_fieldvalue FROM MISC_DRCR_RCP WHERE MISC_DRCR_RCP.TRAN_ID = AS_REF_ID; end if; if TRIM(as_refser_1) = 'MPCANC' then SELECT PAYMENT_NO|| ' - ' ||BANK_CODE|| ' - ' ||NVL(TRIM(REF_NO),'')|| ' - ' ||NVL(TO_CHAR(REF_DATE),'') INTO ls_fieldvalue FROM MISC_PAYMENT_CANC WHERE MISC_PAYMENT_CANC.TRAN_ID = AS_REF_ID; end if; if TRIM(as_refser_1) = 'R-DIS' then SELECT RCPDISHNR.RECEIPT_NO|| ' - ' || (RECEIPT.CUST_BANK_REF)|| ' - ' || NVL(TRIM(RCPDISHNR.BANK_CODE),'') || ' - ' || NVL(TRIM(RCPDISHNR.REF_NO),'')|| ' - ' || RCPDISHNR.REF_DATE INTO ls_fieldvalue FROM RCPDISHNR LEFT OUTER JOIN RECEIPT ON RECEIPT.TRAN_ID = RCPDISHNR.RECEIPT_NO WHERE RCPDISHNR.TRAN_ID = AS_REF_ID; END IF; if TRIM(as_refser_1) = 'RCP' then SELECT RECEIPT.BANK_CODE || ' - ' || NVL(RECEIPT.CUST_BANK_REF,'')|| ' - ' || (CASE WHEN RECEIPT.RCP_MODE='Q' THEN 'Cheque' WHEN RECEIPT.RCP_MODE='D' THEN 'Draft' WHEN RECEIPT.RCP_MODE='C' THEN 'Cash' WHEN RECEIPT.RCP_MODE='P' THEN 'Pay Order' WHEN RECEIPT.RCP_MODE='E' THEN 'Electronic' WHEN RECEIPT.RCP_MODE='R' THEN 'Credit Card' WHEN RECEIPT.RCP_MODE='Y' THEN 'Payment Advice' END) || ' - ' || TRIM(RECEIPT.REF_NO) || ' - ' || NVL(TO_CHAR(RECEIPT.REF_DATE) ,'') || ' Agst : ' || substr(rtrim(xmlagg(xmlelement(e,RCPDET.REF_NO||' - '|| RCPDET.RCP_AMT,',').extract('//text()') order by RCPDET.TRAN_ID).getclobval(),','),1,500) --LISTAGG(TRIM(RCPDET.REF_NO),', ' ON OVERFLOW TRUNCATE '...' WITHOUT COUNT) WITHIN GROUP (ORDER BY RCPDET.TRAN_ID) INTO LS_FIELDVALUE FROM RECEIPT,RCPDET WHERE RECEIPT.TRAN_ID = RCPDET.TRAN_ID AND RECEIPT.TRAN_ID = AS_REF_ID AND RCPDET.CUST_CODE=as_sundry_code GROUP BY RECEIPT.BANK_CODE, RECEIPT.CUST_BANK_REF, RECEIPT.RCP_MODE, RECEIPT.REF_NO, TO_CHAR(RECEIPT.REF_DATE); END IF; if TRIM(as_refser_1) = 'S-INV' then SELECT NVL(INVOICE.SALE_ORDER,'') || ' - ' || NVL(SORDER.CUST_PORD,'')|| ' - ' || NVL(TO_CHAR(SORDER.PORD_DATE ),'') INTO ls_fieldvalue FROM INVOICE LEFT OUTER JOIN SORDER ON INVOICE.SALE_ORDER = SORDER.SALE_ORDER WHERE INVOICE.INVOICE_ID = AS_REF_ID; END IF; if TRIM(as_refser_1) = 'VOUCH' then SELECT PURC_ORDER || ' - ' || NVL(BILL_NO,'')|| ' - ' || NVL(TO_CHAR(BILL_DATE),'') INTO ls_fieldvalue FROM VOUCHER WHERE VOUCHER.TRAN_ID = AS_REF_ID; END IF; if TRIM(as_refser_1) = 'DRNRCP' then SELECT NVL(DRCR_RCP.CUST_REF_NO,'') || ' - ' || NVL(TO_CHAR(DRCR_RCP.CUST_REF_DATE),'') || ' - ' || nvl((select descr from gencodes where fld_name='REAS_CODE' and mod_name='W_DRCRRCP_DR' and fld_value=sreturn.reas_code),'') into ls_fieldvalue from DRCR_RCP left outer join sreturn on DRCR_RCP.SRETURN_NO=sreturn.tran_id where DRCR_RCP.tran_id = as_ref_id; END IF; if TRIM(as_refser) = 'P-VOUC' then select payr_voucher.emp_code || ' - ' || employee.emp_fname || ' - ' ||nvl(employee.emp_mname,'') || ' - ' || nvl(employee.emp_lname,'') into ls_fieldvalue from payr_voucher,employee where employee.emp_code = payr_voucher.emp_code and payr_voucher.tran_id = as_ref_id ; end if; exception when no_data_found then ls_fieldvalue := ' ' ; end; return substr(ls_fieldvalue,1,500); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOS_CODE (as_site_code in char , as_item_ser in char , as_poolcode_3 in char , as_itemgrp_code in char , as_date_fr in date , as_date_to in date) return number is no_of_fso number(5); begin SELECT NVL(COUNT(DISTINCT ORG_CUST.POS_CODE),0) into no_of_fso FROM INVOICE, INVOICE_TRACE IT, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, ITEM WHERE INVOICE.INVOICE_ID=IT.INVOICE_ID AND INVOICE.CUST_CODE=ORG_CUST.CUST_CODE AND IT.ITEM_CODE=ITEM.ITEM_CODE AND ORG_CUST.TABLE_NO = ITEM.ITEM_SER AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND INVOICE.CONFIRMED='Y' AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEM.ITEM_TYPE = 'FGD' AND INVOICE.site_code = as_site_code AND ITEM.ITEM_SER = as_item_ser AND LEVEL_3.POOL_CODE = as_poolcode_3 AND ITEM.GRP_CODE = as_itemgrp_code AND INVOICE.TRAN_DATE >= as_date_fr AND INVOICE.TRAN_DATE <= as_date_to; return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_CP ( as_custcode in customer.cust_code%type, as_sitecode in site.site_code%type) return char is ls_channel_partner char(1) := 'N'; ls_dis_link char(1) := 'N'; begin begin select channel_partner, dis_link into ls_channel_partner, ls_dis_link from site_customer where cust_code = as_custcode and site_code = as_sitecode ; exception when others then ls_channel_partner := null; end; if ls_channel_partner is null then begin select channel_partner, dis_link into ls_channel_partner, ls_dis_link from customer where cust_code = as_custcode; exception when others then ls_channel_partner := 'N'; end; end if; if ls_channel_partner = 'Y' and ls_dis_link = 'A' then ls_channel_partner := 'N'; end if; return ls_channel_partner; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_INIT_FDD_X ON PROJ_INIT_FDD (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ANNUAL_CLAIM ( as_emp_code emp_reimb_claim.emp_code%type, catg_code emp_reimb_claimdet.category_code%type , annal_code emp_reimb_claimdet.anal_code%type, as_todate emp_reimb_claimdet.to_date%type, as_tranid emp_reimb_claim.tran_id%type , as_mode in char , as_limit_type in char , as_line_no in char , as_claim_date emp_reimb_claim.tran_date%type ) return number is ls_claim_amt number(14,3); ld_to_date acctprd.fr_date%type; ld_from_date acctprd.to_date%type; ls_tranid emp_reimb_claim.tran_id%type; begin select fr_date , to_date into ld_from_date, ld_to_date from acctprd where as_todate >= fr_date and as_todate <= to_date ; IF as_limit_type = 'A' THEN if as_mode ='Y' then ls_tranid := '9999999999'; else ls_tranid := as_tranid; end if; if (ls_tranid is null or length(trim(ls_tranid)) = 0) then ls_tranid := '9999999999'; end if; SELECT NVL(SUM(CLAIMDET.CLAIM_AMT),0) into LS_CLAIM_AMT FROM EMP_REIMB_CLAIMDET CLAIMDET , EMP_REIMB_CLAIM CLAIM WHERE CLAIM.TRAN_ID = CLAIMDET.TRAN_ID AND CLAIM.STATUS = 'S' AND CLAIMDET.ANAL_CODE = annal_code AND CLAIMDET.CATEGORY_CODE = catg_code AND CLAIMDET.LIMIT_TYPE = as_limit_type AND CLAIMDET.TRAN_ID <> ls_tranid AND CLAIMDET.TO_DATE BETWEEN ld_from_date AND ld_to_date AND CLAIM.EMP_CODE = as_emp_code; else LS_CLAIM_AMT := 0 ; end if; RETURN LS_CLAIM_AMT; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MAP_DET (AS_TYPE VARCHAR2 , AS_EMP_CODE CHAR , AS_PRD_CODE CHAR ) RETURN NUMBER AS AS_DET NUMBER ; AS_BHR EXCEPTION ; BEGIN IF AS_TYPE = 'UNLST_CHEM_CALL' THEN BEGIN Select nvl(count( DISTINCT M.strg_code),0) INTO AS_DET from STRG_MEET M, PERIOD B Where M.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND M.event_date BETWEEN B.FR_DATE AND B.TO_DATE and NOT EXISTS ( SELECT CM.SC_CODE FROM STRG_CUSTOMER CM WHERE M.STRG_CODE = CM.SC_CODE); Return AS_DET; END; ELSE IF AS_TYPE = 'PC' THEN BEGIN Select nvl(count(distinct SMO.strg_code),0) INTO AS_DET from STRG_MEET SM , STRG_MEET_ORDER SMO, PERIOD B Where SM.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND SMO.STRG_CODE = SM.STRG_CODE and SMO.dcr_id = SM.dcr_id AND SM.event_date BETWEEN B.FR_DATE AND B.TO_DATE and SMO.Quantity > 0 ; Return AS_DET; END; ELSE IF AS_TYPE = 'TLSD' THEN BEGIN select sum(TLSD) INTO AS_DET FROM ( select count( SMO.item_code) as TLSD , SM.event_date --into AS_DET from STRG_MEET SM , STRG_MEET_ORDER SMO, PERIOD B Where SM.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND SMO.STRG_CODE = SM.STRG_CODE and SMO.dcr_id = SM.dcr_id AND SM.event_date BETWEEN B.FR_DATE AND B.TO_DATE and SMO.Quantity > 0 group by SM.event_date ); Return AS_DET; END; ELSE IF AS_TYPE = 'TOTAL_DIS_CALL' THEN BEGIN Select nvl(count(distinct strg_code),0) into AS_DET from STRG_MEET M, PERIOD B Where M.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND M.event_date BETWEEN B.FR_DATE AND B.TO_DATE and M.STRG_TYPE = 'S'; Return AS_DET; END; ELSE IF AS_TYPE = 'LEAVE' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.ACTIVITY_TYPE = AS_TYPE; Return AS_DET; END; ELSE IF AS_TYPE = 'FW' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.ACTIVITY_TYPE = AS_TYPE; Return AS_DET; END; ELSE IF AS_TYPE = 'TRANS' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.ACTIVITY_TYPE = AS_TYPE; Return AS_DET; END; ELSE IF AS_TYPE = 'MEET' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.ACTIVITY_TYPE = AS_TYPE; Return AS_DET; END; ELSE IF AS_TYPE = 'STAR' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.Activity_Code in ('68','42'); Return AS_DET; END; ELSE IF AS_TYPE = 'ADMIN' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.Activity_Code in ('62','46'); Return AS_DET; END; ELSE IF AS_TYPE = 'OTHER' THEN BEGIN SELECT sum (case when TR.ACTIVITY_CODE IN ( '22' , '36' , '58' , '61') THEN 0.5 ELSE 1 END) INTO AS_DET FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR , PERIOD B WHERE TR.SALES_PERS = AS_EMP_CODE AND B.CODE = AS_PRD_CODE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.event_date BETWEEN B.FR_DATE AND B.TO_DATE AND X.STATUS = 'Y' AND X.Activity_Type in ( 'OTHER', 'STRIK', 'TOUR' ) and X.Activity_Code not in ('68','42' ,'62' ); Return AS_DET; END; END IF; END IF; END IF; END IF; END IF; END IF; END IF; END IF; END IF; END IF; END IF; RAISE AS_BHR; EXCEPTION WHEN AS_BHR THEN RETURN NULL; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_TRANS_CREDIT_MULTI_SITE (ldate_fr in date,ldate_to in date, lsite_code in char,lacct_code in char) return number is lc_cr_sum number(14,3); begin Select nvl(Sum(cr_amt),0) into lc_cr_sum from gltran where instr(lsite_code,TRIM(site_code)) > 0 and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE OBJ_DUPLICATE_TAB AS table of OBJ_DUPLICATE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRYDET ( as_sun_type in char, as_sun_code in char, as_flg in char ) return varchar2 is ls_flg varchar2(1000); ls_fullname varchar2(70); ls_name varchar2(80); ls_addr1 varchar2(80); ls_addr2 varchar2(80); ls_addr3 varchar2(80); ls_city varchar2(20); ls_pin varchar2(10); ls_stan varchar2(10); ls_stanm varchar2(100); ls_count char(5) ; ls_country_descr char(40); begin IF as_sun_type = 'C' then select full_name, cust_name, addr1, addr2, addr3, city, pin, state_code,count_code into ls_fullname, ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan , ls_count from customer where cust_code = as_sun_code; ElsIf as_sun_type = 'S' then Select full_name, supp_name, addr1, addr2, addr3, city, pin ,state_code,count_code into ls_fullname, ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan, ls_count From supplier Where supp_code = as_sun_code; ElsIf as_sun_type = 'L' Then Select party_name, addr1, addr2, addr3, city, pin, state_code ,count_code Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan , ls_count From loanparty Where party_code = as_sun_code; ElsIf as_sun_type = 'X' Then Select tauth_name, addr1, addr2, addr3, city, pin ,state_code,count_code Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan , ls_count From tax_authority Where tauth_code = as_sun_code; ElsIf as_sun_type = 'P' Then Select sp_name, addr1, addr2, addr3, city, pin ,state_code,count_code Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan, ls_count From sales_pers Where sales_pers = as_sun_code; ElsIf as_sun_type = 'T' Then Select tran_name, addr1, addr2, addr3, city, pin ,state_code,count_code Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan , ls_count From transporter Where tran_code = as_sun_code; ElsIf as_sun_type = 'R' Then -- ADDED FOR STRG CUSTOMER BY MANOJ SARODE ON 28-AUG-2014 START Select first_name ||' '|| middle_name ||' '|| last_name, addr1, addr2, addr3, city, pin ,state_code,count_code Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_stan , ls_count From strg_customer Where sc_code = as_sun_code; -- ADDED FOR STRG CUSTOMER BY MANOJ SARODE ON 28-AUG-2014 END End If; IF as_flg = 'NAME' then ls_flg := ls_name; ElsIf as_flg = 'FULLNAME' then ls_flg := ls_fullname; ElsIf as_flg = 'ADDR1' then ls_flg := ls_addr1; ElsIf as_flg = 'ADDR2' then ls_flg := ls_addr2; ElsIf as_flg = 'ADDR3' then ls_flg := ls_addr3; ElsIf as_flg = 'CITY' then ls_flg := ls_city; ElsIf as_flg = 'PIN' then ls_flg := ls_pin; elsif as_flg = 'STATCD' then select descr into ls_stanm from state where state_code = ls_stan; ls_flg := ls_stanm; elsif as_flg='COUNTRY' then select descr into ls_country_descr from country where count_code=ls_count; ls_flg := ls_country_descr; End If; Return ls_flg; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DATA_MART_COLS_X ON DATA_MART_COLS (MART_CODE, TABLE_NAME, COL_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_HSN_SAC (as_sitecode in site.site_code%type,as_itemcode in item.item_code%type,as_acctcode in accounts.acct_code%type) return varchar is ls_hsnno varchar2(20); begin if as_itemcode is null or length(trim(as_itemcode)) =0 then begin select sac_no into ls_hsnno from accounts where acct_code = as_acctcode; exception when others then ls_hsnno := ''; end; else begin select hsn_no into ls_hsnno from siteitem where site_code = as_sitecode and item_code = as_itemcode; exception when others then ls_hsnno := ''; end; if ls_hsnno is null or length(trim(ls_hsnno)) = 0 then begin select hsn_no into ls_hsnno from item where item_code = as_itemcode; exception when others then ls_hsnno := ''; end; end if; end if; return ls_hsnno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PHYSCAN_X ON PHYSCAN (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_FGLOT_PKG (as_order_type in workorder.order_type%type, as_sitecode in site.site_code%type, as_lotnoiss in workorder.lot_no__issue%type) return varchar2 is ls_lotnoiss workorder.lot_no__issue%type; ls_lotnonew varchar2(15); ls_itemcodeconsiderlot item.item_code%type; ls_suffix char(1); ls_Code varchar2(15); ls_udf6 varchar2(5); ls_ref_prefix varchar2(10); ls_year_prefix varchar2(2); ld_Ord_date date; ll_count number(6) := 0; ms_lotnonew varchar2(15); begin IF as_order_type in ('P','R') then begin begin ls_lotnoiss := ltrim(rtrim(as_lotnoiss)) || '' ; --Remove the funcnality of ABCD -- DBMS_OUTPUT.PUT_LINE('LS_LOTNOISS : '||LS_LOTNOISS); select count(1) into ll_count from workorder where site_code = as_sitecode and lot_no like ls_lotnoiss || '%' and lot_no > ls_lotnoiss ; --DBMS_OUTPUT.PUT_LINE('LL_COUNT : '||LL_COUNT); exception when others then ll_count:= 0; end; if ll_count <= 1 then ms_lotnonew := trim(as_lotnoiss) || 'A' ; --Remove the funcnality of ABCD elsif ll_count = 2 and length(trim(as_lotnoiss))=7 and ascii(substr(as_lotnoiss,-1,length(as_lotnoiss))) in (48,49,50,51,52,53,54,55,56,57) then ms_lotnonew := trim(as_lotnoiss) || 'A' ; --Remove the funcnality of ABCD --DBMS_OUTPUT.PUT_LINE('ms_lotnonew IF LL COUNT = 0 : '||ms_lotnonew); else begin select max(lot_no) into ls_lotnonew from workorder where site_code = as_sitecode and lot_no like ls_lotnoiss || '%' and lot_no >= ls_lotnoiss ; --DBMS_OUTPUT.PUT_LINE('LS_LOTNONEW IF LL COUNT > 0 : '||LS_LOTNONEW); exception when others then ls_lotnonew := chr(64); end; ls_lotnonew := trim(ls_lotnonew) ; ls_suffix := substr(ls_lotnonew,-1,length(ls_lotnonew)) ; --DBMS_OUTPUT.PUT_LINE('LS_SUFFIX : '||LS_SUFFIX); ls_suffix := chr(ascii(ls_suffix) + 1); ms_lotnonew := trim(as_lotnoiss) || ls_suffix; --DBMS_OUTPUT.PUT_LINE('ms_lotnonew FINAL : '||ms_lotnonew); end if; end; Else begin ld_Ord_date:= to_date(SYSDATE); SELECT trim(udf6) into ls_udf6 from site where site_code=as_sitecode; Select trim(ud_stat) into ls_year_prefix from period where ld_Ord_date between Fr_date and To_date; ls_ref_prefix := ls_udf6 || ls_year_prefix; SELECT TRIM(ls_ref_prefix)||trim(TO_CHAR((NVL(MAX(substr(Lot_no,4,7)),0)+1),'0000')) INTO ls_Code FROM Workorder WHERE site_code = as_sitecode and Order_type = as_order_type and Lot_no LIKE ls_ref_prefix||'%'; ms_lotnonew := ls_Code; end; End if; return Ms_lotnonew; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_BRAND_PITCH_IDX ON STRG_BRAND_PITCH (DCR_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE CHC_CHEM_MET_DM AS FUNCTION getChemMetInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_MET_TB PIPELINED; END CHC_CHEM_MET_DM; CREATE OR REPLACE PACKAGE BODY CHC_CHEM_MET_DM AS FUNCTION getChemMetInfo (empCode in char, eventDate in Date) RETURN CHC_CHEM_MET_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE eventdate BETWEEN FR_DATE AND TO_DATE; SELECT LISTAGG((A.EMP_CODE ), ',') WITHIN GROUP (order by A.EMP_CODE) INTO MGR_EMPS FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE; for x in ( SELECT STRG_DR.STRG_CODE SC_CODE, STRG_DR.CHEM_NAME, STRG_DR.SPECIALITY, STRG_DR.PLANNED_VISIT, STRG_DR.CLASS, STRG_DR.CATEGORY, STRG_DR.LOCALITY, STRG_DR.ROUTE_TYPE, LISTAGG(TRIM('' || TO_CHAR(STRG_DR.EVENT_DATE,'DD') || ''), ',') WITHIN GROUP (ORDER BY STRG_DR.STRG_CODE) AS MET_DATES, AS_PRD_CODE AS PRD_CODE, STRG_DR.SALES_PERS AS MGR_SUB, STRG_DR.DIVISION, STRG_DR.EMP_CODE, STRG_DR.EMP_NAME, STRG_DR.DESIGN, STRG_DR.HEAD_QUAT, STRG_DR.CHEM_ADDR FROM ( SELECT SM.STRG_CODE, EVENT_DATE, (SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS CHEM_NAME, SPL.DESCR AS SPECIALITY, SS.NO_VISIT AS PLANNED_VISIT, SS.CATEGORY, LOC.DESCR AS LOCALITY, SSC.DESCR CLASS, (SELECT descr FROM SPRS_ROUTE ROUTE WHERE ROUTE.SPRS_CODE = SS.SALES_PERS AND ROUTE.ROUTE_ID = SS.ROUTE_ID) ROUTE_TYPE, SM.SALES_PERS, EMP.EMP_CODE, (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) AS EMP_NAME, ITEMSER.DESCR AS DIVISION, EMP.DESIGNATION as DESIGN, STATION.DESCR AS HEAD_QUAT, (SC.ADDR1 || ' ' || SC.ADDR2 || ' ' || SC.ADDR3) AS CHEM_ADDR FROM STRG_MEET SM LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = SM.STRG_CODE LEFT OUTER JOIN LOCALITY LOC ON SC.LOCALITY_CODE = LOC.LOCALITY_CODE LEFT OUTER JOIN STRG_SERIES SS ON SS.SC_CODE = SM.STRG_CODE AND SS.SALES_PERS = SM.SALES_PERS LEFT OUTER JOIN SALES_PERS SP ON SM.SALES_PERS = SP.SALES_PERS LEFT OUTER JOIN ITEMSER ITEMSER ON SP.ITEM_SER = ITEMSER.ITEM_SER LEFT OUTER JOIN STRG_SER_CLASS SSC ON SSC.ITEM_SER = SP.ITEM_SER AND SSC.CLASS_CODE = SS.CLASS_CODE LEFT OUTER JOIN EMPLOYEE EMP ON EMP.EMP_CODE = SM.SALES_PERS LEFT OUTER JOIN STATION STATION ON EMP.STAN_CODE__HQ = STATION.STAN_CODE LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE = SPL.SPL_CODE WHERE SM.SALES_PERS in (SELECT RPAD(COLUMN_VALUE,10,' ') FROM TABLE( CSV_TO_ROW( (MGR_EMPS) ))) AND SM.EVENT_DATE = eventDate -- AND SM.STRG_TYPE = 'C' -- AND SM.CONFIRMED = 'Y' ) STRG_DR GROUP BY STRG_DR.STRG_CODE,STRG_DR.CHEM_NAME, STRG_DR.SPECIALITY, STRG_DR.PLANNED_VISIT, STRG_DR.CATEGORY, STRG_DR.LOCALITY, STRG_DR.CLASS,STRG_DR.ROUTE_TYPE,STRG_DR.SALES_PERS, STRG_DR.EMP_CODE, STRG_DR.EMP_NAME,STRG_DR.DIVISION,STRG_DR.DESIGN,STRG_DR.HEAD_QUAT,STRG_DR.CHEM_ADDR ORDER BY STRG_DR.PLANNED_VISIT ) LOOP PIPE ROW (CHC_CHEM_MET_MST( x.SC_CODE,x.CHEM_NAME,x.SPECIALITY,x.PLANNED_VISIT,x.CLASS,x.CATEGORY,x.LOCALITY,x.ROUTE_TYPE,x.MET_DATES, x.PRD_CODE, x.MGR_SUB, x.DIVISION, x.EMP_CODE, x.EMP_NAME, x.HEAD_QUAT, x.DESIGN, x.CHEM_ADDR)); END LOOP; RETURN; END; END CHC_CHEM_MET_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DRCRINV_ID (as_invoice char, as_site char ,ls_flag char) return varchar2 is as_drcrinv_det varchar2(1000); as_tranid varchar2(20); as_trandt date; as_drcr_amt number(14,2); as_curr_code varchar2(10); as_exch number(14,2); ctr number(2); cursor c1 is select drcr_invdet.tran_id , drcr_inv.tran_date, ROUND(drcr_invdet.DRCR_AMT,2), drcr_inv.curr_code, ROUND(drcr_inv.exch_rate,2) from drcr_invdet,drcr_inv where drcr_inv.invoice_id =as_invoice and drcr_inv.site_code = as_site and drcr_invdet.tran_id =drcr_inv.tran_id ; begin open c1 ; ctr:=1; loop fetch c1 into as_tranid,as_trandt,as_drcr_amt,as_curr_code,as_exch ; exit when c1%notfound ; if ls_flag = 'I' then if ctr =1 then as_drcrinv_det:= '''||as_tranid||'''; else as_drcrinv_det:= TRIM(as_drcrinv_det)||',''|| TRIM(as_tranid)||'''; end if ; elsif ls_flag = 'D' then if ctr =1 then as_drcrinv_det:= to_char(as_trandt); else as_drcrinv_det:= TRIM(as_drcrinv_det)||' | '|| TRIM(to_char(as_trandt)); end if ; elsif ls_flag = 'A' then if ctr = 1 then as_drcrinv_det:= to_char(as_drcr_amt); else as_drcrinv_det:= TRIM(as_drcrinv_det)||' | '||TRIM( to_char(as_drcr_amt)); end if ; elsif ls_flag = 'C' then if ctr = 1 then as_drcrinv_det:= to_char(as_curr_code); else as_drcrinv_det:= TRIM(as_drcrinv_det)||' | '|| TRIM(to_char(as_curr_code)); end if ; elsif ls_flag = 'R' then if ctr = 1 then as_drcrinv_det:= to_char(as_exch); else as_drcrinv_det:= TRIM(as_drcrinv_det)||' | '|| TRIM(to_char(as_exch)); end if ; end if ; ctr := 0; end loop; close c1; return as_drcrinv_det; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_POSITE_BASE_CURR (as_purcorder porder.purc_order%type) return varchar2 is ls_currcode char(100); begin select a.curr_code into ls_currcode from finent a,site b, porder c where a.fin_entity = b.fin_entity and b.site_code = c.site_code__dlv and c.purc_order = as_purcorder; return ls_currcode; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_NAME (LSUNDRY_TYPE IN CHAR, LSUNDRY_CODE IN CHAR, LNAME IN CHAR) RETURN CHAR IS LS_NAME CHAR(60); LS_FNAME CHAR(20); LS_MNAME CHAR(20); LS_LNAME CHAR(20); BEGIN IF LSUNDRY_TYPE = 'O' THEN LS_NAME := ' '; ELSIF LSUNDRY_TYPE = 'T' THEN IF LNAME = 'C' THEN SELECT chq_name INTO LS_NAME FROM transporter WHERE tran_code = LSUNDRY_CODE; ELSE SELECT tran_name INTO LS_NAME FROM transporter WHERE tran_code = LSUNDRY_CODE; END IF; ELSIF LSUNDRY_TYPE = 'B' THEN SELECT bank_name INTO LS_NAME FROM bank WHERE bank_code = LSUNDRY_CODE; ELSIF LSUNDRY_TYPE = 'X' THEN SELECT tauth_name INTO LS_NAME FROM tax_authority WHERE tauth_code = LSUNDRY_CODE; ELSIF LSUNDRY_TYPE = 'E' THEN select nvl(trim(rtrim(emp_fname)),' ')||' '||nvl(trim(rtrim(emp_lname)),' ') ||' '||nvl(trim(rtrim(emp_mname)),' ') into LS_NAME from employee where emp_code = lsundry_code; ELSIF LSUNDRY_TYPE = 'P' THEN IF LNAME = 'C' THEN SELECT chq_name INTO LS_NAME FROM sales_pers WHERE sales_pers = LSUNDRY_CODE; ELSE SELECT sp_name INTO LS_NAME FROM sales_pers WHERE sales_pers = LSUNDRY_CODE; END IF; ELSIF LSUNDRY_TYPE = 'S' THEN IF LNAME = 'C' THEN SELECT chq_name INTO LS_NAME FROM supplier WHERE supp_code = LSUNDRY_CODE; ELSE SELECT supp_name INTO LS_NAME FROM supplier WHERE supp_code = LSUNDRY_CODE; END IF; ELSIF LSUNDRY_TYPE = 'C' THEN IF LNAME = 'C' THEN SELECT chq_name INTO LS_NAME FROM customer WHERE cust_code = LSUNDRY_CODE; ELSE SELECT cust_name INTO LS_NAME FROM customer WHERE cust_code = LSUNDRY_CODE; END IF; ELSIF LSUNDRY_TYPE = 'L' THEN IF LNAME = 'C' THEN SELECT chq_name INTO LS_NAME FROM loanparty WHERE party_code = LSUNDRY_CODE; ELSE SELECT party_name INTO LS_NAME FROM loanparty WHERE party_code = LSUNDRY_CODE; END IF; END IF; if LS_NAME is null then LS_NAME := ' '; end if; RETURN trim(LS_NAME); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEMSER (as_ref_id in char, as_ref_ser in char) RETURN VARCHAR2 IS ls_ret_itemser VARCHAR2(20); ls_item_ser char(20); begin if as_ref_ser ='S-INV' then select item_ser into ls_item_ser from invoice where invoice.invoice_id = as_ref_id; end if; if as_ref_ser ='DRNRCP' then select item_ser into ls_item_ser from drcr_rcp where drcr_rcp.invoice_id = as_ref_id; end if; if as_ref_ser ='RCP' then select item_ser into ls_item_ser from receipt where receipt.tran_id = as_ref_id; end if ; if as_ref_ser ='M-RCP' then select item_ser into ls_item_ser from misc_receipt where misc_receipt.tran_id =as_ref_id; end if; if as_ref_ser ='CRNRCP' then select item_ser into ls_item_ser from drcr_rcp where drcr_rcp.invoice_id = as_ref_id; end if; if as_ref_ser ='MDRCRC' then select misc_drcr_rcp.item_ser into ls_item_ser from misc_drcr_rcp where misc_drcr_rcp.tran_id =as_ref_id; end if; if as_ref_ser ='MDRCRD' then select item_ser into ls_item_ser from misc_drcr_rcp where misc_drcr_rcp.tran_id =as_ref_id; end if; ls_ret_itemser := ls_item_ser; return (ls_ret_itemser); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_QTYPERPKG (as_itemcode stock.item_code%type, as_lotno stock.lot_no%type, as_packinstr stock.pack_instr%type) return number is ll_qtyperpkg number(14,3); begin select round(nvl(quantity,0)/nvl(no_art,1),3) into ll_qtyperpkg from inv_pack_rcp where item_code = as_itemcode and lot_no = as_lotno and pack_instr = as_packinstr and rownum = 1 ; return ll_qtyperpkg; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BI_ROW_SECURITY_X ON BI_ROW_SECURITY (BA_ID, PROFILE_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXPORT_INV_QTY_PLT (as_tran_id char ,as_qty_flag char,as_flag char) return number is as_amt number(14,3); begin if as_flag = 'INV' then if as_qty_flag ='Q' then select sum(invoice_trace.quantity) into as_amt from invoice_trace where invoice_trace.invoice_id = as_tran_id ; elsif as_qty_flag ='D' then select sum(invoice_trace.discount) into as_amt from invoice_trace where invoice_trace.invoice_id = as_tran_id ; elsif as_qty_flag ='S' then select sum((invoice_trace.quantity * invoice_trace.rate) * invoice_trace.discount /100) into as_amt from invoice_trace where invoice_trace.invoice_id = as_tran_id ; end if; elsif as_flag = 'DES' then if as_qty_flag ='Q' then select sum(despatchdet.quantity) into as_amt from despatchdet where despatchdet.desp_id =as_tran_id; elsif as_qty_flag ='p' then select sum(despatchdet.pallet_wt) into as_amt from despatchdet where despatchdet.desp_id =as_tran_id ; end if; elsif as_flag = 'RCP' then if as_qty_flag ='Q' then select sum(inv_pack_rcp.quantity) into as_amt from inv_pack_rcp where inv_pack_rcp.tran_id =as_tran_id; elsif as_qty_flag ='G' then select sum(inv_pack_rcp.GROSS_WEIGHT) into as_amt from inv_pack_rcp where inv_pack_rcp.tran_id = as_tran_id ; elsif as_qty_flag ='N' then select sum(inv_pack_rcp.net_WEIGHT) into as_amt from inv_pack_rcp where inv_pack_rcp.tran_id = as_tran_id ; elsif as_qty_flag ='T' then select sum(inv_pack_rcp.tare_WEIGHT) into as_amt from inv_pack_rcp where inv_pack_rcp.tran_id = as_tran_id ; elsif as_qty_flag ='P' then select sum(inv_pack_rcp.pallet_wt) into as_amt from inv_pack_rcp where inv_pack_rcp.tran_id = as_tran_id ; elsif as_qty_flag ='O' then select sum(inv_pack_rcp.no_art) into as_amt from inv_pack_rcp where inv_pack_rcp.tran_id = as_tran_id ; end if; end if; if as_amt is null then as_amt :=0; end if; return as_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITE_DESCR ( as_site_code char) return varchar2 is ls_descr site.descr%type; begin begin select descr into ls_descr from site where site_code = as_site_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ADM_EMP_NAME ( as_emp_code char) return varchar2 is ls_name varchar2(50); ls_fname varchar2(15); ls_mname varchar2(15); ls_lname varchar2(15); begin begin select emp_fname,emp_mname,emp_lname into ls_fname,ls_mname,ls_lname from employee where emp_code = trim(as_emp_code); exception when no_data_found then ls_name := null; end; ls_name := ls_fname||' '||ls_mname||' ' ||ls_lname; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DESPATCH_DESP_DATE_CONF ON DESPATCH (DESP_DATE, SITE_CODE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MACHINE_LOAD_X ON MACHINE_LOAD (SITE_CODE, LOAD_DATE, WORK_CTR, MC_CODE, DAY_NO, SHIFT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RIGHTCHAR_STAR_TITLE ( as_Obj_Name IN varchar2,as_IN_CHAR IN CHAR,as_form_no in varchar2 ) RETURN varchar2 is ls_ret_val varchar2(500):= ''; c_title varchar2(50):= ''; CURSOR c_objact is select trim(title) from obj_actions where obj_name =as_Obj_Name and form_no=as_form_no UNION select trim(LINK_title) from OBJ_LINKS Where obj_name = as_Obj_Name and form_no= as_form_no; Begin BEGIN OPEN c_objact; LOOP FETCH c_objact into c_title; EXIT WHEN c_objact%notfound; ls_ret_val := ls_ret_val ||c_title||','; END LOOP; CLOSE c_objact; IF LENGTH(ls_ret_val)> 0 THEN ls_ret_val := SUBSTR (ls_ret_val ,1,LENGTH(ls_ret_val)-1) ||' '; END IF; Return ls_ret_val; End; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_BANK_NAME ( as_ref_ser char, as_ref_id char) return varchar2 is ls_bank_code char(10); ls_bank_name varchar2(70); begin begin select bank_code into ls_bank_code from banktran_log where tran_no = as_ref_id and tran_ser = as_ref_ser and rownum = 1; exception when no_data_found then ls_bank_name := null; end; select bank_name into ls_bank_name from bank where bank_code = ls_bank_code; return ls_bank_code ||' '||ls_bank_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE POPHELPPACKAGE1 AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN sundryMasterTable PIPELINED; END; CREATE OR REPLACE PACKAGE BODY POPHELPPACKAGE1 AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN sundryMasterTable PIPELINED IS BEGIN IF asSyndryType = 'E' THEN FOR x IN (SELECT EMPLOYEE.EMP_CODE, EMPLOYEE.EMP_FNAME||' '||EMPLOYEE.EMP_MNAME||' '||EMPLOYEE.EMP_LNAME AS EMP_NAME,TRIM(STATION.DESCR) as CITY, TRIM(DEPARTMENT.DESCR) AS DIVISION, TRIM(STATE.DESCR) AS STATE FROM EMPLOYEE, SITE, STATION, DEPARTMENT, STATE WHERE EMPLOYEE.WORK_SITE = SITE.SITE_CODE (+) AND EMPLOYEE.STAN_CODE__HQ = STATION.STAN_CODE (+) AND STATION.STATE_CODE = STATE.STATE_CODE (+) AND EMPLOYEE.DEPT_CODE = DEPARTMENT.DEPT_CODE (+) AND (EMPLOYEE.WORK_SITE in ( asLoginSite)) ) LOOP PIPE ROW (sundryMaster(x.EMP_CODE,x.EMP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'S' THEN FOR x IN (SELECT SUPPLIER.SUPP_CODE, SUPPLIER.SUPP_NAME, TRIM(NVL(SUPPLIER.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SUPPLIER, STATE WHERE nvl(SUPPLIER.BLACK_LIST,'N') != 'Y' AND SUPPLIER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SUPP_CODE,x.SUPP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'C' THEN FOR x IN (SELECT CUSTOMER.CUST_CODE, CUSTOMER.CUST_NAME, CUSTOMER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM CUSTOMER, STATE WHERE CUSTOMER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.CUST_CODE,x.CUST_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'T' THEN FOR x IN (SELECT TRANSPORTER.TRAN_CODE, TRANSPORTER.TRAN_NAME, TRANSPORTER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TRANSPORTER, STATE WHERE TRANSPORTER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.TRAN_CODE,x.TRAN_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'P' THEN FOR x IN (SELECT SALES_PERS.SALES_PERS, SALES_PERS.SP_NAME, SALES_PERS.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SALES_PERS, STATE WHERE SALES_PERS.ACTIVE_YN <> 'N' AND SALES_PERS.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SALES_PERS,x.SP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'X' THEN FOR x IN (SELECT TAX_AUTHORITY.TAUTH_CODE, TAX_AUTHORITY.TAUTH_NAME, TAX_AUTHORITY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TAX_AUTHORITY, STATE WHERE TAX_AUTHORITY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.TAUTH_CODE,x.TAUTH_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'L' THEN FOR x IN (SELECT LOANPARTY.PARTY_cODE, LOANPARTY.PARTY_NAME, LOANPARTY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM LOANPARTY, STATE WHERE LOANPARTY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.PARTY_CODE,x.PARTY_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'R' THEN FOR x IN (SELECT STRG_CUSTOMER.SC_cODE, STRG_CUSTOMER.FIRST_NAME||' '||STRG_CUSTOMER.MIDDLE_NAME||' '||STRG_CUSTOMER.LAST_NAME AS SC_NAME, CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM STRG_CUSTOMER, STATE WHERE STRG_CUSTOMER.STATUS ='A' AND STRG_CUSTOMER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SC_CODE,x.SC_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'B' THEN FOR x IN (SELECT BANK.BANK_CODE, BANK.BANK_NAME, BANK.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM BANK, STATE WHERE BANK.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.BANK_CODE,x.BANK_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; END popHelpPackage1; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYROLL_EMP_CODE_VOUCHER_NO ON PAYROLL (EMP_CODE, VOUCHER_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_ECONT_INSERT BEFORE INSERT on entity_contact referencing old as old new as new FOR EACH ROW declare ls_maxline varchar2(10); ll_maxline number := 0; ll_count number := 0; ls_contact varchar2(20); BEGIN if :new.CONTACT_PERS is null and :new.entity_type = 'S' then begin select max(to_number(trim(seq_no))) into ll_maxline from refseq where ref_ser = 'SUPP' and ref_prefix = :new.entity_code ; exception when others then ll_maxline := 0; end; if ll_maxline is null then ll_maxline := 0; end if; ll_maxline := ll_maxline + 1; begin --:new.CONTACT_PERS SELECT lpad(to_char(ll_maxline),10,'0') INTO ls_contact FROM dual; exception when others then ls_contact := '0000000001'; end; :new.CONTACT_PERS := ls_contact; select count(1) into ll_count from refseq where ref_ser = 'SUPP' and ref_prefix = :new.entity_code; begin if ll_count = 0 then insert into refseq (REF_SER,REF_PREFIX,SEQ_NO, CHG_DATE, CHG_USER,CHG_TERM) values ('SUPP',:new.entity_code,ls_contact,sysdate,'SYSTEM','SYSTEM'); else update refseq set seq_no = lpad(to_char(ll_maxline),10,'0') where ref_ser = 'SUPP' and ref_prefix = :new.entity_code; end if; exception when others then :new.CONTACT_PERS := '0000000001'; end; end if; enD; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRV_OS (as_sundry_type in misc_payables.sundry_type%type, as_sundry_code in misc_payables.sundry_code%type) RETURN number IS type cursor1 is ref cursor; misc_cur cursor1; misc_sql_stmt varchar2(3000); misc_amt number; cnumber number; begin misc_sql_stmt :='select (SUM(TOT_AMT)-SUM(ADJ_AMT)) as amount from misc_payables where sundry_type = '''||as_sundry_type||''' and sundry_code = '''||as_sundry_code||''' and (TOT_AMT - ADJ_AMT) <> 0'; misc_amt := 0; cnumber :=0; open misc_cur for misc_sql_stmt; loop FETCH misc_cur INTO misc_amt; EXIT WHEN misc_cur%NOTFOUND; if misc_cur%found then cnumber := misc_amt; if cnumber IS null then return 0; else return cnumber; end if; END IF; END LOOP; close misc_cur; return cnumber; --exception when others then END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_NAME_REF_SER_WISE ( ls_ref_ser char, ls_tran_id char) RETURN VARCHAR is ls_sundry_name VARCHAR(100); begin if ls_ref_ser = 'E-PAY' then select fn_sundry_name (sundry_type,sundry_code,'N') into ls_sundry_name from payment_exp where tran_id = ls_tran_id; elsif ls_ref_ser = 'M-PAY' then select fn_sundry_name (sundry_type,sundry_code,'N') into ls_sundry_name from misc_payment where tran_id = ls_tran_id; end if; if ls_sundry_name is null then ls_sundry_name := ''; end if; return ls_sundry_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_JWRK_DT (as_login in varchar, as_sales_ww in varchar, as_fr_date in date,as_to_date in date) return varchar is as_value varchar(1000); first_date date; prev_date date; CURSOR c1 iS select distinct event_date from strg_meet where trim(sales_pers) = as_login and event_date >= as_fr_date and event_date <= as_to_date and trim(sprs_code__ww) = as_sales_ww and event_type = 'JW' order by event_date desc; begin FOR I IN C1 loop first_date := i.event_date; if as_value is null then as_value := to_char(first_date,'dd/MM/yy'); elsif as_value is not null then as_value := as_value || ',' || to_char(first_date,'dd/MM/yy') ; else exit; end if; end loop; return as_value ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LOAN_SCHEME_DESCR ON LOAN_SCHEME (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRAN_SITE_DATE ON GLTRAN (SITE_CODE, TRAN_DATE, ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 458752 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_RCP_ISSUE_REF ON DISTORD_RCP (ISSUE_REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_UNIT_CONV_TO (as_item_code in char,as_unit_fr in char ) return char is ls_unit_to char(10); begin select unit__to into ls_unit_to from uomconv where UNIT__FR = as_unit_fr and item_code = as_item_code and rownum <= 1; return ls_unit_to; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_ACTUAL_WDAYS (AS_EMP_CODE CHAR,AS_DATE_FR DATE,AS_DATE_TO DATE,AS_WHB_TAG char) return number is a_days number(3) := (AS_DATE_TO-AS_DATE_FR+1); a_count number(3); a_tot_wh number(3) := 0; a_hol_tblno employee.hol_tblno%type; begin for i in 1..a_days loop select ddf_get_holtblno(AS_EMP_CODE,(AS_DATE_FR+i-1)) into a_hol_tblno from dual; if (AS_WHB_TAG = 'W') then select nvl(count(hol_date),0) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = (AS_DATE_FR+i-1) and hol_type = 'W'; elsif (AS_WHB_TAG = 'H') then select nvl(count(hol_date),0) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = (AS_DATE_FR+i-1) and hol_type = 'H'; else select nvl(count(hol_date),0) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = (AS_DATE_FR+i-1); end if; if (a_count > 0) then a_tot_wh := a_tot_wh + 1; end if; end loop; return (AS_DATE_TO-AS_DATE_FR+1)-a_tot_wh; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXP_DATE (as_tranid in char,as_lotno in char,ad_mfgdate in date,as_from char,as_itemcode in char) return date is li_shelf_life number(3) := 0; ld_expdate date; ls_track_shelf_life char(1); begin begin select track_shelf_life,shelf_life-1 into ls_track_shelf_life,li_shelf_life from item where item_code = as_itemcode ; end; select (case when ls_track_shelf_life ='Y' then last_day(add_months(ad_mfgdate, li_shelf_life)) else null end) into ld_expdate from dual; return (ld_expdate); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SPACE (as_num in number) return varchar2 is ls_string varchar2(1000); begin select lpad(' ' , as_num) into ls_string from dual; return ls_string; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_DET_TRAN (ls_tran_code in char,ls_tran_id in char, ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value char(30); lc_exch_rate number(17,6); begin select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(abs(tax_amt),0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select AVG(abs(tax_perc)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select SUM(NVL(abs(taxable_amt),0)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; --tax count if ls_type = 'C' then select count(*) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then select exch_rate into lc_exch_rate from invoice where invoice_id = ls_tran_id ; if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_VALUE_PURCHASE ( ls_tran_code In Char, ls_tran_id In Char, ls_line_no In Char, ls_tax_type In Char) return decimal is lc_retval decimal(17,6); lc_tax_amt decimal(17,6); ls_lineno char(3); begin ls_lineno := ls_line_no; if (length(trim(ls_lineno)) = 1) then ls_lineno := concat(' ',trim(ls_lineno)); end if; if (length(trim(ls_lineno)) = 2) then ls_lineno := concat(' ',trim(ls_lineno)); end if; if ls_tax_type = 'e' then select sum ( taxtran.tax_amt ) into lc_tax_amt from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_lineno and tax.tax_type = ls_tax_type and tax_amt > 0 and taxtran.effect <> 'N'; elsif ls_tax_type = 's' then select sum ( taxtran.tax_amt ) into lc_tax_amt from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_lineno and tax.tax_type = ls_tax_type and tax_amt > 0 and taxtran.effect <> 'N'; else select sum ( taxtran.tax_amt ) into lc_tax_amt from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_lineno and tax.tax_type not in ( 'S' , 'E' , 'D' ) and tax_amt > 0 and taxtran.effect <> 'N'; end if; return lc_tax_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUN_ITEM_USAGE (mitem_code in char) return char is musage item.item_usage%type; begin select item_usage into musage from item where item_code = mitem_code; return musage; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITEM_INV_REC_X ON ITEM_INV_REC (SITE_CODE, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PLACE_TIME_ENT_IDX ON PLACE_TIME_ENT (ENTITY_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_FORM16A_DATE (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_date varchar2(50) ; ls_date_det varchar2(50); ctr number(3); cursor c1 is select nvl(to_char(handover_date,'dd/mm/yy'),'') from misc_payment where tran_id in ( select tran_id from misc_paydet where tran_ser = 'M-VOUC' and vouch_no = ls_vouch_no ) order by handover_date desc ; begin open c1; ctr := 0; ls_date := ' ' ; loop fetch c1 into ls_date_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_date_det)) > 0 then ls_date_det := ','||ls_date_det ; end if ; end if ; ls_date := rtrim(ls_date)||''|| ls_date_det ; ctr := ctr + 1; end loop ; close c1; return ls_date ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ARREARDET_PRD_ACC_EMP_AD ON ARREARDET (PRD_CODE__ACC, EMP_CODE, AD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX HUNDI_PAY_DT_X ON HUNDI_PAY_DT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SORD_CONF ON SORDER (CONF_DATE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_SORD_NO (as_workorder in char) return varchar2 is ls_retval varchar2(10); ls_saleorder varchar2(10); ls_saleorderend varchar2(10); begin select sale_order, sale_order__end into ls_saleorder, ls_saleorderend from workorder where work_order = as_workorder ; if (ls_saleorderend is not null) and (length(ltrim(rtrim(ls_saleorderend))) > 0) then return ls_saleorderend; else if (ls_saleorder is not null) and (length(ltrim(rtrim(ls_saleorder))) > 0) then return ls_saleorder; else return 'X'; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PRODUCT_DIM_PROD_SER ON PRODUCT_DIM (PRODUCT_SERIES) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INCPARM_X ON INCPARM (ITEM_SER, LEVEL_NO, LEVEL_CODE, PAR_NAME, PAR_LINE_NO, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SIGN (ls_porder char) return varchar2 is ls_sign varchar2(500); li_count integer; ls_code char(10); ls_for varchar2(50); cursor cur_args is SELECT OBJ_SIGN_TRANS.EMP_CODE, OBJ_SIGN_TRANS.SIGN_FOR FROM PORDER,OBJ_SIGN_TRANS WHERE (PORDER.PURC_ORDER = OBJ_SIGN_TRANS.REF_ID ) and (OBJ_SIGN_TRANS.REF_SER = 'P-ORD' ) AND (PURC_ORDER = ls_porder); begin select a.emp_code into ls_sign from users a,porder b where b.chg_user = a.code and b.purc_order = ls_porder; ls_sign := ls_sign || '|' || 'Checked By/Prepared By'; li_count := 2; open cur_args; loop fetch cur_args into ls_code,ls_for; exit when cur_args%NOTFOUND; if li_count = 5 then exit; end if; ls_sign := ls_sign || '|' || ls_code || '|' || ls_for; ls_code := ' '; ls_for := ' '; li_count := li_count + 1; end loop; close cur_args; if li_count = 2 then ls_sign := ls_sign || '|' || '0' || '|' || ' '; li_count := li_count + 1; end if; if li_count = 3 then ls_sign := ls_sign || '|' || '0' || '|' || ' '; li_count := li_count + 1; end if; if li_count = 4 then ls_sign := ls_sign || '|' || '0' || '|' || ' '; li_count := li_count + 1; end if; return ls_sign; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WFBK_OVERHEADS_TRANFLOW (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(100); v_str_tmp1 varchar2(100); v_str_tmp2 varchar2(100); v_str_tmp3 varchar2(100); v_str_tmp4 varchar2(100); v_str_tmp5 varchar2(100); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for SELECT HEAD.OVERHEAD_DESC, WBK_HEAD.OVERHEAD_TYPE,WBK_HEAD.OVERHEAD_AMT,WBK_HEAD.AMOUNT,WBK_HEAD.ACCT_CODE,WBK_HEAD.CCTR_CODE FROM WORKORDER_FEEDBACK_OVERHEADS WBK_HEAD, OVERHEAD HEAD WHERE HEAD.OVERHEAD_CODE = WBK_HEAD.OVERHEAD_CODE AND WBK_HEAD.TRAN_ID = as_tran_id; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4,v_str_tmp5; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''||v_str_tmp3||''||''||v_str_tmp4||''||''||v_str_tmp5||''||''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Overhead '||''||''||'Overhead Type'||''||''||'Overhead Amount '||''||''||'Amount'||''||''||'Account Code'||''||''||'Cost Centre'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_RECOREC (as_workorder in char, as_trantype in char, as_itemcode in char) return varchar2 is ll_enhcount number(6,0) := 0; ll_bypcount number(6,0) := 0; ll_reccount number(6,0) := 0; ls_retval varchar2(1) := '0'; begin begin -- check whether recovery added select count(1) into ll_enhcount from workorder_enhanc a, workorder_enhanc_det b where a.tran_id = b.tran_id and a.work_order = as_workorder; exception when no_data_found then ll_enhcount := 0; end; if as_trantype = 'B' and ll_enhcount > 0 then -- by-product receipt not allowed as recovery added ls_retval := '1' ; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXPRESSION ( as_mathcpotancy in char , iss_qty_al in number, iss_qty in number ,expr_bill_over_perc in char , expr_bill_potency_adj in number ,expr_bill_adj_potency in char , bom_calc_mth_descr in varchar2) return varchar2 is ls_expression varchar2(150); -- Created by Brijesh Soni on 08-01-07 as per new logic require in the function. -- -- Numbers declaration. -- cnt number ; l_len number; firstTimeFound number; l_firstCommaPos number; l_SecondCommaPos number; -- String declaration ls_comments varchar2(150) ; ls_data varchar2(50); ls_comm_wid_data varchar2(150); ls_method_code varchar2(10); ls_comm varchar2(150); ls_comm1 varchar2(150); ls_data1 varchar2(50) ; ls_data2 varchar2(50) ; ls_rep_data varchar2(50) ; var2 varchar2(50) ; ls_water varchar2(50) ; ls_claim varchar2(150); ls_adj_potency varchar2(10) ; -- Started begin cnt := 1; firstTimeFound := 0; l_SecondCommaPos := 0; l_firstCommaPos := 0 ; if as_mathcpotancy = 'Y' then begin var2 := expr_bill_over_perc || ',' ; l_len := length(var2); while l_len > 0 loop if substr(var2,cnt,1) = ',' then if firstTimeFound = 0 then l_firstCommaPos := cnt; firstTimeFound := 1; cnt := cnt + 1 ; else l_SecondCommaPos := cnt; exit; end if; else cnt := cnt + 1 ; end if; l_len := l_len-1 ; end loop ; if l_firstCommaPos <= 0 or l_SecondCommaPos <= 0 then var2 := 'INVALIDDATA. ' ; else var2 := substr(expr_bill_over_perc,l_firstCommaPos+1,l_SecondCommaPos-l_firstCommaPos-1) ; ls_water := substr(expr_bill_over_perc,l_SecondCommaPos+1,l_len) ; end if ; -- For Set the data as per the function to display firstTimeFound := 0; l_SecondCommaPos := 0; l_firstCommaPos := 0 ; l_len := 0 ; -- get Method code from below SQL select method_code into ls_method_code from bom_calc_mth where descr = bom_calc_mth_descr; -- get the comments from above get method select trim(comm_text) into ls_comments from comments where REF_SER = 'EXPR' and trim(REF_ID) = trim(ls_method_code); -- get the length of comments , loop till comments is End ls_comm := ls_comments ; l_len := length(ls_comm) ; cnt := 1 ; while l_len > 0 loop if substr(trim(ls_comm),cnt,1) = ':' then if firstTimeFound = 0 then l_firstCommaPos := cnt; -- 3 cnt := cnt + 1 ; firstTimeFound := 1; else l_SecondCommaPos := cnt; --15 ls_data := SUBSTR(trim(ls_comm), l_firstCommaPos + 1 , l_SecondCommaPos-l_firstCommaPos-1); if length(trim(ls_data)) > 0 then if ls_rep_data is null or length(trim(ls_rep_data)) = 0 then ls_rep_data := to_char(iss_qty) ; end if; ls_claim := replace(ls_comm, ':'||ls_data ||':' , ls_rep_data ) ; ls_comm := ls_claim ; cnt := 1 ; l_len := length(ls_comm) ; if length(trim(ls_rep_data)) > 0 then if ls_rep_data = to_char(iss_qty) then ls_rep_data := var2; else ls_rep_data := ls_water; end if; end if; end if ; cnt := cnt + 1 ; l_firstCommaPos := 0; firstTimeFound := 0; end if; else cnt := cnt + 1; end if; l_len := l_len-1 ; l_SecondCommaPos := 0; end loop; end; if ls_comm is null or length(trim(ls_comm)) = 0 then ls_expression := 'INVALIDDATA in comments. ' ; else ls_expression := TO_CHAR(round(iss_qty_al,3)) || ' = ' || ls_comm ; end if; elsif expr_bill_potency_adj <> 0 then -- the data is not setisfied from above two codition then return null if expr_bill_potency_adj < 1 and expr_bill_potency_adj > 0 then ls_adj_potency := '0' || to_char(expr_bill_potency_adj) ; else -- if expr_bill_potency_adj < 0 then -- ls_adj_potency := '0' || to_char(expr_bill_potency_adj) ; -- else ls_adj_potency := to_char(expr_bill_potency_adj ); -- end if; end if; -- ls_expression := TO_CHAR(expr_bill_adj_potency) || '(' || TO_CHAR(expr_bill_potency_adj) || ')' ; ls_expression := expr_bill_adj_potency || ' ( ' || ls_adj_potency || ' ) ' ; else ls_expression := '' ; end if ; --Ending of the function by returning the Expression return ls_expression; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE CHC_CHEM_UNLIST_DM AS FUNCTION getChemUnlistCustInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_UNLIST_TB PIPELINED; END CHC_CHEM_UNLIST_DM; CREATE OR REPLACE PACKAGE BODY CHC_CHEM_UNLIST_DM AS FUNCTION getChemUnlistCustInfo (empCode in char, eventDate in Date) RETURN CHC_CHEM_UNLIST_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE, code INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE, AS_PRD_CODE FROM PERIOD WHERE eventdate BETWEEN FR_DATE AND TO_DATE; SELECT LISTAGG((A.EMP_CODE ), ',') WITHIN GROUP (order by A.EMP_CODE) INTO MGR_EMPS FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE; for x in ( select Sm.strg_code SC_CODE, Sm.strg_name CHEM_NAME ,SSC.DESCR CLASS, LOC.DESCR AS ROUTE_TYPE, '' AS PRD_CODE, SM.SALES_PERS as MGR_SUB, sm.addr1 || ' ' || sm.addr2 || ' ' || sm.addr3 as CHEM_ADDR from strg_cust_add Sca LEFT OUTER JOIN strg_meet SM ON sm.strg_code = sca.strg_code and sm.sales_pers = sca.sales_pers LEFT OUTER JOIN SALES_PERS SP ON Sca.SALES_PERS = SP.SALES_PERS LEFT OUTER JOIN ITEMSER ITEMSER ON SP.ITEM_SER = ITEMSER.ITEM_SER LEFT OUTER JOIN STRG_SER_CLASS SSC ON SSC.ITEM_SER = SP.ITEM_SER AND SSC.CLASS_CODE = SM.strg_class_code LEFT OUTER JOIN LOCALITY LOC ON SM.LOCALITY_CODE = LOC.LOCALITY_CODE where Sm.event_date = eventDate and SM.sales_pers in ( SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) ) LOOP PIPE ROW (CHC_CHEM_UNLIST_MST( x.SC_CODE,x.CHEM_NAME,x.ROUTE_TYPE,x.CLASS,x.CHEM_ADDR,x.PRD_CODE, x.MGR_SUB)); END LOOP; RETURN; END; END CHC_CHEM_UNLIST_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ANALYSIS_DESCR ON ANALYSIS (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_SRET_SUMMARY_SITE_PRD_CUST ON INV_SRET_SUMMARY (SITE_CODE, PRD_CODE, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMPLANG_EMPLANG ON EMPLANG (EMP_CODE, LANGUAGE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SMS_STATUS_X ON SMS_STATUS (RECIVER_NUMBER, MSG_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_WFBK_QTYRPT BEFORE insert or update ON workorder_feedback referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; lcTot number(28,17) := 0; lcStdTot number (28,17) := 0; BEGIN if :new.qty_reported <> :new.qty_feedback or nvl(:new.qty_feedback,0) = 0 then raise_application_error( -20601, 'Feedback quantity [' ||to_char(:new.qty_feedback) ||'] quantity reported [' || to_char(:new.qty_reported) || '] should be same and cannot be 0' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_DET (AS_EMP_CODE in char) RETURN VARCHAR2 IS AS_EMP_NAME VARCHAR2(60); AS_EMP_DESIGN VARCHAR2(30); AS_EMP_HQ VARCHAR2(50); BEGIN SELECT (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) EMP_NAME, EMP.DESIGNATION, STATION.DESCR INTO AS_EMP_NAME, AS_EMP_DESIGN, AS_EMP_HQ FROM EMPLOYEE EMP LEFT OUTER JOIN STATION STATION ON EMP.STAN_CODE__HQ = STATION.STAN_CODE WHERE EMP.EMP_CODE = AS_EMP_CODE; RETURN AS_EMP_NAME || '~~' || AS_EMP_DESIGN || '~~' || AS_EMP_HQ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPRS_PLAN_PLACE_X ON SPRS_PLAN_PLACE (PLAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALES_BUDGET_LEVE_ITEM ON SALES_BUDGET (LEVEL_CODE, PRD_CODE, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_MPR_GRADE_KRA ON MPR_GRADE_KRA (MPR_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INVRATEAMT (as_itemcode in invoice_trace.item_code%type,as_lotsl in invoice_trace.lot_sl%type) return number is lc_newrate number(12,3) := 0; begin begin select taxrate.rate into lc_newrate from taxrate, taxset where taxrate.tax_set = taxset.tax_set and taxset.tax_chap = as_itemcode and taxset.tax_table = as_lotsl and taxset.slab_base = 'Q'; exception when others then lc_newrate := 0; end; return lc_newrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DATE_VIJ ( as_ref_id IN CHAR, as_refser IN CHAR, as_sundry_code IN CHAR, as_tran_id IN CHAR) RETURN DATE IS ls_fieldvalue DATE; li_cnt NUMBER := 0; BEGIN BEGIN ls_fieldvalue := '' ; IF rtrim(as_refser) = 'M-PAY' THEN SELECT rtrim(ref_date) INTO ls_fieldvalue FROM misc_payment WHERE tran_id = as_ref_id ; END IF; IF rtrim(as_refser) = 'P-IBCA' THEN SELECT COUNT(*) INTO li_cnt FROM pay_ibca_det WHERE tran_id = as_ref_id AND sundry_code = as_sundry_code AND ABS(tot_amt) = (SELECT ABS( (dr_amt * exch_rate) - ( cr_amt * exch_rate) ) FROM gltrace WHERE tran_id = as_tran_id ) ; IF li_cnt = 1 THEN SELECT rtrim(ref_date) INTO ls_fieldvalue FROM pay_ibca_det WHERE tran_id = as_ref_id AND sundry_code = as_sundry_code AND ABS(tot_amt) = (SELECT ABS( (dr_amt * exch_rate) - ( cr_amt * exch_rate) ) FROM gltrace WHERE tran_id = as_tran_id ) ; li_cnt := 0; END IF; END IF; IF rtrim(as_refser) = 'RCP' THEN SELECT ref_date INTO ls_fieldvalue FROM receipt WHERE tran_id = as_ref_id; END IF; EXCEPTION WHEN no_data_found THEN ls_fieldvalue := '' ; END; RETURN LTRIM(RTRIM(ls_fieldvalue)); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISCRCP_REFNO BEFORE INSERT or UPDATE OF ref_no ON MISC_RECEIPT referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DELETE_BATCHLOAD (msite in char,mdate in date) is ctr number; maxbatch varchar2(15); curtim varchar2(50); cursor c2 is select batch_id,tran_sl from batchload where substr(batch_id,1,3) = msite and tran_sl > 0 and trunc(chg_date) <= mdate --- and ( load_stat = 'Y' or repl_status = 'Y') order by batch_id,tran_sl; begin select to_char(sysdate,'ddmmyyyy hh24:mi:ss') into curtim from dual; dbms_output.put_line('Deleting for site : '||msite||' started at : '||curtim||' upto : '||mdate); ctr := 0; for m2 in c2 loop maxbatch := m2.batch_id; if ctr = 0 then dbms_output.put_line('First ID : '||m2.batch_id); end if; set transaction use rollback segment rb_temp; delete from batchloaddet where batch_id = m2.batch_id and tran_sl = m2.tran_sl; delete from batchload where batch_id = m2.batch_id and tran_sl = m2.tran_sl; delete from batchload_status where batch_id = m2.batch_id and tran_sl = m2.tran_sl and tran_id__ser > '0'; commit; ctr := ctr + 1; if mod(ctr,250) = 0 then select to_char(sysdate,'ddmmyyyy hh24:mi:ss') into curtim from dual; dbms_output.put_line(to_char(ctr)||' records deleted at : '||curtim); end if; end loop; dbms_output.put_line('Last id : '||maxbatch); select to_char(sysdate,'ddmmyyyy hh24:mi:ss') into curtim from dual; dbms_output.put_line(to_char(ctr)||' records deleted at : '||curtim); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MOVING_REF ( as_sitecode in site.site_code%type, as_itemcode in item.item_code%type, adt_asondate in date, as_reftype in char) return char is ls_retval varchar2(30); ls_tranid char(10) ; ldt_trandate date; begin if as_reftype = 'P' then --- Last PO Ref select max(a.ord_date) into ldt_trandate from porder a, porddet b where a.purc_order = b.purc_order and a.site_code__dlv = as_sitecode and b.item_code = as_itemcode and a.ord_date <= adt_asondate; select max(a.purc_order) into ls_tranid from porder a, porddet b where a.purc_order = b.purc_order and a.ord_date = ldt_trandate and a.site_code__dlv = as_sitecode and b.item_code = as_itemcode ; end if; if as_reftype = 'I' then ---- Last Issue Ref select max(eff_date) into ldt_trandate from invtrace where site_code = as_sitecode and item_code = as_itemcode and ref_ser in ('C-ISS','W-ISS','S-DSP') and eff_qty < 0 and eff_date <= adt_asondate; select max(ref_id) into ls_tranid from invtrace where site_code = as_sitecode and item_code = as_itemcode and ref_ser in ('C-ISS','W-ISS','S-DSP') and eff_qty < 0 and eff_date = ldt_trandate; end if; if as_reftype = 'R' then ---- Last Receipt Ref select max(eff_date) into ldt_trandate from invtrace where site_code = as_sitecode and item_code = as_itemcode and ref_ser = 'P-RCP' and eff_qty > 0 and eff_date <= adt_asondate; select max(ref_id) into ls_tranid from invtrace where site_code = as_sitecode and item_code = as_itemcode and ref_ser = 'P-RCP' and eff_qty > 0 and eff_date = ldt_trandate; end if; if ls_tranid is null then ls_tranid := ' '; end if; ls_retval := ls_tranid || ' ' || to_char(ldt_trandate,'dd/mm/yy') ; if ls_retval is null then ls_retval := ' '; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TRADING_EXCISE_TAX (as_tran_code taxtran.tran_code%type,as_tran_id taxtran.tran_id%type,as_flag char) return number is lc_excise number; ls_var varchar2(1000); begin if as_flag='EXCISE' then SELECT var_value into ls_var from disparm where var_name ='EXC_TAX_CODE_MODVAT'; elsif as_flag='CESS' then SELECT var_value into ls_var from disparm where var_name ='CESS_TAX_CODE_MODVAT'; elsif as_flag='SHEC' then SELECT var_value into ls_var from disparm where var_name ='SHEC_TAX_CODE_MODVAT'; elsif as_flag='GJST' then SELECT var_value into ls_var from disparm where var_name ='GJST_TAX_CODE_MODVAT'; end if; SELECT nvl(sum(taxtran.tax_amt * ddf_get_exch_rate( as_tran_id,as_tran_code) ),0) into lc_excise FROM taxtran WHERE taxtran.tran_code = as_tran_code and taxtran.tran_id = as_tran_id and taxtran.tax_perc > 0 and INSTR(trim(ls_var),trim(taxtran.tax_code))>0 ; return lc_excise; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUM_LOAN_RECO (as_loan_no CHAR, ld_date_fr DATE, ld_date_to DATE) return NUMBER is lc_sum_reco NUMBER(14,2) := 0.00; ls_reco_no CHAR(10); BEGIN SELECT ddf_get_ref_loan(as_loan_no, ld_date_fr, ld_date_to) into ls_reco_no from dual; SELECT sum(loan_reco.reco_amt) into lc_sum_reco FROM loan_reco, loans WHERE ( loan_reco.loan_no = loans.loan_no ) and ( ( loan_reco.loan_no = as_loan_no ) AND ( loan_reco.confirmed = 'Y' ) and ( loan_reco. RECO_DATE >=ld_date_fr and loan_reco.reco_date <= ld_date_to ) and ( ls_reco_no is null or loan_reco.reco_no <> ls_reco_no)) ; if lc_sum_reco is null then lc_sum_reco := 0.00; end if ; return lc_sum_reco; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ALLOC_ISSQTY ( as_workorder in char, as_sitecode in char, as_itemcode in char, as_explev in char, as_loccoode in char, as_lotno in char, as_lotsl in char ) Return Number is ld_qty number(14,3); Begin BEGIN Select sum(case when B.quantity is null then 0 else B.quantity+NVL(B.POTENCY_ADJ,0) end) Into ld_qty From workorder_iss A, workorder_issdet B Where A.tran_id = B.tran_id And A.work_order = as_workorder And A.site_code = as_sitecode And B.item_code = as_itemcode And B.exp_lev = as_explev And B.loc_code = as_loccoode And B.lot_no = as_lotno And B.lot_sl = as_lotsl And case when A.confirmed is null then 'N' else A.confirmed end = 'N' and case when a.status is null then 'N' else a.status end <> 'X'; Exception When NO_DATA_FOUND then return 0; END; Return ld_qty; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LEAVEBAL ( AS_EMP_CODE CHAR , AS_LEAVE_CODE CHAR , AD_DATE DATE ) RETURN NUMBER IS LC_BAL_DAYS NUMBER( 12 , 2 ); BEGIN LC_BAL_DAYS := 0; BEGIN SELECT SUM(BAL_DAYS) INTO LC_BAL_DAYS FROM LEAVEBAL WHERE EMP_CODE = AS_EMP_CODE AND LVE_CODE = AS_LEAVE_CODE AND EXP_DATE >= NVL( AD_DATE , TO_DATE( SYSDATE ) ); EXCEPTION WHEN NO_DATA_FOUND THEN LC_BAL_DAYS := 0 ; END; RETURN( LC_BAL_DAYS ); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_DESCRIPTION (VI_REF_SER IN CHAR,VI_REF_ID IN CHAR, VI_PTCN IN VARCHAR) RETURN VARCHAR2 IS TEMP_DESCR VARCHAR2(200); CNT1 NUMBER; --TEMP_DESCR VARCHAR2(200); TEMP_HAZARDOUS CHAR; TEMP_ITEM_CODE CHAR(10); TEMP_REF_ID CHAR(10); TEMP_CASE VARCHAR2(20); TEMP_ACTIVE VARCHAR2(20); TEMP_REF_SER CHAR(6); ISTACKDONE CHAR(1); BEGIN BEGIN --ISTACKDONE := 'N'; IF(VI_REF_SER = 'R-DSO') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'R-PND') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'S-DSP') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'R-CPA') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'R-TASK') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RD-DSA') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RN-DSA') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RP-ACT') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RP-PND') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RP-PND') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RR-DSA') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'RS-DSO') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'S-DOC') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'M-PACK') THEN SELECT DESCR INTO TEMP_DESCR FROM REFSER WHERE REF_SER = VI_REF_SER ; RETURN TEMP_DESCR; END IF; if( VI_REF_SER = 'C-PICK') then TEMP_HAZARDOUS := ''; select wtd.ref_id,WTD.REF_SER, (CASE WHEN I.hazardous IS NULL THEN 'N' ELSE I.hazardous END) AS HAZ into TEMP_REF_ID,TEMP_REF_SER, TEMP_HAZARDOUS from wave_task_det WTD, ITEM I , PICK_ORD_DET POD where WTD.ptcn= VI_PTCN and WTD.ref_ser ='C-PICK' and WTD.REF_ID = VI_REF_ID AND WTD.REF_ID = POD.PICK_ORDER AND I.ITEM_CODE = POD.ITEM_CODE AND ROWNUM = 1; IF (TEMP_REF_SER = 'C-PICK' AND TEMP_HAZARDOUS = 'Y' ) THEN TEMP_CASE := 'HAZ_CASE_CASE'; ISTACKDONE := 'Y'; ELSIF (TEMP_REF_SER = 'C-PICK' AND TEMP_HAZARDOUS = 'N' ) THEN TEMP_CASE := 'CASE_CASE'; ISTACKDONE := 'Y'; END IF; END IF; IF ( VI_REF_SER = 'M-PICK') then select wtd.ref_id,WTD.REF_SER, (CASE WHEN I.hazardous IS NULL THEN 'N' ELSE I.hazardous END) AS HAZ into TEMP_REF_ID,TEMP_REF_SER, TEMP_HAZARDOUS from wave_task_det WTD, ITEM I , PICK_ORD_DET POD where WTD.ptcn= VI_PTCN and WTD.ref_ser ='M-PICK' and WTD.REF_ID = VI_REF_ID AND WTD.REF_ID = POD.PICK_ORDER AND I.ITEM_CODE = POD.ITEM_CODE AND ROWNUM = 1; IF (TEMP_REF_SER = 'M-PICK' AND TEMP_HAZARDOUS = 'Y' ) THEN TEMP_CASE := 'HAZ_MASTER_CASE'; --RETURN TEMP_CASE; ISTACKDONE := 'Y'; ELSIF (TEMP_REF_SER = 'M-PICK' AND TEMP_HAZARDOUS = 'N' ) THEN TEMP_CASE := 'MASTER_CASE'; ISTACKDONE := 'Y'; END IF; ELSIF ( VI_REF_SER = 'P-PICK' ) then TEMP_HAZARDOUS := ''; select wtd.ref_id,WTD.REF_SER, (CASE WHEN I.hazardous IS NULL THEN 'N' ELSE I.hazardous END) AS HAZ into TEMP_REF_ID,TEMP_REF_SER, TEMP_HAZARDOUS from wave_task_det WTD, ITEM I , PICK_ORD_DET POD where WTD.ptcn= VI_PTCN and WTD.ref_ser ='P-PICK' and WTD.REF_ID = VI_REF_ID AND WTD.REF_ID = POD.PICK_ORDER AND I.ITEM_CODE = POD.ITEM_CODE AND ROWNUM = 1; IF (TEMP_REF_SER = 'P-PICK' AND TEMP_HAZARDOUS = 'Y' ) THEN TEMP_CASE := 'HAZ_PARCEL_CASE'; ISTACKDONE := 'Y'; ELSIF (TEMP_REF_SER = 'P-PICK' AND TEMP_HAZARDOUS = 'N' ) THEN TEMP_CASE := 'PARCEL_CASE'; ISTACKDONE := 'Y'; END IF; ELSIF ( VI_REF_SER = 'A-PICK' ) then select count(*) as cont into CNT1 from wave_task_det WTD where WTD.ptcn = VI_PTCN and WTD.ref_ser ='C-PICK'; IF (CNT1 > 0 ) then TEMP_CASE := 'CASE_CASE'; end if; select count(*) as cont into CNT1 from wave_task_det WTD where WTD.ptcn = VI_PTCN and WTD.ref_ser ='M-PICK'; IF (CNT1 > 0 ) then TEMP_CASE := 'MASTER_CASE'; end if; select count(*) as cont into CNT1 from wave_task_det WTD where WTD.ptcn = VI_PTCN and WTD.ref_ser ='P-PICK'; IF (CNT1 > 0 ) then TEMP_CASE := 'PARCEL_CASE'; end if; select count(*) as cont into CNT1 from wave_task_det WTD,wave_status_org O where WTD.ptcn = VI_PTCN and o.ptcn = WTD.ptcn and WTD.ref_ser ='A-PICK'; IF (CNT1 > 0 ) then TEMP_CASE := 'PARCEL_CASE'; end if; select count(*) as cont into CNT1 from wave_task_det WTD where WTD.ptcn = VI_PTCN and WTD.ref_ser ='M-PICK'; IF (CNT1 > 0 ) then TEMP_CASE := 'MASTER_CASE'; end if; end if; IF(VI_REF_SER = 'C-PICK' AND TEMP_CASE = 'HAZ_CASE_CASE' ) THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'HAZ_CASE_CASE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'C-PICK' AND TEMP_CASE = 'CASE_CASE' ) THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'CASE_CASE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'M-PICK' AND TEMP_CASE = 'HAZ_MASTER_CASE' ) THEN ---// for normal MASTER pick ------- start SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'HAZ_MASTER_CASE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'M-PICK' AND TEMP_CASE = 'MASTER_CASE' ) THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'MASTER_CASE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'P-PICK' AND TEMP_CASE = 'HAZ_PARCEL_CASE' ) THEN ---// for normal MASTER pick ------- start SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'HAZ_PARCEL_CASE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'P-PICK' AND TEMP_CASE = 'PARCEL_CASE' ) THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'PARCEL_CASE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF (VI_REF_SER = 'A-PICK') THEN IF ( (TEMP_CASE <> 'PARCEL_CASE' AND TEMP_CASE <> 'MASTER_CASE') or TEMP_CASE is null ) THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'CASE_ACTIVE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF ( TEMP_CASE = 'MASTER_CASE') THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'MASTER_ACTIVE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; ELSIF ( TEMP_CASE = 'PARCEL_CASE') THEN SELECT DESCR INTO TEMP_DESCR FROM GENcodes WHERE FLD_NAME = 'PARCEL_ACTIVE' and MOD_NAME = 'WAVE_TASK' ; RETURN TEMP_DESCR; END IF; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN TEMP_DESCR :=''; END; RETURN TEMP_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_STKTRANSFER_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON stock_transfer referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_stktransfercount number(3) := 0; ll_count number(6) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_stktransfercount from stock_transfer_det s, item i where s.item_code = i.item_code and s.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_stktransfercount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'XFRX' and ref_id = :new.tran_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_stktransfercount then raise_application_error( -20601, 'Invtrace not updated for all the details'); end if; ------------- allocation check to be added here end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX NSTRG_SPECIALITY_X_ ON NCL_STRG_SPECIALITY (SC_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALIDATE_RANGE ( IN_VALUE IN VARCHAR2, CODE IN CHAR, QC_RESULT IN CHAR ) RETURN NUMBER AS RANGE_STR VARCHAR2(200); MIN_VAL NUMBER; MAX_VAL NUMBER; NUM_VALUE NUMBER; RESULT NUMBER := 0; V_INPUT VARCHAR2(200); BEGIN IF QC_RESULT = 'H' THEN RETURN 1; END IF; BEGIN V_INPUT := TRIM(IN_VALUE); -- Fetch the spec definition SELECT TRIM(EXPECTED_RESULT) INTO RANGE_STR FROM qlty_specs WHERE spec_code = CODE; ----------------------------------------------------------------- -- CASE 1: LIST (comma separated: numbers or strings) ----------------------------------------------------------------- IF INSTR(RANGE_STR, ',') > 0 THEN -- For list type, always return 1 regardless of P/R, found or not RETURN 1; END IF; ----------------------------------------------------------------- -- CASE 2: RANGE (contains -) ----------------------------------------------------------------- IF INSTR(RANGE_STR, '-') > 0 THEN MIN_VAL := TO_NUMBER(SUBSTR(RANGE_STR, 1, INSTR(RANGE_STR, '-') - 1)); MAX_VAL := TO_NUMBER(SUBSTR(RANGE_STR, INSTR(RANGE_STR, '-') + 1)); NUM_VALUE := TO_NUMBER(V_INPUT); IF QC_RESULT = 'P' THEN IF NUM_VALUE >= MIN_VAL AND NUM_VALUE <= MAX_VAL THEN RETURN 1; ELSE RETURN 0; END IF; ELSIF QC_RESULT = 'R' THEN IF NUM_VALUE < MIN_VAL OR NUM_VALUE > MAX_VAL THEN RETURN 1; ELSE RETURN 0; END IF; END IF; END IF; ----------------------------------------------------------------- -- CASE 3: EXACT NUMERIC OR STRING ----------------------------------------------------------------- BEGIN NUM_VALUE := TO_NUMBER(V_INPUT); MIN_VAL := TO_NUMBER(RANGE_STR); IF QC_RESULT = 'P' THEN IF NUM_VALUE = MIN_VAL THEN RETURN 1; ELSE RETURN 0; END IF; ELSIF QC_RESULT = 'R' THEN IF NUM_VALUE != MIN_VAL THEN RETURN 1; ELSE RETURN 0; END IF; END IF; EXCEPTION WHEN VALUE_ERROR THEN -- Non-numeric single string spec → always return 1 RETURN 1; END; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 1; -- always pass if spec not found WHEN OTHERS THEN RETURN 0; END; RETURN RESULT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUSINESS_LOGIC_X ON BUSINESS_LOGIC_CHECK (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STATE_CHECK (ls_invtranid in char, ld_eff_qty in number) return char is ls_work_state char(5); ls_site char(5); ls_ref_ser char(6); ls_ref_id char(10); ls_dsp_stan_code char(5); ls_dsp_state char(5); ls_retval char(1); ls_diss_site char(5); begin select site_code, ref_ser,ref_id into ls_site,ls_ref_ser,ls_ref_id from invtrace where tran_id = ls_invtranid; ls_retval := 'X'; if ld_eff_qty < 0 then select station.state_code into ls_work_state from station,site where station.stan_code = site.stan_code and site.site_code = ls_site; if ls_ref_ser = 'S-DSP' then select stan_code into ls_dsp_stan_code from despatch where desp_id = ls_ref_id; select state_code into ls_dsp_state from station where stan_code = ls_dsp_stan_code; elsif ls_ref_ser = 'D-ISS' then select site_code__dlv into ls_diss_site from distord_iss where tran_id = ls_ref_id; select station.state_code into ls_dsp_state from station,site where station.stan_code = site.stan_code and site.site_code = ls_diss_site; end if; if ls_work_state = ls_dsp_state then ls_retval := 'Y'; else ls_retval := 'N'; end if; end if; return (ls_retval); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SITE_REGNO1_PAN ( AS_SITE CHAR, as_ref_code CHAR) RETURN VARCHAR2 IS ls_reg_no varchar2(40); BEGIN BEGIN Select max(reg_no) into ls_reg_no from siteregno where site_code =AS_SITE and ref_code = as_ref_code; EXCEPTION when no_data_found then ls_reg_no := ''; END; return ls_reg_no; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_LEAVEBAL ( as_emp_code char , as_leave_code char , ad_date date ) return number is lc_bal_days number( 12 , 2 ); begin lc_bal_days := 0; begin select sum(bal_days) into lc_bal_days from leavebal where emp_code = as_emp_code and lve_code = as_leave_code and exp_date >= nvl( ad_date , to_date( sysdate ) ); exception when NO_DATA_FOUND then lc_bal_days := 0 ; end; return( lc_bal_days ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DISTISS_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON distord_iss referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_dissuecount number(3) := 0; ll_count number(6) := 0; lc_taxtrantax number(14,3) := 0; ls_lineno char(3); ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_autorcp char(1); ll_isscount number(6) := 0; ll_rcpcount number(6) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_dissuecount from distord_issdet d, item i where d.item_code = i.item_code and d.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_dissuecount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'D-ISS' and ref_id = :new.tran_id and eff_qty < 0 and (item_code,loc_code,lot_no,lot_sl) in (select distinct item_code,loc_code,lot_no,lot_sl from distord_issdet where tran_id = :new.tran_id); exception when others then ll_invcount := 0; end; if ll_invcount <> ll_dissuecount then raise_application_error( -20601, 'Invtrace not updated for all the details'); end if; ------------- allocation check to be added here -- 19-Jul-2024 manoharan added to check tax mis match for cur_diss in ( Select line_no,tax_env,tax_amt from distord_issdet where tran_id = :new.tran_id ) loop if cur_diss.tax_env is not null and length(trim(cur_diss.tax_env)) > 0 then ls_lineno := trim(to_char(cur_diss.line_no)); ls_lineno := substr(' ' || trim(ls_lineno) , -3); begin select sum(tax_amt) into lc_taxtrantax from taxtran where tran_code = 'D-ISS' and tran_id = :new.tran_id and line_no = ls_lineno and effect <> 'N'; exception when others then lc_taxtrantax := 0; end; if NVL(lc_taxtrantax,0) <> NVL(cur_diss.tax_amt,0) then raise_application_error( -20601, 'For Line # [' || to_char(cur_diss.line_no) || '] detail tax amount [' || to_char(nvl(cur_diss.tax_amt,0)) || '] not matching with taxtran tax amount [' || to_char(nvl(lc_taxtrantax,0)) || ']' ); end if; begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'D-ISS' and tax_env = cur_diss.tax_env ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = cur_diss.tax_env ; exception when others then ll_tenvcount := 0; end; end if; begin select count(1) into ll_taxcount from taxtran where tran_code = 'D-ISS' and tran_id = :new.tran_id and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then raise_application_error( -20601, 'For Line # [' || to_char(cur_diss.line_no) || '] taxtran count [' || to_char(ll_taxcount) || '] not matching with environment sequence count [' || to_char(ll_tenvcount) || ']' ); end if; end if; -- tax_env not null end loop; begin select AUTO_RECEIPT into ls_autorcp from distorder where dist_order = :new.dist_order; exception when others then ls_autorcp := 'N'; end; if ls_autorcp <> 'N' then begin select count(1) into ll_isscount from distord_issdet where tran_id = :new.tran_id; exception when others then ll_isscount := 0; end; begin select count(1) into ll_rcpcount from distord_rcpdet d, distord_rcp h where h.tran_id = d.tran_id and h.TRAN_ID__ISS = :new.tran_id; exception when others then ll_rcpcount := 0; end; if NVL(ll_isscount,0) <> NVL(ll_rcpcount,0) then raise_application_error( -20601, 'Number of issue lines [' || to_char(ll_isscount) || '] not matching with number of receipt lines [' || to_char(ll_rcpcount) || ']' ); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE VISITEDWITHPLANPOPHELP AS FUNCTION getvisitedWithPlanData (empCode in char) RETURN vistPlanMasterTABLE PIPELINED; END visitedWithPlanPophelp; CREATE OR REPLACE PACKAGE BODY VISITEDWITHPLANPOPHELP AS FUNCTION getvisitedWithPlanData (empCode in char) RETURN vistPlanMasterTABLE PIPELINED IS ls_grade_typ char(1); ls_cnt number(35); ls_trans_db varchar2(30); begin SELECT (CASE WHEN B.GRADE_TYPE IS NULL THEN'T'ELSE B.GRADE_TYPE END) INTO ls_grade_typ FROM EMPLOYEE A, GRADE B WHERE A.EMP_CODE = empCode AND A.GRADE = B.GRADE_CODE ; if ls_grade_typ <> 'M' then SELECT COUNT(*) INTO ls_cnt FROM ORG_STRUCTURE O, VERSION V START WITH O.POS_CODE in (SELECT O.POS_CODE__REPTO FROM ORG_STRUCTURE O, VERSION V WHERE EMP_CODE = empCode AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y') CONNECT BY PRIOR O.POS_CODE__REPTO = O.POS_CODE AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y'; if ls_cnt > 0 then FOR x IN (SELECT DISTINCT E.EMP_CODE AS REPORT_TO,GET_EMP_DESIGNATION(E.EMP_CODE) DESIGNATION,DDF_GET_EMPLOYEE_NAME (E.EMP_CODE)||' ('||LTRIM(RTRIM(E.EMP_CODE))||') ' AS VISITED_WITH,GRADE.LEVEL_NO AS LEVEL_NO FROM EMPLOYEE E,GRADE G,EMPLOYEE EMP ,GRADE GRADE WHERE E.EMP_CODE IN (SELECT EMP_CODE AS REPORT_TO FROM ORG_STRUCTURE O, VERSION V START WITH O.POS_CODE=(SELECT O.POS_CODE__REPTO FROM ORG_STRUCTURE O, VERSION V WHERE EMP_CODE = empCode AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y') CONNECT BY PRIOR O.POS_CODE__REPTO = O.POS_CODE AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y') AND EMP.GRADE = G.GRADE_CODE AND (CASE WHEN G.GRADE_TYPE IS NULL THEN'T'ELSE G.GRADE_TYPE END) <> 'M' AND EMP.EMP_CODE = empCode AND GRADE.GRADE_CODE=E.GRADE AND GRADE.LEVEL_NO<=4 ORDER BY GRADE.LEVEL_NO DESC) LOOP PIPE ROW (visitPlanMaster(x.REPORT_TO,x.DESIGNATION,x.VISITED_WITH,x.LEVEL_NO)); END LOOP; RETURN; end if; if ls_cnt <= 0 then FOR x IN (SELECT DISTINCT E.EMP_CODE AS REPORT_TO,GET_EMP_DESIGNATION(E.EMP_CODE) DESIGNATION,DDF_GET_EMPLOYEE_NAME (E.EMP_CODE)||' ('||LTRIM(RTRIM(E.EMP_CODE))||') ' AS VISITED_WITH ,GRADE.LEVEL_NO AS LEVEL_NO FROM EMPLOYEE E,GRADE G,EMPLOYEE EMP,GRADE GRADE WHERE E.EMP_CODE IN (SELECT EMP_CODE AS REPORT_TO FROM EMPLOYEE O START WITH EMP_CODE=(SELECT REPORT_TO FROM EMPLOYEE O WHERE O.EMP_CODE = empCode) CONNECT BY PRIOR O.REPORT_TO = O.EMP_CODE) AND EMP.GRADE = G.GRADE_CODE AND (CASE WHEN G.GRADE_TYPE IS NULL THEN'T'ELSE G.GRADE_TYPE END) <> 'M' AND EMP.EMP_CODE = empCode AND GRADE.GRADE_CODE=E.GRADE AND GRADE.LEVEL_NO<=4 ORDER BY GRADE.LEVEL_NO DESC) LOOP PIPE ROW (visitPlanMaster(x.REPORT_TO,x.DESIGNATION,x.VISITED_WITH,x.LEVEL_NO)); END LOOP; RETURN; end if; End if; if ls_grade_typ = 'M' then SELECT COUNT(*) INTO ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN (SELECT EMP_CODE FROM ORG_STRUCTURE O, VERSION V START WITH EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND O.POS_CODE__REPTO IS NOT NULL AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y' ); if ls_cnt > 0 then FOR x in(SELECT DISTINCT SS.SALES_PERS AS REPORT_TO, GET_EMP_DESIGNATION(SALES_PERS) AS DESIGNATION, (CASE WHEN DDF_GET_EMPLOYEE_NAME(SS.SALES_PERS) ||' (' || SS.SALES_PERS || ') ' LIKE '%('||empCode||'%' THEN 'SELF' ELSE DDF_GET_EMPLOYEE_NAME(SS.SALES_PERS) ||' (' || LTRIM(RTRIM(SS.SALES_PERS)) || ') ' END) AS VISITED_WITH,G.LEVEL_NO AS LEVEL_NO FROM SALES_PERS SS, SPRS_ROUTE SR, GRADE G, EMPLOYEE E WHERE SS.SALES_PERS IN ( SELECT EMP_CODE FROM EMPLOYEE WHERE EMP_CODE IN (SELECT EMP_CODE FROM ORG_STRUCTURE O, VERSION V START WITH EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND O.POS_CODE__REPTO IS NOT NULL AND ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO )AND RELIEVE_DATE IS NULL ) AND SS.SALES_PERS = SR.SPRS_CODE AND SR.STATUS = 'Y' AND E.GRADE = G.GRADE_CODE AND G.GRADE_TYPE = 'M' AND E.EMP_CODE = empCode ORDER BY REPORT_TO) LOOP PIPE ROW (visitPlanMaster(x.REPORT_TO,x.DESIGNATION,x.VISITED_WITH,x.LEVEL_NO)); END LOOP; RETURN; end if; if ls_cnt <= 0 then FOR x in(--SELECT DISTINCT SS.SALES_PERS AS REPORT_TO,GET_EMP_DESIGNATION(SALES_PERS) AS DESIGNATION, SELECT DISTINCT emp.emp_code AS REPORT_TO,GET_EMP_DESIGNATION(emp.emp_code) AS DESIGNATION, (CASE WHEN DDF_GET_EMPLOYEE_NAME(EMP.EMP_CODE) ||' (' || EMP.EMP_CODE || ') ' LIKE '%('||empCode||'%' THEN 'SELF' ELSE DDF_GET_EMPLOYEE_NAME(EMP.EMP_CODE) ||' (' || LTRIM(RTRIM(EMP.EMP_CODE)) || ') ' END) AS VISITED_WITH,G.LEVEL_NO AS LEVEL_NO --FROM SALES_PERS SS,SPRS_ROUTE SR,GRADE G,EMPLOYEE E ,EMPLOYEE EMP FROM GRADE G,EMPLOYEE E ,EMPLOYEE EMP --WHERE SS.SALES_PERS IN (SELECT EMP_CODE FROM EMPLOYEE WHERE EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE O START WITH EMP_CODE = empCode --CONNECT BY PRIOR O.EMP_CODE = O.REPORT_TO AND O.REPORT_TO IS NOT NULL)) WHERE EMP.emp_code IN ( (SELECT emp_code FROM employee WHERE emp_code IN ( SELECT emp_code FROM employee o START WITH emp_code = empCode CONNECT BY PRIOR o.emp_code = o.report_to AND o.report_to IS NOT NULL ) AND relieve_date IS NULL) UNION (SELECT emp_code FROM employee WHERE emp_code IN ( SELECT emp_code FROM employee o START WITH emp_code = ( SELECT report_to FROM employee o WHERE o.emp_code = empCode ) CONNECT BY PRIOR o.report_to = o.emp_code )) ) --AND SS.SALES_PERS = SR.SPRS_CODE AND SS.SALES_PERS = EMP.EMP_CODE AND SR.STATUS = 'Y' AND E.GRADE = G.GRADE_CODE AND G.GRADE_TYPE = 'M' AND EMP.STATUS != 'S' AND E.EMP_CODE = empCode ) LOOP PIPE ROW (visitPlanMaster(x.REPORT_TO,x.DESIGNATION,x.VISITED_WITH,x.LEVEL_NO)); END LOOP; RETURN; end if; end if; end; END visitedWithPlanPophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ALL_INVID ( as_recept in char , as_refser in char ) return varchar2 is ls_all_invId varchar2(100); ls_temp char(10); CURSOR Cur_All_inv_ID IS SELECT ref_no FROM rcpdet WHERE rcpdet.TRAN_ID = as_recept and ref_no is not null; BEGIN ls_all_invId := ' '; FOR I IN Cur_All_inv_ID LOOP if trim(ls_all_invId) is null then ls_all_invId := I.ref_no; else ls_all_invId := ls_all_invId || ' ' || I.ref_no; end if; END LOOP; RETURN ls_all_invId; Exception when others then RETURN ls_all_invId; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION WRAPE_UN_APPR (EMP_CODE in CHAR, Pos In int, space_lve In Varchar2, tran_id in char,leaveDate In DATE) return number is unaprlve number(7,1); LV_CODE VARCHAR(20); begin select DDF_GET_LEAVE_TYPE(EMP_CODE, SPACE_LVE, POS,leaveDate) into LV_CODE from DUAL; select ddf_get_unappr_lev(EMP_CODE,LV_CODE,tran_id) into unaprlve from DUAL; Return Unaprlve; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ERROR_INFO (ls_ref_ser char,ls_ref_id char) return varchar2 is ls_data varchar2(4000); ls_err_descr varchar2(2000); li_ctr number :=0; cursor cur_err is select nvl(ir_no, ' ') from e_invoice_update where ref_ser =ls_ref_ser and ref_id= ls_ref_id; --and reg_stat= '0'; begin ls_data := ''; open cur_err; loop fetch cur_err into ls_err_descr; exit when cur_err%notfound; if ls_err_descr is null then ls_err_descr := ' '; end if; li_ctr := li_ctr + 1; dbms_output.put_line(to_char(li_ctr) || '. ' ||ls_err_descr); ls_data:=ls_data || to_char(li_ctr) || '. ' || ls_err_descr ; dbms_output.put_line(to_char(li_ctr) || '. ' ||ls_data); end loop; close cur_err; return ls_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STATE_DESCR ( as_state_code IN VARCHAR2) RETURN VARCHAR2 IS LS_DESCR varchar2(50); BEGIN SELECT DESCR INTO LS_DESCR FROM STATE WHERE state_code = as_state_code ; RETURN LS_DESCR; exception WHEN no_data_found THEN RETURN 'State not found in State master' ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EXPORT_FUND_X ON EXPORT_FUND (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_APRSTAT (as_refid varchar2,as_refser CHAR,as_rolecode obj_sign_trans.role_code__sign%type,as_processid char,as_byaddress char) RETURN VARCHAR2 IS retstr VARCHAR2(500); ls_instance wf_prc_status.instance_id%type; ls_maxid wf_prc_status.instance_id%type; ls_rolecode obj_sign_trans.role_code__sign%type; ls_signstatus obj_sign_trans.sign_status%type; ls_signdate obj_sign_trans.sign_date%type; ls_sign_remarks obj_sign_trans.sign_remarks%type; ls_emp_code obj_sign_trans.emp_code%type; ls_empfname employee.emp_fname%type; ls_empmname employee.emp_mname%type; ls_emplname employee.emp_lname%type; cnt number; CURSOR C1 IS select a.role_code__sign,a.sign_status,a.sign_date,a.sign_remarks, a.emp_code,NVL(b.emp_fname,'') as emp_fname,nvl(b.emp_mname,'') as emp_mname,nvl(b.emp_lname,'') as emp_lname from obj_sign_trans a, employee b where a.ref_ser = as_refser and a.ref_id = as_refid and a.prc_inst__wf like '%' || as_processid || ':' || ls_maxid || '%' and a.emp_code = b.emp_code(+); begin select max(instance_id) into ls_maxid from wf_prc_status where ref_ser = as_refser and ref_id = as_refid; if ls_maxid is not null and length(trim(ls_maxid )) > 0 then select count(1) into cnt from obj_sign_trans a where a.ref_ser = as_refser and a.ref_id = as_refid and a.prc_inst__wf like '%' || as_processid || ':' || ls_maxid || '%'; end if; IF cnt > 0 then OPEN C1 ; LOOP FETCH C1 into ls_rolecode,ls_signstatus,ls_signdate,ls_sign_remarks,ls_emp_code,ls_empfname,ls_empmname,ls_emplname; exit when C1%notfound; if ls_signstatus = 'S' AND ls_rolecode = as_rolecode then retstr := retstr || 'Approved by ' || as_byaddress || ' : ' || chr(13) || chr(10) || ls_empfname || ' ' || ls_empmname || ' ' || ls_emplname || chr(13) || chr(10) || 'Date : '|| to_char(ls_signdate, 'dd/MM/yyyy'); elsif ls_signstatus = 'R' AND ls_rolecode = as_rolecode then retstr := retstr || 'Rejected by ' || as_byaddress || ' : ' || chr(13) || chr(10) || ls_empfname || ' ' || ls_empmname || ' ' || ls_emplname || chr(13) || chr(10) || 'Date : ' || to_char(ls_signdate, 'dd/MM/yyyy'); elsif ls_rolecode = as_rolecode then retstr := retstr || 'Approved by ' || as_byaddress || ' : ' || chr(13) || chr(10) || 'Awaiting for Approval' || chr(13) || chr(10) || 'Date : ' ; end if; end loop; close c1; end if; return retstr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AVAILABLE_LOT ( As_Price_List CHAR, As_Trandate DATE, as_sale_order CHAR, as_site_code CHAR ) RETURN NUMBER IS inner_count NUMBER(1); As_Lot_No VARCHAR2(50); as_item_code VARCHAR2(50); BEGIN FOR c_rec IN (SELECT SORDDET.ITEM_CODE__ORD AS as_item_code FROM SORDER, SORDDET WHERE SORDER.SALE_ORDER = SORDDET.SALE_ORDER AND SORDER.SALE_ORDER = as_sale_order) LOOP as_item_code := c_rec.as_item_code; FOR c1_rec IN (SELECT stock.lot_no AS As_Lot_No FROM invstat, stock, location WHERE location.inv_stat = invstat.inv_stat AND location.loc_code = stock.loc_code and stock.item_code = as_item_code and stock.site_code = as_site_code AND invstat.stat_type <> 'S' AND stock.quantity > 0 AND invstat.available = 'Y') LOOP inner_count := 0; As_Lot_No := c1_rec.As_Lot_No; SELECT COUNT(*) INTO inner_count FROM pricelist WHERE pricelist.list_type = 'B' AND pricelist.price_list = As_Price_List AND pricelist.item_code = as_item_code AND As_Lot_No BETWEEN pricelist.Lot_No__From AND pricelist.Lot_No__To AND As_Trandate BETWEEN pricelist.EFF_FROM AND pricelist.VALID_UPTO; IF inner_count > 0 THEN inner_count := 1; else inner_count := 0; END IF; IF inner_count = 0 THEN RETURN inner_count; END IF; END LOOP; END LOOP; RETURN inner_count; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUSTOMER_SITE ON CUSTOMER (SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXCHANGERATE (as_curr_code VARCHAR2,as_site_code CHAR,as_exch_rate Number,as_tran_date DATE) return number IS ls_retval NUMBER(1); ls_curr_from CHAR(3); ls_curr_to CHAR(3); ls_fin_ent CHAR(10); ls_exch_rate Number; ls_exch_rate1 Number; begin ls_retval := 1 ; ls_curr_to := ''; ls_exch_rate := 0; ls_exch_rate1 := 0; ls_fin_ent := ''; select trim(curr_code) into ls_curr_to from finent A,site B where A.fin_entity=B.fin_entity and trim(site_code)=trim(as_site_code); --raise_application_error( -20601, 'value of ls_curr_to is.. [' || ls_curr_to || ']'); if(as_curr_code <> ls_curr_to)then begin select (case when exch_rate = 0 then 0 else exch_rate end) into ls_exch_rate from daily_exch_rate_sell_buy where as_tran_date between from_date and to_date and trim(curr_code) = trim(as_curr_code) and trim(curr_code__to) = trim(ls_curr_to); exception when others then ls_exch_rate := 0; end; IF(ls_exch_rate > 0 and as_curr_code <> ls_curr_to) THEN ls_exch_rate1 :=((ls_exch_rate*20)/100); if((as_exch_rate < (ls_exch_rate - ls_exch_rate1)) or (as_exch_rate > (ls_exch_rate + ls_exch_rate1)))then --if(as_exch_rate < (ls_exch_rate - ls_exch_rate1)) then --ls_retval := 0; -- elsif(as_exch_rate > (ls_exch_rate + ls_exch_rate1))then ls_retval := 0; else ls_retval := 1; end if; end if; end if; RETURN ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_ADV_AMT ( as_sundry_type IN CHAR, as_sundry_code IN CHAR, as_acct_prd IN CHAR, as_sitewcode IN CHAR) RETURN NUMBER IS lc_advamt NUMBER(14,3); BEGIN SELECT SUM(sundrybal.adv_amt) INTO lc_advamt FROM sundrybal WHERE ( sundrybal.acct_prd = as_acct_prd ) AND ( sundrybal.prd_code = 'zzzzzz' ) AND ( sundrybal.site_code = as_sitewcode ) AND ( sundrybal.sundry_type = as_sundry_type ) AND ( sundrybal.sundry_code = as_sundry_code ) ; IF lc_advamt IS NULL THEN lc_advamt := 0 ; END IF; RETURN lc_advamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PLANTMODIFICATION_PM_DATE ON PLANTMODIFICATION (PM_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_PO_SAMEDISCOUNT (as_po porder.purc_order%type) -- Rahul K Khanolkar -- 24-jul-02 -- -- Check Discount for all items in PO detail. -- -- returns 'SAMEDISCOUNT' string if discount for all items is same -- returns 'NOTSAMEDISCOUNT' string if discount for all items is not same return char is ls_flag varchar2(20); ll_cnt number; ll_dis number; begin select distinct nvl(discount,0) into ll_dis from porddet where purc_order = as_po; return 'SAMEDISCOUNT'; exception when TOO_MANY_ROWS then return 'NOTSAMEDISCOUNT'; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CBK_DET_TRANFLOW (as_cbk_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.quantity ,b.net_amt,b.porder_no,b.porder_date from item a ,charge_back_det b where a.item_code = b.item_code and b.tran_id=as_cbk_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Net Amount'||''||''||'Bill Number'||''||''||'Bill Date'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INVTRACE_AMT (AS_INVOICE_ID INVOICE_TRACE.INVOICE_ID%TYPE, AS_LOT_SL INVOICE_TRACE.LOT_SL%TYPE, AS_LOT_NO INVOICE_TRACE.LOT_NO%TYPE, as_line_no INVOICE_TRACE.line_no%TYPE, AS_FLAG CHAR) RETURN NUMBER IS TOTAL NUMBER(25,3); BEGIN IF AS_FLAG = 'A' THEN SELECT sum(rate__clg * quantity__stduom * 1) INTO TOTAL FROM INVOICE_TRACE where invoice_id=AS_INVOICE_ID and line_no =as_line_no AND LOT_SL =AS_LOT_sl AND LOT_NO =AS_LOT_NO; ELSIF AS_FLAG ='B' THEN SELECT sum(rate__clg * quantity__stduom * 1) INTO TOTAL FROM INVOICE_TRACE where rate =0 and invoice_id=AS_INVOICE_ID and line_no =as_line_no AND LOT_NO =AS_LOT_NO; END IF; RETURN TOTAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PAY_IBCA_DET_U ON PAY_IBCA_DET (TRAN_ID, REF_NO, REF_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_OPENBAL (ls_acct_prd char , ls_prd_code char, ls_bank_code char , ls_site_code char ) return number is lc_opbal number(14,3); begin lc_opbal :=0; Select Sum(dr_amt__base - cr_amt__base) into lc_opbal from sundrybal where acct_prd = ls_acct_prd and prd_code < ls_prd_code and sundry_type = 'B' and sundry_code = ls_bank_code and site_code = ls_site_code; return lc_opbal; if lc_opbal is null then lc_opbal := 0; end if; return lc_opbal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE STRGCODEMASTERMASTERTABLE AS TABLE OF STRGCODEMASTER; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GSTR_PRD_DATE (as_ref_id char, as_ref_ser char, as_ref_date date, as_date_opt char, is_submit_date char) return Date is gstr_prd_date date; submit_date date; begin if('E' = as_date_opt ) then begin --raise_application_error( -20601, 'Inside Function as_ref_ser is: [' || as_ref_ser || ']'); select ack_date into submit_date from e_invoice_update where ref_id = as_ref_id and ref_ser = as_ref_ser and tran_type = 'R' and reg_stat = '1' and rownum = 1; gstr_prd_date := submit_date; exception when no_data_found then gstr_prd_date := as_ref_date; end; else gstr_prd_date := as_ref_date; end if; if(is_submit_date = 'Y' ) then return submit_date; else return gstr_prd_date; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083971 ON TEST11 (NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION MANAGER_ID (mgrid in employee.report_to%type) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select emp_code from employee start with emp_code = mgrid connect by prior emp_code = report_to; loop fetch c into v_str_tmp; exit when c%notfound; v_str := v_str||','||v_str_tmp; end loop; V_STR:=SUBSTR(V_STR,2,LENGTH(V_STR)); exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_QTY ( ls_site_code in char, ls_item_code in char, ls_prd_code_plan in char, ls_prd_code_for in char) return number is ld_qty number(14,3); ls_site char(5); ls_sitecode char(4); begin select substr(ls_site_code,3,5) into ls_site from dual; ls_sitecode := '%' || ltrim(rtrim(ls_site) ); select sum(b.quantity) into ld_qty from salesforecast_hdr a,salesforecast_det b where a.tran_id = b.tran_id and a.site_code like ls_sitecode and b.item_code = ls_item_code and b.prd_code__plan = ls_prd_code_plan and b.prd_code__for = ls_prd_code_for ; return(ld_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STRG_SPECIALITY (mspl_code char) return char is mdescr varchar2(20); begin select descr into mdescr from speciality where spl_code = mspl_code; return mdescr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEM_ATTRIB (as_item_code in char) return varchar2 is ls_specs varchar2(200); begin select nvl(item.phy_attrib_1,'') || ' ' || nvl(item.phy_attrib_2,'') || ' ' || nvl(item.phy_attrib_3,'') || ' ' || nvl(item.phy_attrib_4,'') || ' ' || nvl(item.phy_attrib_5,'') into ls_specs from item where item.item_code = as_item_code; return ls_specs; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PTCN_PICKORDER (AS_PICK_ORDER WAVE_TASK_DET.REF_ID%TYPE) RETURN CHAR IS AS_PTCN WAVE_TASK_DET.PTCN%TYPE ; BEGIN SELECT PTCN INTO AS_PTCN FROM WAVE_TASK_DET WHERE REF_ID = AS_PICK_ORDER AND ROWNUM = 1; RETURN AS_PTCN ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_OPER_BTCH (as_work_order in workorder.work_order%type, an_operation in workorder_iss.operation%type) return number is ln_batch_size number(14,3); begin select nvl(sum(nvl(workorder_enhanc.batch_size_add,0)),0) into ln_batch_size from workorder_enhanc where workorder_enhanc.work_order = as_work_order and workorder_enhanc.operation = an_operation and workorder_enhanc.enhanc_type = 'A' and workorder_enhanc.confirmed = 'Y' ; return ln_batch_size; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_RES_LOC ON STRG_CUSTOMER (RES_LOCALITY_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ORGUNIT_DESCR (as_OrgunitType in char, as_orgUnit in char) RETURN VARCHAR2 AS ls_description varchar2(100); BEGIN if(as_OrgunitType='I') then select descr into ls_description from ITEMSER where item_ser=as_orgUnit; end if; if(as_OrgunitType='S') then select descr into ls_description from SITE where site_code=as_orgUnit; end if; if(as_OrgunitType='D') then select descr into ls_description from DEPARTMENT where dept_code=as_orgUnit; end if; RETURN ls_description; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRECRIPTION_CODE ( as_brand_code char,as_item_code char ,as_emp_code char) return CHAR is ls_precription_code char(10); param_value VARCHAR2(60); begin SELECT get_sfaparm_data('CAMP_BRAND_SKU',as_emp_code) into param_value from dual; if (param_value = 'BRAND') THEN ls_precription_code :=as_brand_code; END IF; if (param_value = 'ITEM') THEN ls_precription_code :=as_item_code; END IF; return ls_precription_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_COMMENTS ON COMMENTS (REF_ID, REF_SER, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE LOCALITYCODERETAILMASTER AS OBJECT ( LOCALITY_CODE CHAR(10), DESCR VARCHAR2(60) , STOCKIST_CODE CHAR(10), STOCKIST_NAME varchar2(120), VISITED_WITH_TEAM char(10), ITEM_SER CHAR(5), ROUTE_ID CHAR(3) , STATION_TYPE CHAR(5), STATION_DESCR VARCHAR2(40) , ROUTE_TYPE VARCHAR2(5) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INVTRACE_OPSTK ( as_site_code char,as_item_code char ,as_lot_no char , ad_from_date date,as_type char) return number is ld_eff_qty number(14,3) ; ldt_crea_date date ; begin if as_type = 'I' then select min(to_date(a.crea_date,'dd/mm/yy')) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = as_site_code and a.item_code = as_item_code and b.available = 'Y'; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity - nvl(a.alloc_qty,0)) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = as_site_code and a.item_code = as_item_code and b.available = 'Y' union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.item_code = as_item_code and a.site_code = as_site_code and a.tran_date > ad_from_date and c.available = 'Y'); elsif as_type ='B' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = as_site_code and a.item_code = as_item_code and a.lot_no = as_lot_no and b.available = 'Y'; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity - nvl(a.alloc_qty,0)) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = as_item_code and a.site_code = as_site_code and a.lot_no = as_lot_no and b.available = 'Y' union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = as_site_code and a.item_code = as_item_code and a.tran_date > ad_from_date and a.lot_no = as_lot_no and c.available = 'Y'); end if; if ld_eff_qty is null then ld_eff_qty := 0; else return ld_eff_qty; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ROPENING_BAL (as_empcode char , ad_date_fr date, ad_date_to date, ad_exp_date date, as_lvecode char) return number is lc_baldays number(6,1) ; lc_nodays number(6,1) := 0; ld_eff_date date; lc_nodays2 number(6,1) := 0; begin begin select min(eff_date) into ld_eff_date from leavebal where emp_code = as_empcode and lve_code = as_lvecode and eff_date <= ad_date_fr and exp_date >= ad_date_to; SELECT nvl(sum(nvl(no_days,0)),0) into lc_nodays FROM empleave_summary,period WHERE empleave_summary.EMP_CODE = as_empcode AND empleave_summary.lve_code = as_lvecode and period.code = empleave_summary.prd_code and period.fr_date >= ld_eff_date and period.fr_date < ad_date_fr; EXCEPTION WHEN NO_DATA_FOUND THEN lc_nodays := 0 ; END ; declare cursor c_lvetrace is SELECT lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc FROM emplve_trace WHERE EMP_CODE = as_empcode AND lve_code = as_lvecode and lve_date_to >= ld_eff_date and eff_date < ld_eff_date group by lve_date_fr,lve_date_to; begin lc_nodays2 := 0; for i in c_lvetrace loop if i.lve_date_fr < ld_eff_date then if ld_eff_date - i.lve_date_fr - 1 < i.lve_aloc then lc_nodays2 := lc_nodays2 + i.lve_aloc - (ld_eff_date - i.lve_date_fr - 1); end if; else lc_nodays2 := lc_nodays2 + i.lve_aloc ; end if; end loop; -- SELECT nvl(sum(nvl(lves_alloc,0)),0) into lc_nodays2 FROM emplve_trace -- WHERE EMP_CODE = as_empcode AND -- lve_code = as_lvecode and -- lve_date_fr >= ld_eff_date and eff_date < ld_eff_date; END ; begin select nvl(sum(NVL(avail_days,0) + nvl(conv_days,0)),0) into lc_baldays from leavebal where emp_code = as_empcode and lve_code = as_lvecode and eff_date <= ad_date_fr and exp_date >= ad_date_to; EXCEPTION WHEN NO_DATA_FOUND THEN lc_baldays := 0 ; END ; return (lc_baldays + lc_nodays2 - lc_nodays); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIVABLES_ADJ_REF_SER_REF_NO ON RECEIVABLES_ADJ (REF_SER, REF_NO, REF_SER_ADJ, REF_NO_ADJ) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SM_SALES_CUST_X ON SM_SALES_CUST (SITE_CODE, ITEM_CODE, PRD_CODE, ITEM_SER, CUST_CODE, MARKET_REG) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ORGUNITMASTERTABLE AS TABLE OF ORGUNITMASTER; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX FUNDTRANSFER_BANK_CODE_FR ON FUNDTRANSFER (BANK_CODE__FROM, REF_NO, LINK_TYPE, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PYRL_PSITE_VDATE ON PAYROLL (SITE_CODE__PAY, VOUCHER_DATE, PRD_CODE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MR_JFW_CNT (AS_TRAN_ID CHAR) RETURN VARCHAR2 IS AS_DESCR VARCHAR2(1000); TRAN_CNT NUMBER(3,0); CURSOR C1 IS SELECT SP_NAME FROM SALES_PERS WHERE SALES_PERS IN (SELECT SALES_PERS FROM STRG_MEET_TEAM WHERE TRAN_ID=AS_TRAN_ID); BEGIN SELECT COUNT(TRAN_ID) INTO TRAN_CNT FROM STRG_MEET_TEAM WHERE TRAN_ID=AS_TRAN_ID; IF TRAN_CNT = 1 THEN SELECT RTRIM(SP_NAME) INTO AS_DESCR FROM SALES_PERS WHERE SALES_PERS= (SELECT SALES_PERS FROM STRG_MEET_TEAM WHERE TRAN_ID=AS_TRAN_ID); RETURN AS_DESCR; ELSIF TRAN_CNT > 1 THEN AS_DESCR:=''; FOR I IN C1 LOOP AS_DESCR:=AS_DESCR||RTRIM(I.SP_NAME)||','; END LOOP; END IF; AS_DESCR:=SUBSTR(AS_DESCR,1,LENGTH(TRIM(AS_DESCR))-1); RETURN AS_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE VISTEDARMASTERTABLE AS TABLE OF visteDARMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_SCHD_ATTD_STATUS (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select lve_code from empleave where emp_code = AS_EMP_CODE and AS_DATE between lve_date_fr and lve_date_to and status = 'A' and use_flag = 'C' order by lve_date_fr,lve_date_to; a_status varchar2(5); a_hol_tblno holiday.hol_tblno%type := ddf_get_holtblno(AS_EMP_CODE,AS_DATE); a_count number(5); a_count1 number(5); begin select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count <> 0) then a_status := 'P'; return a_status; end if; for i in c1 loop a_status := substr(i.lve_code,1,2); return a_status; end loop; select count(*) into a_count from tour where emp_code = AS_EMP_CODE and AS_DATE between date_from and date_to and status = 'A'; if (a_count <> 0) then a_status := 'T'; return a_status; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'H'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 = 0) then a_status := 'H'; return a_status; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 <> 0) then a_status := 'H'; return a_status; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'W'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 = 0) then a_status := 'W'; return a_status; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 <> 0) then a_status := 'W'; return a_status; end if; a_status := 'A'; return a_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CHARGE_BACK_X ON CHARGE_BACK (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_COMPARE_DIMENSION (as_stockdimension in stock.dimension%type, as_requireddimension in stock.dimension%type,ac_trimwidth in number ) return char is ls_retval char(1) ; lc_stk_dimension number(14,3) ; lc_req_dimension number(14,3) ; li_pos number(14,0) ; ls_errcode varchar2(2000); ls_tempreq varchar2(30); ls_tempstk varchar2(30); ls_stockdimension stock.dimension%type; ls_requireddimension stock.dimension%type; ls_delimiter char(1); lc_trimwidth number(14,3); begin -- Comparision will be done each element -- with the corresponding element -- if any of the element from stock dimension -- not equal to the corresponding required dimension -- immediately the comparision fails. ls_delimiter := 'x' ; ls_stockdimension := as_stockdimension; ls_requireddimension := as_requireddimension; lc_trimwidth := ac_trimwidth; -- default value to return ls_retval := 'Y' ; if ls_stockdimension is null then return 'N'; end if ; if ls_requireddimension is null then return 'N' ; end if ; --- ls_stockdimension := lower(ltrim(rtrim(ls_stockdimension))); --- ls_requireddimension := lower(ltrim(rtrim(ls_requireddimension))); loop ls_stockdimension := lower(ltrim(rtrim(ls_stockdimension))); ls_requireddimension := lower(ltrim(rtrim(ls_requireddimension))); if length(ls_requireddimension) = 0 then exit ; end if ; if ls_requireddimension is null then exit ; end if ; li_pos := nvl(instr(ls_requireddimension, ls_delimiter,1,1),0); if li_pos > 0 then ls_tempreq := substr(ls_requireddimension,1,li_pos - 1); ls_requireddimension := substr(ls_requireddimension,li_pos + 1); else ls_tempreq := ls_requireddimension ; ls_requireddimension := '' ; end if; li_pos := nvl(instr(ls_stockdimension, ls_delimiter,1,1),0); if li_pos > 0 then ls_tempstk := substr(ls_stockdimension,1,li_pos - 1); ls_stockdimension := substr(ls_stockdimension,li_pos + 1); else ls_tempstk := ls_stockdimension ; ls_stockdimension := '' ; end if; lc_stk_dimension := to_number(ls_tempstk) ; lc_req_dimension := to_number(ls_tempreq) ; if lc_trimwidth is null then lc_trimwidth := 0 ; end if ; lc_stk_dimension := lc_stk_dimension - lc_trimwidth; if lc_req_dimension > lc_stk_dimension then ls_retval := 'N' ; return ls_retval ; end if; lc_trimwidth := 0 ; if length(ls_stockdimension) = 0 then exit ; end if ; end loop; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX VISITOR_INFO_X ON VISITOR_INFO (VISITOR_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_FEAS_X ON PROJ_FEAS (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AREADESCR ( LS_FLD_NAME VARCHAR , LS_MOD_NAME VARCHAR , LS_FLD_VALUE VARCHAR ) RETURN VARCHAR IS LS_DESCR VARCHAR ( 30 ) ; BEGIN SELECT DESCR INTO LS_DESCR FROM GENCODES WHERE TRIM(FLD_NAME) = LS_FLD_NAME AND TRIM(MOD_NAME) = LS_MOD_NAME AND TRIM(FLD_VALUE) = LS_FLD_VALUE; RETURN LS_DESCR ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LICEMAILID (as_emp_code in char, as_emp_code__ref in char) return varchar as emaillist varchar(500); begin declare emp1 varchar(50):=''; emp2 varchar(50):=''; begin emaillist :='X'; dbms_output.put_line('----------DDF_GET_LICEMAILID--------------------'); select email_id_off into emp1 from employee where emp_code =as_emp_code; select email_id_off into emp2 from employee where emp_code =as_emp_code__ref; if length(trim(emp1)) > 0 then emaillist := emp1; end if; if length(trim(emp2)) > 0 then emaillist := emaillist ||','|| emp2; end if; dbms_output.put_line('[emaillist]'||emaillist); exception when NO_DATA_FOUND then dbms_output.put_line('[x]'); end; return emaillist; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BOM_ITEM_CONF_ACT ON BOM (ITEM_CODE, CONFIRMED, ACTIVE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CRTERM_DESCR (as_crterm char,as_flag char) return Varchar2 is ls_descr crterm.descr%type; begin if as_flag='D' then select crterm.descr into ls_descr from crterm where crterm.cr_term =as_crterm; end if; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_REP_TO_INFO ( as_infotype in char, as_poscoderepto in char) return varchar is info char(250); begin if trim(as_infotype) = 'C' then begin select decode( emp_code, null, emp_code, ' ', emp_code, emp_code) into info from employee where pos_code = as_poscoderepto and rownum = 1; end; end if; if trim(as_infotype) = 'H' then begin select decode( stan_code__hq, null, stan_code__hq, ' ', stan_code__hq, stan_code__hq ) into info from employee where pos_code = as_poscoderepto and rownum = 1; end; end if; if trim(as_infotype) = 'D' then begin select decode( st.descr, null, st.descr, ' ', st.descr, st.descr ) into info from employee e, station st where e.stan_code__hq = st.stan_code(+) and e.pos_code = as_poscoderepto and rownum = 1; end; end if; if trim( as_infotype) = 'N' then begin select decode(emp_fname, null, nvl(rtrim(emp_mname),' ')||' '||nvl(rtrim(emp_lname),' ') ||' '||nvl(rtrim(emp_fname),' '), ' ', nvl(rtrim(emp_fname),' ')||' '||nvl(rtrim(emp_mname),' ') ||' '||nvl(rtrim(emp_lname),' '), nvl(rtrim(emp_fname),' ')||' '||nvl(rtrim(emp_mname),' ') ||' '||nvl(rtrim(emp_lname),' ')) into info from employee where pos_code = as_poscoderepto and rownum = 1; end; end if; return info; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RCP_DISHNR_CALC_TOTAL (as_sitecode Char,as_cust_code__from Char,as_cust_code__to Char, as_date__from date,as_date__to date) return decimal is ldec_total decimal(10,2); begin select (case when sum(rcpdishnr.net_amt) is null then 0 else sum(rcpdishnr.net_amt) end - case when sum(rcpdishnr.bank_charges) is null then 0 else sum(rcpdishnr.bank_charges) end) into ldec_total from rcpdishnr, customer, receipt, site where rcpdishnr.cust_code = customer.cust_code and rcpdishnr.receipt_no = receipt.tran_id and rcpdishnr.site_code = site.site_code and rcpdishnr.confirmed = 'Y' AND rcpdishnr.site_code = as_sitecode AND rcpdishnr.cust_code >= as_cust_code__from AND rcpdishnr.cust_code <= as_cust_code__to AND rcpdishnr.tran_date >= as_date__from AND rcpdishnr.tran_date <= as_date__to; return ldec_total; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_REF_LOAN (loan_loan_no CHAR, frdate DATE, todate DATE) return CHAR IS ls_reco_no CHAR(10); ld_issdt DATE; ld_refdt DATE; li_cnt NUMBER; begin ld_issdt := null; ls_reco_no := null; select issue_date into ld_issdt from loans where loan_no_ref =loan_loan_no; if ld_issdt <> null then SELECT min(loan_reco.reco_date), min(loan_reco.reco_no) into ld_refdt, ls_reco_no FROM loan_reco, loans WHERE ( loan_reco.loan_no = loans.loan_no ) and ( ( loan_reco.loan_no = loan_loan_no ) AND ( loan_reco.confirmed = 'Y' ) ) and ( loan_reco.RECO_DATE >= frdate and loan_reco.RECO_DATE <= todate and loan_reco.reco_date <= ld_issdt); end if; return ls_reco_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_MET_MST force AS OBJECT ( SC_CODE VARCHAR2(30), CHEM_NAME VARCHAR2(150), SPECIALITY VARCHAR2(120), PLANNED_VISIT VARCHAR2(10), CLASS_DESCR VARCHAR2(60), CATEGORY VARCHAR2(60), LOCALITY VARCHAR2(120), ROUTE_TYPE VARCHAR2(60), MET_DATES VARCHAR2(120), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), DIVISION VARCHAR2(30), EMP_CODE VARCHAR2(30), EMP_NAME VARCHAR2(50), HEAD_QUAT VARCHAR2(50), DESIGN VARCHAR2(30), CHEM_ADDR VARCHAR2(500) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXAMT_PERCUP (as_tran_id taxtran.tran_id%type,as_tran_code taxtran.tran_code%type,as_tax_perc taxtran.tax_perc%type ,as_flag char ) return number is t_tax_amt taxtran.tax_amt%type; begin if as_flag = 'T' then select sum(tax_amt) into t_tax_amt from taxtran where tran_id = as_tran_id and tran_code = as_tran_code and tax_perc = as_tax_perc; elsif as_flag = 'X' then select sum(taxable_amt) into t_tax_amt from taxtran where tran_id = as_tran_id and tran_code = as_tran_code and tax_perc = as_tax_perc; elsif as_flag = 'NF' then select sum(b.amount) into t_tax_amt from taxtran a,distord_issdet b,item c where a.tran_id = b.tran_id and a.line_no = b.line_no and b.item_code = c.item_code and a.tran_id = as_tran_id and a.tran_code = as_tran_code and c.loc_type not like 'F%' and a.tax_perc = as_tax_perc ; elsif as_flag = 'LF' then select sum(b.amount) into t_tax_amt from taxtran a,distord_issdet b,item c where a.tran_id = b.tran_id and a.line_no = b.line_no and b.item_code = c.item_code and a.tran_id = as_tran_id and a.tran_code = as_tran_code and c.loc_type like 'F%' and a.tax_perc = as_tax_perc ; end if ; if t_tax_amt is null then t_tax_amt :=0; end if ; return t_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAXENVSEQ (as_trancode in char, as_taxenv in char,as_taxcode in char) return number is ll_cnt number(6) := 0; ll_seqno number(6) := 0; begin ll_cnt :=0; begin select count(1) into ll_cnt from tenvseq where ref_ser = as_trancode and tax_env = as_taxenv; exception when others then ll_cnt := 0; end; begin if ll_cnt = 0 then select seq_no into ll_seqno from tenvseq where ref_ser = ' ' and tax_env = as_taxenv and tax_code = as_taxcode; else select seq_no into ll_seqno from tenvseq where ref_ser = as_trancode and tax_env = as_taxenv and tax_code = as_taxcode; end if; exception when others then ll_seqno := 0; end; return ll_seqno ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_CLG_RATE ( as_ID in char ,as_flag in char ) return number is ll_amt number(16,2); begin begin if as_flag = 'E' then select sum(quantity__stduom * nvl(rate__clg,0)) into ll_amt From despatchdet Where desp_id = as_ID ; else /* Commnted Due to the Old Logic was seted on the Function select sum(quantity * nvl(rate__clg,0) ) into ll_amt from distord_issdet where ( tran_id = as_ID ); */ select round(sum(distord_issdet.quantity * ((distord_issdet.rate__clg) - ((distord_issdet.rate__clg * distord_issdet.discount / 100)))),3) Amounts into ll_amt from distord_issdet where tran_id = as_ID ; end if; exception when others then ll_amt := 0; end; RETURN ll_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RECEIVABLES_TRAN_SER_REF_NO ON RECEIVABLES (TRAN_SER, REF_NO, LINE_NO__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SMKT_TIME_IN_MIN (F_TIME IN VARCHAR2) RETURN NUMBER AS V_CONVERT NUMBER; BEGIN IF (LENGTH(TRIM(F_TIME)) = 8) AND SUBSTR(F_TIME,3,1) = ':' AND INSTR(F_TIME,' ') = 6 AND SUBSTR(F_TIME,7,2) IN ('AM','PM') AND (SUBSTR(F_TIME,1,1)*SUBSTR(F_TIME,2,1)* SUBSTR(F_TIME,4,1)*SUBSTR(F_TIME,5,1))*0 = 0 THEN IF F_TIME LIKE '12%AM' THEN V_CONVERT := TO_NUMBER(SUBSTR(F_TIME,4,2)); ELSIF F_TIME LIKE '%AM' OR F_TIME LIKE '12%PM' THEN V_CONVERT := TO_NUMBER((SUBSTR(F_TIME,1,2)*60) + (SUBSTR(F_TIME,4,2))); ELSIF F_TIME LIKE '%PM' THEN V_CONVERT := TO_NUMBER((SUBSTR(F_TIME,1,2)*60) + (SUBSTR(F_TIME,4,2))) + 720; END IF; ELSE V_CONVERT := NULL; END IF; RETURN V_CONVERT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DRUG_LIC_NEW ( as_var_name char ,as_fin_ent char, as_site_code char) return char is ls_reg_no char (500); mvar_value char (25); as_var_name1 char (25); as_fin_ent1 char (25); as_site_code1 char (25); begin if as_var_name is null or length(as_var_name) = 0 then as_var_name1 := '' ; else as_var_name1 := as_var_name; end if; if as_fin_ent is null or length(as_fin_ent) = 0 then as_fin_ent1 := '' ; else as_fin_ent1 := as_fin_ent ; end if; if as_site_code is null or length(as_site_code) = 0 then as_site_code1 := '' ; else as_site_code1 := as_site_code; end if; select var_value into mvar_value from disparm where prd_code = '999999' and var_name = as_var_name; select reg_no || ' ' || nvl(to_char(reg_date,'dd/mm/yy'),'') into ls_reg_no from siteregno where fin_entity = as_fin_ent and site_code = as_site_code and ref_code = mvar_value; if ls_reg_no is not null then return ls_reg_no; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_SR before insert or update on sreturn referencing old as old new as new FOR EACH ROW declare billno sreturn.cust_ref%type; billno1 sreturn.cust_ref%type; begin billno := trim(:new.cust_ref); select Replace(translate(billno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into billno1 from dual; if (billno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in customer reference [' || billno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ESI_ELIGIBILITY (AS_EMP_CODE CHAR, AS_PRD_CODE CHAR , AS_PROC_TYPE CHAR , AS_ESIWAGES_ADCODE CHAR , AC_ESIWAGES NUMBER, AS_BASE_PRDCODE CHAR) RETURN NUMBER IS M_RETURN NUMBER(16,4) :=1; M_VAL NUMBER(16,4) :=1; M_FRDATE DATE; M_TODATE DATE; M_VAL2 NUMBER(16,4); BEGIN IF AS_PROC_TYPE = 'PP' THEN IF AS_PRD_CODE = AS_BASE_PRDCODE THEN IF AC_ESIWAGES IS NULL OR AC_ESIWAGES = 0 OR AC_ESIWAGES > 21000 THEN M_RETURN := 0; END IF; ELSIF AC_ESIWAGES > 21000 THEN SELECT FR_DATE INTO M_FRDATE FROM PERIOD WHERE CODE = AS_PRD_CODE; SELECT ADD_MONTHS(M_FRDATE ,6) - 1 INTO M_TODATE FROM DUAL; SELECT COUNT(1) INTO M_VAL FROM PAYROLL_PROJDET WHERE EMP_CODE = AS_EMP_CODE AND AD_CODE = 'DW034' AND PRD_CODE IN (SELECT CODE FROM PERIOD WHERE FR_DATE >= M_FRDATE AND FR_DATE <= M_TODATE) AND AMOUNT > 0; IF M_VAL = 0 THEN M_RETURN := 0; END IF; END IF; ELSE SELECT AMOUNT INTO M_VAL2 FROM PAYROLL_PROJDET WHERE EMP_CODE = AS_EMP_CODE AND AD_CODE = AS_ESIWAGES_ADCODE AND PRD_CODE = AS_PRD_CODE; IF M_VAL2 IS NULL THEN M_VAL2 := AC_ESIWAGES; END IF; IF M_VAL2 > 21000 THEN SELECT FR_DATE INTO M_FRDATE FROM PERIOD WHERE CODE = AS_PRD_CODE; SELECT ADD_MONTHS(M_FRDATE ,6) - 1 INTO M_TODATE FROM DUAL; SELECT COUNT(1) INTO M_VAL FROM PAYROLL_PROJDET WHERE EMP_CODE = AS_EMP_CODE AND AD_CODE = 'DW034' AND PRD_CODE IN (SELECT CODE FROM PERIOD WHERE FR_DATE >= M_FRDATE AND FR_DATE <= M_TODATE) AND AMOUNT > 0; IF M_VAL = 0 THEN M_RETURN := 0; END IF; END IF; END IF; RETURN M_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_QTY_IND (as_purc_order CHAR) return number is ls_retval NUMBER(1); ls_ind_no CHAR(12); ls_ord_qty number(14,3); ls_op_reas VARCHAR2(40); ls_ind_qty_std number(14,3); ls_tot_qty number(14,3); cursor c1 is SELECT PORDDET.IND_NO, INDENT.ORD_QTY,PORDDET.OP_REASON,INDENT.QUANTITY__STDUOM FROM PORDDET, INDENT WHERE ( PORDDET.IND_NO = INDENT.IND_NO (+)) AND ( ( PORDDET.PURC_ORDER = as_purc_order) AND ( PORDDET.IND_NO IS NOT NULL ) ) ORDER BY PORDDET.PURC_ORDER ASC,PORDDET.IND_NO ASC, PORDDET.LINE_NO ASC; begin ls_retval := 1; open c1 ; LOOP fetch c1 into ls_ind_no,ls_ord_qty,ls_op_reas,ls_ind_qty_std; exit when c1%NOTFOUND; select case when (sum(case when porddet.quantity__stduom is null then 0 else porddet.quantity__stduom end )) is null then 0 else (sum(case when porddet.quantity__stduom is null then 0 else porddet.quantity__stduom end )) end into ls_tot_qty from porddet where ( porddet.ind_no = ls_ind_no) and ( porddet.purc_order = as_purc_order); if ((ls_tot_qty + ls_ord_qty) > ls_ind_qty_std and (( ls_op_reas is null) or (length(trim(ls_op_reas))) = 0)) then ls_retval := 0; return ls_retval; else ls_retval := 1; end if; END LOOP; close c1; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSINVDSDT (as_desp_date in despatch.desp_Date%type) return number is FLAG NUMBER(1); --ls_count number(10,0); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_DESP_LRDT'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then --select count(*) from dual WHERE ? >SYSDATE ; if as_desp_date > sysdate then RETURN 1; Else RETURN 0; end if; else RETURN 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_MRP ( lsite_code IN CHAR, litem_code IN CHAR, ad_from_date IN DATE) RETURN NUMBER IS ld_eff_qty NUMBER(14,3); ldt_crea_date DATE; BEGIN /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code; if ad_from_date < ldt_crea_date then return 0; end if; */ SELECT SUM(qty) INTO ld_eff_qty FROM ( SELECT SUM(a.quantity-a.alloc_qty) qty FROM STOCK a, INVSTAT b , LOCATION c WHERE a.loc_code = c.loc_code AND b.inv_stat = c.inv_stat AND NVL(b.stat_type, ' ') <> 'S' AND a.site_code = lsite_code AND a.item_code = litem_code AND NVL(b.plan_prod,'N') = 'Y' UNION ALL SELECT NVL((SUM(eff_qty) * -1),0) qty FROM INVTRACE a, LOCATION b, INVSTAT c WHERE a.loc_code = b.loc_code AND b.inv_stat = c.inv_stat AND NVL(c.stat_type, ' ') <> 'S' AND a.item_code = litem_code AND a.site_code = lsite_code AND NVL(c.plan_prod,'N') = 'Y' AND a.EFF_date > ad_from_date); IF ld_eff_qty IS NULL THEN ld_eff_qty := 0; END IF; RETURN (ld_eff_qty); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GRADEMTHAD_DATEWISE ON GRADE_MTHAD (PAY_TABLE, GRADE_CODE, MONTH_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYARR_TO_PROC_PRD_EMP ON PAYARR_TO_PROC (EMP_CODE, PRD_CODE, PROC_TYPE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DISC_TYPE_NEW (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_tax_code in char ) return varchar2 is lc_rate_type varchar2(100); ls_var_value tax.tax_code%type; as_line_no char(3); lc_tax_perc number(1,2); begin if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 3 then as_line_no := rtrim(ltrim(ls_line_no)); end if; --select tax_code -- into ls_var_value -- from tax -- where tax_code = ls_tax_code; select MAX(nvl(RATE_TYPE,' ')) into lc_rate_type from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and tax_code in ( select column_value from TABLE(csv_to_row(ls_tax_code)) ) ; RETURN lc_rate_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SCHEME_APPL_DET_SITE_CODE ON SCHEME_APPLICABILITY_DET (SCHEME_CODE, SITE_CODE, STATE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GL_ALLAC_ALLSITE (m_frst_date in date, m_date_from in date,m_to_date in date, m_sundry_type in char, m_sundry_code in char, m_site_code in char) return number is ld_day_op_bal number(14,3) := 0; ld_day_op_bal_site number(14,3) := 0; ls_sitecode char(5) := ''; ls_code_fr char(6) := ''; ls_code_to char(6) := ''; CURSOR c_sitecode is select distinct site_code from sundrybal a, period b where a.sundry_code= m_sundry_code and a.prd_code = b.code and b.fr_date >= m_frst_date and b.fr_date <= m_to_date; BEGIN OPEN c_sitecode; LOOP FETCH c_sitecode into ls_sitecode; EXIT WHEN c_sitecode%notfound; ld_day_op_bal_site := fn_rdayop_gl_allac (m_frst_date,m_date_from,m_sundry_type,m_sundry_code,ls_sitecode); if ld_day_op_bal_site is null then ld_day_op_bal_site := 0; end if; ld_day_op_bal := ld_day_op_bal + ld_day_op_bal_site; END LOOP; CLOSE c_sitecode; Return ld_day_op_bal; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_WO_OBSRV_STEP ON WO_OBSRV_STEP (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BOMDET_QTYPER__UNIT ( as_bomcode bomdet.bom_code%type, as_operation bomdet.operation%type, as_item_ref bomdet.item_ref%type,as_item_code bomdet.item_code%type ) return varchar2 is qtyper__unit bomdet.qty_per__unit%type; begin qtyper__unit := ''; select trim(bomdet.qty_per__unit) into qtyper__unit from bomdet where bomdet.bom_code = as_bomcode and bomdet.operation = as_operation and bomdet.item_code = as_item_code and rtrim(bomdet.item_ref) = rtrim(as_item_ref); if (qtyper__unit) is null or length(qtyper__unit) = 0 then qtyper__unit :=''; end if; return qtyper__unit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_UNCONF_QC_SAMPLE_NO (as_site_code char, as_rcp_no char,as_item_code char,as_lot_no char,flag char) return varchar2 is ls_data varchar2(10); begin if flag = 'C' then SELECT CASE WHEN nvl(COUNT(DISTINCT QC_SAMPLE.QORDER_NO),0) = 0 THEN 'N' ELSE 'Y' END Qc_Order_Sample_Tran_id_Cnt INTO ls_data FROM QC_ORDER , qc_sample WHERE QC_ORDER.QORDER_NO = QC_SAMPLE.QORDER_NO AND QC_ORDER.LOT_NO = QC_SAMPLE.LOT_NO AND QC_ORDER.SITE_CODE = as_site_code AND QC_ORDER.LOT_NO= as_lot_no AND QC_ORDER.PORCP_NO = as_rcp_no AND QC_ORDER.STATUS = 'U'; elsif flag = 'T' then SELECT QC_SAMPLE.TRAN_ID into ls_data FROM QC_ORDER , qc_sample WHERE QC_ORDER.QORDER_NO = QC_SAMPLE.QORDER_NO AND QC_ORDER.LOT_NO = QC_SAMPLE.LOT_NO AND QC_ORDER.SITE_CODE = as_site_code AND QC_ORDER.LOT_NO= as_lot_no AND QC_ORDER.PORCP_NO = as_rcp_no AND QC_ORDER.STATUS = 'U'; elsif flag = 'Q' then SELECT to_char(qty_sample) into ls_data FROM SITEITEM WHERE SITE_CODE = as_site_code AND ITEM_CODE = as_item_code; end if; return ls_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ENTITYCODEPOPHELP AS FUNCTION getEntityCodeType (entityCode in char) RETURN ENTITYCODEMASTERTABLE PIPELINED ; END ENTITYCODEPOPHELP; CREATE OR REPLACE PACKAGE BODY ENTITYCODEPOPHELP AS FUNCTION getEntityCodeType (entityCode in char) RETURN ENTITYCODEMASTERTABLE PIPELINED AS BEGIN if (entityCode= 'E') THEN for x in(select trim(EMP_CODE) AS EMP_CODE,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS VISITED_WITH from employee where confirmed='Y') LOOP PIPE ROW (ENTITYCODEMASTER(x.EMP_CODE,x.VISITED_WITH)); END LOOP; else if (entityCode = 'S') THEN for x in(SELECT trim(SALES_PERS) AS EMP_CODE,FN_GET_SALES_NAME(SALES_PERS) ||' (' || LTRIM(RTRIM(SALES_PERS)) || ') ' AS VISITED_WITH FROM SALES_PERS WHERE ACTIVE ='Y' ) LOOP PIPE ROW (ENTITYCODEMASTER(x.EMP_CODE,x.VISITED_WITH)); END LOOP; else if (entityCode = 'U') THEN for x in(SELECT trim(EMP_CODE) AS EMP_CODE,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS VISITED_WITH FROM USERS where status='C' ) LOOP PIPE ROW (ENTITYCODEMASTER(x.EMP_CODE,x.VISITED_WITH)); END LOOP; RETURN; end if; end if; end if; end; END ENTITYCODEPOPHELP; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PRICELIST_RATE (as_price_list in char, ad_tran_date in date, as_item_code in char) return number is mrate number(14,3); begin select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE GETDCRID AS OBJECT ( DCR_ID VARCHAR2(120) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETMAILSUBJECT_SIGNFOR_AR (tran_id attd_regularize.tran_id%type, emp_code attd_regularize.emp_code%type, attd_date attd_regularize.attd_date%type, reason_code attd_regularize.reason_code%type, in_time attd_regularize.in_time%type, out_time attd_regularize.out_time%type, descr char, designation char, org_in_time attd_regularize.org_in_time%type, org_out_time attd_regularize.org_out_time%type, auth_sign attd_regularize.auth_sign%type, remarks attd_regularize.remarks%type, chg_date attd_regularize.chg_date%type, wrkflw_status attd_regularize.wrkflw_status%type, reason_descr char, sht_in_time char, sht_out_time char, day_no attd_regularize.day_no%type, report_to attd_regularize.report_to%type, report_to__admin attd_regularize.report_to__admin%type, appl_date attd_regularize.appl_date%type, flag in varchar,apprv_flag varchar) return char Is retrun_string varchar(1000); e_r_name varchar(100); begin retrun_string := 'Attendance regularization '; if flag = 'M' then if apprv_flag = 'R' then retrun_string := retrun_string || 'recommendation of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; end if; select trim(ddf_get_masters_name('EMPLOYEE',emp_code,'F')) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' for '|| initcap(TO_CHAR(attd_date ,'DD-Mon-YYYY')); elsif flag = 'S' then if apprv_flag = 'R' then retrun_string := retrun_string || 'recommendation of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; end if; select trim(ddf_get_masters_name('EMPLOYEE',emp_code,'F')) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' for '|| initcap(TO_CHAR(attd_date ,'DD-Mon-YYYY')); end if; return trim(retrun_string); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ORDERPOPHELPPACKAGE AS FUNCTION getOrderPophelp (asOrderType in char, asLoginSite in char) RETURN orderMasterTable PIPELINED; END; CREATE OR REPLACE PACKAGE BODY ORDERPOPHELPPACKAGE AS FUNCTION getOrderPophelp (asOrderType in char, asLoginSite in char) RETURN orderMasterTable PIPELINED IS BEGIN IF asOrderType = 'S' THEN FOR x IN ( SELECT o.sale_order order_no, o.order_date order_date, o.cust_code party_code, m.cust_NAME party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, o.item_ser DIVISION, TRIM(t.DESCR) AS STATE FROM sorder o, customer m, STATE t WHERE m.cust_code = o.cust_code and o.status not in ('C','X') and o.confirmed = 'Y' and o.site_code = asLoginSite AND m.STATE_CODE = t.STATE_CODE (+) ) LOOP PIPE ROW (orderMaster(x.order_no,x.order_date,x.party_code, x.party_Name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asOrderType = 'I' THEN FOR x IN ( SELECT o.sale_order order_no, o.order_date order_date, o.cust_code party_code, m.cust_NAME party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, o.item_ser DIVISION, TRIM(t.DESCR) AS STATE FROM sorder o, customer m, STATE t WHERE m.cust_code = o.cust_code and o.status not in ('C','X') and o.confirmed = 'Y' and o.site_code = asLoginSite AND m.STATE_CODE = t.STATE_CODE union all SELECT o.dist_order order_no, o.order_date order_date, o.site_code__dlv party_code, m.descr party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(t.DESCR) AS STATE FROM distorder o, site m, STATE t WHERE m.site_code = o.site_code__dlv and o.site_code = asLoginSite and o.status not in ('C','X') and o.confirmed = 'Y' AND m.STATE_CODE = t.STATE_CODE (+) ) LOOP PIPE ROW (orderMaster(x.order_no,x.order_date,x.party_code, x.party_Name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asOrderType = 'D' THEN FOR x IN ( SELECT o.dist_order order_no, o.order_date order_date, o.site_code__dlv party_code, m.descr party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(t.DESCR) AS STATE FROM distorder o, site m, STATE t WHERE m.site_code = o.site_code__dlv and o.site_code = asLoginSite and o.status not in ('C','X') and o.confirmed = 'Y' AND m.STATE_CODE = t.STATE_CODE (+) ) LOOP PIPE ROW (orderMaster(x.order_no,x.order_date,x.party_code, x.party_Name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asOrderType = 'P' THEN FOR x IN ( SELECT o.tran_id order_no, o.tran_date order_date, o.supp_code party_code, m.supp_NAME party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, o.item_ser DIVISION, TRIM(t.DESCR) AS STATE FROM porcp o, supplier m, STATE t WHERE m.supp_code = o.supp_code and o.site_code = asLoginSite and o.confirmed = 'Y' and o.TRAN_SER = 'P-RCP' AND m.STATE_CODE = t.STATE_CODE (+) ) LOOP PIPE ROW (orderMaster(x.order_no,x.order_date,x.party_code, x.party_Name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asOrderType = 'W' THEN FOR x IN ( SELECT o.tran_id order_no, o.tran_date order_date, o.site_code party_code, m.descr party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(t.DESCR) AS STATE FROM workorder_receipt o, site m, STATE t WHERE m.site_code = o.site_code and o.site_code = asLoginSite and o.confirmed = 'Y' AND m.STATE_CODE = t.STATE_CODE (+) ) LOOP PIPE ROW (orderMaster(x.order_no,x.order_date,x.party_code, x.party_Name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asOrderType = 'R' THEN FOR x IN ( SELECT o.tran_id order_no, o.tran_date order_date, o.site_code party_code, m.descr party_Name, TRIM(NVL(m.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(t.DESCR) AS STATE FROM distord_rcp o, site m, STATE t WHERE m.site_code = o.site_code and o.site_code = asLoginSite and o.confirmed = 'Y' AND m.STATE_CODE = t.STATE_CODE (+) ) LOOP PIPE ROW (orderMaster(x.order_no,x.order_date,x.party_code, x.party_Name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; END orderPopHelpPackage; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PO_APPV (po_number varchar2 ) RETURN varchar2 IS last_appr_emp_code varchar2(10) := ''; max_lines number ; emp_grade varchar2(10) := ''; next_apprv_code varchar2(10) := '' ; reporting_emp_code varchar2(10) := ''; rep_emp_code varchar2(10) := ''; flag boolean :=false ; flag_LV1 number; BEGIN select get_entity_code(po_number) into last_appr_emp_code from dual ; select emp_code into reporting_emp_code from employee where emp_code = last_appr_emp_code; select report_to into rep_emp_code from employee where emp_code = last_appr_emp_code; select TRIM(grade) into emp_grade from employee where emp_code = rep_emp_code; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV1'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(last_appr_emp_code , emp_grade ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV2'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV2'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV3'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV3'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV4'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV4'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; --IF next_apprv_code is NULL or next_apprv_code = '' then return '999999'; end if; IF next_apprv_code is NULL or next_apprv_code = '' THEN Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV5'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; end if; select instr((Select Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV5'), trim(emp_grade)) into flag_LV1 from dual; if flag_LV1 > 0 then flag := true; select get_next_po_auth(reporting_emp_code , trim(emp_grade) ) into next_apprv_code from dual ; return next_apprv_code ; end if; -- level 6 if flag = false then flag := true; select get_next_po_auth(reporting_emp_code, trim(emp_grade)) into next_apprv_code from dual ; IF next_apprv_code is NULL or next_apprv_code = '' then Select Regexp_Substr(Replace((Select B.Var_Value From Disparm B Where B.Var_Name = 'PO_APRV_LV1'),' '),'[^,]+', 1,Level) into emp_grade From Dual Connect By Regexp_Substr('' , '[^,]+', 1, Level) Is Not Null; ELSE return next_apprv_code ; END IF; END IF; IF next_apprv_code is NULL or next_apprv_code = '' then RETURN ''; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMPEXPERIENCE_EMPFRDT ON EMPEXPERIENCE (EMP_CODE, FROM_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MRP_CLG (as_tran_id char) return number is tot_amount number (14,3); begin select sum(nvl(quantity,0.00)*nvl(rate__clg,0.00) + nvl(tax_amt,0.00)) into tot_amount from distord_issdet where tran_id = as_tran_id; return tot_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RADD_DAYS ( ARG1 DATE , ARG2 NUMBER) RETURN DATE IS RET_DATE DATE; BEGIN RET_DATE := ARG1 + ARG2; RETURN RET_DATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_TRANS_DEBIT_MULTI_SITE (ldate_fr in date, ldate_to in date, lsite_code in char, lacct_code in char) return number is lc_dr_sum number(14,3); begin Select nvl(Sum(dr_amt),0) into lc_dr_sum from gltran where instr(lsite_code,TRIM(site_code)) > 0 and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_COLLECTION (ad_todate in date, as_site_code in char, as_amt_as in number) return number is lc_total number(14,2) ; receipt_net_amt number(14,2); RCPDISHNR_net_amt number(14,2); begin BEGIN SELECT SUM(NVL(RECEIPT.NET_AMT,0)/as_amt_as) INTO receipt_net_amt FROM RECEIPT, SITE WHERE ( receipt.site_code = site.site_code ) and ( receipt.SITE_CODE = as_site_code) AND ( receipt.TRAN_DATE = ad_todate ); IF receipt_net_amt IS NULL THEN receipt_net_amt := 0; END IF; EXCEPTION WHEN NO_DATA_FOUND then receipt_net_amt := 0; END; BEGIN SELECT SUM(NVL(RCPDISHNR.NET_AMT,0)/as_amt_as) INTO RCPDISHNR_net_amt FROM RCPDISHNR, SITE WHERE ( rcpdishnr.site_code = site.site_code ) and ( RCPDISHNR.site_code = as_site_code ) AND ( RCPDISHNR.TRAN_DATE = ad_todate ); IF RCPDISHNR_net_amt IS NULL THEN RCPDISHNR_net_amt := 0; END IF; EXCEPTION WHEN NO_DATA_FOUND then RCPDISHNR_net_amt := 0; END; lc_total := receipt_net_amt - RCPDISHNR_net_amt ; return lc_total ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIPT_TDATESITECON ON RECEIPT (TRAN_DATE, SITE_CODE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CATEGORY_STOCKIST ( as_emp_code VARCHAR2, as_category VARCHAR2 ) RETURN NUMBER IS a_retval NUMBER(1) := 0; a_count NUMBER(1); item_ser VARCHAR(5); BEGIN SELECT TRIM(item_ser) INTO item_ser FROM sales_pers WHERE TRIM(sales_pers) = TRIM(as_emp_code); IF ( item_ser = 'EN' ) THEN IF as_category IS NULL OR trim(as_category) = '' THEN a_retval := 0; ELSE a_retval := 1; END IF; ELSE a_retval := 1; END IF; RETURN a_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITDECL_ACCTYEAR ( Vi_Date_From In Date, Vi_Date_To In Date, Vi_acct_prd in char) Return Char Is ls_acctprd_code Char(6); Begin Begin SELECT CODE INTO ls_acctprd_code FROM ACCTPRD WHERE ACCTPRD.CODE = Vi_acct_prd AND((Vi_Date_From BETWEEN ACCTPRD.FR_DATE AND ACCTPRD.TO_DATE) OR (Vi_Date_To BETWEEN ACCTPRD.FR_DATE AND ACCTPRD.TO_DATE) or (ACCTPRD.FR_DATE between Vi_Date_From and Vi_Date_To) or (ACCTPRD.TO_DATE between Vi_Date_From and Vi_Date_To)); Exception When No_DatA_Found Then ls_acctprd_code := ' '; END; return ls_acctprd_code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SYSDATE return date is sys_date date; begin select sysdate into sys_date from dual; return sys_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BATCHLOAD_REPL_STATUS ON BATCHLOAD (REPL_STATUS, BATCH_ID, TRAN_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ADVANCE (as_site in char, as_stype in char, as_scode in char, as_prdcode in char, as_acctprd char) return number is lc_fieldvalue number ; Begin lc_fieldvalue := 0 ; select sum(nvl(adv_amt,0)) into lc_fieldvalue from sundrybal where ( acct_prd = as_acctprd ) AND ( prd_code = as_prdcode ) AND ( site_code = as_site ) AND ( sundry_type = as_stype ) AND ( sundry_code = as_scode ) ; return lc_fieldvalue ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GST_RATE_GP_AMT (as_trancode in taxtran.tran_code%type,as_tranid in taxtran.tran_id%type, al_lineno number, as_type in char, as_rateoramt in char,as_taxgroup in char) return number is lc_rateoramt number(16,2) := 0; ls_lineno char(3); -- as_type : G (sgst), H (cgst), I (igst) and J (cess) -- as_rateoramt : R or A begin begin -- get IGST rate select lpad(trim(to_char(al_lineno)),3, ' ') into ls_lineno from dual; exception when others then ls_lineno := ' '; end; if as_rateoramt = 'T' then begin -- taxable amount select taxable_amt into lc_rateoramt from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type in ('G','H','I') and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tt.line_no = ls_lineno and tm.tax_group = as_taxgroup and taxable_amt <> 0 and rownum = 1; exception when others then lc_rateoramt := 0; end; else if as_rateoramt = 'R' then begin -- rate select tax_perc into lc_rateoramt from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type = as_type and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tm.tax_group = as_taxgroup and tt.line_no = ls_lineno; exception when others then lc_rateoramt := 0; end; else begin -- rate select sum(tax_amt) into lc_rateoramt from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type = as_type and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tm.tax_group = as_taxgroup and tt.line_no = ls_lineno; exception when others then lc_rateoramt := 0; end; end if; end if; return lc_rateoramt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_VOUC_FLAG_CHK BEFORE INSERT OR UPDATE OF confirmed ON voucher referencing old as old new as new FOR EACH ROW --DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; BEGIN if :new.confirmed = 'Y' and :old.TRAN_MODE <> 'A' then for vouchdet in ( select tran_id,VOUCH_CREATED from porcp where tran_id in ( select distinct PRCP_ID from vouchrcp where tran_id = :new.tran_id ) ) loop begin if vouchdet.VOUCH_CREATED <> 'Y' then begin update porcp set VOUCH_CREATED = 'Y' where tran_id = vouchdet.tran_id ; exception when others then continue; end; end if; end; end loop; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GRP_SGRP_CODE (ls_code in char, ls_option in char) return char is ls_descr char(50); begin if ls_option = 'G' then select nvl(descr,' ') into ls_descr from gencodes where fld_name = 'GRP_CODE' and fld_value = ls_code and rownum = 1; else select nvl(descr, ' ') into ls_descr from gencodes where fld_name = 'SGRP_CODE' and fld_value = ls_code and rownum = 1; end if; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_OPSTK_REFID (as_sitecode in char, as_itemcode in char, as_loccode in char, adt_fromdate in date ) return char is ls_retval invtrace.ref_id%type ; ls_refid invtrace.ref_id%type ; begin select min(a.ref_id) into ls_refid from invtrace a where a.item_code = as_itemcode and a.site_code = as_sitecode and a.loc_code = as_loccode and a.tran_date = adt_fromdate ; return (ls_refid); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_MP before insert or update on misc_payment referencing old as old new as new FOR EACH ROW declare refno misc_payment.ref_NO%type; refno1 misc_payment.ref_NO%type; begin refno := trim(:new.ref_no); select Replace(translate(refno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into refno1 from dual; if (refno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in ref number [' || refno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_MR before insert or update on misc_receipt referencing old as old new as new FOR EACH ROW declare refno misc_receipt.ref_NO%type; refno1 misc_receipt.ref_NO%type; begin refno := trim(:new.ref_no); select Replace(translate(refno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into refno1 from dual; if (refno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in ref number [' || refno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_MV before insert or update on misc_voucher referencing old as old new as new FOR EACH ROW declare billno MISC_VOUCHER.BILL_NO%type; billno1 MISC_VOUCHER.BILL_NO%type; begin if trim(:new.tran_type) = 'CVH' then :new.bill_no := replace(:new.bill_no , ' ' , ''); :new.bill_no := replace(:new.bill_no , '/' , '-'); else billno := trim(:new.bill_no); select Replace(translate(billno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into billno1 from dual; if (billno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in bill number [' || billno1 ||']' ); end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOAD_QAUNTITY (as_inv_load_qty IN NUMBER,as_stock_quantity IN NUMBER,as_item_code IN CHAR,as_loc_code IN CHAR,as_event_date in date) RETURN number AS load_qty number; BEGIN if as_inv_load_qty is null OR as_inv_load_qty='0' then load_qty:= as_stock_quantity - FN_GET_STOCK_TRANFER_DATA('TRANSFER_IN',trim(as_item_code),trim(as_loc_code),trunc(sysdate))+FN_GET_STOCK_TRANFER_DATA('TRANSFER_OUT',trim(as_item_code),trim(as_loc_code),trunc(sysdate)); else load_qty:= as_inv_load_qty; end if; IF load_qty IS NULL THEN load_qty:=0; END IF; RETURN load_qty; END FN_GET_LOAD_QAUNTITY; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PLACARD (asdesp_id despatchdet.desp_id%type, as_flag char) return char is ls_inc_placard varchar2(1000); ls_pack_instr despatchdet.pack_instr%type; ls_pack_instr_data varchar2(1000); begin if as_flag = 'A' then /*ls_inc_placard*/ select trim(phy_attrib_6) into ls_inc_placard from item where item_code in (select item_code from despatchdet where desp_id = asdesp_id and rownum = 1); elsif as_flag = 'B' then /*Pack_instr*/ begin declare cursor c1 is select trim(pack_instr) from despatchdet where desp_id = asdesp_id; begin open c1; loop fetch c1 into ls_pack_instr; exit when c1%NOTFOUND; ls_pack_instr_data := ls_pack_instr_data || ls_pack_instr || ' , '; end loop; close c1; end; ls_inc_placard := ls_pack_instr_data; end; end if; return ls_inc_placard; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STOCK_TRANFER_DATA (as_calculate_column in varchar,as_item_code IN CHAR ,as_loc_code IN CHAR,as_event_date in date) RETURN number AS STOCK_TRANSFER_IN NUMBER; as_max_day_summ_date DATE; as_min_day_summ_date DATE; BEGIN SELECT MAX(EVENT_DATE) INTO as_max_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(as_loc_code) AND EVENT_DATE<=as_event_date; SELECT MIN(EVENT_DATE) INTO as_min_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(as_loc_code) AND EVENT_DATE > as_event_date ; IF as_min_day_summ_date IS NOT NULL THEN ------------------MIN_DAY_SUMM_DATE IS NOT NULL IF--------------------- if as_calculate_column = 'TRANSFER_IN' then SELECT SUM(STD.QUANTITY) into STOCK_TRANSFER_IN from STOCK_TRANSFER_DET STD,STOCK_TRANSFER ST WHERE TRIM(STD.LOC_CODE__TO)=TRIM(as_loc_code) AND STD.ITEM_CODE = as_item_code AND ST.CONFIRMED='Y' AND ST.TRAN_DATE >= as_max_day_summ_date AND ST.TRAN_DATE < as_min_day_summ_date AND ST.TRAN_ID=STD.TRAN_ID; end if; if as_calculate_column = 'TRANSFER_OUT' then SELECT SUM(STD.QUANTITY) into STOCK_TRANSFER_IN from STOCK_TRANSFER_DET STD,STOCK_TRANSFER ST WHERE TRIM(STD.LOC_CODE__FR)=TRIM(as_loc_code) AND STD.ITEM_CODE = as_item_code AND ST.CONFIRMED='Y' AND ST.TRAN_DATE >= as_max_day_summ_date AND ST.TRAN_DATE < as_min_day_summ_date AND ST.TRAN_ID=STD.TRAN_ID; end if; if as_calculate_column = 'BREAK_ADD_QTY' then SELECT SUM(SMIN.BROKEN_QTY) into STOCK_TRANSFER_IN FROM STRG_MEET_INVOICE SMIN WHERE TRIM(SMIN.DCR_ID) IN (SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.event_date >= as_max_day_summ_date AND sm.event_date < as_min_day_summ_date AND TRIM(sm.sales_pers) = trim(as_loc_code) ) AND SMIN.ITEM_CODE=as_item_code; end if; if as_calculate_column = 'BREAK_DEDUCT_QTY' then SELECT COUNT(*) into STOCK_TRANSFER_IN FROM STRG_MEET_INVOICE SMIN WHERE TRIM(SMIN.DCR_ID) IN (SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.event_date >= as_max_day_summ_date AND sm.event_date < as_min_day_summ_date AND TRIM(sm.sales_pers) = trim(as_loc_code) ) AND SMIN.stock_break='Y' AND SMIN.ITEM_CODE=as_item_code; end if; ELSE ------------------MIN_DAY_SUMM_DATE IS NULL IF--------------------- if as_calculate_column = 'TRANSFER_IN' then SELECT SUM(STD.QUANTITY) into STOCK_TRANSFER_IN from STOCK_TRANSFER_DET STD,STOCK_TRANSFER ST WHERE TRIM(STD.LOC_CODE__TO)=TRIM(as_loc_code) AND STD.ITEM_CODE = as_item_code AND ST.CONFIRMED='Y' AND ST.TRAN_DATE>= as_max_day_summ_date AND ST.TRAN_ID=STD.TRAN_ID; end if; if as_calculate_column = 'TRANSFER_OUT' then SELECT SUM(STD.QUANTITY) into STOCK_TRANSFER_IN from STOCK_TRANSFER_DET STD,STOCK_TRANSFER ST WHERE TRIM(STD.LOC_CODE__FR)=TRIM(as_loc_code) AND STD.ITEM_CODE = as_item_code AND ST.CONFIRMED='Y' AND ST.TRAN_DATE>= as_max_day_summ_date AND ST.TRAN_ID=STD.TRAN_ID; end if; if as_calculate_column = 'BREAK_ADD_QTY' then SELECT SUM(SMIN.BROKEN_QTY) into STOCK_TRANSFER_IN FROM STRG_MEET_INVOICE SMIN WHERE TRIM(SMIN.DCR_ID) IN (SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.event_date >= as_max_day_summ_date AND TRIM(sm.sales_pers) = trim(as_loc_code) ) AND SMIN.ITEM_CODE=as_item_code; end if; if as_calculate_column = 'BREAK_DEDUCT_QTY' then SELECT COUNT(*) into STOCK_TRANSFER_IN FROM STRG_MEET_INVOICE SMIN WHERE TRIM(SMIN.DCR_ID) IN (SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.event_date >= as_max_day_summ_date AND TRIM(sm.sales_pers) = trim(as_loc_code) ) AND SMIN.stock_break='Y' AND SMIN.ITEM_CODE=as_item_code; end if; END IF; IF STOCK_TRANSFER_IN IS NULL THEN STOCK_TRANSFER_IN:=0; END IF; RETURN STOCK_TRANSFER_IN; END FN_GET_STOCK_TRANFER_DATA; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FG_RATE (as_itemcode in item.item_code%type, as_refser in invtrace.ref_ser%type, as_refid in invtrace.ref_id%type) return number is lc_rate number(14,3) := 0; ls_saleorder char(10); ls_lineno char(3); lc_discount number(14,3) := 0; lc_tdis number(14,3) := 0; lc_adis number(14,3) := 0; begin if as_refser = 'QC-ORD' then -- begin select a.sale_order,a.line_no into ls_saleorder, ls_lineno from workorder a, qc_order b, workorder_receipt c where a.work_order = c.work_order and b.porcp_no = c.tran_id and b.qorder_no = as_refid and rownum = 1; if nvl(ls_saleorder,'@') = '@' or nvl(ls_lineno,'@') = '@' then lc_rate := 0; else select nvl(ddf_get_tax_details('S-ORD',ls_saleorder,ls_lineno,'TRADE_DISC_ONLY','P'),0) into lc_tdis from dual; select nvl(ddf_get_tax_details('S-ORD',ls_saleorder,ls_lineno,'ADDIS_DISC','P'),0) into lc_adis from dual; select rate,discount into lc_rate, lc_discount from sorddet where sale_order = ls_saleorder and line_no = ls_lineno ; if lc_rate is null then lc_rate := 0; end if; if lc_tdis is null then lc_tdis := 0; end if; if lc_adis is null then lc_adis := 0; end if; lc_tdis := lc_rate * lc_tdis / 100 ; lc_adis := lc_rate * lc_adis / 100 ; end if; -- end; -- exception -- WHEN NO_DATA_FOUND THEN -- lc_rate := 0; -- when others then -- lc_rate := 0; end if; if lc_rate is null then lc_rate := 0; end if; if lc_tdis is null then lc_tdis := 0; end if; if lc_adis is null then lc_adis := 0; end if; if lc_discount is null then lc_discount := 0; end if; if lc_rate = 0 then select sale_rate, std_disc into lc_rate, lc_discount from item where item_code = as_itemcode ; end if; if lc_rate is null then lc_rate := 0; end if; if lc_discount is null then lc_discount := 0; end if; lc_discount := lc_rate * lc_discount / 100 ; lc_rate := lc_rate - lc_discount - lc_tdis - lc_adis ; return lc_rate ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_FULLRET_CHK ( as_tranid in char) RETURN NUMBER IS ll_invcount number(3) := 0; ll_srcount number(3) := 0; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_invoiceid char(10); ls_fullret char(1); begin begin select full_ret, invoice_id into ls_fullret, ls_invoiceid from sreturn where tran_id = as_tranid; exception when others then ls_fullret := 'N'; ls_invoiceid:= '@@@'; end; if ls_fullret = 'Y' and ls_invoiceid is not null and length(trim(ls_invoiceid)) > 0 then begin select count(1) into ll_invcount from invoice_trace where invoice_id = ls_invoiceid; exception when others then ll_invcount:= 0; end; begin select count(1) into ll_srcount from sreturndet where tran_id = as_tranid; exception when others then ll_srcount:= 0; end; if ll_invcount <> ll_srcount then ll_retval := 1; end if; end if; RETURN ll_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01031: insufficient privileges -- CREATE OR REPLACE TRIGGER DT_PORDERTYPE_ADD BEFORE INSERT ON PORDERTYPE referencing old as old new as new FOR EACH ROW declare ldt_excutdate date; BEGIN raise_application_error( -20601, 'Item Series addition not allowed and it depends on other configuration'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_MULTI_VENDOR_STATUS ( as_supp_code__mnfr VARCHAR2, as_site_code CHAR, AS_item_code CHAR, as_ref_ser CHAR, as_tran_date DATE) RETURN NUMBER IS flag NUMBER(1); as_no_appr_supp NUMBER(1); as_no_status NUMBER(1); as_no_supp NUMBER(1); -------------- Following variable is added by Manoj Sarode on 02-Aug-2014 Start as_no_child_site NUMBER(1); as_no_parent_site NUMBER(1); as_asign_child_site site.site_code%type; as_parent_site site.site_code%type; -------------- Above variable is added by Manoj Sarode on 02-Aug-2014 End as_appr_supp siteitem.appr_supp%type; as_item_appr_supp item.appr_supp%type; as_cnt_appr_supp siteitem.appr_supp%type; as_no_cons_unaprv siteitem.no_cons_unaprv%type; AS_STATUS itemmnfr.status%type; as_vendor_qualify supplier.vendor_qualify%type; as_site_type NUMBER; lc_valid_upto DATE; lc_eff_from DATE; TYPE c1 IS REF CURSOR; CHK_supp_code__mnfr char(10); BEGIN DECLARE CURSOR c1 IS SELECT TRIM(regexp_substr(as_supp_code__mnfr,'[^,]+',1,level)) element FROM dual CONNECT BY level <= LENGTH(regexp_replace(as_supp_code__mnfr,'[^,]+')) + 1; --as_supp_code__mnfr; --TAKE THE SUPP_CODE BEGIN FOR i IN c1 LOOP CHK_supp_code__mnfr :=(i.element); FLAG := 0; as_appr_supp := 'N'; as_asign_child_site := as_site_code; SELECT COUNT(*) INTO as_site_type FROM site WHERE SITE_TYPE = 'R' AND SITE_CODE = as_site_code; IF as_site_type >0 THEN Flag := 1; RETURN Flag; END IF; SELECT COUNT(*) INTO as_cnt_appr_supp FROM siteitem WHERE site_code = as_site_code AND item_code = as_item_code; IF as_cnt_appr_supp > 0 THEN SELECT NVL(appr_supp,'N') INTO as_appr_supp FROM siteitem WHERE site_code = as_site_code AND item_code = as_item_code; -- ELSE -- as_appr_supp := 'N' ; END IF ; -- Following If entry for child site is not exists in SiteItem table then check for it's Parent site code. on 04-Aug-2014 Start IF as_cnt_appr_supp = 0 THEN -- SELECT COUNT(QUALIFY_GRP__SITE) INTO as_no_parent_site FROM SITE WHERE SITE_CODE = as_site_code ; SELECT COUNT(QUALIFY_GRP__SITE) INTO as_cnt_appr_supp FROM SITE WHERE SITE_CODE = as_site_code ; IF as_cnt_appr_supp = 1 THEN SELECT QUALIFY_GRP__SITE INTO as_parent_site FROM SITE WHERE SITE_CODE = as_site_code; SELECT COUNT(*) INTO as_cnt_appr_supp FROM siteitem WHERE site_code = as_parent_site AND item_code = as_item_code; IF as_cnt_appr_supp > 0 THEN SELECT NVL(appr_supp,'N') INTO as_appr_supp FROM siteitem WHERE site_code = as_parent_site AND item_code = as_item_code; ELSE as_appr_supp := 'N' ; END IF ; ELSE Flag := 0; -- If Parent site is not defined then dont allow to save. RETURN Flag; END IF; END IF; -- Above If entry for child site is not exists in SiteItem table then check for it's Parent site code. on 04-Aug-2014 End IF as_cnt_appr_supp = 0 OR as_appr_supp = 'Y' THEN as_vendor_qualify := 'N' ; -- Following more condition is added by Manoj Sarode- If SiteItem entry not exists then blank Manufacture code allowed For Purchase Indent only 05-SEP-2014 ----------- -- i.e AND as_ref_ser <> 'R-IND' IF as_cnt_appr_supp = 0 AND as_ref_ser <> 'R-IND' THEN SELECT NVL(appr_supp,'N') INTO as_item_appr_supp FROM ITEM WHERE ITEM_CODE = as_item_code ; END IF; IF as_item_appr_supp = 'Y' OR as_appr_supp = 'Y' THEN SELECT NVL(vendor_qualify,'N') INTO as_vendor_qualify FROM supplier WHERE supp_code = CHK_supp_code__mnfr; IF as_vendor_qualify = 'Y' THEN --- FOLLOWING LOGIC IS ADDED BY MANOJ SARODE - CHECK WHETHER STIE_CODE ENTRY EXISTS IN VQ TABLE OR NOT. IF YES THEN KEEP AS IT IS (I.E CHILD SITE CODE ) ELSE CONSIDER THE --PARENET SITE on 02-Aug-2014 start SELECT COUNT(*) INTO as_no_child_site FROM ( SELECT B.SITE_CODE FROM SUPP_APPRV A, SUPP_APPRV_SITE B WHERE A.SUPP_CODE__MNFR = B.SUPP_CODE__MNFR AND A.APPRV_SCOPE = 'S' AND B.STATUS <> 'I' AND A.SUPP_CODE__MNFR = CHK_supp_code__mnfr AND B.SITE_CODE = as_site_code AND as_tran_date BETWEEN B.eff_from AND B.valid_upto UNION SELECT B.SITE_CODE FROM SUPP_APPRV A, SUPP_APPRV_ITEM B WHERE A.SUPP_CODE__MNFR = B.SUPP_CODE__MNFR AND A.APPRV_SCOPE = 'I' AND B.STATUS <> 'I' AND A.SUPP_CODE__MNFR = CHK_supp_code__mnfr AND B.SITE_CODE =as_site_code AND B.ITEM_CODE = as_item_code AND as_tran_date BETWEEN B.eff_from AND B.valid_upto ) C; IF as_no_child_site = 0 THEN SELECT COUNT(QUALIFY_GRP__SITE) INTO as_no_parent_site FROM SITE WHERE SITE_CODE = as_site_code ; IF as_no_parent_site = 0 THEN Flag := 0; -- If entry for Parent site is not defined in Supp_apprv_site Or Supp_apprv_item then dont allow to save. RETURN Flag; ELSE SELECT QUALIFY_GRP__SITE INTO as_asign_child_site FROM SITE WHERE SITE_CODE = as_site_code; as_asign_child_site := as_asign_child_site; END IF; ELSE as_asign_child_site := as_site_code; END IF; --- Above LOGIC IS ADDED BY MANOJ SARODE - CHECK WHETHER STIE_CODE ENTRY EXISTS IN VQ TABLE OR NOT. IF YES THEN KEEP AS IT IS I.E CHILD SITE CODE ) ELSE CONSIDER THE --PARENET SITE on 02-Aug-2014 End SELECT STATUS, valid_upto, eff_from INTO AS_STATUS, lc_valid_upto, lc_eff_from FROM (SELECT B.status AS STATUS, B.valid_upto, B.eff_from FROM supp_apprv_item B, supp_apprv A WHERE B.site_code = as_asign_child_site AND A.supp_code__mnfr =B.supp_code__mnfr AND B.item_code = as_item_code AND B.supp_code__mnfr = CHK_supp_code__mnfr AND B.STATUS <> 'I' AND A.apprv_scope ='I' AND as_tran_date BETWEEN B.eff_from AND B.valid_upto UNION SELECT B.status AS STATUS , b.valid_upto, b.eff_from FROM supp_apprv a, supp_apprv_site b WHERE a.supp_code__mnfr = b.supp_code__mnfr AND b.supp_code__mnfr = CHK_supp_code__mnfr AND b.site_code = as_asign_child_site AND b.status <> 'I' AND A.apprv_scope ='S' AND as_tran_date BETWEEN b.eff_from AND b.valid_upto UNION SELECT B.status AS STATUS, b.valid_upto, b.eff_from FROM supp_apprv a, ITEMMNFR b WHERE a.supp_code__mnfr = b.supp_code__mnfr AND b.supp_code__mnfr = CHK_supp_code__mnfr AND b.item_code = as_item_code AND b.STATUS <> 'I' AND a.apprv_scope = 'T' AND as_tran_date BETWEEN b.eff_from AND b.valid_upto UNION SELECT B.status AS STATUS, b.valid_upto, b.eff_from FROM supp_apprv a, supp_apprv_site b WHERE a.supp_code__mnfr = b.supp_code__mnfr AND b.supp_code__mnfr = CHK_supp_code__mnfr AND b.status <> 'I' AND a.apprv_scope = 'V' AND as_tran_date BETWEEN b.eff_from AND b.valid_upto ) A; IF AS_STATUS = 'A' THEN flag := 1; -- RETURN (flag); elsif AS_STATUS ='D' OR AS_STATUS ='R' THEN Flag :=0; RETURN (flag); -- RETURN (flag); ELSE flag := FN_GetCount(AS_STATUS,CHK_supp_code__mnfr,as_site_code,as_item_code,as_tran_date,as_ref_ser,lc_eff_from,lc_valid_upto,as_appr_supp,as_asign_child_site); IF flag =0 THEN RETURN (flag); END IF; END IF; END IF; flag := 1; -- RETURN (flag);--TMP COMMENTED ELSE FLAG := 1; -- RETURN (flag);--TMP COMMENTED END IF; ELSE FLAG := 1; -- RETURN (flag);--TMP COMMENTED END IF ; END LOOP; END; RETURN (flag); EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; RETURN flag; WHEN OTHERS THEN Flag := 0; RETURN flag; END FN_CHK_MULTI_VENDOR_STATUS; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DRCRAMOUNT ( lsSiteCode in char, lsTranId in char) return number is ld_amount number(14,3); begin SELECT sum(drcr_rcp.amount) Into ld_amount FROM sreturn, drcr_rcp WHERE (sreturn.tran_id = lsTranId ) and (sreturn.SITE_CODE = lsSiteCode ) AND (sreturn.ret_opt in ('C') ) and (sreturn.TRAN_ID__CRN = drcr_rcp.TRAN_ID ) ; return ld_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TRFDESCR (as_tranid char) return varchar2 is ls_descr varchar2(1000); begin declare ls_descr varchar2(1000); ls_site_fr char(5); ls_site_to char(5); ls_dept_fr char(5); ls_dept_to char(5); ls_stan_code_hq_fr char(5); ls_stan_code_hq_to char(5); ls_stan_code_fr char(5); ls_stan_code_to char(5); ls_descr_fr varchar2(100); ls_descr_to varchar2(100); begin select emp_site_from,emp_site_to,dept_code_from,dept_code_to,stan_code__hq_from, stan_code__hq_to,stan_code__from,stan_code__to into ls_site_fr,ls_site_to, ls_dept_fr,ls_dept_to,ls_stan_code_hq_fr,ls_stan_code_hq_to,ls_stan_code_fr,ls_stan_code_to from emptransfer where trans_no=as_tranid; ls_descr := ''; if nvl(ls_site_fr,'') <> nvl(ls_site_to,'') then ls_descr_fr := ''; ls_descr_to := ''; select trim(descr) || '-' || trim(city) into ls_descr_fr from site where site_code=ls_site_fr; select trim(descr) || '-' || trim(city) into ls_descr_to from site where site_code=ls_site_to; if length(ls_descr_fr) > 0 and length(ls_descr_to) > 0 then if length(nvl(ls_descr,'')) > 0 then ls_descr := ls_descr || ' and '; end if; ls_descr := ls_descr || 'from ' || ls_descr_fr || ' to ' || ls_descr_to; end if; end if; ls_site_fr := ls_dept_fr; ls_site_to := ls_dept_to; if nvl(ls_site_fr,'') <> nvl(ls_site_to,'') then ls_descr_fr := ''; ls_descr_to := ''; select trim(descr) into ls_descr_fr from department where dept_code=ls_site_fr; select trim(descr) into ls_descr_to from department where dept_code=ls_site_to; if length(ls_descr_fr) > 0 and length(ls_descr_to) > 0 then if length(nvl(ls_descr,'')) > 0 then ls_descr := ls_descr || ' and '; end if; ls_descr := ls_descr || 'from ' || ls_descr_fr || ' department to ' || ls_descr_to || ' department'; end if; end if; ls_site_fr := trim(ls_stan_code_fr); ls_site_to := trim(ls_stan_code_to); if nvl(ls_site_fr,'') <> nvl(ls_site_to,'') then ls_descr_fr := ''; ls_descr_to := ''; select trim(descr) || decode(trim(descr),trim(city),'','-' || trim(city)) into ls_descr_fr from station where stan_code=ls_site_fr; select trim(descr) || decode(trim(descr),trim(city),'','-' || trim(city)) into ls_descr_to from station where stan_code=ls_site_to; if length(ls_descr_fr) > 0 and length(ls_descr_to) > 0 then if length(nvl(ls_descr,'')) > 0 then ls_descr := ls_descr || ' and '; end if; ls_descr := ls_descr || 'from ' || ls_descr_fr || ' location to ' || ls_descr_to || ' location'; end if; end if; return ls_descr; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SALESORDER_PENDINDORDER (as_site sorder.site_code%type, adt_dspdt_fr sorddet.dsp_date%type, adt_dspdt_to sorddet.dsp_date%type, as_status sorder.status%type) return nvarchar2 is ls_data varchar2(2000); ls_salesorder varchar2(15); cursor c1 is select distinct '''' || trim(sorder.sale_order) || ''',' from sorder, sorddet where ( case when sorder.sale_order is not null then 1 else 0 end ) = 1 and sorder.sale_order = sorddet.sale_order and sorder.site_code = as_site and sorddet.dsp_date >= adt_dspdt_fr and sorddet.dsp_date <= adt_dspdt_to and sorder.status in (as_status); begin open c1; loop fetch c1 into ls_salesorder; exit when c1%NOTFOUND; ls_data := ls_data || ls_salesorder; end loop; close c1; --dbms_output.put_line(ls_data); ls_data := substr(ls_data,1,length(ls_data)-1); --dbms_output.put_line('Without Last Comma ::: '||ls_data); return ls_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WOBILL_CHK BEFORE UPDATE OF iss_qty, alloc_qty ON workorder_bill referencing old as old new as new FOR EACH ROW DECLARE lc_issqty number(14,3) := 0; lc_billqty number(14,3) := 0; ls_stkopt item.stk_opt%type; ls_isscriteria item.iss_criteria%type; BEGIN begin select sum(quantity + nvl(potency_adj,0)) into lc_issqty from workorder_issdet d, workorder_iss h where d.tran_id = h.tran_id and h.work_order = :new.work_order and d.exp_lev = :old.exp_lev and h.tran_type <> 'R'; exception when others then lc_issqty := 0; end; begin select nvl(stk_opt,'0'), nvl(iss_criteria,'I') into ls_stkopt, ls_isscriteria from item where item_code = :new.item_code; exception when others then ls_stkopt := '0'; end; begin lc_billqty := nvl(:new.quantity,0) + nvl(:new.potency_adj,0); exception when others then ls_stkopt := '0'; end; if ls_isscriteria = 'I' then if ls_stkopt <> '0' and :new.iss_qty > lc_issqty then raise_application_error( -20601, 'for exp_lev [' || trim(:old.exp_lev) || 'Issue quantity [' || to_char(:new.iss_qty) || '] in WOB cannot be more than net issue [' || to_char(lc_issqty) || ']'); end if; if ls_stkopt <> '0' and abs(:new.alloc_qty - lc_billqty) > .001 then raise_application_error( -20601, 'Allocation for exp_lev [' || trim(:old.exp_lev) || '] quantity [' || to_char(:new.alloc_qty) || '] in WOB cannot be more than bill quantity [' || to_char(lc_billqty) || '] potency_adj [' || to_char(:new.potency_adj) || ']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_ASSET_REVALUE (From_Date IN DATE,To_Date IN DATE ,CODE IN char) RETURN NUMBER IS V_Total_Value NUMBER(14,3); LS_VAR DATE ; BEGIN SELECT SYSDATE INTO LS_VAR FROM DUAL; IF to_char(To_Date,'DDMMYYYY') = TO_CHAR(LS_VAR,'DDMMYYY') THEN SELECT SUM(revalue_amt) INTO V_Total_Value From asset_revalue where asset_code = CODE And TO_CHAR(revalue_date,'DDMMYYYY') < TO_CHAR(From_Date,'DDMMYYYY') ; ELSE Select sum(REVALUE_AMT) INTO V_Total_Value FROM asset_revalue where asset_code=CODE AND TO_CHAR(revalue_date,'DDMMYYYY') >= TO_CHAR(From_Date,'DDMMYYYY') AND TO_CHAR(revalue_date,'DDMMYYYY') <= TO_CHAR(To_Date,'DDMMYYYY'); END IF; IF V_Total_Value IS NULL THEN V_Total_Value := 0.00; END IF; RETURN V_Total_Value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_TNC_ACCEPT ON TNC_ACCEPT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_EINVUPD_REFNO ON E_INVOICE_UPDATE (REF_SER, REF_ID, REG_STAT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GIM_SUPPLIER (as_gimno porcp.tran_id%type) return char is ls_supplier supplier.supp_name%type ; ls_supp_code supplier.supp_code%type; begin select supp_code into ls_supp_code from porcp where tran_id = as_gimno; select supp_name into ls_supplier from supplier where supp_code = ls_supp_code; return(ls_supplier); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CUST_DEPOSIT (as_sitecode in char, as_custcode in char) return number is lc_bal number(14,3); lc_sbal number(14,3); ls_acctprd char(6); ls_prdcode char(6); ldt_today date; ls_acctcode accounts.acct_code%type; ldate_to date; begin -- ldt_today := to_date(sysdate); select NVL(SUM(sundrybal.CR_AMT-sundrybal.DR_AMT),0) INTO LC_BAL from sundrybal,CUSTOMER,loanparty where SUNDRYBAL.SUNDRY_CODE=loanparty.party_code and loanparty.CONTACT_CODE=CUSTOMER.CONTACT_CODE AND SUNDRYBAL.sundry_type='L' AND CUSTOMER.CUST_CODE=as_custcode and SUNDRYBAL.ACCT_PRD =(select acct_prd from PERIOD where FR_DATE<=TRUNC(sysdate) and TO_DATE>=TRUNC(sysdate)) and SUNDRYBAL.PRD_CODE ='zzzzzz'; return LC_BAL; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINV_CLSTK_BOM (LSITE_CODE in VARCHAR2 , LITEM_CODE in VARCHAR2 , LLOT_NO in VARCHAR2 ,AD_FROM_DATE in date, LTYPE in VARCHAR2 , LAVAILABLE in VARCHAR2 ) RETURN number is LC_TOTAL_QTY number (17, 6) ; LD_EFF_QTY number ( 17 , 6 ) ; LD_INVTRACE_QTY number ( 17 , 6 ) ; LDT_CREA_DATE date ; BEGIN IF LTYPE = 'I' THEN SELECT MIN ( A . CREA_DATE ) into LDT_CREA_DATE FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT SUM ( A . QUANTITY ) into LD_EFF_QTY FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; END IF ; IF LTYPE = 'B' THEN SELECT MIN ( A . CREA_DATE ) into LDT_CREA_DATE FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT SUM ( A . QUANTITY ) into LD_EFF_QTY FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; END IF ; LC_TOTAL_QTY := LD_EFF_QTY ; Return Lc_Total_Qty ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DF_GETUSERPHONENO (user_code IN VARCHAR2) RETURN VARCHAR2 IS phone_number VARCHAR2(30); BEGIN -- Ensure the column and table exist SELECT mobile_no INTO phone_number FROM users WHERE TRIM(code) = TRIM(user_code); RETURN phone_number; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'no data found'; WHEN OTHERS THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SITE_SHIP_CUST (SITE_SHIP IN CHAR ,MCUST IN CHAR) RETURN CHAR IS MCTR NUMBER; BEGIN SELECT COUNT(1) INTO MCTR FROM site_customer WHERE site_code = SITE_SHIP AND CUST_CODE = MCUST and NVL(active_yn,'Y') <> 'N'; IF MCTR = 1 THEN RETURN '1'; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAXTRAN_AMT (as_tran_code in char, as_tran_id in char, as_line_no in char, as_type in char) return char is ls_str varchar2(1000); ll_tax_perc number(12,3); ll_tax_amt number(12,3); ll_taxable_amt number(12,3); ll_reco_amount number(12,3); ll_tot_tax_amt number(12,3) := 0; ll_cnt number := 1; ls_tot_tax_code varchar2(500) := ''; cursor c1 is select tax_code from taxtran where tran_code = as_tran_code and tran_id = as_tran_id and ltrim(rtrim(line_no)) = as_line_no and tax_amt <> 0 order by line_no__tax; begin ls_str := ' '; for san in c1 loop begin exit when c1%notfound; select tax_perc,tax_amt,taxable_amt,reco_amount into ll_tax_perc,ll_tax_amt,ll_taxable_amt,ll_reco_amount from taxtran where tran_code = as_tran_code and tran_id = as_tran_id and ltrim(rtrim(line_no)) = as_line_no and tax_code = san.tax_code and tax_amt <> 0 ; if as_type = 'P' then ls_str := ls_str||','||rtrim(san.tax_code)||'|'||ll_tax_perc; elsif as_type = 'A' then ls_str := ls_str||','||rtrim(san.tax_code)||'|'||ll_tax_amt; ll_tot_tax_amt := ll_tot_tax_amt + ll_tax_amt; ls_tot_tax_code := ls_tot_tax_code||','||to_char(ll_cnt)||'|'||rtrim(san.tax_code); elsif as_type = 'TA' then ls_str := ls_str||','||rtrim(san.tax_code)||'|'||ll_taxable_amt; elsif as_type = 'RA' then ls_str := ls_str||','||rtrim(san.tax_code)||'|'||ll_reco_amount; end if; end; ll_cnt := ll_cnt + 1; end loop; if as_type = 'A' and ls_str <> ' ' then ls_str := substr(ls_str,3)||',TOT_TAX_AMT|'||ll_tot_tax_amt||ls_tot_tax_code; else ls_str := substr(ls_str,3); end if; return ls_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_WITH_HELD_X ON EMP_WITH_HELD (EMP_CODE, SITE_CODE, CHG_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_WSHEET_CODE ON PROF_WSHEET_COMP (WSHEET_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WOBILL_ALLOC_CHK BEFORE insert or UPDATE OF alloc_qty,potency_adj ON workorder_bill referencing old as old new as new FOR EACH ROW DECLARE lc_issqty number(14,3) := 0; lc_billqty number(14,3) := 0; ls_stkopt item.stk_opt%type; ls_isscriteria item.iss_criteria%type; BEGIN begin select nvl(stk_opt,'0'), nvl(iss_criteria,'I') into ls_stkopt, ls_isscriteria from item where item_code = :new.item_code; exception when others then ls_stkopt := '0'; end; lc_billqty := nvl(:new.quantity,0) + nvl(:new.potency_adj,0); if :new.ALLOCATE_TYPE = 'N' then :new.alloc_qty := 0; end if; if ls_isscriteria = 'I' then -- if ls_stkopt <> '0' and abs(nvl(:new.alloc_qty,0) - lc_billqty) > .001 then if ls_stkopt <> '0' then if :new.alloc_qty < 0 then raise_application_error( -20601, 'Negative Allocation for exp_lev [' || trim(:old.exp_lev) || '] item [' || :new.item_code ||'] alloc_qty [' || to_char(:new.alloc_qty) || '] in WOB cannot be negative [' || to_char(lc_billqty) || '] potency_adj [' || to_char(:new.potency_adj) || ']'); elsif abs(:new.alloc_qty - lc_billqty) > .001 and :new.alloc_qty <> 0 then raise_application_error( -20601, 'Allocation for exp_lev [' || trim(:old.exp_lev) || '] item [' || :new.item_code ||'] quantity [' || to_char(:new.alloc_qty) || '] in WOB cannot be more than bill quantity [' || to_char(lc_billqty) || '] potency_adj [' || to_char(:new.potency_adj) || ']'); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXC_REFSER_VAL (ls_refser IN CHAR,ls_refid IN CHAR) RETURN NUMBER IS COUNT NUMBER ; ls_table_name CHAR(30); ls_tran_id_col CHAR(100); ls_cnt NUMBER; str VARCHAR2(500); BEGIN BEGIN if ls_refser = 'JOUR' then ls_cnt := 1 ; else str:='SELECT DISTINCT table_name,tran_id_col FROM TRANSETUP WHERE ref_ser ='''||Trim(ls_refser)||''''; EXECUTE IMMEDIATE str INTO ls_table_name,ls_tran_id_col; str :='SELECT COUNT(*) FROM '||Trim(ls_table_name)||' WHERE '||Trim(ls_tran_id_col)||' = '''||Trim(ls_refid)||''''; EXECUTE IMMEDIATE str INTO ls_cnt; if (ls_cnt >= 1) then ls_cnt := 1; else ls_cnt := 0; end if; end if; exception when no_data_found then ls_cnt:=0; END; RETURN ls_cnt; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX JOB_PROFILE_EMP_X ON JOB_PROFILE_EMP (PROFILE_ID_EMP, SITE_CODE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_PE before insert or update on payment_exp referencing old as old new as new FOR EACH ROW declare refno payment_exp.ref_NO%type; refno1 payment_exp.ref_NO%type; begin refno := trim(:new.ref_no); select Replace(translate(refno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into refno1 from dual; if (refno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in ref number [' || refno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_CYCLE_CRITERIA (as_site_code char, as_item_code char) return char is as_cyclecriteria char ; begin begin select cycle_criteria into as_cyclecriteria from siteitem where site_code = as_site_code and item_code = as_item_code; if trim(as_cyclecriteria) is null then select cycle_criteria into as_cyclecriteria from item where item_code = as_item_code; return as_cyclecriteria; else return as_cyclecriteria; end if; exception when no_data_found then select cycle_criteria into as_cyclecriteria from item where item_code = as_item_code; return as_cyclecriteria; end; return as_cyclecriteria; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX FUTURE_DATE_TRANS_REFINFO ON FUTURE_DATE_TRANS (REF_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_VOUCHER_CHK BEFORE INSERT OR UPDATE OF confirmed ON voucher referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_advamt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_acctcount from VOUCHDET where tran_id = :new.tran_id; exception when others then ll_acctcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'VOUCH' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select net_amt, adv_amt into lc_hdramt, lc_advamt from voucher --where tran_id = :new.tran_id; lc_hdramt := :old.net_amt ; lc_advamt := :old.adv_amt ; exception when others then lc_hdramt := 0; lc_advamt := 0; end; if lc_hdramt <> 0 and ll_acctcount <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_acctcount) || '] rows in detail or cheque amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'VOUCH' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if (lc_hdramt <> 0 or lc_advamt <> 0) and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_OISS_CONS_LOT (as_tran_id in char, as_item_code in char, as_lot_no in char) return number is i_ctr number; s_cons char(1); s_lot_no_issue varchar2(120); as_bom_code workorder.bom_code%type ; as_workorder workorder_iss.work_order%type; Begin begin select work_order into as_workorder from workorder_iss where tran_id = as_tran_id; exception when others then return 1; end; begin select bom_code into as_bom_code from workorder where work_order = as_workorder; exception when others then return 1; end; select nvl(B.consider_lot_no__issue,'N') into s_cons from bom A, bomdet B where A.bom_code = B.bom_code and A.bom_code = as_bom_code and B.item_code = as_item_code and rownum = 1; if s_cons = 'Y' then begin select LOT_NO__ISSUE into s_lot_no_issue from workorder where work_order = as_workorder; if length(rtrim(ltrim(s_lot_no_issue))) > 0 then begin select count(1) into i_ctr from workorder where work_order = as_workorder and instr(s_lot_no_issue, ltrim(rtrim(as_lot_no))) > 0; if i_ctr = 0 then return 1; else return 0; end if; exception when others then return 1; end; else return 0; end if; exception when others then return 0; end; else return 0; end if; exception when others then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ENTRY_TRAN_IND ON RECEIPT_PAY_IN_SLIP (ENTRY_BATCH_NO, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_CALC_EMI_INT (AS_EMP_CODE char,AS_LOAN_AMT number,AS_START_PRD char,AS_INT_PERC number,AS_TERM number,AS_LOAN_TYPE char, AS_TYPE char,AS_CURR_INST number,AS_PERK_PERC number,AS_PERK_ADJ char,AS_ADJ_PERC number) return varchar2 is cursor c1 (type in varchar2) is select b.code,b.inst,rownum srno from (select a.code,rownum inst from period a where a.code >= AS_START_PRD and rownum <= AS_TERM order by a.code) b where substr(b.code,5,2) = '09' and type = 'BONUS' union all select b.code,b.inst,rownum srno from (select a.code,rownum inst from period a where a.code >= AS_START_PRD and rownum <= AS_TERM order by a.code) b where b.inst = (case rownum when 1 then (6*rownum) else ((12*rownum)-6) end) and type = 'LTA' order by 1; a_amount allowdedn_bal.amount%type; a_amt_bal allowdedn_bal.amt_bal%type; a_proj_amt allowdedn_bal.amount%type; a_count number(3); a_start_pos number(3); a_end_pos number(3); a_perk_amt number(9); a_perk_ded number(9) := 0; a_ret_amt number(11,2); a_emi_amt number(11,2); a_int_amt number(11,2) := 0; a_principal number(11,2) := 0; a_loan_bal number(11,2) := AS_LOAN_AMT; a_prd_fr char(6); a_prd_to char(6); a_prd_code char(6); a_perk_str varchar2(200); a_ret_value varchar2(200); begin if (AS_PERK_ADJ = 'Y') then for i in c1('BONUS') loop if (i.srno = 1) then select to_char(b.start_date,'yyyymm'),to_char(b.end_date,'yyyymm'),b.amount,b.amt_bal into a_prd_fr,a_prd_to,a_amount,a_amt_bal from allowdedn_bal b,payrparm c where b.emp_code = AS_EMP_CODE and c.prd_code = '999999' and c.var_name = 'BONUS_REG_ADCODE' and instr(','||trim(c.var_value)||',',','||trim(b.ad_code)||',') > 0 and b.start_date || b.end_date = (select max(a.start_date) || max(a.end_date) from allowdedn_bal a,payrparm d where a.emp_code = b.emp_code and d.prd_code = '999999' and d.var_name = 'BONUS_REG_ADCODE' and instr(','||trim(d.var_value)||',',','||trim(a.ad_code)||',') > 0 and to_char(a.end_date,'yyyymm') < i.code); select max(prd_code) into a_prd_code from payroll where prd_code <= a_prd_to and emp_code = AS_EMP_CODE and voucher_no is not null; if (a_prd_code != a_prd_to) then select nvl(sum(b.amount),0) into a_proj_amt from period a,payroll_projdet b,payrparm c where a.code between a_prd_fr and a_prd_to and a.code > a_prd_code and b.prd_code = a_prd_code and b.emp_code = AS_EMP_CODE and c.prd_code = '999999' and c.var_name = 'BONUS_REG_ADCODE' and instr(','||trim(c.var_value)||',',','||trim(b.ad_code)||',') > 0; a_amount := a_amount + a_proj_amt; a_amt_bal := a_amt_bal + a_proj_amt; end if; declare cursor c2 is select to_char(a.start_date,'yyyymm') start_prd,to_char(a.end_date,'yyyymm') end_prd,a.amt_bal from allowdedn_bal a,payrparm b where a.emp_code = AS_EMP_CODE and b.prd_code = '999999' and b.var_name = 'BONUS_REG_ADCODE' and instr(','||trim(b.var_value)||',',','||trim(a.ad_code)||',') > 0 and to_char(a.end_date,'yyyymm') < a_prd_fr and a.amt_bal != 0; begin for ii in c2 loop a_amt_bal := a_amt_bal + ii.amt_bal; if (i.inst = AS_CURR_INST) then if (a_ret_value is not null) then a_ret_value := a_ret_value || ','; end if; a_ret_value := a_ret_value || 'Bonus for '; if (substr(ii.start_prd,1,4) = substr(ii.end_prd,1,4)) then a_ret_value := a_ret_value || substr(ii.end_prd,1,4); else a_ret_value := a_ret_value || substr(ii.start_prd,1,4) || '-' || substr(ii.end_prd,3,2); end if; end if; end loop; end; a_amount := round(a_amount * nvl(AS_ADJ_PERC,0) / 100); a_amt_bal := round(a_amt_bal * nvl(AS_ADJ_PERC,0) / 100); else a_amount := round(a_amount * (1 * (1 + (AS_PERK_PERC / 100)))); a_amt_bal := a_amount; a_prd_fr := to_char(to_number(substr(a_prd_fr,1,4))+1) || substr(a_prd_fr,5,2); a_prd_to := to_char(to_number(substr(a_prd_to,1,4))+1) || substr(a_prd_to,5,2); end if; a_perk_str := a_perk_str || 'A' || to_char(i.inst) || ',' || to_char(a_amt_bal) || ','; if (AS_LOAN_TYPE = 'E') then a_perk_ded := a_perk_ded + floor(a_amt_bal / power((1 * (1 + ((AS_INT_PERC / 100) * (1 / 12)))),i.inst)); else a_perk_ded := a_perk_ded + a_amt_bal; end if; if (a_amt_bal != 0 and i.inst = AS_CURR_INST) then if (a_ret_value is not null) then a_ret_value := a_ret_value || ','; end if; a_ret_value := a_ret_value || 'Bonus for '; if (substr(a_prd_fr,1,4) = substr(a_prd_to,1,4)) then a_ret_value := a_ret_value || substr(a_prd_to,1,4); else a_ret_value := a_ret_value || substr(a_prd_fr,1,4) || '-' || substr(a_prd_to,3,2); end if; end if; end loop; for i in c1('LTA') loop if (i.srno = 1) then select to_char(b.start_date,'yyyymm'),to_char(b.end_date,'yyyymm'),b.amount,b.amt_bal into a_prd_fr,a_prd_to,a_amount,a_amt_bal from allowdedn_bal b,payrparm c where b.emp_code = AS_EMP_CODE and c.prd_code = '999999' and c.var_name = 'LTA_ADCODES_REPORT' and instr(','||trim(c.var_value)||',',','||trim(b.ad_code)||',') > 0 and b.start_date || b.end_date = (select max(a.start_date) || max(a.end_date) from allowdedn_bal a,payrparm d where a.emp_code = b.emp_code and d.prd_code = '999999' and d.var_name = 'LTA_ADCODES_REPORT' and instr(','||trim(d.var_value)||',',','||trim(a.ad_code)||',') > 0 and to_char(a.end_date,'yyyymm') < i.code); select max(prd_code) into a_prd_code from payroll where prd_code <= a_prd_to and emp_code = AS_EMP_CODE and voucher_no is not null; if (a_prd_code != a_prd_to) then select nvl(sum(b.amount),0) into a_proj_amt from period a,payroll_projdet b,payrparm c where a.code between a_prd_fr and a_prd_to and a.code > a_prd_code and b.prd_code = a_prd_code and b.emp_code = AS_EMP_CODE and c.prd_code = '999999' and c.var_name = 'LTA_ADCODES_REPORT' and instr(','||trim(c.var_value)||',',','||trim(b.ad_code)||',') > 0; a_amount := a_amount + a_proj_amt; a_amt_bal := a_amt_bal + a_proj_amt; end if; declare cursor c2 is select to_char(a.start_date,'yyyymm') start_prd,to_char(a.end_date,'yyyymm') end_prd,a.amt_bal from allowdedn_bal a,payrparm b where a.emp_code = AS_EMP_CODE and b.prd_code = '999999' and b.var_name = 'LTA_ADCODES_REPORT' and instr(','||trim(b.var_value)||',',','||trim(a.ad_code)||',') > 0 and to_char(a.end_date,'yyyymm') < a_prd_fr and a.amt_bal != 0; begin for ii in c2 loop a_amt_bal := a_amt_bal + ii.amt_bal; if (i.inst = AS_CURR_INST) then if (a_ret_value is not null) then a_ret_value := a_ret_value || ','; end if; a_ret_value := a_ret_value || 'LTA for '; if (substr(ii.start_prd,1,4) = substr(ii.end_prd,1,4)) then a_ret_value := a_ret_value || substr(ii.end_prd,1,4); else a_ret_value := a_ret_value || substr(ii.start_prd,1,4) || '-' || substr(ii.end_prd,3,2); end if; end if; end loop; end; a_amount := round(a_amount * nvl(AS_ADJ_PERC,0) / 100); a_amt_bal := round(a_amt_bal * nvl(AS_ADJ_PERC,0) / 100); else a_amount := round(a_amount * (1 * (1 + (AS_PERK_PERC / 100)))); a_amt_bal := a_amount; a_prd_fr := to_char(to_number(substr(a_prd_fr,1,4))+1) || substr(a_prd_fr,5,2); a_prd_to := to_char(to_number(substr(a_prd_to,1,4))+1) || substr(a_prd_to,5,2); end if; a_perk_str := a_perk_str || 'A' || to_char(i.inst) || ',' || to_char(a_amt_bal) || ','; if (AS_LOAN_TYPE = 'E') then a_perk_ded := a_perk_ded + floor(a_amt_bal / power((1 * (1 + ((AS_INT_PERC / 100) * (1 / 12)))),i.inst)); else a_perk_ded := a_perk_ded + a_amt_bal; end if; if (a_amt_bal != 0 and i.inst = AS_CURR_INST) then if (a_ret_value is not null) then a_ret_value := a_ret_value || ','; end if; a_ret_value := a_ret_value || 'LTA for '; if (substr(a_prd_fr,1,4) = substr(a_prd_to,1,4)) then a_ret_value := a_ret_value || substr(a_prd_to,1,4); else a_ret_value := a_ret_value || substr(a_prd_fr,1,4) || '-' || substr(a_prd_to,3,2); end if; end if; end loop; end if; if (AS_LOAN_TYPE = 'E') then a_emi_amt := ceil((AS_LOAN_AMT - a_perk_ded) * ((AS_INT_PERC / 100) * (1 / 12)) / (1 - power((1 / (1 + ((AS_INT_PERC / 100) * (1 / 12)))),AS_TERM))); else a_emi_amt := ceil((AS_LOAN_AMT - a_perk_ded) / AS_TERM); end if; a_emi_amt := a_emi_amt + 5 - mod(a_emi_amt,5); for i in 1..(AS_CURR_INST) loop a_int_amt := round((a_loan_bal * AS_INT_PERC / 100 / 12),2); a_principal := a_emi_amt; if (AS_LOAN_TYPE = 'E') then a_principal := a_principal - a_int_amt; end if; a_perk_amt := 0; a_count := 1; a_start_pos := instr(a_perk_str,('A'||to_char(i)||','),1,a_count); while a_start_pos <> 0 loop a_start_pos := a_start_pos + 2 + length(i); a_end_pos := instr(a_perk_str,',',a_start_pos) - 1; a_perk_amt := a_perk_amt + to_number(substr(a_perk_str,a_start_pos,(a_end_pos-a_start_pos+1))); a_count := a_count + 1; a_start_pos := instr(a_perk_str,('A'||to_char(i)||','),1,a_count); end loop; a_loan_bal := a_loan_bal - a_perk_amt; if ((a_loan_bal - a_principal) < 0) then a_principal := a_loan_bal; end if; a_loan_bal := a_loan_bal - a_principal; end loop; if (AS_TYPE = 'P') then a_ret_amt := a_principal; elsif (AS_TYPE = 'I') then a_ret_amt := a_int_amt; elsif (AS_TYPE = 'E') then a_ret_amt := a_principal + a_int_amt; elsif (AS_TYPE = 'A') then a_ret_amt := a_perk_amt; elsif (AS_TYPE = 'R') then return a_ret_value; end if; return a_ret_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_PR before insert or update on porcp referencing old as old new as new FOR EACH ROW declare billno porcp.INVOICE_NO%type; billno1 porcp.INVOICE_NO%type; begin billno := trim(:new.INVOICE_NO); select Replace(translate(billno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into billno1 from dual; if (billno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in invoice number [' || billno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BOND_MONTHSBETN ( as_emp_code char, as_relieve_date date, as_tran_id char, as_tran_id_bond char, argstr_bond_type char, ad_code char, argdt_eff_date date, as_tran_id_pvouch char, as_line_no_pvouch char ) return number is a_month number(3); bond_start_date date; gratuity_date date; date_join date; begin if(argstr_bond_type = 'VCH') THEN bond_start_date := argdt_eff_date; ELSE bond_start_date := nvl(gratuity_date,date_join); END IF; select ceil(MONTHS_BETWEEN(as_relieve_date,bond_start_date)) into a_month from employee where emp_code = as_emp_code; return case when a_month is null or a_month <=0 then 0 else a_month end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VOUCHRCP_PRCP_ID_LINE_TRAN_ID ON VOUCHRCP (PRCP_ID, LINE_NO__RCP, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RCONCAT (ARG1 IN VARCHAR2, ARG2 IN VARCHAR2) RETURN VARCHAR2 IS BEGIN RETURN CONCAT(ARG1,ARG2); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PO_CONF_VAL (po_no in char) return char is ls_confVal char; begin select nvl(confirmed,'N') into ls_confVal from porder where PURC_ORDER= po_no; return ls_confVal; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WF_ACTIVITY_DET_X ON WF_ACTIVITY_DET (PROCESS_ID, ACTIVITY_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TAX (as_tran_code char,as_tran_id char, as_tax_code char,as_acct_code char) return VARCHAR2 is ls_tax_form VARCHAR2(30); ls_var_value VARCHAR2(30); ls_errcode VARCHAR2(30); begin select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = as_acct_code; select distinct tax_form into ls_tax_form from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code AND ACCT_CODE = ls_var_value; return ls_tax_form; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_BLANKSTR RETURN VARCHAR2 IS BEGIN RETURN ''; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WOISS_CHK BEFORE INSERT ON invalloc_trace referencing old as old new as new FOR EACH ROW DECLARE lc_issqty number(14,3) := 0; ls_stkopt item.stk_opt%type; ls_isscriteria item.iss_criteria%type; ll_lineno number(3) := 0; BEGIN if trim(:new.ref_ser) = 'W-ISS' then begin ll_lineno := to_number(trim(:new.ref_line)); select sum(quantity + nvl(potency_adj,0)) into lc_issqty from workorder_issdet d, workorder_iss h where d.tran_id = h.tran_id and h.tran_id = :new.ref_id and d.line_no = ll_lineno and h.tran_type <> 'R'; exception when others then lc_issqty := 0; end; begin select nvl(stk_opt,'0'), nvl(iss_criteria,'I') into ls_stkopt, ls_isscriteria from item where item_code = :new.item_code; exception when others then ls_stkopt := '0'; end; begin if ls_isscriteria = 'I' then if ls_stkopt <> '0' and abs(:new.alloc_qty) <> lc_issqty then raise_application_error( -20601, 'for line # [' || trim(:new.ref_line) || ' detail quantity [' || to_char(lc_issqty) || '] trace allocation is [' || to_char(:new.alloc_qty) || ']'); end if; end if; end; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DRCR_PACCT_X ON DRCR_PACCT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CENVATPLACLBAL ( as_sitecode IN site.site_code%type, adt_todate IN cenvat.tran_date%type, as_type IN cenvat.tran_type%type, as_tax_type IN cenvat.tax_type%type) return number is lc_clbal cenvat.closing_bal%type ; ls_tranid cenvat.tran_id%type ; ll_lineno cenvat.line_no%type; begin if as_type = 'A' or as_type = 'C' then select max(tran_id) into ls_tranid from cenvat where tran_date <= adt_todate and site_code = as_sitecode and tran_type = as_type and tax_type = as_tax_type; select max(line_no) into ll_lineno from cenvat where tran_id = ls_tranid ; select nvl(closing_bal,0) into lc_clbal from cenvat where tran_id = ls_tranid and line_no = ll_lineno ; end if; if as_type = 'P' then select max(tran_id) into ls_tranid from pla where tran_date <= adt_todate and site_code = as_sitecode and tax_type = as_tax_type; select max(line_no) into ll_lineno from pla where tran_id = ls_tranid ; select nvl(closing_bal,0) into lc_clbal from pla where tran_id = ls_tranid and line_no = ll_lineno ; end if; return lc_clbal ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DEDN (as_acctprd in char,as_empcode in char,as_section in char, as_type in char) return number is amt number (14,3); begin if as_type = 'A' then select sum(b.amount) into amt from allwdedn a, it_calcdet b where a.ad_code=b.ad_code and acct_prd = as_acctprd and emp_code = as_empcode and a.it_section = as_section; elsif as_type = 'P' then select sum(b.amount) into amt from allwdedn a, itproj_calcdet b where a.ad_code=b.ad_code and acct_prd = as_acctprd and emp_code = as_empcode and a.it_section = as_section; end if; return amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYARR_TO_PROC_TRACE_X ON PAYARR_TO_PROC_TRACE (EMP_CODE, PRD_CODE, PROC_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PRCLST_RATE ( adt_trandt pricelist.eff_from%type, ads_lotno pricelist.lot_no__from%type, ads_itmcode pricelist.item_code%type, ads_sitcode site.site_code%type) return number is plrate number := 0; /*Function Created by Brijesh Soni On 19.05.10*/ ls_prlist pricelist.price_list%type; begin select price_list into ls_prlist from site where site_code = ads_sitcode; if ls_prlist is not null and length(trim(ls_prlist)) > 0 then select nvl(rate,0) into plrate from pricelist where adt_trandt between pricelist.eff_from and pricelist.valid_upto and ads_lotno between pricelist.lot_no__from and pricelist.lot_no__to and pricelist.item_code = ads_itmcode and pricelist.price_list = ls_prlist and pricelist.rate > 0; else if sqlcode = 100 then plrate := -999999; end if; end if; return plrate; /*Final Function End Brijesh Soni*/ end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_VOUCH_DATE (as_tran_id in char, as_net_amt in number ,as_sundry_type in char) return char is lc_vouch_no varchar2(20); begin if (as_sundry_type <> 'B') then select to_char(misc_paydet.vouch_date) into lc_vouch_no from misc_paydet where misc_paydet.tran_id = as_tran_id and misc_paydet.net_amt = as_net_amt; else select to_char(misc_payment.ref_date) into lc_vouch_no from misc_payment where misc_payment.tran_id = as_tran_id ; end if; return lc_vouch_no ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083150 ON COSTALLOC_BAS (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RBF_UNITDOC BEFORE INSERT or UPDATE OF unit__doc ON receipt_backflush_det referencing old as old new as new FOR EACH ROW DECLARE BEGIN if :new.unit__doc = 'null' or length(trim(:new.unit__doc)) > 3 then :new.unit__doc := null; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INTERNAL_SALES_PRD (ls_prd_code_fr in char, ls_prd_code_to in char, ls_level_code in char, ls_item_ser in char, ls_item_code in char) return number is lc_val number(14,3); begin select sum(sales_val - return_val + repl_val) into lc_val from sm_sales_site where item_ser=ls_item_ser and prd_code between ls_prd_code_fr and ls_prd_code_to and level_code = ls_level_code and item_code = ls_item_code; return lc_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_USR_STATUS ( cur_status VARCHAR2 ) RETURN VARCHAR2 IS status VARCHAR2(100); BEGIN CASE cur_status WHEN 'I' THEN status := 'Status: Invited'; ELSE status := 'Status: Accepted'; END CASE; RETURN TRIM(status); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_SRETN_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON sreturn referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_sretncount number(3) := 0; ll_count number(6) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_sretncount from sreturndet s, item i where s.item_code = i.item_code and s.tran_id = :new.tran_id and s.ret_rep_flag = 'R' and i.stk_opt <> '0'; exception when others then ll_sretncount := 0; end; begin select count(1) into ll_invcount from invtrace i, location l, invstat s where l.loc_code = i.loc_code and s.inv_stat = l.inv_stat and i.ref_ser = 'S-RET' and i.ref_id = :new.tran_id and i.eff_qty > 0 and s.stat_type <> 'S' ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_sretncount then raise_application_error( -20601, 'Invtrace not updated for all returned ' || to_char(ll_sretncount) ||'] lines invtrace count [' || to_char(ll_invcount) || ']'); end if; begin select count(1) into ll_sretncount from sreturndet s, item i where s.item_code = i.item_code and s.tran_id = :new.tran_id and s.ret_rep_flag = 'P' and i.stk_opt <> '0'; exception when others then ll_sretncount := 0; end; begin select count(1) into ll_invcount from invtrace i, location l, invstat s where l.loc_code = i.loc_code and s.inv_stat = l.inv_stat and i.ref_ser = 'S-RET' and i.ref_id = :new.tran_id and i.eff_qty < 0 and s.stat_type <> 'S' ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_sretncount then raise_application_error( -20601, 'Invtrace not updated for all replaced ' || to_char(ll_sretncount) ||'] lines invtrace count [' || to_char(ll_invcount) || ']'); end if; ------------- allocation check to be added here end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STOCK_ITEM_INFO ( ls_item_code in stock.item_code%type, ls_site_code in stock.site_code%type, ls_loc_code in stock.loc_code%type, ls_lot_no in stock.lot_no%type, ls_lot_sl in stock.lot_sl%type, ret_value in char ) return varchar2 is ls_ret_value varchar2(200) := ''; begin if ret_value = 'M' then select nvl(supp_code__mfg,' ') into ls_ret_value from stock where item_code = ls_item_code and site_code = ls_site_code and loc_code = ls_loc_code and lot_no = ls_lot_no and lot_sl = ls_lot_sl; else ls_ret_value := 'xx'; end if; return ls_ret_value; end FN_GET_STOCK_ITEM_INFO; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETMAILSUBJECT_SIGNFOR_LV (emp_code empleave.emp_code%type, lve_date_fr empleave.lve_date_fr%type, leave_starts empleave.leave_starts%type, start_time empleave.start_time%type, lve_date_to empleave.lve_date_to%type, leave_ends empleave.leave_ends%type, end_time empleave.end_time%type, ls_lve_code empleave.lve_code%type, emp_code__aprv empleave.emp_code__aprv%type,lve_type empleave.lve_type%type, ench_amt empleave.ench_amt%type, chg_user empleave.chg_user%type, chg_term empleave.chg_term%type, use_flag empleave.use_flag%type, status empleave.status%type, status_date empleave.status_date%type, prd_code empleave.prd_code%type, remarks empleave.remarks%type, no_days empleave.no_days%type, tran_id empleave.tran_id%type, appl_date empleave.appl_date%type, auth_emp empleave.auth_emp%type , auth_emp_alternate empleave.auth_emp_alternate%type, designation char, dept_code employee.dept_code%type, unappr_lev number, cl_1 char, pl_1 char, lwp_1 char, cl_avail number, pl_avail number, lwp_avail number, cl_unappr number, pl_unappr number, lwp_unappr number, auth_sign empleave.auth_sign%type, entry_by empleave.entry_by%type, cancel_remarks empleave.cancel_remarks%type, flag in varchar,apprv_flag varchar ) return char Is retrun_string varchar(1000); e_r_name varchar(100); leaves_descr varchar(100); begin retrun_string := ''; if flag = 'M' then select trim(descr) into leaves_descr from leaves where lve_code = ls_lve_code; retrun_string := initcap(leaves_descr) || ' ' || '('|| trim(ls_lve_code) ||') '; if use_flag = 'E' then retrun_string := retrun_string ||''||'Encashment '; end if; if apprv_flag = 'R' then retrun_string := retrun_string || 'recommendation of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; elsif apprv_flag = 'FH' then retrun_string := retrun_string || 'HR confirmation of '; elsif apprv_flag = 'SH' then retrun_string := retrun_string || 'HR confirmation of '; elsif apprv_flag = 'TH' then retrun_string := retrun_string || 'HR confirmation of '; end if; select initcap(trim(ddf_get_masters_name('EMPLOYEE',emp_code,'F'))) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' from '|| initcap(TO_CHAR(lve_date_fr,'DD-Mon')) || ' to ' || initcap(TO_CHAR(lve_date_to,'DD-Mon')) || ' for ' || no_days; if no_days > 1 then retrun_string := retrun_string || ' days' ; else retrun_string := retrun_string || ' day' ; end if; elsif flag = 'S' then select trim(descr) into leaves_descr from leaves where lve_code = ls_lve_code; retrun_string := initcap(leaves_descr) || ' ' || '('|| trim(ls_lve_code) ||') '; if use_flag = 'E' then retrun_string := retrun_string ||''||'Encashment '; end if; if apprv_flag = 'R' then retrun_string := retrun_string || 'recommendation of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; elsif apprv_flag = 'FH' then retrun_string := retrun_string || 'HR confirmation of '; elsif apprv_flag = 'SH' then retrun_string := retrun_string || 'HR confirmation of '; elsif apprv_flag = 'TH' then retrun_string := retrun_string || 'HR confirmation of '; end if; select initcap(trim(ddf_get_masters_name('EMPLOYEE',emp_code,'F'))) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' from '|| initcap(TO_CHAR(lve_date_fr,'DD-Mon')) || ' to ' || initcap(TO_CHAR(lve_date_to,'DD-Mon')) || ' for ' || no_days ; if no_days > 1 then retrun_string := retrun_string || ' days' ; else retrun_string := retrun_string || ' day' ; end if; end if; return trim(retrun_string); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REJECTED_NAME (as_obj_name audit_trail.obj_name%type, as_tran_id empdetail_chg.tran_id%type) RETURN VARCHAR2 is ls_retvalue varchar2(90); ls_status empdetail_chg.status%type; ls_chg_user empdetail_chg.chg_user%type; ls_chg_id audit_trail.chg_id%type; ls_emp_code users.code%type; ls_count number; BEGIN ls_count := 0; ls_retvalue := ''; ls_status := ''; ls_chg_user := ''; ls_emp_code := ''; select status into ls_status from empdetail_chg where tran_id = as_tran_id; if ls_status = 'X' then select count(1) into ls_count from audit_trail where obj_name = LOWER(as_obj_name) and ref_id = as_tran_id; if ls_count > 0 then select max(chg_id) into ls_chg_id from audit_trail where obj_name = LOWER(as_obj_name) and ref_id = as_tran_id; if ls_chg_id > 0 then select chg_user into ls_chg_user from audit_trail where obj_name = LOWER(as_obj_name) and ref_id = as_tran_id and chg_id = ls_chg_id; select emp_code into ls_emp_code from users where code = ls_chg_user ; select ddf_get_masters_name('EMPLOYEE', ls_emp_code, 'FML') into ls_retvalue from dual; end if; end if; end if; return ls_retvalue; Exception when no_data_found then ls_retvalue := ''; RETURN ls_retvalue; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE BRANCODEMASTERTABLE AS TABLE OF branCodeMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_ORGSTRUC_REPORT (AS_VERSION_ID char,AS_TABLE_NO char,AS_POS_CODE char,AS_DETAILS_OF char) return varchar2 is a_ret_value varchar2(200); a_string varchar2(200); a_cnt number(5) := 0; begin if (AS_DETAILS_OF in ('STATE_CODE','STATE_DESCR')) then declare cursor c1 is select state_code,state_descr from ( select a.pos_code,a.pos_code__repto,e.descr as state_descr,e.state_code as state_code,(case when g.state_code = c.state_code then 1 else 2 end) as rep_hq_tag from org_structure a,station c,state e,org_structure f,station g where a.version_id = AS_VERSION_ID and a.table_no = AS_TABLE_NO and nvl(a.pos_code,' ') = a.pos_code and a.active = 'Y' and c.stan_code = a.stan_code__hq and e.state_code = c.state_code and f.version_id(+) = a.version_id and f.table_no(+) = a.table_no and f.pos_code(+) = a.pos_code__repto and f.active(+) = 'Y' and g.stan_code(+) = f.stan_code__hq ) d start with pos_code = AS_POS_CODE connect by prior d.pos_code = d.pos_code__repto order siblings by rep_hq_tag; begin for i in c1 loop if (instr(','||a_string||',',','||trim(i.state_code)||',') = 0) then a_string := a_string || ',' || trim(i.state_code) || ','; a_cnt := a_cnt + 1; if (a_cnt <> 1) then a_ret_value := a_ret_value || ', '; end if; if (AS_DETAILS_OF = 'STATE_CODE') then a_ret_value := a_ret_value || trim(i.state_code); elsif (AS_DETAILS_OF = 'STATE_DESCR') then a_ret_value := a_ret_value || i.state_descr; end if; end if; end loop; end; end if; return a_ret_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_CR_TERM (ls_ref_ser char, ls_ref_id char) return char is ls_cr_term char(5); begin if ls_ref_ser = 'INV' then select nvl(b.cr_term ,' ') into ls_cr_term from despatch a , invoice b where b.desp_id = a.desp_id and b.invoice_id = ls_ref_id; return ls_cr_term ; elsif ls_ref_ser = 'CRNRCP' or ls_ref_ser = 'DRNRCP' then select nvl(b.cr_term ,' ') into ls_cr_term from despatch a , invoice b , drcr_rcp c where c.invoice_id = b.invoice_id and b.desp_id = a.desp_id and c.tran_id = ls_ref_id and rownum = 1; return ls_cr_term ; else ls_cr_term := ' '; return ls_cr_term ; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EMP_PAYAMT ( p_empcode char, p_prdcd char, p_adcode char, p_valtype char, p_table char) Return number is V_Bamount Number(12,3); V_Samount Number(12,3); V_Aamount Number(12,3); V_RetAmt Number(12,3); Begin If p_table = 'PY' then Select nvl(base_amt,0),nvl(slab_amt,0),nvl(amount,0) into V_Bamount , V_Samount , V_Aamount from payrolldet where emp_code = p_empcode and prd_code = p_prdcd and ad_code = p_adcode; ElsIf p_table = 'PP' then Select nvl(base_amt,0),nvl(slab_amt,0),nvl(amount,0) into V_Bamount , V_Samount , V_Aamount from payroll_projdet where emp_code = p_empcode and prd_code = p_prdcd and ad_code = p_adcode; Elsif p_table = 'PR' then Select nvl(base_amt,0),nvl(slab_amt,0),nvl(amount,0) into V_Bamount , V_Samount , V_Aamount from payarr_det where emp_code = p_empcode and prd_code = p_prdcd and ad_code = p_adcode; End if; If p_valtype = 'B' then V_RetAmt := V_Bamount; Elsif p_valtype = 'S' then V_RetAmt := V_Samount; Else V_RetAmt := V_Aamount; End if; Return V_RetAmt; EXCEPTION when no_data_found then return 0; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_SUBMISSION_DATA (as_emp_code varchar2,as_site_code varchar2,as_item_ser varchar2,as_req_typ varchar2,as_dept_code varchar2) return number is a_count number(1); begin SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND site_code = as_site_code AND DEPT_CODE = as_dept_code AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND site_code = as_site_code AND DEPT_CODE = as_dept_code AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND site_code = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE IS NULL AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE is null AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND grade_allow is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND DESIGNATION_ALLOW is not null AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER is null AND SITE_CODE =as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER = as_item_ser AND SITE_CODE is null AND DEPT_CODE is null AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; end if; if (a_count = 0 ) then SELECT count(*) INTO a_count FROM ser_compl_assign WHERE req_type = as_req_typ AND ITEM_SER is null AND SITE_CODE is null AND DEPT_CODE =as_dept_code AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' and (esc__emp_code_1 = as_emp_code or esc__emp_code_2 = as_emp_code) AND ROWNUM=1; if (a_count = 1 ) then return a_count; else return a_count; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VOUCHER_TRAN_DATE_SITE ON VOUCHER (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ABSENT_PANOLI (a_emp_code char,a_prd_code char) return number is cursor c1 is select attd_date,in_time,out_time,shift,day_no,result from attendance_day a,period b where a.emp_code = a_emp_code and b.code = a_prd_code and a.attd_date between b.fr_date and b.to_date and a.result in ('F','H') and a.out_time is not null; b_tot_min number := 0; b_tot_lop number := 0; b_tot_days number := 0; b_diff number := 0; b_diff1 number := 0; b_in_time char(5); b_out_time char(5); b_gt number; b_hd_it char(5); b_min_s number := 0; b_min_a number := 0; BEGIN for i in c1 loop b_diff:=0; b_diff1:=0; select in_time,out_time,grace_time,hd_in_time into b_in_time,b_out_time,b_gt,b_hd_it from workshft where shift = i.shift and day_no = i.day_no; if (ddf_time_in_mm(b_out_time) < ddf_time_in_mm(b_in_time)) then b_out_time := (to_number(substr(b_out_time,1,2))+24) || substr(b_out_time,3,3); end if; if (ddf_time_in_mm(b_hd_it) < ddf_time_in_mm(b_in_time)) then b_hd_it := (to_number(substr(b_hd_it,1,2))+24) || substr(b_hd_it,3,3); end if; if (i.result = 'F') then b_min_s := ddf_time_in_mm(b_in_time); b_min_a := ddf_time_in_mm(i.in_time); if ((b_min_s+b_gt) < b_min_a) then b_diff := b_diff + (b_min_a - b_min_s); end if; b_min_s := ddf_time_in_mm(b_out_time); b_min_a := ddf_time_in_mm(i.out_time); if (b_min_s > b_min_a) then b_diff := b_diff + (b_min_s - b_min_a); end if; if (b_diff > (ddf_time_in_mm(b_out_time) - ddf_time_in_mm(b_in_time))) then b_diff := (ddf_time_in_mm(b_out_time) - ddf_time_in_mm(b_in_time)); end if; elsif (i.result = 'H') then b_min_s := ddf_time_in_mm(b_in_time); b_min_a := ddf_time_in_mm(i.in_time); if ((b_min_s+b_gt) < b_min_a) then b_diff := b_diff + (b_min_a - b_min_s); end if; b_min_s := ddf_time_in_mm(b_hd_it); b_min_a := ddf_time_in_mm(i.out_time); if (b_min_s > b_min_a) then b_diff := b_diff + (b_min_s - b_min_a); end if; b_min_s := ddf_time_in_mm(b_hd_it); b_min_a := ddf_time_in_mm(i.in_time); if (b_min_s < b_min_a) then b_diff1 := b_diff1 + (b_min_a - b_min_s); end if; b_min_s := ddf_time_in_mm(b_out_time); b_min_a := ddf_time_in_mm(i.out_time); if (b_min_s > b_min_a) then b_diff1 := b_diff1 + (b_min_s - b_min_a); end if; if (b_diff > (ddf_time_in_mm(b_hd_it) - ddf_time_in_mm(b_in_time))) then b_diff := (ddf_time_in_mm(b_hd_it) - ddf_time_in_mm(b_in_time)); end if; if (b_diff1 > (ddf_time_in_mm(b_out_time) - ddf_time_in_mm(b_hd_it))) then b_diff1 := (ddf_time_in_mm(b_out_time) - ddf_time_in_mm(b_hd_it)); end if; if (b_diff > b_diff1) then b_diff := b_diff1; end if; end if; b_tot_min := b_tot_min + b_diff; end loop; select nvl(sum(lop_days),0) into b_tot_lop from attd_reg a,period b where a.emp_code = a_emp_code and b.code = a_prd_code and a.attd_date between b.fr_date and b.to_date; b_tot_days := trunc((((b_tot_min/60) * 1) / 8),2) + b_tot_lop; return b_tot_days; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INVDEMSUPREFSER BEFORE INSERT or UPDATE OF ref_ser ON INV_DEM_SUPP_TRACE referencing old as old new as new FOR EACH ROW DECLARE BEGIN if :new.ref_ser is null then :new.ref_ser := 'W-BIL'; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LVDESC (as_level_type in char, as_level_code in char) return varchar2 is ls_level_descr varchar2(40); begin if as_level_type = 'C' then select descr into ls_level_descr from cadre where cadre_code = as_level_code; elsif as_level_type = 'G' then select descr into ls_level_descr from grade where grade_code = as_level_code; elsif as_level_type = 'X' then ls_level_descr := 'GENERAL'; end if; return ls_level_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE ITEMMASTER AS OBJECT ( ITEM_CODE CHAR(10), DESCR VARCHAR2(130) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_PO_LIMIT_X ON EMP_PO_LIMIT (EMP_CODE, ITEM_SER, EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PO_EMP_SIGN (as_po_no porder.purc_order%type , flag char) return varchar2 is ls_data varchar2(35) := ' '; ls_varvalue disparm.var_value%type; ls_empcd porder.emp_code%type; ls_empname varchar2(35); begin /*ddf_get_disparm_value(as_varname,as_prdcode)*/ select nvl(ddf_get_disparm_value('PO_SIGN','999999'),'NULLFOUND') into ls_varvalue from dual; if ls_varvalue <> 'NULLFOUND' then /*if variable is not define then return as ''*/ if ls_varvalue = 'C' then /*return employee code*/ if flag = 'P' then /*prepared by*/ select emp_code into ls_empcd from porder where purc_order = as_po_no; elsif flag = 'A' then /*authorized by*/ select emp_code__aprv into ls_empcd from porder where purc_order = as_po_no; end if; ls_data := trim(ls_empcd); return ls_empcd; elsif ls_varvalue = 'N' then /*return employee name*/ if flag = 'P' then /*prepared by*/ select trim(b.emp_fname) || ' ' || trim(b.emp_lname) into ls_empname from porder a , employee b where a.emp_code = b.emp_code and a.purc_order = as_po_no; elsif flag = 'A' then /*authorized by*/ select trim(b.emp_fname) || ' ' || trim(b.emp_lname) into ls_empname from porder a , employee b where a.emp_code__aprv(+) = b.emp_code and a.purc_order = as_po_no; end if; ls_data := trim(ls_empname); return ls_data; end if; else return ls_data; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_PERC_EUROPE (as_tran_id taxtran.tran_id%type, as_line_no taxtran.line_no%type, as_tran_cd taxtran.tran_code%type, as_tax_code taxtran.tax_code%type,as_flag char) return number is ld_tax_perc taxtran.tax_perc%type; begin if as_flag = 'A' then --For Tax Amt SELECT SUM(TAX_AMT) TAX_AMT into ld_tax_perc FROM TAXTRAN WHERE TAX_CODE =as_tax_code AND TRAN_ID =as_tran_id AND line_no = as_line_no AND tran_code = as_tran_cd ; elsif as_flag = 'P' then --For Tax Perc SELECT max(TAX_PERC) into ld_tax_perc FROM TAXTRAN WHERE TAX_CODE =as_tax_code AND TRAN_ID =as_tran_id AND tran_code = as_tran_cd ; end if; return ld_tax_perc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRACE_SITE_DATE ON GLTRACE (SITE_CODE, TRAN_DATE, SUNDRY_TYPE, SUNDRY_CODE, ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_EXP_RETEST_DATE ( as_sitecode stock.site_code%type,as_itemcode stock.item_code%type, as_loccode stock.loc_code%type, as_lotno stock.lot_no%type, as_lotsl stock.lot_sl%type,as_tran_id workorder_iss.tran_id%type) return varchar2 is ls_e_r_tag varchar2(3) := ''; li_val mfgparm.var_value%type; ldt_expdate stock.exp_date%type ; ldt_retestdate stock.retest_date%type ; ls_conf_dt workorder_iss.conf_date%type ; ls_conf workorder_iss.conf_date%type ; begin select exp_date, retest_date into ldt_expdate, ldt_retestdate from stock where site_code = as_sitecode and item_code = as_itemcode and loc_code = as_loccode and lot_no = as_lotno and lot_sl = as_lotsl ; select var_value into li_val from mfgparm where var_name ='DATE_NO'; select workorder_iss.conf_date into ls_conf_dt from workorder_iss where tran_id = as_tran_id ; if sqlcode = 0 then if (li_val) is null then select trunc(to_date(ls_conf_dt,'dd/mm/yy')+14) into ls_conf from dual; if to_date(ls_conf) >= to_date(ldt_expdate) then ls_e_r_tag := ls_e_r_tag || '*'; end if; if to_date(ls_conf) >= to_date(ldt_retestdate) then ls_e_r_tag := ls_e_r_tag || '#'; end if; else select trunc(to_date(ls_conf_dt,'dd/mm/yy')+li_val) into ls_conf from dual; dbms_output.put_line('value of ls_conf variable ::::::::: ' || ls_conf ); dbms_output.put_line('value of ldt_expdate variable ::::::::: ' || ldt_expdate ); if to_date(ls_conf) >= to_date(ldt_expdate) then ls_e_r_tag := ls_e_r_tag || '*'; end if; if to_date(ls_conf) >= to_date(ldt_retestdate) then ls_e_r_tag := ls_e_r_tag || '#'; end if; end if; end if; return ls_e_r_tag; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RNDROUTEREMARKS ( as_expr_no IN CHAR , al_opr_no IN NUMBER ) return varchar2 is ls_remark varchar2(5000); ls_remarkdescr varchar2(5000); ll_opr number; ls_expr char(15); cursor cur_args is SELECT (case when remarks is null then '' else remarks end ) from expr_route where EXPR_NO = as_expr_no AND OPERATION <= al_opr_no ORDER BY expr_route.OPERATION ASC ; begin open cur_args; loop fetch cur_args into ls_remarkdescr; --dbms_output.put_line('Remarks: ' || ls_remarkdescr ||'.'); exit when cur_args%NOTFOUND; -- dbms_output.put_line('Remarks: ' || ls_remarkdescr ||'.'); if length(ls_remarkdescr) > 0 then ls_remark := ls_remark || ls_remarkdescr || chr(10) ; end if; end loop; close cur_args; return ls_remark ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_DESPQTY (as_despid in char, ls_line_no in char, ls_sord_no in char, ls_line_no__sord in char, ls_exp_lev in char , ln_quantity in number) return number is ls_val number(1); ln_prv_qty number(14,3) :=0; ln_sord_qty number(14,3) :=0; ln_tot_qty number(14,3) :=0; ls_linenosord char(3); ls_despid char(10); begin if as_despid is null or length(trim(as_despid)) = 0 then ls_despid := '@@@@@@@@@@'; else ls_despid := as_despid; end if; ls_linenosord := lpad(trim(ls_line_no__sord),3,' '); begin select sum(quantity) into ln_prv_qty from despatchdet where desp_id <> ls_despid and sord_no = ls_sord_no and line_no__sord = ls_linenosord and exp_lev = ls_exp_lev; Exception when others then ln_prv_qty :=0; end; if ln_prv_qty is null then ln_prv_qty :=0; end if; begin select quantity into ln_sord_qty from sorditem where sale_order = ls_sord_no and line_no = ls_linenosord and exp_lev = ls_exp_lev; Exception When NO_DATA_FOUND then ln_sord_qty := 0; end ; ln_tot_qty := ln_prv_qty + ln_quantity ; if ln_tot_qty > ln_sord_qty then return 0 ; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SHOW_DATE_OF_JOIN (AS_EMP_CODE char,AS_DATE date,AS_VAR_NAME char) return char is a_value site_env.par_value%type; BEGIN a_value :=''; SELECT DDF_HR_SITE_ENV_VALUE( AS_EMP_CODE, AS_DATE, AS_VAR_NAME ) into a_value FROM DUAL; if( trim(a_value) = '') then SELECT VAR_VALUE into a_value FROM PAYRPARM WHERE PRD_CODE = '999999' AND VAR_NAME = AS_VAR_NAME; end if; RETURN trim(a_value); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX HR_DETAIL_X ON ADM_ENV (FIN_ENTITY, SITE_CODE, APP_TYPE, DEPT_CODE, VALID_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083121 ON TRAN_TYPE_MASTER (TRAN_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TRAINING_DESCR ON TRAINING (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SPRS_HOLIDAY (AS_EMP_CODE CHAR,AS_DATE_FR date,AS_DATE_TO date) return number is a_count number(1); a_hol_days number(5) := 0; a_date date; begin for i in 1..(AS_DATE_TO-AS_DATE_FR+1) loop a_date := AS_DATE_FR+i-1; select count(*) into a_count from holiday where hol_tblno = ddf_get_holtblno(AS_EMP_CODE,a_date) and hol_date = a_date and not exists (select * from dr_main where sales_pers = AS_EMP_CODE and work_date = a_date); if (a_count > 0) then a_hol_days := a_hol_days + 1; end if; end loop; return a_hol_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMP_ITDECL_PRDEMP_QTR_AD ON EMP_IT_DECL_QTR (ACCT_PRD, EMP_CODE, QTR_NO, AD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_EXCISE_TAX_DATE (as_tran_code IN VARCHAR2, as_tran_id IN VARCHAR2, as_tax_code IN VARCHAR2, as_acct_code IN VARCHAR2) RETURN DATE IS AS_VALUE DATE; ls_var_value VARCHAR2(100); ls_errcode VARCHAR2(100); BEGIN select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = as_acct_code; select distinct tax_form_date into AS_VALUE from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code AND ACCT_CODE = ls_var_value; return AS_VALUE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_PREPROC_ATTD_STATUS (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select lve_code,lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and AS_DATE between lve_date_fr and lve_date_to and status = 'A' and use_flag = 'C' order by lve_date_fr,lve_date_to; cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and AS_DATE between date_from and date_to and status = 'A' order by date_from,date_to; a_status varchar2(5); a_hol_tblno holiday.hol_tblno%type := ddf_get_holtblno(AS_EMP_CODE,AS_DATE); a_curr_holtbl holiday.hol_tblno%type; a_count number(5); a_count1 number(5); a_first varchar2(2); a_second varchar2(2); a_prev_date date; a_next_date date; a_curr_date date; a_tag boolean; a_absent_pn boolean; a_prev_stat char(10); a_next_stat char(10); begin a_curr_date := AS_DATE; while a_prev_date is null loop a_tag := true; a_curr_date := a_curr_date - 1; a_curr_holtbl := ddf_get_holtblno(AS_EMP_CODE,a_curr_date); select count(*) into a_count from holiday where hol_tblno = a_curr_holtbl and hol_date = a_curr_date; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = a_curr_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 = 0) then a_tag := false; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = a_curr_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 <> 0) then a_tag := false; end if; if (a_tag = true) then a_prev_date := a_curr_date; end if; end loop; a_curr_date := AS_DATE; while a_next_date is null loop a_tag := true; a_curr_date := a_curr_date + 1; a_curr_holtbl := ddf_get_holtblno(AS_EMP_CODE,a_curr_date); select count(*) into a_count from holiday where hol_tblno = a_curr_holtbl and hol_date = a_curr_date; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = a_curr_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 = 0) then a_tag := false; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = a_curr_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 <> 0) then a_tag := false; end if; if (a_tag = true) then a_next_date := a_curr_date; end if; end loop; a_prev_stat := ddf_hr_woff_lve_comb(AS_EMP_CODE,a_prev_date); a_next_stat := ddf_hr_woff_lve_comb(AS_EMP_CODE,a_next_date); if (substr(a_prev_stat,1,1) in ('A','L') and substr(a_prev_stat,2,1) in ('A','L') and substr(a_next_stat,1,1) in ('A','L') and (substr(a_prev_stat,2,1) = 'A' or substr(a_next_stat,1,1) = 'A')) then a_absent_pn := true; elsif (substr(a_prev_stat,2,1) in ('A','L') and substr(a_next_stat,1,1) in ('A','L') and substr(a_next_stat,2,1) in ('A','L') and (substr(a_prev_stat,2,1) = 'A' or substr(a_next_stat,1,1) = 'A')) then a_absent_pn := true; else a_absent_pn := false; end if; for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> AS_DATE and i.lve_date_to <> AS_DATE) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = AS_DATE and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_status := substr(i.lve_code,1,2); return a_status; else if (i.lve_date_fr = AS_DATE and i.leave_starts = 'B') then a_first := substr(i.lve_code,1,2); elsif (i.lve_date_fr = AS_DATE and i.leave_starts = 'M') then a_second := substr(i.lve_code,1,2); elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'M') then a_first := substr(i.lve_code,1,2); elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_second := substr(i.lve_code,1,2); end if; end if; end loop; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'H'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 = 0) and a_absent_pn then a_status := 'A'; return a_status; elsif (a_count1 = 0) and not a_absent_pn then a_status := 'PH'; return a_status; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 <> 0) and a_absent_pn then a_status := 'A'; return a_status; elsif (a_count1 <> 0) and not a_absent_pn then a_status := 'PH'; return a_status; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'W'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 = 0) and a_absent_pn then a_status := 'A'; return a_status; elsif (a_count1 = 0) and not a_absent_pn then a_status := 'WO'; return a_status; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 <> 0) and a_absent_pn then a_status := 'A'; return a_status; elsif (a_count1 <> 0) and not a_absent_pn then a_status := 'WO'; return a_status; end if; for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> AS_DATE and i.date_to <> AS_DATE) or (i.date_from <> i.date_to and i.date_from = AS_DATE and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = AS_DATE and i.tour_ends = 'E') then a_status := 'T'; return a_status; else if (i.date_from = AS_DATE and i.tour_starts = 'S') then a_first := 'T'; elsif (i.date_from = AS_DATE and i.tour_starts = 'B') then a_second := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'B') then a_first := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'E') then a_second := 'T'; end if; end if; end loop; if (a_first is null) and (a_second is not null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= (ddf_time_in_mm(b.in_time)+b.grace_time)) and (ddf_time_in_mm(a.out_time) >= (ddf_time_in_mm(b.in_time)+(b.hd_hrs*60))); if (a_count = 0) then a_first := 'A'; else a_first := 'P'; end if; elsif (a_first is not null) and (a_second is null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= ddf_time_in_mm(b.hd_in_time)) and (ddf_time_in_mm(a.out_time) >= (case when (b.out_time < b.hd_in_time) then (ddf_time_in_mm(b.out_time)+1440) else ddf_time_in_mm(b.out_time) end)); if (a_count = 0) then a_second := 'A'; else a_second := 'P'; end if; elsif (a_first is null) and (a_second is null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= (ddf_time_in_mm(b.in_time)+b.grace_time)) and (ddf_time_in_mm(a.out_time) >= (case when (b.out_time < b.in_time) then (ddf_time_in_mm(b.out_time)+1440) else ddf_time_in_mm(b.out_time) end)); if (a_count <> 0) then a_status := 'P'; return a_status; end if; select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= (ddf_time_in_mm(b.in_time)+b.grace_time)) and (ddf_time_in_mm(a.out_time) >= (ddf_time_in_mm(b.in_time)+(b.hd_hrs*60))); if (a_count <> 0) then a_status := 'P/A'; return a_status; end if; select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= ddf_time_in_mm(b.hd_in_time)) and (ddf_time_in_mm(a.out_time) >= (case when (b.out_time < b.hd_in_time) then (ddf_time_in_mm(b.out_time)+1440) else ddf_time_in_mm(b.out_time) end)); if (a_count <> 0) then a_status := 'A/P'; return a_status; end if; a_status := 'A'; return a_status; end if; a_status := a_first || '/' || a_second; return a_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SM_RECEIPT_ITEM_X ON SM_RECEIPT_ITEM (CUST_CODE, ITEM_CODE, PRD_CODE, ITEM_SER, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_SHIFTCODE (AS_EMP_CODE char,AS_DATE date) return char is a_work_shift employee.work_shift%type; ll_count number; begin select count(*) into ll_count from work_shift where emp_code=AS_EMP_CODE and as_date between from_dt and to_dt; if ll_count > 0 then dbms_output.put_line('BEGIN'); select shift into a_work_shift from work_shift where emp_code=AS_EMP_CODE and as_date between from_dt and to_dt; dbms_output.put_line('got in workshift'||a_work_shift ); else declare cursor c1 is select work_shift, eff_date,conf_date,chg_date from ( select WORK_SHIFT__fr as work_shift,eff_date as eff_date,conf_date,chg_date from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' UNION ALL select WORK_SHIFT_o,tran_date as eff_date,conf_date,chg_date from employee_det_change where emp_code = AS_EMP_CODE and tran_date > AS_DATE and confirmed = 'Y') order by eff_date,conf_date,chg_date ; begin dbms_output.put_line('got in union '||a_work_shift ); dbms_output.put_line('a_work_shift IN IF'||length(ltrim(rtrim(a_work_shift)))); for i in c1 loop a_work_shift := i.WORK_SHIFT; dbms_output.put_line('a_work_shift'||a_work_shift); exit; end loop; if (length(ltrim(rtrim(a_work_shift))) = 0 or a_work_shift is null) then select work_shift into a_work_shift from employee where emp_code = AS_EMP_CODE; dbms_output.put_line('got in employee'||a_work_shift); end if; dbms_output.put_line('a_work_shift'||a_work_shift); end; dbms_output.put_line('end'); end if; return a_work_shift; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALE_DISTJV_INX ON SALE_DIST_JV (SITE_CODE, TRAN_DATE, SUNDRY_TYPE, SUNDRY_CODE, ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CREATE_TRAN_ID ( p_cust_code IN VARCHAR2 ) RETURN VARCHAR2 IS v_last_num NUMBER; v_new_tran_id VARCHAR2(20); v_count NUMBER; v_cust_code_clean VARCHAR2(20); BEGIN -- Trim the input cust_code to remove any spaces v_cust_code_clean := TRIM(p_cust_code); -- Start with the current max number for this cust_code SELECT NVL(MAX(TO_NUMBER(SUBSTR(tran_id, -4))), 0) INTO v_last_num FROM interest_cal_hdr WHERE cust_code = v_cust_code_clean AND tran_id LIKE 'INC%'; LOOP -- Generate candidate tran_id v_new_tran_id := 'INC' || SUBSTR(v_cust_code_clean, 1, 2) || SUBSTR(v_cust_code_clean, -1, 1) || LPAD(v_last_num + 1, 4, '0'); -- Remove any accidental spaces just in case v_new_tran_id := REPLACE(v_new_tran_id, ' ', ''); -- Check if this tran_id already exists SELECT COUNT(*) INTO v_count FROM interest_cal_hdr WHERE tran_id = v_new_tran_id; IF v_count = 0 THEN -- Found a free tran_id EXIT; END IF; -- Otherwise, increment and try again v_last_num := v_last_num + 1; END LOOP; RETURN v_new_tran_id; EXCEPTION WHEN OTHERS THEN RETURN NULL; END FN_CREATE_TRAN_ID; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VICS_CHK_DIGIT (as_crtn_plt in char,as_prono in char) return varchar2 is ls_prono varchar2(20) := as_prono; len number := 0; m number(17,2); rem number(17,2); c number; sumodd number := 0; sumeven number := 0; begin len := length(trim(ls_prono)); m := -1; for i in reverse 1..len loop c := substr(ls_prono,m,1); if mod(c,2) = 0 then sumodd := sumodd + c; end if; if mod(c,2) <> 0 then sumeven := sumeven + c; end if; m := m-1; end loop; sumOdd := sumOdd * 3; ls_prono := as_crtn_plt || ls_prono || trim(to_char(10 - mod((sumEven + sumOdd), 10))) ; return ls_prono ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LC_VOUCHER_AMEND_X ON LC_VOUCHER_AMEND (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETRESOURCEENDDATE (AS_PROJ_CODE IN CHAR,AS_LINE_NO IN CHAR) RETURN DATE AS END_DATE DATE; BEGIN BEGIN ---------ADDED BY NISAR AHMAD ON 07/07/09 TO CONSIDER END DATE OF RESOURCE----------- SELECT CASE WHEN END_DATE IS NULL THEN (CASE WHEN EXT_END_DATE IS NULL THEN EXP_END_DATE ELSE EXT_END_DATE END) ELSE END_DATE END AS EXT_END_DATE INTO END_DATE FROM PROJ_TASK_RES WHERE PROJ_CODE=AS_PROJ_CODE AND LINE_NO=AS_LINE_NO; END; RETURN END_DATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SITE_DIM_SITE_CODE ON SITE_DIM (SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SIGN_DATE ( ls_ref_id char) return varchar2 is ls_sign_date varchar2(15); begin select sign_date into ls_sign_date from obj_sign_trans where ref_id= trim(ls_ref_id) and sign_status='S'; return ls_sign_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DAY_NAME (LD_DATE DATE) RETURN VARCHAR2 IS LS_DAY VARCHAR2(30); BEGIN RETURN TO_CHAR(LD_DATE,'DAY'); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char) return number is mrate number(14,3); ls_type char(1); ls_price_list__parent char(5); ls_plist char(5); begin begin select list_type into ls_type from pricelist where price_list = as_price_list and rownum = 1; exception when others then ls_type := 'L'; end; if ls_type = 'L' then begin select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop select (case when price_list__parent is null then '' else price_list__parent end ) into ls_price_list__parent from pricelist_mst where price_list = ls_plist and list_type = 'L'; if length(trim(ls_price_list__parent)) = 0 then exit; end if; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then select rate into mrate from pricelist where price_list = ls_price_list__parent and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; if mrate > 0 then exit; end if; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'B' then begin select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop select (case when price_list__parent is null then '' else price_list__parent end ) into ls_price_list__parent from pricelist_mst where price_list = ls_plist and list_type = 'B'; if length(trim(ls_price_list__parent)) = 0 then exit; end if; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then select nvl(rate,0) into mrate from pricelist where price_list = ls_price_list__parent and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; if mrate > 0 then exit; end if ; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCP_TRAN_CONF_VOUCH_CR ON PORCP (TRAN_ID, CONFIRMED, VOUCH_CREATED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRAN_REF_SER_REF_ID ON GLTRAN (REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GEN_DESCR (as_fld_name char,as_mod_name char,as_fld_value char,as_descr char) return char is v_descr gencodes.descr%type; begin select decode(as_descr, 'D', descr, sh_descr) into v_descr from gencodes where fld_name = as_fld_name and fld_value = as_fld_value and ( mod_name = as_mod_name or mod_name ='X') ; If v_descr is null then v_descr := ''; end if; return v_descr; Exception when OTHERS then return ''; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MACHLOADDET_WORK_ORD ON MACHINE_LOAD_DET (WORK_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SPON_REQ_X ON STRG_SPON_REQ (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_QTY_FC (ls_quantity char,ls_qty__fc char) return int is lc_return number(1); begin select case when to_number(ls_quantity) >= to_number(ls_qty__fc) and to_number(ls_qty__fc) > 0 then 0 else 1 end into lc_return from dual; RETURN lc_return ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVDET_ITEM_INVOICE_ID_LINE_NO ON INVDET (ITEM_CODE, INVOICE_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INV_SRET_SUMMARY_X ON INV_SRET_SUMMARY (SITE_CODE, PRD_CODE, REF_SER, CUST_CODE, LOC_CODE, RET_REP_FLAG) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMTRANSFERSQL_X ON EMPTRANSFERSQL (TABLE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GST_MVOUC ( ls_sundry_code IN CHAR, ls_site_code IN CHAR, ls_tax_env IN CHAR, ls_sundry_type IN CHAR ) RETURN NUMBER AS ls_local NUMBER; as_sundry_state CHAR(5); as_site_state CHAR(5); ls_sundry_count NUMBER(14, 3); cur_out SYS_REFCURSOR; ls_sql VARCHAR2(4000); begin --TO CHECK INTRASTATE TAX ENVIONMENT begin SELECT TRIM(state_code) INTO as_site_state FROM site WHERE site_code = ls_site_code; EXCEPTION WHEN OTHERS THEN as_site_state := ' '; END; IF ls_sundry_type = 'S' THEN ls_sql := 'select trim(state_code) state_code from supplier where supp_code = :sundry_code'; ELSIF ls_sundry_type = 'T' THEN ls_sql := 'select trim(state_code) state_code from transporter where tran_code = :sundry_code'; ELSIF ls_sundry_type = 'X' THEN ls_sql := 'select trim(state_code) state_code from tax_authority WHERE tauth_code = :sundry_code'; ELSIF ls_sundry_type = 'E' THEN ls_sql := 'select trim(s.state_code) state_code from employee e, station s WHERE s.stan_code = e.stan_code and e.emp_code = :sundry_code'; ELSIF ls_sundry_type = 'P' THEN ls_sql := 'select trim(state_code) state_code from sales_pers WHERE sales_pers = :sundry_code'; ELSIF ls_sundry_type = 'C' THEN ls_sql := 'select trim(state_code) state_code from customer WHERE cust_code = :sundry_code'; ELSIF ls_sundry_type = 'L' THEN ls_sql := 'select trim(state_code) state_code from loanparty WHERE party_code = :sundry_code'; END IF; BEGIN OPEN cur_out FOR ls_sql USING ls_sundry_code; FETCH cur_out INTO as_sundry_state; EXCEPTION WHEN OTHERS THEN as_sundry_state := ' '; END; IF as_sundry_state = as_site_state THEN IF trim(ls_tax_env) = 'ELNC01' OR trim(ls_tax_env) = 'ELWC01' OR trim(ls_tax_env) = 'ERCML01' OR trim(ls_tax_env) = 'ELWC02' OR trim(ls_tax_env) = 'ERCML02' OR trim(ls_tax_env) = 'ERITCL01' OR trim(ls_tax_env) = 'NOGST' THEN ls_local := 1; ELSE ls_local := 0; END IF; ELSE ls_local := 1; END IF; return ls_local; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SAMPLEQTY (as_item_code in char, as_site_code in char) return char is lc_qty_sample number(14,3); begin begin select qty_sample into lc_qty_sample from siteitem where item_code = as_item_code and site_code = as_site_code ; exception when others then lc_qty_sample := 0 ; end; return lc_qty_sample; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_SPECIAL_CHAR (as_value in varchar2) Return Number Is ls_type NUMBER; ll_retval number(1):=0; Begin select count(1) INTO ls_type from dual where rtrim(Replace(translate(rtrim(as_value),'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-_','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','')) is not null; IF ls_type=1 THEN ll_retval:=1; ELSE ll_retval:=0; END IF; RETURN ll_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_GET_CR_DAYS (AS_CR_TERM IN VARCHAR2) return number is AS_CR_DAYS number(5); BEGIN SELECT CR_DAYS INTO AS_CR_DAYS FROM CRTERM WHERE CR_TERM=AS_CR_TERM; RETURN AS_CR_DAYS ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_MET_FOCUS_SKU_TB force AS TABLE OF CHC_CHEM_MET_FOCUS_SKU_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSINVLRDT (as_lr_date in despatch.lr_Date%type) return number is FLAG NUMBER(1); --ls_count number(10,0); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_DESP_INVLRDT'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then --select count(*) from dual WHERE ? >SYSDATE ; if as_lr_date > sysdate then RETURN 1; Else RETURN 0; end if; else RETURN 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMP_EMPLOY_EMPCD_EFF_TYPE_CON ON EMP_EMPLOY_EVENTS (EMP_CODE, EFF_DATE, TRANS_TYPE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPROPORTIONATEQTY (as_bomcode bom.bom_code%type, al_operation bomdet.operation%type,as_itemcode bomdet.item_code%type, as_itemref bomdet.item_ref%type,as_altitem bom_alt.item_code__alt%type, as_workorder workorder.work_order%type) return number is lc_proportionate_qty workorder.quantity%type; ls_reqtype bomdet.req_type%type ; lc_min_qty bomdet.min_qty%type ; lc_qtyper bom_alt.quantity%type ; lc_wo_batchqty workorder.quantity%type; lc_bom_batchqty bom.batch_qty%type; begin select batch_qty into lc_bom_batchqty from bom where bom_code = as_bomcode ; select quantity into lc_wo_batchqty from workorder where work_order = as_workorder ; select req_type,min_qty into ls_reqtype,lc_min_qty from bomdet where bom_code = as_bomcode and operation = al_operation and item_code = as_itemcode and item_ref = as_itemref; if (lc_min_qty) is null then lc_min_qty := 0; end if; select quantity into lc_qtyper from bom_alt where bom_code = as_bomcode and item_code = as_itemcode and item_ref = as_itemref and item_code__alt = as_altitem; if ls_reqtype ='S' then lc_proportionate_qty := trunc((lc_wo_batchqty / lc_bom_batchqty),0) * lc_qtyper; elsif ls_reqtype ='P' then lc_proportionate_qty := (lc_qtyper / lc_bom_batchqty) * lc_wo_batchqty; elsif ls_reqtype ='F' then lc_proportionate_qty := lc_qtyper; end if; if lc_proportionate_qty < lc_min_qty then lc_proportionate_qty := lc_min_qty; end if; Return lc_proportionate_qty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_BUSINESS_ACTIVITY_DET ON BUSINESS_ACTIVITY_DET (PRD_CODE, SALES_PERS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DISPLAY_COMMENTS (as_ref_ser char,as_ref_id char) return varchar2 is ls_comments varchar2(1000); begin select comm_text into ls_comments from comments where ref_ser = as_ref_ser and ref_id = as_ref_id; return ls_comments; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_GRADE_KRA ON GRADE_KRA (GRADE, DEPT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DIST_QTY_CHECK_COMPLETE (as_item_Code in char,as_lot_no in char,as_lot_sl in char,as_site_code in char ,as_loc_code in char,as_quantity in NUMBER, as_tran_id in char) return number is ls_result number(1); ls_item_code char(10); ls_lot_no CHAR(15); ls_lot_sl CHAR(15); ls_site_code CHAR(5); ls_loc_code CHAR(8); ls_quantity number(14,3); ls_iss_criteria CHAR(1); begin --select iss_criteria into ls_iss_criteria from item where trim(item_code)=trim(as_item_code); select iss_criteria into ls_iss_criteria from item where item_code=trim(as_item_code); ls_result:=1; --if as_tran_id is null then if ls_iss_criteria='W' then begin --select quantity-alloc_qty-hold_qty into ls_quantity from stock select quantity into ls_quantity from stock where trim(item_code)=trim(as_item_code) and trim(lot_no)=trim(as_lot_no) and trim(lot_sl)=trim(as_lot_sl) and trim(site_code)=trim(as_site_code) and trim(loc_code)=trim(as_loc_code); exception when others then ls_quantity := 0; end; --end if; if ls_quantity <> as_quantity then ls_result:=0; else ls_result:=1; end if; end if; return ls_result; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_EMP_IT_PROOF (as_tran_id char, FORCE_VALIDATE char default 'X', AS_CHK_MODE CHAR DEFAULT 'EMP', AS_LOGIN_EMP_CODE CHAR DEFAULT '') return varchar2 is ls_return varchar2(4000); lc_qtr number(1); MV_IS_ERROR CHAR(1); LS_DECL_TYPE CHAR(1); LS_RET1 VARCHAR2(4000); LS_STATUS EMP_ITDECL_HDR.STATUS%TYPE; LS_CONFIRMED EMP_ITDECL_HDR.CONFIRMED%TYPE; LS_CHG_USER USERS.CODE%TYPE; LS_EMP_CODE__DECL EMP_ITDECL_HDR.EMP_CODE__DECL%TYPE; LS_EMP_CODE_CHG EMP_ITDECL_HDR.EMP_CODE__DECL%TYPE; LS_ACCT_PRD EMP_ITDECL_HDR.ACCT_PRD%TYPE; LD_TRAN_DATE EMP_ITDECL_HDR.TRAN_DATE%TYPE; CURSOR C_AD_PROOF IS SELECT AD_CODE, NVL(IS_PROOFOK,' ') AS IS_PROOFOK from emp_itdecl_det where tran_id = as_tran_id AND AD_CODE IN ('FDSB','IT02D','IT02H','IT02I','IT02J','IT02K','IT02L','IT03D','IT03F','IT07','IT07A','IT07F','IT07G','IT10','IT10C','IT11','IT11B','IT13','IT15','IT18','IT19','IT27A','IT27B','IT27C','IT27D','IT27F','IT27I','IT27K','IT27M','IT2AA') ORDER BY LINE_NO; begin LS_RETURN := ''; MV_IS_ERROR := 'N'; SELECT DECL_TYPE, QTR_NO, STATUS, CHG_USER, EMP_CODE__DECL, ACCT_PRD, TRAN_DATE, NVL(CONFIRMED,'N') INTO LS_DECL_TYPE , LC_QTR, LS_STATUS, LS_CHG_USER, LS_EMP_CODE__DECL, LS_ACCT_PRD, LD_TRAN_DATE, LS_CONFIRMED FROM EMP_ITDECL_HDR WHERE TRAN_ID = AS_TRAN_ID; IF LS_DECL_TYPE = 'P' and LC_QTR = 4 THEN IF LS_CONFIRMED = 'Y' THEN LS_RETURN := ''; return LS_RETURN; END IF; IF FORCE_VALIDATE = 'N' THEN RETURN ''; END IF; for i in c_ad_proof LOOP LS_RET1 := ''; IF (NVL(AS_CHK_MODE,' ') <> 'PAC') OR (NVL(AS_CHK_MODE,' ') = 'PAC' AND I.IS_PROOFOK <> 'N') THEN IF LS_ACCT_PRD = '201617' AND LD_TRAN_DATE <= '07-FEB-2017' THEN SELECT fn_validate_emp_it_proof_1617 (as_tran_id, I.AD_CODE) INTO LS_RET1 FROM DUAL; ELSE SELECT fn_validate_emp_it_proof (as_tran_id, I.AD_CODE) INTO LS_RET1 FROM DUAL; END IF; if(LS_RET1 IS NOT NULL AND LENGTH(TRIM(LS_RET1)) > 0) THEN MV_IS_ERROR := 'Y'; IF LS_RETURN IS NULL OR LENGTH(TRIM(LS_RETURN)) = 0 THEN LS_RETURN := TRIM(I.AD_CODE); ELSE LS_RETURN := LS_RETURN || ', ' || TRIM(I.AD_CODE); END IF; END IF; END IF; end loop; if (mv_is_error is NOT null AND mv_is_error = 'Y') then LS_RETURN := ''; end if; end if; return ls_return; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALC_NSHIFT_ALLW (AS_PRD_CODE CHAR, AS_EMP_CODE CHAR, ac_nshift_rate number) RETURN NUMBER IS NSHIFT_CON NUMBER; ncnt1 NUMBER(14,3); ncnt2 NUMBER(14,3); BEGIN select count(a.attd_date) into ncnt1 from attendance_day a where to_char(a.attd_date,'YYYYMM') = as_prd_code and a.emp_code = as_emp_code and a.shift in ('113T1','113T2','113T3','113T4'); select count(a.attd_date) into ncnt2 from attendance_day a, workshft b where to_char(a.attd_date,'YYYYMM') = as_prd_code and a.emp_code = as_emp_code and a.shift in ('113S1','113S2','113S3') and b.day_no = to_char(a.attd_date,'D') and b.shift = a.shift and ddf_time_in_mm(A.OUT_TIME) >= ddf_time_in_mm (B.OUT_TIME)+240; nshift_con := (ncnt1 + ncnt2)*ac_nshift_rate ; return nshift_con; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LAB_BKING_EMP_PROJ (as_site char, as_mcCode char,as_frdate date) return varchar2 is ls_emp varchar2(50); ls_emp_code varchar2(4000); ls_emp_name varchar2(4000); cursor c1 is select a.emp_code__bkd,b.emp_fname,b.emp_lname,c.proj_code,c.descr,a.status from lab_booking a,employee b,PROJECT c where a.mc_code=as_mcCode and a.emp_code__bkd =b.emp_code and a.proj_code=c.proj_code and a.site_code=as_site and trunc(a.start_time) =as_frdate ; i c1%rowtype; begin open c1; fetch c1 into i; if(c1% notfound) then ls_emp_code := ' '; else while(c1%found) loop ls_emp_code := ls_emp_code||trim(i.emp_fname)||' '||trim(i.emp_lname)||chr(10)||'( '||trim(i.proj_code)||' '||trim(i.descr)||' )'||' - '||i.status||' '||CHR(10); fetch c1 into i; end loop; ls_emp_name := substr(ls_emp_code,1,length(trim(ls_emp_code))-1); end if; close c1; RETURN ls_emp_name ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ORDTYPE_DESC (as_order_type in char) return char is ls_descr_order char(60); begin select descr into ls_descr_order from itemser where item_ser =as_order_type; return ls_descr_order; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SUNDRYBAL_TYPE_CODE_ACCT_PRD ON SUNDRYBAL (SUNDRY_TYPE, SUNDRY_CODE, ACCT_PRD, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_TOT_OUTLETS_TB force AS TABLE OF CHC_CHEM_TOT_OUTLETS_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_WO before insert or update on workorder referencing old as old new as new FOR EACH ROW declare ls_tempstr stock.lot_no%type; ls_tempstr1 stock.lot_no%type; begin ls_tempstr := trim(:new.lot_no); select Replace(translate(ls_tempstr,' ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-._*','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_tempstr1 from dual; if (ls_tempstr1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in lot number [' || ls_tempstr1 ||']' ); end if; ls_tempstr := trim(:new.lot_sl); select Replace(translate(ls_tempstr,' ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-._*','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_tempstr1 from dual; if (ls_tempstr1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in lot serial [' || ls_tempstr1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SRETURN_TRAN_DATE_SITE ON SRETURN (TRAN_DATE, SITE_CODE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LEAVE_APPL_ALLOW (AS_EMP_CODE char,AS_DATE date,AS_FLAG char) return number is a_allow_days number(5) := 0; a_hol_days Number(10); begin if (AS_DATE >= trunc(sysdate)) then return 1; end if; if (AS_FLAG = 'C') then select to_number(nvl(ddf_hr_site_env_value(AS_EMP_CODE,trunc(sysdate),'LV_CANCEL_VAL'),0)) into a_allow_days from dual; elsif (AS_FLAG = 'A') then select to_number(nvl(ddf_hr_site_env_value(AS_EMP_CODE,trunc(sysdate),'LEAVE_APPLY_ALLOW'),0)) into a_allow_days from dual; end if; if (a_allow_days < 0) then return 1; elsif (a_allow_days = 0) then return 0; else select count(distinct adate) into a_hol_days from ( select a.adate from nsrno a,holiday b where a.adate > AS_DATE and a.adate <= trunc(sysdate) and b.hol_tblno = ddf_get_holtblno(AS_EMP_CODE,a.adate) and b.hol_date = a.adate and not exists (select c.hol_date_for from change_holiday c where c.emp_code = AS_EMP_CODE and c.hol_date_for = b.hol_date and c.hol_type = b.hol_type and c.confirmed = 'Y') union all select a.adate from nsrno a,change_holiday b where a.adate > AS_DATE and a.adate <= trunc(sysdate) and b.emp_code = AS_EMP_CODE and b.hol_date_to = a.adate and b.confirmed = 'Y' ); if (((trunc(sysdate) - AS_DATE) - a_hol_days) <= a_allow_days) then return 1; else return 0; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXTRAN_AMT (as_tran_id char,flag char) return decimal is ld_amt decimal(3); begin if flag='C' then select NVL(sum(tax_amt),0) into ld_amt from taxtran where tran_code in('MDRCRD','MDRCRC') AND TRAN_ID =as_tran_id AND TAX_CODE ='UKFRT'; elsif flag='V' then select NVL(sum(tax_amt),0) into ld_amt from taxtran where tran_code in('MDRCRD','MDRCRC') AND TRAN_ID =as_tran_id AND TAX_CODE IN('VATSL','ADJ') ; elsif flag='T' then select NVL(sum(taxable_amt),0) into ld_amt from taxtran where tran_code in('MDRCRD','MDRCRC') AND TRAN_ID =as_tran_id AND TAX_CODE ='VATSL'; elsif flag='X' then select nvl(MAX(TAX_PERC),0) into ld_amt from taxtran where tran_code in('MDRCRD','MDRCRC') AND TRAN_ID =as_tran_id AND TAX_CODE ='VATSL' ; end if; return ld_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE POPSUNDRYCHARGETYPE AS FUNCTION getSundryPophelp (asChargeType in char) RETURN sundryMasterTable PIPELINED; END; CREATE OR REPLACE PACKAGE BODY POPSUNDRYCHARGETYPE AS FUNCTION getSundryPophelp (asChargeType in char) RETURN sundryMasterTable PIPELINED IS BEGIN IF asChargeType = 'L' or asChargeType = 'S' THEN FOR x IN (SELECT SUPPLIER.SUPP_CODE, SUPPLIER.SUPP_NAME, TRIM(NVL(SUPPLIER.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SUPPLIER, STATE WHERE nvl(SUPPLIER.BLACK_LIST,'N') != 'Y' AND SUPPLIER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SUPP_CODE,x.SUPP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asChargeType = 'F' or asChargeType = 'D' THEN FOR x IN (SELECT TRANSPORTER.TRAN_CODE, TRANSPORTER.TRAN_NAME, TRANSPORTER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TRANSPORTER, STATE WHERE TRANSPORTER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.TRAN_CODE,x.TRAN_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asChargeType = 'C' THEN FOR x IN (SELECT TAX_AUTHORITY.TAUTH_CODE, TAX_AUTHORITY.TAUTH_NAME, TAX_AUTHORITY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TAX_AUTHORITY, STATE WHERE TAX_AUTHORITY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.TAUTH_CODE,x.TAUTH_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; END popSundryChargeType; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_WO_RCP_QTY (as_workorder in char) return number is lc_retval number (14,3); lc_rejqty number (14,3); lc_recqty number (14,3); begin select sum(nvl(quantity,0)) into lc_recqty from workorder_receipt where work_order = as_workorder and tran_type = 'F' and confirmed = 'Y'; select sum(nvl(qty_rejected,0)) into lc_rejqty from qc_order where porcp_no in ( select tran_id from workorder_receipt where work_order = as_workorder and tran_type = 'F' and confirmed = 'Y' ) and status = 'C'; if lc_recqty is null then lc_recqty := 0; end if; if lc_rejqty is null then lc_rejqty := 0; end if; return lc_recqty - lc_rejqty ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LVL_NAMES ( ai_lvl_no in number, as_lvl_code in char) return varchar2 is ls_val varchar2(1500); li_temp number; ls_lvlcode__parent char(10); ls_sname varchar2(560); ls_val1 varchar2(1500); ls_lvl_parent1 char(10); ls_lvl_descr varchar2(100); ls_label varchar2(200); begin ls_lvl_parent1 := as_lvl_code; for li_temp in reverse 1..ai_lvl_no loop select ltrim(level_descr) , level_code__parent into ls_lvl_descr, ls_lvlcode__parent from hierarchy where level_code = ls_lvl_parent1; select nvl(ddf_sl_pers_name(ls_lvl_parent1), 'XXX') into ls_sname from dual; if li_temp = 1 then ls_label := 'ZONE: '; elsif li_temp = 2 then ls_label := 'REGION: '; elsif li_temp = 3 then ls_label := 'AREA: '; elsif li_temp = 4 then ls_label := 'TERRITORY: '; end if; select rpad(ls_label||'-'||rtrim(ltrim(ls_lvl_parent1))||' '||ltrim(rtrim(ls_lvl_descr))||' ->: '||ltrim(rtrim(ls_sname)),200,' ') into ls_val1 from dual ; ls_val := ls_val1 ||rtrim(ltrim(ls_val)); ls_lvl_parent1 := ls_lvlcode__parent; end loop; return ls_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGETADCODE_DESCR (as_no IN CHAR) RETURN VARCHAR IS AS_DESCR VARCHAR(150); BEGIN BEGIN SELECT SH_DESCR INTO AS_DESCR FROM ALLWDEDN where PRT_SEQ = as_no AND ROWNUM = 1; RETURN AS_DESCR ; EXCEPTION WHEN NO_DATA_FOUND THEN AS_DESCR := ' ' ; END; RETURN AS_DESCR ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INT_CALC_DAYS ( ls_site_code in varchar2, ls_sundry_type in varchar2, ls_sundry_code in varchar2, ls_acct_code in varchar2, ld_tran_date in date, ld_last_date in date, ls_ref_Ser in varchar2, ls_ref_id in varchar2) return number is li_days number(4); ll_cnt number; ldt_prev_tran_Date date; begin select count(*) into ll_cnt from gltrace where site_code = trim(ls_site_code) and sundry_type = trim(ls_sundry_type) and sundry_code = trim(ls_sundry_code) and acct_code = trim(ls_acct_code) and eff_date < ld_tran_date; if ll_cnt > 0 then select max(eff_date) into ldt_prev_tran_date from gltrace where site_code = trim(ls_site_code) and sundry_type = trim(ls_sundry_type) and sundry_code = trim(ls_sundry_code) and acct_code = trim(ls_acct_code) and TRUNC(eff_date) < TRUNC(ld_tran_date); end if; if ll_cnt = 0 then ldt_prev_tran_date := ddf_get_ref_date(trim(ls_ref_ser), trim(ls_ref_id)); li_days := trunc(ld_last_date - ldt_prev_tran_date ) + 1; else li_days := trunc(ld_tran_date - ldt_prev_tran_date); end if; return li_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_MAX_TRANDT (MSITE IN CHAR, MLOT IN CHAR, MTYPE IN CHAR,MITEMCODE IN CHAR) RETURN DATE IS MTRAN_DATE DATE; begin IF MTYPE = 'R' THEN SELECT MAX(TRAN_DATE) INTO MTRAN_DATE FROM INVTRACE WHERE ITEM_CODE=MITEMCODE AND SITE_CODE = MSITE AND REF_SER IN ('P-RCP','D-RCP','W-RCP','QC-ORD','ADJRCP') AND LOT_NO = MLOT AND inv_stat NOT IN ('INTR','DISCR'); END IF; IF MTYPE = 'I' THEN SELECT MAX(TRAN_DATE) INTO MTRAN_DATE FROM INVTRACE WHERE ITEM_CODE=MITEMCODE AND SITE_CODE = MSITE AND LOT_NO = MLOT AND inv_stat NOT IN ('INTR','DISCR') AND instr((select (','||trim(var_value)||',') from disparm where prd_code = '999999' and var_name = 'GET_REF_SER'),(','||trim(ref_ser)||',') ) > 0; END IF; RETURN MTRAN_DATE; End ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GIM_NO (mitem_code in char, mlot_no in char) return varchar2 is mgim_no char(10) := null; begin select max(porcpdet.tran_id) as gim_no into mgim_no from porcp, porcpdet where porcp.tran_date >= '01-apr-03' and porcp.confirmed = 'Y' and porcpdet.tran_id = porcp.tran_id and porcpdet.item_code = mitem_code and porcpdet.lot_no = mlot_no; return mgim_no; exception when others then select max(distord_rcpdet.tran_id) as gim_no into mgim_no from distord_rcp, distord_rcpdet where distord_rcp.tran_date >= '01-apr-03' and distord_rcp.confirmed = 'Y' and distord_rcpdet.tran_id = distord_rcp.tran_id and distord_rcpdet.item_code = mitem_code and distord_rcpdet.lot_no = mlot_no; return mgim_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALC_EXEMPT_LTA (AS_EMP_CODE EMPLOYEE.EMP_CODE%TYPE, AS_ACCT_PRD ACCTPRD.CODE%TYPE, LTA PAYROLLDET.AMOUNT%TYPE, LTA_PAID PAYROLLDET.AMOUNT%TYPE, IT_REGIME NUMBER) RETURN DECIMAL IS EXCEMPTED_LTA DECIMAL(14,3); BEGIN EXCEMPTED_LTA := 0.00; IF (IT_REGIME IS NULL OR IT_REGIME <= 1) AND (LTA > 0 AND LTA_PAID > 0) THEN EXCEMPTED_LTA := LEAST(LTA,LTA_PAID); END IF; RETURN EXCEMPTED_LTA; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEM_DESCR_TRANFLOW (as_desp_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,B.QUANTITY ,B.LOT_NO from item a ,despatchdet b where b.desp_id = as_desp_id and a.item_code = b.item_code; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''||' Item Description '||''||''||'Quantity'||''||''||'Despatch lot'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYR_GRAMT (as_acctprd in char,as_empcode in char) return number is lc_retval number(12,3); lc_gross number(20,3); lc_sectenamt number(12,3); ls_grossad it_calcdet.ad_code%type; begin begin select substr(var_value,1,5) into ls_grossad from payrparm where prd_code = '999999' and var_name = 'GROSS'; exception when No_Data_Found then ls_grossad := ''; end; begin select amount into lc_gross from it_calcdet where ad_code = ls_grossad and acct_prd = as_acctprd and emp_code = as_empcode; exception when Too_many_rows then return -999999.91; when No_Data_Found then lc_gross := 0; when others then return -999999.95; end; begin select sum(b.amount) into lc_sectenamt from allwdedn a, it_calcdet b where a.ad_code = b.ad_code and b.acct_prd = as_acctprd and b.emp_code = as_empcode and a.it_section = '10'; exception when No_Data_Found then lc_sectenamt := 0; when others then return -999999.99; end; return lc_gross - lc_sectenamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHEQITMSER_PORCP (as_tranid in char ) RETURN NUMBER IS LL_ROW NUMBER(5); LS_RESULT NUMBER(1); ll_count number(5); ls_itemcode varchar2(10); ls_sitecode varchar2(5); ls_itemser varchar2(10); ll_loopcount number(5); CURSOR C1 IS SELECT DISTINCT(b.ITEM_CODE),a.SITE_CODE ,C.ITEM_SER FROM porcp a ,porcpdet b ,ITEM C where a.tran_id = b.tran_id AND B.ITEM_CODE = C.ITEM_CODE and a.tran_id = as_tranid ; begin LL_ROW :=0; open c1; loop fetch c1 into ls_itemcode,ls_sitecode,ls_itemser ; exit when c1% notfound; if TRIM(ls_itemser) in ('RM1','PM1','BD','BDI','LRM','LPM','OM') then select count(*) into ll_count from siteitem a where a.item_code = ls_itemcode and a.site_code = ls_sitecode and a.item_ser in ('RM1','PM1','BD','BDI','LRM','LPM','OM'); LL_ROW := LL_ROW + ll_count; ll_loopcount := c1%rowcount ; else ll_row := 1; return ll_row; end if ; end loop; close c1; IF ll_loopcount = ll_row then ll_row := 1; else ll_row := 0; end if ; RETURN LL_ROW; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRY_TRANDATE ( ls_ref_ser in char , ls_tran_id in char ) Return date is ls_tran_date invoice.tran_date%type; Begin If ls_ref_ser = 'S-INV' Then Select tran_date Into ls_tran_date From Invoice Where Trim(invoice_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'VOUCH' Then Select tran_date Into ls_tran_date From Voucher Where Trim(tran_id) = Trim(ls_tran_id) ; ElsIf ls_ref_ser = 'CRNPAY' Or ls_ref_ser = 'DRNPAY' Then Select tran_date Into ls_tran_date From DRCR_Pay Where Trim(tran_id) = Trim(ls_tran_id) ; ElsIf ls_ref_ser = 'CRNRCP' Or ls_ref_ser = 'DRNRCP' Then Select tran_date Into ls_tran_date From DRCR_Rcp Where Trim(tran_id) = Trim(ls_tran_id) ; ElsIf ls_ref_ser = 'D-RCP' Then Select tran_date Into ls_tran_date From DistOrd_Rcp Where Trim(tran_id) = Trim(ls_tran_id); End If; Return ls_tran_date; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_DETAILS ( LSUNDRY_TYPE IN CHAR, LSUNDRY_CODE IN CHAR, LSREQ_VAL IN CHAR ) RETURN CHAR IS DETAILS varCHAR2(4000); SUNDRY_NAME varCHAR2(120); LS_ADDR1 varCHAR2(150); LS_ADDR2 varCHAR2(150); LS_ADDR3 varCHAR2(150); LS_CITY varCHAR2(140); LS_STATE varCHAR2(130); LS_PIN varCHAR2(110); LS_STAN_CODE varCHAR2(110); LS_TELE1 varCHAR2(110); LS_TELE2 varCHAR2(110); LS_TELE3 varCHAR2(110); BEGIN IF LSUNDRY_TYPE='S' THEN SELECT SUPP_NAME,ADDR1,ADDR2,ADDR3,CITY,STATE_CODE,PIN,STAN_CODE,TELE1,TELE2,TELE3 INTO SUNDRY_NAME,LS_ADDR1, LS_ADDR2, LS_ADDR3, LS_CITY, LS_STATE, LS_PIN, LS_STAN_CODE, LS_TELE1, LS_TELE2, LS_TELE3 FROM SUPPLIER WHERE SUPP_CODE=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='C' THEN SELECT CUST_NAME,ADDR1, ADDR2, ADDR3, CITY, STATE_CODE, PIN, STAN_CODE, TELE1, TELE2, TELE3 INTO SUNDRY_NAME,LS_ADDR1, LS_ADDR2, LS_ADDR3, LS_CITY, LS_STATE, LS_PIN, LS_STAN_CODE, LS_TELE1, LS_TELE2, LS_TELE3 FROM CUSTOMER WHERE CUST_CODE=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='E' THEN SELECT EMP_FNAME,CUR_ADD1, CUR_ADD2, CUR_ADD3, CUR_CITY, CUR_STATE, CUR_PIN, STAN_CODE, CUR_TEL1, CUR_TEL2, CUR_TEL3 INTO SUNDRY_NAME,LS_ADDR1, LS_ADDR2, LS_ADDR3, LS_CITY, LS_STATE, LS_PIN, LS_STAN_CODE, LS_TELE1, LS_TELE2, LS_TELE3 FROM EMPLOYEE WHERE EMP_CODE=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='R' THEN SELECT FIRST_NAME,ADDR1, ADDR2, ADDR3, CITY, STATE_CODE, PIN, STAN_CODE, TELE1, TELE2, TELE3 INTO SUNDRY_NAME,LS_ADDR1, LS_ADDR2, LS_ADDR3, LS_CITY, LS_STATE, LS_PIN, LS_STAN_CODE, LS_TELE1, LS_TELE2, LS_TELE3 FROM STRG_CUSTOMER WHERE SC_CODE=LSUNDRY_CODE; END IF; IF LSREQ_VAL='ADDR1' THEN DETAILS :=trim(LS_ADDR1); ELSIF LSREQ_VAL='ADDR2' THEN DETAILS := trim(LS_ADDR2); ELSIF LSREQ_VAL='ADDR3' THEN DETAILS := trim(LS_ADDR3); ELSIF LSREQ_VAL='CITY' THEN DETAILS := trim(LS_CITY); ELSIF LSREQ_VAL='STATE' THEN DETAILS := trim(LS_STATE); ELSIF LSREQ_VAL='PIN' THEN DETAILS := trim(LS_PIN); ELSIF LSREQ_VAL='STAN_CODE' THEN DETAILS := trim(LS_STAN_CODE); ELSIF LSREQ_VAL='TELE1' THEN DETAILS := trim(LS_TELE1); ELSIF LSREQ_VAL='TELE2' THEN DETAILS := trim(LS_TELE2); ELSIF LSREQ_VAL='TELE3' THEN DETAILS := trim(LS_TELE3); ELSIF LSREQ_VAL='NAME' THEN DETAILS := trim(SUNDRY_NAME); END IF; RETURN DETAILS; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RVOUC_DUEDATE (lsref_ser char,lsref_id char) return date is ld_date date; begin if lsref_ser = 'M-VOUC' then select due_date into ld_date from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; end if; return ld_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_REMP_NAME (as_emp_code char ) return varchar2 is ls_name varchar2(75); ls_fname varchar2(15); ls_mname varchar2(15); ls_lname varchar2(15); begin select nvl(emp_fname,''),nvl(emp_mname,''),nvl(emp_lname,'') into ls_fname,ls_mname,ls_lname from employee where trim(emp_code) = trim(as_emp_code); ls_name := ls_fname||' '||ls_mname||' ' ||ls_lname; return ls_name; exception when NO_DATA_FOUND THEN RETURN '' ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QC_ORD_SPEC_X ON QC_ORD_SPEC (QORDER_NO, OPERATION, SEQ_NO, SPEC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_TAX_AMT_INC (AS_TRANCODE char,AS_TRANID CHAR ,AS_LINENO NUMBER ,AS_TYPE CHAR , AI_NETAMT number ,AI_AMOUNT number) RETURN NUMBER IS lc_amt number(14,3); lc_taxamt number(14,3); begin select NVL(sum(tax_amt),0) into lc_amt from taxtran a,tax b where a.tran_code=AS_TRANCODE and a.tran_id= AS_TRANID and a.line_no = LPAD(rtrim(TO_Char(AS_LINENO)),3,' ') and b.tax_type=AS_TYPE and b.tax_code= a.tax_code ; lc_taxamt := AI_NETAMT - lc_amt - AI_AMOUNT; return lc_taxamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE TYP_EMPCODE IS TABLE OF EMPPOS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REJECTED_DATE (as_obj_name audit_trail.obj_name%type, as_tran_id empdetail_chg.tran_id%type) RETURN DATE is ls_retvalue date; ls_status empdetail_chg.status%type; ls_chg_date empdetail_chg.chg_date%type; ls_chg_id audit_trail.chg_id%type; ls_count number; BEGIN ls_count := 0; ls_retvalue := ''; ls_status := ''; ls_chg_date := ''; select status into ls_status from empdetail_chg where tran_id = trim(as_tran_id); if ls_status = 'X' then select count(1) into ls_count from audit_trail where obj_name = LOWER(as_obj_name) and ref_id = as_tran_id; if ls_count > 0 then select max(chg_id) into ls_chg_id from audit_trail where obj_name = LOWER(as_obj_name) and ref_id = as_tran_id; -- if ls_chg_id > 1 then Commented by santosh to check chg_id greater then 0 on 21-SEP-2018 if ls_chg_id > 0 then select chg_date into ls_chg_date from audit_trail where obj_name = LOWER(as_obj_name) and ref_id = as_tran_id and chg_id = ls_chg_id; ls_retvalue := ls_chg_date; end if; end if; end if; return ls_retvalue; Exception when no_data_found then ls_retvalue := ''; RETURN ls_retvalue; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PO_RECOAMT (as_porder in char , as_lineno in int, as_type char ,as_band in char) return number is lc_amt number(14,3) ; lc_taxdiff number(14,3) ; begin lc_taxdiff := 0 ; if as_type = 'S' and as_band = 'D' then select nvl(quantity*rate__std,0) into lc_amt from sorddet where sale_order = as_porder and line_no = as_lineno ; elsif as_type = 'S' and as_band = 'H' then select nvl(quantity*rate__std,0) into lc_amt from sorddet where sale_order = as_porder; elsif as_type = 'S' and as_band ='D' then select nvl(net_amt,0) into lc_amt from sorddet where sale_order = as_porder and line_no = as_lineno ; select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and a.line_no = as_lineno and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_amt + lc_taxdiff ; elsif as_type = 'R' and as_band = 'D' then -- reco amt select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and a.line_no = as_lineno and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_taxdiff ; elsif as_type = 'R' and as_band = 'H' then -- reco amt select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_taxdiff ; elsif as_type = 'P' and as_band = 'H' then -- std cost select sum(nvl(quantity,0) * nvl(std_rate ,0)) into lc_amt from porddet where purc_order = as_porder; end if ; lc_amt := NVL(lc_amt,0) ; return lc_amt ; EXCEPTION WHEN others THEN RETURN 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DPARM_VAL (LS_VAR_NAME in varchar2 ,LS_TAX_CODE in varchar2 ) RETURN number is ls_ret_val number(17,6) ; ls_var_value VARCHAR2(100); BEGIN SELECT var_value into ls_var_value FROM disparm WHERE prd_code = '999999' AND var_name = ls_var_name ; SELECT INSTR(ls_var_value,rtrim(ls_tax_code)) into ls_ret_val FROM DUAL ; RETURN (ls_ret_val) ; exception when NO_DATA_FOUND THEN RETURN 0 ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLOYEE_PF_X ON EMPLOYEE_BAK (EMP_SITE, PF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001105676 ON USERS_GEOFENCE (USER_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VOUCHRCP_PRCP ON VOUCHRCP (PRCP_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHECK (AS_DATE_CHECK IN DATE,AS_SYS_DATE IN DATE,AS_NO_VISIT IN NUMBER ) RETURN NUMBER IS AS_SUM NUMBER(10) ; J NUMBER(1); AS_DATE DATE; BEGIN AS_SUM :=0; AS_DATE :=LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1 ; LOOP J := J+1 ; IF AS_DATE_CHECK>=AS_DATE AND AS_DATE_CHECK<=AS_DATE+30/AS_NO_VISIT THEN AS_SUM :=AS_SUM+1; ELSE AS_SUM :=0; END IF ; AS_DATE :=AS_DATE+30/AS_NO_VISIT; EXIT WHEN J>AS_NO_VISIT; END LOOP; RETURN AS_SUM ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0084086 ON CONDN_ACC (CONDN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UNITSPCL_X ON UNITSPCL (ITEM_TYPE, PHY_ATTRIB_1, PHY_ATTRIB_4) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_QTYISSUE (adec_qtyperpkg in number,adec_totalqty in number) return char is ll_numofpkg integer; ll_temp integer; ll_qtyperpkg integer; ls_str varchar2(2000); begin if adec_totalqty < adec_qtyperpkg then ls_str := '1' || ' x ' || TO_CHAR(adec_totalqty,'99999999.000'); if (ls_str)=' x ' then ls_str:=''; else ls_str:=ls_str ; end if; return ls_str; else ll_temp := (adec_totalqty/adec_qtyperpkg); ll_temp := ll_temp * adec_qtyperpkg; if ll_temp <> adec_totalqty then ll_numofpkg := trunc(adec_totalqty/adec_qtyperpkg,0); ls_str :=TO_CHAR(ll_numofpkg)|| ' x ' ||to_char(adec_qtyperpkg, '99999999.000'); ls_str := ls_str||CHR(10)||'1' || ' x ' || TO_CHAR((adec_totalqty - (ll_numofpkg * adec_qtyperpkg)),'99999999.000'); if (ls_str)=' x ' then ls_str:=''; else ls_str:=ls_str ; end if; return ls_str; else ll_numofpkg := (adec_totalqty/adec_qtyperpkg); ls_str := TO_CHAR(ll_numofpkg)||' x ' ||TO_CHAR(adec_qtyperpkg,'99999999.000'); if (ls_str)=' x ' then ls_str:=''; else ls_str:=ls_str ; end if; return ls_str; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MAX_RCP_OF_INV (ls_refser in char , ls_refno in char ) return char is ls_rcpno char(10) ; begin select max(rcpdet.tran_id) into ls_rcpno from receipt, rcpdet where receipt.tran_id = rcpdet.tran_id and rcpdet.ref_ser = ls_refser and rcpdet.ref_no = ls_refno and confirmed = 'Y' ; return ls_rcpno ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPEC_REF_X ON SPEC_CODES (SPEC_REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDER_ORD_DATE ON PORDER (ORD_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PAYR_VOUCHER_CHK BEFORE INSERT OR UPDATE OF confirmed ON payr_voucher referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_acctcount from PAYR_VOUCHDET where tran_id = :new.tran_id; exception when others then ll_acctcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'P-VOUC' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select tot_amt into lc_hdramt from payr_voucher --where tran_id = :new.tran_id; lc_hdramt := :old.tot_amt ; exception when others then lc_hdramt := 0; end; if (lc_hdramt <> 0 or ll_acctcount <> 0) and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_acctcount) || '] rows in detail or cheque amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'P-VOUC' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AGING_AMT (as_due_date date, as_fr_days NUMBER, as_to_days NUMBER, as_balance_amt NUMBER) RETURN NUMBER as ls_current_date date; ld_due_amt Number; ld_tot_days NUMBER; BEGIN ls_current_date := sysdate; select (sysdate - as_due_date) into ld_tot_days from dual; IF ld_tot_days > as_fr_days AND ld_tot_days <= as_to_days THEN ld_due_amt := as_balance_amt ; ELSE ld_due_amt := 0; END IF ; RETURN (ld_due_amt); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MVOUC_IBCA BEFORE INSERT OR UPDATE OF confirmed ON misc_voucher referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_ibcacount number(3) := 0; ls_sitecodepay char(5); BEGIN if :new.confirmed = 'Y' and :new.net_amt <> 0 then -- 1. check pay site ls_sitecodepay := :new.SITE_CODE__PAY; if ls_sitecodepay is null or length(trim(ls_sitecodepay)) = 0 then ls_sitecodepay := :new.site_code; end if; if trim(:new.site_code) <> trim(ls_sitecodepay) then begin /*select count(1) into ll_ibcacount from misc_payables where tran_ser = 'P-IBCA' and ref_no = :new.tran_id and site_code = ls_sitecodepay ;*/ select count(1) into ll_ibcacount from pay_ibca_det where ref_ser = 'M-VOUC' and ref_no = :new.tran_id; exception when others then ll_ibcacount := 0; end; if ll_ibcacount = 0 then raise_application_error( -20601, 'IBCA not created pay site [' || ls_sitecodepay || '] voucher site [' || :new.site_code || ']' ); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_OBJ_SIGN_TR_RES_REFID ON OBJ_SIGN_TRANS_RESET (REF_SER, REF_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_SALES_COMM_SITE_SP_VAL (as_tranid in char, as_salespers in char ) return number is ac_cnt number(14,3) ; ls_sitecomm char(5); begin select site_code into ls_sitecomm from sales_comm_hdr where tran_id = as_tranid ; select count(1) into ac_cnt from sales_pers, employee where sales_pers.sales_pers = employee.emp_code and sales_pers.sales_pers = as_salespers and employee.pay_site = ls_sitecomm ; return ac_cnt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_BL_SIT_BK_ST ON BANKTRAN_LOG (SITE_CODE, BANK_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GST_CHK_SOTAX ( ls_tax_env IN CHAR ) RETURN NUMBER AS ls_tax NUMBER; BEGIN IF trim(ls_tax_env) = 'SAN' OR trim(ls_tax_env) = 'SAS' OR trim(ls_tax_env) = 'SAR' OR trim(ls_tax_env) = 'SCG' OR trim(ls_tax_env ) = 'SJH' OR trim(ls_tax_env) = 'SML' OR trim(ls_tax_env) = 'SMN' OR trim(ls_tax_env) = 'SMZ' OR trim(ls_tax_env) = 'SNL' OR trim (ls_tax_env) = 'SOR' OR trim(ls_tax_env) = 'SSK' OR trim(ls_tax_env) = 'STR' OR trim(ls_tax_env) = 'SWB' OR trim(ls_tax_env) = 'SBR' OR trim(ls_tax_env) = 'SCH' OR trim(ls_tax_env) = 'SDL' OR trim(ls_tax_env) = 'SHP' OR trim(ls_tax_env) = 'SHR' OR trim(ls_tax_env ) = 'SJK' OR trim(ls_tax_env) = 'SMP' OR trim(ls_tax_env) = 'SPB' OR trim(ls_tax_env) = 'SUP' OR trim(ls_tax_env) = 'SUA' OR trim (ls_tax_env) = 'SAP' OR trim(ls_tax_env) = 'SKL' OR trim(ls_tax_env) = 'SKL' OR trim(ls_tax_env) = 'SKA' OR trim(ls_tax_env) = 'SPY' OR trim(ls_tax_env) = 'STN' OR trim(ls_tax_env) = 'STS' OR trim(ls_tax_env) = 'SDD' OR trim(ls_tax_env) = 'SGJ' OR trim(ls_tax_env ) = 'SGA' OR trim(ls_tax_env) = 'SMH' OR trim(ls_tax_env) = 'SGA' OR trim(ls_tax_env) = 'SRJ' OR trim(ls_tax_env) = 'SDN' OR trim (ls_tax_env) = 'SDN' OR trim(ls_tax_env) = 'SLD' OR trim(ls_tax_env) = 'SIGST01' OR trim(ls_tax_env) = 'PSIWC01' OR trim(ls_tax_env ) = 'SEP01' OR trim(ls_tax_env) = 'SIGST02' OR trim(ls_tax_env) = 'SPRL01' OR trim(ls_tax_env) = 'SPRI01' OR trim(ls_tax_env) = 'SPRI02' or trim(ls_tax_env) = 'SMHTC' THEN ls_tax := 1; RETURN ls_tax; ELSE RETURN 0; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INVOICE_2S ( as_invoice_id char, as_lot_sl char) return decimal is lc_tot_2s decimal(13,2); begin select case when sum(net_amt) is null then 0 else sum(net_amt) end into lc_tot_2s from invoice_trace where invoice_id = as_invoice_id and lot_sl = as_lot_sl and substr(tax_env,1,2) = substr(tax_env,3,2) and tax_amt <> 0 ; if sqlcode() < 0 then return -1; end if; return lc_tot_2s; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRODUCTCOST_DET_X ON PRODUCTCOST_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION BI_RGET_HOL_CNT (as_emp_code char, as_month varchar2) return Number is Cnt number(3); begin select count(hol_date) into Cnt from holiday where hol_tblno in (select hol_tblno from employee where emp_code=as_emp_code) and to_char(hol_date,'MONTH-YY')=as_month; return nvl(Cnt,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPAYSLP_PROLL ( ls_period char,ls_emp char ,ls_ad_code char) return number is lc_amt number (14,2) ; begin SELECT nvl(payarr_det.amount,0) into lc_amt FROM payarr_det WHERE ( payarr_det.prd_code = ls_period) AND ( payarr_det.emp_code = ls_emp ) AND ( payarr_det.ad_code = ls_ad_code) ; return lc_amt ; exception when NO_DATA_FOUND then return 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYUNADJADV_AMT ( as_refser IN Char , as_refno IN Char , ad_asondate IN Date , ac_outstamt IN Number) Return Number IS ac_outst_amt Number(14,3); lc_outstamt number(14,3) ; lc_adjamt number(14,3) ; Begin lc_outstamt := ac_outstamt ; -- tot_amt - adj_amt Select Nvl(Sum(A.pay_amt),0) Into lc_adjamt From Misc_Paydet A, Misc_Payment B Where A.tran_id = B.tran_id And A.tran_ser = as_refser And A.vouch_no = as_refno And B.tran_date > ad_asondate And B.confirmed = 'Y' ; lc_outstamt := lc_outstamt + lc_adjamt ; Select Nvl(Sum(B.adj_amt),0) Into lc_adjamt From Misc_Voucher A , Misc_VouchAdv B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.adj_amt),0) Into lc_adjamt From Voucher A , VouchAdv B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.tot_amt),0) Into lc_adjamt From Pay_Ibca A , Pay_Ibca_Det B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.pay_amt),0) Into lc_adjamt From Misc_Payment_Canc A , Misc_Payment_Cancdet B , Misc_Payment C Where A.tran_id = B.tran_id And A.payment_no = C.tran_id And B.tran_ser = as_refser And B.vouch_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt - lc_adjamt; Return lc_outstamt; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_VOUCH_ADVCOUNT (as_purc in char) RETURN NUMBER IS li_cnt NUMBER (14,2) ; BEGIN select COUNT(*) into li_cnt from pord_pay_term where purc_order = as_purc; return li_cnt ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MPAYTAX ( AS_TRANID CHAR, AS_REFSER CHAR, AS_VOUCHNO CHAR ) RETURN VARCHAR2 IS ls_retval VARCHAR2(2000); lc_cnt smallint; ls_maxid varchar(10); cursor c1 is SELECT tax_code, sum(tax_amt) as tax_amt FROM taxtran WHERE tran_code = as_refser and tran_id = as_vouchno and tax_amt <> 0 group by tax_code; BEGIN select max(a.tran_id) into ls_maxid from misc_payment a, misc_paydet b where a.tran_id = b.tran_id and b.tran_ser = as_refser and b.vouch_no = as_vouchno and a.conf_date = (select max(a.conf_date) from misc_payment a, misc_paydet b where a.tran_id = b.tran_id and b.tran_ser = as_refser and b.vouch_no = as_vouchno ); ls_retval :=' '; for san in c1 loop begin exit when c1%notfound; ls_retval := ls_retval || ' ' ||san.tax_code || ' ' || lpad(trim(to_char(san.tax_amt,'9999990.99')),10,' ') || chr(13); end; end loop; --end if; RETURN ls_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_ITEM_DISPLAY_X ON STRG_ITEM_DISPLAY (DCR_ID, STRG_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BANK_NAME ( as_ref_ser char, as_ref_id char) return varchar2 is ls_bank_code char(10); ls_bank_name varchar2(70); begin begin select bank_code into ls_bank_code from banktran_log where tran_no = as_ref_id and tran_ser = as_ref_ser and rownum = 1; exception when no_data_found then ls_bank_name := null; end; select bank_name into ls_bank_name from bank where bank_code = ls_bank_code; return ls_bank_code ||' '||ls_bank_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_FEAS_COMP_X ON PROJ_FEAS_COMP (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LICENCE_ISS_RET_X ON LICENCE_ISS_RET (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TOT_GROSS (GRN_NO IN CHAR,TRAN_TYPE IN CHAR,EXCH_RATE IN NUMBER) return NUMBER IS lc_amt_bal NUMBER(14,3); BEGIN select SUM(PORCPDET.QUANTITY * (CASE WHEN (TRAN_TYPE= 'IM' ) THEN (EXCH_RATE*PORCPDET.RATE) ELSE PORCPDET.RATE END ) ) into lc_amt_bal FROM PORCPDET WHERE TRAN_ID=GRN_NO; return lc_amt_bal; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DWH_SALES ( AS_FR_DATE DATE, AS_TO_DATE DATE) AS BEGIN IF (AS_TO_DATE >= AS_FR_DATE) THEN /*========== INSERT for DWH_SALES_SUM Started ==========*/ INSERT INTO DWH_SALES_SUM ( TRAN_ID, SITE_CODE, CUST_CODE, CUST_CODE__BIL, ITEM_CODE, LOT_NO, LINE_TYPE, DOC_DATE, POS_CODE, SALES_QTY, GROSS_SALES_VALUE, SALES_VALUE, FREE_QTY, FREE_SALES_VALUE, NET_SALES_QTY, NET_SALES_VALUE, REPL_QTY, REPL_VALUE, SALEABLE_RETURN_QTY, SALEABLE_RETURN_AMT, BREAKAGE_RETURN_QTY, BREAKAGE_RETURN_AMT, EXPIRY_RETURN_QTY, EXPIRY_RETURN_AMT, CORRECTION_RETURN_QTY, CORRECTION_RETURN_AMT, REPL_RETURN_QTY, REPL_RETURN_VALUE, RETURN_QTY, GROSS_RETURN_VALUE, RETURN_VALUE, NET_RETURN_VALUE, CGST_RATE, CGST_AMT, SGST_RATE, SGST_AMT, IGST_RATE, IGST_AMT, DISC_AMT, MRP, PTR, PTS, HSN_CODE, PACK, DUE_DATE, REF_SER, CITY, ITEM_BRAND, ITEM_SER , LINE_NO, LOAD_DATE ) SELECT DSSV.TRAN_ID, DSSV.SITE_CODE AS SITE_CODE, DSSV.CUST_CODE AS CUST_CODE, DSSV.CUST_CODE_BILL AS CUST_CODE__BIL, DSSV.ITEM_CODE AS ITEM_CODE, DSSV.LOT_NO AS LOT_NO, DSSV.LINE_TYPE AS LINE_TYPE, DSSV.TRAN_DATE AS DOC_DATE, DSSV.POS_CODE AS POS_CODE, SUM( DSSV.SALES_QTY ) AS SALES_QTY, SUM( DSSV.GROSS_SALES_VALUE - DSSV.DISC_AMT_INV ) AS GROSS_SALES_VALUE, SUM( DSSV.GROSS_SALES_VALUE ) AS SALES_VALUE, SUM( DSSV.FREE_QTY ) AS FREE_QTY, SUM( DSSV.FREE_SALES_VALUE ) AS FREE_SALES_VALUE, SUM( DSSV.SALES_QTY + DSSV.FREE_QTY + DSSV.REPL_QTY - DSSV.RETURN_QTY + DSSV.REPL_RETURN_QTY ) AS NET_SALES_QTY, SUM( ( DSSV.GROSS_SALES_VALUE - DSSV.DISC_AMT_INV ) - ( DSSV.GROSS_RETURN_VALUE - DSSV.DISC_AMT_RET ) + ( DSSV.REPL_RETURN_VALUE - DSSV.DISC_AMT_REPL_RET ) ) AS NET_SALES_VALUE, SUM( DSSV.REPL_QTY ) AS REPL_QTY, SUM( DSSV.REPL_VALUE - DSSV.DISC_AMT_REPL) AS REPL_VALUE, SUM( DSSV.SALEABLE_RETURN_QTY ) AS SALEABLE_RETURN_QTY, SUM( DSSV.SALEABLE_RETURN_AMT ) AS SALEABLE_RETURN_AMT, SUM( DSSV.BREAKAGE_RETURN_QTY ) AS BREAKAGE_RETURN_QTY, SUM( DSSV.BREAKAGE_RETURN_AMT ) AS BREAKAGE_RETURN_AMT, SUM( DSSV.EXPIRY_RETURN_QTY ) AS EXPIRY_RETURN_QTY, SUM( DSSV.EXPIRY_RETURN_AMT ) AS EXPIRY_RETURN_AMT, SUM( DSSV.CORRECTION_RETURN_QTY ) AS CORRECTION_RETURN_QTY, SUM( DSSV.CORRECTION_RETURN_AMT ) AS CORRECTION_RETURN_AMT, SUM( DSSV.REPL_RETURN_QTY ) AS REPL_RETURN_QTY, SUM( DSSV.REPL_RETURN_VALUE - DSSV.DISC_AMT_REPL_RET) AS REPL_RETURN_VALUE, SUM( DSSV.RETURN_QTY ) AS RETURN_QTY, SUM( DSSV.GROSS_RETURN_VALUE - DSSV.DISC_AMT_RET) AS GROSS_RETURN_VALUE, SUM( DSSV.GROSS_RETURN_VALUE ) AS RETURN_VALUE, SUM( DSSV.NET_RETURN_VALUE ) AS NET_RETURN_VALUE, DSSV.CGST_RATE, SUM(DSSV.CGST_AMT) AS CGST_AMT, DSSV.SGST_RATE, SUM(DSSV.SGST_AMT) AS SGST_AMT, DSSV.IGST_RATE, SUM(DSSV.IGST_AMT) AS IGST_AMT, SUM(DSSV.DISC_AMT_INV + DSSV.DISC_AMT_RET + DSSV.DISC_AMT_REPL + DSSV.DISC_AMT_REPL_RET) AS DISC_AMT, DSSV.MRP, DSSV.PTR, DSSV.PTS, DSSV.HSN_CODE, (SELECT DESCR FROM PACKING WHERE PACK_CODE = DSSV.PACK_CODE) AS PACK, DSSV.DUE_DATE, DSSV.REF_SER, NVL(DSSV.CITY , 'NOTSPECIFIED') AS CITY, DSSV.ITEM_BRAND, DSSV.ITEM_SER, DSSV.LINE_NO, SYSDATE AS LOAD_DATE FROM (SELECT 'S-INV ' AS REF_SER, ITEM.ITEM_SER, INVOICE_TRACE.LINE_NO, INVOICE.INVOICE_ID AS TRAN_ID, INVOICE.SITE_CODE, INVOICE.CUST_CODE, INVOICE.CUST_CODE__BIL AS CUST_CODE_BILL, INVOICE_TRACE.ITEM_CODE, nvl(INVOICE_TRACE.LOT_NO,'NA') as lot_no, nvl(INVOICE_TRACE.LINE_TYPE,'NA') as line_type, INVOICE.TRAN_DATE, NVL((SELECT ORG.POS_CODE FROM ORG_STRUCTURE_CUST ORG WHERE ORG.CUST_CODE=INVOICE.CUST_CODE__BIL AND ORG.VERSION_ID IN (SELECT V.VERSION_ID FROM VERSION V WHERE TO_DATE(SYSDATE) BETWEEN V.EFF_FROM AND V.VALID_UPTO) AND ORG.TABLE_NO = ITEM.ITEM_SER ) ,'NA') AS POS_CODE, INVOICE.INV_TYPE AS TRAN_TYPE, ITEM.HSN_NO AS HSN_CODE, ITEM.PACK_CODE AS PACK_CODE, NVL(DC.CITY , 'NOTSPECIFIED') AS CITY, ITEM.PHY_ATTRIB_2 AS ITEM_BRAND, TO_CHAR(NVL(INVOICE.DUE_DATE,INVOICE.TRAN_DATE )) AS DUE_DATE, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'F', 'V') AND INVOICE_TRACE.RATE__STDUOM = 0 THEN 0 ELSE INVOICE_TRACE.QUANTITY__STDUOM END ) AS SALES_QTY, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN 0 ELSE INVOICE_TRACE.QUANTITY__STDUOM * INVOICE_TRACE.RATE__STDUOM END ) AS GROSS_SALES_VALUE, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'I', 'V') THEN INVOICE_TRACE.QUANTITY__STDUOM ELSE 0 END ) AS REPL_QTY, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN INVOICE_TRACE.QUANTITY__STDUOM ELSE 0 END ) AS FREE_QTY, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN INVOICE_TRACE.QUANTITY__STDUOM * NVL(FN_RPICK_RATE_PL(DC.PRICE_LIST, INVOICE.TRAN_DATE, INVOICE_TRACE.ITEM_CODE, INVOICE_TRACE.LOT_NO) , 0 ) ELSE 0 END ) AS FREE_SALES_VALUE, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'I', 'V') AND INVOICE_TRACE.RATE__STDUOM = 0 THEN INVOICE_TRACE.QUANTITY__STDUOM * NVL(FN_RPICK_RATE_PL(DC.PRICE_LIST, INVOICE.TRAN_DATE, INVOICE_TRACE.ITEM_CODE, INVOICE_TRACE.LOT_NO) , 0 ) ELSE 0 END ) AS REPL_VALUE, INVOICE_TRACE.NET_AMT AS NET_SALES_VALUE, 0 AS SALEABLE_RETURN_QTY, 0 AS SALEABLE_RETURN_AMT, 0 AS BREAKAGE_RETURN_QTY, 0 AS BREAKAGE_RETURN_AMT, 0 AS EXPIRY_RETURN_QTY, 0 AS EXPIRY_RETURN_AMT, 0 AS CORRECTION_RETURN_QTY, 0 AS CORRECTION_RETURN_AMT, 0 AS REPL_RETURN_QTY, 0 AS REPL_RETURN_VALUE, 0 AS RETURN_QTY, 0 AS GROSS_RETURN_VALUE, 0 AS NET_RETURN_VALUE, 0 AS FREE_RETURN_QTY, 0 AS FREE_RET_VALUE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','P'),0) AS CGST_RATE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','T'),0) AS CGST_AMT, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','P'),0) AS SGST_RATE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','T'),0) AS SGST_AMT, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','P'),0) AS IGST_RATE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','T'),0) AS IGST_AMT, ( (NVL((((NVL(INVOICE_TRACE.QUANTITY,0)*NVL(INVOICE_TRACE.RATE__STDUOM,0)*NVL(INVOICE.EXCH_RATE,0))*NVL(INVOICE_TRACE.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-INV', INVOICE_TRACE.INVOICE_ID, CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0)) ) AS DISC_AMT_INV, 0 AS DISC_AMT_RET, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'I', 'V') AND INVOICE_TRACE.RATE__STDUOM = 0 THEN ( (NVL((((NVL(INVOICE_TRACE.QUANTITY,0)*NVL(INVOICE_TRACE.RATE__STDUOM,0)*NVL(INVOICE.EXCH_RATE,0))*NVL(INVOICE_TRACE.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-INV', INVOICE_TRACE.INVOICE_ID, CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0)) ) ELSE 0 END ) AS DISC_AMT_REPL, 0 AS DISC_AMT_REPL_RET, NVL(FN_RPICK_MRP_PTR(INVOICE_TRACE.ITEM_CODE,INVOICE.TRAN_DATE,INVOICE_TRACE.LOT_NO,'MRP_GST'),0) AS MRP, NVL(FN_RPICK_MRP_PTR(INVOICE_TRACE.ITEM_CODE,INVOICE.TRAN_DATE,INVOICE_TRACE.LOT_NO,'PTR_GST'),0) AS PTR, NVL(FN_RPICK_MRP_PTR(INVOICE_TRACE.ITEM_CODE,INVOICE.TRAN_DATE,INVOICE_TRACE.LOT_NO,'PTS_GST'),0) AS PTS FROM INVOICE INNER JOIN INVOICE_TRACE ON INVOICE.INVOICE_ID = INVOICE_TRACE.INVOICE_ID INNER JOIN SITE ON INVOICE.SITE_CODE = SITE.SITE_CODE INNER JOIN ITEM ON INVOICE_TRACE.ITEM_CODE = ITEM.ITEM_CODE LEFT OUTER JOIN CUSTOMER DC ON INVOICE.CUST_CODE = DC.CUST_CODE WHERE INVOICE.CONFIRMED = 'Y' AND INVOICE.TRAN_DATE >= AS_FR_DATE AND INVOICE.TRAN_DATE <= AS_TO_DATE UNION ALL SELECT 'S-RET' AS REF_SER, ITEM.ITEM_SER, SRETURNDET.LINE_NO, SRETURN.TRAN_ID, SRETURN.SITE_CODE, SRETURN.CUST_CODE, SRETURN.CUST_CODE__BILL AS CUST_CODE_BILL, SRETURNDET.ITEM_CODE, nvl(SRETURNDET.LOT_NO,'NA') as lot_no, nvl(SRETURNDET.LINE_TYPE,'NA') as line_type, SRETURN.TRAN_DATE, NVL((SELECT ORG.POS_CODE FROM ORG_STRUCTURE_CUST ORG WHERE ORG.CUST_CODE=SRETURN.CUST_CODE__BILL AND ORG.VERSION_ID IN (SELECT V.VERSION_ID FROM VERSION V WHERE TO_DATE(SYSDATE) BETWEEN V.EFF_FROM AND V.VALID_UPTO) AND ORG.TABLE_NO = ITEM.ITEM_SER ) ,'NA') AS POS_CODE, SRETURN.TRAN_TYPE, ITEM.HSN_NO AS HSN_CODE, ITEM.PACK_CODE AS PACK_CODE, ITEM.PHY_ATTRIB_2 AS ITEM_BRAND, NVL(DC.CITY , 'NOTSPECIFIED') AS CITY, TO_CHAR( SRETURN.TRAN_DATE) AS DUE_DATE, 0 AS SALES_QTY, 0 AS GROSS_SALES_VALUE, 0 AS REPL_QTY, 0 AS FREE_QTY, 0 AS FREE_SALES_VALUE, 0 AS REPL_VALUE, 0 AS NET_SALES_VALUE, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('SR') THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS SALEABLE_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('SR') THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS SALEABLE_RETURN_AMT, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('BR', 'DR') THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS BREAKAGE_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('BR', 'DR') THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS BREAKAGE_RETURN_AMT, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE = 'ER' AND SRETURNDET.DISCOUNT <> 100 THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS EXPIRY_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE = 'ER' AND SRETURNDET.DISCOUNT <> 100 THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS EXPIRY_RETURN_AMT, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('IC') THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS CORRECTION_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('IC') THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS CORRECTION_RETURN_AMT, DECODE(SRETURNDET.RET_REP_FLAG, 'P', SRETURNDET.QUANTITY__STDUOM, 0) AS REPL_RETURN_QTY, DECODE(SRETURNDET.RET_REP_FLAG, 'P', SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM, 0) AS REPL_RETURN_VALUE, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS GROSS_RETURN_VALUE, SRETURNDET.NET_AMT AS NET_RETURN_VALUE, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN DECODE(INVOICE_TRACE.INVOICE_ID, NULL, 0, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END) ) ELSE 0 END) AS FREE_RETURN_QTY, (CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN DECODE(INVOICE_TRACE.INVOICE_ID, NULL, 0, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN SRETURNDET.QUANTITY__STDUOM * INVOICE_TRACE.RATE__STDUOM ELSE 0 END) ) ELSE 0 END) AS FREE_RET_VALUE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','P'),0) AS CGST_RATE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','T'),0) AS CGST_AMT, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','P'),0) AS SGST_RATE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','T'),0) AS SGST_AMT, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','P'),0) AS IGST_RATE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','T'),0) AS IGST_AMT, 0 AS DISC_AMT_INV, ((NVL((((NVL(SRETURNDET.QUANTITY__STDUOM,0)*NVL(SRETURNDET.RATE__STDUOM,0)*NVL(SRETURN.EXCH_RATE,0))*NVL(SRETURNDET.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-RET', SRETURN.TRAN_ID, CAST(SRETURNDET.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0))) AS DISC_AMT_RET, 0 AS DISC_AMT_REPL, DECODE(SRETURNDET.RET_REP_FLAG,'P',((NVL((((NVL(SRETURNDET.QUANTITY__STDUOM,0)*NVL(SRETURNDET.RATE__STDUOM,0)*NVL(SRETURN.EXCH_RATE,0))*NVL(SRETURNDET.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-RET', SRETURN.TRAN_ID, CAST(SRETURNDET.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0))), 0) AS DISC_AMT_REPL_RET, NVL(FN_RPICK_MRP_PTR(SRETURNDET.ITEM_CODE, SRETURN.TRAN_DATE,SRETURNDET.LOT_NO,'MRP_GST'),0) AS MRP, NVL(FN_RPICK_MRP_PTR(SRETURNDET.ITEM_CODE, SRETURN.TRAN_DATE,SRETURNDET.LOT_NO,'PTR_GST'),0) AS PTR, NVL(FN_RPICK_MRP_PTR(SRETURNDET.ITEM_CODE, SRETURN.TRAN_DATE,SRETURNDET.LOT_NO,'PTS_GST'),0) AS PTS FROM SRETURN INNER JOIN SRETURNDET ON SRETURN.TRAN_ID = SRETURNDET.TRAN_ID INNER JOIN SITE ON SRETURN.SITE_CODE = SITE.SITE_CODE INNER JOIN ITEM ON SRETURNDET.ITEM_CODE = ITEM.ITEM_CODE LEFT OUTER JOIN CUSTOMER DC ON SRETURN.CUST_CODE = DC.CUST_CODE LEFT OUTER JOIN INVOICE_TRACE ON SRETURN.INVOICE_ID = INVOICE_TRACE.INVOICE_ID AND SRETURNDET.INVOICE_ID = INVOICE_TRACE.INVOICE_ID AND SRETURNDET.LINE_NO__INVTRACE = INVOICE_TRACE.LINE_NO WHERE SRETURN.CONFIRMED = 'Y' AND SRETURN.TRAN_DATE >= AS_FR_DATE AND SRETURN.TRAN_DATE <= AS_TO_DATE ) DSSV GROUP BY DSSV.TRAN_ID, DSSV.SITE_CODE, DSSV.CUST_CODE, DSSV.CUST_CODE_BILL, DSSV.ITEM_CODE, DSSV.LOT_NO, DSSV.LINE_TYPE, DSSV.TRAN_DATE, DSSV.POS_CODE, DSSV.MRP, DSSV.PTR, DSSV.PTS, DSSV.HSN_CODE, DSSV.PACK_CODE, DSSV.DUE_DATE, DSSV.ITEM_BRAND, NVL(DSSV.CITY , 'NOTSPECIFIED'), DSSV.CGST_RATE, DSSV.SGST_RATE, DSSV.IGST_RATE, DSSV.REF_SER, DSSV.ITEM_SER, DSSV.LINE_NO ; /*========== INSERT for DWH_SALES_SUM Ended ==========*/ COMMIT ; /* ==================== DWH_SALES_SUM Data Insertion END ==================== */ /* ==================== DWH_SALES_SUM Data Updation START ==================== */ UPDATE DWH_SALES_SUM t1 SET (t1.TARGET_QTY, t1.TARGET_VALUE) = ( SELECT t2.TARGET_QTY, t2.TARGET_VALUE FROM ( select SITE_CODE, CUST_CODE, POS_CODE, ITEM_CODE, ITEM_SER, SUM(H_NET_AMT) as TARGET_VALUE, SUM(QUANTITY) as TARGET_QTY from ( select SBC.TRAN_ID, SBCD.LINE_NO, SBC.SITE_CODE, SBC.CUST_CODE, SBC.POS_CODE, SBCD.ITEM_CODE, SBC.ITEM_SER, SBC.NET_AMT as H_NET_AMT, SBCD.RATE, SBCD.QUANTITY, SBCD.NET_AMT as D_NET_AMT from SALES_BUDGET_CUST SBC LEFT JOIN SALES_BUDGET_CUST_DET SBCD ON SBC.TRAN_ID = SBCD.TRAN_ID ) where SITE_CODE is not null And CUST_CODE is not null And POS_CODE is not null And ITEM_CODE is not null And ITEM_SER is not null group by SITE_CODE, CUST_CODE, POS_CODE, ITEM_CODE, ITEM_SER ) t2 WHERE t1.SITE_CODE = t2.SITE_CODE and t1.CUST_CODE = t2.CUST_CODE and t1.POS_CODE = t2.POS_CODE and t1.ITEM_CODE = t2.ITEM_CODE and t1.ITEM_SER = t2.ITEM_SER ); COMMIT ; /* ==================== DWH_SALES_SUM Data Updation END ==================== */ END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(' Error occured '); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX UK_TRAN_EVAL ON PROJ_FEAS_EVAL (TRAN_ID, EVAL_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PAYEXP_REFNO BEFORE INSERT or UPDATE OF ref_no ON PAYMENT_EXP referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_COUNTRY_CONV_DT (ld_english_date in date) return varchar2 is ls_return varchar2(40); ls_convertdt char(10); begin begin select convert_date into ls_convertdt from date_conversion where english_date = ld_english_date ; exception when no_data_found then ls_return := to_char(ld_english_date); end; if (ls_convertdt is not null) and length(rtrim(ls_convertdt)) > 0 then ls_return := ls_convertdt ; end if; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DORD_TERM_X ON DORD_TERM (DIST_ORDER, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TRANSPORTER_TRAN_NAME ON TRANSPORTER (TRAN_CODE, UPPER(TRAN_NAME)) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_BUD_GRP_X ON PROJ_BUD_GRP (BUD_GRP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUDGET_ALLOC_DET_X ON BUDGET_ALLOC_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WOUNDOFP AFTER UPDATE ON WORDER_UNDOFIRMPLAN REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE ALLOCQTY NUMBER(17,6) := 0; ERRSTR VARCHAR2(4000) := ' '; SNO NUMBER(4) := 0; CURSOR C_WOUNDOFP IS SELECT SITE_CODE,LOC_CODE,ITEM_CODE,LOT_NO,LOT_SL,SUM(ALLOC_QTY) AS ALLOC_QTY FROM INVALLOC_TRACE WHERE REF_SER = 'W-ORD' AND REF_ID = :NEW.WORK_ORDER GROUP BY SITE_CODE,LOC_CODE,ITEM_CODE,LOT_NO,LOT_SL HAVING SUM(ALLOC_QTY) <> 0 ORDER BY SITE_CODE,LOC_CODE,ITEM_CODE,LOT_NO,LOT_SL; BEGIN ALLOCQTY := 0; SNO := 0; errstr := ''; IF :NEW.STATUS = 'U' THEN FOR RN IN C_WOUNDOFP LOOP SNO := SNO + 1; ERRSTR := ERRSTR || '(' || TRIM(TO_CHAR(SNO)) || ') [' || RN.SITE_CODE || '] [' || RN.LOC_CODE || '] [' || RN.ITEM_CODE || '] [' || RN.LOT_NO || '] [' || RN.LOT_SL || '] [' || TRIM(TO_CHAR(RN.ALLOC_QTY)) || ']' || CHR(13); END LOOP; IF(SNO > 0) THEN RAISE_APPLICATION_ERROR( -20601, 'Alloc Qty non zero : ' || ERRSTR); END IF; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MAX_RATESTD_KUS (ls_site_code in char,ls_item_code in char,ls_eff_date in date,ls_valid_upto in date) return number is ls_max_rate number(15,4); ls_invoice_id INVOICE.INVOICE_ID%TYPE; begin SELECT TO_CHAR(MAX(IT.INVOICE_ID)) INTO ls_invoice_id FROM INVOICE_TRACE IT,INVOICE I WHERE I.INVOICE_ID=IT.INVOICE_ID AND I.SITE_CODE = ls_site_code AND IT.ITEM_CODE = ls_item_code AND I.TRAN_DATE BETWEEN ls_eff_date AND ls_valid_upto ; SELECT NVL(ROUND(MAX(IT.RATE__STDUOM),2),0.00) INTO ls_max_rate FROM INVOICE_TRACE IT,INVOICE I WHERE IT.INVOICE_ID=ls_invoice_id AND IT.ITEM_CODE = ls_item_code AND I.SITE_CODE = ls_site_code AND IT.EXP_LEV <> '1.2.' ; RETURN ls_max_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_SUMM (ls_tran_code in char, ls_tran_id in char, ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; lc_exch_rate number(17,6); begin begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); select (','||rtrim(var_value)||',') into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt__TCurr,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; end if; -- tax % if ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 AND TAX_AMT <>0 ; end if; -- taxable amt if ls_type = 'A' then select coalesce(SUM(taxable_amt), 0) into lc_tax_amt from taxtran,tax WHERE tax.tax_code = taxtran.tax_code and tran_code = ls_tran_code and tran_id = ls_tran_id And tax_perc <> 0 AND (TAX.TAX_TYPE) IN ('H','I','J') ; end if; exception when no_data_found then lc_tax_amt := 0 ; end ; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUBMISSION_DESIGNATION (as_designaton_allow varchar2,as_emp_code char) RETURN varchar2 IS designation varchar2(20); a_count number(3); designation_whitespace varchar2(200); begin select regexp_replace(as_designaton_allow,'\s') into designation_whitespace from dual; select INSTR(designation_whitespace,',') into a_count from dual; if a_count = 0 then select (case when instr(','||designation_whitespace||',',','||(select TRIM(DESIGN_CODE) from employee where emp_code = as_emp_code )||',') > 0 then 'exists' else 'not exists' end) into designation FROM DUAL; else select (case when instr(','||designation_whitespace||',',','||(select TRIM(DESIGN_CODE) from employee where emp_code = as_emp_code )||',') > 0 then 'exists' else 'not exists' end) into designation FROM DUAL; end if; return designation; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_OPSTK_DATE (as_sitecode in char, as_itemcode in char, as_loccode in char ) return date is ldt_opdate date; ldt_crea_date date ; begin select min(a.TRAN_DATE) into ldt_crea_date from invtrace a where a.item_code = as_itemcode and a.site_code = as_sitecode and a.loc_code = as_loccode ; return (ldt_crea_date); end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CREDITREMKS_TRANSLINK (ls_sreturn char) return varchar2 is LS_REMARKS VARCHAR2(1000); LS_INVOICE CHAR(10); begin select invoice_id into ls_invoice from sreturn where tran_id=ls_sreturn; if TRIM(LENGTH(ls_invoice)) =0 then select remarks into ls_remarks from misc_drcr_rcp where sreturn_no=ls_sreturn; else select remarks into ls_remarks from drcr_rcp where sreturn_no=ls_sreturn; end if; return ls_remarks; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUNDRY_NAME (lsundry_type in char,lsundry_code in char,lname in char) return char is ls_name Varchar2(1000); /*While Returning from the Report giving Error of Charactor Buffer is too Small*/ begin if lsundry_type ='O' then ls_name := ' '; elsif lsundry_type ='T' then if lname = 'C' then select chq_name into ls_name from transporter where tran_code = lsundry_code; else select tran_name into ls_name from transporter where tran_code = lsundry_code; end if; elsif lsundry_type = 'B' then select bank_name into ls_name from bank where bank_code = lsundry_code; elsif lsundry_type = 'X' then select tauth_name into ls_name from tax_authority where tauth_code = lsundry_code; elsif lsundry_type = 'E' then select nvl(trim(rtrim(emp_fname)),' ')||' '||nvl(trim(rtrim(emp_mname)),' ')||' '||nvl(trim(rtrim(emp_lname)),' ') into ls_name from employee where emp_code = lsundry_code; elsif lsundry_type = 'P' then if lname = 'C' then select chq_name into ls_name from sales_pers where sales_pers = lsundry_code; else select sp_name into ls_name from sales_pers where sales_pers = lsundry_code; end if; elsif lsundry_type ='S' then if lname = 'C' then select chq_name into ls_name from supplier where supp_code = lsundry_code; else select supp_name into ls_name from supplier where supp_code = lsundry_code; end if; elsif lsundry_type ='C' then if lname = 'C' then select chq_name into ls_name from customer where cust_code = lsundry_code; else select cust_name into ls_name from customer where cust_code = lsundry_code; end if; elsif lsundry_type = 'L' then if lname = 'C' then select chq_name into ls_name from loanparty where party_code = lsundry_code; else select party_name into ls_name from loanparty where party_code = lsundry_code; end if; /* Added by Sejal on 02-feb-10 to add site for getting the descr */ elsif lsundry_type ='Z' then select descr into ls_name from site where site_code = lsundry_code; elsif lsundry_type = 'R' then select nvl(trim(rtrim(first_name)),' ')||' '||nvl(trim(rtrim(middle_name)),' ') ||' '||nvl(trim(rtrim(last_name)),' ') into ls_name from STRG_CUSTOMER where SC_CODE = lsundry_code; end if; return trim(ls_name); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_CT3FORM_DET ON CT3FORM_DET (TRAN_ID, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_NO_SSD (as_item_ser char,as_cust_code__bil char) return number is ls_return number(1); as_cust_category char(3); as_tran_date date ; as_day_tran_date char (2); as_prd_code char(6); as_prd_code_prv char(6); as_cust_stock_count number (1); begin ls_return:=0; select trunc(sysdate) into as_tran_date from dual; select to_char (as_tran_date,'DD') into as_day_tran_date from dual; if to_number (as_day_tran_date) >= 11 then SELECT NVL(cust_category,'ZZZ') INTO as_cust_category FROM CUSTOMER WHERE CUST_CODE = AS_CUST_CODE__BIL; if as_cust_category in ('T','I') then select code into as_prd_code from period where fr_date <= as_tran_date and to_date >= as_tran_date; select code into as_prd_code_prv from period where fr_date <= (select (fr_date)-1 from period where code=as_prd_code) and to_date >= (select (fr_date)-1 from period where code=as_prd_code) ; SELECT COUNT(1) INTO as_cust_stock_count FROM CUST_STOCK WHERE CUST_CODE =as_cust_code__bil AND from_date >= ( SELECT FR_DATE FROM PERIOD WHERE CODE=as_prd_code_prv) AND to_date <= ( SELECT TO_DATE FROM PERIOD WHERE CODE=as_prd_code_prv) AND CONFIRMED ='Y'; if as_cust_stock_count > 0 then ls_return := 0; else ls_return := 1; end if; end if; end if; return ls_return ; exception when NO_DATA_FOUND then RETURN 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SRETURNDET_INV_LIN_TRAN ON SRETURNDET (INVOICE_ID, LINE_NO__INV, TRAN_ID, LINE_NO, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSDRDATE (as_lr_date in despatch.lr_Date%type,as_desp_date in despatch.desp_date%type) return number is FLAG NUMBER(1); ls_count number(10,0); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_DESP_LRDT'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then SELECT COUNT(1) into ls_count FROM DUAL WHERE to_date(as_lr_date) < to_date(as_desp_date); if ls_count = 0 then RETURN 0; Else RETURN 1; end if; else RETURN 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SLS_ITEMWISE (as_itemcode item.item_code%type, as_prdcode in char, ad_frdate in date, ad_todate in date, as_periodtype in char, as_valuetype in char) return number is ai_sales number(14); li_month number(2); ls_frprdcode char(6); ld_frdate date; begin if as_periodtype = 'M' then ------------ FOR MONTHLY---------------- if as_valuetype = 'Q' then select nvl(sum(cust_stock_det.sales),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ad_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; else select nvl(sum(cust_stock_det.sales_value),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ad_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; end if; ------------------------------ elsif as_periodtype = 'C' then ------------ FOR CUMMULATIVE---------------- if as_valuetype = 'Q' then select to_number(substr(as_prdcode, 5, 2) ) into li_month from dual; if li_month = 4 then select nvl(sum(cust_stock_det.sales),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ad_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; elsif li_month > 4 then select to_date('01/04/'||substr(as_prdcode,1,4),'dd/mm/yy') into ld_frdate from dual; select nvl(sum(cust_stock_det.sales),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ld_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; elsif li_month < 4 then select to_date('01/04/'||to_char(to_number(substr(as_prdcode,1,4)) - 1),'dd/mm/yy') into ld_frdate from dual; select nvl(sum(cust_stock_det.sales),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ld_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; end if; else select to_number(substr(as_prdcode, 5, 2) ) into li_month from dual; if li_month = 4 then select nvl(sum(cust_stock_det.sales_value),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ad_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; elsif li_month > 4 then select to_date('01/04/'||substr(as_prdcode,1,4),'dd/mm/yy') into ld_frdate from dual; select nvl(sum(cust_stock_det.sales_value),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ld_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; elsif li_month < 4 then select to_date('01/04/'||to_char(to_number(substr(as_prdcode,1,4)) - 1),'dd/mm/yy') into ld_frdate from dual; select nvl(sum(cust_stock_det.sales_value),0) into ai_sales from cust_stock, cust_stock_det where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock.tran_date between ld_frdate and ad_todate and cust_stock_det.item_code = as_itemcode; end if; end if; ------------------------------------------------------------------ elsif as_periodtype = 'U' then --------------- FOR CUMMULATIVE TARGET QUANTITY-------------- if as_valuetype = 'Q' then select to_number(substr(as_prdcode, 5, 2) ) into li_month from dual; if li_month = 4 then select sum(quantity__stduom) into ai_sales from sales_budget where item_code = as_itemcode and prd_code = as_prdcode; elsif li_month > 4 then select substr(as_prdcode, 1, 4)||'04' into ls_frprdcode from dual; select sum(quantity__stduom) into ai_sales from sales_budget where item_code = as_itemcode and prd_code between ls_frprdcode and prd_code; elsif li_month < 4 then select to_char(to_number(substr(as_prdcode, 1, 4)) - 1,'0000')||'04' into ls_frprdcode from dual; select sum(quantity__stduom) into ai_sales from sales_budget where item_code = as_itemcode and prd_code between ls_frprdcode and prd_code; end if; ----------------------------------------------------------------- else ---------FOR CUMMULATIVE TARGET VALUE-------------- select to_number(substr(as_prdcode, 5, 2) ) into li_month from dual; if li_month = 4 then select sum(amount) into ai_sales from sales_budget where item_code = as_itemcode and prd_code = as_prdcode; elsif li_month > 4 then select substr(as_prdcode, 1, 4)||'04' into ls_frprdcode from dual; select sum(amount) into ai_sales from sales_budget where item_code = as_itemcode and prd_code between ls_frprdcode and prd_code; elsif li_month < 4 then select to_char(to_number(substr(as_prdcode, 1, 4)) - 1,'0000')||'04' into ls_frprdcode from dual; select sum(amount) into ai_sales from sales_budget where item_code = as_itemcode and prd_code between ls_frprdcode and prd_code; end if; ----------------------------------------------------------------- end if; end if; return ai_sales; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EFFORT_LEV_CNT (AS_EMP_CODE IN EMPLOYEE.EMP_CODE%TYPE,TYPE IN VARCHAR, AS_PERIOD CHAR) RETURN NUMBER IS LEV_CNT NUMBER(10,1); AS_FR_DATE DATE; AS_TO_DATE DATE; STRG_MEET_CNT VARCHAR(8); AS_FLD_WRK_DY number(10,1); AS_NO_CALLS number(10,1); FULL_DAY_W number(10,1); HALF_DAY_W number(10,1); UN_CONFIRM_CNT NUMBER(3); AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE CODE = AS_PERIOD; SELECT COUNT(1) INTO UN_CONFIRM_CNT FROM SPRS_ACT_TRAN WHERE EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND CONFIRMED = 'Y' AND SALES_PERS = AS_EMP_CODE; if (UN_CONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; IF(TYPE = 'TOT_DR_NO') THEN SELECT COUNT(DISTINCT(SS.SC_CODE)) INTO LEV_CNT FROM STRG_SERIES SS, STRG_CUSTOMER SC WHERE SS.SALES_PERS = AS_EMP_CODE AND SS.SC_CODE = SC.SC_CODE AND SC.CUST_TYPE = 'D' AND 'Y' = (CASE WHEN SS.STATUS = 'Y' AND SS.EFF_DATE <= AS_TO_DATE THEN 'Y' WHEN SS.STATUS = 'N' AND SS.EFF_DATE <= AS_TO_DATE AND SS.CHG_DATE >= AS_TO_DATE THEN 'Y' ELSE 'N' END ) ORDER BY SS.SC_CODE; ELSE IF(TYPE = 'DR_MEET') THEN SELECT COUNT(DISTINCT SM.STRG_CODE) INTO LEV_CNT FROM FIELDACTIVITY F, STRG_MEET SM LEFT JOIN STRG_SERIES SER ON SER.SALES_PERS = SM.SALES_PERS AND SER.SC_CODE = SM.STRG_CODE WHERE SM.SALES_PERS = AS_EMP_CODE AND SM.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE AND SM.EVENT_TYPE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000'; ELSE IF(TYPE = 'DR_N_MEET') THEN SELECT COUNT(DISTINCT(SS.SC_CODE)) AS NOT_MEET INTO LEV_CNT FROM STRG_SERIES SS, STRG_CUSTOMER SC WHERE SS.SALES_PERS = AS_EMP_CODE AND SS.SC_CODE = SC.SC_CODE AND SC.CUST_TYPE = 'D' AND 'Y' = ( CASE WHEN SS.STATUS = 'Y' AND SS.EFF_DATE <= AS_TO_DATE THEN 'Y' WHEN SS.STATUS = 'N' AND SS.EFF_DATE <= AS_TO_DATE AND SS.CHG_DATE >= AS_TO_DATE THEN 'Y' ELSE 'N' END ) AND SS.SC_CODE NOT IN ( SELECT DISTINCT SM.STRG_CODE FROM STRG_MEET SM, FIELDACTIVITY F where SM.SALES_PERS = AS_EMP_CODE AND SM.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE AND SM.EVENT_TYPE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SM.STRG_TYPE = 'D' and SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' ); ELSE IF (TYPE = 'NO_CALLS') THEN SELECT NVL(SUM(VISIT_COUNT),0) INTO FULL_DAY_W FROM ( SELECT (CASE WHEN COUNT(1) <= SER.NO_VISIT THEN COUNT(1) ELSE (SER.NO_VISIT + 1) END) VISIT_COUNT, SM.STRG_CODE, SER.NO_VISIT FROM STRG_MEET SM, STRG_SERIES SER WHERE SM.EVENT_TYPE IN (SELECT ACTIVITY_CODE FROM FIELDACTIVITY WHERE ACTIVITY_TYPE ='FW' AND ACTIVITY_CODE NOT IN (SELECT COLUMN_VALUE FROM TABLE( CSV_TO_ROW( (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_HALF_DAYS'))))) AND SM.SALES_PERS = AS_EMP_CODE AND SER.SALES_PERS = SM.SALES_PERS AND SER.SC_CODE = SM.STRG_CODE AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= AS_TO_DATE THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= AS_TO_DATE AND SER.CHG_DATE >= AS_TO_DATE THEN 'Y' ELSE 'N' END ) AND SM.STRG_CODE != '0000000000' AND SM.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE GROUP BY SM.STRG_CODE, SER.NO_VISIT ); SELECT NVL(SUM(VISIT_COUNT),0) INTO HALF_DAY_W FROM ( SELECT (CASE WHEN (COUNT(1) / 2) <= SER.NO_VISIT THEN (COUNT(1) / 2) ELSE (SER.NO_VISIT + 1) END) VISIT_COUNT, SM.STRG_CODE, SER.NO_VISIT FROM STRG_MEET SM, STRG_SERIES SER WHERE SM.EVENT_TYPE IN (SELECT ACTIVITY_CODE FROM FIELDACTIVITY WHERE ACTIVITY_TYPE ='FW' AND ACTIVITY_CODE IN (SELECT COLUMN_VALUE FROM TABLE( CSV_TO_ROW( (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_HALF_DAYS'))))) AND SM.SALES_PERS = AS_EMP_CODE AND SER.SALES_PERS = SM.SALES_PERS AND SER.SC_CODE = SM.STRG_CODE AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' AND SM.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= AS_TO_DATE THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= AS_TO_DATE AND SER.CHG_DATE >= AS_TO_DATE THEN 'Y' ELSE 'N' END ) GROUP BY SM.STRG_CODE, SER.NO_VISIT ); LEV_CNT:= FULL_DAY_W + HALF_DAY_W; ELSE IF (TYPE = 'CALL_AVG') THEN SELECT NVL(SUM(VISIT_COUNT),0) INTO FULL_DAY_W FROM ( SELECT (CASE WHEN COUNT(1) <= SER.NO_VISIT THEN COUNT(1) ELSE (SER.NO_VISIT + 1) END) VISIT_COUNT, SM.STRG_CODE, SER.NO_VISIT FROM STRG_MEET SM, STRG_SERIES SER WHERE SM.EVENT_TYPE IN (SELECT ACTIVITY_CODE FROM FIELDACTIVITY WHERE ACTIVITY_TYPE ='FW' AND ACTIVITY_CODE NOT IN (SELECT COLUMN_VALUE FROM TABLE( CSV_TO_ROW( (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_HALF_DAYS'))))) AND SM.SALES_PERS = AS_EMP_CODE AND SER.SALES_PERS = SM.SALES_PERS AND SER.SC_CODE = SM.STRG_CODE AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= AS_TO_DATE THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= AS_TO_DATE AND SER.CHG_DATE >= AS_TO_DATE THEN 'Y' ELSE 'N' END ) AND SM.STRG_CODE != '0000000000' AND SM.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE GROUP BY SM.STRG_CODE, SER.NO_VISIT ); SELECT NVL(SUM(VISIT_COUNT),0) INTO HALF_DAY_W FROM ( SELECT (CASE WHEN (COUNT(1) / 2) <= SER.NO_VISIT THEN (COUNT(1) / 2) ELSE (SER.NO_VISIT + 1) END) VISIT_COUNT, SM.STRG_CODE, SER.NO_VISIT FROM STRG_MEET SM, STRG_SERIES SER WHERE SM.EVENT_TYPE IN (SELECT ACTIVITY_CODE FROM FIELDACTIVITY WHERE ACTIVITY_TYPE ='FW' AND ACTIVITY_CODE IN (SELECT COLUMN_VALUE FROM TABLE( CSV_TO_ROW( (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_HALF_DAYS'))))) AND SM.SALES_PERS = AS_EMP_CODE AND SER.SALES_PERS = SM.SALES_PERS AND SER.SC_CODE = SM.STRG_CODE AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' AND SM.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= AS_TO_DATE THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= AS_TO_DATE AND SER.CHG_DATE >= AS_TO_DATE THEN 'Y' ELSE 'N' END ) GROUP BY SM.STRG_CODE, SER.NO_VISIT ); AS_NO_CALLS:= FULL_DAY_W + HALF_DAY_W; select FN_GET_FLD_WRK_DY(AS_EMP_CODE, AS_PERIOD) INTO AS_FLD_WRK_DY from dual; IF(AS_FLD_WRK_DY <> 0) THEN LEV_CNT := AS_NO_CALLS / AS_FLD_WRK_DY ; ELSE LEV_CNT := 0; END IF; END IF; END IF; END IF; END IF; END IF; RETURN LEV_CNT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TDS_AMT (ls_tran_id TAXTRAN.TRAN_ID%TYPE, ls_tran_ser TAXTRAN.TRAN_CODE%TYPE) RETURN NUMBER AS ll_tds_amt TAXTRAN.TAX_AMT%TYPE; ll_vamt TAXTRAN.TAX_AMT%TYPE; ls_cur_taxamt TAXTRAN.TAX_AMT%TYPE; ls_cur_taxgrp TAX.TAX_GROUP%TYPE; CURSOR TDS_CURSOR IS SELECT TAXTRAN.TAX_AMT,TAX.TAX_GROUP FROM TAXTRAN, TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = ls_tran_ser AND TAXTRAN.TRAN_ID = ls_tran_id; BEGIN ll_vamt := 0; OPEN TDS_CURSOR; LOOP FETCH TDS_CURSOR INTO ls_cur_taxamt,ls_cur_taxgrp; EXIT WHEN TDS_CURSOR%NOTFOUND; IF ls_cur_taxgrp = 'ITDS' OR ls_cur_taxgrp = 'SRTDS' OR ls_cur_taxgrp = 'ECTDS' OR ls_cur_taxgrp = 'VWCT' OR ls_cur_taxgrp = 'SHTDS' THEN ll_vamt := ll_vamt + ls_cur_taxamt; END IF ; END LOOP; RETURN ll_vamt; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONSUME_ISS_DET_CON_ORDER ON CONSUME_ISS_DET (CONS_ORDER, LINE_NO__ORD, CONS_ISSUE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_PARTC_ROLE ( partc_role VARCHAR2 ) RETURN VARCHAR2 IS partcRole VARCHAR2(100); BEGIN CASE partc_role WHEN 'I' THEN partcRole := 'Invitee'; ELSE partcRole := 'Presenter'; END CASE; RETURN TRIM(partcRole); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_DORD_QTTY bEFORE insert or update ON distorder_det referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; iss_qty number(14,3) := 0; rcp_qty number(14,3) := 0; BEGIN if nvl(:new.qty_order,0) <> 0 and nvl(:new.qty_confirm,0) = 0 then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] qty_order [' || to_char(:new.qty_order) || '] qty_confirm [' || to_char(:new.qty_confirm) || ']' ); end if; begin select sum(i.quantity) into iss_qty from distord_issdet i, distord_iss h where h.tran_id = i.tran_id and i.dist_order = :new.dist_order and i.LINE_NO_DIST_ORDER = :new.line_no and h.confirmed <> 'X' ; exception when others then iss_qty := 0; end; if nvl(:new.qty_confirm,0) < nvl(iss_qty,0) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity shipped exceeds qty_confirm [' || to_char(:new.qty_confirm) || '] qty_shipped [' || to_char(iss_qty) || ']' ); end if; begin select sum(i.quantity) into rcp_qty from distord_rcpdet i, distord_rcp h where h.tran_id = i.tran_id and i.dist_order = :new.dist_order and i.LINE_NO_DIST_ORDER = :new.line_no; exception when others then iss_qty := 0; end; if nvl(:new.qty_confirm,0) < nvl(rcp_qty,0) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity received exceeds qty_confirm [' || to_char(:new.qty_confirm) || '] qty_shipped [' || to_char(rcp_qty) || ']' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AVG_SALE (AS_SITE_CODE INVOICE.SITE_CODE%TYPE, AS_ITEM_CODE INVOICE_TRACE.ITEM_CODE%TYPE, AS_FROM_DATE INVOICE.TRAN_DATE%TYPE, AS_TO_DATE INVOICE.TRAN_DATE%TYPE) RETURN NUMBER IS AVG_SALE NUMBER(14,3); BEGIN SELECT CASE WHEN COUNT(DISTINCT INVOICE.TRAN_DATE) > 0 THEN FLOOR(SUM(INVOICE_TRACE.QUANTITY__STDUOM) / COUNT(DISTINCT INVOICE.TRAN_DATE) ) ELSE 0 END INTO AVG_SALE FROM INVOICE, INVOICE_TRACE WHERE INVOICE.SITE_CODE >= AS_SITE_CODE AND INVOICE.SITE_CODE <= AS_SITE_CODE AND INVOICE.TRAN_DATE >= AS_FROM_DATE AND INVOICE.TRAN_DATE <= AS_TO_DATE AND INVOICE_TRACE.ITEM_CODE = AS_ITEM_CODE AND INVOICE.INVOICE_ID = INVOICE_TRACE.INVOICE_ID AND CASE WHEN INVOICE_TRACE.LINE_TYPE IS NULL THEN 'C' ELSE INVOICE_TRACE.LINE_TYPE END = 'C' AND INVOICE.CONFIRMED = 'Y'; IF AVG_SALE IS NULL THEN AVG_SALE := 0 ; END IF; RETURN AVG_SALE; EXCEPTION WHEN OTHERS THEN RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SALESPERS (as_cust_code char,as_itemser char) return char is ls_sales_pers char(40); begin ls_sales_pers := null; select sales_pers into ls_sales_pers from customer_series where cust_code = as_cust_code and item_ser = as_itemser; return (nvl(ls_sales_pers,'')); exception when no_data_found then select sales_pers into ls_sales_pers from customer where cust_code = as_cust_code; return (nvl(ls_sales_pers,'')); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RCPDISHNR_CUSTNAME ( AS_CUST_CODE IN CHAR , AS_RECEIPT_NO IN CHAR , AS_TRAN_SER IN CHAR , AS_SITE_CODE IN CHAR , AS_SITE_CODE__FOR IN CHAR) RETURN VARCHAR2 IS CUST_NAME varchar2(120); ls_sundry_type CHAR(1); BEGIN IF AS_TRAN_SER = 'R' then SELECT CUST_NAME INTO CUST_NAME FROM CUSTOMER WHERE CUST_CODE = AS_CUST_CODE ; --CHEMIST2-LLOYD return CUST_NAME; ELSE SELECT fn_sundry_name(misc_rcpdet.sundry_type,misc_rcpdet.sundry_code,'N') as CUST_NAME INTO CUST_NAME FROM misc_rcpdet WHERE TRAN_ID = AS_RECEIPT_NO AND ROWNUM = 1 ORDER BY LINE_NO DESC; END IF; return CUST_NAME; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BANKTRAN_LOG_BANK_DATE_SITE ON BANKTRAN_LOG (BANK_CODE, TRAN_DATE, TRAN_SER, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX NCL_DOCTOR_MAIN_X ON NCL_DOCTOR_MAIN (SALES_PERS, WORK_DATE, SC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SITE_CUSTOMER_CUST ON SITE_CUSTOMER (CUST_CODE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_DR BEFORE UPDATE of confirmed ON distord_rcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from porcpdet where tran_id = :tran_id'; OPEN cur_out FOR ls_sql USING :new.tran_id ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'D-RCP' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'D-RCP' and tran_id = :new.tran_id and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_DO BEFORE UPDATE of confirmed ON distorder referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from distorder_det where dist_order = :tran_id'; OPEN cur_out FOR ls_sql USING :new.sale_order ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'D-ORD' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'D-ORD' and tran_id = :new.dist_order and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FINVAL (ac_amount in number,al_no_days in number,as_crterm in char,ad_tran in date) return number is lc_intamt number(20,2); lc_finchg number(20,2); ls_type char; begin select fin_chg, fchg_type into lc_finchg, ls_type from crtermfc where cr_term = as_crterm and al_no_days >= min_day and al_no_days <= max_day and ac_amount >= min_cramt and ac_amount <= max_cramt and ad_tran >= eff_date and ad_tran <= valid_upto ; if SQLCODE <> 0 then lc_intamt := 0; else if ls_type = 'F' then lc_intamt := lc_finchg; else return -1; end if; end if; Return lc_intamt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_SOTAXENV1 (Ls_Cust_Code In Char, Ls_Site_Code In Char, ls_tax_class in char, ls_tax_env in char) return number Is Ln_Cust_State CHAR(5); ln_site_state CHAR(5); Begin Select Trim(State_Code) Into Ln_Cust_State From Customer Where Cust_Code=Ls_Cust_Code; Select Trim(State_Code) Into Ln_Site_State From Site Where Site_Code=Ls_Site_Code; If Ln_Cust_State <> ln_site_state And ls_tax_class not in ('REB','LUT','BOND','DEEM','SEWP','SEWOP','NOGST1') And ls_tax_env in ('SIGST01','NOGST1','SIGST02','SPRI01','SPRI02') then Return 0; Elsif Ln_Cust_State <> Ln_Site_State And ls_tax_class in ('REB','LUT','BOND','DEEM','SEWP','SEWOP','NOGST1') And Ls_Tax_Env In ('SEP01','SEPDEEM','NOGST1','SIGST02','SPRI01','SPRI02') Then Return 0; ElsIf Ln_Cust_State = ln_site_state and Ls_Tax_Env In ('SDN ','SLD ','SAN ','SAS ','SAR ','SCG ','SJH ','SML ','SMN ','SMZ ','SNL ','SOR ','SSK ','STR ','SWB ','SBR ','SCH ','SDL ','SHP ','SHR ','SJK ','SMP ','SPB ','SUP ','SUA ','SAP ','SKL ','SKA ','SPY ','STN ','STS ','SDD ','SGJ ','SGA ','SMH ','SRJ ','SRCMI01 ','SRCML01 ','NOGST1','SPRL01') Then Return 0; else Return 1; End If; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WEIGH_RETEST_EXP (as_sitecode in char ,as_tranid in char) return varchar2 is ls_retval number := 0; mcount number ; begin select count(*) into mcount from workorder_issdet a,stock b where b.site_code=as_sitecode and a.item_code=b.item_code and a.lot_no=b.lot_no and a.loc_code=b.loc_code and a.lot_sl=B.lot_sl and a.tran_id=as_tranid and ( b.retest_date is not null OR b.exp_date is not null) and ( TRUNC(b.exp_date)<= trunc(sysdate) OR TRUNC(b.retest_date)<=trunc(sysdate)); if (mcount>0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CUSTOMERITEM_XREF_X ON CUSTOMERITEM_XREF (CUST_CODE, ITEM_CODE, XREF_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_D1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX OBJECT_ATTRIBMST_OBJ_ATRIB_KEY ON OBJECT_ATTRIB__MST (OBJ_CODE, ATTRIB_CODE, KEY_VALUE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_MPAY_TRACE_REFNO (as_transer misc_payables.tran_ser%type, as_refno misc_payables.ref_no%type) is ll_count number(10) := 0; ll_updatecount number := 0; lc_adjamt number := 0; lc_totamt number := 0; ldt_statdate date; ls_amtafter number := 0; begin begin select count(1) into ll_count from payables_trace where ref_ser = as_transer and ref_no = as_refno; if ll_count = 0 then for cur_mpay in ( select tran_ser,ref_no ref_no,tran_id,tot_amt, adj_amt, ref_date,due_date,' ' Cr_term,sundry_type,sundry_code, site_code,exch_rate,bank_code,curr_code from misc_payables where tran_ser = as_transer and ref_no = as_refno ) loop lc_totamt := cur_mpay.tot_amt; insert into payables_trace ( TRAN_ID, TRAN_ID__PAY, REF_SER, REF_NO, REF_SER__ADJ, REF_NO__ADJ, ADJ_AMT, AMT_BEFORE, AMT_AFTER, REF_DATE, DUE_DATE, CR_TERM, SYNDRY_TYPE, SUNDRY_CODE, SITE_CODE, CURR_CODE, EXCH_RATE, TRAN_TYPE, REMARKS, DOC_REF, DOC_REF_TYPE, DOC_REF_DATE, BANK_CODE, CHANGE_TYPE, os_stat, STATUS_DATE, CHG_USER, CHG_DATE, eff_date ) select lpad(MPAYTC_SEQ.nextval,12,'0') tran_id, cur_mpay.tran_id tran_id__pay, cur_mpay.tran_ser ref_ser, cur_mpay.ref_no ref_no, null ref_ser__adj, null ref_no__adj, 0 adj_amt, 0 amt_before, cur_mpay.tot_amt amt_after, cur_mpay.ref_date ref_date, cur_mpay.due_date Due_date, cur_mpay.cr_term Cr_term, cur_mpay.sundry_type sundry_type, cur_mpay.sundry_code sundry_code, cur_mpay.site_code Site_code, cur_mpay.curr_code Curr_code, cur_mpay.exch_rate Exch_rate, 'I' tran_type, 'Insert by Proteus' Remarks, to_char(cur_mpay.adj_amt) Doc_ref, 'O' Doc_ref_type, sysdate Doc_ref_date, cur_mpay.bank_code Bank_code, 'I' change_type, 'U' status, cur_mpay.ref_date status_date, 'Proteus' chg_user, sysdate chg_date, ref_date eff_date from misc_payables where tran_ser = cur_mpay.tran_ser and ref_no = cur_mpay.ref_no; for cur_tran in ( select ref_ser_adj,tran_id, conf_date, eff_date,adj_amt from ( select 'M-PAY' ref_ser_adj,h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'M-PAY' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'M-PAY' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.pay_amt adj_amt from misc_payment h, misc_paydet d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.tran_ser = cur_mpay.tran_ser and d.vouch_no = cur_mpay.ref_no union all select 'MPCANC' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'MPCANC' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'MPCANC' and i.ref_id = h.tran_id and rownum = 1) eff_date,-1 * d.pay_amt adj_amt from misc_payment_canc h, misc_payment_cancdet d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.tran_ser = cur_mpay.tran_ser and d.vouch_no = cur_mpay.ref_no union all select 'P-IBCA' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-IBCA' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'P-IBCA' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.TOT_AMT adj_amt from pay_ibca h, pay_ibca_det d where d.tran_id = h.tran_id and h.confirmed = 'Y' and trim(h.tran_ser) = 'I' and d.ref_ser = cur_mpay.tran_ser and d.ref_no = cur_mpay.ref_no union all select 'P-ADJ' ref_ser_adj, decode(d.ref_ser_adj,' ',h.tran_ser,d.ref_ser_adj) tran_id,h.ref_date conf_date,h.ref_date eff_date, d.adj_amt from misc_payables h, misc_payables_adj d where decode(d.ref_ser_adj,' ',h.tran_ser,d.ref_ser_adj) = h.tran_ser and decode(d.ref_no_adj,' ',h.ref_no,d.ref_no_adj) = h.ref_no and ((d.ref_ser = cur_mpay.tran_ser and d.ref_no = cur_mpay.ref_no) or (d.ref_ser_adj = cur_mpay.tran_ser and d.ref_no_adj = cur_mpay.ref_no)) union all select 'VOUCH' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'VOUCH' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'VOUCH' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.adj_amt from voucher h, vouchadv d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_mpay.tran_ser and d.ref_no = cur_mpay.ref_no union all select 'M-VOUC' ref_ser_adj, h.tran_id,(select i.post_date from gltrace i where i.ref_ser ='M-VOUC' and i.ref_id = h.tran_id and rownum = 1) conf_date,(select i.eff_date from gltrace i where i.ref_ser = 'M-VOUC' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.adj_amt from misc_voucher h, misc_vouchadv d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_mpay.tran_ser and d.ref_no = cur_mpay.ref_no union all select 'PAYRCP' ref_ser_adj,h.tran_id,h.conf_date,h.conf_date eff_date,d.trf_amt adj_amt from rec_pay_trf_det d ,rec_pay_trf h where h.tran_id = d.tran_id and h.trf_type = '0' and h.confirmed = 'Y' and d.tran_ser = cur_mpay.tran_ser and d.ref_no = cur_mpay.ref_no union all select 'M-RCP' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'M-RCP' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'M-RCP' and i.ref_id = h.tran_id and rownum = 1) eff_date, -1 * d.adj_amt from misc_receipt h, MISC_PAY_RCP_TRACE d where d.tran_id__rcp = h.tran_id and h.confirmed = 'Y' and d.TRAN_SER__PAY = cur_mpay.tran_ser and d.REF_NO__PAY = cur_mpay.ref_no ) order by conf_date ) loop begin ldt_statdate := cur_tran.conf_date; lc_adjamt := cur_tran.adj_amt; insert into payables_trace ( TRAN_ID, TRAN_ID__PAY, REF_SER, REF_NO, REF_SER__ADJ, REF_NO__ADJ, ADJ_AMT, AMT_BEFORE, AMT_AFTER, REF_DATE, DUE_DATE, CR_TERM, SYNDRY_TYPE, SUNDRY_CODE, SITE_CODE, CURR_CODE, EXCH_RATE, TRAN_TYPE, REMARKS, DOC_REF, DOC_REF_TYPE, DOC_REF_DATE, BANK_CODE, CHANGE_TYPE, os_stat, STATUS_DATE, CHG_USER, CHG_DATE, eff_date ) select lpad(MPAYTC_SEQ.nextval,12,'0') tran_id, cur_tran.tran_id tran_id__rcv, cur_mpay.tran_ser ref_ser, cur_mpay.ref_no ref_no, cur_tran.ref_ser_adj ref_ser__adj, cur_tran.tran_id ref_no__adj, lc_adjamt adj_amt, lc_totamt amt_before, lc_totamt - lc_adjamt amt_after, cur_mpay.ref_date ref_date, cur_mpay.due_date Due_date, cur_mpay.cr_term Cr_term, cur_mpay.sundry_type sundry_type, cur_mpay.sundry_code sundry_code, cur_mpay.site_code Site_code, cur_mpay.curr_code Curr_code, cur_mpay.exch_rate Exch_rate, 'U' tran_type, 'Update by Proteus' Remarks, 'UPD' Doc_ref, 'O' Doc_ref_type, sysdate Doc_ref_date, cur_mpay.bank_code Bank_code, 'U' change_type, case when lc_totamt - lc_adjamt = 0 then 'A' else 'P' end status, ldt_statdate status_date, 'Proteus' chg_user, sysdate chg_date, cur_tran.eff_date from misc_payables where tran_ser = cur_mpay.tran_ser and ref_no = cur_mpay.ref_no; lc_totamt := lc_totamt - lc_adjamt; exception when others then dbms_output.put_line('Exception updating '); end; end loop; end loop; end if; exception when others then dbms_output.put_line('Exception outer sqlcode [' || to_char(SQLCODE) ||'[ message [' || SQLERRM ||']'); rollback; end; commit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DATE_INFO ( as_infotype in char, as_versionId in char, as_tableNo in char, as_posCode in char ) return date is info date; begin if trim(as_infotype) = 'E' then begin select eff_date into info from org_structure where version_id = as_versionId and table_no = as_tableNo and pos_code = as_posCode; end; end if; if trim( as_infotype) = 'V' then begin select valid_upto into info from org_structure where version_id = as_versionId and table_no = as_tableNo and pos_code = as_posCode; end; end if; if info is null then info := ''; end if; return info; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GROSSAMT (as_tran_id in char, as_type in char) return number as lc_gross_amt number (15,2); ld_tax_total number (15,2); ld_cost_total number (15,2); begin if as_type = 'D' then select sum(quantity__stduom * rate__clg) into lc_gross_amt from despatchdet where desp_id = as_tran_id; elsif as_type = 'I' then select sum(quantity * rate) into lc_gross_amt from distord_issdet where tran_id = as_tran_id; elsif as_type = 'P-RET' then ld_cost_total := 0; select sum(rate * quantity) into ld_cost_total from porcpdet where tran_id = as_tran_id; if ld_cost_total is null then ld_cost_total := 0; end if; --Get Total Tax -- select sum(tax_amt) into ld_tax_total -- from taxtran -- where tran_id = as_tran_id -- and tran_code= as_type; -- if ld_tax_total is null then -- ld_tax_total := 0; -- end if; -- lc_gross_amt := ld_cost_total + ld_tax_total; lc_gross_amt := ld_cost_total; elsif as_type = 'DRNRCP' then lc_gross_amt := 0; select sum(drcr_amt) into lc_gross_amt from drcr_rdet where tran_id = as_tran_id; end if; if lc_gross_amt is null then lc_gross_amt := 0; end if; return lc_gross_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ROPBAL_BANK_TRS_MSITE ( as_sitecode in site.ITEM_SER__APPL%type, as_sundrytype in sundrybal.sundry_type%type, as_sundrycode in sundrybal.sundry_code%type, ad_bal_upto_date in date ) return number as ls_yr period.acct_prd%type; ls_prdcode period.code%type; ld_frst_date period.fr_date%type; ld_dramt sundrybal.dr_amt__base%type; ld_cramt sundrybal.cr_amt__base%type; ld_opbal sundrybal.dr_amt__base%type; ls_site_code site.site_code%type; ld_opbal_amt sundrybal.dr_amt__base%type; CURSOR c_site is select column_value FROM TABLE(csv_to_row(as_sitecode)); begin ls_site_code := ''; ld_opbal_amt := 0.0; OPEN c_site; LOOP FETCH c_site into ls_site_code; EXIT WHEN c_site%notfound; ld_opbal_amt := ld_opbal_amt + FN_ROPBAL_BANK_TRS(ls_site_code,as_sundrytype,as_sundrycode,ad_bal_upto_date); END LOOP; CLOSE c_site; return ld_opbal_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STATION_DESCR (as_emp_code CHAR) return varchar2 IS ls_stat_descr VARCHAR2(40); ls_stat varchar2(10); BEGIN select STAN_CODE__HQ into ls_stat from employee where emp_code = as_emp_code; if ls_stat is not null then select DESCR into ls_stat_descr from station where STAN_CODE = ls_stat; end if; return ls_stat_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RECEIPT_NO (as_tran_id in char, as_net_amt in number ,as_sundry_type in char) return char is lc_vouch_no varchar2(10); begin if (as_sundry_type = 'C') then select rcpdet.ref_no into lc_vouch_no from rcpdet where rcpdet.tran_id = as_tran_id; else select receipt.ref_no into lc_vouch_no from receipt where receipt.tran_id = as_tran_id ; end if; return lc_vouch_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MULTI_VEND_STATUS_ALL ( as_supp_code__mnfr VARCHAR2, as_site_code CHAR, AS_item_code CHAR, as_ref_ser CHAR, as_tran_tmp DATE, val_type VARCHAR2) RETURN NUMBER IS FLAG NUMBER(1); supp_chk_cnt NUMBER; BEGIN supp_chk_cnt :=0; select LENGTH(TRIM(as_supp_code__mnfr)) INTO supp_chk_cnt from DUAL; IF supp_chk_cnt > 0 THEN IF val_type='STK-AMD' THEN --CALL THE FUNCTION FUNCTION SELECT FN_CHK_MULTI_VENDOR_STATUS(as_supp_code__mnfr,as_site_code,AS_item_code,as_ref_ser,as_tran_tmp ) INTO FLAG FROM dual; RETURN FLAG; END IF; IF val_type='ADJ-REC' THEN --CALL THE FUNCTION FUNCTION SELECT FN_CHK_MULTI_VENDOR_STATUS(as_supp_code__mnfr,as_site_code,AS_item_code,as_ref_ser,as_tran_tmp ) INTO FLAG FROM dual; RETURN FLAG; END IF; else Flag := 1; RETURN flag; END IF; RETURN flag; -------- CHECK WHETHER THE ENTRY EXISTS IN ITEM MASTER OR NOT ------------ EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; RETURN flag; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGETENV_PREFIX (as_prdcode in varchar, as_varname in varchar,as_prefix in varchar) return number is VAR_VALUE number(14,7); varvalue varchar(20); begin select var_value into varvalue from payrparm where rtrim(prd_code) = rtrim(as_prdcode) and rtrim(var_name) = rtrim(as_varname); varvalue := as_prefix || varvalue ; SELECT TO_NUMBER(fn_rgetenv('999999',VARVALUE)) INTO VAR_VALUE FROM DUAL; return var_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LAB_BOOKING_DAYS (as_site char, as_mcCode char,as_frdate date) return varchar2 is ls_day varchar2(50); ls_dates varchar2(2000); ls_day_name varchar2(50); ls_week varchar2(50); cursor c1 is select distinct start_time from lab_booking where mc_code=as_mcCode AND site_code=as_site and trunc(start_time) =as_frdate ; i c1%rowtype; begin open c1; fetch c1 into i; if(c1% notfound) then ls_day := ' '; else while(c1%found) loop ls_day := ls_day||','||i.start_time; ls_dates :=substr(ls_day,2,length(trim(ls_day))); fetch c1 into i; end loop; end if; close c1; SELECT to_char((TO_DATE(ls_dates,'DD/MM/YY')),'DAY') into ls_day_name FROM DUAL; if trim(ls_day_name) ='SUNDAY' then ls_week:= ls_day_name; elsif trim(ls_day_name) = 'MONDAY' then ls_week:= ls_day_name; elsif trim(ls_day_name) = 'TUESDAY' then ls_week:= ls_day_name; elsif trim(ls_day_name) = 'WEDNESDAY' then ls_week:= ls_day_name; elsif trim(ls_day_name) = 'THURSDAY' then ls_week:= ls_day_name; elsif trim(ls_day_name) = 'FRIDAY' then ls_week:= ls_day_name; elsif trim(ls_day_name) = 'SATURDAY' then ls_week:= ls_day_name; end if; RETURN ls_week ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DDF_HR_TRF_PERKBAL ( AS_TRAN_ID IN VARCHAR, AS_CHG_USER IN CHAR, AS_EMP_CODE_TO IN CHAR, AS_CHG_TERM IN CHAR, as_out_param out VARCHAR) IS BEGIN DECLARE ls_cnt NUMBER; ls_acct_prd emp_lveprkbal_trfdet.acct_prd%type; ls_balance_code emp_lveprkbal_trfdet.balance_code%type; ls_encashable emp_lveprkbal_trfdet.encashable%type; ls_lve_unit emp_lveprkbal_trfdet.lve_unit%type; ld_from_date emp_lveprkbal_trfdet.from_date%type; ld_to_date emp_lveprkbal_trfdet.to_date%type; ld_exp_date emp_lveprkbal_trfdet.exp_date%type; ls_balance emp_lveprkbal_trfdet.balance%type; CURSOR cur_perktrf IS SELECT acct_prd, balance_code , encashable, lve_unit, from_date, to_date, exp_date, balance FROM emp_lveprkbal_trfdet WHERE TRAN_ID = as_tran_id GROUP BY ACCT_PRD, BALANCE_CODE, ENCASHABLE, LVE_UNIT, FROM_DATE, to_date, exp_date, BALANCE; BEGIN OPEN cur_perktrf; LOOP FETCH cur_perktrf INTO ls_acct_prd, ls_balance_code, ls_encashable, ls_lve_unit, ld_from_date, ld_to_date, ld_exp_date, LS_BALANCE; SELECT COUNT(*) INTO ls_cnt FROM ALLOWDEDN_BAL WHERE EMP_CODE = as_emp_code_to AND AD_CODE = ls_balance_code AND START_DATE = ld_from_date AND END_DATE = ld_to_date; IF ls_cnt > 0 THEN UPDATE ALLOWDEDN_BAL SET AMOUNT = AMOUNT + ls_balance, AMT_BAL = AMT_BAL + ls_balance WHERE EMP_CODE = as_emp_code_to AND AD_CODE = ls_balance_code AND START_DATE = ld_from_date AND END_DATE = ld_to_date; ELSE INSERT INTO ALLOWDEDN_BAL ( EMP_CODE, AD_CODE, START_DATE, END_DATE, AMOUNT, AMT_ADJ, AMT_BAL, EXP_DATE, REF_TYPE, REF_NO, CHG_DATE, CHG_USER, CHG_TERM ) VALUES ( as_emp_code_to, ls_balance_code, ld_from_date, ld_to_date, ls_balance, 0, ls_balance, sysdate, 'K', NULL, sysdate, as_chg_user, AS_CHG_TERM ); END IF; EXIT WHEN cur_perktrf%notfound; END LOOP; CLOSE cur_perktrf; END; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_WORKINGDAY (as_emp_code in char,ad_date in date, ad_tdate in date,no_days in number) --function to get no of days based on max allowed day within which employee has to apply leave after resuming --it scans holiday ,change_holiday to get the working days and finally subtracts the total days- working days return number is ls_holtblno char(5); ln_holcnt number ; ln_chgcnt number ; ln_count_days number; ln_totdays number; ln_tour_days number; ls_holyn char(1); ad_fdate date; begin ln_count_days:=0; ln_tour_days:=0; ad_fdate :=ad_date; ln_totdays := ad_tdate - ad_fdate ; if ad_tdate - ad_fdate > no_days then while ad_fdate <= ad_tdate loop select ddf_get_holtblno(as_emp_code ,ad_fdate) into ls_holtblno from dual; select count(*) into ln_holcnt from holiday where hol_tblno=ls_holtblno and hol_date=ad_fdate ; if ln_holcnt = 1 then select count(*) into ln_chgcnt from change_holiday where emp_code=as_emp_code and hol_date_for=ad_date; if ln_chgcnt = 1 then ls_holyn:='N'; else ls_holyn:='Y'; ln_count_days :=ln_count_days +1 ; end if; -- elsif ln_chgcnt = 0 then -- ls_holyn:='Y'; -- ln_count_days :=ln_count_days +1 ; end if; ad_fdate := ad_fdate + 1; end loop; end if ; select NVL(sum(no_days),0) into ln_tour_days from tour where emp_code=as_emp_code and date_from >=ad_date and date_to <=ad_tdate and status='A'; ln_count_days := ln_totdays - ln_count_days - ln_tour_days ; return ROUND(ln_count_days,0); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX APPRAISAL_EMP_PRD_FR_TO ON APPRAISAL (EMP_CODE, PRD_CODE__FR, PRD_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_MEMCODE (Ln_Itemser In Char,Ls_Cust_Code In Char) Return Number Is LS_MEMBER_CODE VARCHAR2(1200 BYTE); LS_TYPE NUMBER; Begin SELECT VAR_VALUE INTO LS_MEMBER_CODE FROM DISPARM WHERE PRD_CODE='999999' AND VAR_NAME='MEMBER_CODE'; IF LS_MEMBER_CODE='Y' THEN Select (case when NVL(trim(Member_Code),'0') <> trim(Ln_Itemser) then 1 else 0 end) INTO LS_TYPE From Customer Where Cust_Code=Ls_Cust_Code; IF LS_TYPE=1 THEN RETURN 1 ; ELSE RETURN 0; END IF; ELSE RETURN 0; END IF; RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAXAMT_PUR (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_tax_code in char) return number is lc_tax_amt number(14,3); begin select sum(nvl(taxtran.tax_amt,0) * (taxtran.exch_rate)) into lc_tax_amt from tax,taxtran where tax.tax_code = taxtran.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_line_no and taxtran.tax_code = ls_tax_code and tax.print_tax ='Y' and taxtran.tax_amt <> 0; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXPER_PLIST (mitm in char, mtype in char) return number is mrate number; begin declare mreg char(3); begin --- Picking up PTS % as when MTYPE = 'S', will search in DISPARM if mtype = 'R' then select REG_SCH into mreg from item where item_code = mitm; if mreg = 'C' then select to_number(var_value) into mrate from disparm where var_name = 'PTR_C'; elsif mreg = 'DC' then select to_number(var_value) into mrate from disparm where var_name = 'PTR_DC'; elsif mreg = 'DC*' then select to_number(var_value) into mrate from disparm where var_name = 'PTR_DC*'; elsif mreg = 'DCV' then select to_number(var_value) into mrate from disparm where var_name = 'PTR_DCV'; elsif mreg = 'FM' then select to_number(var_value) into mrate from disparm where var_name = 'PTR_FM'; end if; end if; return mrate; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INCIDENT_DET_X ON INCIDENT_DET (INCIDENT_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_DAYS_SINCE_NOT_MET (AS_SALES_PERS IN VARCHAR2, AS_SYS_DATE IN DATE, AS_SC_CODE IN VARCHAR2 ) RETURN VARCHAR2 IS AS_OUTPUT DATE; AS_RESULT NUMBER(38); AS_RETURN VARCHAR2(50); begin SELECT MAX(EVENT_DATE) INTO AS_OUTPUT FROM strg_meet where sales_pers = AS_SALES_PERS and event_date<=AS_SYS_DATE and strg_code = AS_SC_CODE order by strg_code,event_date ; IF AS_OUTPUT IS NOT NULL THEN AS_RESULT :=(TO_DATE(AS_SYS_DATE) - TO_DATE(AS_OUTPUT)) ; ELSE AS_RESULT :=to_number(AS_SYS_DATE - (LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1)) ; END IF; if AS_RESULT =1 then AS_RETURN := to_char(AS_RESULT)||' '||'day'; else AS_RETURN :=to_char(AS_RESULT)||' '||'days'; end if; RETURN AS_RETURN ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SITE_DIM_X ON SITE_DIM (SITE_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LOAN_BALANCE_AMOUNT (AS_OP_BAL number,AS_LOAN_NO char,AS_CURR_PRD char,AS_ACCT_PRD char,AS_LAST_PRD char) return number is a_return number(14,3); a_amount number(14,3); begin select sum(princ_dedn) into a_amount from ( select sum(a.amount) princ_dedn from loan_reg a,period b,acctprd c where a.loan_no = AS_LOAN_NO and b.code = AS_CURR_PRD and c.code = AS_ACCT_PRD and a.tran_date >= c.fr_Date and a.tran_date < b.fr_date and nvl(a.amount,0) <> 0 union all select sum(ddf_hr_loan_instal(AS_LOAN_NO,AS_CURR_PRD,AS_LAST_PRD)) princ_dedn from period a Where a.acct_prd = AS_ACCT_PRD and a.code > AS_LAST_PRD and a.code < AS_CURR_PRD); a_return := AS_OP_BAL - a_amount; return a_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RATE_REJECTED (as_lot_no varchar2, as_item_code varchar2, as_site_code varchar2, as_loc_code varchar2) return number is ldec_rate number; CURSOR C1 is SELECT DISTINCT stock.rate FROM stock where ( stock.site_code =as_site_code ) and ( stock.item_code = as_item_code ) and ( stock.loc_code = as_loc_code ) and ( stock.lot_no = as_lot_no ); begin open C1 ; fetch C1 into ldec_rate; if c1%notfound then ldec_rate:=0; end if; close c1; RETURN ldec_rate ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ADVANCE_VOUCH (as_sundry_type char,as_sundry_code char) return char is ls_advance char(50); ldt_advamt misc_payables.tot_amt%type; begin select sum(tot_amt - adj_amt) into ldt_advamt from misc_payables where sundry_type = 'S' and sundry_code = as_sundry_code and tran_ser = 'P-ADV' and tot_amt - adj_amt < 0; if ldt_advamt < 0 then ldt_advamt := abs(ldt_advamt); ls_advance := 'Advance unadjusted >> ' || ldt_advamt; else ls_advance := ''; end if; return ls_advance; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_FLAT (litemser in char, litemtype in char ,lsitecode in char,lwing in char, lfloor in char, lflat in char) return char is litemcode varchar(10); ls_itemcode char(10); ls_sitecode char(5); ls_building char(3); ls_flattype varchar(2); ls_wing char(1); ls_floor char(2); ls_flat char(2); BEGIN if(substr(litemser,1,4)<>'FLAT') then select lpad(max(substr(item_code,6,5))+1,9,0) into litemcode from item where substr(item_code,1,1)=substr(litemser,1,1); select concat(substr(litemser,1,1),litemcode) into ls_itemcode from dual; return ls_itemcode; else ls_sitecode:=substr(lsitecode,1,5); ls_wing:=substr(lwing,1,1); LS_FLATTYPE:=SUBSTR(LITEMTYPE,1,2); LS_FLOOR:=SUBSTR(LFLOOR,1,2); LS_FLAT := SUBSTR(LFLAT,1,2) ; SELECT LPAD(TRIM(DOC_PREFIX),3,0) INTO LS_BUILDING FROM SITE WHERE SITE_CODE=LS_SITECODE; select concat(ls_building,concat(ls_wing,concat(ls_flattype,concat(ls_floor, ls_flat)))) into ls_itemcode from dual; RETURN LS_ITEMCODE; end if ; return ls_itemcode; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GRADE_DESCR (as_grade char) return char is ls_grade_descr char(20); begin select nvl(descr,' ') into ls_grade_descr from gencodes where fld_name = 'GRADE' and upper(gencodes.mod_name) = 'W_PORCP' and upper(gencodes.fld_value) = as_grade; return ls_grade_descr; exception when no_data_found then return ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REP_SITE (as_option number,as_type varchar2) RETURN VARCHAR2 IS BEGIN RETURN as_type; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RECEIPT_STAT ( ls_tranid in char ,ls_type char ) return char is ls_stat char(10); begin if ls_type = 'M' then select (case when sum(nvl(receivables.tot_amt,0) - nvl(receivables.adj_amt,0)) = 0 then 'A' when sum(nvl(receivables.tot_amt,0) - nvl(receivables.adj_amt,0)) <> 0 then 'U' else '' end ) into ls_stat from receivables where receivables.tran_ser in ('MDRCRC','MDRCRD') and receivables.ref_no = ls_tranid ; end if ; return ls_stat ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DISPLAY_LAST_MEET_DATE (as_sales_pers in char,as_strg_code in char) return date is last_meeet_date date; as_max_day_summ_date DATE; as_min_day_summ_date DATE; begin SELECT MAX(EVENT_DATE) INTO as_max_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(as_sales_pers) AND EVENT_DATE<=trunc(sysdate); SELECT MIN(EVENT_DATE) INTO as_min_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(as_sales_pers) AND EVENT_DATE > trunc(sysdate) ; IF as_min_day_summ_date IS NOT NULL THEN select max(event_date) into last_meeet_date from strg_meet sm where sm.sales_pers=as_sales_pers and sm.strg_code=as_strg_code and sm.event_date >= as_max_day_summ_date AND sm.event_date < as_min_day_summ_date; else select max(event_date) into last_meeet_date from strg_meet sm where sm.sales_pers=as_sales_pers and sm.strg_code=as_strg_code and sm.event_date >= as_max_day_summ_date ; end if; return last_meeet_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PURC_REQ_AVGCONS (as_itemcode in char) return number is lc_average1 workorder_issdet.quantity%type; lc_average2 consume_iss_det.quantity%type; average number(14,3); begin SELECT nvl(avg(workorder_issdet.quantity),0) into lc_average1 FROM workorder_issdet, workorder_iss WHERE ( workorder_iss.tran_id = workorder_issdet.tran_id ) and ( ( workorder_iss.conf_date >= sysdate - 90 ) AND ( workorder_iss.conf_date <= sysdate ) AND ( workorder_iss.tran_type = 'I' ) AND ( workorder_issdet.item_code = as_itemcode ) ) ; SELECT nvl(avg(consume_iss_det.quantity),0) into lc_average2 FROM consume_iss, consume_iss_det WHERE ( consume_iss.cons_issue = consume_iss_det.cons_issue ) and ( ( consume_iss.conf_date >= sysdate - 90 ) AND ( consume_iss.conf_date <= sysdate ) AND ( consume_iss.tran_code = as_itemcode ) ); average:=(lc_average1+lc_average2)/2; return (average); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STRG_CONTACT_FN ( as_scon_code char) return varchar2 is ls_first_name varchar2(25); begin begin select first_name into ls_first_name from strg_contact where scon_code = as_scon_code; exception when no_data_found then ls_first_name := null; end; return ls_first_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PAY_AMT (as_tranid char) return number is ls_payamt number(14,3); begin select sum(misc_paydet.pay_amt) into ls_payamt from misc_payment, misc_paydet where misc_payment.tran_id =misc_paydet.tran_id and misc_paydet.vouch_no = as_tranid and misc_payment.tran_id not in (select misc_payment_canc.payment_no from misc_payment_canc ) ; return ls_payamt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_NO_PERS (llevel_code in char) return number is ll_tot number(14); ll_sel number(14); --declare cursor c1 is select level_code from hierarchy where level_code__parent = llevel_code and level_no <= 4 and sysdate between eff_from and valid_upto; begin select count(*) into ll_sel from hierarchy_det a, hierarchy b where a.level_code = b.level_code and a.level_code__parent = b.level_code__parent and a.table_no = b.table_no and b.level_no = 4 and b.level_code = llevel_code and sysdate between b.eff_from and b.valid_upto; ll_tot := ll_sel; for ls_parent in c1 loop begin select ddf_no_pers(ls_parent.level_code) into ll_sel from dual; ll_tot := ll_tot + ll_sel; end; end loop; return ll_tot; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE EFFORTLEVDM AS FUNCTION getEffortLevData (empCode in char, prdCode in char) RETURN EffortLevTABLE PIPELINED; END EffortLevDm; CREATE OR REPLACE PACKAGE BODY EFFORTLEVDM AS FUNCTION getEffortLevData (empCode in char, prdCode in char) RETURN EffortLevTABLE PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UN_CONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE CODE = prdCode; SELECT COUNT(1) INTO UN_CONFIRM_CNT FROM SPRS_ACT_TRAN WHERE EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND CONFIRMED = 'Y' AND SALES_PERS = empCode; if (UN_CONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; SELECT CODE INTO AS_PRD_CODE FROM PERIOD WHERE FR_DATE = AS_FR_DATE AND TO_DATE = AS_TO_DATE; for x in ( SELECT FLD_NAME, DATA_GRP, EVENT_DATE, X_VALUE, TARGET_VALUE, ACTUAL_VALUE, DESCR, SH_DESCR, THEME_COLOR, ICON, AVG_VALUE, SPECIALITY, VISIT_CNT FROM ( -----------------------------------------------------------------SUMMARY----------------------------------------------- SELECT FLD_NAME, DATA_GRP, EVENT_DATE, X_VALUE, TARGET_VALUE, ACTUAL_VALUE, DESCR, SH_DESCR, THEME_COLOR, ICON, AVG_VALUE, SPECIALITY, VISIT_CNT FROM ( select fld_name, 'KPI_SUMMARY' AS DATA_GRP, '' AS EVENT_DATE, 'NA' AS X_VALUE, fw_day as TARGET_VALUE, (strg_dr_cnt / fw_day ) as AVG_VALUE, strg_dr_cnt as ACTUAL_VALUE, '' as SPECIALITY, '' as VISIT_CNT, DESCR, SH_DESCR, '' as THEME_COLOR, '' as ICON from ( select fld_name, DESCR, SH_DESCR, strg_dr_cnt, FN_GET_FW_CNT('MTD', empCode, to_date, '') fw_day from ( select 'IND_DOC_MTD' as fld_name, 'Doctors Calls' as DESCR, 'MTD' AS SH_DESCR, TO_CHAR(TO_DATE(b.EVENT_DATE),'mm/yy') AS EVENT_DATE, count(1) as strg_dr_cnt ,prd.to_date as to_date from sprs_act_tran a, strg_meet b, period prd,STRG_SERIES SER where a.dcr_id = b.dcr_id and a.sales_pers=empCode and b.strg_type ='D' and b.strg_code !='0000000000' AND b.SALES_PERS = SER.SALES_PERS AND b.STRG_CODE = SER.SC_CODE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= prd.to_date THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= prd.to_date AND SER.CHG_DATE >= prd.to_date THEN 'Y' ELSE 'N' END ) AND prd.code= AS_PRD_CODE AND TO_CHAR(TO_DATE(b.EVENT_DATE),'mm/yy')= TO_CHAR(TO_DATE(prd.to_date,'dd/mm/yy'),'mm/yy') and a.confirmed = 'Y' group by TO_CHAR(TO_DATE(b.EVENT_DATE),'mm/yy'), prd.to_date ) UNION ALL select fld_name, DESCR, SH_DESCR,strg_chem_cnt as strg_dr_cnt , FN_GET_FW_CNT('MTD', empCode, to_date, '') fw_day from ( select 'IND_CHEM_MTD' as fld_name, 'Chemist Calls' as DESCR, 'MTD' AS SH_DESCR, TO_CHAR(TO_DATE(strg_chem.event_date),'mm/yy') EVENT_DATE, (sum(strg_chem.strg_chem_cnt) + sum(strg_chem.unlist_chem_cnt)) strg_chem_cnt , to_date from ( select b.event_date, 0 as strg_chem_cnt, (case when b.strg_code = 'UR00000000' then sum(b.member_present) else 0 end) unlist_chem_cnt,prd.to_date as to_date from sprs_act_tran a, strg_meet b, period prd where a.dcr_id = b.dcr_id and a.sales_pers=empCode and b.strg_type ='C' and b.strg_code !='0000000000' AND prd.code= AS_PRD_CODE AND TO_CHAR(TO_DATE(b.EVENT_DATE),'mm/yy')= TO_CHAR(TO_DATE(prd.to_date,'dd/mm/yy'),'mm/yy') and a.confirmed='Y' group by b.event_date, b.strg_code, prd.to_date )strg_chem group by TO_CHAR(TO_DATE(strg_chem.event_date),'mm/yy'),to_date ) UNION ALL select fld_name,DESCR, SH_DESCR, strg_chem_cnt as strg_dr_cnt , FN_GET_FW_CNT('YTD', empCode, sysdate, '') fw_day from ( select 'IND_CHEM_YTD' as fld_name, 'Chemist Calls' as DESCR, 'YTD' AS SH_DESCR, (sum(strg_chem.strg_chem_cnt) + sum(strg_chem.unlist_chem_cnt)) strg_chem_cnt from ( select TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM') event_date, 0 as strg_chem_cnt, (case when b.strg_code = 'UR00000000' then sum(b.member_present) else 0 end) unlist_chem_cnt from sprs_act_tran a, strg_meet b--, YTD_PRD YTD_PRD where a.dcr_id = b.dcr_id and a.sales_pers=empCode and b.strg_type ='C' and b.strg_code !='0000000000' and TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM') in ( (select code from period where acct_prd = (SELECT CODE FROM ACCTPRD WHERE (select TO_DATE from period where code = AS_PRD_CODE) BETWEEN FR_DATE AND TO_DATE) and fr_date >= (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE') ) ) and a.confirmed='Y' group by TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM'), b.strg_code )strg_chem ) UNION ALL select fld_name,DESCR, SH_DESCR, strg_dr_cnt , FN_GET_FW_CNT('YTD', empCode, sysdate, '') fw_day from ( select 'IND_DOC_YTD' as fld_name, 'Doctors Calls' as DESCR, 'YTD' AS SH_DESCR, sum(strg_dr_cnt) strg_dr_cnt,'' as visit_cnt, '' as SPECIALITY from ( select TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM') event_date,count(1) as strg_dr_cnt from sprs_act_tran a, strg_meet b, STRG_SERIES SER where a.dcr_id = b.dcr_id and a.sales_pers=empCode AND B.SALES_PERS = SER.SALES_PERS AND B.STRG_CODE = SER.SC_CODE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= (select TO_DATE from period where code = AS_PRD_CODE) THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= (select TO_DATE from period where code = AS_PRD_CODE) AND SER.CHG_DATE >= (select TO_DATE from period where code = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) and b.strg_type ='D' and b.strg_code !='0000000000' and TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM') in ( (select code from period where acct_prd = (SELECT CODE FROM ACCTPRD WHERE (select TO_DATE from period where code = AS_PRD_CODE) BETWEEN FR_DATE AND TO_DATE) and fr_date >= (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE') ) ) and a.confirmed = 'Y' group by b.event_date ) ) ) ) UNION ALL -----------------------------------------------------------------MTD----------------------------------------------- SELECT FLD_NAME, DATA_GRP, EVENT_DATE, X_VALUE, TARGET_VALUE, ACTUAL_VALUE, DESCR, SH_DESCR, THEME_COLOR, ICON, AVG_VALUE, SPECIALITY, VISIT_CNT from ( select 'IND_DOC_MTD' as FLD_NAME, 'MTD_DETAIL' as DATA_GRP, TO_CHAR(to_date(FINAL_DET.EVENT_DATE,'DD-MM-YY'),'DD-MM-YYYY') AS EVENT_DATE , TO_CHAR(to_date(FINAL_DET.EVENT_DATE,'DD-MM-YY'),'DD MON') AS X_VALUE , 0 as TARGET_VALUE, strg_dr_cnt as ACTUAL_VALUE, 'Doctors Calls' as DESCR, 'MTD' as SH_DESCR, '' as THEME_COLOR, '' as ICON, 0 as AVG_VALUE, visit_cnt as VISIT_CNT, SPECIALITY as SPECIALITY from ( select MISS_DATE.EVENT_DATE as EVENT_DATE, 0 as strg_dr_cnt , '' as visit_cnt, '' as SPECIALITY FROM ( with MNTH_DATE AS ( SELECT add_months((select to_date from period where code = AS_PRD_CODE), -1 ) + 1 + lvl AS EVENT_DATE, TO_CHAR( TO_DATE (add_months( (select to_date from period where code = AS_PRD_CODE),-1 ) + 1 ) + lvl ,'DD MON' ) AS EVENT_DAY FROM (SELECT level - 1 lvl FROM dual CONNECT BY level <= (select to_date from period where code = AS_PRD_CODE) - ( last_day( add_months((select to_date from period where code = AS_PRD_CODE),-1) ) + 1 ) + 1) ) SELECT EVENT_DATE FROM MNTH_DATE WHERE EVENT_DATE <> ALL ( SELECT DISTINCT a.EVENT_DATE FROM STRG_MEET A, SPRS_ACT_TRAN B, STRG_SERIES SER WHERE a.dcr_id = b.dcr_id and a.sales_pers=empCode AND A.STRG_CODE = SER.SC_CODE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SER.CHG_DATE >= (select TO_DATE from period where code = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) and A.strg_type ='D' and A.strg_code !='0000000000' and a.event_date >= (select fr_date from period where code =AS_PRD_CODE) --'01-sep-20' and '30-sep-20' and a.event_date <= (select to_date from period where code =AS_PRD_CODE) and b.confirmed = 'Y' )order by event_date )MISS_DATE UNION all select strg_dr.event_date, sum( strg_dr.strg_dr_cnt ) strg_dr_cnt, '[' || LISTAGG(TRIM('' || strg_dr.strg_dr_cnt || ''), ',') WITHIN GROUP (ORDER BY strg_dr.SPECIALITY) || ']' as visit_cnt, '[' || LISTAGG(TRIM('' || strg_dr.SPECIALITY || '' ),',') WITHIN GROUP (ORDER BY strg_dr.SPECIALITY) || ']' as SPECIALITY from ( select b.event_date AS EVENT_DATE, spl.descr as SPECIALITY, count(1) as strg_dr_cnt from sprs_act_tran a, strg_meet b, speciality spl, strg_series ss where a.dcr_id = b.dcr_id and a.sales_pers=empCode and b.strg_type ='D' and b.strg_code !='0000000000' and b.event_date >= (select fr_date from period where code =AS_PRD_CODE) --'01-sep-20' and '30-sep-20' and b.event_date <= (select to_date from period where code =AS_PRD_CODE) and a.confirmed = 'Y' and b.sales_pers = ss.sales_pers and b.strg_code = ss.sc_code and ss.spl_code = spl.spl_code --and ss.STATUS = 'Y' AND 'Y' = ( CASE WHEN SS.STATUS = 'Y' AND SS.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' WHEN SS.STATUS = 'N' AND SS.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SS.CHG_DATE >= (select TO_DATE from period where code = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) group by b.event_date,spl.descr )strg_dr group by strg_dr.event_date ) FINAL_DET UNION ALL select 'IND_CHEM_MTD' as FLD_NAME, 'MTD_DETAIL' as DATA_GRP, TO_CHAR(to_date(FINAL_DET.EVENT_DATE,'DD-MM-YY'),'DD-MM-YYYY') AS EVENT_DATE , TO_CHAR(to_date(FINAL_DET.EVENT_DATE,'DD-MM-YY'),'DD MON') AS X_VALUE , 0 as TARGET_VALUE, strg_dr_cnt as ACTUAL_VALUE, 'Chemist Calls' as DESCR, 'MTD' as SH_DESCR, '' as THEME_COLOR, '' as ICON, 0 as AVG_VALUE, visit_cnt as VISIT_CNT, SPECIALITY as SPECIALITY from ( select MISS_DATE.EVENT_DATE as EVENT_DATE, 0 as strg_dr_cnt , '' as visit_cnt, '' as SPECIALITY FROM ( with MNTH_DATE AS ( SELECT add_months((select to_date from period where code = AS_PRD_CODE), -1 ) + 1 + lvl AS EVENT_DATE, TO_CHAR( TO_DATE (add_months( (select to_date from period where code = AS_PRD_CODE),-1 ) + 1 ) + lvl ,'DD MON' ) AS EVENT_DAY FROM (SELECT level - 1 lvl FROM dual CONNECT BY level <= (select to_date from period where code = AS_PRD_CODE) - ( last_day( add_months((select to_date from period where code = AS_PRD_CODE),-1) ) + 1 ) + 1) ) SELECT EVENT_DATE FROM MNTH_DATE WHERE EVENT_DATE <> ALL ( SELECT DISTINCT a.EVENT_DATE FROM STRG_MEET A, SPRS_ACT_TRAN B WHERE a.dcr_id = b.dcr_id and a.sales_pers=empCode and A.strg_type ='C' and A.strg_code !='0000000000' and a.event_date >= (select fr_date from period where code =AS_PRD_CODE) --'01-sep-20' and '30-sep-20' and a.event_date <= (select to_date from period where code =AS_PRD_CODE) and b.confirmed = 'Y' )order by event_date )MISS_DATE UNION all select strg_chem.event_date, (sum(strg_chem.unlist_chem_cnt)) strg_chem_cnt, null as visit_cnt, null as SPECIALITY from ( select b.event_date, 0 as strg_chem_cnt, (case when b.strg_code = 'UR00000000' then sum(b.member_present) else 0 end) unlist_chem_cnt from sprs_act_tran a, strg_meet b where a.dcr_id = b.dcr_id and a.sales_pers = empCode and b.strg_type ='C' and b.strg_code !='0000000000' and b.event_date >= (select fr_date from period where code =AS_PRD_CODE) --'01-sep-20' and '30-sep-20' and b.event_date <= (select to_date from period where code =AS_PRD_CODE) and a.confirmed='Y' group by b.event_date, b.strg_code )strg_chem group by strg_chem.event_date ) FINAL_DET order by 7,3 ) UNION ALL -----------------------------------------------------------------YTD----------------------------------------------- SELECT FLD_NAME, DATA_GRP, EVENT_DATE, X_VALUE, TARGET_VALUE, ACTUAL_VALUE, DESCR, SH_DESCR, THEME_COLOR, ICON, AVG_VALUE, SPECIALITY, VISIT_CNT FROM ( select 'IND_DOC_YTD' as FLD_NAME, 'YTD_DETAIL' as DATA_GRP, TO_CHAR(TO_DATE(FINAL_DET.EVENT_MONTH,'MON YY'),'dd/mm/yy' ) AS EVENT_DATE , FINAL_DET.EVENT_MONTH as X_VALUE, 0 as TARGET_VALUE, strg_dr_cnt as ACTUAL_VALUE, 'Doctors Calls' as DESCR, 'YTD' as SH_DESCR, '' as THEME_COLOR, '' as ICON, 0 as AVG_VALUE, visit_cnt as VISIT_CNT, SPECIALITY as SPECIALITY from ( select sum(strg_dr_cnt) strg_dr_cnt, EVENT_MONTH,'' as visit_cnt, '' as SPECIALITY from ( WITH YTD_PRD AS ( SELECT TO_CHAR(TO_DATE(fr_date,'dd/mm/yy'),'MON YY') AS EVENT_MONTH FROM PERIOD WHERE ACCT_PRD IN ( SELECT CODE FROM ACCTPRD WHERE TO_DATE((select to_date from period where code = AS_PRD_CODE)) BETWEEN FR_DATE AND TO_DATE) AND fr_date >= (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE') ) select YTD_PRD.EVENT_MONTH, b.event_date AS EVENT_DATE, count(1) as strg_dr_cnt from sprs_act_tran a, strg_meet b, YTD_PRD, STRG_SERIES SER where a.dcr_id = b.dcr_id and a.sales_pers=empCode AND B.SALES_PERS = SER.SALES_PERS AND B.STRG_CODE = SER.SC_CODE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SER.CHG_DATE >= (select TO_DATE from period where code = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) and b.strg_type ='D' and b.strg_code !='0000000000' AND TO_CHAR(TO_DATE(b.EVENT_DATE),'MON YY')= YTD_PRD.EVENT_MONTH and a.confirmed = 'Y' group by b.event_date, YTD_PRD.EVENT_MONTH ) FINAL group by FINAL.EVENT_MONTH UNION ALL SELECT 0 as strg_dr_cnt , MISS_MTH.EVENT_MONTH as EVENT_DATE, '' as visit_cnt, '' as SPECIALITY FROM ( with YR_MTH AS ( SELECT TO_CHAR(TO_DATE(fr_date,'dd/mm/yy'),'MON YY' ) AS EVENT_MONTH FROM PERIOD WHERE ACCT_PRD IN ( SELECT CODE FROM ACCTPRD WHERE TO_DATE((select to_date from period where code = AS_PRD_CODE)) BETWEEN FR_DATE AND TO_DATE) AND fr_date >= (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE') ) SELECT 0 as strg_dr_cnt ,EVENT_MONTH FROM YR_MTH WHERE EVENT_MONTH <> ALL ( SELECT DISTINCT TO_CHAR(TO_DATE(a.EVENT_DATE,'dd/mm/yy'),'MON YY' ) as EVENT_MONTH FROM STRG_MEET A, SPRS_ACT_TRAN B, YR_MTH YR_MTH, STRG_SERIES SER WHERE a.dcr_id = b.dcr_id and a.sales_pers=empCode AND A.SALES_PERS = SER.SALES_PERS AND A.STRG_CODE = SER.SC_CODE AND 'Y' = ( CASE WHEN SER.STATUS = 'Y' AND SER.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' WHEN SER.STATUS = 'N' AND SER.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SER.CHG_DATE >= (select TO_DATE from period where code = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) and A.strg_type ='D' and A.strg_code !='0000000000' AND TO_CHAR(TO_DATE(b.EVENT_DATE),'MON YY')= YR_MTH.EVENT_MONTH and b.confirmed = 'Y' )order by EVENT_MONTH ) MISS_MTH )FINAL_DET UNION ALL select 'IND_CHEM_YTD' as FLD_NAME, 'YTD_DETAIL' as DATA_GRP, TO_CHAR(TO_DATE(FINAL_DET.EVENT_MONTH,'MON YY'),'dd/mm/yy' ) AS EVENT_DATE , FINAL_DET.EVENT_MONTH as X_VALUE, 0 as TARGET_VALUE, strg_chem_cnt as ACTUAL_VALUE, 'Chemist Calls' as DESCR, 'YTD' as SH_DESCR, '' as THEME_COLOR, '' as ICON, 0 as AVG_VALUE, visit_cnt as VISIT_CNT, SPECIALITY as SPECIALITY from ( select sum(strg_chem_cnt) strg_chem_cnt, EVENT_MONTH,'' as visit_cnt, '' as SPECIALITY from ( select strg_chem.event_date, TO_CHAR(TO_DATE(strg_chem.event_date,'YYYYMM'),'MON YY') AS EVENT_MONTH, (sum(strg_chem.strg_chem_cnt) + sum(strg_chem.unlist_chem_cnt)) strg_chem_cnt, null as visit_cnt, null as SPECIALITY from ( select TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM') event_date, 0 as strg_chem_cnt, (case when b.strg_code = 'UR00000000' then sum(b.member_present) else 0 end) unlist_chem_cnt from sprs_act_tran a, strg_meet b--, YTD_PRD YTD_PRD where a.dcr_id = b.dcr_id and a.sales_pers=empCode and b.strg_type ='C' and b.strg_code !='0000000000' and TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM') in ( (select code from period where acct_prd = (SELECT CODE FROM ACCTPRD WHERE (select TO_DATE from period where code = AS_PRD_CODE) BETWEEN FR_DATE AND TO_DATE) and fr_date >= (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE') ) ) and a.confirmed='Y' group by TO_CHAR(TO_DATE(b.EVENT_DATE),'YYYYMM'), b.strg_code )strg_chem GROUP BY strg_chem.event_date ) FINAL group by FINAL.EVENT_MONTH UNION ALL SELECT 0 as strg_chem_cnt , MISS_MTH.EVENT_MONTH , '' as visit_cnt, '' as SPECIALITY FROM ( with YR_MTH AS ( SELECT TO_CHAR(TO_DATE(fr_date,'dd/mm/yy'),'MON YY' ) AS EVENT_MONTH FROM PERIOD WHERE ACCT_PRD IN ( SELECT CODE FROM ACCTPRD WHERE TO_DATE((select to_date from period where code = AS_PRD_CODE)) BETWEEN FR_DATE AND TO_DATE) AND fr_date >= (SELECT PARAM_VALUE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE') ) SELECT 0 as strg_dr_cnt ,EVENT_MONTH FROM YR_MTH WHERE EVENT_MONTH <> ALL ( SELECT DISTINCT TO_CHAR(TO_DATE(a.EVENT_DATE,'dd/mm/yy'),'MON YY' ) as EVENT_MONTH FROM STRG_MEET A, SPRS_ACT_TRAN B, YR_MTH YR_MTH WHERE a.dcr_id = b.dcr_id and a.sales_pers = empCode and A.strg_type ='C' and A.strg_code !='0000000000' AND TO_CHAR(TO_DATE(b.EVENT_DATE),'MON YY')= YR_MTH.EVENT_MONTH and b.confirmed = 'Y' )order by EVENT_MONTH ) MISS_MTH )FINAL_DET order by 7,3 ) ) ) LOOP PIPE ROW (EffortLevDmMaster( x.FLD_NAME, x.DATA_GRP, x.EVENT_DATE, x.X_VALUE, nvl( x.TARGET_VALUE, '0'), nvl( x.ACTUAL_VALUE, 0), x.DESCR, x.SH_DESCR, x.THEME_COLOR, x.ICON, x.avg_value, x.SPECIALITY, x.VISIT_CNT )); END LOOP; RETURN; END; END EffortLevDm; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_TLSD_TB force AS TABLE OF CHC_CHEM_TLSD_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ASRVCTAX_PAYMENT (vouchno char,net_amt number,pay_amt number,exch_rate__vouch number, DIFF_AMT__EXCH NUMBER , taxgroup char) return number is srtax number; mexch_rate number; begin srtax := 0; SELECT (ROUND((((SUM(TAXTRAN.TAX_AMT) * (PAY_AMT))/ NET_AMT) * exch_rate__vouch),3)) / (ROUND(((((SUM(PAY_AMT * exch_rate__vouch) / COUNT(TAXTRAN.TAX_CODE)) + (CASE WHEN DIFF_AMT__EXCH <=0 THEN DIFF_AMT__EXCH * -1 ELSE DIFF_AMT__EXCH * -1 END)) / pay_amt)),3)) into srtax --NVL((SUM(TAXTRAN.TAX_AMT) * PAY_AMT )/ NET_AMT,0) * exch_rate__vouch / --(((SUM(PAY_AMT * exch_rate__vouch) + (CASE WHEN DIFF_AMT__EXCH <=0 THEN DIFF_AMT__EXCH * -1 ELSE DIFF_AMT__EXCH END))) / pay_amt) into srtax FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE IN ('M-VOUC','VOUCH','CRNINV','DRNPAY','CRNPAY') AND TAXTRAN.TRAN_ID=VOUCHNO AND TAX.TAX_GROUP IN (taxgroup) AND (TAXTRAN.ACCT_CODE IS NOT NULL OR TAXTRAN.ACCT_CODE__RECO IS NOT NULL) AND TAXTRAN.TAX_AMT <> 0; return srtax; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_PAY_PRD (as_emp_code in payroll.emp_code%type, as_prd_code in payroll.prd_code%type , as_ench_mode in empleave.encash_mode%type) return varchar2 is err_string varchar2(10); ls_prd_code_db payroll.prd_code%type; begin err_string := ''; if(trim(as_ench_mode) = 'P') then if(as_prd_code is null or length(trim(as_prd_code)) is null) then err_string := 'VTSIGNPCBL'; else select max(prd_code) as prd_code_db into ls_prd_code_db from payroll where emp_code = as_emp_code; if(ls_prd_code_db is null or length(trim(ls_prd_code_db)) is null) then ls_prd_code_db := 0; end if; if(as_prd_code <= ls_prd_code_db) then err_string := 'VTSIGNPCIV'; end if; end if; end if; return err_string; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHKVALIDCRTERM (as_order_type VARCHAR2,as_cust_code_bil CHAR,as_cust_code_dlv CHAR,as_cust_code CHAR,as_item_ser CHAR,as_cr_term CHAR) return number IS ls_retval NUMBER(1); ls_var_value VARCHAR2(1200); ls_ord_type_flag VARCHAR2 (1); ls_cr_term_np VARCHAR2(5); ls_cr_term_source CHAR(1); ls_count number; ls_cnt number; Begin ls_retval := 1 ; ls_var_value := ''; ls_ord_type_flag := 'F'; ls_cr_term_source := ''; ls_cr_term_np := ''; ls_count := 0; ls_cnt := 0; begin --Select Trim(var_value) into ls_var_value from disparm where var_name='ORD_TYPE_NEWPRD'; select --trim(var_value),--regexp_count(var_value,',')+1, count(*) into ls_cnt from disparm, lateral(select level l from dual connect by level <= regexp_count(var_value,',')+1) where var_name='ORD_TYPE_NEWPRD' and regexp_substr(var_value,'\w+',1,l) = as_order_type; exception when others then ls_var_value := ''; end; if ls_cnt > 0 then --If trim(ls_var_value) = trim(as_order_type) then ls_ord_type_flag :='T'; if (ls_ord_type_flag = 'T') then begin select cr_term_source into ls_cr_term_source from sordertype where order_type = as_order_type; exception when others then ls_cr_term_source := ''; end; if (ls_cr_term_source = 'B') then begin select (case when cr_term__np is null then '' else cr_term__np end) into ls_cr_term_np from customer_series where trim(cust_code) = as_cust_code_bil and item_ser = as_item_ser; exception when others then ls_cr_term_np := ''; end; ELSIF (ls_cr_term_source = 'D') then begin select (case when cr_term__np is null then '' else cr_term__np end) into ls_cr_term_np from customer_series where trim(cust_code) = as_cust_code_dlv and item_ser = as_item_ser; exception when others then ls_cr_term_np := ''; end; ELSIF ((ls_cr_term_source != 'D' and ls_cr_term_source != 'B') or ls_cr_term_source is null)then begin select (case when cr_term__np is null then '' else cr_term__np end) into ls_cr_term_np from customer_series where trim(cust_code) = as_cust_code and item_ser = as_item_ser; exception when others then ls_cr_term_np := ''; end; end if; if (ls_cr_term_np is null and ls_cr_term_source = 'B') then begin select (case when cr_term__np is null then '' else cr_term__np end) into ls_cr_term_np from customer where trim(cust_code) = as_cust_code_bil; --raise_application_error( -20601, 'value of ls_cr_term_np is.. [' || ls_cr_term_np || ']'); exception when others then ls_cr_term_np := ''; end; ELSIF (ls_cr_term_np is null and ls_cr_term_source = 'D') then begin select (case when cr_term__np is null then '' else cr_term__np end) into ls_cr_term_np from customer where trim(cust_code) = as_cust_code_dlv; exception when others then ls_cr_term_np := ''; end; ELSIF (ls_cr_term_np is null and ((ls_cr_term_source != 'B' and ls_cr_term_source != 'D') or ls_cr_term_source is null) ) then begin select (case when cr_term__np is null then '' else cr_term__np end) into ls_cr_term_np from customer where trim(cust_code) = as_cust_code; exception when others then ls_cr_term_np := ''; end; end if; if(ls_cr_term_np = as_cr_term ) then ls_retval := 1; else ls_retval := 0; end if; else ls_retval := 1; end if; else ls_retval := 1; end if; RETURN ls_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX NCL_STRG_CUSTOMER_X ON NCL_STRG_CUSTOMER (SC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXCDATE_VAL (ls_refser IN CHAR,ls_refid IN CHAR) RETURN number is cnt number ; ls_table_name CHAR(30); ls_tran_id_col CHAR(100); ls_cnt NUMBER; ls_date date; fin_date date; str VARCHAR2(500); ld_month number; ld_year number; BEGIN BEGIN if (ls_refser = 'JOUR' AND ls_refid <> NULL ) then cnt := 1 ; else str:='SELECT DISTINCT table_name,tran_id_col FROM TRANSETUP WHERE ref_ser ='''||Trim(ls_refser)||''''; EXECUTE IMMEDIATE str INTO ls_table_name,ls_tran_id_col; str :='SELECT tran_date FROM '||Trim(ls_table_name)||' WHERE '||Trim(ls_tran_id_col)||' = '''||Trim(ls_refid)||''''; EXECUTE IMMEDIATE str INTO ls_date; end if; select to_char(ls_date,'mm') into ld_month from dual; select to_char(ls_date,'yyyy') into ld_year from dual; if (ld_month = '12') then ld_year := ld_year +1; ld_month := '00' ; end if; ld_month := ld_month + 1; fin_date := to_date(to_char(ld_month) ||'/'||'07'||'/'||to_char(ld_year),'mm/dd/yyyy') ; END; if(fin_date >= sysdate ) then cnt := 0 ; else cnt := 1 ; end if ; RETURN cnt ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_ITEM_SITE_GRADE_QTY ON STOCK (ITEM_CODE, SITE_CODE, GRADE, QUANTITY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SILVASSA_QMS_DATA_X ON SILVASSA_QMS_DATA (SR_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STANTYPE_X ON STANTYPE (STAN_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVTRACE_REF_SER_REF_ID ON INVTRACE (REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_FORM16A_BANK_DET ( as_ref_ser char , as_vouch_no char) return varchar2 is ls_details varchar2(60); ls_sh_bank bank.sh_name%type; ls_bank_city bank.city%type; ls_bank_code bank.bank_code%type; ls_handover_to misc_payment.handover_to%type; begin select rtrim(handover_to), rtrim(bank_code) into ls_handover_to , ls_bank_code from misc_payment a , misc_paydet b where a.tran_id = b.tran_id and tran_ser = 'M-VOUC' and vouch_no = as_vouch_no and length( rtrim( handover_to ) ) > 0 and rownum = 1 ; if ls_handover_to is null then select rtrim(nvl(sh_name,' ')) , rtrim(nvl(city,' ')) into ls_sh_bank , ls_bank_city from bank where bank_code = ls_bank_code; ls_details := ls_sh_bank||', '||ls_bank_city; else ls_details := ls_handover_to; end if; return ls_details; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_BOMCODE (as_emp_code IN CHAR ,as_item_code IN CHAR ) return char is bom_code CHAR(10); begin begin select s.bom_code into bom_code from SITEITEM s where trim(s.SITE_CODE) IN (SELECT TRIM(EMP_SITE) FROM EMPLOYEE WHERE EMP_CODE=as_emp_code) and trim(s.ITEM_CODE)=TRIM(as_item_code); EXCEPTION WHEN NO_DATA_FOUND THEN select i.bom_code into bom_code from item i where trim(i.item_code)=trim(as_item_code); end; return bom_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BANK_APPL_FOR_SITE (as_bankcode in BANK.BANK_CODE%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_BANK'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from SITE_BANK where site_code = as_sitecode and bank_code = as_bankcode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PORCP_DETAILS (ls_prcp_no in char, l_field_name in char, ls_req_val in char) return varchar is lsreturn varchar2(200); ls_rec_date varchar2(200); ls_lr_no varchar2(200); ls_lr_date varchar2(200); ls_tran_code varchar2(200); ls_tran_name varchar2(200); ls_gst_amt varchar2(200); lsreq_val varchar2(200); begin begin if l_field_name = 'PORCP' then begin select porcp.rec_date, porcp.lr_no, porcp.lr_date, porcp.tran_code, transporter.tran_name into ls_rec_date, ls_lr_no, ls_lr_date, ls_tran_code,ls_tran_name from porcp porcp LEFT OUTER JOIN transporter transporter ON transporter.tran_code = porcp.tran_code where porcp.tran_id = ls_prcp_no; exception when no_data_found then lsreturn := ''; end; elsif l_field_name = 'GSTAMT' then begin select nvl(sum(tax_amt),0) into ls_gst_amt from taxtran t, tax tm where tm.tax_code = t.tax_code and tm.tax_type in ('G','H','I') and t.tran_code = 'P-RCP' and t.tran_id = ls_prcp_no; exception when no_data_found then lsreturn := ''; end; end if; if ls_req_val ='REC_DATE' then lsreturn := ls_rec_date; elsif ls_req_val ='LR_NO' then lsreturn := ls_lr_no; elsif ls_req_val ='LR_DATE' then lsreturn := ls_lr_date; elsif ls_req_val ='TRAN_NAME' then lsreturn := ls_tran_name; elsif ls_req_val ='GST_AMT' then lsreturn := ls_gst_amt; else lsreturn := ''; end if; exception when no_data_found then lsreturn := ''; end; return lsreturn; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINV_CLSTKQVSTK1 (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char, as_qtyvalue in char, lreporttype_fr in char, lreporttype_to in char, lloc_code in char ) return number is ld_eff_qty number(18,3); ldt_crea_date date; begin if ltype = 'I' then select sum(qty) into ld_eff_qty from ( Select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code= litem_code and a.site_code= lsite_code and a.loc_code=lloc_code union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code ); end if; if ltype = 'B' then --Added for negative value coming due to quantity and rate differnce if as_qtyvalue = 'Q' then select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no= llot_no union all select nvl( decode(as_qtyvalue,'Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no = llot_no ); else select sum(qty) into ld_eff_qty from ( select decode('Q','Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no= llot_no union all select nvl( decode('Q','Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no = llot_no ); if nvl(ld_eff_qty,0) > 0 then select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no= llot_no union all select nvl( decode(as_qtyvalue,'Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no = llot_no ); else ld_eff_qty := 0; end if; end if; end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE ENTITYCODEMASTER AS OBJECT ( EMP_CODE VARCHAR2(10), Visited_with VARCHAR2(80) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX QUALIFICATION_DESCR ON QUALIFICATION (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINV_CLSTKQVSTK_N1 (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ad_to_date in date, ltype in char, lavailable in char, as_qtyvalue in char, lreporttype_fr in char, lreporttype_to in char, lloc_code in char ) return number is ld_eff_qty number(18,3); ldt_crea_date date; ld_eff_stock_rate number(15,4); ld_raterowcount number(10):= 0; begin if ltype = 'I' then select sum(qty) into ld_eff_qty from ( Select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code= litem_code and a.site_code= lsite_code and a.loc_code=lloc_code union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a where a.tran_date > ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code ); end if; if ltype = 'B' then --Added for negative value coming due to quantity and rate differnce if as_qtyvalue = 'Q' then select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a where a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no= llot_no union all select nvl( decode(as_qtyvalue,'Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a where a.tran_date >= ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_no = llot_no ); else select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0)) ) qty from stock a where a.item_code = litem_code and a.site_code = lsite_code and a.loc_code=lloc_code and a.lot_no= llot_no union all select nvl( decode(as_qtyvalue,'Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a where a.tran_date >= ad_from_date and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_no = llot_no ); end if; END IF; if ld_eff_qty is null then ld_eff_qty := 0; end if; --Navin:30-Mar-23 , need to trunc value to 2 decimal as its showing wrong in report when stk is zero IF as_qtyvalue ='V' THEN ld_eff_qty := trunc(ld_eff_qty,2); END IF; --Navin:30-Mar-23 -End return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CONTROLPARM_X ON CONTROLPARM (MC_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE LOCALITYCODEMASTER force AS OBJECT ( LOCALITY_CODE CHAR(10), DESCR VARCHAR2(60) , STOCKIST_CODE CHAR(10), STOCKIST_NAME varchar2(120), STOCKIST_ADDRESS VARCHAR2(122) , STOCKIST_GST_NO VARCHAR2(40) , STOCKIST_STATE VARCHAR2(40) , INVOICE_SR_NO CHAR(10), VISITED_WITH_TEAM char(10), ITEM_SER CHAR(5), ROUTE_ID CHAR(3) , STATION_TYPE CHAR(5), STATION_DESCR VARCHAR2(40) , ROUTE_TYPE VARCHAR2(5), PLAN_DAYS VARCHAR2(200) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RBNKRECOSTMTBAL (as_bankcode IN CHAR, as_date IN DATE) RETURN NUMBER IS ld_total number (14,3); ld_tot_p1 NUMBER (14,3) ; ld_tot_r1 NUMBER (14,3) ; ld_tot_p2 NUMBER (14,3) ; ld_tot_r2 NUMBER (14,3) ; BEGIN SELECT sum(amount-amt_adj) into ld_tot_p1 FROM banktran_log where bank_code=as_bankcode and status <> 'R' and tran_date <= as_date and tran_type='P'; SELECT sum(amount-amt_adj) into ld_tot_r1 FROM banktran_log where bank_code=as_bankcode and status <> 'R' and tran_date <= as_date and tran_type='R'; SELECT sum(amount-amt_adj) into ld_tot_p2 FROM bank_statement where bank_code = as_bankcode and status <> 'R' and eff_date <= as_date and tran_type = 'P'; SELECT sum(amount-amt_adj) into ld_tot_r2 FROM bank_statement where bank_code = as_bankcode and status <> 'R' and eff_date <= as_date and tran_type = 'R'; if ld_tot_p1 is null then ld_tot_p1 := 0; end if; if ld_tot_p2 is null then ld_tot_p2 := 0; end if; if ld_tot_r1 is null then ld_tot_r1 := 0; end if; if ld_tot_r2 is null then ld_tot_r2 := 0; end if; ld_total := (ld_tot_p1 - ld_tot_r1 - ld_tot_p2 + ld_tot_r2); return ld_total; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_VOUCH AFTER UPDATE OF CONFIRMED ON voucher REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN begin select count(1) into ll_count from e_invoice where ref_ser in( 'VOUCH') and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, Tran_code, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE ) SELECT ls_seq as tran_id, :new.TRAN_DATE AS TRAN_DATE, :new.TRAN_TYPE as tran_type, buyer.einv_reqd as einv_opt, 'VOUCH' as REF_SER, :new.tran_id as REF_ID, :new.TRAN_DATE as REF_DATE, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, :new.site_code SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_ship, seller.descr trade_name_ship, seller.descr legal_name_ship, seller.ADD1 add1_ship, seller.ADD2 add2_ship, seller.CITY city_ship, seller.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_ship, seller.TELE1 tele_ship, seller.EMAIL_ADDR email_id_ship, :new.supp_CODE CUST_CODE, (SELECT tax_reg_2 FROM supplier WHERE supp_code=buyer.supp_code ) gstn_buy, buyer.sh_name trade_name_buy, buyer.sh_name legal_name_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.city city_buy, buyer.state_code state_code__buy, '' drug_lic_no_buy, buyer.pin pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.tele1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.supp_code CUST_CODE__BIL, :new.supp_code CUST_CODE__DLV, buyer.sh_name name_dlv, buyer.ADDR1 add1_dlv, buyer.ADDR2 add2_dlv, buyer.pin pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_dlv, buyer.state_code state_code__dlv, '' drug_lic_no_dlv, :new.BILL_AMT INV_AMT, :new.tot_amt as NET_AMT, :new.BILL_AMT AS ASSESABLE_VALUE, 0 AS DISC_AMT, :new.PURC_ORDER as ORDER_NO, NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'VOUCH' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='I') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS IGST_AMT, NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'VOUCH' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='H') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS CGST_AMT, NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'VOUCH' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='G') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS SGST_AMT, NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'VOUCH' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='J')AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS CESS_AMT, NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'VOUCH' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='C') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS OTHER_AMT, 'N' proc_stat, sysdate proc_date, 'P' resp_stat, 0 distance, null Trans_Mode, null Tran_code, null lr_date, null lr_no, null lorry_no, '' Vehicle_Type, null DOC_NO, null DOC_DATE FROM --VOUCHER INV, supplier buyer, site seller WHERE seller.site_code = :new.site_code and buyer.supp_code = :new.supp_code; --and INV.tran_ID= :new.tran_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.item_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, '' AS LINE_TYPE, it.VOUCH_AMT as INV_AMT, it.VOUCH_AMT as ASS_AMT, it.DISC_AMT AS DISCOUNT, nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'VOUCH' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0) as IGST_AMT, nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'VOUCH' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0) as CGST_AMT, nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'VOUCH' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0) as SGST_AMT, nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'VOUCH' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0) as CESS_AMT, nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'VOUCH' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='C') and tax_perc > 0 and tax_amt > 0),0) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END AS Unit FROM uom WHERE unit=it.unit ) AS UNIT, it.VOUCH_QTY AS QUANTITY, it.VOUCH_RATE AS RATE, item.hsn_no AS HSN_CODE, null as LOT_NO, null as EXP_DATE, null as MFG_DATE, it.NET_AMT as TOT_ITEM_VAL, fn_gst_rate_amt('VOUCH',it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt('VOUCH',it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt('VOUCH',it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt('VOUCH',it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate('VOUCH',it.tran_id, it.line_no) as GST_RATE FROM vouchrcp it, item WHERE item.item_code = it.item_code AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER UPD_EMPEXPERIENCE_LINENO BEFORE INSERT ON EMPEXPERIENCE FOR EACH ROW DECLARE MAX_LINE_NO EMPEXPERIENCE.LINE_NO%TYPE; BEGIN MAX_LINE_NO := 0; IF :NEW.LINE_NO IS NULL OR :NEW.LINE_NO = 0 THEN SELECT MAX(LINE_NO) INTO MAX_LINE_NO FROM EMPEXPERIENCE WHERE EMP_CODE = :NEW.EMP_CODE; :NEW.LINE_NO := NVL(MAX_LINE_NO , 0) + 1; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUN_GET_MRP_RED (MITM IN CHAR, MLOT IN CHAR) RETURN NUMBER IS MAMT NUMBER; ID VARCHAR2(10); BEGIN SELECT CHG_REF_NO INTO ID FROM PRICELIST WHERE PRICE_LIST = 'MRP' AND ITEM_CODE = MITM AND MLOT BETWEEN LOT_NO__FROM AND LOT_NO__TO; IF ID = 'MRP' THEN MAMT := 1; ELSE MAMT := 0; END IF; RETURN MAMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EFF_DT_BNKSTMNT (ref_ser gltrace.ref_ser%type,ref_id gltrace.ref_id %type) return date is ld_eff_date date; begin select eff_date into LD_EFF_DATE from bank_statement where tran_id in(SELECT TRAN_ID__STAT FROM BANKRECO_TRACE WHERE TRAN_ID__LOG IN (SELECT TRAN_ID FROM BANKTRAN_LOG WHERE TRAN_SER = ref_ser AND TRAN_NO = ref_id)); RETURN LD_EFF_DATE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_COSTING_RATE_ON_DATE (as_item_code in char, as_rate_option in char, as_excise_option in char, adt_as_on in date ) RETURN number is ls_option char(1); lc_qty number(14,3); lc_rate number(14,3); lc_gross_rate number(14,3); lc_tot_qty number(14,3); lc_tot_val number(14,3); lc_ret_rate number(14,3); lc_tot_gr_rate number(14,3); ldt_rcp_date date; ls_lotno char(15) ; /*--select nvl(quantity,0), nvl(rate,0), nvl(gross_rate ,0) --from stock --where rtrim(item_code) = rtrim(as_item_code) --and quantity > 0 and ltran_date <= adt_as_on --and rtrim(loc_code) NOT IN('INTR', 'EXSH') ; */ cursor c1 is select distinct ddf_inv_clstk_loc(stock.site_code, stock.item_code, stock.lot_no, adt_as_on, 'B', 'YN', stock.loc_code, 'Q',' ' ) qty, nvl(stock.rate,0), nvl(stock.gross_rate ,0) , stock.lot_no from stock , invtrace where stock.site_code = invtrace.site_code and stock.item_code = invtrace.item_code and stock.loc_code = invtrace.loc_code and stock.lot_no = invtrace.lot_no and stock.lot_sl = invtrace.lot_sl and stock.item_code = as_item_code and invtrace.tran_date <= adt_as_on and rtrim(stock.loc_code) NOT IN('INTR', 'EXSH') and ddf_inv_clstk_loc(stock.site_code, stock.item_code, stock.lot_no, adt_as_on, 'B', 'YN', stock.loc_code, 'Q',' ' ) > 0 ; cursor c2 is select last_rcp_date, nvl(quantity,0), nvl(rate,0), nvl(gross_rate ,0) from stock where rtrim(item_code) = rtrim(as_item_code) and rtrim(loc_code) NOT IN('INTR', 'EXSH') and last_rcp_date <= adt_as_on order by last_rcp_date desc; begin ls_option := as_rate_option; if ls_option = 'S' then begin open c1; lc_tot_qty := 0; lc_tot_val := 0; loop fetch c1 into lc_qty, lc_rate, lc_gross_rate, ls_lotno ; exit when c1%NOTFOUND; lc_tot_qty := lc_tot_qty + lc_qty; if as_excise_option = 'I' then lc_tot_val := lc_tot_val + (lc_qty * lc_gross_rate); else lc_tot_val := lc_tot_val + (lc_qty * lc_rate); end if ; end loop; close c1; If lc_tot_val = 0 OR lc_tot_val is null then ls_option := 'R'; else lc_ret_rate := lc_tot_val / lc_tot_qty; end if; EXCEPTION when NO_DATA_FOUND then begin lc_ret_rate := 0; ls_option := 'R'; end; when OTHERS then begin lc_ret_rate := 0; ls_option := 'R'; end; end; end if; -- last receipt rate if ls_option = 'R' then begin Open c2; Fetch c2 into ldt_rcp_date, lc_qty, lc_rate, lc_gross_rate ; if as_excise_option = 'I' then lc_ret_rate := lc_gross_rate; else lc_ret_rate := lc_rate; end if; close c2; EXCEPTION when NO_DATA_FOUND then begin lc_ret_rate := 0; end; when OTHERS then begin lc_ret_rate := 0; end; end; end if; lc_ret_rate := nvl(lc_ret_rate,0); return lc_ret_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BANK_CODE ( ls_emp varchar2 ,ls_period varchar2) return varchar2 is ls_bankcode varchar2 (70) ; begin declare ls_voucher char(10); ls_bank char(10); ls_tranid char(10); ls_flag char(1); ls_stan char(5); ls_descr varchar2(60); begin ls_flag := ' ' ; select voucher_no into ls_voucher from payroll where prd_code = ls_period and emp_code =ls_emp ; begin select distinct tran_id, stan_code into ls_tranid , ls_stan from misc_paydet where vouch_no = ls_voucher and tran_ser = 'P-VOUC' and rownum = 1 order by tran_id desc; EXCEPTION WHEN NO_DATA_FOUND then return ' '; end ; begin select nvl(bank_code,'DUPE') into ls_bank from misc_payment where tran_id = ls_tranid; EXCEPTION WHEN NO_DATA_FOUND then ls_bank:= 'DUPE' ; end ; if length(rtrim(ltrim(ls_bank))) =0 or (ls_bank = 'DUPE') then begin select bank_code, stan_code into ls_bank, ls_stan from employee where emp_code =ls_emp ; ls_flag := '* ' ; EXCEPTION WHEN NO_DATA_FOUND then ls_bank := ' '; ls_stan :=' '; end ; end if ; begin select nvl(drawn_at,' ') into ls_descr from bank_stan_serv where bank_code = ls_bank and stan_code = ls_stan ; EXCEPTION WHEN NO_DATA_FOUND then ls_descr := ' '; end ; return ls_flag||rtrim(ltrim(ls_descr)) ; end ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_DI BEFORE UPDATE of confirmed ON distord_iss referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from porcpdet where tran_id = :tran_id'; OPEN cur_out FOR ls_sql USING :new.tran_id ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'D-ISS' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'D-ISS' and tran_id = :new.tran_id and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESP_DATE ( as_desp_id char) return Date is ldt_desp_date date; begin begin select desp_date into ldt_desp_date from despatch where desp_id = as_desp_id; exception when no_data_found then ldt_desp_date := null; end; return ldt_desp_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_VOUC_TRACE_REF_TRAN ON MISC_VOUCHER_TRACE (REF_SER, TRAN_ID__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE DAILYSALESMASTERTABLE AS TABLE OF DailySalesMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_SITE_DEACTIVE ( as_site_code char) return number is FLAG NUMBER(1); ls_count number(10,0); begin begin ls_count :=0; SELECT INSTR(VAR_VALUE,as_site_code,1) into ls_count FROM DISPARM WHERE var_name='DEACT_SITE'; exception when no_data_found then ls_count :=0; end; if ls_count >0 then return 0; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUPPBNKAC (as_suppcode in supplier.supp_code%type, as_bankcode in bank.bank_code%type) return varchar is ls_retval varchar(40); begin begin select BANK_ACCT_NO__BEN into ls_retval from supplier_bank where supp_code = as_suppcode and BANK_CODE__BEN = as_bankcode; exception when others then ls_retval := ''; end; if ls_retval is null then return ''; end if; RETURN LS_RETVAL; END; -- -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_MULTI_VENDOR_EXIST_BOM ( as_supp_code__mnfr VARCHAR2, as_bom_code CHAR, AS_item_code CHAR, bom_type CHAR ) RETURN NUMBER IS FLAG NUMBER(1); --- change the type of TMP_site_code,as_site_code to site.site_code%type on 25-Nov-2014 --- Start ----- TMP_site_code site.site_code%type; as_site_code site.site_code%type; --- change the type of TMP_site_code,as_site_code to site.site_code%type on 25-Nov-2014 --- end----- site_chk_cnt NUMBER; supp_chk_cnt NUMBER; BEGIN TMP_site_code :='X'; site_chk_cnt :=0; supp_chk_cnt :=0; select LENGTH(TRIM(as_supp_code__mnfr)) INTO supp_chk_cnt from DUAL; IF supp_chk_cnt > 0 THEN --check for validation IF bom_type ='A-BOM' THEN -------FOR ALT BOM TRANSACTION select site_code,LENGTH(SITE_CODE) INTO TMP_site_code,site_chk_cnt from bom where bom_code=as_bom_code; IF site_chk_cnt >0 THEN as_site_code := TMP_site_code; ELSE ---TAKE FROM DISPARM if its not exist in bom SELECT VAR_VALUE INTO as_site_code FROM DISPARM WHERE VAR_NAME='ALT_BOM_SITE'; END IF; ELSE -------FOR BOM TRANSACTION as_site_code := as_bom_code; END IF; --check for validation --CALL THE FUNCTION FUNCTION -- ADD ref series parameter to following FN_CHK_MULTI_VENDOR_EXIST - on 05-Sept-2014 By Manoj Sarode ----- Start ------------- --CALL THE FUNCTION FUNCTION SELECT FN_CHK_MULTI_VENDOR_EXIST(as_supp_code__mnfr,as_site_code,AS_item_code,bom_type) INTO FLAG FROM dual; -- ADD ref series parameter to following FN_CHK_MULTI_VENDOR_EXIST - on 05-Sept-2014 By Manoj Sarode ----- End ------------- RETURN FLAG; else Flag := 1; RETURN flag; END IF; -------- CHECK WHETHER THE ENTRY EXISTS IN ITEM MASTER OR NOT ------------ EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; RETURN flag; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_QC_DATA_RCP (as_site_code in char,as_item_code in char, as_loc_code in char,as_lot_no in char, as_lot_sl in char) return date is ldt_ret_date date; begin select retest_date into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.loc_code = as_loc_code and stock.lot_no = as_lot_no and stock.lot_sl = as_lot_sl; if sqlcode() = 100 and ((as_lot_sl) is null or length(trim(as_lot_sl)) = 0 ) or ((as_loc_code) is null or length(trim(as_loc_code)) = 0) then if (as_lot_sl)is null or length(trim(as_lot_sl)) = 0 then select min(retest_date) into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.loc_code = as_loc_code and stock.lot_no = as_lot_no; elsif (as_loc_code) is null or length(trim(as_loc_code)) = 0 then select min(retest_date) into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.lot_no = as_lot_no and stock.lot_sl = as_lot_sl; elsif (as_loc_code) is null or length(trim(as_loc_code)) = 0 and (as_lot_sl) is null or length(trim(as_lot_sl)) = 0 then select min(retest_date) into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.lot_no = as_lot_no; end if; end if; return ldt_ret_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DEPR_ITEMSER_X ON DEPR_ITEMSER (ITEM_SER, DEPR_METHOD, PURPOSE, EFF_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_WOR_WO ON WORKORDER_RECEIPT (WORK_ORDER, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LOC_DIM_X ON LOCATION_DIM (LOC_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_QCORDDT_VAL ( as_qorder_no in char ) return number is ld_worep_date date; ld_qorder_date date; lc_flag number(1); lc_aprv_lead_time number (5); as_site_code char (10) ; as_item_code char (10) ; begin select qorder_date , site_code , item_code into ld_qorder_date, as_site_code, as_item_code from qc_order where qorder_no = as_qorder_no; select aprv_lead_time into lc_aprv_lead_time from siteitem where site_code = as_site_code and item_code = as_item_code; select tran_date into ld_worep_date from workorder_receipt where tran_id in ( select porcp_no from qc_order where qorder_no = as_qorder_no ) ; ld_worep_date := ld_worep_date + lc_aprv_lead_time ; if( ld_qorder_date < ld_worep_date ) then lc_flag := 1; else lc_flag := 0; end if; return lc_flag; EXCEPTION WHEN NO_DATA_FOUND then return 1; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DATE_DIFF (as_sc_code char, as_sales_pers char, as_date date, as_cust_type char) return number is ls_date date; ls_days number(4); begin if(as_sc_code is not null) then select max(event_date) into ls_date from strg_meet where trim(strg_code)=trim(as_sc_code) and trim(sales_pers)=trim(as_sales_pers) and trim(strg_type)=trim(as_cust_type) and event_date<= as_date; ls_days := (as_date - ls_date); return ls_days; elsif(as_sc_code is null) then return 0; end if; exception when no_data_found then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALIDATE_EMP_IT_PROOF (as_tran_id EMP_ITDECL_HDR.TRAN_ID%TYPE, as_ad_code EMP_ITDECL_DET.AD_CODE%TYPE) return varchar2 is ls_return varchar2(4000); lc_cnt number(5); lc_cnt1 number(5); lc_qtr number(1); MV_IS_ERROR CHAR(1); LS_DECL_TYPE CHAR(1); MV_AD_CODE EMP_ITDECL_PROOF.AD_CODE%TYPE; MV_UDF_STR_1 EMP_ITDECL_PROOF.UDF_STR_1%TYPE; MV_UDF_STR_2 EMP_ITDECL_PROOF.UDF_STR_2%TYPE; MV_UDF_STR_3 EMP_ITDECL_PROOF.UDF_STR_3%TYPE; MV_UDF_STR_4 EMP_ITDECL_PROOF.UDF_STR_4%TYPE; MV_UDF_STR_5 EMP_ITDECL_PROOF.UDF_STR_5%TYPE; MV_UDF_STR_6 EMP_ITDECL_PROOF.UDF_STR_6%TYPE; MV_UDF_DATE_1 EMP_ITDECL_PROOF.UDF_DATE_1%TYPE; MV_UDF_DATE_2 EMP_ITDECL_PROOF.UDF_DATE_2%TYPE; MV_UDF_DATE_3 EMP_ITDECL_PROOF.UDF_DATE_3%TYPE; MV_UDF_NUM_VAL1 EMP_ITDECL_PROOF.UDF_NUM_VAL1%TYPE; MV_UDF_NUM_VAL2 EMP_ITDECL_PROOF.UDF_NUM_VAL2%TYPE; MV_UDF_NUM_VAL3 EMP_ITDECL_PROOF.UDF_NUM_VAL3%TYPE; MV_PROOF_AMOUNT EMP_ITDECL_PROOF.PROOF_AMOUNT%TYPE; LS_CONFIRMED EMP_ITDECL_HDR.CONFIRMED%TYPE; LS_STATUS EMP_ITDECL_HDR.STATUS%TYPE; ld_fr_date acctprd.fr_date%type;--added on 05-jan-2019 ld_to_date acctprd.to_date%type;--added on 05-jan-2019 ls_acct_prd emp_itdecl_hdr.acct_prd%type;--added on 05-jan-2019 CURSOR C_AD_PROOF IS SELECT AD_CODE, UDF_STR_1, UDF_STR_2, UDF_STR_3, UDF_STR_4, UDF_STR_5, UDF_STR_6, udf_date_1, udf_date_2, udf_date_3, udf_num_val1, udf_num_val2, udf_num_val3, udf_num_val4, udf_num_val5, CITY, STATE_CODE, PIN, COUNT_CODE, NVL(PROOF_AMOUNT , 0) AS PROOF_AMOUNT from emp_itdecl_proof where tran_id = as_tran_id and ad_code = as_ad_code; begin mv_ad_code := as_ad_code; MV_PROOF_AMOUNT := 0; lc_cnt := 0; lc_cnt1 := 0; lc_qtr := 0; MV_IS_ERROR := 'N'; if trim(mv_ad_code) IN ('FDSB','IT02D','IT02H','IT02I','IT02J','IT02K','IT02L','IT03D','IT03F','IT07','IT07A','IT07F','IT07G','IT10','IT10C','IT11','IT11B','IT13','IT15','IT18','IT19','IT27A','IT27B','IT27C','IT27D','IT27F','IT27I','IT27K','IT27M','IT2AA') then lc_cnt1 := lc_cnt1 +1; END IF; --SELECT DECL_TYPE,QTR_NO,NVL(CONFIRMED,'N'),NVL(STATUS,'D') INTO LS_DECL_TYPE, LC_QTR, LS_CONFIRMED, LS_STATUS, FROM EMP_ITDECL_HDR WHERE TRAN_ID = AS_TRAN_ID; SELECT DECL_TYPE,QTR_NO,NVL(CONFIRMED,'N'),NVL(STATUS,'D'),acct_prd INTO LS_DECL_TYPE, LC_QTR, LS_CONFIRMED, LS_STATUS, ls_acct_prd FROM EMP_ITDECL_HDR WHERE TRAN_ID = AS_TRAN_ID;--added on 05-jan-2019 --RETURN (LS_DECL_TYPE ||' - ' || LC_QTR); select fr_date, to_date into ld_fr_date, ld_to_date from acctprd where code = ls_acct_prd;--added on 05-jan-2019 IF LS_DECL_TYPE = 'P' THEN IF LS_CONFIRMED = 'Y' AND LC_QTR = 4 THEN RETURN 'Error : Message : ALREADY CONFIRMED! Description : PROOF IS ALREADY CONFIRMED HENCE YOU CAN NOT DO ANY MODIFICATION'; END IF; for i in c_ad_proof LOOP if trim(mv_ad_code) = 'FDSB' then IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR i.udf_date_1 is null or I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 07-jan-2019 I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR i.udf_str_2 is null or length(trim(i.udf_str_2)) = 0 or I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02D' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR i.udf_str_2 is null or length(trim(i.udf_str_2)) = 0 or I.CITY IS NULL OR LENGTH(TRIM(I.CITY)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR (NVL(I.UDF_NUM_VAL1,0) > 8000 AND (I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0)) OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02H' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; elsif trim(mv_ad_code) = 'IT02I' then IF I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02J' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02K' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02L' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT03D' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT03F' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07' THEN IF I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07A' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_5 IS NULL OR LENGTH(TRIM(I.UDF_STR_5)) = 0 OR I.UDF_STR_6 IS NULL OR LENGTH(TRIM(I.UDF_STR_6)) = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR i.udf_date_1 is null or I.CITY IS NULL OR LENGTH(TRIM(I.CITY)) = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07F' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_5 IS NULL OR LENGTH(TRIM(I.UDF_STR_5)) = 0 OR I.UDF_STR_6 IS NULL OR LENGTH(TRIM(I.UDF_STR_6)) = 0 OR i.city is null or length(trim(i.city)) = 0 or i.udf_num_val1 is null or i.udf_num_val1 = 0 or I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.UDF_num_val3 IS NULL OR I.UDF_num_val4 IS NULL OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07G' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or i.udf_num_val1 is null or I.UDF_num_val2 IS NULL OR I.UDF_num_val5 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT10' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT10C' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT11' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT11B' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT13' THEN IF I.UDF_num_val1 IS NULL OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT15' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT18' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT19' THEN IF I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27A' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27B' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR I.UDF_STR_4 IS NULL OR LENGTH(TRIM(I.UDF_STR_4)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.UDF_DATE_2 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27C' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27D' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27F' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 07-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27I' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_5 IS NULL OR LENGTH(TRIM(I.UDF_STR_5)) = 0 OR i.city is null or length(trim(i.city)) = 0 or I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27K' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27M' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_1 NOT BETWEEN LD_FR_DATE AND LD_TO_DATE OR--added on 05-jan-2019 I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT2AA' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; END IF; if mv_is_error = 'Y' then LS_RETURN := 'Error : Message : INVALID PROOF DETAIL Description : INVALID PROOF DETAIL FOR ' || MV_AD_CODE || ' - VALUE NOT ENTERED FOR ALL OR SOME OF MANDATORY FIELDS'; EXIT; END IF; mv_proof_amount := mv_proof_amount + i.proof_amount; end loop; if (mv_is_error is null or mv_is_error <> 'Y') and lc_cnt1 > 0 then lc_cnt := 0; select count(1) into lc_cnt from emp_itdecl_det where tran_id = as_tran_id and ad_code = as_ad_code and CASE WHEN AMOUNT_PROOF < 0 THEN CEIL(AMOUNT_PROOF) ELSE FLOOR(AMOUNT_PROOF) END <> CASE WHEN mv_proof_amount < 0 THEN CEIL(mv_proof_amount) ELSE FLOOR(mv_proof_amount) END; if lc_cnt > 0 then ls_return := 'Error : Message : INVALID PROOF AMOUNT Description : INVALID PROOF AMOUNT FOR ' || mv_ad_code || ' - VALUE NOT MATCHES WITH PROOF DETAIL'; END IF; end if; end if; return ls_return; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_OBSERV_NUMVAL (as_value varchar) return number is ls_end varchar2(500) := as_value; ls_start varchar2(200); lc_value number(14,3) := 0; li_pos number; begin if ls_end is null then return 0; end if; if length(ltrim(rtrim(ls_end))) = 0 then return 0; end if; li_pos := instr(ls_end,'-'); if li_pos = 0 then ls_start := ls_end; ls_end := '0'; else ls_start := substr(ls_end,1,li_pos -1); ls_end := substr(ls_end, li_pos + 1, length(ls_end) - li_pos); end if; lc_value := to_number(ls_end) - to_number(ls_start); return lc_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_BONUS_DED_AMT (as_tran_id char,as_EMP_CODE CHAR,as_FROM_DATE DATE,as_to_date date) return number is DED_AMT number(14,7); begin SELECT ABS(SUM(PAYR_VOUCHDET.AMOUNT)) into ded_amt FROM MISC_PAYDET,PAYR_VOUCHDET,PAYR_VOUCHER,MISC_PAYMENT,BANK,EMPLOYEE EMPLOYEE_A, DEPARTMENT,STATION,SITE,ALLWDEDN WHERE PAYR_VOUCHER.TRAN_ID = PAYR_VOUCHDET.TRAN_ID and ALLWDEDN.AD_CODE = PAYR_VOUCHDET.AD_CODE and misc_paydet.vouch_no(+) = payr_voucher.tran_id and misc_payment.tran_id(+) = misc_paydet.tran_id and misc_payment.bank_code = bank.bank_code(+) and payr_voucher.emp_code = as_EMP_CODE and payr_voucher.bank_code between '00' and 'ZZ' and payr_voucher.pay_mode IN ('T','Q') and payr_voucher.emp_code = employee_a.emp_code and payr_voucher.tran_id=as_tran_id and employee_a.proc_group between '00' and 'ZZ' and employee_a.pay_site = site.site_code(+) and employee_a.dept_code = department.dept_code(+) and employee_a.stan_code__hq = station.stan_code(+) and PAYR_VOUCHER.TRAN_DATE >=as_FROM_DATE AND PAYR_VOUCHER.TRAN_DATE <=as_to_DATE AND PAYR_VOUCHDET.AD_CODE IN ('PER1','PERS' ,'PER2' ,'HOSE','SPLL') AND PAYR_VOUCHER.TRAN_TYPE = 'PRK' and MISC_PAYMENT.CONFIRMED(+) = 'Y' AND PAYR_VOUCHDET.AMOUNT < 0 AND RTRIM( MISC_PAYMENT.TRAN_ID ) || RTRIM( PAYR_VOUCHER.TRAN_ID ) not in (SELECT RTRIM(MISC_PAYMENT_CANC.PAYMENT_NO) || RTRIM(MISC_PAYMENT_CANCDET.VOUCH_NO) FROM MISC_PAYMENT_CANC,MISC_PAYMENT_CANCDET WHERE (MISC_PAYMENT_CANC.TRAN_ID = MISC_PAYMENT_CANCDET.TRAN_ID) AND MISC_PAYMENT_CANC.CONFIRMED = 'Y'); return ded_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RESTR_PRC_DET_X ON RESTR_PRC_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE LOCALITYDARCODEMASTERTABLE AS TABLE OF localityDARCodeMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PAYMENT_EXP_SC BEFORE INSERT OR UPDATE ON payment_exp referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.sundry_type is null then :new.sundry_type := 'O'; end if; if :new.sundry_code is null then :new.sundry_code := ' '; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RCVR_ADDR (as_type varchar2, as_code varchar2) return varchar2 is as_party varchar(500); as_disparm varchar(250); cnt number; begin select count(1) into cnt from disparm where prd_code='999999' and var_name='DRUG_LIC'; if cnt = 1 then select var_value INTO as_disparm from disparm where prd_code='999999'and var_name='DRUG_LIC'; else as_disparm := 'N'; end if; if as_type = 'S' then select nvl(sup.addr1,' ') ||','||nvl(sup.addr2,' ') ||','||nvl(sup.addr3,' ')||','|| chr(10) ||nvl(sup.city,' ')||'-'|| nvl(sup.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')'||','||nvl(c.descr,' ')|| chr(10)||'Phone No :' ||nvl(sup.tele1,' ')||','||nvl(sup.tele2,' ')||','||nvl(sup.tele3,' ')||(CASE WHEN as_disparm='Y' THEN chr(10) ||'D.L.NO.'||nvl(sup.udf_2,' ') ||','||nvl(sup.udf_3,' ') ELSE '' END ) ||chr(10)||'GSTIN Number :' ||nvl(sup.tax_reg_2,' ') into as_party from supplier sup left outer join state st on sup.state_code = st.state_code left outer join country c on sup.count_code = c.count_code where sup.supp_code = as_code; elsif as_type = 'C' then select nvl(cust.addr1,' ')||','||nvl(cust.addr2,' ')||','||nvl(cust.addr3,' ')||','||chr(10)||nvl(cust.city,' ')||'-'|| nvl(cust.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')'||','||nvl(c.descr,' ')|| chr(10)||'Phone No :' ||nvl(cust.tele1,' ')||','||nvl(cust.tele2,' ')||','||nvl(cust.tele3,' ')||(CASE WHEN as_disparm='Y' THEN chr(10) ||'D.L.NO.'||nvl(cust.drug_lic_no,' ') ||','||nvl(cust.drug_lic_no_1,' ')||','||nvl(cust.drug_lic_no_2,' ') ELSE '' END )||chr(10) ||'GSTIN Number :' ||nvl(cust.tax_reg_2,' ') into as_party from customer cust left outer join state st on cust.state_code = st.state_code left outer join country c on cust.count_code = c.count_code where cust.cust_code = as_code; elsif as_type = 'E' then select nvl(emp.cur_add1,' ')||','||nvl(emp.cur_add2,' ')||','||nvl(emp.cur_add3,' ')||','||chr(10)||nvl(emp.cur_city,' ')||'-'|| nvl(emp.cur_pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')'||','||nvl(c.descr,' ')|| chr(10)||'Phone No :' ||nvl(emp.cur_tel1,' ')||','||nvl(emp.cur_tel2,' ')||','||nvl(emp.cur_tel3,' ') into as_party from employee emp left outer join state st on emp.cur_state = st.state_code left outer join country c on st.count_code = c.count_code where emp.emp_code = as_code; elsif as_type = 'T' then select nvl(trans.addr1,' ')||','||nvl(trans.addr2,' ')||','||nvl(trans.addr3,' ')||','||chr(10)||nvl(trans.city,' ')||'-'|| nvl(trans.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')'||','||nvl(c.descr,' ')|| chr(10)||'Phone No :' ||nvl(trans.tele1,' ')||','||nvl(trans.tele2,' ')||','||nvl(trans.tele3,' ')|| chr(10)||'GSTIN Number :' ||nvl(trans.tax_reg_2,' ') into as_party from transporter trans left outer join state st on trans.state_code = st.state_code left outer join country c on trans.count_code = c.count_code where trans.tran_code = as_code; elsif as_type = 'P' then select nvl(sp.addr1,' ')||','||nvl(sp.addr2,' ')||','||nvl(sp.addr3,' ')||','||chr(10)||nvl(sp.city,' ')||'-'|| nvl(sp.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')'||','||nvl(c.descr,' ')|| chr(10)||'Phone No :' ||nvl(sp.tele1,' ')||','||nvl(sp.tele2,' ')||','||nvl(sp.tele3,' ') into as_party from sales_pers sp left outer join state st on sp.state_code = st.state_code left outer join country c on sp.count_code = c.count_code where sp.sales_pers = as_code; elsif as_type = 'X' then select nvl(a.addr1,' ')||','||nvl(a.addr2,' ')||','||nvl(a.addr3,' ')||','||chr(10)||nvl(a.city,' ')||'-'|| nvl(a.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')' ||','||nvl(c.descr,' ')||chr(10)||'Phone No :' ||nvl(a.tele1,' ')||','||nvl(a.tele2,' ')||','||nvl(a.tele3,' ') into as_party from tax_authority a left outer join country c on a.count_code = c.count_code left outer join state st on a.state_code = st.state_code where a.tauth_code = as_code; elsif as_type = 'L' then select nvl(lp.addr1,' ')||','||nvl(lp.addr2,' ')||','||nvl(lp.addr3,' ')||','||chr(10)||nvl(lp.city,' ')||'-'|| nvl(lp.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')' ||','||nvl(c.descr,' ')||chr(10)||'Phone No :' ||nvl(lp.tele1,' ')||','||nvl(lp.tele2,' ')||','||nvl(lp.tele3,' ')|| chr(10)||'GSTIN Number :' ||nvl(lp.tax_reg_2,' ') into as_party from loanparty lp left outer join country c on lp.count_code = c.count_code left outer join state st on lp.state_code = st.state_code where lp.party_code = as_code; elsif as_type = 'R' then select nvl(sc.addr1,' ')||','||nvl(sc.addr2,' ')||','||nvl(sc.addr3,' ')||','||chr(10)||nvl(sc.city,' ')||'-'|| nvl(sc.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')' ||','||nvl(c.descr,' ')||chr(10)||'Phone No :' ||nvl(sc.tele1,' ')||','||nvl(sc.tele2,' ')||','||nvl(sc.tele3,' ')|| chr(10)||'GSTIN Number :' ||nvl(sc.tax_reg_2,' ') into as_party from strg_customer sc left outer join country c on sc.count_code = c.count_code left outer join state st on sc.state_code = st.state_code where sc.sc_code = as_code; elsif as_type = 'B' then select nvl(bk.addr1,' ')||','||nvl(bk.addr2,' ')||','||nvl(bk.addr3,' ')||','||chr(10)||nvl(bk.city,' ')||'-'|| nvl(bk.pin,0)||','||chr(10)||nvl(st.descr,' ')||' ('||nvl(st.gst_code,'') || ')' ||','||nvl(c.descr,' ')||chr(10)||'Phone No :' ||nvl(bk.tele1,' ')||','||nvl(bk.tele2,' ')||','||nvl(bk.tele3,' ')|| chr(10)||'GSTIN Number :' ||nvl(bk.tax_reg_2,' ') into as_party from bank bk left outer join country c on bk.count_code = c.count_code left outer join state st on bk.state_code = st.state_code where bk.bank_code = as_code; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_ATRIAL_CHG_ID ON AUDIT_TRAIL (CHG_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 589824 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETBANKTRANID ( lssitecode in CHAR, lstranser in CHAR, lstranno in CHAR) return varchar2 is ls_tranid VARCHAR2(100); cursor c1 is select tran_id from banktran_log where site_code = lssitecode and (tran_ser = lstranser or tran_ser is null) and tran_no = lstranno ; begin if (lstranser = 'M-RCP' or lsTranSer = 'RCP' or lsTranSer = 'R-DIS' or lsTranSer = 'B' or lsTranSer = 'E-PAY' or lsTranSer = 'M-PAY' or lsTranSer = 'MPCANC') then BEGIN FOR I IN c1 LOOP ls_tranid := ls_tranid || ' ' || rtrim(I.TRAN_ID); END LOOP; END; end if; return LTRIM(ls_tranid); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GIM_UNIT (as_itemcode item.item_code%type) return char is ls_unit item.unit%type ; begin select unit into ls_unit from item where item_code = as_itemcode; return(ls_unit); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION MONTHNAME (ls_date timestamp) return varchar is ls_var varchar(10); begin SELECT TO_CHAR(ls_date,'MON') into ls_var from DUAL; return ls_var; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SECOND_PLAN_APRV (as_emp_code char) return char is EMP_CODE_APRV char(10) ; as_report_to_second char(10); as_report_to_third char(10); a_count number(1); begin select report_to into as_report_to_second from employee where emp_code = (select report_to from employee where trim(emp_code) = trim(as_emp_code) ); SELECT COUNT(*) into a_count FROM EMPLOYEE WHERE trim(EMP_CODE)= trim(as_report_to_second) AND RELIEVE_DATE IS NULL; IF(a_count = 0 )then select report_to into as_report_to_third from employee where trim(emp_code) =trim(as_report_to_second); EMP_CODE_APRV :=as_report_to_third; ELSE EMP_CODE_APRV :=as_report_to_second; end if; return EMP_CODE_APRV; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANDATE_DR (ldate_fr in date,lsite_code in char,lacct_code in char) return NUMBER is lc_day_op_bal NUMBER(16,3); lc_prd_op_bal NUMBER(16,3); ls_prd char(6); ls_acctprd char(6); ls_fent char(10); mfr_date date; begin select acct_prd, code, fr_date into ls_acctprd, ls_prd, mfr_date from period where ldate_fr between fr_date and to_date; select fin_entity into ls_fent from site where site_code = lsite_code; select NVL(sum(dr_amt__base),0) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and site_code = lsite_code and acct_code = lacct_code; -- lc_prd_op_bal:= nvl(lc_prd_op_bal,0); Select NVL(Sum(dr_amt),0) into lc_day_op_bal from gltran where site_code= lsite_code and tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code ; --lc_day_op_bal := nvl(lc_day_op_bal,0); lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WIPAMT ( as_site varchar2,as_item varchar2) return number is l_amt decimal(12,2); begin select case when sum(( workorder.YIELD_PERC * workorder.CURRENT_BATCH_QTY/100) -workorder.QUANTITY__RCVD) < 0 then 0 else (case when MAX(workorder.STATUS) ='R' or MAX(workorder.STATUS) ='F'then sum(( workorder.YIELD_PERC * workorder.CURRENT_BATCH_QTY/100) -workorder.QUANTITY__RCVD) else 0 end ) end into l_amt from workorder where workorder.site_code = as_site and workorder.item_code = as_item and workorder.STATUS IN ('R','F') ; return l_amt ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LOANS_SHCEME_EMP ON LOANS (SCHEME_NO, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_DED (as_taxcode in char, as_tranid in char, as_lineno in char) return number is lded_val number(14,3):=0; ls_qc_order char(10); ls_item_code char(10); ls_spec_ref char(15); ls_purcorder char(10); ls_flg char(1) ; ls_app_ded char(1); ll_actual_result number(14,3) :=0 ; ll_noart number(6,0) :=0; cursor c_ded_mtd is select apply_ded from qcitem_spec_det where qcitem_spec_det.item_code = ls_item_code and qcitem_spec_det.spec_ref = ls_spec_ref ; begin begin begin select no_art,purc_order into ll_noart,ls_purcorder from porcpdet where tran_id = as_tranid and line_no = as_lineno ; exception when no_data_found then lded_val :=0; end; begin select udf_str__1 into ls_flg from porder where purc_order = ls_purcorder; exception when no_data_found then lded_val :=0; end; begin select qorder_no,item_code, spec_ref into ls_qc_order ,ls_item_code, ls_spec_ref from qc_order where porcp_no = as_tranid and porcp_line_no = as_lineno ; select to_number(actual_result) into ll_actual_result from qc_ord_spec where qc_ord_spec.qorder_no = ls_qc_order and qc_ord_spec.spec_code = as_taxcode ; exception when no_data_found then lded_val :=0; end; open c_ded_mtd ; LOOP fetch c_ded_mtd into ls_app_ded; EXIT WHEN (c_ded_mtd%NOTFOUND) ; -- if ls_app_ded = 'N' then -- ls_flg := 'N' ; -- EXIT; -- else -- ls_flg := 'Y' ; -- end if ; END LOOP ; CLOSE c_ded_mtd ; begin select apply_ded into ls_app_ded from qcitem_spec_det where qcitem_spec_det.item_code= ls_item_code and qcitem_spec_det.spec_ref= ls_spec_ref and qcitem_spec_det.spec_code= as_taxcode ; exception when no_data_found then lded_val :=0; end; -- ll_actual_result := ll_actual_result/1000 ; ll_actual_result := ll_actual_result ; if as_taxcode = 'MATTI' and ll_actual_result >= 0.701 and ll_actual_result <= 1.400 and ls_app_ded = 'Y' and ls_flg = 'Y' then lded_val := ll_noart * (ll_actual_result * 0.5 - 0.350) ; end if; if as_taxcode = 'MATTI' and ll_actual_result >= 1.001 and ll_actual_result <= 1.400 and ls_app_ded = 'Y' and ls_flg = 'N' then lded_val := ll_noart * (ll_actual_result * 0.5 - 0.500) ; end if; if as_taxcode = 'MATTI' and ll_actual_result >= 1.401 and ll_actual_result <= 25.00 and ls_app_ded = 'Y' then lded_val := ll_noart * ll_actual_result * 0.5 ; end if; if as_taxcode = 'FOTRI' and ls_app_ded = 'Y' then lded_val := ll_noart * ll_actual_result ; elsif as_taxcode = 'FOTRI' and ls_app_ded = 'N' then lded_val := 0 ; end if; if as_taxcode = 'DAMAG' and ls_app_ded = 'Y' then lded_val := ll_noart * ll_actual_result ; elsif as_taxcode = 'DAMAG' and ls_app_ded = 'N' then lded_val := 0 ; end if; if as_taxcode = 'WTDIF' and ls_app_ded = 'Y' then lded_val := ll_noart * ll_actual_result ; elsif as_taxcode = 'WTDIF' and ls_app_ded = 'N' then lded_val := 0 ; end if; if as_taxcode = 'DSEED' and ls_app_ded = 'Y' then lded_val := ll_noart * ll_actual_result ; elsif as_taxcode = 'DSEED' and ls_app_ded = 'N' then lded_val := 0 ; end if; if as_taxcode = 'BARD' and ls_app_ded = 'Y' then lded_val := ll_noart * ll_actual_result ; elsif as_taxcode = 'BARD' and ls_app_ded = 'N' then lded_val := 0 ; end if; exception when no_data_found then lded_val :=0; when others then lded_val :=0; end; return nvl(lded_val,0); exception when no_data_found then lded_val :=0; when others then lded_val :=0; return nvl(lded_val,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INCIDENT_INCIDENT_DATE ON INCIDENT (INCIDENT_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DELETE_AUDIT_TABLE (mseq_no number) is ctr number; maxseqno varchar2(15); curtim varchar2(50); cursor c1 is select seq_no from audit_table where seq_no = mseq_no; begin select to_char(sysdate,'ddmmyyyy hh24:mi:ss') into curtim from dual; dbms_output.put_line('Deleting for Seq_no : '||mseq_no||' started at : '||curtim); ctr := 0; for m2 in c1 loop maxseqno := m2.seq_no; if ctr = 0 then dbms_output.put_line('First No : '||m2.seq_no); end if; set transaction use rollback segment rb_temp; delete from audit_table where seq_no = m2.seq_no; delete from audit_table_values where seq_no = m2.seq_no and col_name like '%'; commit; ctr := ctr + 1; if mod(ctr,250) = 0 then select to_char(sysdate,'ddmmyyyy hh24:mi:ss') into curtim from dual; dbms_output.put_line(to_char(ctr)||' records deleted at : '||curtim); end if; end loop; dbms_output.put_line('Last no : '||maxseqno); select to_char(sysdate,'ddmmyyyy hh24:mi:ss') into curtim from dual; dbms_output.put_line(to_char(ctr)||' records deleted at : '||curtim); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ESIBASE (EMP_CD VARCHAR2, BASE_PRD VARCHAR2, CURR_PRD VARCHAR2, PROC_TYPE VARCHAR2) RETURN NUMBER IS LC_RET NUMBER(14,2); BEGIN DECLARE LC_BASE1 NUMBER(14,2); LC_BASE2 NUMBER(14,2); LC_BASE3 NUMBER(14,2); ls_adcode char(5); BEGIN LC_BASE1 := 0; LC_BASE2 := 0; LC_BASE3 := 0; LC_RET := 0; select MIN(NVL(a.amount,0)) into LC_BASE3 from payroll_projdet a where a.emp_code = EMP_CD and a.prd_code between BASE_PRD and CURR_PRD and a.ad_code ='XESSL' and nvl(a.amount,0) > 0 ; LC_RET := LC_BASE3; RETURN LC_RET; END; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_PICK_RATE ( as_price_list char, ad_tran_date date,as_item_code char, as_lot_no char,as_type char,ac_qty number) return number is ld_rate number(14,3) ; ctr number(14,3) ; ls_var_value char(100); ls_var_value1 char(100); begin if as_type = 'L' then select rate into ld_rate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty; elsif as_type ='B' then ld_rate := 0 ; select rate into ld_rate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty; elsif as_type ='MRP' then ld_rate := 0 ; select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = as_type; select rate into ld_rate from pricelist where price_list = ls_var_value and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif as_type ='EXC' then ld_rate := 0 ; select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = as_type; select rate into ld_rate from pricelist where price_list = ls_var_value and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif as_type ='PTR' then ld_rate := 0 ; select udf_str1 into ls_var_value from gencodes where fld_name = 'PRICE_LIST' and fld_value = as_price_list; select count(*) into ctr from pricelist where price_list = ls_var_value and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; if ctr = 1 then select rate into ld_rate from pricelist where price_list = ls_var_value and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; else select price_list__parent into ls_var_value1 from pricelist_mst_det where price_list__tar = ls_var_value and rownum = 1; select rate into ld_rate from pricelist where price_list = ls_var_value1 and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; end if; IF ld_rate IS NOT NULL OR ld_rate<>0 THEN return ld_rate ; ELSE ld_rate := 0 ; return ld_rate ; END IF; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_INT_RATE (AS_CRTERM IN VARCHAR2,AL_NO_DAYS IN NUMBER,AC_AMOUNT IN DECIMAL,AD_TRAN IN DATE) RETURN NUMBER IS LC_INTRATE DECIMAL(5,2); lc_finchg decimal(14,3); ls_type varchar2(20); BEGIN select fin_chg, fchg_type into lc_finchg, ls_type from crtermfc where cr_term = as_crterm and al_no_days >= min_day and al_no_days <= max_day and ac_amount >= min_cramt and ac_amount <= max_cramt and ad_tran >= eff_date and ad_tran <= valid_upto; if ls_type = 'P' then lc_intrate := lc_finchg ; ELSE RETURN -1 ; END IF; RETURN LC_INTRATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPTRANS_DATE ON EMPTRANSFER (EMP_CODE, TRANS_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_QC_NO_STATUS (as_rcp_no char,ls_flag char) return varchar2 is as_tran_ret varchar2(2000); as_qc_order_no varchar2(2000); as_qc_order_status varchar2(500); as_qc_order_no1 varchar2(2000); as_qc_order_status1 varchar2(500); cursor c1 is select qorder_no,status from qc_order where porcp_no=as_rcp_no; begin open c1; loop fetch c1 into as_qc_order_no,as_qc_order_status; exit when c1%notfound; as_qc_order_no1 := as_qc_order_no1||as_qc_order_no||' , '; as_qc_order_status1 := as_qc_order_status1||as_qc_order_status||' , '; end loop; close c1; if ls_flag = 'N' then as_tran_ret := as_qc_order_no1; elsif ls_flag = 'S' then as_tran_ret := as_qc_order_status1; end if; if as_tran_ret is null then as_tran_ret := ' '; end if; return as_tran_ret ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITEMFG_ITEMLOTPACK ( M_ITEM_CODE INVOICE_TRACE.ITEM_CODE%TYPE, M_LOT_NO INVOICE_TRACE.LOT_NO%TYPE ) RETURN CHAR IS M_SITEMFG VARCHAR2(5); CTR NUMBER := 0; BEGIN SELECT COUNT(SITE_CODE__MFG) INTO CTR FROM ITEM_LOT_PACKSIZE WHERE ITEM_CODE = M_ITEM_CODE AND M_LOT_NO BETWEEN LOT_NO__FROM AND LOT_NO__TO; IF CTR = 0 THEN M_SITEMFG := 'NOAVL'; ELSIF CTR > 0 THEN SELECT MAX(SITE_CODE__MFG) INTO M_SITEMFG FROM ITEM_LOT_PACKSIZE WHERE ITEM_CODE = M_ITEM_CODE AND M_LOT_NO BETWEEN LOT_NO__FROM AND LOT_NO__TO; END IF; RETURN M_SITEMFG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SUPPLY_SITES_X ON SUPPLY_SITES (SITE_CODE, SITE_CODE__SUPP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083611 ON DWH_PURCHASE (RECEIPT_NO, ITEM_CODE, LOT_NO, LOT_SL, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANDATE_CR (ldate_fr in date,lsite_code in char,lacct_code in char) return NUMBER is lc_day_op_bal NUMBER(16,3); lc_prd_op_bal NUMBER(16,3); ls_prd char(6); ls_acctprd char(6); ls_fent char(10); mfr_date date; begin select acct_prd, code, fr_date into ls_acctprd, ls_prd, mfr_date from period where ldate_fr between fr_date and to_date; select fin_entity into ls_fent from site where site_code = lsite_code; select NVL(sum(cr_amt__base),0) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and site_code = lsite_code and acct_code = lacct_code; -- lc_prd_op_bal:= nvl(lc_prd_op_bal,0); Select NVL(Sum(cr_amt),0) into lc_day_op_bal from gltran where site_code= lsite_code and tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code ; --lc_day_op_bal := nvl(lc_day_op_bal,0); lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_DWH_PROD ON DWH_PRODUCTION (SITE_CODE__MFG, WORK_ORDER_STATUS, BOM_SUB_TYPE, WO_RELEASE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IDX_MAT_STAGEPLAN ON MAT_STAGE_PLAN (ITEM_CODE, DESCR, PRD_CODE__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROCESS_MTH__DET_X ON PROCESS_MTH_DET (PROC_MTH, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SPECIALITY_DESCR ON SPECIALITY (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PALLETMERGE_DET_X ON PALLETMERGE_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCISE_EXPORT (as_tran_code taxtran.tran_code%type,as_tran_id taxtran.tran_id%type) return number is lc_duty number; ls_string varchar(1000); ls_var varchar(1000); begin SELECT sum (case when tax_amt is null then 0 else tax_amt end) INTO lc_duty FROM taxtran WHERE ( tran_code = as_tran_code ) AND ( tran_id = as_tran_id ) AND INSTR((DDF_GET_DISPARM_VALUE('EXC_TAX_CODE','999999')),trim(taxtran.tax_code)) > 0 ; return lc_duty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDITEM_DUEDT_SORD_QTYALLOC ON SORDITEM (DUE_DATE, SALE_ORDER, QTY_ALLOC) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER QC_ORDER_LOTS_QC BEFORE INSERT OR UPDATE ON QC_ORDER_LOTS FOR EACH ROW BEGIN :NEW.qc_order := :new.qorder_no; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RFREQ_OF_VISIT ( P_SALES_PERS CHAR, P_STRG_CODE CHAR, P_MONTH VARCHAR2, P_YEAR VARCHAR2 ) RETURN NUMBER IS V_COUNT NUMBER ; BEGIN select NVL(count(*),0) as frequency_of_visit INTO V_COUNT from strg_meet sm where sm.event_date between trunc(to_date(P_MONTH||P_YEAR,'MONYYYY'),'MON') AND last_day(to_date(P_MONTH ||P_YEAR,'MONYYYY')) and sm.strg_code=P_STRG_CODE AND SM.SALES_PERS=P_SALES_PERS ; RETURN V_COUNT; END FN_RFREQ_OF_VISIT; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ASSET_TRFEMP_X ON ASSET_TRFEMP (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CONSUMED_AMT (as_tran_code in char,as_tran_id in char,as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_flag in char) return number is ac_con_amt number(14,3); ld_tran_date date; ls_var_value char(30); ls_fin_ent char(10); ll_count number(3); begin if as_tran_code = 'M-VOUC' then select tran_date,substr(site_code,1,2) into ld_tran_date,ls_fin_ent from misc_voucher where tran_id = as_tran_id; else select tran_date,substr(site_code,1,2) into ld_tran_date,ls_fin_ent from voucher where tran_id = as_tran_id; end if ; if ld_tran_date is null then ac_con_amt := -1; return ac_con_amt; end if; select var_value into ls_var_value from finparm where var_name = 'ACTIVE_BUDGET'; if ls_var_value is null then ac_con_amt := -1; return ac_con_amt; end if; select count(*) into ll_count from budgets where budget_id = ls_var_value; if ll_count <> 1 then ac_con_amt := -1; return ac_con_amt; end if; begin if ltrim(rtrim(as_flag)) = 'A' then select con_amt into ac_con_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code and anal_code = as_anal_code; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; else select SUM(con_amt) into ac_con_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code ; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; end if; EXCEPTION WHEN NO_DATA_FOUND then ac_con_amt := 0; return ac_con_amt; end; return ac_con_amt; EXCEPTION WHEN NO_DATA_FOUND then ac_con_amt := -1; return ac_con_amt; end ddf_get_consumed_amt; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCISE_TAX_PERC (as_tran_id taxtran.tran_id%type, as_line_no taxtran.line_no%type , as_tran_code taxtran.tran_code%type , as_tax_code taxtran.tax_code%type ) return decimal is ldec_excise taxtran.tax_perc%type; begin select nvl(tax_perc,0) into ldec_excise from taxtran where tran_id = as_tran_id and trim(line_no) = as_line_no /*Trim used as value contains space at lne no and tax code column in database*/ and tran_code = as_tran_code and trim(tax_code) like as_tax_code; return ldec_excise; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EPCG_HDR_X1 ON EPCG_HDR (FILE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EPCG_HDR_X2 ON EPCG_HDR (LICENCE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE FIELDACTIVITYPOPHELP AS FUNCTION getfieldactivitypophelpData (empCode in char) RETURN FIELDACTIVITYMASTERTABLE PIPELINED; END fieldactivitypophelp; CREATE OR REPLACE PACKAGE BODY FIELDACTIVITYPOPHELP AS FUNCTION getfieldactivitypophelpData (empCode in char) RETURN FIELDACTIVITYMASTERTABLE PIPELINED IS ls_parm_value varchar2(30); BEGIN SELECT GET_SFAPARM_DATA('IS_FORTUNE_ACTIVITY',empCode) INTO ls_parm_value FROM DUAL; if (ls_parm_value = 'Y') THEN for x in( SELECT DISTINCT(FA.PARENT_ACT_CODE) AS ACTIVITY_CODE, FA.DESCR AS ACTIVITY_DESCR, FA.ACTIVITY_TYPE AS ACTIVITY_TYPE FROM FIELDACTIVITY FA WHERE FA.STATUS = 'Y' AND FA.ACTIVITY_TYPE NOT IN ('PR') AND FA.ACTIVITY_CODE NOT IN ('JW') AND FA.ACTIVITY_SEL NOT IN('S') OR FA.ACTIVITY_SEL IS NULL AND FA.PARENT_ACT_CODE=FA.ACTIVITY_CODE AND PARENT_ACT_CODE IS NOT NULL AND (FA.ITEM_SER='ALL' OR (SELECT ITEM_SER FROM SALES_PERS WHERE SALES_PERS = empCode ) IN(SELECT regexp_substr( ITEM_SER,'[^,]+', 1, LEVEL) FROM dual CONNECT BY regexp_substr(ITEM_SER, '[^,]+', 1, LEVEL) IS NOT NULL ) ) order by FA.DESCR,FA.PARENT_ACT_CODE ) LOOP PIPE ROW (FIELDACTIVITYMASTER(X.ACTIVITY_CODE, X.ACTIVITY_DESCR, X.ACTIVITY_TYPE)); END LOOP; RETURN; END IF; if (ls_parm_value = 'N') THEN for x in( SELECT FA.ACTIVITY_CODE AS ACTIVITY_CODE, FA.DESCR AS ACTIVITY_DESCR, FA.ACTIVITY_TYPE AS ACTIVITY_TYPE FROM FIELDACTIVITY FA WHERE FA.STATUS = 'Y' AND FA.ACTIVITY_TYPE NOT IN ('PR') AND FA.ACTIVITY_CODE NOT IN ('JW') AND FA.ACTIVITY_SEL NOT IN('S') OR FA.ACTIVITY_SEL IS NULL AND (FA.ITEM_SER='ALL' OR (SELECT ITEM_SER FROM SALES_PERS WHERE SALES_PERS = empCode) IN(SELECT regexp_substr( ITEM_SER,'[^,]+', 1, LEVEL) FROM dual CONNECT BY regexp_substr(ITEM_SER, '[^,]+', 1, LEVEL) IS NOT NULL ) ) order by FA.DESCR,FA.ACTIVITY_CODE ) LOOP PIPE ROW (FIELDACTIVITYMASTER(X.ACTIVITY_CODE, X.ACTIVITY_DESCR, X.ACTIVITY_TYPE)); END LOOP; RETURN; END IF; end; END fieldactivitypophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONSUME_ISS_DATE ON CONSUME_ISS (ISSUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QC_STABILITY_HDR_X ON QC_STABILITY_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_MANUAL_STOCK_ALLOC (SI_SALE_ORDER IN CHAR, SI_LINE_NO IN CHAR ) RETURN number is FLAG number ; CNT NUMBER; CNT1 NUMBER; BEGIN BEGIN SELECT count(*) INTO CNT FROM SORDALLOC WHERE SALE_ORDER = SI_SALE_ORDER AND LINE_NO = SI_LINE_NO; IF (CNT > 0 ) THEN SELECT count(*) INTO CNT1 FROM SORDALLOC WHERE SALE_ORDER = SI_SALE_ORDER AND LINE_NO = SI_LINE_NO AND (CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END) = 'Y'; IF( CNT1 >0 ) THEN FLAG := 1; ELSE FLAG := 0 ; END IF; ELSE FLAG :=3; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG :=2; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_PATCH_DRYBASIS (mdrug_per_patch in number, mnon_volatile_mass_form in number, mexpr_process_size in number, mtot_non_volatile_mass_form in number, massay_drybasis in number, mlod in number) return number is mpotency number(14,6) := 0; begin -- if any independent value in the denominator is ZERO, Potency Adjusted will be set as ZERO if (mtot_non_volatile_mass_form = 0 or massay_drybasis = 0) then mpotency := 0; else mpotency := round( (mdrug_per_patch * (mnon_volatile_mass_form /100) * mexpr_process_size * 100 * 100) / (mtot_non_volatile_mass_form * 100 * massay_drybasis * (100 - mlod) ), 6); end if; return mpotency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION INT_NUM2WORD_21 (val in number,CURR IN VARCHAR) return varchar2 is amt number; strt number; str varchar2(17); ls_dec_unit varchar(10); ls_currency varchar(50); c_str varchar2(400); flag number:=0; begin amt:=floor(val); str:=to_char(amt); ls_dec_unit:=' '; ls_currency :=' ' ; select nvl(dec_unit,'Cents') into ls_dec_unit from currency where TRIM(curr_code)=TRIM(curr); select nvl(descr,'US DOLLAR') into ls_currency from currency where TRIM(curr_code)=TRIM(curr); if val > 0 then if length(str) >= 16 and length(str) <=17 then strt:=(length(str)-15); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Million ' ; amt:=to_number(substr(to_char(amt),(strt+1),15)); flag:=1; end if; str:=to_char(amt); if length(str) >= 10 and length(str) <=15 then strt:=(length(str)-9); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Billion ' ; amt:=to_number(substr(to_char(amt),(strt+1),9)); flag:=1; end if; str:=to_char(amt); if length(str) =9 then strt:=(length(str)-8); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Hundred '; amt:=to_number(substr(to_char(amt),(strt+1),8)); flag:=1; end if; str:=to_char(amt); if length(str) = 8 then strt:=(length(str)-6); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Million ' ; amt:=to_number(substr(to_char(amt),(strt+1),6)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 7 ) or flag = 1) then c_str:=c_str || (spell(amt)) ; end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := ls_currency || ' ' || LOWER(c_str) || ' and ' || lower(spell(amt)) || ' ' || ls_dec_unit; else c_str := ls_currency || ' ' || LOWER(c_str) || ' Only'; end if; c_str:=replace(c_Str,'-',' '); return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083677 ON EXT_DB_CONNECTION (DB_CONN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_TEST --return VARCHAR2 is v_out VARCHAR2(4000); begin v_out:=''; BEGIN for r_lotno in ( SELECT distinct(INV_HOLD_DET.LOT_NO) as lot_no FROM INV_HOLD_REL_DET INV_HOLD_REL_DET,INV_HOLD_DET INV_HOLD_DET, ITEM ITEM,LOCATION LOCATION,INV_HOLD INV_HOLD WHERE (INV_HOLD.TRAN_ID=INV_HOLD_DET.TRAN_ID) AND ( INV_HOLD_REL_DET.TRAN_ID__HOLD = INV_HOLD.TRAN_ID ) AND ( INV_HOLD_REL_DET.LINE_NO__HOLD = INV_HOLD_DET.LINE_NO ) AND ( INV_HOLD_DET.ITEM_CODE = ITEM.ITEM_CODE(+) ) AND INV_HOLD_REL_DET.TRAN_ID = 'PF0008') loop DBMS_OUTPUT.PUT_LINE('v_out BEFORE ' || v_out); IF length(trim(v_out)) > 0 THEN v_out := v_out || ',' || r_lotno.lot_no; ELSE v_out := r_lotno.lot_no; END IF; DBMS_OUTPUT.PUT_LINE('v_out AFTER ' || v_out); end loop; EXCEPTION WHEN OTHERS THEN v_out := 'eXCEPTION'; END; --RETURN v_out; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISC_PAYABLES_PO_CHK BEFORE INSERT ON MISC_PAYABLES referencing old as old new as new FOR EACH ROW declare ls_msg varchar2(100); begin if ((trim(:new.tran_ser) = 'P-ADV' or trim(:new.tran_ser) = 'VOUCH') and (:new.purc_order is null or length(trim(:new.purc_order)) = 0) ) then ls_msg := ' tran series: ' || :new.tran_ser || ' refference no: ' || :new.ref_no; raise_application_error( -20601, 'PO number can not be blank in purchase advance/voucher payables ' || ls_msg); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AR_HISTORY ( Vi_Status In Char, Vi_Auth_Sign In Char, Vi_Wrkflw_Status In Char, Vi_Tran_Id_1 In attd_regularize.tran_id%type, vi_for_history in char, vi_for_emp in char) Return Varchar2 Is History_Descr Varchar2(1000); Vi_Use_Flag Char(1); -- Vi_Status char(1); Vi_EMP_CODE attd_regularize.emp_code%type; --Added by Nikhil sign_date VARCHAR2(10); ls_emp_fname VARCHAR2(15); ls_emp_mname VARCHAR2(15); ls_emp_lname VARCHAR2(15); historyFormat VARCHAR2(1000); empCode attd_regularize.emp_code%type; fullName VARCHAR2(50); signStatus CHAR(1); reportTo attd_regularize.emp_code%type; reportToAdmin attd_regularize.emp_code%type; reportToFullName VARCHAR2(200); reportToAdminFullName VARCHAR2(200); counter number; BEGIN Begin Select EMP_CODE, report_to, report_to__admin Into Vi_EMP_CODE, reportto, reportToAdmin From attd_regularize Where Tran_Id = Vi_Tran_Id_1; select case when emp_fname is null then '' else trim(emp_fname) end , case when emp_mname is null then '' else emp_mname end, case when emp_lname is null then '' else emp_lname end into ls_emp_fname, ls_emp_mname, ls_emp_lname from employee where emp_code=reportto; reportToFullName := ls_emp_fname || ' ' || ls_emp_mname || ' ' || ls_emp_lname; ls_emp_fname := ''; ls_emp_mname := ''; ls_emp_lname := ''; select case when emp_fname is null then '' else trim(emp_fname) end , case when emp_mname is null then '' else emp_mname end, case when emp_lname is null then '' else emp_lname end into ls_emp_fname, ls_emp_mname, ls_emp_lname from employee where emp_code=reporttoadmin; reportToAdminFullName := ls_emp_fname || ' ' || ls_emp_mname || ' ' || ls_emp_lname; -- For field employee if(vi_for_emp = 'E') then ------------Recommender History-------------------------------- if(Vi_For_History = 'R') then if (vi_status = 'C' and Vi_Wrkflw_Status='X') then historyFormat := 'Cancelled by Employee' ; History_Descr := historyFormat ; return History_Descr; end if; Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = trim(Vi_Tran_Id_1) And Role_Code__Sign = 'AR_RE_SIGN' ; --AND EMP_CODE IS NOT NULL; if(counter>0) then Select Sign_Remarks,emp_code, sign_date, sign_status Into History_Descr, empCode, sign_date,signStatus From ( Select case when Sign_Remarks is null then '' else Sign_Remarks end as Sign_Remarks, emp_code as emp_code, sign_date as sign_date, sign_status as sign_status From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = trim(Vi_Tran_Id_1) And Role_Code__Sign = 'AR_RE_SIGN' order by line_no desc ) a where rownum = 1; if(signStatus='U') then historyFormat := case when Vi_Wrkflw_Status='X' then 'Cancelled by Employee' else 'Awaiting Approval from ' || reportToFullName end ; History_Descr := historyFormat ; elsif(signStatus='S') then select case when emp_fname is null then '' else trim(emp_fname) end , case when emp_mname is null then '' else emp_mname end, case when emp_lname is null then '' else emp_lname end into ls_emp_fname, ls_emp_mname, ls_emp_lname from employee where emp_code=empCode ; fullName := ls_emp_fname || ' ' || ls_emp_mname || ' ' || ls_emp_lname; historyFormat := case when Vi_Wrkflw_Status='X' and (empCode is null or trim(empCode) is null or length(trim(empcode)) = 0) then 'Cancelled by Employee' else 'Approved by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || History_Descr end ; History_Descr := historyFormat ; elsif(signStatus='R') then select case when emp_fname is null then '' else trim(emp_fname) end , case when emp_mname is null then '' else emp_mname end, case when emp_lname is null then '' else emp_lname end into ls_emp_fname, ls_emp_mname, ls_emp_lname from employee where emp_code=empCode ; fullName := ls_emp_fname || ' ' || ls_emp_mname || ' ' || ls_emp_lname; historyFormat := 'Rejected by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || History_Descr; History_Descr := historyFormat ; end if; elsif(counter=0) then if(Vi_For_History = 'R' AND Vi_Auth_Sign='R' AND Vi_Wrkflw_Status='O' ) then historyFormat := 'Awaiting Approval from ' || reportToFullName; History_Descr := historyFormat ; elsif(Vi_For_History = 'R' AND Vi_Auth_Sign='R' AND Vi_Wrkflw_Status='X') then historyFormat := 'Cancelled by Employee'; History_Descr := historyFormat ; end if; end if; History_Descr := History_Descr ; ------------Approver History-------------------------------- elsif(Vi_For_History = 'A') then if (vi_status = 'C' and Vi_Wrkflw_Status='X') then return ''; end if; Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = trim(Vi_Tran_Id_1) And Role_Code__Sign = 'AR_AP_SIGN' ; --AND EMP_CODE IS NOT NULL; if(counter>0) then Select sign_remarks, emp_code, sign_date, sign_status Into History_Descr, empCode, sign_date, signStatus From ( Select case when Sign_Remarks is null then '' else sign_remarks end as sign_remarks, emp_code as emp_code, sign_date as sign_date, sign_status as sign_status From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = trim(Vi_Tran_Id_1) And Role_Code__Sign = 'AR_AP_SIGN' order by line_no desc ) a where rownum = 1; if(signStatus='U') then historyFormat := case when Vi_Wrkflw_Status='X' then 'Cancelled by Employee' else 'Awaiting Approval from ' || reportToAdminFullName end; History_Descr := historyFormat ; elsif(signStatus='S') then select case when emp_fname is null then '' else trim(emp_fname) end , case when emp_mname is null then '' else emp_mname end, case when emp_lname is null then '' else emp_lname end into ls_emp_fname, ls_emp_mname, ls_emp_lname from employee where emp_code=empCode ; fullName := ls_emp_fname || ' ' || ls_emp_mname || ' ' || ls_emp_lname; historyFormat := case when Vi_Wrkflw_Status='X' and (empCode is null or trim(empCode) is null or length(trim(empcode)) = 0) then 'Cancelled by Employee' else 'Approved by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || History_Descr end; History_Descr := historyFormat ; elsif(signStatus='R') then select case when emp_fname is null then '' else trim(emp_fname) end , case when emp_mname is null then '' else emp_mname end, case when emp_lname is null then '' else emp_lname end into ls_emp_fname, ls_emp_mname, ls_emp_lname from employee where emp_code=empCode ; fullName := ls_emp_fname || ' ' || ls_emp_mname || ' ' || ls_emp_lname; historyFormat := 'Rejected by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || History_Descr; History_Descr := historyFormat ; end if; elsif(counter=0) then if(Vi_For_History = 'A' AND Vi_Auth_Sign='R' AND Vi_Wrkflw_Status='O' ) then historyFormat := ' '; History_Descr := historyFormat ; elsif(Vi_For_History = 'A' AND Vi_Auth_Sign='A' AND Vi_Wrkflw_Status='O' ) then historyFormat := 'Awaiting Approval from ' || reportToAdminFullName; History_Descr := historyFormat ; elsif(Vi_For_History = 'A' AND Vi_Auth_Sign='R' AND Vi_Wrkflw_Status='X') then historyFormat := 'Cancelled by Employee'; History_Descr := historyFormat ; elsif(Vi_For_History = 'A' AND Vi_Auth_Sign='A' AND Vi_Wrkflw_Status='X')then historyFormat := 'Cancelled by Employee'; History_Descr := historyFormat ; elsif(Vi_For_History = 'A' AND Vi_Auth_Sign='R' AND Vi_Wrkflw_Status='R' and Vi_Status='C' ) then -- Modified by Piyush on 24/12/2014.Start -- historyFormat := 'Cancelled by Recomendor'; -- History_Descr := historyFormat ; historyFormat := ' '; History_Descr := historyFormat ; -- Modified by Piyush on 24/12/2014.End end if; end if; History_Descr := History_Descr ; -- elsif(Vi_For_History = 'H') then -- History_Descr := History_Descr || ' ' || reportToAdminFullName; end if; end if; EXCEPTION When No_Data_Found Then HISTORY_DESCR :=' '; END; RETURN HISTORY_DESCR; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDSTAX_CHNO (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_str varchar2(200) ; ls_chq_no varchar2(50); ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ctr number(3); cursor c1 is select DISTINCT NVL(MISC_PAYMENT.REF_NO,' '), nvl(misc_payment.HANDOVER_CHNO,''), nvl(misc_payment.BANK_CODE__TAX,''), nvl(misc_payment.TOKEN_NO,'') from misc_paydet,misc_payment where misc_paydet.tran_id = misc_payment.tran_id and misc_paydet.tran_ser = 'M-VOUC' and misc_paydet.vouch_no in (select misc_voucher_trace.tran_id from misc_voucher_trace ,TAX where misc_voucher_trace.TAX_CODE = TAX.TAX_CODE AND misc_voucher_trace.amount <>0 and tax.tax_group in ('ITDS ','SRTDS','ECTDS','SHTDS') AND tran_id__ref in ( ls_vouch_no ) ); begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_chq_no ,ls_ch_no_det,ls_bank_cd_det,ls_token_no_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_chq_no)) > 0 then ls_chq_no := ','||ls_chq_no ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; ls_str := rtrim(ls_str)||ls_chq_no; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WFBK_WT_CHK BEFORE INSERT ON workorder_feedback referencing old as old new as new FOR EACH ROW DECLARE --lc_issqty number(14,3) := 0; --ls_stkopt item.stk_opt%type; --ls_isscriteria item.iss_criteria%type; ll_count number(3) := 0; BEGIN /* overhead_type F - Fixed M - Multiplier W - Per Unit Weight H - Per Man Hour O - Per Machine Hour S - Standard Machine Hour P - Per Standard Weight */ if :new.ohd_table__post is not null and length(trim(:new.ohd_table__post)) > 0 then if :new.net_weight is null or :new.net_weight = 0 or :new.qty_reported is null or :new.qty_reported = 0 then begin ll_count := 0; select count(1) into ll_count from process_overhead_det where TABLE_NO = :new.ohd_table__post and overhead_type in ('W','P'); exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Weight based overheads defined net weight or reported quantity cannot be zero'); end if; end if; if :new.MACHINE_HOURS is null or :new.MACHINE_HOURS = 0 then begin ll_count := 0; select count(1) into ll_count from process_overhead_det where TABLE_NO = :new.ohd_table__post and overhead_type ='O'; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Machine Hours based overheads defined machine hours cannot be zero'); end if; end if; if :new.MAN_HOURS is null or :new.MAN_HOURS = 0 then begin ll_count := 0; select count(1) into ll_count from process_overhead_det where TABLE_NO = :new.ohd_table__post and overhead_type ='H'; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Man Hours based overheads defined man hours cannot be zero'); end if; end if; if :new.QTY_REPORTED is null or :new.QTY_REPORTED = 0 then begin ll_count := 0; select count(1) into ll_count from process_overhead_det where TABLE_NO = :new.ohd_table__post and overhead_type ='M'; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Quantity multiplier based overheads defined quantity reported cannot be zero'); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_PO_DELEGATE_X ON EMP_PO_DELEGATE (EMP_CODE_FROM, EMP_CODE_TO, ITEM_SER, EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PUREXP_AMT (as_voucher_id in char, as_voucher_line in char ) return number is lc_bill_amt number(14,3) ; lc_tax number(14,3) ; begin select nvl(vouch_qty*vouch_rate,0) into lc_bill_amt from vouchrcp where tran_id = as_voucher_id and line_no = as_voucher_line ; if lc_bill_amt is null then lc_bill_amt := 0 ; end if ; select sum(nvl(a.tax_amt,0)) - sum(nvl(a.reco_amount,0)) into lc_tax from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'VOUCH' and a.tran_id = as_voucher_id and ltrim(a.line_no) = ltrim(as_voucher_line) and b.effect <> 'N' and a.acct_code is null ; if lc_tax is null then lc_tax := 0 ; end if ; lc_bill_amt := lc_bill_amt + lc_tax ; return lc_bill_amt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DISTISSUE_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON DISTORD_ISS referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; BEGIN if :new.confirmed = 'Y' then begin --------------------- begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_DISS'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_distorddet in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM DISTORD_ISSDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id ) loop if cur_distorddet.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from distord_issdet where tran_id = :new.tran_id; exception when others then ll_count:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'D-ISS' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if ll_count > 0 then begin SELECT sum(rate * quantity) into lc_rate FROM distord_issdet where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'D-ISS' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; -- count end -- count end end; end if ;-- end of varvalue if end if; end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETITEMS_SETPKVAL Before Insert On Strg_Meet_Items For Each Row declare max_line_no number(10); begin if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then begin select tran_id into :new.tran_id from strg_meet where dcr_id = :new.dcr_id and strg_code = :new.strg_code and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_items where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_items where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_items where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_PACK_RCP_ITEM_LOT ON INV_PACK_RCP (ITEM_CODE, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGENCODE_DESCR (AS_FLD_NAME IN VARCHAR,AS_MOD_NAME IN VARCHAR2,AS_FLD_VALUE IN VARCHAR2 ) RETURN VARCHAR IS AS_DESCR VARCHAR(100); BEGIN SELECT DESCR INTO AS_DESCR FROM GENCODES WHERE TRIM(FLD_NAME)=TRIM(AS_FLD_NAME) AND (MOD_NAME)= (AS_MOD_NAME) AND TRIM(FLD_VALUE )= TRIM(AS_FLD_VALUE); RETURN AS_DESCR; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_ITEM_UNIT BEFORE update ON ITEM referencing old as OLD new as NEW FOR EACH ROW declare ll_count number; BEGIN if updating ('UNIT') then if trim(:NEW.UNIT) <> trim(:OLD.UNIT) then begin select count(1) into ll_count from stock where item_code = :new.item_code and quantity <> 0; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Change of unit is not allowed as there is already [' || to_char(ll_count) ||'] rows in stock for the item' ); end if; end if; end if; if updating('STK_OPT') then if :new.stk_opt ='0' and :old.stk_opt <> '0' then begin select count(1) into ll_count from stock where item_code = :new.item_code and quantity <> 0; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Change of stock option is not allowed as there is already [' || to_char(ll_count) ||'] rows in stock for the item' ); end if; end if; end if; /* --- commented as suggested by KB as reported from UNIML if updating('QC_REQD') then if :new.QC_REQD <> :old.QC_REQD then begin select count(1) into ll_count from stock where item_code = :new.item_code and quantity <> 0; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Change of QC required is not allowed as there is already [' || to_char(ll_count) ||'] rows in stock for the item' ); end if; end if; end if; */ if updating('QC_REQD_TYPE') then if :new.QC_REQD_TYPE <> :old.QC_REQD_TYPE then begin select count(1) into ll_count from stock where item_code = :new.item_code and quantity <> 0; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Change of QC required type is not allowed as there is already [' || to_char(ll_count) ||'] rows in stock for the item' ); end if; end if; end if; if updating('TRACK_SHELF_LIFE') then if :new.TRACK_SHELF_LIFE <> :old.TRACK_SHELF_LIFE then begin select count(1) into ll_count from stock where item_code = :new.item_code and quantity <> 0 and (mfg_date is null or exp_date is null) ; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Change of track shelf life is not allowed as there is already [' || to_char(ll_count) ||'] rows in stock for the item' ); end if; end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_STRG_NAME (as_strg_code CHAR, as_option VARCHAR2) RETURN VARCHAR2 IS ls_type VARCHAR2(1); ls_prefix VARCHAR2(5); ls_fname VARCHAR2(25); ls_mname VARCHAR2(25); ls_lname VARCHAR2(25); ls_code CHAR(10); ls_cust_det VARCHAR2(100); BEGIN IF(as_option='NAME') then if (as_strg_code <>NULL) then select prefix, first_name, middle_name, last_name into ls_prefix, ls_fname, ls_mname, ls_lname from strg_customer where trim(sc_code) = trim(as_strg_code); ls_cust_det := ls_prefix||' '||ls_fname||' '||ls_mname||' '||ls_lname ; elsif as_strg_code is null then ls_cust_det := 'Not Listed'; end if; ELSIF(as_option='CUST_TYPE') then select cust_type into ls_type from strg_customer where trim(sc_code) = trim(as_strg_code); if(ls_type='D') then ls_cust_det :='Doctor'; elsif(ls_type='C') then ls_cust_det := 'Chemist'; elsif(ls_type='S') then ls_cust_det := 'Stockist'; end if; ELSIF(as_option='QUALIFICATION') then select qualification into ls_cust_det from strg_customer where trim(sc_code) = trim(as_strg_code); ELSIF (as_option='STAN_CODE') then select stan_code into ls_cust_det from strg_customer where trim(sc_code) = trim(as_strg_code); ELSIF (as_option='STAN_NAME') then select stan_code into ls_code from strg_customer where trim(sc_code) = trim(as_strg_code); select descr into ls_cust_det from station where trim(stan_code) = trim(ls_code); ELSIF (as_option='CLASS_CODE') then select class_code into ls_cust_det from strg_customer where trim(sc_code) = trim(as_strg_code); ELSIF (as_option='CATEGORY') then select class_code_descr into ls_cust_det from strg_customer where trim(sc_code) = trim(as_strg_code); /*if(ls_code='A') then ls_cust_det := 'Super Target'; elsif(ls_code='C') then ls_cust_det := 'Tier1'; elsif(ls_code='D') then ls_cust_det := 'Tier2'; elsif (ls_code='N') then ls_cust_det := 'Tier3'; else ls_cust_det := 'N/A'; end if;*/ ELSIF (as_option='LOCALITY_CODE') then select locality_code into ls_cust_det from strg_customer where trim(sc_code) = trim(as_strg_code); ELSIF (as_option='LOCALITY_NAME') then select locality_code into ls_code from strg_customer where trim(sc_code) = trim(as_strg_code); select descr into ls_cust_det from locality where trim(locality_code)= trim(ls_code); ELSIF (as_option='CITY') then select city into ls_cust_det from strg_customer where trim(sc_code) = trim(as_strg_code); else ls_cust_det := ''; end if; return nvl(ls_cust_det,''); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RX_COUNT_CAMPAIGNWISE (AS_STRG_CODE CHAR,as_campgn_id in VARCHAR2,as_sales_pers in CHAR,as_brand_code in VARCHAR2 ,as_tran_id in VARCHAR2) return number is prcount number; BEGIN SELECT SUM(OUTCOME_NUM) INTO prcount FROM sprs_campgn INNER JOIN sprs_campgn_items ON sprs_campgn.tran_id = sprs_campgn_items.tran_id AND sprs_campgn.campgn_id = as_campgn_id AND Strg_Code = AS_STRG_CODE AND sprs_campgn.sales_pers = as_sales_pers and sprs_campgn_items.item_code IN ( select item_code from item where brand_code = as_brand_code ) and sprs_campgn.tran_id=as_tran_id; RETURN prcount; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_PAYROLL_DETAILS (AS_PRD_CODE_FROM char,AS_PRD_CODE_TO char,AS_EMP_CODE char,AS_AD_CODE char,AS_TABLE char,AS_FIELD char) return number is a_amount payarr_det.amount%type := 0; begin if (AS_TABLE = 'P') then if (AS_FIELD = 'B') then select sum(a.base_amt) into a_amount from payrolldet a,payroll b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code >= AS_PRD_CODE_FROM and a.prd_code <= AS_PRD_CODE_TO and a.emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(a.ad_code)||',') > 0 and b.voucher_no is not null; elsif (AS_FIELD = 'S') then select sum(a.slab_amt) into a_amount from payrolldet a,payroll b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code >= AS_PRD_CODE_FROM and a.prd_code <= AS_PRD_CODE_TO and a.emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(a.ad_code)||',') > 0 and b.voucher_no is not null; elsif (AS_FIELD = 'A') then select sum(a.amount) into a_amount from payrolldet a,payroll b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code >= AS_PRD_CODE_FROM and a.prd_code <= AS_PRD_CODE_TO and a.emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(a.ad_code)||',') > 0 and b.voucher_no is not null; end if; elsif (AS_TABLE = 'A') then if (AS_FIELD = 'B') then select sum(a.diff_base_amt) into a_amount from arreardet a,arrears b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code__acc = b.prd_code__acc and a.prd_code__acc >= AS_PRD_CODE_FROM and a.prd_code__acc <= AS_PRD_CODE_TO and a.emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(a.ad_code)||',') > 0 and b.voucher_no is not null; elsif (AS_FIELD = 'S') then select sum(a.diff_slab_amt) into a_amount from arreardet a,arrears b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code__acc = b.prd_code__acc and a.prd_code__acc >= AS_PRD_CODE_FROM and a.prd_code__acc <= AS_PRD_CODE_TO and a.emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(a.ad_code)||',') > 0 and b.voucher_no is not null; elsif (AS_FIELD = 'A') then select sum(a.diff_amt) into a_amount from arreardet a,arrears b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code__acc = b.prd_code__acc and a.prd_code__acc >= AS_PRD_CODE_FROM and a.prd_code__acc <= AS_PRD_CODE_TO and a.emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(a.ad_code)||',') > 0 and b.voucher_no is not null; end if; elsif (AS_TABLE = 'R') then if (AS_FIELD = 'B') then select sum(base_amt) into a_amount from payarr_det where prd_code >= AS_PRD_CODE_FROM and prd_code <= AS_PRD_CODE_TO and emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(ad_code)||',') > 0; elsif (AS_FIELD = 'S') then select sum(slab_amt) into a_amount from payarr_det where prd_code >= AS_PRD_CODE_FROM and prd_code <= AS_PRD_CODE_TO and emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(ad_code)||',') > 0; elsif (AS_FIELD = 'A') then select sum(amount) into a_amount from payarr_det where prd_code >= AS_PRD_CODE_FROM and prd_code <= AS_PRD_CODE_TO and emp_code = AS_EMP_CODE and instr(','||trim(AS_AD_CODE)||',',','||trim(ad_code)||',') > 0; end if; end if; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_RESIG_CLEARANCE_X ON EMP_RESIG_CLEARANCE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_MVTAXENV (ls_sundry_code In Char, Ls_Site_Code In Char, ls_tax_env in char,ls_sundry_type in char) return number Is ls_sundrystate CHAR(5); ls_sitestate CHAR(5); cur_out sys_refcursor; ls_sql varchar2(4000); Begin if ls_sundry_type = 'S' then ls_sql := 'select trim(state_code) state_code from supplier where supp_code = :ls_sundry_code'; elsif ls_sundry_type = 'C' then ls_sql := 'select trim(state_code) state_code from customer where cust_code = :ls_sundry_code'; elsif ls_sundry_type = 'T' then ls_sql := 'select trim(state_code) state_code from transporter where tran_code = :ls_sundry_code'; elsif ls_sundry_type = 'X' then ls_sql := 'select trim(state_code) state_code from tax_authority where tauth_code = :ls_sundry_code'; elsif ls_sundry_type = 'L' then ls_sql := 'select trim(state_code) state_code from loanparty where party_code = :ls_sundry_code'; elsif ls_sundry_type = 'E' then ls_sql := 'select trim(s.state_code) state_code from employee e, station s WHERE s.stan_code = e.stan_code and e.emp_code = :ls_sundry_code'; -- ls_sql := 'select trim(CUR_STATE) state_code from employee where emp_code = :ls_sundry_code'; elsif ls_sundry_type = 'P' then ls_sql := 'select trim(stan_code) state_code from sales_pers where sales_pers = :ls_sundry_code'; else return 0; end if; OPEN cur_out FOR ls_sql USING ls_sundry_code ; FETCH cur_out INTO ls_sundrystate ; close cur_out; Select Trim(State_Code) Into ls_sitestate From Site Where Site_Code=Ls_Site_Code; If ls_sundrystate <> ls_sitestate and ls_tax_env in ('EINC01','EIWC01','EIMP01','ERCMI01','ERCMI02','NOGST' ) then Return 0; ElsIf ls_sundrystate = ls_sitestate and Ls_Tax_Env In ('ELNC01','ELWC01','ERCML01','ERCML02','NOGST' ) Then Return 0; else Return 1; End If; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DUPLICATE (as_line_no number,as_no_art number) return obj_duplicate_tab is l_obj_duplicate_tab obj_duplicate_tab := obj_duplicate_tab(); n integer := 0; begin for r in (select trim(as_line_no) line_no,as_no_art no_art,rownum NUM from ALL_OBJECTS where rownum<=as_no_art) loop l_obj_duplicate_tab.extend; n := n + 1; l_obj_duplicate_tab(n) := obj_duplicate(r.line_no,r.no_art,r.num); end loop; return l_obj_duplicate_tab; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_FEAS_EVAL_X ON PROJ_FEAS_EVAL (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CONTACT_NAME ( AS_CONTACT_CODE CHAR) RETURN CHAR IS CONTACT_NAME varchar2(40); BEGIN SELECT (STRG_CUSTOMER.FIRST_NAME ||' '|| STRG_CUSTOMER.MIDDLE_NAME ||' '|| STRG_CUSTOMER.LAST_NAME) into CONTACT_NAME FROM STRG_CUSTOMER WHERE SC_CODE=AS_CONTACT_CODE; return contact_name; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_STOCK_RATE BEFORE UPDATE OF RATE ON STOCK referencing old as old new as new FOR EACH ROW declare ls_available char(1); ls_inv_stat char(5); ls_msg varchar2(2000); ls_stattype char(1); trace_alloc number(18,7); ls_stkopt char(1); ls_maxid invtrace.tran_id%type; lc_invrate invtrace.rate%type; begin select nvl(stk_opt,'0') into ls_stkopt from item where item_code = :new.item_code; if ls_stkopt = '2' then ls_msg := ' site [' || :new.site_code || '] item [' || trim(:new.item_code) || '] location [' || trim(:new.loc_code) || '] Lot no [' || trim(:new.lot_no) || '] Lot sl [' || trim(:new.lot_sl) || '] old rate [' || to_char(:old.rate) || '] new rate [' || to_char(:new.rate) || '] alloc_qty [' ||to_char(:old.alloc_qty) ||']'; if :old.alloc_qty <> 0 and :new.rate <> :old.rate then raise_application_error( -20602, 'Allocation exists, rate cannot be changed ' || ls_msg); end if; end if; if ls_stkopt <> '0' then begin select max(tran_id) into ls_maxid from invtrace where site_code = :new.site_code and item_code = :new.item_CODE and loc_code = :new.LOC_CODE and lot_no = :new.lot_no and lot_sl = :new.lot_sl; exception when others then ls_maxid := ' '; end; if length(trim(ls_maxid)) > 0 then begin select rate into lc_invrate from invtrace where tran_id = ls_maxid; exception when others then lc_invrate := 0; end; if lc_invrate <> :new.rate and :old.quantity > :new.quantity then ls_msg := ' site [' || :new.site_code || '] item [' || trim(:new.item_code) || '] location [' || trim(:new.loc_code) || '] Lot no [' || trim(:new.lot_no) || '] Lot sl [' || trim(:new.lot_sl) || '] invtrace rate [' || to_char(lc_invrate) || '] stock rate [' || to_char(:new.rate) || ']'; raise_application_error( -20602, 'Stock rate is not matching with last invtrace rate ' || ls_msg); end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ORG_CUST_TRACE_X ON ORG_CUST_TRACE (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONSUME_ORD_DATE_SITE ON CONSUME_ORD (ORDER_DATE, SITE_CODE__ORD) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_SFAPARM_DATA (as_parm_name varchar,as_emp_code char) return varchar is parmVal varchar2(20); site_code__def CHAR(5); item_ser CHAR(5); begin SELECT SITE_CODE__DEF into site_code__def FROM USERS WHERE CODE = as_emp_code ; SELECT SALES_PERS.ITEM_SER into item_ser FROM ITEMSER LEFT OUTER JOIN SALES_PERS ON ITEMSER.ITEM_SER = SALES_PERS.ITEM_SER WHERE SALES_PERS.SALES_PERS = as_emp_code; begin SELECT PARM_VALUE into parmVal FROM SFAPARM WHERE PARM_NAME = as_parm_name and active = 'Y' and org_unit=site_code__def||'_'||item_ser; return parmVal; exception when no_data_found then begin SELECT PARM_VALUE into parmVal FROM SFAPARM WHERE PARM_NAME = as_parm_name and active = 'Y' and org_unit=item_ser; return parmVal; exception when no_data_found then begin SELECT PARM_VALUE into parmVal FROM SFAPARM WHERE PARM_NAME = as_parm_name and active = 'Y' and org_unit='ALL'; return parmVal; end; end; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_YTD_SALES_ACHIVMNT (as_sales_pers CHAR,as_stan_code CHAR,AS_OPT VARCHAR) RETURN NUMBER IS FINAL_VAL NUMBER(14,3); TARGET_VAL NUMBER(14,3); TARGET_VAL_CNT NUMBER(14,3); SALES_VAL NUMBER(14,3); NO_OF_SE NUMBER(14,3); BEGIN FINAL_VAL := 0; IF AS_OPT = 'Y' THEN SELECT MAX(NO_OF_SE), SUM(SALES_VAL) INTO NO_OF_SE, SALES_VAL FROM DWH_INV_SRET_SUM WHERE TRAN_DATE BETWEEN (select fr_date from ACCTPRD where sysdate between fr_date and to_date) AND SYSDATE AND TERRITORY_CODE IN (select POOL_CODE from ORG_STRUCTURE where EMP_CODE in (select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code) AND VERSION_ID = (SELECT MAX(Q.VERSION_ID) FROM VERSION Q WHERE TRUNC(SYSDATE) BETWEEN Q.EFF_FROM AND SYSDATE)) AND EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code); -- Get Target Value SELECT SUM(SALES_TARGET_VAL), COUNT(SALES_TARGET_VAL) INTO TARGET_VAL, TARGET_VAL_CNT FROM DWH_SM_SALES_EXP WHERE PRD_CODE in(select P.CODE from ACCTPRD SCT,PERIOD P where P.ACCT_PRD=SCT.CODE and sct.CODE=(select PP.ACCT_PRD from PERIOD PP where sysdate between PP.FR_DATE and PP.TO_DATE) and P.FR_DATE between SCT.FR_DATE and SCT.TO_DATE and P.TO_DATE between SCT.FR_DATE and SCT.TO_DATE ) AND TERR_CODE IN (select POOL_CODE from ORG_STRUCTURE where EMP_CODE in (select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code) AND VERSION_ID = (SELECT MAX(Q.VERSION_ID) FROM VERSION Q WHERE TRUNC(SYSDATE) BETWEEN Q.EFF_FROM AND SYSDATE)); ELSE SELECT MAX(NO_OF_SE), SUM(SALES_VAL) INTO NO_OF_SE, SALES_VAL FROM DWH_INV_SRET_SUM WHERE TRAN_DATE BETWEEN (select fr_date from ACCTPRD where sysdate between fr_date and to_date) AND SYSDATE AND TERRITORY_CODE IN (select POOL_CODE from ORG_STRUCTURE where EMP_CODE in (select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ) AND VERSION_ID = (SELECT MAX(Q.VERSION_ID) FROM VERSION Q WHERE TRUNC(SYSDATE) BETWEEN Q.EFF_FROM AND SYSDATE)) AND EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ); -- Get Target Value SELECT SUM(SALES_TARGET_VAL), COUNT(SALES_TARGET_VAL) INTO TARGET_VAL, TARGET_VAL_CNT FROM DWH_SM_SALES_EXP WHERE PRD_CODE in(select P.CODE from ACCTPRD SCT,PERIOD P where P.ACCT_PRD=SCT.CODE and sct.CODE=(select PP.ACCT_PRD from PERIOD PP where sysdate between PP.FR_DATE and PP.TO_DATE) and P.FR_DATE between SCT.FR_DATE and SCT.TO_DATE and P.TO_DATE between SCT.FR_DATE and SCT.TO_DATE ) AND TERR_CODE IN (select POOL_CODE from ORG_STRUCTURE where EMP_CODE in (select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ) AND VERSION_ID = (SELECT MAX(Q.VERSION_ID) FROM VERSION Q WHERE TRUNC(SYSDATE) BETWEEN Q.EFF_FROM AND SYSDATE)); END IF; IF TARGET_VAL_CNT > 0 AND TARGET_VAL > 0 THEN FINAL_VAL := ( ( SALES_VAL / NO_OF_SE ) / ( TARGET_VAL / NO_OF_SE ) ) * 100 ; END IF; RETURN FINAL_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYROLLDET_REF_TYPE_NO ON PAYROLLDET (REF_TYPE, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_UNCONF_QTY ( tranId IN varchar, lineNo IN number ) return number is unconf_qty number(14,3); begin select sum(case when b.quantity is null then 0 else b.quantity end) into unconf_qty from charge_back a, charge_back_det b where a.tran_id = b.tran_id and a.cust_code = ( select cust_code from charge_back where tran_id = tranId ) and a.site_code = ( select site_code from charge_back where tran_id = tranId ) and b.item_code = ( select item_code from charge_back_det where tran_id = tranId and line_no = lineNo ) and b.lot_no = ( select lot_no from charge_back_det where tran_id = tranId and line_no = lineNo ) and a.tran_id <> tranId and (case when a.confirmed is null then 'N' else a.confirmed end) = 'N'; return(unconf_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_LOAD_NO (empCode in char,as_event_date in date) RETURN varchar2 IS load_no_wth_route varchar2(80); as_max_day_summ_date DATE; as_min_day_summ_date DATE; begin SELECT MAX(EVENT_DATE) INTO as_max_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(empCode) AND EVENT_DATE<=as_event_date; SELECT MIN(EVENT_DATE) INTO as_min_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(empCode) AND EVENT_DATE > as_event_date ; IF as_min_day_summ_date IS NOT NULL THEN select LOAD_NO||'@'||(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) into load_no_wth_route from SPRS_DAY_SUMM SDS,SPRS_ROUTE SR where TRIM(SDS.sales_pers) = trim(empCode) AND SDS.event_date >=as_max_day_summ_date AND event_date < as_min_day_summ_date AND SR.SPRS_CODE=SDS.SALES_PERS AND SR.ROUTE_ID=SDS.ROUTE_ID; else select LOAD_NO||'@'||(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) into load_no_wth_route from SPRS_DAY_SUMM SDS,SPRS_ROUTE SR where TRIM(SDS.sales_pers) = trim(empCode) AND SDS.event_date >=as_max_day_summ_date AND SR.SPRS_CODE=SDS.SALES_PERS AND SR.ROUTE_ID=SDS.ROUTE_ID; END IF; return load_no_wth_route; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ITEM_DESCR (ls_item_code IN char) return VARCHAR2 is as_item_desc VARCHAR2 (2000); BEGIN select descr into as_item_desc from item_own where item_code=ls_item_code; RETURN as_item_desc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083650 ON SITE_REPL_PREF (SITE_CODE, SITE_CODE__SUPP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPAY_OUTST ( as_refser in char, as_refno in char, ad_asondate in date, ac_outstamt in number) return number is ac_outst_amt number(14,3) ; lc_outstamt number(14,3) ; lc_adjamt number(14,3) ; begin lc_outstamt := ac_outstamt ; select nvl(sum(misc_paydet.pay_amt),0) into lc_adjamt from misc_paydet, misc_payment where misc_paydet.tran_id = misc_payment.tran_id and misc_payment.tran_date > ad_asondate and misc_payment.confirmed = 'Y' and misc_paydet.tran_ser = as_refser and misc_paydet.vouch_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(a.adj_amt),0) into lc_adjamt from misc_payables_adj a, misc_payables b where decode(a.ref_ser_adj,' ',a.ref_ser,a.ref_ser_adj) = b.tran_ser (+) and decode(a.ref_no_adj,' ',a.ref_no,a.ref_no_adj) = b.ref_no (+) and a.ref_ser = as_refser and a.ref_no = as_refno and ( b.tran_date > ad_asondate ) ; lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(b.pay_amt),0) into lc_adjamt from misc_payment_cancdet b where b.tran_id in (select a.tran_id from misc_payment_canc a where a.tran_date > ad_asondate and a.confirmed = 'Y' ) and b.tran_ser = as_refser and b.vouch_no = as_refno; lc_outstamt := lc_outstamt - lc_adjamt ; select NVL(sum(vouchadv.adj_amt),0) into lc_adjamt from vouchadv INNER JOIN VOUCHER ON vouchadv.TRAN_ID=VOUCHER.TRAN_ID WHERE vouchadv.REF_SER=as_refser and vouchadv.REF_NO =as_refno and VOUCHER.tran_date>ad_asondate and VOUCHER.confirmed='Y' ; lc_outstamt := lc_outstamt + lc_adjamt ; select NVL(sum(misc_vouchadv.adj_amt),0) into lc_adjamt from misc_vouchadv INNER JOIN misc_VOUCHER ON misc_vouchadv.TRAN_ID=misc_VOUCHER.TRAN_ID WHERE misc_vouchadv.REF_SER=as_refser and misc_vouchadv.REF_NO =as_refno and misc_VOUCHER.tran_date>ad_asondate and misc_VOUCHER.confirmed='Y' ; lc_outstamt := lc_outstamt + lc_adjamt ; SELECT nvl(SUM(MISC_PAY_RCP_TRACE.ADJ_AMT),0) into lc_adjamt FROM MISC_PAY_RCP_TRACE inner join misc_receipt on MISC_PAY_RCP_TRACE.tran_id__rcp=misc_receipt.tran_id WHERE MISC_PAY_RCP_TRACE.TRAN_SER__PAY=as_refser AND MISC_PAY_RCP_TRACE.REF_NO__PAY=as_refno AND misc_receipt.TRAN_DATE >ad_asondate ; lc_outstamt := lc_outstamt - lc_adjamt ; select NVL(sum(pay_ibca_det.tot_amt),0) into lc_adjamt from pay_ibca_det INNER JOIN pay_ibca ON pay_ibca_det.TRAN_ID=pay_ibca.TRAN_ID WHERE pay_ibca_det.REF_SER=as_refser and pay_ibca_det.REF_NO =as_refno and pay_ibca.tran_date>ad_asondate and pay_ibca.confirmed='Y'; lc_outstamt := lc_outstamt + lc_adjamt ; return lc_outstamt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHK_PLANNED_MFG_DT ( as_ref_no char,mfg_date__start date) return number is ret_val number(1); so_pln_dt date; begin SELECT UDF__DATE1 INTO so_pln_dt FROM SORDER WHERE TRIM(sale_order)=trim(as_ref_no); if(so_pln_dt IS not NULL) and as_ref_no<>' ' then IF mfg_date__start SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX UK_INSURANCE_CUST ON INSURANCE_CUST (TRAN_ID, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE PICKRATE AS OBJECT ( LOT_NO VARCHAR2(15), MRPRATE NUMBER(15,4), PTRRATE NUMBER(15,4), PTSRATE NUMBER(15,4), QUANTITY NUMBER(17,6) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX POSITION_POLICY_REFERENCE_X ON POSITION_POLICY_REFERENCE (POSITION_CONTEXT, POLICY_CODE, CHAPTER_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FINENT_DESCR ON FINENT (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CONFIRMED_BY (ls_refser in char, ls_refid in char) return char is ls_user char(10); begin ls_user := ' '; select chg_user into ls_user from gltrace where ref_ser = ls_refser and ref_id = ls_refid and rownum = 1; return ls_user; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SELL_QTY (as_item_code IN CHAR ,as_sales_pers IN CHAR,as_event_date in date) RETURN number AS li_sale_qty NUMBER; BEGIN select sum(quantity) into li_sale_qty from strg_meet_invoice where dcr_id in(select dcr_id from sprs_Act_Tran where load_no= FN_GET_LOAD_NO(as_sales_pers,trunc(sysdate) )) and item_code = as_item_code group by item_code; return li_sale_qty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_TRANDATE (ldate_fr in date,lsite_code in char,lacct_code in char) return number is lc_day_op_bal number(14,3); lc_prd_op_bal number(14,3); ls_prd char(6); ls_acctprd char(6); ls_fent char(10); mfr_date date; begin select acct_prd, code, fr_date into ls_acctprd, ls_prd, mfr_date from period where ldate_fr between fr_date and to_date; select fin_entity into ls_fent from site where site_code = lsite_code; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and site_code = lsite_code and acct_code = lacct_code; Select nvl(Sum(dr_amt - cr_amt),0) into lc_day_op_bal from gltran where site_code= lsite_code and tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code ; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LY_SALES (lsite_code in char, litem_code in char, ltable_no in char,lprd_code in char ,larg in char,lqty_or_val in char,llevel_code in char) return number is lc_val number(14,3); ls_prd char(6); lc_quantity number(14,3); lc_sales_qty number(14,3); lc_sales_val number(14,3); lc_sales_qty__round number(14,3); lc_sales_val__round number(14,3); lc_sales_qty__cqtr number(14,3); lc_sales_val__cqtr number(14,3); lc_sales_qty__quatret number(14,3); lc_sales_val__quatret number(14,3); lc_return_qty number(14,3); lc_return_val number(14,3); lc_return_qty__round number(14,3); lc_return_val__round number(14,3); lc_return_qty__cqtr number(14,3); lc_return_val__cqtr number(14,3); lc_return_qty__quatret number(14,3); lc_return_val__quatret number(14,3); lc_repl_qty number(14,3); lc_repl_val number(14,3); lc_repl_qty__round number(14,3); lc_repl_val__round number(14,3); lc_repl_qty__cqtr number(14,3); lc_repl_val__cqtr number(14,3); lc_repl_qty__quatret number(14,3); lc_repl_val__quatret number(14,3); lc_net_sales_qty number(14,3); lc_net_sales_qty__round number(14,3); lc_net_sales_qty__cqtr number(14,3); lc_net_sales_qty__quatret number(14,3); lc_net_sales_val number(14,3); lc_net_sales_val__round number(14,3); lc_net_sales_val__cqtr number(14,3); lc_net_sales_val__quatret number(14,3); begin ls_prd := to_char(to_number(lprd_code) - 100); select sum(sales_qty),sum(sales_val),sum(sales_qty__round), sum(sales_val__round), sum(sales_qty__cqtr),sum(sales_val__cqtr), sum(return_qty),sum(return_val),sum(return_qty__round), sum(return_val__round),sum(return_qty__cqtr),sum(return_val__cqtr), sum(repl_qty),sum(repl_val),sum(repl_qty__round), sum(repl_val__round),sum(repl_qty__cqtr),sum(repl_val__cqtr), sum(sales_qty__quatret),sum(return_qty__quatret),sum(repl_qty__quatret), sum(sales_val__quatret),sum(return_val__quatret),sum(repl_val__quatret) into lc_sales_qty, lc_sales_val, lc_sales_qty__round, lc_sales_val__round, lc_sales_qty__cqtr, lc_sales_val__cqtr, lc_return_qty, lc_return_val, lc_return_qty__round, lc_return_val__round, lc_return_qty__cqtr, lc_return_val__cqtr, lc_repl_qty, lc_repl_val, lc_repl_qty__round, lc_repl_val__round, lc_repl_qty__cqtr, lc_repl_val__cqtr, lc_sales_qty__quatret, lc_return_qty__quatret, lc_repl_qty__quatret, lc_sales_val__quatret, lc_return_val__quatret, lc_repl_val__quatret from sm_sales_site where level_code = llevel_code and item_code = litem_code and prd_code = ls_prd; lc_net_sales_qty := (lc_sales_qty - lc_return_qty) + lc_repl_qty; lc_net_sales_qty__round := (lc_sales_qty__round - lc_return_qty__round) + lc_repl_qty__round; lc_net_sales_qty__cqtr := (lc_sales_qty__cqtr - lc_return_qty__cqtr) + lc_repl_qty__cqtr; lc_net_sales_qty__quatret := (lc_sales_qty__quatret - lc_return_qty__quatret) + lc_repl_qty__quatret; lc_net_sales_val := (lc_sales_val - lc_return_val) + lc_repl_val; lc_net_sales_val__round := (lc_sales_val__round - lc_return_val__round) + lc_repl_val__round; lc_net_sales_val__cqtr := (lc_sales_val__cqtr - lc_return_val__cqtr) + lc_repl_val__cqtr; lc_net_sales_val__quatret := (lc_sales_val__quatret - lc_return_val__quatret) + lc_repl_val__quatret; if (lqty_or_val = 'Q') then if (larg = 'M') then lc_val := lc_net_sales_qty; elsif (larg = 'R') then lc_val := lc_net_sales_qty__round; elsif (larg = 'Q') then lc_val := lc_net_sales_qty__cqtr; elsif (larg = 'T') then lc_val := lc_net_sales_qty__quatret; end if; elsif (lqty_or_val = 'V') then if (larg = 'M') then lc_val := lc_net_sales_val; elsif (larg = 'R') then lc_val := lc_net_sales_val__round; elsif (larg = 'Q') then lc_val := lc_net_sales_val__cqtr; elsif (larg = 'T') then lc_val := lc_net_sales_val__quatret; end if; end if; lc_val := nvl(lc_val,0); return lc_val; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESPQTY_SL ( as_desp_id in char, as_item_code in char, as_lotsl in char, as_free in char ) return number is lc_qty number(14,3); begin if as_free = 'A' then select nvl(sum(quantity__stduom),0) into lc_qty from despatchdet where desp_id = as_desp_id and item_code = as_item_code and lot_sl = as_lotsl ; else select nvl(sum(quantity__stduom),0) into lc_qty from despatchdet where desp_id = as_desp_id and item_code = as_item_code and UPPER(lot_sl) = as_lotsl and rate__stduom <> 0; end if; return lc_qty ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NUMBERTOWORD_ALLCURR (var in number,CURR IN VARCHAR) return varchar2 is amt number; strt number; val number; str varchar2(15); ls_dec_unit varchar(10); ls_currency varchar(50); c_str varchar2(400); flag number:=0; begin val:=round(var,2); amt:=floor(val); str:=to_char(amt); ls_dec_unit:=' '; ls_currency :=' ' ; select case when curr_code='USD' then 'dec_unit' else nvl(dec_unit,'Cents') end into ls_dec_unit from currency where TRIM(curr_code)=TRIM(curr); select case when curr_code='USD' then 'USD' else nvl(descr,'US DOLLAR') end into ls_currency from currency where TRIM(curr_code)=TRIM(curr); if val > 0 then if length(str) >= 8 and length(str) <=10 then strt:=(length(str)-7); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' crore '; amt:=to_number(substr(to_char(amt),(strt+1),7)); flag:=0; end if; str:=to_char(amt); if ((length(str) >= 6 and length(str) <= 7) or flag = 1) then strt:=(length(str) - 5); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' lakh '; amt:=to_number(substr(to_char(amt),(strt+1),5)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 5 ) or flag = 1) then c_str:=c_str || initcap(case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end); end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := ls_currency || ' ' || initcap(c_str) || ' and ' || initcap(spell(amt)) || ' ' || initcap(ls_dec_unit) || ' Only'; else c_str := ls_currency || ' ' || initcap(c_str) || ' Only'; end if; c_str:=replace(c_Str,'-',' '); return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HRP_ROLE_ENTITY ( AS_REF_SER CHAR, AS_EMP_CODE CHAR, AS_ROLE_CODE CHAR) RETURN VARCHAR2 IS LS_ROLE_ENTITY VARCHAR2(100); LS_UTYPE VARCHAR2(2); LS_STATUS NUMBER(1); LS_CODE CHAR(10); BEGIN LS_ROLE_ENTITY := TRIM(AS_EMP_CODE); IF(TRIM(AS_REF_SER) IN ('E-LVE','E-LVF','E-LVN')) THEN SELECT CASE WHEN USER_TYPE = 'E' THEN '1E' WHEN USER_TYPE = 'P' THEN '2P' ELSE '3' || USER_TYPE END AS USER_TYPE, CODE, CASE WHEN NVL(STATUS,'A') = 'C' THEN 2 ELSE 1 END AS USER_STATUS INTO LS_UTYPE, LS_CODE, LS_STATUS FROM USERS WHERE EMP_CODE = AS_EMP_CODE AND ROWNUM = 1 ORDER BY CASE WHEN USER_TYPE = 'E' THEN '1E' WHEN USER_TYPE = 'P' THEN '2P' ELSE '3' || USER_TYPE END, CASE WHEN NVL(STATUS,'A') = 'C' THEN 2 ELSE 1 END; IF(LS_UTYPE IS NOT NULL AND LENGTH(TRIM(LS_UTYPE)) > 1) THEN LS_ROLE_ENTITY := SUBSTR(LS_UTYPE,2,1) || ',' || TRIM(AS_EMP_CODE); ELSIF(LS_UTYPE IS NOT NULL AND LENGTH(TRIM(LS_UTYPE)) > 0) THEN LS_ROLE_ENTITY := TRIM(LS_UTYPE) || ',' || TRIM(AS_EMP_CODE); END IF; END IF; IF(LS_UTYPE IS NOT NULL AND LENGTH(TRIM(LS_UTYPE)) > 1) THEN LS_ROLE_ENTITY := SUBSTR(LS_UTYPE,2,1) || ',' || TRIM(AS_EMP_CODE); ELSIF(LS_UTYPE IS NOT NULL AND LENGTH(TRIM(LS_UTYPE)) > 0) THEN LS_ROLE_ENTITY := TRIM(LS_UTYPE) || ',' || TRIM(AS_EMP_CODE); END IF; RETURN LS_ROLE_ENTITY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYAMT_CHECK ( as_cust_code in char ) return number is lc_outstamt number(14,3) ; as_credit number(14,3) ; as_outstand number(14,3) ; begin select nvl(credit_lmt,0) into as_credit from customer where cust_code=as_cust_code; SELECT nvl(Sum(R.Tot_Amt - R.Adj_Amt),0) into as_outstand FROM Receivables R, Customer C WHERE R.CUST_CODE = C.CUST_CODE and R.cust_code=as_cust_code; lc_outstamt:= as_credit-as_outstand; if lc_outstamt<0 then return 0; else return lc_outstamt ; END IF ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_FW_CUMM_DAYS ( as_event_date date, as_sales_pers char ) Return Number as as_fw_cumm_days number(2); Begin select Nvl(Count (Distinct Event_Date),0) into as_fw_cumm_days from Strg_Meet SM Inner Join fieldactivity FA On sm.event_Type = fa.activity_code Where fa.activity_type = 'FW' And strg_type = 'C' AND SALES_PERS = as_sales_pers AND event_date >= trunc(to_date(as_event_date),'mon') AND event_date <= as_event_date ; Return as_fw_cumm_days; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RECEIPT_DATE (as_tran_id in char, as_net_amt in number ,as_sundry_type in char) return char is lc_vouch_no varchar2(20); begin if (as_sundry_type = 'C') then select to_char(rcpdet.ref_date) into lc_vouch_no from rcpdet where rcpdet.tran_id = as_tran_id ; else select to_char(receipt.ref_date) into lc_vouch_no from receipt where receipt.tran_id = as_tran_id ; end if; return lc_vouch_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONTACT_NAME ON CONTACT (NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VOUCHRCP_PRCP_ID_LINE_NO_RCP ON VOUCHRCP (PRCP_ID, LINE_NO__RCP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_RBF before insert on receipt_backflush referencing old as old new as new FOR EACH ROW declare ls_tempstr receipt_backflush.lot_no%type; ls_tempstr1 receipt_backflush.lot_no%type; begin ls_tempstr := trim(:new.lot_no); select Replace(translate(ls_tempstr,' ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-.','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_tempstr1 from dual; if (ls_tempstr1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in lot number [' || ls_tempstr1 ||']' ); end if; ls_tempstr := trim(:new.lot_sl); select Replace(translate(ls_tempstr,' ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-.','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_tempstr1 from dual; if (ls_tempstr1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in lot serial [' || ls_tempstr1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_BUS_LOGIC_SO ON BUSINESS_LOGIC_CHECK (SALE_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION WRAPE_LEAVES_DTLS (EMP_CODE in CHAR, Pos In int, space_lve In Varchar2,leaveDate In DATE) return number is BALDAYS number(7,1); LV_CODE VARCHAR2(20); begin select DDF_GET_LEAVE_TYPE(EMP_CODE, SPACE_LVE, POS,leaveDate) into LV_CODE from DUAL; SELECT DDF_GET_LEAVEBAL(EMP_CODE,LV_CODE,TO_DATE(SYSDATE)) INTO BALDAYS FROM DUAL; Return Baldays; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_QCITMSPCD ON QCITEM_SPEC_DET (ITEM_CODE, SPEC_REF, SPEC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLEAVE_SUMMARY__EMP_DATE_LVE ON EMPLEAVE_SUMMARY (EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, PRD_CODE, USE_FLAG) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RCUR_SEQUENCE ( AS_STRING in varchar2 ) RETURN VARCHAR2 IS LS_STRING VARCHAR2(100); LS_NUM NUMBER(10); BEGIN LS_STRING := AS_STRING ; while instr(ls_string,'.') != 0 loop ls_num := instr(ls_string,'.'); ls_string := substr(ls_string, ls_num+1, length(ls_string)); end loop; RETURN ls_string ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_IS_PR_SUBMITTED ( ls_dcr_id char, ls_sales_pers char) return varchar2 is ls_is_pr_exist varchar2(1):='N'; li_pr_count integer; begin begin SELECT COUNT(*) into li_pr_count FROM SPRS_ACT_TRAN A, FIELDACTIVITY B WHERE A.ACTIVITY_CODE = B.ACTIVITY_CODE AND A.SALES_PERS = ls_sales_pers AND B.ACTIVITY_TYPE='PR' AND A.EVENT_DATE = (SELECT EVENT_DATE FROM SPRS_ACT_TRAN WHERE SALES_PERS = ls_sales_pers AND DCR_ID= ls_dcr_id); if li_pr_count > 0 then ls_is_pr_exist :='Y'; else ls_is_pr_exist :='N'; end if; exception when no_data_found then ls_is_pr_exist :='N'; end; return ls_is_pr_exist; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_STOCK_DET_ITEM_TRAN_ID ON CUST_STOCK_DET (ITEM_CODE, TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLEAVE_EMP_DATE_LVE_USE_STAT ON EMPLEAVE (EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, USE_FLAG, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE IOPOPHELPPACKAGE AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN iosundryMasterTable PIPELINED ; FUNCTION getInstrumentTypePophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2) RETURN instrumentTypeTable PIPELINED ; FUNCTION getInstrumentNoPophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2, asRefSer in varchar2) RETURN instrumentNoTable PIPELINED ; FUNCTION getPickRatePophelp (asTranDate in Date, asItemCode in varchar2, asQuantity in number, asSiteCode in varchar2, asLocCode in char) RETURN pickRateTable PIPELINED ; FUNCTION getCctrCodePophelp (acctCode in char) RETURN cctrMasterTable PIPELINED ; END IOpopHelpPackage; CREATE OR REPLACE PACKAGE BODY IOPOPHELPPACKAGE AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN iosundryMasterTable PIPELINED IS BEGIN IF asSyndryType = 'E' THEN FOR x IN (SELECT EMPLOYEE.EMP_CODE, EMPLOYEE.EMP_FNAME||' '||EMPLOYEE.EMP_MNAME||' '||EMPLOYEE.EMP_LNAME AS EMP_NAME,TRIM(STATION.DESCR) as CITY, TRIM(DEPARTMENT.DESCR) AS DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM EMPLOYEE, SITE, STATION, DEPARTMENT, STATE WHERE EMPLOYEE.WORK_SITE = SITE.SITE_CODE (+) AND EMPLOYEE.STAN_CODE__HQ = STATION.STAN_CODE (+) AND STATION.STATE_CODE = STATE.STATE_CODE (+) AND EMPLOYEE.DEPT_CODE = DEPARTMENT.DEPT_CODE (+) AND (EMPLOYEE.WORK_SITE = asLoginSite) ) LOOP PIPE ROW (iosundryMaster(x.EMP_CODE,x.EMP_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'S' THEN FOR x IN (SELECT SUPPLIER.SUPP_CODE, SUPPLIER.SUPP_NAME, TRIM(NVL(SUPPLIER.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM SUPPLIER, STATE WHERE nvl(SUPPLIER.BLACK_LIST,'N') != 'Y' AND SUPPLIER.STATE_CODE = STATE.STATE_CODE (+) and FN_SUPP_APPL_FOR_SITE(SUPPLIER.SUPP_CODE, asLoginSite)='Y') LOOP PIPE ROW (iosundryMaster(x.SUPP_CODE,x.SUPP_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'C' THEN FOR x IN (SELECT CUSTOMER.CUST_CODE, CUSTOMER.CUST_NAME, CUSTOMER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, CUSTOMER.ORDER_TYPE FROM CUSTOMER, STATE WHERE CUSTOMER.STATE_CODE = STATE.STATE_CODE (+) and FN_CUST_APPL_FOR_SITE(CUSTOMER.CUST_CODE, asLoginSite)='Y' AND (CUSTOMER.STOP_BUSINESS is null or CUSTOMER.STOP_BUSINESS = '')) LOOP PIPE ROW (iosundryMaster(x.CUST_CODE,x.CUST_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'T' THEN FOR x IN (SELECT TRANSPORTER.TRAN_CODE, TRANSPORTER.TRAN_NAME, TRANSPORTER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM TRANSPORTER, STATE WHERE TRANSPORTER.STATE_CODE = STATE.STATE_CODE (+) and FN_TRANS_APPL_FOR_SITE(TRANSPORTER.TRAN_CODE, asLoginSite) = 'Y') LOOP PIPE ROW (iosundryMaster(x.TRAN_CODE,x.TRAN_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'P' THEN FOR x IN (SELECT SALES_PERS.SALES_PERS, SALES_PERS.SP_NAME, SALES_PERS.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM SALES_PERS, STATE WHERE SALES_PERS.ACTIVE_YN <> 'N' AND SALES_PERS.STATE_CODE = STATE.STATE_CODE (+) and FN_SLPERS_APPL_FOR_SITE(SALES_PERS.SALES_PERS,asLoginSite) = 'Y') LOOP PIPE ROW (iosundryMaster(x.SALES_PERS,x.SP_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'X' THEN FOR x IN (SELECT TAX_AUTHORITY.TAUTH_CODE, TAX_AUTHORITY.TAUTH_NAME, TAX_AUTHORITY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM TAX_AUTHORITY, STATE WHERE TAX_AUTHORITY.STATE_CODE = STATE.STATE_CODE (+) and FN_TAXAUTH_APPL_FOR_SITE(TAX_AUTHORITY.TAUTH_CODE,asLoginSite) = 'Y') LOOP PIPE ROW (iosundryMaster(x.TAUTH_CODE,x.TAUTH_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'L' THEN FOR x IN (SELECT LOANPARTY.PARTY_cODE, LOANPARTY.PARTY_NAME, LOANPARTY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM LOANPARTY, STATE WHERE LOANPARTY.STATE_CODE = STATE.STATE_CODE (+) and FN_LPARTY_APPL_FOR_SITE(LOANPARTY.PARTY_CODE,asLoginSite) = 'Y') LOOP PIPE ROW (iosundryMaster(x.PARTY_CODE,x.PARTY_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'R' THEN FOR x IN (SELECT STRG_CUSTOMER.SC_cODE, STRG_CUSTOMER.FIRST_NAME||' '||STRG_CUSTOMER.MIDDLE_NAME||' '||STRG_CUSTOMER.LAST_NAME AS SC_NAME, CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM STRG_CUSTOMER, STATE WHERE STRG_CUSTOMER.STATUS ='A' AND STRG_CUSTOMER.STATE_CODE = STATE.STATE_CODE (+) and FN_STRGCUST_APPL_FOR_SITE(STRG_CUSTOMER.SC_cODE,asLoginSite) = 'Y') LOOP PIPE ROW (iosundryMaster(x.SC_CODE,x.SC_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; IF asSyndryType = 'B' THEN FOR x IN (SELECT BANK.BANK_CODE, BANK.BANK_NAME, BANK.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE, NULL ORDER_TYPE FROM BANK, STATE WHERE BANK.STATE_CODE = STATE.STATE_CODE (+) and FN_BANK_APPL_FOR_SITE(BANK.BANK_CODE, asLoginSite) = 'Y') LOOP PIPE ROW (iosundryMaster(x.BANK_CODE,x.BANK_NAME,x.CITY,X.DIVISION,X.STATE,X.ORDER_TYPE)); END LOOP; RETURN; END IF; END; --Start of getInstrumentTypePophelp function FUNCTION getInstrumentTypePophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2) RETURN instrumentTypeTable PIPELINED IS BEGIN --if asRcpMode = 'E' then --end if; if asRcpMode = 'B' then for x in (select DISTINCT(TRAN_SER) as pophelp_descr from receivables where trim(CUST_CODE) = trim(asCustCode) and trim(SITE_CODE) = trim(asSiteCode) and (TOT_AMT-Adj_Amt) < 0) loop pipe row (instrumentType(x.pophelp_descr)); end loop; return; elsif asRcpMode = 'E' then for x in (SELECT Descr as pophelp_descr FROM GENCODES WHERE FLD_NAME = 'CREDIT_CARD_TYPE') loop pipe row (instrumentType(x.pophelp_descr)); end loop; return; end if; END; --Start of getInstrumentNoPophelp function FUNCTION getInstrumentNoPophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2, asRefSer in varchar2) RETURN instrumentNoTable PIPELINED IS BEGIN if asRcpMode = 'B' then for x in (select TRAN_SER, REF_NO, REF_DATE, TOT_AMT - ADJ_AMT as BAL_AMT from receivables where trim(CUST_CODE) = trim(asCustCode) and trim(SITE_CODE) = trim(asSiteCode) and trim(TRAN_SER) = trim(asRefSer) and (TOT_AMT-ADJ_AMT) < 0) loop pipe row (instrumentNo(x.TRAN_SER, x.REF_NO, x.REF_DATE, x.BAL_AMT)); end loop; return; elsif asRcpMode = 'R' then for x in(select tran_type as TRAN_SER, tran_id as REF_NO ,tran_date as REF_DATE, net_amt as BAL_AMT from posreturn where trim(CUST_CODE) = trim(asCustCode) and adjusted is null or adjusted <> 'Y') loop pipe row (instrumentNo(x.TRAN_SER, x.REF_NO, x.REF_DATE, x.BAL_AMT)); end loop; return; end if; END; --start of pickrate function FUNCTION getPickRatePophelp (asTranDate in Date, asItemCode in varchar2, asQuantity in number, asSiteCode in varchar2, asLocCode in char) RETURN pickRateTable PIPELINED IS lotnopick char(15); ls_ptrrate number(14,3); ls_ptsrate number(14,3); ls_mrprate number(14,3); ls_quantity number(16,5); BEGIN --COMMENTED TO AVOID LOC_CODE WHILE SELECTING LOT NO --for x in (select lot_no, lot_sl from stock where item_code = asItemCode and site_code = asSiteCode and loc_code = asLocCode) for x in (select lot_no, lot_sl,loc_code, quantity from stock where item_code = asItemCode and site_code = asSiteCode and (QUANTITY - (ALLOC_QTY + (CASE WHEN HOLD_QTY IS NULL THEN 0 ELSE HOLD_QTY END))) > 0 and (exp_date > sysdate or exp_date is null)) loop lotnopick := x.lot_no; select nvl(FN_PICKRATE((select var_value from disparm where var_name = 'PTR') ,asTranDate,asItemCode,x.lot_no,(Select list_type from pricelist_mst where price_list = (select var_value from disparm where var_name = 'PTR' )), asQuantity, asSiteCode, x.loc_code, x.lot_sl),0), nvl(FN_PICKRATE((select var_value from disparm where var_name = 'PTS') ,asTranDate,asItemCode,x.lot_no,(Select list_type from pricelist_mst where price_list = (select var_value from disparm where var_name = 'PTS' )), asQuantity, asSiteCode, x.loc_code, x.lot_sl),0), nvl(FN_PICKRATE((select var_value from disparm where var_name = 'MRP') ,asTranDate,asItemCode,x.lot_no,(Select list_type from pricelist_mst where price_list = (select var_value from disparm where var_name = 'MRP' )), asQuantity, asSiteCode, x.loc_code, x.lot_sl),0) into ls_ptrrate,ls_ptsrate ,ls_mrprate from dual; ls_quantity := x.quantity; -- pipe row (pickRate(lotnopick,ls_ptrrate,ls_ptsrate,ls_mrprate)); pipe row (pickRate(lotnopick,ls_ptrrate,ls_ptsrate,ls_mrprate,ls_quantity)); end loop; return; END; ---Start cctr code package FUNCTION getCctrCodePophelp (acctCode in char) RETURN cctrMasterTable PIPELINED IS ls_cnt number(35); BEGIN select count(*) into ls_cnt from accounts_cctr where acct_code = acctCode; if(ls_cnt > 0) then FOR x IN (select a.cctr_code , c.descr, c.sh_descr from accounts_cctr a, costctr c where a.cctr_code=c.cctr_code and nvl(c.active, 'Y')='Y' and a.acct_code = acctCode) LOOP PIPE ROW (cctrMaster(x.CCTR_CODE, x.DESCR, x.SH_DESCR)); END LOOP; RETURN; end if; if(ls_cnt <= 0 ) then FOR x IN (SELECT CCTR_CODE, DESCR, SH_DESCR FROM COSTCTR where nvl(active, 'Y')='Y') LOOP PIPE ROW (cctrMaster(x.CCTR_CODE, x.DESCR, x.SH_DESCR)); END LOOP; RETURN; end if; END; END IOpopHelpPackage; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NO_OFART_PICKUPLIST (an_qty number, as_siteCd workorder_iss.site_Code%type, as_ItemCd workorder_issdet.item_Code%type, as_LocCd workorder_issdet.loc_Code%type, as_LotNo workorder_issdet.lot_no%type, as_LotSl workorder_issdet.lot_sl%type ) return varchar2 is ls_Datas nvarchar2(1000); begin --Material Pick - Up List - Summary select ceil(round(an_qty,3) / (case when quantity < qty_per_art then quantity else qty_per_art end)) || ' X ' || (case when quantity < qty_per_art then quantity else qty_per_art end) into ls_Datas from stock where site_code = as_siteCd and item_code = as_ItemCd and loc_code = as_LocCd and lot_no = as_LotNo and lot_sl = as_LotSl and quantity > 0 ; return ls_Datas; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SORDERDET_SCHEME_UNIQ ON SORDERDET_SCHEME (TRAN_ID, LINE_NO_FORM, SCHEME_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TOLERANCE (as_itemcode in char) return VARCHAR2 is ret_varvalue VARCHAR2(5); begin select nvl(udf_str3,'0') into ret_varvalue from gencodes where mod_name ='W_ITEM' and fld_name='SGRP_CODE' and fld_value =(select sgrp_code from item WHERE ITEM_CODE = as_itemcode) ; return( ret_varvalue ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYMENT_DATE_SITE_CODE ON MISC_PAYMENT (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C00708548 ON TNC_IGNORE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STOCKIST_PK ON SALES_QUOT_STOCKIST (QUOT_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MC_SLOT_DET_X ON MC_SLOT_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DRCR_RCP_CHK BEFORE INSERT OR UPDATE OF confirmed ON drcr_rcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; ls_drcrflag drcr_rcp.DRCR_FLAG%type; ls_refser gltrace.ref_ser%type; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin --select amount, DRCR_FLAG into lc_hdramt,ls_drcrflag from drcr_rcp --where tran_id = :new.tran_id; lc_hdramt := :old.amount ; ls_drcrflag := :old.DRCR_FLAG ; exception when others then lc_hdramt := 0; end; if ls_drcrflag = 'D' then ls_refser := 'DRNRCP'; else ls_refser := 'CRNRCP'; end if; begin select count(1) into ll_glcount from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if lc_hdramt <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but net amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_APRV_LOC (as_loccode in location.loc_code%type) return varchar2 is ls_loccode varchar2(8); ls_output varchar2(8); begin if ltrim(rtrim(as_loccode)) IN ('QUAR','REJ','RETEST') then ls_loccode := 'APRV'; ELSIF ltrim(rtrim(as_loccode)) = 'INTQ' then ls_loccode := 'INTF'; ELSIF ltrim(rtrim(as_loccode)) = 'RDPK' then ls_loccode := 'RDPK'; ELSIf substr(rtrim(as_loccode),length(rtrim(as_loccode)),length(rtrim(as_loccode)))='Q' THEN ls_loccode := substr(rtrim(as_loccode),1,length(rtrim(as_loccode)) - 1); ELSIF ltrim(rtrim(as_loccode)) = 'FROOM' then ls_loccode := 'BSR'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOM25X' then ls_loccode := 'BSR25X'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMC25' then ls_loccode := 'BSRC25'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMC30' then ls_loccode := 'BSRC30'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMC8' then ls_loccode := 'BSRC8'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMC8X' then ls_loccode := 'BSRC8X'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMF' then ls_loccode := 'BSRF'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMS8' then ls_loccode := 'BSRS8'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMX' then ls_loccode := 'BSRX'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMX25' then ls_loccode := 'BSRX25'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMS8X' then ls_loccode := 'BSRS8'; ELSIF ltrim(rtrim(as_loccode)) = 'FROOMPN' then ls_loccode := 'BSRPN'; else ls_loccode := 'A' || SUBSTR(as_loccode, 2); end if; return ls_loccode; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LOC_DIM_CODE ON LOCATION_DIM (LOC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_LCDET_X ON SALES_LCDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FT_BENEFIT_SCHDET_X ON FT_BENEFIT_SCHDET (BEN_SCH, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WOR_NOART (as_qcid in char) return number is ls_rcpid char(10); lc_rcpqty number(14,3); lc_passedqty number(14,3); lc_noart number (14); begin select porcp_no,qty_passed into ls_rcpid, lc_passedqty from qc_order where qorder_no = as_qcid; select quantity, no_art into lc_rcpqty, lc_noart from workorder_receipt where tran_id = ls_rcpid; if lc_passedqty is null then lc_passedqty := 0 ; end if; if lc_rcpqty is null then lc_rcpqty := 0 ; end if; if lc_noart is null then lc_noart := 0 ; end if; if lc_rcpqty > 0 then lc_noart := lc_noart / lc_rcpqty * lc_passedqty ; end if; if lc_noart is null then lc_noart := 0 ; end if; return lc_noart ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ADF_GET_PREVTIME (ls_emp_code in char, ld_attd_date in date, ls_option in char) return char is ls_time varchar2(1000); begin if ls_option = 'I' then select in_time||'#'||NVL(punch_str,'') into ls_time from attendance_day where emp_code = ls_emp_code and attd_date = ld_attd_date; elsif ls_option = 'O' then select out_time||'#'||NVL(punch_str,'') into ls_time from attendance_day where emp_code = ls_emp_code and attd_date = ld_attd_date; end if; return ls_time; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TOURFORM_TOURID ON TOUR_FORM (TOUR_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_USER_NAME ( as_user_code in char) return varchar2 is ls_user_name varchar2(40); begin select name into ls_user_name from users where upper(code) = upper(as_user_code); return ls_user_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083699 ON SF_PLAN_PARAM_STAN (PARAM_TABLE, PRD_CODE, STAN_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ADVBKING_CLOSE_ID ON ADVBKING_CLOSE (ADVBKING_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_APRV_NAME ( as_ls_ref_id varchar2) return varchar2 is ls_emp_aprv_name varchar2(200); begin select e.emp_fname ||' '|| e.emp_lname into ls_emp_aprv_name from obj_sign_trans os left outer join employee e on os.entity_code=e.emp_code where os.SIGN_STATUS ='U' AND OS.REF_ID = as_ls_ref_id; return ls_emp_aprv_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SER_CONTRACT_TERM_X ON SER_CONTRACT_TERM (SER_CONTRACT, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHECK_ADJRCP_ACCT BEFORE insert or UPDATE ON adj_issrcpdet FOR EACH ROW declare ls_invacct finparm.var_value%type; ls_refser char(6); BEGIN if :new.acct_code__dr is null or length(trim(:new.acct_code__dr)) = 0 then begin select var_value into ls_invacct from finparm where var_name = 'INV_ACCT_ARCP'; exception when others then ls_invacct := 'N'; end; if ls_invacct = 'Y' then begin select ref_ser into ls_refser from adj_issrcp where tran_id = :new.tran_id; exception when others then ls_refser := ' '; end; if trim(ls_refser) = 'ADJRCP' then raise_application_error( -20601, 'Inventory accounting is enabled debit a/c must be valid account code for line [' || to_char(:new.LINE_NO) ||']'); end if; end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_DISS_MISS_LINE before update of confirmed on distord_iss referencing old as old new as new FOR EACH ROW declare lc_quantity number(14,3) := 0; begin begin select sum(alloc_qty) into lc_quantity from invalloc_trace where ref_ser = 'D-ISS' and ref_id = :new.tran_id and to_number(trim(ref_line)) not in ( select line_no from distord_issdet where tran_id = :new.tran_id ); exception when others then lc_quantity := 0; end; if lc_quantity <> 0 then RAISE_APPLICATION_ERROR(-20602, 'There is some stock allocation as per allocation trace but the line item is missing in issue detail ' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXCHRATE_GT (as_refser in char,as_refid in char) return number is lc_exchrate number(15,6) := 1; begin select exch_rate into lc_exchrate from gltrace where ref_ser = as_refser and ref_id = as_refid and rownum = 1; return lc_exchrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SCHEME_DEF_DET_U ON SCHEME_DEF_DET (TRAN_ID, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_INVTRC_SITDT ON INVTRACE (SITE_CODE, ITEM_CODE, TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMPLOYEE_NAME ( as_emp_code char) return varchar2 is ls_name varchar2(50); ls_fname varchar2(15); ls_mname varchar2(15); ls_lname varchar2(15); begin begin select emp_fname,emp_mname,emp_lname into ls_fname,ls_mname,ls_lname from employee where emp_code = as_emp_code; exception when no_data_found then ls_name := null; end; ls_name := ls_fname||' '||ls_mname||' ' ||ls_lname; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDER_STATUS_DUE ON SORDER (STATUS, DUE_DATE, SALES_PERS, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PERMISSIONS_SUB_TREE_ROOT ( the_emp_code IN CHAR, the_level IN NUMBER) RETURN NUMBER IS sub_tree_root CHAR; BEGIN SELECT emp_code INTO sub_tree_root FROM employee WHERE level = the_level -- Connect 'upwards', i.e. find the parent CONNECT BY PRIOR report_to = emp_code START WITH emp_code = the_emp_code; RETURN sub_tree_root; END permissions_sub_tree_root; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUNDRY_SH_NAME ( as_sundrytype in char, as_sundrycode in char) return varchar is ls_name char(250); begin if trim(as_sundrytype) = 'O' then begin ls_name := ' '; end; end if; if trim(as_sundrytype) = 'T' then begin select (case when sh_name is null then substr(tran_name,1,20) else sh_name end) into ls_name from transporter where tran_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'B' then begin select (case when sh_name is null then substr(bank_name,1,20) else sh_name end) into ls_name from bank where bank_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'X' then begin select (case when sh_name is null then substr(tauth_name,1,20) else sh_name end) into ls_name from tax_authority where tauth_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'E' then begin select (case when short_name is null then substr( nvl(emp_fname,'')||nvl(emp_lname,''), 1, 40 ) else short_name end) into ls_name from employee where emp_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'P' then begin select (case when sh_name is null then substr(sp_name,1,20) else sh_name end) into ls_name from sales_pers where sales_pers = as_sundrycode; end; end if; if trim(as_sundrytype) = 'S' then begin select (case when sh_name is null then substr(supp_name,1,20) else sh_name end) into ls_name from supplier where supp_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'C' then begin select (case when sh_name is null then substr(cust_name,1,20) else sh_name end) into ls_name from customer where cust_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'L' then begin select (case when sh_name is null then substr(party_name,1,20) else sh_name end) into ls_name from loanparty where party_code = as_sundrycode; end; end if; if trim( as_sundrytype) = 'R' then begin select substr( nvl(rtrim(first_name),' ')||' '||nvl(rtrim(middle_name),' ') ||' '||nvl(rtrim(last_name),' '),1,40) into ls_name from strg_customer where sc_code = as_sundrycode; end; end if; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STATE_DESCR (mstate_code state.state_code%type) return varchar2 is mdescr state.descr%type; begin select descr into mdescr from state where state_code = mstate_code; return mdescr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE UDT_SITE_INFO_CHANGE AS TABLE OF UDTT_SITE_INFO_CHANGE -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE VISITEDWITHRELPOPHELP AS FUNCTION getvisitedWithRELData (empCode in char) RETURN vistRELMasterTABLE PIPELINED; END visitedWithRELPophelp; CREATE OR REPLACE PACKAGE BODY VISITEDWITHRELPOPHELP AS FUNCTION getvisitedwithreldata (empcode IN CHAR) RETURN vistrelmastertable pipelined IS ls_grade_typ CHAR(1); ls_cnt NUMBER(35); ls_grade_lev NUMBER(1); ls_custom_grade_lev NUMBER(1); ls_item_ser VARCHAR2(5); BEGIN select TRIM(item_ser) into ls_item_ser from sales_pers where sales_pers=empCode; SELECT (CASE WHEN b.grade_type IS NULL THEN 'T' ELSE b.grade_type END) INTO ls_grade_typ FROM employee A, grade b WHERE A.emp_code = empcode AND A.grade = b.grade_code; SELECT count(1) INTO ls_custom_grade_lev FROM sfaparm WHERE parm_name = 'TEAM_GRADE_LEV' AND active = 'Y'; IF ls_custom_grade_lev = 0 THEN ls_grade_lev := 4; ELSE SELECT parm_value INTO ls_grade_lev FROM sfaparm WHERE parm_name = 'TEAM_GRADE_LEV' AND active = 'Y'; END IF; IF ls_grade_typ <> 'M' THEN SELECT count(*) INTO ls_cnt FROM org_structure o, VERSION v START WITH o.pos_code=(SELECT o.pos_code__repto FROM org_structure o, VERSION v WHERE emp_code = empcode AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto AND o.active = 'Y') CONNECT BY PRIOR o.pos_code__repto = o.pos_code AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto AND o.active = 'Y'; IF ls_cnt > 0 THEN FOR x IN ( SELECT DISTINCT EMP_CODE AS report_to ,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS visited_with,'' AS grade_type,'N' AS resign_emp,'' AS status, ddf_get_employee_name(EMP.emp_code)||'('||ltrim(rtrim(EMP.design_code))||')' AS visited_with_display,g.level_no AS level_no, EMP.design_code AS design_code FROM EMPLOYEE EMP, GRADE G WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE union SELECT DISTINCT e.emp_code AS report_to, get_emp_designation(e.emp_code) designation, ddf_get_employee_name(e.emp_code)||' (' || LTRIM(RTRIM(e.EMP_CODE)) || ') ' AS visited_with, g.grade_type AS grade_type, 'N' AS resign_emp, '' AS status, ddf_get_employee_name(e.emp_code)||'('||ltrim(rtrim(e.design_code))||')' AS visited_with_display, grade.level_no AS level_no, e.design_code AS design_code FROM employee e,grade g,employee emp,grade grade WHERE e.emp_code IN (SELECT emp_code AS report_to FROM org_structure o, VERSION v START WITH o.pos_code=(SELECT o.pos_code__repto FROM org_structure o, VERSION v WHERE emp_code = empcode AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto AND o.active = 'Y') CONNECT BY PRIOR o.pos_code__repto = o.pos_code AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto AND o.active = 'Y') AND emp.grade = g.grade_code AND (CASE WHEN g.grade_type IS NULL THEN'T'ELSE g.grade_type END) <> 'M' AND emp.emp_code = empcode AND e.grade = grade.grade_code AND grade.level_no <= ls_grade_lev ORDER BY level_no DESC) loop pipe ROW (visitrelmaster(x.report_to,x.designation,x.visited_with,x.grade_type,x.resign_emp,x.status,x.visited_with_display,x.level_no, x.design_code)); END loop; RETURN; END IF; IF ls_cnt <= 0 THEN FOR x IN ( SELECT DISTINCT EMP_CODE AS report_to ,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION, DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS visited_with,'' AS grade_type,'N' AS resign_emp,'' AS status, ddf_get_employee_name(EMP.emp_code)||'('||ltrim(rtrim(EMP.design_code))||')' AS visited_with_display,g.level_no AS level_no, EMP.design_code AS design_code FROM EMPLOYEE EMP, GRADE G WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE union SELECT DISTINCT e.emp_code AS report_to, get_emp_designation(e.emp_code) designation, ddf_get_employee_name(e.emp_code)||' (' || LTRIM(RTRIM(e.EMP_CODE)) || ') ' AS visited_with, g.grade_type AS grade_type, 'N' AS resign_emp, '' AS status, ddf_get_employee_name(e.emp_code)||'('||ltrim(rtrim(e.design_code))||')' AS visited_with_display, grade.level_no AS level_no, e.design_code AS design_code FROM employee e,grade g,employee emp,grade grade WHERE e.emp_code IN (SELECT emp_code AS report_to FROM employee o START WITH emp_code=(SELECT report_to FROM employee o WHERE o.emp_code = empcode) CONNECT BY PRIOR o.report_to = o.emp_code) AND emp.grade = g.grade_code AND (CASE WHEN g.grade_type IS NULL THEN'T'ELSE g.grade_type END) <> 'M' AND e.grade=grade.grade_code AND grade.level_no <= ls_grade_lev AND emp.emp_code = empcode ORDER BY level_no DESC) loop pipe ROW (visitrelmaster(x.report_to,x.designation,x.visited_with,x.grade_type,x.resign_emp,x.status,x.visited_with_display,x.level_no, x.design_code)); END loop; RETURN; END IF; END IF; IF ls_grade_typ = 'M' THEN SELECT count(*) INTO ls_cnt FROM employee WHERE emp_code IN (SELECT emp_code FROM org_structure o, VERSION v START WITH emp_code = empcode CONNECT BY PRIOR o.pos_code = o.pos_code__repto AND o.pos_code__repto IS NOT NULL AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto AND o.active = 'Y' ); IF ls_cnt > 0 THEN FOR x IN ( SELECT DISTINCT EMP_CODE AS report_to ,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS visited_with,'M' AS grade_type,'N' AS resign_emp,'' AS status, ddf_get_employee_name(EMP.emp_code)||'('||ltrim(rtrim(EMP.design_code))||')' AS visited_with_display,g.level_no AS level_no, EMP.design_code AS design_code FROM EMPLOYEE EMP, GRADE G WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE union SELECT DISTINCT ss.sales_pers AS report_to, get_emp_designation(sales_pers) AS designation, (CASE WHEN emp.relieve_date IS NULL THEN ( CASE WHEN upper(ddf_get_employee_name(emp.emp_code)) = upper(ddf_get_employee_name(empcode)) THEN 'SELF' ELSE ddf_get_employee_name(emp.emp_code)||' (' || LTRIM(RTRIM(emp.EMP_CODE)) || ') ' END) WHEN emp.relieve_date IS NOT NULL THEN ddf_get_employee_name(emp.emp_code)||' (' || LTRIM(RTRIM(emp.EMP_CODE)) || ') ' ELSE '' END ) AS visited_with, g.grade_type AS grade_type, (CASE WHEN emp.relieve_date IS NULL THEN 'N' WHEN emp.relieve_date IS NOT NULL THEN 'Y' ELSE '' END) AS resign_emp, (CASE WHEN emp.relieve_date IS NULL THEN '' WHEN emp.relieve_date IS NOT NULL THEN 'VACANT' ELSE '' END) AS status, ddf_get_employee_name(emp.emp_code)||'('||ltrim(rtrim(emp.design_code))|| ')' AS visited_with_display, g.level_no AS level_no, emp.design_code AS design_code FROM sales_pers ss,sprs_route sr,grade g,employee e ,employee emp WHERE ss.sales_pers IN (SELECT emp_code FROM employee WHERE emp_code IN (SELECT emp_code FROM org_structure o, VERSION v START WITH emp_code = empcode CONNECT BY PRIOR o.pos_code = o.pos_code__repto AND o.pos_code__repto IS NOT NULL AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto AND o.active = 'Y' )) AND ss.sales_pers = sr.sprs_code AND ss.sales_pers = emp.emp_code AND sr.status = 'Y' AND e.grade = g.grade_code AND g.grade_type = 'M' AND e.emp_code = empcode UNION ALL SELECT DISTINCT ss.sales_pers AS report_to, get_emp_designation(sales_pers) AS designation, (CASE WHEN upper(ddf_get_employee_name(ss.emp_code)) = upper(ddf_get_employee_name(empcode)) THEN 'SELF' ELSE ddf_get_employee_name(SS.emp_code)||' (' || LTRIM(RTRIM(SS.EMP_CODE)) || ') ' END) AS visited_with, g.grade_type AS grade_type, 'Y' AS resign_emp, (CASE WHEN emp.relieve_date IS NULL THEN '' WHEN emp.relieve_date IS NOT NULL THEN 'VACANT' ELSE '' END) AS status, ddf_get_employee_name(emp.emp_code)||'('||ltrim(rtrim(emp.design_code))|| ')' AS visited_with_display, g.level_no AS level_no, emp.design_code AS design_code FROM sales_pers ss,sprs_route sr,grade g,employee e,employee emp WHERE ss.sales_pers IN ( SELECT emp_code FROM employee WHERE emp_code IN (SELECT emp_code FROM org_structure o, VERSION v START WITH emp_code = empcode CONNECT BY PRIOR o.pos_code = o.pos_code__repto AND o.pos_code__repto IS NOT NULL AND active = 'Y' AND o.version_id= v.version_id AND SYSDATE BETWEEN v.eff_from AND v.valid_upto )AND relieve_date IS NULL ) AND ss.sales_pers = sr.sprs_code AND ss.sales_pers = emp.emp_code AND sr.status = 'Y' AND e.grade = g.grade_code AND g.grade_type = 'M' AND e.emp_code = empcode) loop pipe ROW (visitrelmaster(x.report_to,x.designation,x.visited_with,x.grade_type,x.resign_emp,x.status,x.visited_with_display,x.level_no, x.design_code)); END loop; RETURN; END IF; IF ls_cnt <= 0 THEN FOR x IN( SELECT DISTINCT EMP_CODE AS report_to ,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS visited_with,'M' AS grade_type,'N' AS resign_emp,'' AS status, ddf_get_employee_name(EMP.emp_code)||'('||ltrim(rtrim(EMP.design_code))||')' AS visited_with_display,g.level_no AS level_no, EMP.design_code AS design_code FROM EMPLOYEE EMP, GRADE G WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE UNION ALL --SELECT DISTINCT ss.sales_pers AS report_to, SELECT DISTINCT emp.emp_code AS report_to, --get_emp_designation(sales_pers) AS designation, get_emp_designation(emp.emp_code) AS designation, (CASE WHEN emp.relieve_date IS NULL THEN ( CASE WHEN upper(ddf_get_employee_name(emp.emp_code)) = upper(ddf_get_employee_name(empcode)) THEN 'SELF' ELSE ddf_get_employee_name(emp.emp_code)||' (' || LTRIM(RTRIM(emp.EMP_CODE)) || ') ' END) WHEN emp.relieve_date IS NOT NULL THEN ddf_get_employee_name(emp.emp_code)||' (' || LTRIM(RTRIM(emp.EMP_CODE)) || ') ' ELSE '' END ) AS visited_with, g.grade_type AS grade_type, (CASE WHEN emp.relieve_date IS NULL THEN 'N' WHEN emp.relieve_date IS NOT NULL THEN 'Y' ELSE '' END) AS resign_emp, (CASE WHEN emp.relieve_date IS NULL THEN '' WHEN emp.relieve_date IS NOT NULL THEN 'VACANT' ELSE '' END) AS status, ddf_get_employee_name(emp.emp_code)||'('||ltrim(rtrim(emp.design_code))|| ')' AS visited_with_display, g.level_no AS level_no, emp.design_code AS design_code --FROM sales_pers ss,sprs_route sr,grade g,employee e ,employee emp FROM grade g,employee e ,employee emp --WHERE ss.sales_pers IN (SELECT emp_code FROM employee WHERE emp_code IN (SELECT emp_code FROM employee o START WITH emp_code = empcode -- CONNECT BY PRIOR o.emp_code = o.report_to AND o.report_to IS NOT NULL)) WHERE emp.emp_code IN ( (SELECT emp_code FROM employee WHERE emp_code IN ( SELECT emp_code FROM employee o START WITH emp_code = empCode CONNECT BY PRIOR o.emp_code = o.report_to AND o.report_to IS NOT NULL ) AND relieve_date IS NULL) UNION (SELECT emp_code FROM employee WHERE emp_code IN ( SELECT emp_code FROM employee o START WITH emp_code = ( SELECT report_to FROM employee o WHERE o.emp_code = empCode ) CONNECT BY PRIOR o.report_to = o.emp_code )) ) --AND ss.sales_pers = sr.sprs_code --AND ss.sales_pers = emp.emp_code --AND sr.status = 'Y' AND e.grade = g.grade_code AND g.grade_type = 'M' AND emp.status != 'S' AND e.emp_code = empcode UNION ALL --SELECT DISTINCT ss.sales_pers AS report_to, SELECT DISTINCT emp.emp_code AS report_to, --get_emp_designation(sales_pers) AS designation, get_emp_designation(emp.emp_code) AS designation, --(CASE WHEN upper(ddf_get_employee_name(ss.emp_code)) = upper(ddf_get_employee_name(empcode)) THEN 'SELF' ELSE ddf_get_employee_name(ss.emp_code)||' (' || LTRIM(RTRIM(ss.emp_code)) || ') ' END) AS visited_with, (CASE WHEN upper(ddf_get_employee_name(emp.emp_code)) = upper(ddf_get_employee_name(empcode)) THEN 'SELF' ELSE ddf_get_employee_name(emp.emp_code)||' (' || LTRIM(RTRIM(emp.emp_code)) || ') ' END) AS visited_with, g.grade_type AS grade_type, 'Y' AS resign_emp, (CASE WHEN emp.relieve_date IS NULL THEN '' WHEN emp.relieve_date IS NOT NULL THEN 'VACANT' ELSE '' END) AS status, ddf_get_employee_name(emp.emp_code)||'('||ltrim(rtrim(emp.design_code))|| ')' AS visited_with_display, g.level_no AS level_no, emp.design_code AS design_code --FROM sales_pers ss,sprs_route sr,grade g,employee e,employee emp FROM grade g,employee e,employee emp --WHERE ss.sales_pers IN ( SELECT emp_code FROM employee WHERE emp_code IN (SELECT emp_code FROM employee o START WITH emp_code = empcode -- CONNECT BY PRIOR o.emp_code = o.report_to AND o.report_to IS NOT NULL )AND relieve_date IS NULL ) WHERE emp.emp_code IN ( (SELECT emp_code FROM employee WHERE emp_code IN ( SELECT emp_code FROM employee o START WITH emp_code = empCode CONNECT BY PRIOR o.emp_code = o.report_to AND o.report_to IS NOT NULL ) AND relieve_date IS NULL) UNION (SELECT emp_code FROM employee WHERE emp_code IN ( SELECT emp_code FROM employee o START WITH emp_code = ( SELECT report_to FROM employee o WHERE o.emp_code = empCode ) CONNECT BY PRIOR o.report_to = o.emp_code )) ) --AND ss.sales_pers = sr.sprs_code --AND ss.sales_pers = emp.emp_code --AND sr.status = 'Y' AND e.grade = g.grade_code AND g.grade_type = 'M' AND emp.status != 'S' AND e.emp_code = empcode) loop pipe ROW (visitrelmaster(x.report_to,x.designation,x.visited_with,x.grade_type,x.resign_emp,x.status,x.visited_with_display,x.level_no,x.design_code)); END loop; RETURN; END IF; END IF; END; END visitedwithrelpophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_TRACE_X1 ON INVOICE_TRACE (DESP_ID, DESP_LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IDX_BANKTRANLOG ON BANKTRAN_LOG (SITE_CODE, TRAN_SER, TRAN_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_PAYMENT_DETAILS (AS_VOUCHER_NO char,AS_EMP_CODE char) return varchar2 is a_voucher_no payr_voucher.tran_id%type; a_tot_amt payr_voucher.tot_amt%type; a_tran_date payr_voucher.tran_date%type; a_result varchar2(50); begin if (AS_VOUCHER_NO is null) then return a_result; end if; begin select b.tran_id__payr into a_voucher_no from fullfinal_hdr a,fullfinal_det b where a.tran_id = b.tran_id and a.emp_code = AS_EMP_CODE and a.confirmed = 'Y' and b.tran_id__payr is not null and b.ref_ser = 'P-VOUC' and b.ref_no = AS_VOUCHER_NO; EXCEPTION WHEN NO_DATA_FOUND then a_voucher_no := AS_VOUCHER_NO; end; begin select tot_amt,tran_date into a_tot_amt,a_tran_date from payr_voucher where tran_id = a_voucher_no; if (a_tot_amt <= 0) then return a_tran_date; end if; select max(b.tran_date) into a_result from misc_paydet a,misc_payment b where b.tran_id = a.tran_id and a.tran_ser = 'P-VOUC' and a.vouch_no = a_voucher_no and b.confirmed = 'Y' and b.tran_id || a.vouch_no not in ( select c.payment_no || d.vouch_no from misc_payment_canc c,misc_payment_cancdet d where c.payment_no = b.tran_id and d.tran_id = c.tran_id and d.tran_ser = a.tran_ser and d.vouch_no = a.vouch_no and c.confirmed = 'Y'); EXCEPTION WHEN NO_DATA_FOUND then a_result := null; end; return a_result; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ISMYJUNIOR (sales_pers in char , entity_code in char) return number is a_retval number(1) := 0; BEGIN SELECT COUNT(EMP_CODE) INTO a_retval FROM ( select emp_code from employee start with emp_code = entity_code connect by prior emp_code = report_to ) WHERE EMP_CODE = sales_pers; return a_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DRUGLIC_DT (as_var_name in char,as_fin_ent in char,as_site_code in char) return date is mreg_date date; mvar_value varchar2(50); ls_var_name varchar2(50); ls_fin_ent varchar2(15); ls_site_code varchar(15); Begin if as_var_name Is Null or length(as_var_name) = 0 then ls_var_name := ''; else ls_var_name := as_var_name; end if; if as_fin_ent Is Null or length(as_fin_ent) = 0 then ls_fin_ent := ''; else ls_fin_ent := as_fin_ent; end if; if as_site_code Is Null or length(as_site_code) = 0 then ls_site_code := ''; else ls_site_code := as_site_code; end if; select var_value into mvar_value from disparm where prd_code = '999999' and var_name = ls_var_name; select reg_date into mreg_date from siteregno where rtrim(fin_entity) = rtrim(ls_fin_ent) and rtrim(site_code) = rtrim(ls_site_code) and rtrim(ref_code) = rtrim(mvar_value); return mreg_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STATUSCHG_RATING_X ON STATUSCHG_RATING (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_SORDITEM_ALLOC (as_sitecode in site.site_code%type) is ls_error exception ; ls_error1 exception ; ls_saleorder sorditem.sale_order%type; ls_explev sorditem.exp_lev%type; ls_lineno sorditem.line_no%type; lc_allocqty number(14,3); ll_sorallocount number(6) := 0; ll_despcount number(6) := 0; ll_start NUMBER := 1; --ll_pos NUMBER := 1; begin begin delete from sordalloc where sale_order in (select sale_order from sorder where status in ('C','X')); delete from sordalloc where (sale_order,line_no,exp_lev,item_code,loc_code,lot_no,lot_sl) in (select sale_order,line_no,exp_lev,item_code,loc_code,lot_no,lot_sl from ( select i.sale_order,i.line_no,i.exp_lev,s.site_code,s.item_code,s.loc_code,s.lot_no,s.lot_sl,s.quantity,s.alloc_qty, i.qty_alloc,sum(a.QTY_ALLOC) from stock s, sorditem i, sordalloc a where a.sale_order = i.sale_order and a.line_no = i.line_no and a.exp_lev = i.exp_lev and s.item_code = a.item_code and s.site_code = a.site_code and s.loc_code = a.loc_code and s.lot_no = a.lot_no and s.lot_sl = a.lot_sl and s.alloc_qty = 0 and s.site_code = as_sitecode and case when i.status is null then 'P' else i.status end not in ('C','X') group by i.sale_order,i.line_no,i.exp_lev,s.site_code,s.item_code,s.loc_code,s.lot_no,s.lot_sl,s.quantity,s.alloc_qty, i.qty_alloc having s.alloc_qty < i.qty_alloc or s.alloc_qty < sum(a.QTY_ALLOC) )) ; end ; begin --drop table sordalloc_t; EXECUTE IMMEDIATE 'truncate table sordalloc_t'; insert into sordalloc_t (SALE_ORDER, LINE_NO, EXP_LEV, SITE_CODE, ITEM_CODE, LOC_CODE, LOT_NO, LOT_SL, QUANTITY, STK_ALLOCQTY, QTY_ALLOC, ALLOC_QTY, NO_ROW) select i.sale_order,i.line_no,i.exp_lev,s.site_code,s.item_code,s.loc_code,s.lot_no,s.lot_sl,s.quantity,s.alloc_qty stk_allocqty, i.qty_alloc,sum(a.QTY_ALLOC) as alloc_qty,count(1) as no_row from stock s, sorditem i, sordalloc a where a.sale_order = i.sale_order and a.line_no = i.line_no and a.exp_lev = i.exp_lev and s.item_code = a.item_code and s.site_code = a.site_code and s.loc_code = a.loc_code and s.lot_no = a.lot_no and s.lot_sl = a.lot_sl and s.site_code = as_sitecode and case when i.status is null then 'P' else i.status end not in ('C','X') group by i.sale_order,i.line_no,i.exp_lev,s.site_code,s.item_code,s.loc_code,s.lot_no,s.lot_sl,s.quantity,s.alloc_qty, i.qty_alloc having s.alloc_qty < sum(a.QTY_ALLOC); for cur_stkalloc in ( select sale_order,line_no,exp_lev,site_code,item_code,loc_code,lot_no,lot_sl,quantity, stk_allocqty, qty_alloc,alloc_qty,no_row from sordalloc_t ) loop update sordalloc set qty_alloc = cur_stkalloc.stk_allocqty where sale_order = cur_stkalloc.sale_order and line_no = cur_stkalloc.line_no and exp_lev = cur_stkalloc.exp_lev and item_code = cur_stkalloc.item_code and loc_code = cur_stkalloc.loc_code and lot_no = cur_stkalloc.lot_no and lot_sl = cur_stkalloc.lot_sl ; end loop; end; begin --update sorditem set qty_alloc = 0 where site_code in ('CP376', 'CP383', 'CP114') and quantity <= qty_desp and qty_alloc <> 0; --update sorditem set qty_alloc = 0 where site_code in ('CP376', 'CP383', 'CP114') and qty_alloc > quantity - qty_desp ; update sorditem set qty_alloc = 0 where quantity <= qty_desp and qty_alloc <> 0; update sorditem set qty_alloc = 0 where qty_alloc > quantity - qty_desp ; end; declare cursor cur_allocation is select sale_order,line_no ,exp_lev ,sum(qty_alloc) from sordalloc where site_code = as_sitecode group by sale_order,line_no ,exp_lev; begin open cur_allocation; ll_sorallocount := 0; --if cur_allocation%notfound then -- Raise ls_error; --end if; loop fetch cur_allocation into ls_saleorder, ls_lineno, ls_explev, lc_allocqty; exit when cur_allocation %NOTFOUND; begin ll_sorallocount := ll_sorallocount + 1; update sorditem set qty_alloc = lc_allocqty where sale_order = ls_saleorder and line_no = ls_lineno and exp_lev = ls_explev; exception when others then DBMS_OUTPUT.PUT_LINE('ll_sorallocount [' || to_char(ll_sorallocount) ||'] ls_saleorder [' || ls_saleorder || '] ls_lineno [' || ls_lineno || '] ls_explev [' || trim(ls_explev) || '] lc_allocqty [' || to_char(lc_allocqty) || ']'); rollback; end; end loop; close cur_allocation; commit; end; EXCEPTION when others then if LENGTH(SQLERRM) > 250 then BEGIN ll_start := 1; dbms_output.put_line('There is an exception during update ' || TO_CHAR(SQLCODE) || '-' ); WHILE ll_start <= LENGTH(SQLERRM) LOOP DBMS_OUTPUT.PUT_LINE(SUBSTR(SQLERRM, ll_start, 200)); ll_start := ll_start + 200; END LOOP; END; else dbms_output.put_line('There is an exception during update ' || TO_CHAR(SQLCODE) || '-' || SQLERRM); end if; rollback; begin declare cursor cur_despatch is select d.SORD_NO, d.LINE_NO__SORD, d.EXP_LEV, sum(d.QUANTITY__STDUOM) from despatchdet d, despatch h where h.site_code = as_sitecode and nvl(h.confirmed,'N') = 'N' and (select count(1) from sordalloc a where a.site_code = h.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl) = 0 group by d.SORD_NO, d.LINE_NO__SORD, d.EXP_LEV; begin open cur_despatch; ll_despcount := 0; loop fetch cur_despatch into ls_saleorder, ls_lineno, ls_explev, lc_allocqty; exit when cur_despatch %NOTFOUND; ll_despcount := ll_despcount + 1; update sorditem set qty_alloc = qty_alloc + lc_allocqty where sale_order = ls_saleorder and line_no = ls_lineno and exp_lev = ls_explev; end loop; close cur_despatch; commit; end; EXCEPTION when others then if LENGTH(SQLERRM) > 250 then BEGIN ll_start := 1; dbms_output.put_line('There is an exception during update ' || TO_CHAR(SQLCODE) || '-' ); WHILE ll_start <= LENGTH(SQLERRM) LOOP DBMS_OUTPUT.PUT_LINE(SUBSTR(SQLERRM, ll_start, 200)); ll_start := ll_start + 200; END LOOP; END; else dbms_output.put_line('There is an exception during update ' || TO_CHAR(SQLCODE) || '-' || SQLERRM ); end if; rollback; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ADVAMT (as_sitecode in char,as_custcode in char , as_trandt in date) return number is ls_amt number; begin select SUM(receivables.tot_amt - receivables.adj_amt) into ls_amt from receivables where tran_ser ='R-ADV' and ( RECEIVABLES.CUST_CODE = as_custcode ) AND ( RECEIVABLES.SITE_CODE = as_sitecode ) and ( RECEIVABLES.tran_date <= as_trandt ); if (ls_amt is null) then ls_amt := 0; else ls_amt := ls_amt ; end if; return ls_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_SCCLOSE BEFORE insert or UPDATE of confirmed ON scontract FOR EACH ROW declare ls_invacct finparm.var_value%type; ls_refser char(6); BEGIN if :new.confirmed = 'Y' and :old.confirmed <> 'Y' and (:new.status = 'C' or :new.status = 'X') then raise_application_error( -20601, 'Contrac status is C (Closed) cannot be confirmed'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_SUNDRY_DETAILS (as_sundry_type CHAR,as_sundry_code CHAR,AS_FLAg char) RETURN VARCHAR2 IS LS_RET varchar2(500) ; ls_name supplier.supp_name%TYPE; ls_addr1 supplier.ALT_ADDR1%type; ls_addr2 supplier.ALT_ADDR2%type; ls_addr3 supplier.ALT_ADDR3%type; ls_city supplier.ALT_CITY%TYPE; ls_pin supplier.ALT_PIN%TYPE; BEGIN IF AS_SUNDRY_type='T' THEN IF AS_FLAG='N' THEN select tran_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from transporter where tran_code = as_sundry_code; ELSIF as_flag = 'D' then select tran_name, addr1, addr2, addr3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from transporter where tran_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='B' THEN if as_flag = 'N' then select bank_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from bank where bank_code = as_sundry_code; elsif as_flag = 'D' then select bank_name, addr1, addr2, addr3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from bank where bank_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='X' THEN if as_flag = 'N' then select tauth_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from tax_authority where tauth_code = as_sundry_code; elsif as_flag = 'D' then select tauth_name, addr1, addr2, addr3, city, pin into ls_name,ls_addr1,ls_addr2, ls_addr3, ls_city, ls_pin from tax_authority where tauth_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='E' THEN if as_flag = 'N' then select emp_fname||emp_mname||emp_lname, cur_add1, cur_add2, cur_add3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from employee where emp_code = as_sundry_code; elsif as_flag = 'D' then select emp_fname||emp_mname||emp_lname, cur_add1, cur_add2, cur_add3, cur_city, trim(cur_pin) into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from employee where emp_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='P' THEN if as_flag = 'N' then select sp_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from sales_pers where sales_pers = as_sundry_code; elsif as_flag = 'D' then select sp_name, addr1, addr2, addr3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from sales_pers where sales_pers = as_sundry_code; end if ; ELSIF AS_SUNDRY_tYPE='S' THEN if as_flag = 'N' then select supp_name, alt_addr1, alt_addr2, alt_addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from supplier where supp_code = as_sundry_code; elsif as_flag = 'D' then select supp_name, alt_addr1, alt_addr2, alt_addr3, alt_city, alt_pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from supplier where supp_code = as_sundry_code; if length(rtrim(ls_addr1)) = 0 then select supp_name, alt_addr1, alt_addr2, alt_addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from supplier where supp_code = as_sundry_code; end if; end if; ELSIF AS_SUNDRY_tYPE='C' THEN if as_flag = 'N' then select cust_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from customer where cust_code = as_sundry_code; elsif as_flag = 'D' then select cust_name, addr1, addr2, addr3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from customer where cust_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='L' THEN if as_flag = 'N' then select PARTY_NAME, ADDR1, ADDR2, ADDR3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from loanparty where party_code = as_sundry_code; elsif as_flag = 'D' then select PARTY_NAME, ADDR1, ADDR2, ADDR3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from loanparty where party_code = as_sundry_code; end if; end if; if length(rtrim(ls_addr1))=0 then ls_addr2 :=null ; end if; if length(rtrim(ls_addr2))=0 then ls_addr2 :=null ; end if; if length(rtrim(ls_addr3))=0 then ls_addr3 :=null; end if; if length(rtrim(ls_city))=0 then ls_city := null; end if; if length(rtrim(ls_pin))=0 then ls_pin := null; end if; if as_flag = 'N' then ls_ret := ls_name||'|'||ls_addr1||'|'||ls_addr2||'|'||ls_addr3; elsif as_flag = 'D' then ls_ret := ls_name||'|'||ls_addr1||'|'||ls_addr2||'|'||ls_addr3||'|'||rtrim(ls_city)||'|'||ls_pin; end if; return ls_ret; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PO_TAX (IN_TAX_CLASS IN CHAR, IN_TAX_CHAP IN CHAR, IN_TAX_ENV IN CHAR) return number as PVAL number(1); CLASS_CNT NUMBER; CHAP_CNT NUMBER; ENC_CNT NUMBER; BEGIN SELECT COUNT(*) INTO CLASS_CNT FROM TAXCLASS WHERE TAX_CLASS=IN_TAX_CLASS; SELECT COUNT(*) INTO CHAP_CNT FROM TAXCHAP WHERE TAX_CHAP=IN_TAX_CHAP; SELECT COUNT(*) INTO ENC_CNT FROM TAXENV WHERE TAX_ENV=IN_TAX_ENV; IF CLASS_CNT > 0 THEN IF CHAP_CNT > 0 THEN IF ENC_CNT > 0 THEN PVAL := 1; ELSE PVAL := 0; END IF; ELSE PVAL := 0; END IF; ELSE PVAL := 0; END IF; RETURN PVAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ARRS_PSITE_VDATE ON ARREARS (SITE_CODE__PAY, VOUCHER_DATE, PRD_CODE__ACC, PRD_CODE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TOKEN (as_string char, as_sep char) return varchar2 is ls_string varchar2(500) := as_string; ls_retstr varchar2(100); li_pos number; begin li_pos := instr(ls_string,as_sep); if li_pos = 0 then ls_retstr := ls_string; ls_string := ''; else ls_retstr := substr(ls_string,1,li_pos -1); ls_string := substr(ls_string, length(ls_string) - (li_pos + length(as_sep) - 1)); end if; return ls_retstr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE TAXENVIRONMENTTABLE AS TABLE OF taxEnvtable; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STRG_UNLISTED ( ls_tran_id char) return varchar2 is ls_strg_unlisted varchar2(2000); uli_cnt number(7); CURSOR l_ulisted is SELECT trim(guest_name) AS unlisted_customer FROM strg_event_plan_guests WHERE tran_id =ls_tran_id AND SUNDRY_CODE IS NULL; l_cur_rec l_ulisted%ROWTYPE; begin uli_cnt :=0; OPEN l_ulisted; LOOP uli_cnt := uli_cnt + 1; FETCH l_ulisted INTO l_cur_rec; EXIT WHEN l_ulisted%NOTFOUND; if(uli_cnt = 1) then ls_strg_unlisted := l_cur_rec.unlisted_customer; else ls_strg_unlisted := ls_strg_unlisted || ',' || l_cur_rec.unlisted_customer ; end if; END LOOP; return ls_strg_unlisted; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUPPBNKNM (as_suppcode in supplier.supp_code%type, as_bankcode in bank.bank_code%type) return varchar is ls_retval varchar(40); begin begin select BANK_NAME__BEN into ls_retval from supplier_bank where supp_code = as_suppcode and BANK_CODE__BEN = as_bankcode; exception when others then ls_retval := ''; end; if ls_retval is null then return ''; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ESI (EMP_CD char,BASE_PRD char,CURR_PRD char, AC_ES03A NUMBER,AC_ES03 NUMBER,aS_arrac_prd char,ac_curramt number,LC_ESIBASELIMIT_PREV NUMBER, LC_ESIBASELIMIT NUMBER,as_proctype char) return number IS lc_amt number(14,3); LC_PREVAMT NUMBER(14,3) := 0; LC_ES03A NUMBER(14,3) := 0; LC_ES03 NUMBER(14,3) := 0; LC_BASE NUMBER(14,3) := 0; LC_CURRAMT NUMBER(14,3) := 0; BEGIN if as_proctype <> 'AR' then IF NVL(AC_ES03A,0) = 0 OR NVL(AC_ES03A,0) > NVL(AC_ES03,0) THEN LC_BASE := NVL(AC_ES03,0); ELSE LC_BASE := NVL(AC_ES03A,0); END IF; IF LC_BASE <= LC_ESIBASELIMIT THEN RETURN ceil(ROUND(NVL(AC_CURRAMT,0),2)); ELSE RETURN 0; END IF; -- return ac_curramt; end if; LC_CURRAMT := ROUND(NVL(AC_CURRAMT,0),2); SELECT sum(AMOUNT) into lc_PREVamt FROM (select NVL(a.amount,0) AS AMOUNT from payrolldet a, payroll b where b.emp_code = a.emp_code and b.prd_code = a.prd_code and b.emp_code = EMP_CD and b.prd_code = CURR_PRD and a.ad_code ='ESI' and nvl(a.amount,0) <> 0 and b.voucher_no is not null UNION ALL select NVL(a.diff_amt,0) AS AMOUNT from arreardet a, arrears b where b.emp_code = a.emp_code and b.prd_code = a.prd_code and b.prd_code__acc = a.prd_code__acc and b.emp_code = EMP_CD and b.prd_code = CURR_PRD and a.ad_code ='ESI' and nvl(a.DIFF_AMT,0) <> 0 and b.voucher_no is not null ); IF LC_PREVAMT IS NULL THEN LC_PREVAMT := 0.00; END IF; IF NVL(AC_ES03A,0) = 0 OR NVL(AC_ES03A,0) > NVL(AC_ES03,0) THEN LC_BASE := NVL(AC_ES03,0); ELSE LC_BASE := NVL(AC_ES03A,0); END IF; IF LC_BASE > LC_ESIBASELIMIT_PREV THEN LC_CURRAMT := 0; END IF; IF LC_CURRAMT < LC_PREVAMT THEN RETURN LC_PREVAMT; END IF; SELECT NVL(AMOUNT,0) INTO LC_ES03A FROM PAYROLL_PROJDET WHERE EMP_CODE = EMP_CD AND PRD_CODE = AS_ARRAC_PRD AND AD_CODE = 'ES03A'; IF LC_ES03A IS NULL THEN LC_ES03A := 0.00; END IF; SELECT NVL(AMOUNT,0) INTO LC_ES03 FROM PAYROLL_PROJDET WHERE EMP_CODE = EMP_CD AND PRD_CODE = AS_ARRAC_PRD AND AD_CODE = 'ES03'; IF LC_ES03 IS NULL THEN LC_ES03 := 0.00; END IF; IF LC_ES03A = 0 OR LC_ES03A > LC_ES03 THEN LC_BASE := LC_ES03; ELSE LC_BASE := LC_ES03A; END IF; IF LC_BASE > LC_ESIBASELIMIT THEN RETURN LC_PREVAMT; ELSE RETURN (LC_CURRAMT) + ((ceil(lc_curramt-lc_prevamt))+lc_prevamt-lc_curramt); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_WORKLOC_DESCR (AS_WORK_LOC_CODE WORK_LOCATIONS.WORK_LOC_CODE%TYPE) RETURN VARCHAR2 IS LS_DESCR WORK_LOCATIONS.DESCR%TYPE; BEGIN BEGIN SELECT DESCR INTO LS_DESCR FROM WORK_LOCATIONS WHERE WORK_LOC_CODE = AS_WORK_LOC_CODE; EXCEPTION WHEN NO_DATA_FOUND THEN LS_DESCR := NULL; END; RETURN LS_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DATE_STRING (as_date in date, as_date_formate in char, as_date_lang in char) return char is ls_date char(20); ls_date_sting varchar2(40); ls_lang v$nls_parameters.value%type; begin if as_date_lang = 'HU' then ls_date_sting := 'NLS_DATE_LANGUAGE=HUNGARIAN'; elsif as_date_lang = 'SP' then ls_date_sting := 'NLS_DATE_LANGUAGE=SPANISH' ; elsif as_date_lang = 'DU' then ls_date_sting := 'NLS_DATE_LANGUAGE=DUTCH' ; elsif as_date_lang = 'EN' then ls_date_sting := 'NLS_DATE_LANGUAGE=ENGLISH' ; elsif as_date_lang = 'FR' then ls_date_sting := 'NLS_DATE_LANGUAGE=FRENCH' ; elsif as_date_lang = 'IT' then ls_date_sting := 'NLS_DATE_LANGUAGE=ITALIAN' ; elsif as_date_lang = 'GE' then ls_date_sting := 'NLS_DATE_LANGUAGE=GERMAN' ; elsif as_date_lang = 'PO' then ls_date_sting := 'NLS_DATE_LANGUAGE=PORTUGUESE' ; else begin select rtrim(value) into ls_lang from v$nls_parameters where parameter ='NLS_DATE_LANGUAGE'; exception when others then ls_lang:='AMERICAN'; end; ls_date_sting := 'NLS_DATE_LANGUAGE='|| ls_lang ; end if; begin select to_char(as_date, as_date_formate, ls_date_sting ) into ls_date from dual; exception when others then ls_date := ' '; end; return ls_date ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_REF_DATE (as_ref_ser in varchar2, as_ref_id in varchar2) return date is ld_ref_date date; begin if TRIM(as_ref_ser) = 'RCP' then select ref_date into ld_ref_date from receipt where tran_id = as_ref_id; elsif TRIM(as_ref_ser) = 'R-DIS' then select ref_date into ld_ref_Date from rcpdishnr where tran_id = as_ref_id; elsif TRIM(as_ref_ser) = 'E-PAY' then select ref_date into ld_ref_Date from payment_exp where tran_id = as_ref_id; elsif TRIM(as_ref_ser) = 'M-PAY' then select ref_date into ld_ref_Date from MISC_PAYMENT where tran_id = as_ref_id; end if; return ld_ref_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_TDDS_FORM (mamt_per_unit in number, msolid_form_perc in number, mbatch_size in number, munit_wt in number, msolid_ingre_perc in number) return number is mpotency number(14,6) := 0; begin -- if any independent value in the denominator is ZERO, Potency Adjusted will be set as ZERO if (munit_wt = 0 or msolid_ingre_perc = 0) then mpotency := 0; else mpotency := round( (mamt_per_unit * (msolid_form_perc / 100) * mbatch_size) / (munit_wt * (msolid_ingre_perc / 100)), 6); end if; return mpotency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DIST_SITESHIP_DESCR (as_ref_id in tax_processed.ref_id%type) return varchar2 is ls_descr site.descr%type; begin SELECT site.descr into ls_descr from distord_rcp,site WHERE DISTORD_RCP.tran_id=as_ref_id and site.site_code= DISTORD_RCP.site_code__ship; return ls_descr; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BOM_YIELD_PERC (as_site_code bom.site_code%type, as_item_code bom.item_code%type, as_bom_code bom.bom_code%type, as_flag in char) return number is ldec_yield_perc bom.yield_perc%type; ldec_mfg_lead siteitem.mfg_lead_time%type; begin if as_flag = 'STDYIELD' then select yield_perc into ldec_yield_perc from bom where bom_code = as_bom_code and item_code = as_item_code; if (ldec_yield_perc) is null or ldec_yield_perc = 0 then select yield_perc into ldec_yield_perc from siteitem where site_code = as_site_code and item_code = as_item_code; if sqlcode = 100 then select yield_perc into ldec_yield_perc from item where item_code = as_item_code; end if; end if; return ldec_yield_perc; else select mfg_lead_time into ldec_mfg_lead from siteitem where site_code = as_site_code and item_code = as_item_code; if sqlcode = 100 then select mfg_lead into ldec_mfg_lead from item where item_code = as_item_code; end if; return ldec_mfg_lead; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEM_DESCR_SRETURN (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,B.QUANTITY ,B.LOT_NO from item a ,sreturndet b where b.tran_id = as_tran_id and a.item_code = b.item_code; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''||' Item Description '||''||''||'Quantity'||''||''||'Return lot'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_VOUCHNO (AS_TRANID IN VARCHAR2) RETURN VARCHAR2 IS LS_TRANID VARCHAR2(100); CURSOR CUR_RCPNO IS SELECT DISTINCT VOUCHRCP.TRAN_ID FROM PORCP, VOUCHRCP WHERE PORCP.TRAN_ID = VOUCHRCP.PRCP_ID AND PORCP.TRAN_ID = AS_TRANID; BEGIN FOR I IN CUR_RCPNO LOOP LS_TRANID := LS_TRANID || ' ' || rtrim(I.TRAN_ID); END LOOP; RETURN LS_TRANID; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRINT_PERKSLIP ( ls_period char,ls_emp char ,ls_ad_code char) return number is lc_amt number (14,2) ; lc_amt1 number (14,2) ; begin SELECT COUNT(*) into lc_amt FROM PAYROLLDET,PAYROLL WHERE ( PAYROLLDET.prd_code = ls_period) AND ( PAYROLLDET.emp_code = ls_emp ) AND ( PAYROLLDET.ad_code = ls_ad_code) AND (PAYROLL.EMP_CODE = PAYROLLDET.EMP_CODE) AND (PAYROLL.PRD_CODE = PAYROLLDET.PRD_CODE) AND (nvl(PAYROLL.CONFIRMED , 'N') = 'Y') AND NVL(PAYROLLDET.AMOUNT,0) <> 0; SELECT COUNT(*) into lc_amt1 FROM ARREARDET,ARREARS WHERE ( ARREARDET.prd_code__acc = ls_period) AND ( ARREARDET.emp_code = ls_emp ) AND ( ARREARDET.ad_code = ls_ad_code) AND (ARREARS.EMP_CODE = ARREARDET.EMP_CODE) AND (ARREARS.PRD_CODE = ARREARDET.PRD_CODE) AND (ARREARS.PRD_CODE__ACC = ARREARDET.PRD_CODE__ACC) and (nvl(ARREARS.CONFIRMED,'N') = 'Y') AND NVL(ARREARDET.DIFF_AMT,0) <> 0; RETURN LC_AMT + lc_amt1; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TAX_CLASS (as_tran_id char,as_type char) return varchar2 is ls_sh_descr varchar2(100); ls_tax_class varchar2(100); begin if as_type='D' then select tax_class into ls_tax_class from sorddet where sale_order = as_tran_id and line_no = (select min(line_no) from sorddet where sale_order = as_tran_id); elsif as_type='T' then select tax_class into ls_tax_class from distord_issdet where tran_id = as_tran_id and line_no = (select min(line_no) from distord_issdet where tran_id = as_tran_id); else ls_tax_class:=''; end if; select sh_descr into ls_sh_descr from taxclass where tax_class = ls_tax_class; return trim(ls_sh_descr); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPROV_COUNT (as_emp_code char, as_cctr_code char) return integer AS prov_count integer; begin select count(*) into prov_count from misc_voucher, employee where misc_voucher.sundry_code = employee.emp_code and employee.cctr_code__sal = as_cctr_code and misc_voucher.sundry_code = as_emp_code and misc_voucher.sundry_type = 'E' and VOUCH_TYPE = 'F' and misc_voucher.confirmed = 'Y' GROUP BY employee.cctr_code__sal, employee.emp_code; return prov_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION BUILD_ALPHANUMERIC_STRINGS ( str1 IN VARCHAR2 ) RETURN VARCHAR2 DETERMINISTIC IS -- Local Variables clean_str1 VARCHAR2(4000); i NUMBER; char_code NUMBER; result VARCHAR2(4000); BEGIN -- Initialize cleaned strings clean_str1 := ''; -- Clean str1 - Keep only alphanumeric characters IF str1 IS NOT NULL THEN FOR i IN 1..LENGTH(str1) LOOP char_code := ASCII(SUBSTR(str1, i, 1)); -- Check if character is alphanumeric (A-Z, a-z, 0-9) IF (char_code BETWEEN 48 AND 57) OR -- 0-9 (char_code BETWEEN 65 AND 90) OR -- A-Z (char_code BETWEEN 97 AND 122) THEN -- a-z clean_str1 := clean_str1 || UPPER(SUBSTR(str1, i, 1)); END IF; END LOOP; END IF; RESULT := clean_str1; RETURN result; EXCEPTION WHEN OTHERS THEN -- Log the error (optional) -- INSERT INTO error_log (error_message, timestamp) VALUES (SQLERRM, SYSTIMESTAMP); RAISE; -- Re-raise the exception END build_alphanumeric_strings; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_GSTIRNINFO_INSERT BEFORE INSERT ON gst_ir_info FOR EACH ROW BEGIN SELECT lpad(to_char(gst_irn_seq.nextval),20,'0') INTO :new.tran_id FROM dual; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_CUSTOMER_NAME ON STRG_CUSTOMER (FIRST_NAME, MIDDLE_NAME, LAST_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALE_TERM_X ON SALE_TERM (TERM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE TAXENVTABLE AS OBJECT ( TAX_ENV VARCHAR2(15), DESCR VARCHAR2(60) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_LR_DATE (mtran_id char, mlr_date date) return number is mconf_date date; msite char(5); flag number; begin select site_code into msite from distord_iss where tran_id = mtran_id; if (msite like '__6__' or msite like '%302' or msite like '%314' or msite like '__308' or msite like '__383' or msite like '%401' or msite like '%407') then select (case when (site_code__dlv not like '__307') then (case when site_code not in ('AM645','SP645','UT645','UT314','AM314','SP314','SA314','AM383','CP383','SP383','SQ383') then ((case when mlr_date - trunc(conf_date) > 2 then 0 else 1 end)) else ((case when mlr_date - trunc(conf_date) > 5 then 0 else 1 end)) end) else 1 end) into flag from distord_iss where tran_id = mtran_id; return flag; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STATUTORY_OTH_DET_X ON STATUTORY_OTH_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_UNLISTED_DATA (ls_cust_type char ,as_emp_code char) return char is parmValue VARCHAR2(60); begin if(ls_cust_type='D') then SELECT GET_SFAPARM_DATA('ALLOW_DR_UNLIST_DAR',as_emp_code) INTO parmValue FROM DUAL; end if; if (ls_cust_type='C') then SELECT GET_SFAPARM_DATA('ALLOW_CH_UNLIST_DAR',as_emp_code) INTO parmValue FROM DUAL; end if; if (ls_cust_type='S') then SELECT GET_SFAPARM_DATA('ALLOW_SK_UNLIST_DAR',as_emp_code) INTO parmValue FROM DUAL; end if; return parmValue; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DOPL (V1 VARCHAR2) AS BEGIN DBMS_OUTPUT.PUT_LINE(V1); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TRANSIT_RCPNO (sitedlv in char,issdate in date,issueid in char) return char is rcpid varchar2(10); begin select tran_id into rcpid from distord_rcp where site_code = sitedlv and tran_date >= issdate and substr(remarks,1,10) = issueid and confirmed = 'Y'; return rcpid; exception when no_data_found then return null; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION MFG_GETTOTALISSUEQTY (quantity number,overPerc number,potencyAdj number) return number is totalIssueQty number( 14 , 6); issue_qty number(14,6); begin issue_qty := mfg_getIssueQty(quantity,overPerc); totalIssueQty := issue_qty + potencyAdj; return( totalIssueQty ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CONSUMEISSRCP_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON CONSUME_ISS referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; lc_rate number(17,3) := 0; ll_line_no number(3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; -- SELECT rate , line_no into lc_rate, ll_line_no FROM consume_iss_det where cons_issue = :new.cons_issue; BEGIN if :new.confirmed = 'Y' then begin --consumption issuen and return begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_CISS'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_consume in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM CONSUME_ISS_DET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.CONS_ISSUE = :new.cons_issue ) loop if cur_consume.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from consume_iss_det where cons_issue = :new.cons_issue; exception when others then ll_count:= 0; end; if (:new.tran_type = 'I') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'C-ISS' and ref_id = :new.cons_issue; exception when others then ll_glcount := 0; end; end if; if (:new.tran_type = 'R') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'C-IRTN' and ref_id = :new.cons_issue; exception when others then ll_glcount := 0; end; end if; if ll_count > 0 then begin SELECT sum(rate * quantity) into lc_rate FROM consume_iss_det where cons_issue = :new.cons_issue; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR if (:new.tran_type = 'I') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'C-ISS' and ref_id = :new.cons_issue; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if (:new.tran_type = 'R') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'C-IRTN' and ref_id = :new.cons_issue; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; -- count end end; end if ;-- end of varvalue if end if; end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYMENT_MODE ( ls_pay_mode char) return CHAR is ls_payment_mode varchar2(120); begin select (CASE WHEN ls_pay_mode = 'C' THEN 'Cash' WHEN ls_pay_mode = 'Q' THEN 'Cheque' WHEN ls_pay_mode = 'T' THEN 'Electronic Transfer' WHEN ls_pay_mode= 'D' THEN 'Demand Draft' WHEN ls_pay_mode = 'P' THEN 'Pay Order' WHEN ls_pay_mode = 'R' THEN 'Credit Card' WHEN ls_pay_mode = 'I' THEN 'EDI' WHEN ls_pay_mode = 'Y' THEN 'Payment Advice' WHEN ls_pay_mode = 'G' THEN 'RTGS' WHEN ls_pay_mode = 'N' THEN 'NEFT' WHEN ls_pay_mode = 'W' THEN 'Cheque Print' ELSE '' END) INTO ls_payment_mode from dual; return ls_payment_mode; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GRADE_DESCR ON GRADE (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_PICK_FINCHG ( as_crterm char ) return number is lc_finchg number(14,3); begin select nvl(fin_chg,0) into lc_finchg from crtermfc where cr_term = as_crterm and (line_no is null or line_no = ' 1'); if lc_finchg <> 0 then return lc_finchg; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PICKRATE (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, as_quantity in number, as_site_code in char, as_loc_code in char, as_lot_sl in char) RETURN NUMBER IS mrate number(14,3); ls_type char(1); ls_price_list__parent char(5); ls_plist char(5); BEGIN begin select list_type into ls_type from pricelist_mst where price_list = as_price_list and rownum = 1; exception when others then ls_type := 'L'; end; if ls_type = 'L' then begin select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop select (case when price_list__parent is null then ' ' else price_list__parent end ) into ls_price_list__parent from pricelist_mst where price_list = ls_plist and list_type = 'L'; IF ls_price_list__parent IS NULL THEN ls_price_list__parent := ' '; END IF; if trim(ls_price_list__parent) is null or length(trim(ls_price_list__parent)) = 0 then exit; end if; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then select rate into mrate from pricelist where price_list = ls_price_list__parent and item_code = as_item_code AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; if mrate > 0 then exit; end if; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'B' then begin select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop select (case when price_list__parent is null then '' else price_list__parent end ) into ls_price_list__parent from pricelist_mst where price_list = ls_plist and list_type = 'B'; IF ls_price_list__parent IS NULL THEN ls_price_list__parent := ' '; END IF; if trim(ls_price_list__parent) is null or length(trim(ls_price_list__parent)) = 0 then exit; end if; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then select nvl(rate,0) into mrate from pricelist where price_list = ls_price_list__parent and item_code = as_item_code and list_type = 'B' AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; if mrate > 0 then exit; end if ; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'M' or ls_type = 'N' then begin SELECT RATE into mrate FROM PRICELIST WHERE PRICE_LIST = as_price_list AND ITEM_CODE = as_item_code AND LIST_TYPE = ls_type AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity AND EFF_FROM <= ad_tran_date AND VALID_UPTO >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) into ls_price_list__parent FROM pricelist_mst WHERE PRICE_LIST = ls_plist and list_type = ls_type; IF ls_price_list__parent IS NULL THEN ls_price_list__parent := ' '; END IF; if trim(ls_price_list__parent) is null or length(trim(ls_price_list__parent)) = 0 then exit; end if; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then SELECT RATE into mrate FROM PRICELIST WHERE PRICE_LIST = ls_price_list__parent AND ITEM_CODE = as_item_code AND LIST_TYPE = ls_type AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity AND EFF_FROM <= ad_tran_date AND VALID_UPTO >= ad_tran_date; end if; if mrate > 0 then exit; end if; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'I' then begin mrate := 0 ; if as_lot_sl = null or length(trim(as_lot_sl)) = 0 then SELECT RATE into mrate FROM STOCK WHERE ITEM_CODE = as_item_code AND SITE_CODE = as_site_code AND LOC_CODE = as_loc_code AND LOT_NO = as_lot_no; else SELECT RATE into mrate FROM STOCK WHERE ITEM_CODE = as_item_code AND SITE_CODE = as_site_code AND LOC_CODE = as_loc_code AND LOT_NO = as_lot_no AND LOT_SL = as_lot_sl; end if; exception when no_data_found then mrate := 0 ; end; end if; return mrate; END FN_PICKRATE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_BT_REFNO BEFORE INSERT or UPDATE OF ref_no ON bank_statement referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE VISTRELMASTERTABLE AS TABLE OF visitRELMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SRETURN_CUST_TRAN_DATE ON SRETURN (CUST_CODE, TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CRTERM_FC (AC_AMOUNT IN NUMBER, AD_DUE IN DATE, AS_CRTERM IN CHAR , AD_TRAN IN DATE) RETURN NUMBER IS AC_INTAMT NUMBER (14,2) DEFAULT 0; LC_FINAMT NUMBER(14,3); LC_FINCHG NUMBER(14,3); LS_TYPE CHAR(1); LL_NO_DAYS NUMBER(14,3); BEGIN LL_NO_DAYS := FLOOR(SYSDATE - AD_DUE); select fin_chg, fchg_type into lc_finchg, ls_type from crtermfc where cr_term = AS_CRTERM and LL_NO_DAYS >= min_day and LL_NO_DAYS <= max_day and AC_AMOUNT >= min_cramt and AC_AMOUNT <= max_cramt and AD_TRAN >= eff_date and AD_TRAN <= valid_upto ; If LS_TYPE = 'P' then AC_INTAMT := ROUND((AC_AMOUNT * LC_FINCHG / 100 ) / 365 ,2); AC_INTAMT := AC_INTAMT * LL_NO_DAYS; elsif LS_TYPE = 'F' then AC_INTAMT := LC_FINCHG; else AC_INTAMT := -1; return AC_INTAMT; end if; IF AC_INTAMT = NULL THEN AC_INTAMT := 0; END IF; Return ROUND(AC_INTAMT); exception when no_data_found then RETURN AC_INTAMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX NSRNO_ADATE ON NSRNO (ADATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UIDX_PROCESS ON PROCESS (PROC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TOUR_APPL_DATE_EMPCD ON TOUR (APPL_DATE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UNCON_WG ( as_tranid char, AS_SITECODE CHAR, AS_LOCCODE CHAR , AS_LOTNO CHAR, AS_LOTSL CHAR, AC_remwt number) RETURN NUMBER IS LC_COUNT NUMBER (6); BEGIN IF AC_remwt > 0 THEN SELECT COUNT(1) INTO LC_COUNT FROM workorder_issdet_sl d, woi_scan_hdr h WHERE d.tran_id = h.tran_id and d.tran_id <> as_tranid and h.SITE_CODE = AS_SITECODE AND d.LOC_CODE = AS_LOCCODE AND d.LOT_NO = AS_LOTNO AND d.LOT_SL = AS_LOTSL and case when h.confirmed is null then 'N' else h.confirmed end = 'N' ; ELSE LC_COUNT := 0 ; END IF ; RETURN LC_COUNT ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_DISCOUNT (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, ac_qty in number) return number is mrate number(14,3); begin if as_type = 'L' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; elsif as_type = 'D' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; elsif as_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; elsif as_type = 'N' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'N' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; elsif as_type = 'M' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'M' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_STAN_CODE (as_sundry_type char, as_sundry_code char) return varchar is ls_stan_name station.descr%type; ls_stan_code station.stan_code%type; begin select fn_get_stan_code(as_sundry_type, as_sundry_code ) into ls_stan_code from dual; if ls_stan_code is not null and length(trim(ls_stan_code)) > 0 then select descr into ls_stan_name from station where stan_code = ls_stan_code; ls_stan_name := trim(ls_stan_name); else ls_stan_name := null; end if; return ls_stan_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DRCR_NOTE_TAX (as_tranid char , as_lineno number,as_tran_ser char) return number is mtax number := 0; ls_format varchar2(3):= ' '; ls_line char(5); mvar_value varchar2(50) ; ls_var varchar2(50); ls_string nvarchar2(4000); ls_token nvarchar2(4000); mvar_value1 varchar2(50) ; begin select trim(var_value) into mvar_value from disparm where prd_code = '999999' and var_name = 'SALES_TAX'; if sqlcode < 0 then return -1; end if ; ls_var := rpad((' ' || trim(to_char(as_lineno))),3); dbms_output.put_line('ls_var ::::::::: '|| ls_var ); while length(trim(mvar_value)) > 0 --(pos(mvar_value,',') <> 0) loop ls_Token := trim(ddf_get_token(mvar_value,',')); ls_string := ls_string || '''' || trim(ls_Token) || ''','; dbms_output.put_line('ls_string ::::::::: '|| ls_string ); mvar_value1 := substr(mvar_value,length(ls_token)+2 ,LENGTH(mvar_value)); mvar_value := mvar_value1; end loop; ls_string := '(' || substr(ls_string,1,LENGTH(ls_string)-1) || ') '; declare cursor c1 is SELECT sum(tax_amt) FROM taxtran WHERE tran_code = as_tran_ser and tran_id = as_tranid and line_no = ls_var and tax_code IN ls_string; begin open c1; fetch c1 into mtax; close c1; end; if sqlcode < 0 then return -1 ; end if ; if mtax is null then mtax := 0.00 ; end if; return mtax; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_MJ_WRK_BONUS (AS_EMP_CODE char,AS_PRD_FR char,AS_FLAG char) return number is a_bonus_amt payarr_det.amount%type; a_tot_amt payarr_det.amount%type; a_prd_to payarr_det.prd_code%type; a_work_days attendance_mon.work_days%type; begin select to_char(add_months(fr_date,11),'YYYYMM') into a_prd_to from period where code = AS_PRD_FR; select nvl(sum(work_days),0) into a_work_days from attendance_mon where prd_code >= AS_PRD_FR and prd_code <= a_prd_to and emp_code = AS_EMP_CODE; if (a_work_days < 30) then return 0; end if; select sum(round((case when amount between -2500 and 2500 then (amount * 8.33 / 100) else (case when instr(amount,'-') = 0 then (2500 * 8.33 / 100) else (-2500 * 8.33 / 100) end) end),2)), sum(round(amount * 20 / 100,2)) into a_bonus_amt,a_tot_amt from (select prd_code,sum(amount) amount from payarr_det where prd_code >= AS_PRD_FR and prd_code <= a_prd_to and emp_code = AS_EMP_CODE and ad_code in ('BAS','BASM') group by prd_code order by prd_code); a_bonus_amt := nvl(a_bonus_amt,0); a_tot_amt := nvl(a_tot_amt,0); if (AS_FLAG = 'B') then return a_bonus_amt; elsif (AS_FLAG = 'E') then return (a_tot_amt - a_bonus_amt); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_SR BEFORE UPDATE of confirmed ON sreturn referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from porcpdet where tran_id = :tran_id'; OPEN cur_out FOR ls_sql USING :new.tran_id ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'S-RET' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'S-RET' and tran_id = :new.tran_id and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_IAMD AFTER UPDATE OF CONFIRMED ON invoice_amendment REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ls_tranid e_invoice.tran_id%type; ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN begin select tran_id into ls_tranid from e_invoice where ref_ser = 'S-INV' and ref_id = :new.invoice_id; exception when others then ls_tranid := null; end; if ls_tranid is not null then begin update e_invoice set Trans_Mode = (select case when :new.trans_mode = 'R' then '1' when :new.trans_mode = 'L' then '2' when :new.trans_mode = 'A' then '3' when :new.trans_mode = 'S' then '4' else '1' end from dual), -- Road-1, Rail-2, Air-3, Ship-4 TRAN_gstn = (select case when t.tax_reg_2 = 'UNREGISTER' then ' ' else t.tax_reg_2 end from transporter t where t.tran_code = :new.tran_code), lr_date = :new.lr_date, lr_no = :new.lr_date, lorry_no = :new.lorry_no, Vehicle_Type = 'R', tran_name = (select t.tran_name from transporter t where t.tran_code = :new.tran_code) where tran_id = ls_tranid; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to update data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DOC_LIST_CNT (as_mth varchar2, as_locality char, as_sprs char, as_opt varchar2) return number is CntDoc Number(4); begin if as_opt='S' then select count(sc_code) into CntDoc from strg_series where trim(sales_pers) = trim(as_sprs) and route_id in (select route_id from sprs_route where trim(locality_code) = trim(as_locality) and trim(sales_pers) = trim(as_sprs)); elsif as_opt='M' then select count(strg_code) into CntDoc from strg_meet where to_char(event_date,'monthyy') = as_mth and trim(sales_pers) = trim(as_sprs) and trim(locality_code) = trim(as_locality) and strg_code is not null and strg_code in (select sc_code from strg_series where trim(sales_pers) = trim(as_sprs)); end if; return nvl(CntDoc, 0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_SO BEFORE UPDATE of confirmed ON sorder referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from sorddet where sale_order = :tran_id'; OPEN cur_out FOR ls_sql USING :new.sale_order ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'S-ORD' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'S-ORD' and tran_id = :new.sale_order and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RECO_ACCT (as_acct_code_revr in char) return char is acct char(10); begin begin select udf_str1 into acct from gencodes where MOD_name='W_REV_ACCT_CODE' and FLD_NAME='ACCT_CODE_REV' and active ='Y' and fld_value= as_acct_code_revr ; exception when others then acct := ''; end; return acct; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PRODUCT_DIM_PROD_CODE ON PRODUCT_DIM (PRODUCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE STRGCODEMASTER AS OBJECT ( STRG_CODE CHAR(10), STRG_NAME VARCHAR2(120), STRG_TYPE CHAR(1), ADDRESS_AS NVARCHAR2(120), GENDER CHAR(1) , ADDR1 VARCHAR2(45), ADDR2 VARCHAR2(40), ADDR3 VARCHAR2(40), EMAIL_ADDR VARCHAR2(40), MOBILE_NO VARCHAR2(15), SPL_CODE CHAR(10), SPECIALITY_DESCR VARCHAR2(40), STRG_CLASS_CODE CHAR(1), CLASS_CODE_DESCR VARCHAR2(15), LOCALITY_CODE CHAR(10), LOCALITY_DESCR VARCHAR2(60), PRICE_LIST CHAR(5), TOTAL_CGST NUMBER(2), TOTAL_SGST NUMBER(2), STRG_STATE VARCHAR2(60) , STRG_GST_NO VARCHAR2(40) , VISITED_WITH_TEAM CHAR(10) , TAGGED_LOCATION varchar2(60) , GEOPOS_ADDRESS varchar2(250), ALLWD_DELAY_PRD number(3), VARIANCE_DISTANCE VARCHAR2(60), SUBCLASS_DESCR VARCHAR2(50), PROMOTER_NAME VARCHAR2(60) , MAN_POWER NUMBER(3) , GST_NO VARCHAR2(40) , SUBCLASS_CODE CHAR(2), PIN VARCHAR2(10) , SH_DESCR VARCHAR2(15), ROUTE_ID CHAR(3), SURVEY_TEMPL CHAR(10), NO_VISIT NUMBER(2), LAST_MEET_SUMM VARCHAR2(160), LAST_MEET_DATE DATE, REG_NO VARCHAR2(40), NON_ECO_DET VARCHAR2(200), PRICE_LIST__DISC CHAR(5), GST_CODE VARCHAR2(5), PRICE_LIST__PAYDIS CHAR(5) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_PC_TB force AS TABLE OF CHC_CHEM_PC_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE UPDATE_ATTENDANCE (AS_EMP_CODE char,AS_DATE_PUNCH date,AS_TIME_PUNCH char) as begin declare a_time_punch workshft.in_time%type := AS_TIME_PUNCH; a_work_shift employee.work_shift%type; a_shift_intime workshft.in_time%type; a_lunch_time workshft.lunch_time%type; a_hol_tblno holiday.hol_tblno%type; a_fin_entity site.fin_entity%type; a_prv_date date := AS_DATE_PUNCH - 1; a_count number(5); a_count1 number(5); cursor c1 is select work_shift from ( select tran_date eff_date,work_shift_o work_shift,conf_date,chg_date from employee_det_change where emp_code = AS_EMP_CODE and tran_date > AS_DATE_PUNCH and status = 'C' union all select eff_Date,work_shift__fr work_shift,conf_date,chg_date from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE_PUNCH and confirmed = 'Y' ) order by eff_date,conf_date,chg_date; begin select b.fin_entity into a_fin_entity from employee a,site b where a.emp_code = AS_EMP_CODE and b.site_code = a.work_site; select count(*) into a_count from work_shift where emp_code = AS_EMP_CODE and AS_DATE_PUNCH between from_dt and to_dt; if (a_count > 0) then select shift into a_work_shift from work_shift where emp_code = AS_EMP_CODE and AS_DATE_PUNCH between from_dt and to_dt; else for i in c1 loop a_work_shift := i.work_shift; exit; end loop; if (a_work_shift is null) then select work_shift into a_work_shift from employee where emp_code = AS_EMP_CODE; end if; end if; select in_time,lunch_time into a_shift_intime,a_lunch_time from workshft where shift = a_work_shift and day_no = to_char(AS_DATE_PUNCH,'D'); select count(*) into a_count from attendance_day where attd_date = AS_DATE_PUNCH and emp_code = AS_EMP_CODE; if (a_count > 0) then if (a_fin_entity in ('IC','HU')) then update attendance_day set out_time = a_time_punch,punch_str = punch_str || ' , -' || AS_TIME_PUNCH, work_hour = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time)) where attd_date = AS_DATE_PUNCH and emp_code = AS_EMP_CODE; else if (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) + 30)) then update attendance_day set punch_str = punch_str || ' , -' || AS_TIME_PUNCH where attd_date = AS_DATE_PUNCH and emp_code = AS_EMP_CODE; else update attendance_day set out_time = a_time_punch,punch_str = punch_str || ' , -' || AS_TIME_PUNCH, work_hour = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time)) where attd_date = AS_DATE_PUNCH and emp_code = AS_EMP_CODE; end if; end if; else select count(*) into a_count1 from work_shift where emp_code = AS_EMP_CODE and a_prv_date between from_dt and to_dt and shift = (select shift from workshft where shift = work_shift.shift and day_no = to_char(a_prv_date,'D') and (out_time > '24:00' or out_time < in_time)); select ddf_get_holtblno(AS_EMP_CODE,AS_DATE_PUNCH) into a_hol_tblno from dual; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE_PUNCH; if ((a_count1 > 0) or (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) - 120)) or (a_count > 0)) then if (a_fin_entity in ('IC','HU') and a_count1 > 0) then select count(*) into a_count from attendance_day a,workshft b where a.attd_date = a_prv_date and a.emp_code = AS_EMP_CODE and b.shift = a.shift and b.day_no = a.day_no and (ddf_time_in_mm(a_time_punch)+1440) <= (ddf_time_in_mm(b.out_time) + (case when b.out_time < b.in_time then 1440 else 0 end) + 300); else select count(*) into a_count from attendance_day where attd_date = a_prv_date and emp_code = AS_EMP_CODE and out_time is null; end if; if (a_count > 0) then a_time_punch := to_char((to_number(substr(a_time_punch,1,2))+24)) || ':' || substr(a_time_punch,4,2); update attendance_day set out_time = a_time_punch,punch_str = punch_str || ' , -' || a_time_punch, work_hour = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time)) where attd_date = a_prv_date and emp_code = AS_EMP_CODE; else insert into attendance_day (attd_date,emp_code,in_time,shift,day_no,chg_date,chg_user,chg_term,punch_str,lunch_time) values (AS_DATE_PUNCH, AS_EMP_CODE,a_time_punch,a_work_shift,to_char(AS_DATE_PUNCH,'D'),sysdate,user,userenv('terminal'),'-' || AS_TIME_PUNCH,a_lunch_time); end if; else insert into attendance_day (attd_date,emp_code,in_time,shift,day_no,chg_date,chg_user,chg_term,punch_str,lunch_time) values (AS_DATE_PUNCH, AS_EMP_CODE,a_time_punch,a_work_shift,to_char(AS_DATE_PUNCH,'D'),sysdate,user,userenv('terminal'),'-' || AS_TIME_PUNCH,a_lunch_time); end if; end if; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_COMPANY_PF (as_site_code varchar2 ,pf_no varchar2 ) return varchar2 is mpfreg varchar2(40) ; begin declare mcode5 char(200) ; ls_fin char(10) ; BEGIN begin select nvl(var_value,'NULLFOUND') into mcode5 from payrparm where prd_code='999999'and var_name = 'PFREG'; exception when NO_DATA_FOUND then mcode5 := 'NULLFOUND' ; end ; begin select fin_entity into ls_fin from site where site_code = as_site_code ; if mcode5 <> 'NULLFOUND' then begin Select nvl(reg_no ,'00') into mpfreg from siteregno where fin_entity = ls_fin and site_code = as_site_code and ref_code = mcode5 ; exception when NO_DATA_FOUND then Select nvl(reg_no,' ') into mpfreg from siteregno where fin_entity = ls_fin and site_code = '99999' and ref_code = mcode5 ; end ; if mpfreg = '00' then Select nvl(reg_no,' ') into mpfreg from siteregno where fin_entity = ls_fin and site_code = '99999' and ref_code = mcode5 ; end if ; else mpfreg :='' ; end if ; END ; if length(rtrim(ltrim(mpfreg))) > 0 then if length(rtrim(ltrim(pf_no))) = 0 or length(rtrim(ltrim(pf_no))) > 0 then mpfreg := mpfreg ||'/'||rtrim(ltrim(pf_no)) ; end if ; else mpfreg := pf_no ; end if ; return mpfreg ; end ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LEGAL_AGR_DET_X ON LEGAL_AGR_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PM_IMPL_PM_ID ON PM_IMPL (PM_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TESI (EMP_CD char,BASE_PRD char,CURR_PRD char,aS_arrac_prd char,ac_curramt number,LC_ESIBASELIMIT NUMBER,as_proctype char) return number is LC_PREVAMT NUMBER(14,3) := 0; LC_ES03A NUMBER(14,3) := 0; LC_ES03 NUMBER(14,3) := 0; LC_BASE NUMBER(14,3) := 0; BEGIN if (as_proctype <> 'AR') then return ac_curramt; end if; select nvl(max(amount),0) into lc_prevamt FROM ( select nvl(a.amount,0) as amount from payrolldet a,payroll b where b.emp_code = a.emp_code and b.prd_code = a.prd_code and b.emp_code = EMP_CD and b.prd_code = CURR_PRD and a.ad_code = 'TESI' and nvl(a.amount,0) <> 0 and b.voucher_no is not null union all select nvl(a.amount,0) as amount from arreardet a,arrears b where b.emp_code = a.emp_code and b.prd_code = a.prd_code and b.prd_code__acc = a.prd_code__acc and b.emp_code = EMP_CD and b.prd_code = CURR_PRD and a.ad_code = 'TESI' and nvl(a.amount,0) <> 0 and b.voucher_no is not null ); IF (AC_CURRAMT < LC_PREVAMT) THEN RETURN LC_PREVAMT; END IF; begin SELECT NVL(AMOUNT,0) INTO LC_ES03A FROM PAYROLL_PROJDET WHERE EMP_CODE = EMP_CD AND PRD_CODE = AS_ARRAC_PRD AND AD_CODE = 'ES03A'; EXCEPTION WHEN NO_DATA_FOUND THEN raise_application_error (-20001,'Current month projection not found'); end; IF (LC_ES03A IS NULL) THEN LC_ES03A := 0.00; END IF; begin SELECT NVL(AMOUNT,0) INTO LC_ES03 FROM PAYROLL_PROJDET WHERE EMP_CODE = EMP_CD AND PRD_CODE = AS_ARRAC_PRD AND AD_CODE = 'ES03'; EXCEPTION WHEN NO_DATA_FOUND THEN raise_application_error (-20001,'Current month projection not found'); end; IF (LC_ES03 IS NULL) THEN LC_ES03 := 0.00; END IF; IF (LC_ES03A > LC_ES03) THEN LC_BASE := LC_ES03; ELSE LC_BASE := LC_ES03A; END IF; IF (LC_BASE > LC_ESIBASELIMIT) THEN RETURN LC_PREVAMT; ELSE RETURN AC_CURRAMT; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INVOICE_SALES_CREDIT_X ON INVOICE_SALES_CREDIT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_DUP_REC_OPENING (as_ref_no in receivables_dtl.ref_no%type,as_tran_ser in receivables_dtl.tran_ser%type) return number is ls_count number(10,0); ls_ref_count number(10,0); begin begin ls_count :=0; SELECT count(1) into ls_count FROM FINPARM WHERE var_name='LY_DUPREC_NO' and var_value='Y'; exception when no_data_found then ls_count :=0; end; if ls_count >0 then SELECT COUNT(1) into ls_ref_count FROM RECEIVABLES WHERE REF_NO=as_ref_no AND TRAN_SER=as_tran_ser ; IF ls_ref_count >0 THEN return 0; ELSE RETURN 1; END IF; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONTAINER_CONTRACT_DATE ON RETAINER_CONTRACT (CONTRACT_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INCQTR_X ON INCQTR (ITEM_SER, TERR_CODE, QTR, PROC_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STATE_TAX_DESC (PRC_CODE IN CHAR,VAR_CODE IN VARCHAR2) RETURN VARCHAR2 IS AS_DESC VARCHAR2(120); BEGIN BEGIN SELECT DESCR INTO AS_DESC FROM DISPARM WHERE PRD_CODE = PRC_CODE AND VAR_NAME = VAR_CODE; EXCEPTION WHEN OTHERS THEN AS_DESC := 'Rajasthan Sales Tax'; END; RETURN AS_DESC; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MAX_LOT_RATE (ls_price_list in char, ls_item_code in char) return number is lc_rate number(14,3); begin select rate into lc_rate from pricelist where price_list = ls_price_list and item_code = ls_item_code and ref_no = (select max(ref_no) from pricelist where price_list = ls_price_list and item_code = ls_item_code and eff_from <= sysdate and valid_upto >= sysdate and (ref_no is not null) ) and list_type = 'B' and rownum = 1 ; return lc_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEM_CAT ( AS_ITEM_CODE VARCHAR2 ) RETURN VARCHAR2 IS LS_ITEM_CAT VARCHAR ( 1 ); LS_MAT_CAT VARCHAR2(1); LS_TAX_CHAP VARCHAR2(10); LS_VAR_VALUE VARCHAR2(1); LL_COUNT DECIMAL (1,0); BEGIN SELECT VAR_VALUE INTO LS_VAR_VALUE FROM DISPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'EXC_CAPITAL'; IF LS_VAR_VALUE IS NULL THEN SELECT ITEMSER.MATERIAL_CATEGORY INTO LS_MAT_CAT FROM ITEMSER , ITEM WHERE ITEM . ITEM_SER = ITEMSER.ITEM_SER AND ITEM . ITEM_CODE = AS_ITEM_CODE ; IF LS_MAT_CAT IS NULL THEN LS_MAT_CAT := 'M'; END IF; IF LS_MAT_CAT = 'C' THEN LS_ITEM_CAT := 'C' ; ELSE LS_ITEM_CAT := 'A' ; END IF ; ELSE SELECT NVL(TAX_CHAP__REP,TAX_CHAP) INTO LS_TAX_CHAP FROM ITEM WHERE ITEM_CODE = AS_ITEM_CODE ; IF LS_TAX_CHAP IS NULL THEN LS_TAX_CHAP := ''; END IF; SELECT COUNT ( 1 ) INTO LL_COUNT FROM TAXCHAP WHERE TAX_CHAP = LS_TAX_CHAP AND CATEGORY = LS_VAR_VALUE ; IF LL_COUNT = 1 THEN LS_ITEM_CAT := 'C' ; ELSE LS_ITEM_CAT := 'A' ; END IF ; END IF ; RETURN LS_ITEM_CAT ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_UDACCDR ( as_itemser varchar2, as_type char ) return varchar2 is ls_return varchar2(10) ; BEGIN if trim(as_itemser) = 'RTU' then if trim(as_type) = 'D' then ls_return := 'A999999998' ; else ls_return := 'A999999997' ; end if; end if ; return ls_return ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHECK_PRINT2 (AS_SALES_PERS IN VARCHAR2, AS_SYS_DATE IN DATE, AS_NO_VISIT IN NUMBER, AS_SC_CODE IN VARCHAR2 ) RETURN NUMBER IS AS_SUM NUMBER(30) ; AS_DATE DATE; AS_OUTPUT DATE; J NUMBER(30); BEGIN AS_SUM :=0; J :=0; AS_DATE :=LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1 ; FOR I IN 1..AS_NO_VISIT LOOP J:=J+1; IF J<>AS_NO_VISIT OR AS_NO_VISIT=1 THEN SELECT MAX(EVENT_DATE) INTO AS_OUTPUT FROM strg_meet where sales_pers = AS_SALES_PERS and event_date<=AS_SYS_DATE and strg_code = AS_SC_CODE AND EVENT_DATE BETWEEN AS_DATE AND AS_DATE + trunc((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)-1 order by strg_code,event_date ; ELSE SELECT MAX(EVENT_DATE) INTO AS_OUTPUT FROM strg_meet where sales_pers = AS_SALES_PERS and event_date<=AS_SYS_DATE and strg_code =AS_SC_CODE AND EVENT_DATE BETWEEN AS_DATE AND AS_DATE + (trunc((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)-1)+( mod((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1))),AS_NO_VISIT)) order by strg_code,event_date ; END IF ; IF AS_OUTPUT IS NOT NULL THEN AS_SUM :=AS_SUM+1; END IF; AS_DATE :=AS_DATE+ trunc(((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)); END LOOP; RETURN AS_SUM ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHECK_PRINT1 (AS_SALES_PERS IN VARCHAR2, AS_SYS_DATE IN DATE, AS_NO_VISIT IN NUMBER) RETURN NUMBER IS AS_SUM NUMBER(10) ; AS_DATE DATE; AS_OUTPUT DATE; BEGIN AS_SUM :=0; AS_DATE :=LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1 ; FOR I IN 1..AS_NO_VISIT LOOP SELECT MAX(EVENT_DATE) INTO AS_OUTPUT FROM strg_meet where sales_pers = '1313' and to_char(event_date,'DD-MON-YY')<=AS_SYS_DATE and strg_code ='1283 ' AND EVENT_DATE BETWEEN AS_DATE AND AS_DATE + 30/AS_NO_VISIT order by strg_code,event_date ; IF AS_OUTPUT IS NOT NULL THEN AS_SUM :=AS_SUM+1; END IF; AS_DATE :=AS_DATE+ (30/AS_NO_VISIT); END LOOP; RETURN AS_SUM ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GENCODE_DESCR (ls_fld_name in char, ls_fld_value in char) return char is ls_retval varchar2(120); begin select descr into ls_retval from gencodes where fld_name = ls_fld_name and fld_value = ls_fld_value; return ls_retval; exception when too_many_rows then return ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONS_ISS_EMP_DELIVERED ON CONSUME_ISS (EMP_CODE, DELIVERED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_INVOICE_PACKLIST ( as_var_name in char, ad_tran_date in date, as_item_code in char, as_lot_no in char) return number is mrate number(14,3); ls_type pricelist.list_type%type; as_var_value pricelist.price_list%type; begin select var_value into as_var_value from disparm where var_name = as_var_name; --MRP select list_type into ls_type from pricelist where trim(price_list) = trim(as_var_value) and rownum = 1; --L or B if ls_type = 'L' then --L Then Do below select nvl(rate,0) into mrate from pricelist where trim(price_list) = trim(as_var_value) and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif ls_type = 'B' then --B Then Do below select max(nvl(rate,0)) into mrate from pricelist where trim(price_list) = trim(as_var_value) and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no ; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PACKING_MFGDATE (as_workorder in char, as_plan_date in date) return date is ldt_mfgdate date; ls_lotnoissue varchar2(120); ls_bomcode char(10); ls_string varchar2(1000); ls_token varchar2(1000); ls_sql varchar2(2000); ldt_today date; ldt_plan_date date; ldt_reldate date; begin begin select lot_no__issue, mfg_date__start, bom_code, rel_date into ls_lotnoissue, ldt_mfgdate, ls_bomcode, ldt_reldate from workorder where work_order = as_workorder; end; if ls_lotnoissue is null then ls_lotnoissue := ' '; end if; if ldt_mfgdate is null or to_char(ldt_mfgdate,'dd-mm-yyyy') = '01-01-1900' then begin loop exit when instr(ls_lotnoissue,',') = 0; ls_Token := ddf_get_token(ls_lotnoissue,',') ; ls_string := ls_string || '''' || ls_Token || ''','; ls_lotnoissue := substr(ls_lotnoissue,instr(ls_lotnoissue,',') + 1); end loop; end; ls_string := '(' || ls_string || '''' || ls_lotnoissue || ''') '; ls_sql := 'select Min(mfg_date) + 30 from stock ' ; ls_sql := ls_sql || ' where item_code in ' ; ls_sql := ls_sql || ' (select distinct item_code from bomdet where bom_code = ''' || ls_bomcode ||''''; ls_sql := ls_sql || ' and consider_lot_no__issue = ''Y'' ) and lot_no IN ' || ls_string ; execute immediate ls_sql into ldt_mfgdate; if ldt_mfgdate is null then ldt_mfgdate := ldt_reldate; end if; ldt_plan_date := as_plan_date; if to_date(ldt_mfgdate) > to_date(ldt_plan_date) then -- return the date Plan Due date + 30 days ldt_mfgdate := ldt_plan_date ; end if; end if; if ldt_mfgdate is null then ldt_mfgdate := ldt_plan_date ; end if; return ldt_mfgdate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_PARTIAL_SORD_QTY ( as_sord_no in char ,as_sord_line integer,as_qty number ) return number is sord_qty number(14,3); lc_flag number(1); begin lc_flag := 1; select quantity into sord_qty from sorddet where sale_order = as_sord_no and line_no = as_sord_line ; if( as_qty < sord_qty ) then lc_flag := 1; else lc_flag := 0; end if; return lc_flag; EXCEPTION when no_data_found then return 1; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INDEPENDENT_DEMAND_SITE_ITEM ON INDEPENDENT_DEMAND (SITE_CODE, ITEM_CODE, DUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STOCK_AMD_X ON STOCK_AMD (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SORD_RATE ( as_so in sorditem.sale_order%type, as_lineno in sorditem.line_no%type) return number is lc_rate number(14,3) := 0; begin begin select rate into lc_rate from sorddet where sale_order = as_so and line_no = as_lineno; exception when others then lc_rate := 0; end; return lc_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ITI_WFAPPRV ( as_user_code CHAR, as_aprv_lev NUMBER ) RETURN CHAR IS ls_ret_emp_code CHAR(10); ls_smgrfac CHAR(10); ls_riskhd CHAR(10); lc_actceo CHAR(10); BEGIN ls_ret_emp_code := ''; IF as_aprv_lev = 1 THEN SELECT var_value INTO ls_smgrfac FROM finparm WHERE var_name = 'WF_SMGRFAC'; ls_ret_emp_code := ls_smgrfac; ELSIF as_aprv_lev = 2 THEN SELECT var_value INTO ls_riskhd FROM finparm WHERE var_name = 'WF_RISKHD'; ls_ret_emp_code := ls_riskhd; ELSIF as_aprv_lev = 3 THEN SELECT var_value INTO lc_actceo FROM finparm WHERE var_name = 'WF_ACTCEO'; ls_ret_emp_code := lc_actceo; END IF; RETURN ls_ret_emp_code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_ITEM_SITE_GRADE ON STOCK (ITEM_CODE, SITE_CODE, GRADE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MASTER_GEN_X ON MASTER_GEN (MASTER_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RETAILER_X ON RETAILER (RETAILER_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DISTRICT_DESCR (as_cust_code char,as_item_ser char,as_tran_date date) return varchar2 is ls_return char(160); hq varchar2(40); region varchar2(60); district varchar2(60); begin select RSM.descr into district from gencodes p, org_structure o, org_structure DSM, org_structure RSM, org_structure_cust c ,version v where o.table_no=c.table_no and o.version_id=c.version_id and o.pos_code=c.POS_code and o.version_id=v.version_id and trim(p.fld_Value)=trim(o.pool_code) AND O.POS_CODE__REPTO=DSM.POS_CODE(+) AND DSM.POS_CODE__REPTO=RSM.POS_CODE(+) and c.cust_code=as_cust_code and c.table_no=as_item_ser and as_tran_date between v.eff_from and v.valid_upto and as_tran_date between C.eff_DATE and C.valid_upto AND ROWNUM=1; ls_return:=SUBSTR(LPAD(NVL(TRIM(TO_CHAR(district)),' '),60),-60) ; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WRND_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from worder_iss_rnd where tran_id=as_tran_id and tran_type='F'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_DETAILS (ls_tran_code in char,ls_tran_id in char, ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) > 2 then as_line_no := rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; /*EXC_TAX_CODE,SALES_TAX*/ --tax amt if ls_type = 'T' then select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select MAX(tax_perc) /*MIN(tax_perc) As discuss with Mr. Ashish @ MOSSCO and Mr. Ta run Desai 260509 That Excise Per */ into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select MIN(taxable_amt) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then lc_exch_rate := ddf_get_exch_rate(ls_tran_id,ls_tran_code); if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GPNO (as_ref_Ser in char, as_ref_id in char) return char is ls_gpno varchar2(15); BEGIN if as_ref_Ser = 'S-DSP' then select trim(gp_no) into ls_gpno from despatch where desp_id = as_ref_id ; end if ; if as_ref_Ser = 'D-ISS' then select trim(gp_no) into ls_gpno from distord_iss where tran_id = as_ref_id ; end if ; if as_ref_Ser = 'P-RCP' then select trim(dc_no) into ls_gpno from PORCP where tran_id = as_ref_id ; end if ; return ls_gpno ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_ACTIVITY_CNT (as_tran_id char, as_sales_pers char, as_date date, as_option varchar2) return Number is Cnt Number(5); MaxTranId Char(10); Mth Number(2); Yr Number(4); MaxDt date; MinDt date; MaxMeetDt date; begin select to_number(to_char(to_date(as_date),'MM')) ,to_number(to_char(to_date(as_date),'YYYY')) into Mth,Yr from dual; select max(dt),min(dt) into MaxDt,MinDt from sfa_time where year=Yr and month_no=Mth; if(as_option='FW') then select max(tran_id) into MaxTranId from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('07','22','32','36','45','48','53','58','59','61','CP','FA'); ('FW','53','HS','HM'); if (trim(as_tran_id) =trim(MaxTranId)) then select max(event_date) into MaxMeetDt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('07','22','32','36','45','48','53','58','59','61','CP','FA'); ('FW','53','HS','HM'); select count(distinct event_date) into Cnt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('07','22','32','36','45','48','53','58','59','61','CP','FA') ('FW','53','HS','HM') and event_date <= MaxMeetDt; else Cnt:= 0; end if; elsif(as_option='MEET') then select max(tran_id) into MaxTranId from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('08','09','10','11','12','13','14','15','18','19','20','21','25','26','27','28','29','33','44'); ('CM','HM','R'); if (trim(as_tran_id) =trim(MaxTranId)) then select max(event_date) into MaxMeetDt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('08','09','10','11','12','13','14','15','18','19','20','21','25','26','27','28','29','33','44'); ('CM','HM','R'); select count(distinct event_date) into Cnt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('08','09','10','11','12','13','14','15','18','19','20','21','25','26','27','28','29','33','44') ('CM','HM','R') and event_date <= MaxMeetDt; else Cnt:= 0; end if; elsif(as_option='LEAVE') then select max(tran_id) into MaxTranId from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('01','02','03','04','06','50','54','55','56','57','63'); ('CL','SL','PL','TL'); if (trim(as_tran_id) =trim(MaxTranId)) then select max(event_date) into MaxMeetDt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('01','02','03','04','06','50','54','55','56','57','63'); ('CL','SL','PL','TL'); select count(distinct event_date) into Cnt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('01','02','03','04','06','50','54','55','56','57','63') ('CL','SL','PL','TL') and event_date <= MaxMeetDt; else Cnt:= 0; end if; elsif(as_option='TRANSIT') then select max(tran_id) into MaxTranId from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('16','35','38'); ('TR','TH'); if (trim(as_tran_id) =trim(MaxTranId)) then select max(event_date) into MaxMeetDt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('16','35','38'); ('TR','TH'); select count(distinct event_date) into Cnt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('16','35','38') ('TR','TH') and event_date <= MaxMeetDt; else Cnt:= 0; end if; elsif(as_option='OTHER') then select max(tran_id) into MaxTranId from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('17','23','24','30','31','39','40','41','42','43','47','49','51','52','60','62','64','65','66'); ('ST','SC','IP','C','PT'); if (trim(as_tran_id) =trim(MaxTranId)) then select max(event_date) into MaxMeetDt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('17','23','24','30','31','39','40','41','42','43','47','49','51','52','60','62','64','65','66'); ('ST','SC','IP','C','PT'); select count(distinct event_date) into Cnt from strg_meet where event_date between MinDt and MaxDt and trim(sales_pers) =trim(as_sales_pers) and event_type in --('17','23','24','30','31','39','40','41','42','43','47','49','51','52','60','62','64','65','66') ('ST','SC','IP','C','PT') and event_date <= MaxMeetDt; else Cnt:= 0; end if; end if; return nvl(Cnt,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_RECEIPT_TRAN_DATE_SITE ON MISC_RECEIPT (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_ROUTECODE (as_wo workorder.work_order%type) return char is ls_route varchar2(20); begin select route_code into ls_route from workorder where work_order = as_wo; return ls_route; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RECEIPT_CHK BEFORE INSERT OR UPDATE OF confirmed ON receipt referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_detcount number(3) := 0; ll_advcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_detcount from rcpacct where tran_id = :new.tran_id; exception when others then ll_detcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'RCP' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin lc_hdramt := :new.chq_amt; exception when others then lc_hdramt := 0; end; if (lc_hdramt <> 0 or ll_detcount <> 0) and ll_glcount = 0 and trim(:new.tran_type) <> 'J' then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_detcount) || '] rows in detail or cheque amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'RCP' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CASENO_MAX_PINSTR (as_tran_id in inv_pack_rcp.tran_id%type ) return char is ls_range varchar2(15); ls_packinst varchar2(15); ls_packinst1 varchar2(15); ls_ret varchar2(15); ls_min varchar2(15); ls_max varchar2(15); ls_max1 varchar2(15); ll_max number(10); ll_ret number(10); ls_source number(10); ll_cnt number(10); cursor cur_pack is select inv_pack_rcp.pack_instr from inv_pack_rcp where (inv_pack_rcp.tran_id = as_tran_id) order by line_no,pack_instr; begin ll_cnt :=0; open cur_pack ; fetch cur_pack into ls_packinst; while(cur_pack%FOUND) LOOP ll_cnt := ll_cnt +1; ls_ret := ddf_get_token(ls_packinst,'-'); ll_ret := length(ls_ret); if (ls_min)is null or length(trim(ls_min)) = 0 then ls_min := ls_ret; else if (ls_max)is null or length(trim(ls_max)) = 0 then ls_max := ls_ret ; else if ll_max <= ll_ret then ls_max := ls_ret; end if ; ll_max := length(ls_max); end if; end if; fetch cur_pack into ls_packinst; end loop; close cur_pack ; if (ls_max)is null or length(trim(ls_max)) = 0 then ls_range := ls_min; else ls_range := ls_max; end if; return ls_range; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PCONTRACTAMD_TERM_X ON PCONTRACTAMD_TERM (AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_CHK_TAXABLE_AMT (as_refser in char, as_refid in char) --RETURN NUMBER IS ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_taxtype char(1); lc_quantity number(14,3) := 0; lc_rate number(15,4) := 0; lc_discount number(14,3) := 0; lc_taxableamt number(14,3) := 0; lc_dettaxamt number(14,3) := 0; lc_taxtrantaxamt number(14,3) := 0; ll_count number(3) := 0; lc_othchrg number(14,3) := 0; begin if as_refser = 'S-RET' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env,tax_amt from sreturndet where tran_id = :tran_id'; end if; if as_refser = 'S-DSP' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env,tax_amt from despatchdet where desp_id = :tran_id'; end if; if as_refser = 'P-RCP' or as_refser = 'P-RET' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env, tax_amt from porcpdet where tran_id = :tran_id'; end if; if as_refser = 'P-ORD' then ls_sql := 'Select line_no,quantity__stduom,rate__stduom,discount,tax_env, tax_amt from porddet where purc_order = :tran_id'; end if; if as_refser = 'D-ISS' then ls_sql := 'Select line_no,quantity,rate,discount,tax_env, tax_amt from distord_issdet where tran_id = :tran_id'; end if; if as_refser = 'D-RCP' then ls_sql := 'Select line_no,quantity,rate,discount,tax_env, tax_amt from distord_rcpdet where tran_id = :tran_id'; end if; OPEN cur_out FOR ls_sql USING as_refid ; LOOP FETCH cur_out INTO ls_lineno, lc_quantity,lc_rate,lc_discount,ls_taxenv,lc_dettaxamt ; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then ll_mismatch_cnt := 0; if lc_quantity is null then lc_quantity := 0; end if; if lc_rate is null then lc_rate := 0; end if; if lc_discount is null then lc_discount := 0; end if; ls_lineno := lpad(trim(ls_lineno),3,' '); for cur_taxableamt in ( select t.taxable_amt, t.tax_base, t.tran_id, t.line_no from taxtran t, tax tm where tm.tax_code = t.tax_code and t.tran_code = as_refser and t.tran_id = as_refid and t.line_no = ls_lineno and tm.tax_type in ('G','H','I') ) loop begin select count(1) into ll_count from tbasseq where tax_base = cur_taxableamt.tax_base; exception when others then ll_count := 0; end; if ll_count > 0 then begin select sum(tax_amt) into lc_othchrg from taxtran where tran_id = cur_taxableamt.tran_id and line_no = cur_taxableamt.line_no and tax_code in (select tax_code from tbasseq where tax_base = cur_taxableamt.tax_base); exception when others then lc_othchrg := 0; end; end if; if lc_othchrg is null then lc_othchrg := 0; end if; if lc_discount is null then lc_discount := 0; end if; lc_taxableamt := round( ((lc_quantity * lc_rate) - ((lc_quantity * lc_rate) * lc_discount / 100 )) + lc_othchrg,3); --round((lc_quantity * lc_rate) - ((lc_quantity * lc_rate) * lc_discount / 100 ),3); if lc_taxableamt is null then lc_taxableamt := 0; end if; dbms_output.put_line('line no [' ||ls_lineno ||'] rate [' || to_char(lc_rate) ||'] discount [' || to_char(lc_discount) || '] other chrg [' || to_char(lc_othchrg) || ']'); dbms_output.put_line('quantity [' ||to_char(lc_quantity) ||'] cal taxableamt [' || to_char(lc_taxableamt) ||'] taxtran taxableamt [' || to_char(cur_taxableamt.taxable_amt) || ']'); if abs(cur_taxableamt.taxable_amt - lc_taxableamt) > 1 and trim(ls_taxenv) <> 'PIMP01' then -- 08-Jul-2022 import cannot use this formula dbms_output.put_line('tax_base [' ||cur_taxableamt.tax_base ||'] lc_taxableamt[' || to_char(lc_taxableamt) ||'] taxable_amt [' || to_char(cur_taxableamt.taxable_amt) || ']'); ll_mismatch_cnt := 1; exit; end if; select sum(tax_amt) into lc_taxtrantaxamt from taxtran t where t.tran_code = as_refser and t.tran_id = as_refid and t.line_no = ls_lineno and effect <> 'N'; if abs(lc_dettaxamt - lc_taxtrantaxamt) > 1 then dbms_output.put_line('line no [' ||ls_lineno ||'] lc_dettaxamt[' || to_char(lc_dettaxamt) ||'] lc_taxtrantaxamt [' || to_char(lc_taxtrantaxamt) || ']'); ll_mismatch_cnt := 1; exit; end if; end loop; if ll_mismatch_cnt> 0 then exit; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then ll_retval := 1; end if; --RETURN ll_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VOUCH_REF_ID (lsref_ser char,lsref_id char) return char is ls_no char(500); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EUL4_BAS_X ON EUL4_BAS (BA_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_PRODUCT_X_UNIQUE ON STRG_PRODUCT (SALES_PERS, SC_CODE, BRAND_CODE, ITEM_SER, VALID_FROM, VALID_TO, PITCH_PRIORITY, PRODUCT_CODE, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CANDIDATE_INFO (as_tran_id char,edit_flag char,xtra_param char) return char is ls_return messages.msg_no%type; mpr_value candidate.mpr_no_org%type; a_count number(5); a_pen_perc candidate_family.PEN_PERC%type; a_pf_perc candidate_family.PF_PERC%type; a_grat_perc candidate_family.GRAT_PERC%type; a_fcnt number(5); a_mcnt number(5); a_hcnt number(5); begin select count(*) INTO a_count from candidate_experience a , candidate_experience b where (a.from_date <> b.from_date and a.candidate_id = b.candidate_id) and ((a.from_date between b.from_date and nvl(b.to_date,to_date('31-DEC-34','DD-MM-YYYY'))) or (a.to_date between b.from_date and nvl(b.to_date,to_date('31-DEC-34','DD-MM-YYYY')))) and b.candidate_id = as_tran_id; IF a_count > 0 THEN ls_return := 'VTEMPLD12'; return ls_return; END IF; SELECT SUM(nvl(PEN_PERC,0)),SUM(nvl(PF_PERC,0)),SUM(nvl(GRAT_PERC,0)),COUNT(*), sum(case b.relation when 'FATHER' then 1 else 0 end), sum(case b.relation when 'MOTHER' then 1 else 0 end), sum(case b.relation when 'HUSBAND' then 1 else 0 end) into a_pen_perc,a_pf_perc,a_grat_perc,a_count,a_fcnt,a_mcnt,a_hcnt FROM candidate_family B WHERE candidate_id = as_tran_id and (b.pen_nominee = 'Y' or b.grat_nominee = 'Y' or b.pf_nominee = 'Y' ) GROUP BY CANDIDATE_ID; IF a_count > 0 THEN If(a_pen_perc != 100) Then ls_return := 'UVPNPERC'; return ls_return; end if; If(a_pf_perc != 100) Then ls_return := 'UVPFPERC'; return ls_return; end if; If(a_grat_perc != 100) Then ls_return := 'UVGRPERC'; return ls_return; end if; If(a_fcnt > 1 or a_mcnt > 1 or a_hcnt > 1) Then ls_return := 'UV_DUPREL'; return ls_return; end if; END IF; select mpr_no_org into mpr_value from candidate where candidate_id = as_tran_id; if (trim(mpr_value) is not null) then select count(*) into a_count from candidate_language where candidate_id = as_tran_id; if(a_count > 5) then ls_return := 'VTCANDLANG'; return ls_return; end if; select count(*) into a_count from candidate_qual where candidate_id = as_tran_id; if(a_count > 7) then ls_return := 'VTCANDQUAL'; return ls_return; end if; select count(*) into a_count from candidate_experience where candidate_id = as_tran_id; if(a_count > 10) then ls_return := 'VTCANDEXP'; return ls_return; End If; select count(*) into a_count from candidate_family where candidate_id = as_tran_id; If(a_count > 7) Then ls_return := 'VTCANDFAM'; return ls_return; end if; end if; RETURN ls_return; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SUNDRY_TAX ( ls_ref_ser in char, ls_tran_id in char, ls_type in char ) return varchar2 is ls_val VARCHAR2(250); ls_code CHAR(10); ls_name VARCHAR2(250); ls_site_code varchar2(10); begin if ls_ref_ser = 'S-INV' then select A.cust_code , B.cust_name, A.Site_code into ls_code , ls_name, ls_site_code from invoice A, customer B where A.cust_code = B.cust_code and Trim(A.invoice_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'VOUCH' then Select A.supp_code , B.supp_name, A.Site_code into ls_code , ls_name, ls_site_code From Voucher A ,Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNPAY' Or ls_ref_ser = 'DRNPAY' Then Select A.supp_code , B.supp_name, A.Site_code Into ls_code , ls_name, ls_site_code From DRCR_Pay A ,Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNRCP' Or ls_ref_ser = 'DRNRCP' Then Select A.cust_code , B.cust_name, A.Site_code Into ls_code , ls_name, ls_site_code From DRCR_Rcp A , Customer B Where A.cust_code = B.cust_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'P-RCP' Or ls_ref_ser = 'P-RET' Then Select A.supp_code , B.supp_name, A.Site_code Into ls_code , ls_name, ls_site_code From PORCP A, Supplier B Where A.supp_code = B.supp_code AND (A.tran_id) = (ls_tran_id) ; ElsIf ls_ref_ser = 'P-ORD' Then Select A.supp_code , B.supp_name, A.Site_code__DLV Into ls_code , ls_name, ls_site_code From PORDER A, Supplier B Where A.supp_code = B.supp_code AND (A.PURC_ORDER) = (ls_tran_id) ; ElsIf ls_ref_ser = 'S-DSP' Then Select A.CUST_code__dlv , B.CUST_name, A.Site_code Into ls_code , ls_name, ls_site_code From DESPATCH A, CUSTOMER B Where A.CUST_code = B.CUST_code AND (A.DESP_ID) = (ls_tran_id) ; ElsIf ls_ref_ser = 'C-ISS' Then Select A.EMP_code , B.EMP_Fname || ' ' || B.EMP_lname, A.Site_code__ORD Into ls_code , ls_name, ls_site_code From CONSUME_ISS A, EMPLOYEE B Where A.EMP_CODE = B.EMP_code AND (A.CONS_ISSUE) = (ls_tran_id) ; ElsIf ls_ref_ser = 'S-ORD' Then Select A.cust_code , B.cust_name, A.Site_code Into ls_code , ls_name, ls_site_code From SORDER A , Customer B Where A.cust_code = B.cust_code And Trim(A.SALE_ORDER) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'S-RET' Then Select A.cust_code , B.cust_name, A.Site_code Into ls_code , ls_name, ls_site_code From SRETURN A , Customer B Where A.cust_code = B.cust_code And Trim(A.TRAN_ID) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'D-RCP' Then select a.site_code__ship ,b.sh_descr ,b.site_code into ls_code , ls_name, ls_site_code from distord_rcp a,site b where a.site_code__ship =b.site_code and a.tran_id =ls_tran_id; elsif ls_ref_ser = 'D-ISS' then select a.site_code__dlv ,b.sh_descr ,b.site_code into ls_code , ls_name, ls_site_code from distord_iss a,site b where a.site_code__dlv =b.site_code and a.tran_id =ls_tran_id; End If; ls_name := nvl(ls_name,' '); ls_code := nvl(ls_code,' '); If ls_type = 'C' Then ls_val := ls_code; ElsIf ls_type = 'S' Then ls_val := ls_site_code; Else ls_val := ls_name; End If; Return ls_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INV_DEM_SUPP_TRACE_INSERT BEFORE INSERT ON INV_DEM_SUPP_TRACE FOR EACH ROW BEGIN SELECT lpad(to_char(inv_dem_supp_trace_seq.nextval),20,'0') INTO :new.tran_id FROM dual; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RET_SITE_REGNO ( as_site_code CHAR, as_ref_code CHAR) RETURN VARCHAR2 IS ls_reg_no varchar2(40); BEGIN BEGIN Select reg_no into ls_reg_no from siteregno where site_code = as_site_code and ref_code = as_ref_code; EXCEPTION when no_data_found then ls_reg_no := ''; END; return ls_reg_no; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ORG_STRUC_TRACE_X ON ORG_STRUC_TRACE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LASTPURRATE ( as_itemcode item.item_code%type, adt_todate date, as_site_code item.site_code%type ) return decimal is lc_rate decimal(14,3) ; ldt_lastdate date; BEGIN begin select max(c.ord_date) into ldt_lastdate from porder c,porddet d where c.purc_order = d.purc_order and d.ITEM_CODE = as_itemcode and c.ord_date < adt_todate and d.site_code = as_site_code; exception when no_data_found then lc_rate := 0; when others then lc_rate := 0; end; begin if ldt_lastdate is not null then select b.rate into lc_rate from porder a,porddet b where a.purc_order = b.purc_order and b.item_code = as_itemcode and rownum = 1 and a.ord_date = ldt_lastdate ; end if; exception when no_data_found then lc_rate := 0; when others then lc_rate := 0; end; return lc_rate ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ALLWD_DELAY_PRD (as_sales_pers in char) return number is allwdDelayPrd number(3); begin select allwd_delay_prd into allwdDelayPrd from sales_pers where sales_pers=as_sales_pers; return allwdDelayPrd; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITEMMNFR_X ON ITEMMNFR (ITEM_CODE, SUPP_CODE__MNFR, SUPP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_PO BEFORE UPDATE of confirmed ON porder referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from porddet where purc_order = :tran_id'; OPEN cur_out FOR ls_sql USING :new.sale_order ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'P-ORD' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'P-ORD' and tran_id = :new.purc_order and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DESIGNATION (as_sundry_typ in char, as_sundry_cd in char) return char is ls_designation gencodes.descr%type; ls_type char(1); ls_fld_name gencodes.fld_name%type; begin if trim(as_sundry_typ) = 'C' then select trim(cust_type) into ls_type from customer where cust_code = as_sundry_cd ; ls_fld_name := 'CUST_TYPE'; elsif trim(as_sundry_typ) = 'R' then select a.cust_type into ls_type from strg_customer b, customer a where b.cust_code = a.cust_code(+) and b.sc_code = as_sundry_cd ; ls_fld_name := 'CUST_TYPE'; elsif trim(as_sundry_typ) = 'B' then select bank_type into ls_type from bank where bank_code = as_sundry_cd ; ls_fld_name := 'BANK_TYPE' ; elsif trim(as_sundry_typ) = 'E' then select designation into ls_designation from employee a, site b, department c where a.pay_site = b.site_code and a.emp_code = as_sundry_cd and a.dept_code =c.dept_code ; elsif trim(as_sundry_typ) = 'P' then select sp_type into ls_type from sales_pers where sales_pers = as_sundry_cd ; ls_fld_name := 'SP_TYPE' ; elsif trim(as_sundry_typ) = 'T' then select transporter_type into ls_type from transporter where tran_code = as_sundry_cd ; ls_fld_name := 'TRANSPORTER_TYPE'; elsif trim(as_sundry_typ) = 'S' then select supp_type into ls_type from supplier where supp_code = as_sundry_cd ; ls_fld_name := 'SUPP_TYPE'; elsif trim(as_sundry_typ) = 'X' then select tauth_type into ls_type from tax_authority where tauth_code = as_sundry_cd ; ls_fld_name := 'TAUTH_TYPE'; end if; if trim(as_sundry_typ) <> 'E' then ls_type := upper(trim(ls_type)); select descr into ls_designation from gencodes where upper(mod_name) = 'X' and upper(fld_name) = ls_fld_name and upper((fld_value)) = ls_type ; end if; return trim(ls_designation) ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_PRODUCT_X ON STRG_PRODUCT (SC_CODE, ITEM_SER, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 524288 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_RCP_TRAN_SITE_CODE ON DISTORD_RCP (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SHIFTDATES_INRANGE (shift_frdt date, shift_todt date , from_date date , to_date date) return number is lc_cnt number( 1 ); begin If ((Shift_Frdt Between From_Date And To_Date) Or (Shift_Todt Between From_Date And To_Date) ) then lc_cnt := 1; else lc_cnt := 0; end if; return lc_cnt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0084139 ON DISTORDER_ALLOC (DIST_ORDER, LINE_NO, ITEM_CODE, LOT_NO, LOT_SL, LOC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXCHRATE (LS_CURR IN CHAR, LN_EXCH IN NUMBER) RETURN NUMBER IS LS_NUMBER NUMBER(1); LS_EXRT_MIN NUMBER (14,6); LS_EXRT_MAx NUMBER (14,6); BEGIN IF LS_CURR ='curr_code' then return 1; end if; SELECT EXCH_RATE__MIN,EXCH_RATE__MAX INTO LS_EXRT_MIN, LS_EXRT_MAx FROM CURRENCY WHERE CURR_CODE = LS_CURR; IF (LS_EXRT_MIN IS NULL OR LS_EXRT_MIN =0) OR (LS_EXRT_MAx IS NULL OR LS_EXRT_MIN =0) THEN RETURN 1; END IF; SELECT COUNT(1) INTO LS_NUMBER FROM CURRENCY WHERE TRIM(CURR_CODE)= TRIM(LS_CURR) AND LN_EXCH between EXCH_RATE__MIN and EXCH_RATE__MAX and LN_EXCH > 0; IF LS_NUMBER > 0 THEN RETURN 1; ELSE RETURN 0; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0084138 ON RESOURCE_CONS_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_ITMREF ON BOMDET (BOM_CODE, ITEM_CODE, ITEM_REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_HOLIDAY_C (as_sales_pers char, as_mth varchar2, as_year varchar2, as_option varchar2) return number is HolTblNo char(5); CntDay Number(9); begin select hol_tblno into HolTblNo from employee where trim(emp_code) = (select trim(emp_code) from sales_pers where trim(sales_pers)=trim(as_sales_pers)); if(as_option='M') then select count(dt) into CntDay from sfa_time where month_no=as_mth and year=as_year; elsif(as_option='W') then select count(hol_date) into CntDay from holiday where trim(hol_tblno) = trim(HolTblNo) and trim(hol_type)='W' and to_char(hol_date,'MM') =as_mth and to_char(hol_date,'yyyy')=as_year; elsif(as_option='H') then select count(hol_date) into CntDay from holiday where trim(hol_tblno) = trim(HolTblNo) and trim(hol_type)='H' and to_char(hol_date,'MM') =as_mth and to_char(hol_date,'yyyy')=as_year; end if; return nvl(CntDay,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_TRACE_SORDNO_LINE ON INVOICE_TRACE (SORD_NO, SORD_LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PND_PO_IND_MRP (as_site indent.site_code%type, as_itemcode indent.item_code%type) return number is ls_quantity indent.QUANTITY%type; begin select nvl(sum(QUANTITY__STDUOM-ORD_QTY),0) into ls_quantity from indent where indent.STATUS in('O','A') and indent.IND_TYPE <> 'M' and indent.site_code= as_site and indent.item_code= as_itemcode and ORD_QTY < QUANTITY__STDUOM ; return ls_quantity; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRG_SCHM_BAL_UPD before insert or update on scheme_balance referencing old as old new as new FOR EACH ROW begin if :new.used_free_qty is null then :new.used_free_qty := 0; end if; if :new.used_free_value is null then :new.used_free_value := 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_POTENCY_BIO (as_workorder in workorder.work_order%type, as_itemcode in item.item_code%type, ac_quantity in number, ac_ratio in number ) return number is ls_sitecode site.site_code%type; ls_bomcode bom.bom_code%type; ls_lotnnoiss varchar2(120); lc_quantity number(14,3) := 0; lc_potencyqty number(14,3) := 0; lc_potencyperc number(14,3) := 0; lc_batchqty number(14,3) := 0; lc_woqty number(14,3) := 0; begin begin -- get the lot_no__issue (of technical) from workorder select site_code,lot_no__issue, bom_code, quantity into ls_sitecode, ls_lotnnoiss, ls_bomcode, lc_woqty from workorder where work_order = as_workorder; exception when no_data_found then return 0; when others then return 0; end; if ls_lotnnoiss is null or length(trim(ls_lotnnoiss)) = 0 then return 0; end if; begin -- get the bom batch_qty select batch_qty into lc_batchqty from bom where bom_code = ls_bomcode; exception when no_data_found then return 0; when others then return 0; end; begin -- get the quantity and potency_perc from stock for the technical select a.quantity, a.potency_perc into lc_quantity, lc_potencyperc from stock a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and c.available = 'Y' and a.item_code in (select distinct item_code from bomdet where bom_code = ls_bomcode) and a.site_code = ls_sitecode and instr(ls_lotnnoiss,trim(a.lot_no)) > 0 and a.quantity - nvl(a.alloc_qty,0) > 0; end; -- following is the formula -- technical -- quantity - A -- potency_perc - B -- other material -- A x B / 96 x ratio / 76.5 lc_potencyqty := (lc_quantity * lc_potencyperc / 96) * (ac_ratio / 76.5); --lc_potencyqty := (lc_potencyqty / lc_batchqty * lc_woqty) - ac_quantity; return lc_potencyqty ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_HOLIDAY_N (as_sales_pers char, fr_date date, t_date date, as_option char) return number is HolTblNo char(5); CntDay Number(9); begin select hol_tblno into HolTblNo from employee where trim(emp_code) = (select trim(emp_code) from sales_pers where trim(sales_pers)=trim(as_sales_pers)); if(as_option='M') then select count(dt) into CntDay from sfa_time where dt between to_date(fr_date) and to_date(t_date); elsif(as_option='W') then select count(hol_date) into CntDay from holiday where trim(hol_tblno) = trim(HolTblNo) and trim(hol_type)='W' and hol_date between fr_date and t_date; elsif(as_option='H') then select count(hol_date) into CntDay from holiday where trim(hol_tblno) = trim(HolTblNo) and trim(hol_type)='H' and hol_date between fr_date and t_date; end if; return nvl(CntDay,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUM_TAXABLE_AMT (ls_tran_code in char,ls_tran_id in char,ls_var_name in char) return number is AS_TAXABLE_SUM number(14,3); BEGIN SELECT NVL(sum(nvl(TAXTRAN.TAXABLE_AMT,0)),0) INTO AS_TAXABLE_SUM FROM TAX, TAXTRAN WHERE TAX.TAX_CODE = TAXTRAN.TAX_CODE and taxtran.tran_id = ls_tran_id AND taxtran.tran_code = ls_tran_code and (TAX.PRINT_TAX) ='Y' AND taxtran.tax_amt <> 0 AND INSTR((SELECT ',' || TRIM(VAR_VALUE) || ',' FROM DISPARM WHERE TRIM(VAR_NAME) = ls_var_name AND PRD_CODE = '999999'),',' || TRIM(TAXTRAN.TAX_CODE) || ',') > 0; RETURN AS_TAXABLE_SUM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MODULES_OBJECT_NAME ON MODULES (OBJECT_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_DEVICE ON DEVICE_AUTH (DEVICE_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GST_MVOUC1 (ls_sundry_code in char,ls_site_code in char,ls_tax_env in char,ls_sundry_type in char) return number as ls_local number; as_sundry_state char(5); as_site_state char(5); ls_sundry_count number(14,3); Begin --TO CHECK INTRASTATE TAX ENVIONMENT select count(*) into ls_sundry_count from (select supp_code from supplier where supp_code=ls_sundry_code and 'S'=ls_sundry_type union select tran_code from transporter where tran_code=ls_sundry_code and 'T'=ls_sundry_type); if ls_sundry_count>0 then select state_code into as_sundry_state from ( select trim(state_code) state_code from supplier where supp_code=ls_sundry_code and 'S'=ls_sundry_type union select trim(state_code) from transporter where tran_code=ls_sundry_code and 'T'=ls_sundry_type); select trim(state_code) into as_site_state from site where site_code=ls_site_code; if as_sundry_state = as_site_state then if trim(ls_tax_env)='ELNC01' or trim(ls_tax_env)='ELWC01' or trim(ls_tax_env)='ERCML01' or trim(ls_tax_env)='ELWC02 ' or trim(ls_tax_env)='ERCML02' or trim(ls_tax_env)='ERITCL01' or trim(ls_tax_env)='ELUT01' or trim(ls_tax_env)='ERCMLUT' or trim(ls_tax_env)='NOGST' or trim(ls_tax_env)='SUP' then ls_local:=1; else ls_local:=0; end if; else ls_local:=1; end if; ELSE ls_local:=1; end if; return ls_local; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DEPR_MTH_DET_X ON ASSET_DEPR_MTHDET (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MACHINE_MAINTDET_X ON MACHINE_PART_MAINTDET (MC_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SMKT_GEN_DET (V_CODE_A IN CHAR, V_CODE_B IN CHAR, V_CODE_C IN CHAR, V_CODE_D IN CHAR, V_DETAILS IN CHAR) RETURN VARCHAR2 AS V_OUTPUT VARCHAR2(200); V_OUTPUTA NUMBER; V_OUTPUTB NUMBER; V_FROM_DATE DATE; V_TO_DATE DATE; BEGIN IF V_DETAILS <> 'GENCODES_DESCR' THEN IF (LENGTH(V_CODE_C) = 6 AND LENGTH(V_CODE_D) = 6) THEN V_FROM_DATE := TO_DATE(V_CODE_C,'YYYYMM'); V_TO_DATE := LAST_DAY(TO_DATE(V_CODE_D,'YYYYMM')); ELSE V_FROM_DATE := TO_DATE(V_CODE_C); V_TO_DATE := TO_DATE(V_CODE_D); END IF; END IF; /*=================================================================== 'HQ_STN_DESC' :- STATION DESCRIPTION OF HEAD QUARTER BY EMP_CODE =====================================================================*/ IF (V_DETAILS = 'HQ_STN_DESC') THEN SELECT A.DESCR INTO V_OUTPUT FROM EMPLOYEE B,STATION A WHERE B.STAN_CODE__HQ = A.STAN_CODE AND B.EMP_CODE = V_CODE_A; /*================================================================== 'STN_DESC' :- STATION DESCRIPTION OF HEAD QUARTER BY STAN_CODE ====================================================================*/ ELSIF (V_DETAILS = 'STN_DESC') THEN SELECT DESCR INTO V_OUTPUT FROM STATION WHERE STAN_CODE = V_CODE_A; /*=================================================================== 'HQ_STATE_DESC' :- STATE DESCRIPTION OF HEAD QUARTER BY EMP_CODE =====================================================================*/ ELSIF (V_DETAILS = 'HQ_STATE_DESC') THEN SELECT C.DESCR INTO V_OUTPUT FROM EMPLOYEE A,STATION B,STATE C WHERE A.STAN_CODE__HQ = B.STAN_CODE AND B.STATE_CODE = C.STATE_CODE AND A.EMP_CODE = V_CODE_A; /*================================================================= 'STATE_DESC' :- STATE DESCRIPTION OF HEAD QUARTER BY STAN_CODE ===================================================================*/ ELSIF (V_DETAILS = 'STATE_DESC') THEN SELECT B.DESCR INTO V_OUTPUT FROM STATION A,STATE B WHERE A.STATE_CODE = B.STATE_CODE AND A.STAN_CODE = V_CODE_A; /*============================================ 'SH_ITEMSER' :- ITMESER SH_DESCRIPTION ==============================================*/ ELSIF (V_DETAILS = 'SH_ITEMSER') THEN SELECT C.SH_DESCR INTO V_OUTPUT FROM SALES_PERS A,ITEMSER C WHERE A.ITEM_SER = C.ITEM_SER AND A.SALES_PERS = V_CODE_A; /*============================================ 'GRADE_LEVEL' :- LEVEL NO =============================================*/ ELSIF (V_DETAILS = 'GRADE_LEVEL') THEN SELECT B.LEVEL_NO INTO V_OUTPUT FROM EMPLOYEE A,GRADE B WHERE A.GRADE = B.GRADE_CODE AND A.EMP_CODE = V_CODE_A; /*============================================ 'DESG' :- DESIGNATION ==============================================*/ ELSIF (V_DETAILS = 'DESG') THEN SELECT (CASE B.LEVEL_NO WHEN 1 THEN 'TLM' WHEN 2 THEN 'SLM' WHEN 3 THEN 'FLM' WHEN 4 THEN 'SO' ELSE 'HO' END) LEVL_NO INTO V_OUTPUT FROM EMPLOYEE A,GRADE B WHERE A.GRADE = B.GRADE_CODE AND A.EMP_CODE = V_CODE_A; /*============================================= 'LOC_ROUTE' :- LOCALITY CODE ===============================================*/ ELSIF (V_DETAILS = 'LOC_ROUTE') THEN SELECT A.LOCALITY_CODE INTO V_OUTPUT FROM SPRS_ROUTE A WHERE A.SPRS_CODE = V_CODE_A AND A.ROUTE_ID = V_CODE_B; /*============================================= 'LOC_DESC' :- LOCALITY DESCRIPTION ===============================================*/ ELSIF (V_DETAILS = 'LOC_DESC') THEN SELECT DESCR INTO V_OUTPUT FROM LOCALITY WHERE LOCALITY_CODE = V_CODE_A; /*============================================= 'ROUTE_DESC' :- ROUTE DESCRIPTION ==============================================*/ ELSIF (V_DETAILS = 'ROUTE_DESC' ) THEN SELECT DESCR INTO V_OUTPUT FROM SPRS_ROUTE WHERE SPRS_CODE = V_CODE_A AND ROUTE_ID = V_CODE_B; /*================================================== 'DAR_CONF_FLAG' :- CONFIRMATION FLAG ====================================================*/ ELSIF (V_DETAILS = 'DAR_CONF_FLAG') THEN SELECT CONFIRMATION_FLAG INTO V_OUTPUT FROM DR_MAIN WHERE SALES_PERS = V_CODE_A AND WORK_DATE = V_FROM_DATE; /*================================================== 'LDOC_COUNT' :- SUM OF DOCTORS LISTED ====================================================*/ ELSIF (V_DETAILS = 'LDOC_COUNT') THEN SELECT NVL(SUM(A.NOOF_DOCT),0) INTO V_OUTPUT FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.SC_TYPE = 'C' AND B.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE; /*========================================================= 'UDOC_COUNT' :- SUM OF DOCTORS UNLISTED ===========================================================*/ ELSIF (V_DETAILS = 'UDOC_COUNT') THEN SELECT NVL(SUM(A.NOOF_DOCT),0) INTO V_OUTPUT FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.SC_TYPE = 'N' AND B.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE; /*========================================================= 'STOCK_COUNT' :- SUM OF NO OF STOCKIST ===========================================================*/ ELSIF (V_DETAILS = 'STOCK_COUNT') THEN SELECT COUNT(A.CUST_CODE) INTO V_OUTPUT FROM DR_STOCKIST_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE; /*========================================================= 'CHEM_COUNT' :- SUM OF NO OF CHEMIST ===========================================================*/ ELSIF (V_DETAILS = 'CHEM_COUNT') THEN SELECT NVL(SUM(A.NOOF_CHEMIST),0) INTO V_OUTPUT FROM DR_CHEMIST_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE; /*========================================================== 'LDOC_MAX_TIME' :- MAX TIME FOR LISTED DOCTORS ============================================================*/ ELSIF (V_DETAILS = 'LDOC_MAX_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MAX(DDF_SMKT_TIME_IN_MIN(B.DOCTOR_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_DOCTOR_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND B.SC_TYPE = 'C' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*========================================================== 'LDOC_MIN_TIME' :- MIN TIME FOR LISTED DOCTORS ============================================================*/ ELSIF (V_DETAILS = 'LDOC_MIN_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MIN(DDF_SMKT_TIME_IN_MIN(B.DOCTOR_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_DOCTOR_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND B.SC_TYPE = 'C' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*========================================================== 'UDOC_MAX_TIME' :- MAX TIME FOR UNLISTED DOCTORS ============================================================*/ ELSIF (V_DETAILS = 'UDOC_MAX_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MAX(DDF_SMKT_TIME_IN_MIN(B.DR_LAST_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_DOCTOR_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND B.SC_TYPE = 'N' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*=========================================================== 'UDOC_MIN_TIME' :- MIN TIME FOR UNLISTED DOCTORS =============================================================*/ ELSIF (V_DETAILS = 'UDOC_MIN_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MIN(DDF_SMKT_TIME_IN_MIN(B.DOCTOR_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_DOCTOR_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND B.SC_TYPE = 'N' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*============================================================ 'STOCK_MAX_TIME' :- MAX TIME FOR STOCKIST ==============================================================*/ ELSIF (V_DETAILS = 'STOCK_MAX_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MAX(DDF_SMKT_TIME_IN_MIN(B.STOCKIST_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_STOCKIST_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*============================================================ 'STOCK_MIN_TIME' :- MIN TIME FOR STOCKIST ==============================================================*/ ELSIF (V_DETAILS = 'STOCK_MIN_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MIN(DDF_SMKT_TIME_IN_MIN(B.STOCKIST_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_STOCKIST_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*============================================================ 'CHEM_MAX_TIME' :- MAX TIME FOR CHEMIST ==============================================================*/ ELSIF (V_DETAILS = 'CHEM_MAX_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MAX(DDF_SMKT_TIME_IN_MIN(B.CHEM_LAST_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_CHEMIST_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*============================================================ 'CHEM_MIN_TIME' :- MIN TIME FOR CHEMIST ==============================================================*/ ELSIF (V_DETAILS = 'CHEM_MIN_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MIN(DDF_SMKT_TIME_IN_MIN(B.CHEMIST_VISIT_TIME))) INTO V_OUTPUT FROM DR_MAIN A,DR_CHEMIST_VISIT B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.CONFIRMATION_FLAG = 'Y' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE; /*=============================================================================================== 'DAR_MAX_TIME' :- MAX TIME FROM ALL VISIT COLUMNS FOR PARTICULAR EMPLOYEE ON SPECIFIC DATE =================================================================================================*/ ELSIF (V_DETAILS = 'DAR_MAX_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MAX(DDF_SMKT_TIME_IN_MIN(DOCTOR_VISIT_TIME))) INTO V_OUTPUT FROM (SELECT A.DOCTOR_VISIT_TIME FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.DOCTOR_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE UNION SELECT A.CHEMIST_VISIT_TIME FROM DR_CHEMIST_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.CHEMIST_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE UNION SELECT A.STOCKIST_VISIT_TIME FROM DR_STOCKIST_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.STOCKIST_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE); /*================================================================================================ 'DAR_MIN_TIME' :- MIN TIME FROM ALL VISIT COLUMNS FOR PARTICULAR EMPLOYEE ON SPECIFIC DATE ================================================================================================*/ ELSIF (V_DETAILS = 'DAR_MIN_TIME') THEN SELECT DDF_SMKT_MIN_IN_TIME(MIN(DDF_SMKT_TIME_IN_MIN(DOCTOR_VISIT_TIME))) INTO V_OUTPUT FROM (SELECT A.DOCTOR_VISIT_TIME FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.DOCTOR_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE UNION SELECT A.DR_LAST_VISIT_TIME FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.DR_LAST_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE UNION SELECT A.CHEM_LAST_VISIT_TIME FROM DR_CHEMIST_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.CHEM_LAST_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE UNION SELECT A.STOCKIST_VISIT_TIME FROM DR_STOCKIST_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND B.CONFIRMATION_FLAG = 'Y' AND A.STOCKIST_VISIT_TIME IS NOT NULL AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE = V_FROM_DATE); /*================================================================================================ 'TYPE_DAY_CNT' :- WORK DAYS COUNT OF FIELD EMPLOYEES ================================================================================================*/ ELSIF (V_DETAILS = 'TYPE_DAY_CNT') THEN SELECT NVL(SUM(CASE WHEN (T.ACTIVITY_CODE <> '62') AND (T.ACTIVITY_TYPE = T.ACTIVITY_TYPE_SH) THEN 1 WHEN (T.ACTIVITY_CODE = '62') AND ('ADMIN' = V_CODE_B) THEN 1 WHEN (T.ACTIVITY_CODE = '62') AND (T.ACTIVITY_TYPE = 'OTHER') THEN 0 ELSE 0.5 END),0) WORK_DAYS INTO V_OUTPUT FROM( SELECT FD.ACTIVITY_CODE,FD.ACTIVITY_TYPE,FD.ACTIVITY_TYPE_SH,FD.SH_DESCR FROM FIELDACTIVITY FD,(SELECT MAX(D.ACTIVITY_CODE) ACT_CODE FROM DR_MAIN M,DR_TRAVEL_DETAILS D,FIELDACTIVITY W WHERE M.SALEs_PERS = D.SALES_PERS AND M.WORK_DATE = D.WORK_DATE AND M.CONFIRMATION_FLAG = 'Y' AND D.ACTIVITY_CODE = W.ACTIVITY_CODE AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE GROUP BY D.WORK_DATE) N WHERE FD.ACTIVITY_CODE = N.ACT_CODE) T WHERE T.ACTIVITY_TYPE = V_CODE_B OR T.ACTIVITY_TYPE_SH = V_CODE_B OR T.ACTIVITY_CODE = '62'; /*================================================================================================ 'MAX_SMPISS_DT' :- MAX ISSUE DATE FROM SAMPLE RCP ================================================================================================*/ ELSIF (V_DETAILS = 'MAX_SMPISS_DT') THEN SELECT MAX(A.TRAN_DATE) INTO V_OUTPUT FROM SAMPLE_RCP A,SAMPLE_RCP_DET B WHERE A.TRAN_ID = B.TRAN_ID AND (CASE WHEN B.LINE_NO IS NULL THEN 0 ELSE 1 END) = 1 AND A.TRAN_DATE >= V_FROM_DATE AND A.TRAN_DATE <= V_TO_DATE AND B.ITEM_CODE = V_CODE_B; /*================================================================================================ 'USR_RET_PARM' :- VALUE OF ACC_PARM1 FIELD OF USERS TABLE ================================================================================================*/ ELSIF (V_DETAILS = 'USR_RET_PARM') THEN SELECT ACC_PARM1 INTO V_OUTPUT FROM USERS WHERE CODE = V_CODE_A; /*============================================================================ 'CORE_COUNT' :- SUM OF CORE DOCTORS LISTED ==============================================================================*/ ELSIF (V_DETAILS = 'CORE_COUNT') THEN SELECT NVL(SUM(A.NOOF_DOCT),0) INTO V_OUTPUT FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.SC_TYPE = 'C' AND B.CONFIRMATION_FLAG = 'Y' AND A.CLASS_CODE = 'C' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE; /*============================================================================ 'NCORE_COUNT' :- SUM OF NON-CORE DOCTORS LISTED ==============================================================================*/ ELSIF (V_DETAILS = 'NCORE_COUNT') THEN SELECT NVL(SUM(A.NOOF_DOCT),0) INTO V_OUTPUT FROM DR_DOCTOR_VISIT A,DR_MAIN B WHERE A.SALES_PERS = B.SALES_PERS AND A.WORK_DATE = B.WORK_DATE AND A.SC_TYPE = 'C' AND B.CONFIRMATION_FLAG = 'Y' AND A.CLASS_CODE = 'N' AND A.SALES_PERS = V_CODE_A AND A.WORK_DATE BETWEEN V_FROM_DATE AND V_TO_DATE; /*============================================================================ 'ACT_PLACE_WORK' :- GET ACUTUAL PLACE OF WORK ==============================================================================*/ ELSIF (V_DETAILS = 'ACT_PLACE_WORK') THEN --SELECT WM_CONCAT(Z.DESCR) SELECT (Z.DESCR) INTO V_OUTPUT FROM( SELECT DISTINCT(S.DESCR) DESCR FROM DR_DOCTOR_VISIT D,DR_MAIN M,SPRS_ROUTE S WHERE D.SALES_PERS_MGR = M.SALES_PERS AND D.WORK_DATE = M.WORK_DATE AND M.SALES_PERS = S.SPRS_CODE AND D.WORK_ROUTE_ID = S.ROUTE_ID AND M.CONFIRMATION_FLAG = 'Y' AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE = V_FROM_DATE UNION SELECT DISTINCT(R.DESCR) DESCR FROM DR_STOCKIST_VISIT D,DR_MAIN M,SPRS_STOCKIST S,SPRS_ROUTE R WHERE D.SALES_PERS_MGR = S.SPRS_CODE AND S.SPRS_CODE = M.SALES_PERS AND D.WORK_DATE = M.WORK_DATE AND M.CONFIRMATION_FLAG = 'Y' AND D.CUST_CODE = S.CUST_CODE AND M.SALES_PERS = R.SPRS_CODE AND S.ROUTE_ID = R.ROUTE_ID AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE = V_FROM_DATE) Z; /*======================================================================== 'WORK_WITH_FSM' :- EMPLOYEE VISITED TO DOCTORS WITH FSM ==========================================================================*/ ELSIF (V_DETAILS = 'WORK_WITH_FSM') THEN --SELECT WM_CONCAT(A.COL) SELECT (A.COL) INTO V_OUTPUT FROM ( SELECT DISTINCT(TRIM(D.VISITED_WITH_FSM)||' '||TRIM(GET_EMPLOYEE_NAME(D.VISITED_WITH_FSM))) COL FROM DR_DOCTOR_VISIT D,DR_MAIN M WHERE D.SALES_PERS = M.SALES_PERS AND D.WORK_DATE = M.WORK_DATE AND M.CONFIRMATION_FLAG = 'Y' AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE = V_FROM_DATE AND D.VISITED_WITH_FSM IS NOT NULL) A; IF V_OUTPUT IS NOT NULL THEN V_OUTPUT := 'FSM - '||V_OUTPUT; ELSE V_OUTPUT := V_OUTPUT; END IF; /*======================================================================== 'WORK_WITH_RSM' :- EMPLOYEE VISITED TO DOCTORS WITH RSM ==========================================================================*/ ELSIF (V_DETAILS = 'WORK_WITH_RSM') THEN --SELECT WM_CONCAT(A.COL) SELECT (A.COL) INTO V_OUTPUT FROM ( SELECT DISTINCT(TRIM(D.VISITED_WITH_RSM)||' '||TRIM(GET_EMPLOYEE_NAME(D.VISITED_WITH_RSM))) COL FROM DR_DOCTOR_VISIT D,DR_MAIN M WHERE D.SALES_PERS = M.SALES_PERS AND D.WORK_DATE = M.WORK_DATE AND M.CONFIRMATION_FLAG = 'Y' AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE = V_FROM_DATE AND D.VISITED_WITH_RSM IS NOT NULL) A; IF V_OUTPUT IS NOT NULL THEN V_OUTPUT := 'RSM - '||V_OUTPUT; ELSE V_OUTPUT := V_OUTPUT; END IF; /*======================================================================== 'WORK_WITH_SM' :- EMPLOYEE VISITED TO DOCTORS WITH SM ==========================================================================*/ ELSIF (V_DETAILS = 'WORK_WITH_SM') THEN --SELECT WM_CONCAT(A.COL) SELECT (A.COL) INTO V_OUTPUT FROM ( SELECT DISTINCT(TRIM(D.VISITED_WITH_SM)||' '||TRIM(GET_EMPLOYEE_NAME(D.VISITED_WITH_SM))) COL FROM DR_DOCTOR_VISIT D,DR_MAIN M WHERE D.SALES_PERS = M.SALES_PERS AND D.WORK_DATE = M.WORK_DATE AND M.CONFIRMATION_FLAG = 'Y' AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE = V_FROM_DATE AND D.VISITED_WITH_SM IS NOT NULL) A; IF V_OUTPUT IS NOT NULL THEN V_OUTPUT := 'SM - '||V_OUTPUT; ELSE V_OUTPUT := V_OUTPUT; END IF; /*======================================================================== 'WORK_WITH_SO' :- FSM VISITED TO DOCTORS WITH SO ==========================================================================*/ ELSIF (V_DETAILS = 'WORK_WITH_SO') THEN --SELECT WM_CONCAT(A.COL) SELECT (A.COL) INTO V_OUTPUT FROM ( SELECT DISTINCT(TRIM(D.SALES_PERS_MGR)||' '||TRIM(GET_EMPLOYEE_NAME(D.SALES_PERS_MGR))) COL FROM DR_DOCTOR_VISIT D,DR_MAIN M WHERE D.SALES_PERS = M.SALES_PERS AND D.WORK_DATE = M.WORK_DATE AND M.CONFIRMATION_FLAG = 'Y' AND D.SALES_PERS = V_CODE_A AND D.WORK_DATE = V_FROM_DATE AND D.SALES_PERS_MGR IS NOT NULL AND D.VISITED_WITH_PSR = 'Y' AND D.SALES_PERS <> D.SALES_PERS_MGR) A; IF V_OUTPUT IS NOT NULL THEN V_OUTPUT := 'SO - '||V_OUTPUT; ELSE V_OUTPUT := V_OUTPUT; END IF; /*======================================================================== 'EXCESS_VISIT' :- Count of excess visit for listed doctor ==========================================================================*/ ELSIF (V_DETAILS = 'EXCESS_VISIT') THEN select nvl(sum(case when sum(c.noof_doct) > max(c.no_visit+1) then sum(c.noof_doct) - max(c.no_visit+1) else 0 end),0) into V_OUTPUT from period a,dr_main b,dr_doctor_visit c where a.code >= V_CODE_C and a.code <= V_CODE_D and b.sales_pers = V_CODE_A and b.work_date >= a.fr_date and b.work_date <= a.to_date and b.confirmation_flag = 'Y' and c.sales_pers = b.sales_pers and c.work_date = b.work_date and c.sc_type = 'C' group by a.code,c.sc_code having max(c.class_code) = (case V_CODE_B when 'CORE' then 'C' when 'NONCORE' then 'N' else max(c.class_code) end); /*======================================================================== 'EMP_SALES' :- Data from emp_sales table ==========================================================================*/ /*ELSIF (V_DETAILS = 'EMP_SALES') THEN select (case V_CODE_B when 'FLS' then netsales when 'TGT' then target when 'ACH' then (case when (netsales != 0 and target != 0) then round((netsales/target)*100,0) else 0 end) else 0 end) into V_OUTPUT from ( select nvl(sum(round(netsales_val,0)),0) netsales,nvl(sum(round(target_val,0)),0) target from emp_sales where emp_code = V_CODE_A and prd_code >= V_CODE_C and prd_code <= V_CODE_D );*/ /*=================================================================== 'GENCODES_DESCR' :- GENCODE DESCRIPTION =====================================================================*/ ELSIF (V_DETAILS = 'GENCODES_DESCR') THEN SELECT A.DESCR INTO V_OUTPUT FROM GENCODES A WHERE A.FLD_NAME = V_CODE_A AND A.MOD_NAME = V_CODE_B AND A.FLD_VALUE = V_CODE_C ; END IF; RETURN V_OUTPUT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CUSTITEM_DSCR (ls_CUST_CODE CHAR,ls_ITEM_CODE CHAR,ls_cust_item__ref char) return varchar is ls_itmdescr customeritem.descr%type;--varchar2(40); begin begin select descr into ls_itmdescr from customeritem where cust_code =ls_cust_code and item_code =ls_item_code and item_code__ref = ls_cust_item__ref ; exception when others then ls_itmdescr := ' '; end; RETURN ls_itmdescr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RCP_IBCA_CHK BEFORE INSERT OR UPDATE OF confirmed ON rcp_ibca referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check gltrace count and gltrace count begin select count(1) into ll_glcount from gltrace where ref_ser = 'R-IBCA' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; -- 2. check header DR, CR and gltrace DR, CR begin --select amount into lc_hdramt from rcp_ibca --where tran_id = :new.tran_id; lc_hdramt := :old.amount ; exception when others then lc_hdramt := 0; end; begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'R-IBCA' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; --if lc_hdramt <> 0 and (lc_gldr <> lc_glcr or lc_glcr <> lc_hdramt or lc_gldr <> lc_hdramt) then if lc_hdramt <> 0 and (lc_gldr <> lc_glcr) then raise_application_error( -20601, 'Debit or credit mismatch between IBCA (Receipt) and gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; -- 31-jan-2023 manoharan check all the receivables in deatils are adjusted with the amount in detail for cur_ibca in ( select d.REF_SER,d.REF_NO, d.TOT_AMT, r.adj_amt from rcp_ibca_det d, receivables r where r.tran_ser = d.ref_ser and r.ref_no = d.ref_no and d.tran_id = :new.tran_id ) loop if abs(cur_ibca.adj_amt) < abs( cur_ibca.tot_amt) then raise_application_error( -20601, 'Receivables not adjust as per detail total amount for tran_ser [' || cur_ibca.ref_ser || '] ref_no [' || cur_ibca.ref_no || '] detail tot_amt [' || to_char(cur_ibca.tot_amt) || '] receivables adj_amt [' || to_char(cur_ibca.adj_amt) || ']' ); end if; end loop; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RECV_CUSTADV (AS_CUST_CODE IN CHAR, AS_FR_DT IN DATE, AS_TO_DT IN DATE, AS_SITE_CODE IN CHAR, AS_FLAG IN CHAR) RETURN NUMBER IS AC_ADV_AMT NUMBER(14,3) ; BEGIN AC_ADV_AMT := 0; IF AS_CUST_CODE = 'ALL' THEN IF AS_FLAG = 'R' THEN SELECT SUM(nvl(RECEIVABLES.TOT_AMT,0)) INTO AC_ADV_AMT FROM RECEIVABLES WHERE (RECEIVABLES.TRAN_SER = 'R-ADV') AND ( RECEIVABLES.REF_DATE >= AS_FR_DT ) AND ( RECEIVABLES.REF_DATE <= AS_TO_DT ) AND ( RECEIVABLES.SITE_CODE = AS_SITE_CODE); ELSE SELECT SUM(nvl(RECEIVABLES.TOT_AMT,0)) INTO AC_ADV_AMT FROM RECEIVABLES, RCPDISHNR WHERE (RECEIVABLES.REF_NO = RCPDISHNR.RECEIPT_NO) AND ( RECEIVABLES.TRAN_SER = 'R-ADV' ) AND ( RCPDISHNR.TRAN_DATE >= AS_FR_DT ) AND ( RCPDISHNR.TRAN_DATE <= AS_TO_DT ) AND ( RCPDISHNR.SITE_CODE =AS_SITE_CODE ) AND ( RCPDISHNR.CONFIRMED = 'Y'); END IF; ELSE IF AS_FLAG = 'R' THEN SELECT SUM(nvl(RECEIVABLES.TOT_AMT,0)) INTO AC_ADV_AMT FROM RECEIVABLES WHERE (RECEIVABLES.TRAN_SER = 'R-ADV') AND ( RECEIVABLES.REF_DATE >= AS_FR_DT ) AND ( RECEIVABLES.REF_DATE <= AS_TO_DT ) AND ( RECEIVABLES.SITE_CODE = AS_SITE_CODE) AND ( RECEIVABLES.CUST_CODE = AS_CUST_CODE); ELSE SELECT SUM(nvl(RECEIVABLES.TOT_AMT,0)) INTO AC_ADV_AMT FROM RECEIVABLES, RCPDISHNR WHERE (RECEIVABLES.REF_NO = RCPDISHNR.RECEIPT_NO) AND ( RECEIVABLES.TRAN_SER = 'R-ADV' ) AND ( RCPDISHNR.TRAN_DATE >= AS_FR_DT ) AND ( RCPDISHNR.TRAN_DATE <= AS_TO_DT ) AND ( RCPDISHNR.SITE_CODE =AS_SITE_CODE ) AND ( RECEIVABLES.CUST_CODE = AS_CUST_CODE) AND ( RCPDISHNR.CONFIRMED = 'Y'); END IF; END IF; RETURN AC_ADV_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE GETDCRIDMASTER AS TABLE OF getDcrID; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CLSTK_QV_PAR_CCTR_ITEM_GR (as_sitecode in char, as_itemcode in char, adt_fromdate in date, as_available in char, as_cctr_code in char, as_qtyvalue in char, as_grade in char ) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin -- select min(a.crea_date) into ldt_crea_date -- from stock a, -- invstat b, -- costctr cctr_a, -- costctr cctr_b -- where a.inv_stat = b.inv_stat -- and a.CCTR_CODE__INV = cctr_a.cctr_code -- and cctr_a.cctr_code__par = cctr_b.cctr_code -- and a.item_code = as_itemcode -- and a.site_code = as_sitecode -- and cctr_b.cctr_code = as_cctr_code -- and instr(as_available,b.available) > 0; -- if adt_fromdate < ldt_crea_date then -- return 0; -- end if; select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) ),0), nvl(sum ((nvl(a.eff_qty,0) * nvl(a.rate,0) ) ),0) ) qty from invtrace a, location b, invstat c, costctr cctr_a, costctr cctr_b, stock d where a.item_code = d.item_code and a.site_code = d.site_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.grade = d.grade and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.item_code = as_itemcode and a.site_code = as_sitecode and d.cctr_code__inv = cctr_a.cctr_code and cctr_a.cctr_code__par = cctr_b.cctr_code and cctr_b.cctr_code = as_cctr_code and a.tran_date <= adt_fromdate and d.grade = as_grade and instr(as_available,c.available) > 0); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RIGHTCHAR_TITLE ( as_Obj_Name IN varchar2,as_IN_CHAR IN CHAR,as_form_no in varchar2 ) RETURN varchar2 is ls_ret_val varchar2(500):= ''; c_title varchar2(50):= ''; CURSOR c_objact is select trim(title) from obj_actions where obj_name =as_Obj_Name and form_no=as_form_no and RIGHTS_CHAR = as_IN_CHAR UNION select trim(LINK_title) from OBJ_LINKS Where obj_name = as_Obj_Name and form_no= as_form_no and RIGHTS_CHAR = as_IN_CHAR; Begin BEGIN OPEN c_objact; LOOP FETCH c_objact into c_title; EXIT WHEN c_objact%notfound; ls_ret_val := ls_ret_val ||c_title||','; END LOOP; CLOSE c_objact; IF LENGTH(ls_ret_val)> 0 THEN ls_ret_val := SUBSTR (ls_ret_val ,1,LENGTH(ls_ret_val)-1) ||' '; END IF; Return ls_ret_val; End; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX COSTCTR_PAR ON COSTCTR (CCTR_CODE__PAR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_LENGTH (as_value in varchar2) return numeric is as_length numeric(14,3); begin select length(as_value) into as_length from dual; return as_length; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_SRETURN_SER (ls_tran_id in char,ls_item_ser_det in char) return number is ll_count number(5,0); ls_site_code char(2); begin select substr(site_code,1,2) into ls_site_code from sreturn where tran_id = ls_tran_id; if ls_site_code = 'AM' then ll_count := 1; else select count(*) into ll_count from sreturn where tran_id = ls_tran_id and item_ser = ls_item_ser_det; end if; return ll_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAXTRAN_RECO_AMT (as_tran_id in char, as_line_no in char) return number is lc_amount number(14,3); begin select nvl(reco_amount,0) into lc_amount from taxtran where ( taxtran.tran_code = 'P-RCP' ) and ( tran_id = as_tran_id ) and ( line_no = as_line_no ) and ( taxtran.tax_code = 'EXC') ; return lc_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_TYPE (as_invoiceid char) return varchar is ls_val varchar(15); begin select tax_class into ls_val from invoice where invoice_id = as_invoiceid; return ls_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_TABLE_NAME_PRIMARY_KEY (AS_COLUMN_NAME VARCHAR2,AS_OBJ_NAME VARCHAR2) RETURN VARCHAR2 IS COL_VAL VARCHAR2(50); BEGIN IF(AS_COLUMN_NAME='TABLE_NAME') THEN SELECT TABLE_NAME INTO COL_VAL FROM TRANSETUP WHERE TRAN_WINDOW=CONCAT('w_',AS_OBJ_NAME); END IF; IF(AS_COLUMN_NAME='PRIMARY_KEY') THEN SELECT TRAN_ID_COL INTO COL_VAL FROM TRANSETUP WHERE TRAN_WINDOW=CONCAT('w_',AS_OBJ_NAME); END IF; IF(AS_COLUMN_NAME='SERVICE_TYPE') THEN SELECT DESCR INTO COL_VAL FROM GENCODES WHERE FLD_VALUE=AS_OBJ_NAME; END IF; IF(AS_COLUMN_NAME='OJB_DESCR') THEN SELECT DESCR INTO COL_VAL FROM ITM2MENU WHERE WIN_NAME=CONCAT('w_',AS_OBJ_NAME) AND ROWNUM = 1; END IF; IF(AS_COLUMN_NAME='FLD_VALUE') THEN SELECT FLD_VALUE INTO COL_VAL FROM GENCODES WHERE MOD_NAME='W_APP' AND FLD_VALUE=AS_OBJ_NAME ; END IF; IF COL_VAL IS NULL THEN COL_VAL:=''; END IF; RETURN COL_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STNAMD_TRAN_DATE ON STN_AMD (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXMPT_EXC_AMT (as_tran_id varchar2,ls_grp varchar2,ls_exch number) return decimal is ls_exmp_amt decimal(12,2); begin select sum(amt) into ls_exmp_amt from (SELECT sum(nvl( taxtran.tax_amt,0) * ls_exch ) amt FROM TAXTRAN , TAX , PORCPDET , LOCATION WHERE trim(TAXTRAN.TRAN_CODE)=trim('P-RCP') and taxtran.tran_id = porcpdet.tran_id and taxtran.line_no = porcpdet.line_no AND LOCATION.LOC_CODE = PORCPDET.LOC_CODE (+) AND TAXTRAN.TRAN_ID= as_tran_id and trim(tax.bal_group) =ls_grp AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TAX_AMT <> 0 AND LOCATION.LOC_GROUP='EXEX' UNION ALL SELECT sum(nvl( taxtran.tax_amt,0) * ls_exch ) FROM TAXTRAN , TAX , DISTORD_RCPDET , LOCATION WHERE trim(TAXTRAN.TRAN_CODE)=trim('D-RCP') and taxtran.tran_id = DISTORD_RCPDET.tran_id and taxtran.line_no = DISTORD_RCPDET.line_no AND TAXTRAN.TRAN_ID= as_tran_id and trim(tax.bal_group) =ls_grp AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND LOCATION.LOC_CODE = DISTORD_RCPDET.LOC_CODE(+) AND TAXTRAN.TAX_AMT <> 0 AND LOCATION.LOC_GROUP='EXEX' UNION ALL SELECT sum(nvl( taxtran.tax_amt,0) * ls_exch ) FROM TAXTRAN , TAX , SRETURNDET , LOCATION WHERE trim(TAXTRAN.TRAN_CODE)=trim('S-RET') and taxtran.tran_id = SRETURNDET.tran_id and taxtran.line_no = SRETURNDET.line_no AND SRETURNDET.LOC_CODE = LOCATION.LOC_CODE AND TAXTRAN.TRAN_ID= as_tran_id and trim(tax.bal_group) =ls_grp AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TAX_AMT <> 0 AND LOCATION.LOC_GROUP='EXEX' ); return ls_exmp_amt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETBANKTRANID ( lssitecode in CHAR, lstranser in CHAR, lstranno in CHAR) return varchar2 is ls_tranid VARCHAR2(100); cursor c1 is select tran_id from banktran_log where site_code = lssitecode and (tran_ser = lstranser or tran_ser is null) and tran_no = lstranno ; begin if (lstranser = 'M-RCP' or lsTranSer = 'RCP' or lsTranSer = 'R-DIS' or lsTranSer = 'B' or lsTranSer = 'E-PAY' or lsTranSer = 'M-PAY' or lsTranSer = 'MPCANC') then BEGIN FOR I IN c1 LOOP ls_tranid := ls_tranid || ' ' || rtrim(I.TRAN_ID); END LOOP; END; end if; return LTRIM(ls_tranid); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LEGAL_AGR_REG_X ON LEGAL_AGR_REG (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ASSESSMENT_DETAILS (as_ref_type in statutory_filing.ref_type%TYPE, as_tran_id_ref in statutory_filing.tran_id%TYPE) RETURN varchar2 IS CURSOR ASSESSMENT_DET IS SELECT nvl(a.ASS_AMT,0), (nvl(a.PAY_TAX_AMT,0) + nvl(a.INTR_AMT,0)) as it_payable, (nvl(a.ADV_TAX_AMT,0) + nvl(a.TDS_AMT,0) + nvl(a.SELF_ASS_AMT,0)) as it_paid, ((nvl(a.PAY_TAX_AMT,0) + nvl(a.INTR_AMT,0)) - (nvl(a.ADV_TAX_AMT,0) + nvl(a.TDS_AMT,0) + nvl(a.SELF_ASS_AMT,0))) as ref_pay FROM statutory_it_det a, statutory_filing b where b.tran_id = a.tran_id and b.tran_id = as_tran_id_ref; CURSOR OTH_DET IS SELECT a.remarks FROM statutory_oth_det a, statutory_filing b where b.tran_id = a.tran_id and b.tran_id = as_tran_id_ref; assessmentDetail varchar2(5000) :=''; otherDetail varchar2(5000) :=''; assAmt statutory_it_det.ASS_AMT%TYPE := 0; itPayable statutory_it_det.ASS_AMT%TYPE := 0; itPaid statutory_it_det.ASS_AMT%TYPE := 0; refPay statutory_it_det.ASS_AMT%TYPE := 0; v_char char(1) := ':'; seprator char(1) := ','; breakLine char(1) := '@'; BEGIN -- Sharad 19-OCT-2010 : Begin -- Added If loop to check if Ref type is IT as per discussion with Navin Sir on Date 19-OCT-2010 if (instr(as_ref_type, 'IT') > 0) then -- Sharad 19-OCT-2010 : End OPEN ASSESSMENT_DET; FETCH ASSESSMENT_DET INTO assAmt,itPayable,itPaid,refPay; WHILE ASSESSMENT_DET%FOUND LOOP FETCH ASSESSMENT_DET INTO assAmt,itPayable,itPaid,refPay; assessmentDetail := assessmentDetail || 'Assessment Amount' || v_char || assAmt || seprator; assessmentDetail := assessmentDetail || 'Total Tax Payable' || v_char || itPayable || seprator; assessmentDetail := assessmentDetail || 'Total Tax Paid' || v_char || itPaid || seprator; assessmentDetail := assessmentDetail || 'Refund/Payable Amount' || v_char || itPaid || chr(10) || seprator; if(length(assessmentDetail) is null or length(assessmentDetail) = 0) then assessmentDetail := ''; else assessmentDetail := substr(assessmentDetail,0, (length(assessmentDetail)-1)); end if; END LOOP; CLOSE ASSESSMENT_DET; if(length(assessmentDetail) is null or length(assessmentDetail) = 0) then assessmentDetail := ''; else assessmentDetail := substr(assessmentDetail,0, (length(assessmentDetail)-1)); end if; -- Sharad 19-OCT-2010 : Begin -- Added for Other Details as per discussion with Navin Sir on Date 19-OCT-2010 else OPEN OTH_DET; FETCH OTH_DET INTO otherDetail; WHILE OTH_DET%FOUND LOOP FETCH OTH_DET INTO otherDetail; assessmentDetail := assessmentDetail || 'Remarks' || v_char || otherDetail || chr(10); END LOOP; CLOSE OTH_DET; end if; -- Sharad 19-OCT-2010 : End if(length(assessmentDetail) is null or length(assessmentDetail) = 0) then assessmentDetail := ''; else assessmentDetail := substr(assessmentDetail,0, (length(assessmentDetail)-1)); end if; RETURN assessmentDetail; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN assessmentDetail; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SL_TRANDATE (ldate_fr in date,lsundry_code in char,lsundry_type in char,lsite_code in char,lacct_code in char) return number is lc_day_op_bal number(14,3); lc_prd_op_bal number(14,3); ls_prd char(6); ls_acct_prd char(6); ls_fr_date date; begin select code, acct_prd ,fr_date into ls_prd ,ls_acct_prd,ls_fr_date from period where ldate_fr between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and site_code = lsite_code and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Select nvl(Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)),0) into lc_day_op_bal from gltrace where site_code = lsite_code and tran_date >= ls_fr_date and tran_date < ldate_fr and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DESP_STATUS BEFORE INSERT OR UPDATE ON despatchdet referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.status is null then :new.status := ' '; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SORD_ALLOC ON SORD_ALLOC (CUST_CODE, SITE_CODE, SALE_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PUR_EXP_RECO_SER_ID ON PUR_EXP_RECO (REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_TRANSITSTK ( lgeo_loc in char, litem_code in char, ad_to_date in date) return number is LC_PORCP_QTY number(14,3); LC_DIST_QTY NUMBER(14,3); begin SELECT SUM(PORCPDET.QUANTITY) INTO LC_PORCP_QTY FROM PORCP, PORCPDET, SITE WHERE ( PORCP.TRAN_ID = PORCPDET.TRAN_ID ) AND ( PORCP.SITE_CODE = SITE.SITE_CODE ) AND ( PORCPDET.ITEM_CODE = litem_code ) AND ( SITE.GEO_LOC = lgeo_loc) AND ( PORCP.CONFIRMED = 'N' ) AND ( PORCP.TRAN_DATE >= '01-APR-2003' ) AND ( PORCP.TRAN_DATE <= ad_to_date ) ; IF LC_PORCP_QTY = NULL THEN LC_PORCP_QTY := 0; END IF; SELECT SUM(DISTORDER_DET.QTY_ORDER ) INTO LC_DIST_QTY FROM DISTORDER, DISTORDER_DET, SITE WHERE ( DISTORDER_DET.DIST_ORDER = DISTORDER.DIST_ORDER ) and ( SITE.SITE_CODE = DISTORDER.SITE_CODE ) and ( ( DISTORDER.CONFIRMED = 'N' ) AND ( DISTORDER.ORDER_DATE >= '01-APR-2003' ) AND ( DISTORDER.ORDER_DATE <= ad_to_date ) AND ( SITE.GEO_LOC = lgeo_loc ) AND ( DISTORDER_DET.ITEM_CODE = litem_code ) ) ; IF LC_DIST_QTY = NULL THEN LC_DIST_QTY := 0; END IF; LC_PORCP_QTY := LC_PORCP_QTY + LC_DIST_QTY ; RETURN LC_PORCP_QTY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PRICELIST (as_sales_pers IN CHAR ,as_strg_code IN CHAR ) return char is price_list CHAR(5); cnt number(3); begin select count(*) into cnt from site_customer where cust_code = as_strg_code and site_code = (SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE=as_sales_pers) ; if(cnt > 0) then select price_list into price_list from site_customer where cust_code = as_strg_code and site_code = (SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE=as_sales_pers) ; cnt :=0; end if; select count(*) into cnt from customer where cust_code=as_strg_code; if(cnt > 0) then if(price_list is null OR price_list = '') then select price_list into price_list from customer where cust_code=as_strg_code; end if; end if; if(price_list is null OR price_list = '') then select price_list into price_list from strg_customer where sc_code=as_strg_code; end if; if(price_list is null OR price_list = '') then select st.price_list into price_list from state st left outer join sales_pers sp on sp.state_code = st.state_code where sp.sales_pers=as_sales_pers; end if; return price_list; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSINVLRDT1 (as_lr_date in despatch.lr_Date%type) return number is FLAG NUMBER(1); --ls_count number(10,0); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_DESP_INVLRDT1'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then --select count(*) from dual WHERE ? SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SM_SALES_SITE_SITE_PRD ON SM_SALES_SITE (ITEM_SER, LEVEL_CODE, LEVEL_CODE__PARENT, PRD_CODE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDS_CHNO_BANKCD_TNO (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_str varchar2(200) ; ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ctr number(3); cursor c1 is select nvl(HANDOVER_CHNO,''), nvl(BANK_CODE__TAX,''),nvl(TOKEN_NO,'') from misc_payment where tran_id in ( select tran_id from misc_paydet where tran_ser = 'M-VOUC' and vouch_no = ls_vouch_no ) ; begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_ch_no_det,ls_bank_cd_det,ls_token_no_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; ls_str := rtrim(ls_str)||'|'|| ls_ch_no_det||'|'||ls_bank_cd_det||'|'||ls_token_no_det ; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_ACTIVITY_DESCR (AS_ACTIVITY_CODE CHAR,AS_OPTION VARCHAR2) RETURN VARCHAR2 IS LS_DESCR VARCHAR2(50); BEGIN IF(AS_OPTION='DESCR')THEN SELECT DESCR INTO LS_DESCR FROM FIELDACTIVITY WHERE TRIM(ACTIVITY_CODE)=TRIM(AS_ACTIVITY_CODE); RETURN LS_DESCR; ELSIF(AS_OPTION='SH_DESCR')THEN SELECT SH_DESCR INTO LS_DESCR FROM FIELDACTIVITY WHERE TRIM(ACTIVITY_CODE)=TRIM(AS_ACTIVITY_CODE); RETURN LS_DESCR; ELSIF(AS_OPTION='ACTIVITY_TYPE')THEN SELECT ACTIVITY_TYPE INTO LS_DESCR FROM FIELDACTIVITY WHERE TRIM(ACTIVITY_CODE)=TRIM(AS_ACTIVITY_CODE); RETURN LS_DESCR; ELSIF(AS_OPTION='STATUS')THEN SELECT STATUS INTO LS_DESCR FROM FIELDACTIVITY WHERE TRIM(ACTIVITY_CODE)=TRIM(AS_ACTIVITY_CODE); RETURN LS_DESCR; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ORG_UNIT_VISITED_WITH (as_org_unit IN VARCHAR2,as_role_code varchar2) RETURN VARCHAR2 is VISITED_WITH varchar2(5000); BEGIN if(as_org_unit is not null and as_role_code is not null) then SELECT LISTAGG(DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ')' , ',') WITHIN GROUP (ORDER BY DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ') into VISITED_WITH FROM EMPLOYEE EMP WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE trim(ORG_UNIT)=trim(as_org_unit) AND trim(ROLE_CODE)=trim(as_role_code) connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null); end if; RETURN VISITED_WITH; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DR_MAIN_INSERT AFTER INSERT or update or delete ON SPRS_ACT_TRAN FOR EACH ROW declare POSTAGE_EXP NUMBER(3); TELEPHONE_EXP NUMBER(3); OTHER_EXP NUMBER(3); CNT number(10); CNTTRAVEL number(10); CURRDATE DATE; ls_emp_site char(5); TRAVEL_FARE number(7,2); DAILY_ALLOWANCE number(5); MODE_REPO char(1); LS_ITEM_SER CHAR(5); LS_GRADE CHAR(5); li_grade_level number(3); ls_stan_code__hq char(5); ls_report_to char(10); ls_sales_pers_mgr varchar2(100); ls_sales_pers_mgr_flg char(1); ls_last_update date; ld_travel_date date; ls_stan_code_start char(5); ls_last_placeof_work_descr varchar2(15); ls_route_id_start number(3); ls_designation varchar2(25); ls_route_descr_start varchar2(60); line_cnt number(10); dr_trv_cnt number(3); sprstrv_cnt number(3); BEGIN POSTAGE_EXP := 0; TELEPHONE_EXP := 0; OTHER_EXP := 0; CNT:=0; TRAVEL_FARE:=0; DAILY_ALLOWANCE:=0; MODE_REPO:='N'; line_cnt:=0; if deleting then DELETE FROM DR_MAIN WHERE SALES_PERS = :old.sales_pers AND WORK_DATE = :old.event_date; else SELECT COUNT (*) INTO CNT FROM DR_MAIN WHERE SALES_PERS = :new.sales_pers AND WORK_DATE = :new.event_date; SELECT MODE_REPO, ITEM_SER into MODE_REPO, LS_ITEM_SER FROM SALES_PERS WHERE SALES_PERS=:new.sales_pers; SELECT EMP.GRADE, G.LEVEL_NO LEVEL_NO, EMP.STAN_CODE__HQ, EMP.REPORT_TO, EMP.DESIGNATION INTO LS_GRADE,li_grade_level,ls_stan_code__hq,ls_report_to, ls_designation FROM EMPLOYEE EMP, GRADE G WHERE EMP.EMP_CODE = :new.sales_pers AND G.GRADE_CODE = EMP.GRADE; if li_grade_level=4 then ls_sales_pers_mgr := :new.sales_pers; ls_sales_pers_mgr_flg :='N'; else ls_sales_pers_mgr:=:new.sprs_code__ww; ls_sales_pers_mgr_flg:='Y'; end if; if MODE_REPO='B' or MODE_REPO ='N' then MODE_REPO :='N'; else MODE_REPO :='M'; end if; SELECT COUNT (*) INTO CNTTRAVEL FROM DR_TRAVEL_DETAILS WHERE SALES_PERS = :new.sales_pers AND WORK_DATE =(SELECT MAX(WORK_DATE) FROM DR_TRAVEL_DETAILS WHERE WORK_DATE < :new.event_date AND SALES_PERS = :new.sales_pers AND WORK_ROUTE_ID IS NOT NULL ) AND ROWNUM = 1 ORDER BY LINE_NO DESC; IF CNTTRAVEL > 0 THEN SELECT WORK_ROUTE_ID, WORK_STAN_CODE, WRK_ROUTE_DESCR INTO ls_route_id_start, ls_stan_code_start, ls_route_descr_start FROM DR_TRAVEL_DETAILS WHERE SALES_PERS = :new.sales_pers AND WORK_DATE =(SELECT MAX(WORK_DATE) FROM DR_TRAVEL_DETAILS WHERE WORK_DATE < :new.event_date AND SALES_PERS = :new.sales_pers AND WORK_ROUTE_ID IS NOT NULL ) AND ROWNUM = 1 ORDER BY LINE_NO DESC; END IF; if ls_stan_code_start = null or length(trim(ls_stan_code_start)) = 0 then ls_stan_code_start := ls_stan_code__hq; end if; if ls_route_id_start = null or length(trim(ls_route_id_start)) = 0 then SELECT ROUTE_ID,(case when ROUTE_DESCR is null then descr else ROUTE_DESCR end ) INTO ls_route_id_start,ls_route_descr_start FROM SPRS_ROUTE WHERE SPRS_CODE = :new.sales_pers AND STAN_CODE = ls_stan_code_start AND ROWNUM=1 ORDER BY ROUTE_ID; end if; if (:new.CONFIRMED = 'Y') then ls_last_update := :new.conf_date; else ls_last_update := :new.chg_date; end if; IF CNT > 0 THEN UPDATE DR_MAIN SET REMARK = :new.remark, LAST_UPDATE =ls_last_update , UPDATED_BY = :new.sales_pers , CHG_DATE = :new.chg_date , CHG_USER = :new.chg_user , CHG_TERM = :new.chg_term , ACTIVITY_CODE = :new.activity_code , COMPLETION_FLAG = 'Y' , copy_plan = :new.copy_plan , CONFIRMATION_FLAG = :new.confirmed,SALES_PERS_MGR=ls_sales_pers_mgr,GENERAL_REMARK=:new.remark WHERE SALES_PERS = :new.sales_pers AND WORK_DATE = :new.event_date ; ELSE INSERT INTO DR_MAIN(SALES_PERS ,WORK_DATE ,REMARK,SUBMISSION_DATE ,POSTAGE_EXP ,TELEPHONE_EXP ,OTHER_EXP ,LAST_UPDATE ,UPDATED_BY ,CHG_DATE ,CHG_USER ,CHG_TERM ,ACTIVITY_CODE ,COMPLETION_FLAG,copy_plan,CONFIRMATION_FLAG,TRAVEL_FARE,DAILY_ALLOWANCE,MODE_REPO,ITEM_SER,SALES_PERS_MGR,SALES_PERS_MGR_FLG,USE_SUB_DATA,STAN_CODE__START,ROUTE_ID__START,ROUTE_DESCR__START,DESIGNATION, GRADE, STAN_CODE__HQ,GENERAL_REMARK,REPORT_TO,REPORT_SRC ) VALUES (:new.sales_pers ,:new.event_date ,:new.remark,:new.chg_date,POSTAGE_EXP ,TELEPHONE_EXP ,OTHER_EXP ,:new.chg_date ,:new.sales_pers ,:new.chg_date ,:new.chg_user ,:new.chg_term ,:new.activity_code ,'Y',:new.copy_plan,:new.confirmed,TRAVEL_FARE,DAILY_ALLOWANCE,MODE_REPO,LS_ITEM_SER,ls_sales_pers_mgr,ls_sales_pers_mgr_flg,:new.use_sub_data,ls_stan_code_start,ls_route_id_start,ls_route_descr_start,ls_designation,LS_GRADE, ls_stan_code__hq,:new.remark,ls_report_to,'SHINE') ; END IF; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SER_COMP_MST_X ON SER_COMP_MST (COMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ENTITY_DETAIL_TB force AS TABLE OF ENTITY_DETAIL_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_VOUCHER_REF_ID (lsref_ser char,lsref_id char) return char is ls_no char(60); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCISE_DUTY1 (as_tran_code taxtran.tran_code%type,as_tran_id taxtran.tran_id%type,as_tax_code taxtran.tax_code%type) return number is lc_duty number; ls_non_payable varchar(1000); ls_sql varchar(1000); ls_token varchar(1000); ls_string varchar(1000); ls_var varchar(1000); begin select case when non_payable is null then 'N' else non_payable end into ls_non_payable from tax where tax_code = as_tax_code; SELECT var_value into ls_var from disparm where var_name = 'CESS_TAX_CODE_MODVAT'; if ls_non_payable = 'Y' then lc_duty := 0; else SELECT nvl(sum(taxtran.tax_amt * ddf_get_exch_rate( as_tran_id,as_tran_code) ),0) INTO lc_duty FROM taxtran, tax WHERE ( taxtran.tax_code = tax.tax_code ) and ( ( tran_code = as_tran_code ) AND ( tran_id = as_tran_id ) AND ( taxtran.tax_perc <> 0 ) ) and INSTR(ls_var,taxtran.tax_code)>0 ; dbms_output.put_line('Amount Checking'||lc_duty); end if; return lc_duty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION BI_GS_STOCK (msales_pers in char, mwork_date in date, mitem_code in char) return number is mbal_qty number(14,3) := 0; miss_qty number(14,3) := 0; msp_qty number(14,3) := 0; begin select nvl(sum(consume_iss_det.quantity), 0) into miss_qty from consume_iss, consume_iss_det where consume_iss.emp_code = msales_pers and consume_iss.issue_date >= '01-apr-05' and consume_iss.issue_date <= mwork_date and consume_iss_det.cons_issue = consume_iss.cons_issue and consume_iss_det.item_code = 'G037515'; select nvl(sum(dr_sample_distributed.item_qty), 0) into msp_qty from dr_sample_distributed where dr_sample_distributed.sales_pers = msales_pers and dr_sample_distributed.work_date >= '01-apr-05' and dr_sample_distributed.work_date <= (mwork_date - 1) and dr_sample_distributed.item_code = mitem_code; mbal_qty := miss_qty - msp_qty; return mbal_qty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BOL_X ON BOL (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_PORCP_QTYRATE BEFORE insert or update ON porcpdet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; BEGIN if round(nvl(:new.quantity,0) * nvl(:new.conv__qty_stduom,0),3) <> round(nvl(:new.quantity__stduom,0),3) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] x conv__qty_stduom [' || to_char(:new.conv__qty_stduom) || '] not matching with quantity__stduom['||to_char(:new.quantity__stduom)|| '] rounded qtyconv * qty [' || to_char(round(nvl(:new.quantity,0) * nvl(:new.conv__qty_stduom,0),3)) ||']'); end if; if round(nvl(:new.rate,0) * nvl(:new.CONV__RTUOM_STDUOM,1),6) <> round(nvl(:new.RATE__STDUOM,0),6) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] rate [' || to_char(:new.rate) || '] x CONV__RTUOM_STDUOM [' || to_char(:new.CONV__RTUOM_STDUOM) || '] not matching with RATE__STDUOM['||to_char(:new.RATE__STDUOM)|| ']' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_REPRINTCNT (as_parameter_val char, as_report_name char) return number is rptcnt rpt_print_log.REPRINT_CNT%type; begin SELECT (MAX(REPRINT_CNT)) into rptcnt FROM rpt_print_log WHERE REPORT_NAME=as_report_name AND PARAMETER_VAL=as_parameter_val ; return rptcnt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_DRTAX (as_tranid in distord_rcp.tran_id%type) RETURN NUMBER IS ls_distorder distorder.dist_order%type; ls_tranid_iss distord_iss.tran_id%type; lc_ordperc number(14,3) := 0; lc_recperc number(14,3) := 0; ll_retval number(1) := 0; ls_taxcode tax.tax_code%type; ll_isscount number(3) := 0; cur_out sys_refcursor; ls_sql VARCHAR2(1000); ls_taxid taxtran.tran_id%type; ls_trancode taxtran.tran_code%type; ll_mismatch_cnt number(3) := 0; ls_linenoord taxtran.line_no%type; ls_lineno taxtran.line_no%type; ll_linenoiss distord_issdet.line_no%type := 0; ls_linenoiss taxtran.line_no%type; BEGIN begin ls_tranid_iss := ' '; select TRAN_ID__ISS,dist_order into ls_tranid_iss,ls_distorder from distord_rcp where tran_id = as_tranid; exception when others then ls_tranid_iss := ' '; end; if ls_tranid_iss is not null and length(trim(ls_tranid_iss)) > 0 then select count(1) into ll_isscount from distord_iss where tran_id = ls_tranid_iss; end if; if ll_isscount > 0 then ls_trancode := 'D-ISS'; ls_taxid := ls_tranid_iss; else ls_trancode := 'D-ORD'; ls_taxid := ls_distorder; end if; for cur_drdet in ( select line_no, DIST_ORDER, LINE_NO_DIST_ORDER from distord_rcpdet where tran_id = as_tranid ) loop ls_lineno := lpad(cur_drdet.line_no,3,' '); ls_linenoord := lpad(cur_drdet.LINE_NO_DIST_ORDER,3,' '); --OPEN cur_out FOR ls_sql USING ls_trancode,ls_taxid, ls_linenoord ; if ll_isscount > 0 then ll_linenoiss := 0; begin select line_no into ll_linenoiss from distord_issdet where tran_id = ls_tranid_iss and line_no_dist_order = cur_drdet.LINE_NO_DIST_ORDER and rownum = 1; exception when others then ll_linenoiss := 0; end; end if; if ll_linenoiss > 0 then ls_trancode := 'D-ISS'; ls_taxid := ls_tranid_iss; ls_linenoiss := lpad(ll_linenoiss,3,' '); else ls_trancode := 'D-ORD'; ls_taxid := ls_distorder; ls_linenoiss := ls_linenoord; end if; ls_sql := 'Select tax_code,tax_perc from taxtran where tran_code = :tran_code and tran_id = :tran_id and line_no = :lineord and tax_perc <> 0 order by line_no, line_no__tax'; OPEN cur_out FOR ls_sql USING ls_trancode,ls_taxid, ls_linenoiss ; LOOP FETCH cur_out INTO ls_taxcode, lc_ordperc; EXIT WHEN cur_out%NOTFOUND; begin select count(1) into ll_mismatch_cnt from taxtran where tran_code = 'D-RCP' and tran_id = as_tranid and line_no = ls_lineno and tax_code = ls_taxcode; if ll_mismatch_cnt = 0 then ll_mismatch_cnt := 1; exit; end if; exception when others then ll_mismatch_cnt := 1; exit; end; begin select count(1) into ll_mismatch_cnt from taxtran where tran_code = 'D-RCP' and tran_id = as_tranid and tax_code = ls_taxcode and line_no = ls_lineno and tax_perc <> lc_ordperc; if ll_mismatch_cnt > 0 then exit; end if; exception when others then ll_mismatch_cnt := 1; exit; end; END LOOP; close cur_out; end loop; -- end of receipt det if ll_mismatch_cnt > 0 then ll_retval := 1; end if; RETURN ll_retval ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_MRPTAB_S_I_B_IMPS ON MRPTABLEDATA (SITE_CODE, ITEM_CODE, BOM_CODE, ITEM_CODE__MPS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXPMFG_DATE (as_itemcode in char, as_sitecode in char, as_lotno in char, as_expmfg in char) return date is ldt_retval date; begin begin select min(decode(as_expmfg,'E',exp_date,mfg_date)) into ldt_retval from stock where item_code = as_itemcode and site_code = as_sitecode and lot_no = as_lotno; end; return ldt_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRY_DET (LS_SUNDRY_TYPE in CHAR , LS_SCODE in CHAR , LC_TYPE in CHAR ) RETURN VARCHAR IS LS_SUPPCODERET VARCHAR (4000); LS_SITE_CODE VARCHAR ( 10 ); LS_VAR_SUPPCODE VARCHAR(4000); BEGIN LS_SUPPCODERET := ' '; IF LS_SUNDRY_TYPE = 'S' THEN IF LC_TYPE = 'N' THEN SELECT SUPP_NAME || ', ' || NVL ( CITY , '' ) INTO LS_VAR_SUPPCODE FROM SUPPLIER WHERE SUPP_CODE = LS_SCODE ; ELSIF LC_TYPE = 'C' THEN SELECT COUNTRY . DESCR INTO LS_VAR_SUPPCODE FROM SUPPLIER , COUNTRY WHERE COUNTRY . COUNT_CODE = SUPPLIER . COUNT_CODE AND SUPP_CODE = LS_SCODE ; END IF ; ELSIF LS_SUNDRY_TYPE = 'C' THEN IF LC_TYPE = 'N' THEN SELECT CUST_NAME || ', ' || CITY INTO LS_VAR_SUPPCODE FROM CUSTOMER WHERE CUST_CODE = LS_SCODE; ELSIF LC_TYPE = 'C' THEN SELECT COUNTRY . DESCR INTO LS_VAR_SUPPCODE FROM CUSTOMER , COUNTRY WHERE COUNTRY . COUNT_CODE = CUSTOMER . COUNT_CODE AND CUST_CODE = LS_SCODE ; END IF ; END IF ; LS_SUPPCODERET := LS_VAR_SUPPCODE; RETURN (LS_SUPPCODERET) ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGIM_EXCISE (as_gimno porcp.tran_id%type) return number is ldec_excise number(14,3) ; begin select sum(tax_amt) into ldec_excise from taxtran where tran_code = 'P-RCP' and tax_code='EXC' and tran_id=as_gimno; return(ldec_excise); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LEAVEBAL_EMP_EFF_UPTO_LVE ON LEAVEBAL (EMP_CODE, EFF_DATE, UPTO_DATE, LVE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DLVTERM_DESCR (as_dlvterm char,as_flag char) return Varchar2 is ls_descr delivery_term.descr%type; begin if as_flag='D' then select delivery_term.descr into ls_descr from delivery_term where delivery_term.dlv_term =as_dlvterm; end if; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LOANS_NO_X ON LOAN_ADJ (LOAN_NO, LINE_NO, AD_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INTERESTEDQCTL_X ON INTERESTEDQCTL (SITE_CODE__FR, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_PRODUCTDESCR (AS_TRAN_ID IN CHAR,AS_PROD_TYPE IN VARCHAR2) RETURN VARCHAR2 IS AS_PROD_DESCR VARCHAR2(250) ; BEGIN SELECT DECODE(strg_meet_items.item_code, NULL, SPRODGRP.descr, item.descr) INTO AS_PROD_DESCR FROM strg_meet_items LEFT OUTER JOIN item ON strg_meet_items.item_code = item.item_code LEFT OUTER JOIN sales_prod_grp SPRODGRP ON strg_meet_items.sales_prod_grp = SPRODGRP.sales_prod_grp WHERE TRAN_ID = AS_TRAN_ID AND BRIEFED_DESCR = AS_PROD_TYPE; RETURN AS_PROD_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LAST_ISS_DATE ( as_item_cd in char , as_site_cd in char , as_lot_no in char , as_type char , as_lot_itm char ) return date is ldt_last_date date ; begin declare ls_ref_ser char(6); ldt_last_date1 date ; begin select to_date('01/01/1900','dd/mm/yyyy') into ldt_last_date from dual; if length(rtrim(as_site_cd)) > 0 and length(rtrim(as_item_cd)) > 0 then begin if rtrim(as_lot_itm) = 'L' then begin if rtrim(as_type) = 'I' then begin select max(tran_date) into ldt_last_date from invtrace where site_code = as_site_cd and item_code = as_item_cd and lot_no = as_lot_no and ref_ser in ('W-ISS','C-ISS','D-ISS','S-DSP') ; exception when no_data_found then select to_date('01/01/1900','dd/mm/yyyy') into ldt_last_date from dual; end; end if; if rtrim(as_type) = 'R' then begin select max(tran_date) into ldt_last_date from invtrace where site_code = as_site_cd and item_code = as_item_cd and lot_no = as_lot_no and ref_ser in ('ADJRCP','W-RCP','P-RCP','D-RCP','C-IRTN','W-IRTN') ; if length(ltrim(rtrim(ldt_last_date))) = 0 or ldt_last_date is null then select min(tran_date),min(ref_ser) into ldt_last_date1,ls_ref_ser from invtrace where site_code = as_site_cd and item_code = as_item_cd and lot_no = as_lot_no group by site_code,item_code,lot_no; if ltrim(rtrim(ls_ref_ser)) = 'QC-ORD' then ldt_last_date := ldt_last_date1; end if; end if; exception when no_data_found then select to_date('01/01/1900','dd/mm/yyyy') into ldt_last_date from dual; end; end if; end; end if; if rtrim(as_lot_itm) = 'I' then begin if rtrim(as_type) = 'I' then begin select max(tran_date) into ldt_last_date from invtrace where site_code = as_site_cd and item_code = as_item_cd and ref_ser in ('W-ISS','C-ISS','D-ISS','S-DSP') ; exception when no_data_found then select to_date('01/01/1900','dd/mm/yyyy') into ldt_last_date from dual; end; end if; if rtrim(as_type) = 'R' then begin select max(tran_date) into ldt_last_date from invtrace where site_code = as_site_cd and item_code = as_item_cd and ref_ser in ('ADJRCP','W-RCP','P-RCP','D-RCP','C-IRTN','W-IRTN') ; if length(ltrim(rtrim(ldt_last_date))) = 0 or ldt_last_date is null then select min(tran_date),min(ref_ser) into ldt_last_date1,ls_ref_ser from invtrace where site_code = as_site_cd and item_code = as_item_cd and lot_no = as_lot_no group by site_code,item_code,lot_no; if ltrim(rtrim(ls_ref_ser)) = 'QC-ORD' then ldt_last_date := ldt_last_date1; end if; end if; exception when no_data_found then select to_date('01/01/1900','dd/mm/yyyy') into ldt_last_date from dual; end; end if; end; end if; end; end if; return ldt_last_date; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HIER_IND_KEY (as_level_code in char) return char is ls_key char(40); ls_sel char(40); ls_sel1 char(40); li_cnt number(14,3); --declare begin ls_key := ' '; select level_code__parent into ls_sel from hierarchy where level_code = as_level_code and rownum = 1; if (ls_sel is null) then return ' '; else dbms_output.put_line(ls_key); ls_key := ls_sel || rtrim(ls_key); select count(*), ddf_hier_ind_key(ls_sel) into li_cnt, ls_sel1 from dual; if (ls_sel1 is null) or (ls_sel1 = ' ') then return ls_key; else ls_key := rtrim(ls_sel1) || rtrim(ls_key); end if; end if; return ls_key; -- exception -- when too_many_rows then -- dbms_output.put_line(sqlcode); -- dbms_output.put_line(sqlerrm); -- dbms_output.put_line(ls_key); -- return ls_key; -- when others then -- dbms_output.put_line(ls_key); -- return ls_key; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISC_PAYMENT_CANC_CHK BEFORE INSERT OR UPDATE OF confirmed ON misc_payment_canc referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_acctcount from misc_payment_cancdet where tran_id = :new.tran_id; exception when others then ll_acctcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'MPCANC' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin select net_amt into lc_hdramt from misc_payment_canc where tran_id = :new.tran_id; exception when others then lc_hdramt := 0; end; if (lc_hdramt <> 0 or ll_acctcount <> 0) and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_acctcount) || '] rows in detail or header amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'MPCANC' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PAYROLL_DET ( ls_period char,ls_emp char ,ls_ad_code char) return number is lc_amt number (14,2) ; begin SELECT payrolldet.amount into lc_amt FROM payrolldet WHERE ( payrolldet.prd_code = ls_period ) AND ( payrolldet.emp_code = ls_emp ) AND ( payrolldet.ad_code = ls_ad_code ) ; return lc_amt; exception when NO_DATA_FOUND then return 0; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCISE_DUTY2 (as_tran_code taxtran.tran_code%type,as_tran_id taxtran.tran_id%type,as_tax_code taxtran.tax_code%type) return number is lc_duty number; ls_non_payable varchar(1000); ls_sql varchar(1000); ls_token varchar(1000); ls_string varchar(1000); ls_var varchar(1000); begin select case when non_payable is null then 'N' else non_payable end into ls_non_payable from tax where tax_code = as_tax_code; SELECT var_value into ls_var from disparm where var_name = 'CESS_TAX_CODE_MODVAT'; if ls_non_payable = 'Y' then lc_duty := 0; else SELECT nvl(sum(taxtran.tax_amt * ddf_get_exch_rate( as_tran_id,as_tran_code) ),0) INTO lc_duty FROM taxtran, tax WHERE ( taxtran.tax_code = tax.tax_code ) and ( ( tran_code = as_tran_code ) AND ( tran_id = as_tran_id ) AND ( taxtran.tax_perc <> 0 ) ) and ( taxtran.tax_amt <> 0 ) and ( taxtran.effect <> 'N') ; dbms_output.put_line('Amount Checking'||lc_duty); end if; return lc_duty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETBG_AVAILABLE (AS_PURC_ORDER IN CHAR) RETURN CHAR IS BG_AVAILABLE CHAR(1) := 'N'; BG_COUNT NUMBER(14):=0; BEGIN SELECT COUNT(1) INTO BG_COUNT FROM LC_VOUCHER WHERE PURC_ORDER= AS_PURC_ORDER; IF BG_COUNT > 0 THEN BG_AVAILABLE := 'Y'; ELSE BG_AVAILABLE := 'N'; END IF; RETURN BG_AVAILABLE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_QUANTITY (as_reqid in char, as_itemcode in char) return number Is lc_quantity number(14,3) := 0; begin begin select quantity into lc_quantity from ser_req_item where req_id = as_reqid and item_code = as_itemcode; exception when others then lc_quantity := 0; end; return lc_quantity; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_BANK_RECO_BOOK ( as_bankcode in char, ad_ason in date ) return number is lc_total number(14,3) ; lc_tot_p1 number(14,3) := 0; lc_tot_r1 number(14,3) := 0; lc_tot_p2 number(14,3) := 0; lc_tot_r2 number(14,3) := 0; begin select NVL(sum( nvl(banktran_log.amount,0)),0) into lc_tot_p1 FROM banktran_log, bank, bankreco_trace, bank_statement WHERE ( banktran_log.tran_id = bankreco_trace.tran_id__log (+)) and ( bankreco_trace.tran_id__stat = bank_statement.tran_id (+)) and ( banktran_log.bank_code = bank.bank_code ) and ( banktran_log.amount <> banktran_log.amt_adj ) and (banktran_log.bank_code = as_bankcode ) AND (banktran_log.tran_date <= ad_ason ) AND (banktran_log.tran_type = 'P' ) AND (banktran_log.status <> 'R' OR (bank_statement.status = 'R' AND bank_statement.eff_date > ad_ason ) AND banktran_log.tran_date < bank_statement.stat_date) ORDER BY banktran_log.tran_type ASC ; select NVL(sum( nvl(banktran_log.amount,0)),0) into lc_tot_r1 FROM banktran_log, bank, bankreco_trace, bank_statement WHERE ( banktran_log.tran_id = bankreco_trace.tran_id__log (+)) and ( bankreco_trace.tran_id__stat = bank_statement.tran_id (+)) and ( banktran_log.bank_code = bank.bank_code ) and ( banktran_log.amount <> banktran_log.amt_adj ) and (banktran_log.bank_code = as_bankcode ) AND (banktran_log.tran_date <= ad_ason ) AND (banktran_log.tran_type = 'R' ) AND (banktran_log.status <> 'R' OR (bank_statement.status = 'R' AND bank_statement.eff_date > ad_ason ) AND banktran_log.tran_date < bank_statement.stat_date) ORDER BY banktran_log.tran_type ASC ; select NVL(sum( nvl(bank_statement.amount,0) ),0) into lc_tot_p2 from bank_statement, bank, bankreco_trace, banktran_log where ( bank_statement.tran_id = bankreco_trace.tran_id__stat (+)) and ( bankreco_trace.tran_id__log = banktran_log.tran_id (+)) and ( bank_statement.bank_code = bank.bank_code ) and ( ( bank_statement.bank_code = as_bankcode ) and ( bank_statement.eff_date <= ad_ason ) and ( bank_statement.tran_type in ('P') ) and ( bank_statement.amount <> 0 ) ) and (bank_statement.status not in ('R','P') or (bank_statement.status = 'R' and bank_statement.eff_date > ad_ason) and bank_statement.stat_date < banktran_log.tran_date) order by bank_statement.tran_type asc ; select NVL(sum( nvl(bank_statement.amount,0) ),0) into lc_tot_r2 from bank_statement, bank, bankreco_trace, banktran_log where ( bank_statement.tran_id = bankreco_trace.tran_id__stat (+)) and ( bankreco_trace.tran_id__log = banktran_log.tran_id (+)) and ( bank_statement.bank_code = bank.bank_code ) and ( ( bank_statement.bank_code = as_bankcode ) and ( bank_statement.eff_date <= ad_ason ) and ( bank_statement.tran_type in ('R') ) and ( bank_statement.amount <> 0 ) ) and (bank_statement.status not in ('R','P') or (bank_statement.status = 'R' and bank_statement.eff_date > ad_ason) and bank_statement.stat_date < banktran_log.tran_date) order by bank_statement.tran_type asc ; lc_total := (lc_tot_p1 - lc_tot_r1 - lc_tot_p2 + lc_tot_r2) ; return lc_total ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FUNDTRANSFER_CTRL_X ON FUNDTRANSFER_CTRL (FIN_ENTITY__FROM, FIN_ENTITY__TO, SITE_CODE__FROM, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PO_SO ( AS_TRAN_ID VARCHAR, AS_TRAN_SER VARCHAR, AS_TYPE VARCHAR ) RETURN VARCHAR IS ls_po VARCHAR(100); BEGIN ls_po := ' '; IF AS_TRAN_SER = 'S-INV' THEN BEGIN IF AS_TYPE = 'A' THEN SELECT sale_order INTO ls_po FROM INVOICE WHERE INVOICE_ID = AS_TRAN_ID; ELSIF AS_TYPE = 'B' THEN SELECT cust_pord INTO ls_po FROM sorder WHERE sale_order = ls_po; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN ls_po := ' '; END; END IF; RETURN ls_po; END FN_GET_PO_SO; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_DISS AFTER UPDATE OF CONFIRMED ON DISTORD_ISS REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN --IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN IF ((:old.confirmed = 'N' and :new.confirmed = 'Y') or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y') ) THEN begin delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser = 'D-ISS' and ref_id = :new.tran_id); delete from e_invoice where ref_ser = 'D-ISS' and ref_id = :new.tran_id; select count(1) into ll_count from e_invoice where ref_ser in( 'D-ISS') and ref_id = :new.tran_id; exception when others then ll_count := 0; end; --if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, Tran_gstn, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, TRAN_NAME ) SELECT ls_seq as tran_id, :new.TRAN_DATE as TRAN_DATE, :new.tran_type as tran_type, (select einv_reqd from item_acct_detr_dist where SITE_CODE__FROM = seller.site_code and SITE_CODE__TO = buyer.site_code and rownum = 1) as einv_opt, 'D-ISS' as REF_SER, :new.tran_id as REF_ID, :new.tran_date as REF_DATE, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, :new.site_code SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_ship, seller.descr trade_name_ship, seller.descr legal_name_ship, seller.ADD1 add1_ship, seller.ADD2 add2_ship, seller.CITY city_ship, seller.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_ship, seller.TELE1 tele_ship, seller.EMAIL_ADDR email_id_ship, :new.SITE_CODE__DLV CUST_CODE, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= buyer.site_code AND ref_code='GSTIN_NO' ) gstn_buy, buyer.descr trade_name_buy, buyer.descr legal_name_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) pos_buy, buyer.ADD1 add1_buy, buyer.ADD2 add2_buy, buyer.city city_buy, buyer.state_code state_code__buy, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= buyer.site_code AND ref_code='DL/001' ) drug_lic_no_buy, buyer.pin pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.tele1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.site_code__dlv CUST_CODE__BIL, :new.site_code__dlv CUST_CODE__DLV, buyer.descr name_dlv, buyer.ADD1 add1_dlv, buyer.ADD2 add2_dlv, buyer.pin pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_dlv, buyer.state_code state_code__dlv, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= buyer.site_code AND ref_code='DL/001' ) drug_lic_no_dlv, round((select sum(d.quantity * d.rate) from distord_issdet d where d.tran_id = :new.tran_id ),2) INV_AMT, round((select sum(d.quantity * d.rate) from distord_issdet d where d.tran_id = :new.tran_id ) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C')) and tax_perc <> 0 and tax_amt <> 0),0),2) as NET_AMT, --round(:new.NET_AMT - :new.TAX_AMT,2) AS ASSESABLE_VALUE, round((select (sum(d.quantity * d.rate) - sum(d.quantity * d.rate * discount / 100) ) from distord_issdet d where d.tran_id = :new.tran_id) - (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('D')) and tax_perc <> 0 and tax_amt <> 0),0)),2) AS ASSESABLE_VALUE, --round( nvl((select sum(d.quantity * d.rate * discount / 100) from distord_issdet d where d.tran_id = :new.tran_id ),0),2) DISC_AMT, 0 DISC_AMT, :new.dist_order as ORDER_NO, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'D-ISS' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='I') AND tax_perc <> 0 AND tax_amt <> 0),0),2) AS IGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'D-ISS' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='H') AND tax_perc <> 0 AND tax_amt <> 0),0),2) AS CGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'D-ISS' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='G') AND tax_perc <> 0 AND tax_amt <> 0),0),2) AS SGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'D-ISS' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='J')AND tax_perc <> 0 AND tax_amt <> 0),0),2) AS CESS_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = 'D-ISS' and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE in ('K','C') ) AND tax_perc <> 0 AND tax_amt <> 0),0),2) AS OTHER_AMT, 'N' proc_stat, sysdate proc_date, 'P' resp_stat, 0 distance, null Trans_Mode, (select case when t.tax_reg_2 = 'UNREGISTER' then ' ' else t.tax_reg_2 end from transporter t where t.tran_code = :new.tran_code) Tran_gstn, :new.lr_date lr_date, :new.lr_no lr_no, :new.lorry_no lorry_no, '' Vehicle_Type, :new.GP_NO DOC_NO, :new.GP_Date DOC_DATE, (select t.tran_name from transporter t where t.tran_code = :new.tran_code) Tran_name FROM --DISTORD_ISS INV, site buyer, site seller WHERE seller.site_code = :new.site_code and buyer.site_code = :new.SITE_CODE__DLV; -- and INV.tran_ID= :new.tran_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.ITEM_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, '' AS LINE_TYPE, round((it.quantity * it.RATE),2) as INV_AMT, round(case when it.DISCOUNT > 0 then round((it.quantity * it.RATE) -((it.quantity * it.RATE)/100 * it.DISCOUNT),3) else round((it.quantity * it.RATE),3) END,2) as ASS_AMT, round(((it.quantity * it.RATE)/100 * it.DISCOUNT) + (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) AS DISCOUNT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0),2) as IGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0),2) as CGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0),2) as SGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0),2) as CESS_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in ('K','C')) and tax_perc <> 0 and tax_amt <> 0),0),2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=it.unit ) AS UNIT, it.quantity AS QUANTITY, it.RATE AS RATE, item.hsn_no AS HSN_CODE, it.LOT_NO as LOT_NO, it.EXP_DATE as EXP_DATE, it.MFG_DATE as MFG_DATE, round((it.quantity * it.RATE) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'D-ISS' and taxtran.tran_id=:new.tran_id and taxtran.line_no = lpad(to_char(it.line_no),3,' ') and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C','D')) and tax_perc <> 0 and tax_amt <> 0),0),2) as TOT_ITEM_VAL, --it.NET_AMT as TOT_ITEM_VAL, fn_gst_rate_amt('D-ISS',it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt('D-ISS',it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt('D-ISS',it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt('D-ISS',it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate('D-ISS',it.tran_id, it.line_no) as GST_RATE, --(select case when item.stk_opt = '0' then 'Y' else 'N' end from item where item.item_code = it.item_code) (select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code and item.item_ser = itemser.item_ser and rownum = 1) FROM distord_issdet it, item WHERE item.item_code= it.item_code AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; --end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFFORTLEVTABLE AS TABLE OF EffortLevDmMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_PORCP_SUPP (as_sitecode in char, as_suppcode in char,as_itemcode in char,as_suppcodemnfr in char) return varchar2 is ls_retval number := 0; ls_appr_supp char(1); ll_count number(3) := 0; begin ls_appr_supp :='N'; begin select count(1) into ll_count from siteitem where item_code = as_itemcode and site_code = as_sitecode; exception when others then ll_count := 0; end; if ll_count > 0 then begin select (case when APPR_SUPP is null then ' ' else APPR_SUPP end) into ls_APPR_SUPP from siteitem where item_code = as_itemcode and site_code = as_sitecode; exception when others then ls_appr_supp := ' '; end; end if; if ls_appr_supp is null then ls_appr_supp := ' '; end if; if length(trim(ls_appr_supp)) = 0 then begin select (case when APPR_SUPP is null then 'N' else APPR_SUPP end) into ls_APPR_SUPP from item where item_code = as_itemcode; exception when others then ls_appr_supp := 'N'; end; end if; if ls_appr_supp is null or length(trim(ls_appr_supp)) = 0 then ls_appr_supp :='N'; end if; if ls_appr_supp = 'N' then ls_retval := 1; end if; if (as_suppcodemnfr is not null and length(trim(as_suppcodemnfr)) > 0) and ls_appr_supp = 'Y' then ls_retval := 1; /* if len(trim(ls_errcode)) = 0 then select status into :ls_supp from itemmnfr where item_code = :as_itemcode and supp_code__mnfr = :as_suppcodemnfr; end if if get_sqlcode() < 0 then ls_errcode = 'DS000' + trim(string(sqlca.sqldbcode)) + ~t + sqlca.sqlerrtext elseif get_sqlcode() = 100 then ls_errcode = VTINVMNFR elseif ls_supp = 'U' or len(trim(ls_supp)) = 0 AND LEN(TRIM(ls_errcode)) = 0 then if len(trim(ls_errcode)) = 0 then select no_cons_unaprv into :li_count from siteitem where site_code = :as_sitecode and item_code = :as_itemcode; if get_sqlcode() < 0 then ls_errcode = 'DS000' + trim(string(sqlca.sqldbcode)) + ~t + sqlca.sqlerrtext elseif get_sqlcode() = 100 then select no_cons_unaprv into :li_count from item where item_code = :as_itemcode; if get_sqlcode() < 0 then ls_errcode = 'DS000' + trim(string(sqlca.sqldbcode)) + ~t + sqlca.sqlerrtext end if end if if isnull(ls_errcode) or len(trim(ls_errcode)) = 0 then select count(distinct tran_id) into :cnt from porcpdet where item_code = :as_itemcode and supp_code__mnfr = :as_suppcodemnfr; if get_sqlcode() < 0 then ls_errcode = 'DS000' + trim(string(sqlca.sqldbcode)) + ~t + sqlca.sqlerrtext elseif get_sqlcode() = 0 then if cnt >= li_count then ls_errcode = EGRACCONS end if end if end if end if end if */ elsif ls_appr_supp = 'N' then ls_retval := 1; elsif ( as_suppcodemnfr is null or length(trim(as_suppcodemnfr)) = 0) and ls_appr_supp = 'Y' then ls_retval := 0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_SALTFORM (Label_claim IN number,actual_assay IN number, m_wt_slt IN number, moisture IN number, m_wt_base IN number) return number is potency number(14,6); begin potency := ((Label_claim*m_wt_slt*10000)/(actual_assay*(100-moisture)*m_wt_base)); return( potency); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_SERIES_SPRS_ITEM ON STRG_SERIES (SALES_PERS, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_QCTRANS (as_itemcode in char, as_lotno in char,as_loccode in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ls_retval number := 0; begin select count(qorder_no) into ll_qccount from qc_order where item_code=as_itemcode and lot_no=as_lotno and status='U'; if ll_qccount > 0 then select count(*) into ll_qtcount from qc_transfer where item_code=as_itemcode and lot_no=as_lotno and loc_code__trf=as_loccode and confirmed='Y'; Dbms_output.put_line(ll_qtcount); Dbms_output.put_line(ll_qccount); if ll_qtcount = 0 then ls_retval:= 1; end if; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_USERTYPE_LIC_COUNT (as_user_type IN CHAR ) return char is cnt number(5); begin SELECT COUNT(*) INTO cnt from users where USER_LIC_TYPE = as_user_type; return cnt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_TASK_DEPENDENT_ON (VI_REF_SER IN CHAR ,VI_REF_Id IN VARCHAR) RETURN VARCHAR2 IS TASK_DEPENDENT_ON VARCHAR2(1500); taskDependentOn varchar2(1500); flag BOOLEAN := false; cursor C1 is SELECT distinct(nvl(pick_ord_det.repl_order,' ')) as TASK_DEPENDENT_NO1 from pick_ord_det where pick_ord_det.pick_order = VI_REF_Id; cursor C2 is SELECT distinct(nvl(repl_ord_det.pick_order,' ')) as TASK_DEPENDENT_NO1 from repl_ord_det where repl_ord_det.repl_order = VI_REF_Id; BEGIN IF(VI_REF_SER = 'P-PICK' OR VI_REF_SER = 'C-PICK' OR VI_REF_SER = 'A-PICK' OR VI_REF_SER = 'M-PICK') THEN FOR taskDepOn in C1 LOOP IF(flag) Then taskDependentOn :=taskDependentOn || ',' || taskDepOn.TASK_DEPENDENT_NO1; ELSE taskDependentOn := taskDepOn.TASK_DEPENDENT_NO1; flag:=true; End IF; END LOOP; TASK_DEPENDENT_ON :=taskDependentOn; RETURN TASK_DEPENDENT_ON; ELSIF(VI_REF_SER = 'R-TASK' OR VI_REF_SER = 'RP-PND' OR VI_REF_SER = 'R-CPA' OR VI_REF_SER = 'R-PND' OR VI_REF_SER = 'S-DOC' OR VI_REF_SER = 'RP-ACT' OR VI_REF_SER = 'RR-DSA' OR VI_REF_SER = 'RD-DSA' OR VI_REF_SER = 'R-DSO' OR VI_REF_SER = 'RS-DSO' OR VI_REF_SER = 'RN-DSA') THEN FOR taskDepOn in C2 LOOP IF(flag) Then taskDependentOn :=taskDependentOn || ',' || taskDepOn.TASK_DEPENDENT_NO1; ELSE taskDependentOn := taskDepOn.TASK_DEPENDENT_NO1; flag:=true; End IF; END LOOP; TASK_DEPENDENT_ON :=taskDependentOn; RETURN TASK_DEPENDENT_ON; ELSE TASK_DEPENDENT_ON :=' '; RETURN TASK_DEPENDENT_ON; End IF; EXCEPTION WHEN NO_DATA_FOUND THEN TASK_DEPENDENT_ON :=' '; RETURN TASK_DEPENDENT_ON; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SALES_NAME (as_emp_code char) return varchar2 is ls_spname varchar2(50); begin begin select sp_name into ls_spname from sales_pers where sales_pers = as_emp_code; exception when no_data_found then ls_spname := null; end; --ls_name := ls_fname||' '||ls_mname||' '||ls_lname; return ls_spname; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_OPER_BTCHSIZE (as_work_order in workorder.work_order%type, an_operation in workorder_iss.operation%type) return number is ln_batch_size number(14,3); begin select nvl(sum(nvl(workorder_enhanc.batch_size_add,0)),0) into ln_batch_size from workorder_enhanc where workorder_enhanc.work_order = as_work_order and workorder_enhanc.operation = an_operation and workorder_enhanc.enhanc_type = 'A' and workorder_enhanc.confirmed = 'Y' ; return ln_batch_size; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CANDIDATE_STATUS_DESCR (LS_STATUS CANDIDATE.STATUS%TYPE) RETURN VARCHAR2 IS LS_RETURN VARCHAR2(4000); BEGIN IF LS_STATUS = 'X' THEN LS_RETURN := 'TRANSACTION IS CLOSED'; ELSIF LS_STATUS = 'I' THEN LS_RETURN := 'PENDING FOR INITIATION'; ELSIF LS_STATUS = 'O' THEN LS_RETURN := 'PENDING FROM EMPLOYEE'; ELSIF LS_STATUS = 'S' THEN LS_RETURN := 'PENDING FROM AUTHORITY'; ELSIF LS_STATUS = 'A' THEN LS_RETURN := 'PENDING FROM APPROVER'; ELSIF LS_STATUS = 'Y' THEN LS_RETURN := 'APPROVED'; ELSIF LS_STATUS = 'C' THEN LS_RETURN := 'CLOSED'; END IF; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TOT_AMT (as_tran_id char,as_tran_ser char) return number is ls_tot_amt number(14,3); begin SELECT TOT_AMT into ls_tot_amt FROM MISC_PAYABLES WHERE TRAN_SER= as_tran_ser AND REF_NO= as_tran_id; return ls_tot_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_DETAILS_DUTY_FREE (ls_tran_code in char,ls_tran_id in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; lc_exch_rate number(17,6); begin select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = 'DUTYFREE_BONDTAX_RG1'; select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; lc_exch_rate := ddf_get_exch_rate(ls_tran_id,ls_tran_code); if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DOC_TRAN BEFORE INSERT ON doc_transaction_link referencing old as old new as new FOR EACH ROW DECLARE BEGIN if trim(:new.ref_ser) = 'S-BILL' and :new.DOC_TYPE_ATTACH is null then :new.DOC_TYPE_ATTACH := 'Invoice'; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_PICKRATE (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, as_quantity in number, as_site_code in char, as_loc_code in char, as_lot_sl in char) IS mrate number(14,3); ls_type char(1); ls_price_list__parent char(5); ls_plist char(5); v_code NUMBER; v_errm VARCHAR2(64); BEGIN begin select list_type into ls_type from pricelist_mst where price_list = as_price_list and rownum = 1; exception when others then ls_type := 'L'; end; dbms_output.put_line('list_type is [' || ls_type ||']'); if ls_type = 'L' then begin select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; dbms_output.put_line('mrate is [' || to_char(mrate) ||']'); exception when no_data_found then v_code := SQLCODE; v_errm := SUBSTR(SQLERRM, 1, 64); DBMS_OUTPUT.PUT_LINE ('Exception is [' ||v_code || '][' || v_errm||']'); ls_plist := as_price_list; mrate := 0 ; while true loop select (case when price_list__parent is null then ' ' else price_list__parent end ) into ls_price_list__parent from pricelist_mst where price_list = ls_plist and list_type = 'L'; IF ls_price_list__parent IS NULL THEN ls_price_list__parent := ' '; END IF; if trim(ls_price_list__parent) is null or length(trim(ls_price_list__parent)) = 0 then exit; end if; dbms_output.put_line('ls_price_list__parent is [' || ls_price_list__parent ||']'); mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then select rate into mrate from pricelist where price_list = ls_price_list__parent and item_code = as_item_code AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; dbms_output.put_line('mrate from ls_price_list__parent is [' || to_char(mrate) ||']'); if mrate > 0 then exit; end if; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'B' then begin select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop select (case when price_list__parent is null then '' else price_list__parent end ) into ls_price_list__parent from pricelist_mst where price_list = ls_plist and list_type = 'B'; /*if length(trim(ls_price_list__parent)) = 0 then exit; end if;*/ IF TRIM(ls_price_list__parent) IS NULL THEN exit; END IF; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then select nvl(rate,0) into mrate from pricelist where price_list = ls_price_list__parent and item_code = as_item_code and list_type = 'B' AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; if mrate > 0 then exit; end if ; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'M' or ls_type = 'N' then begin SELECT RATE into mrate FROM PRICELIST WHERE PRICE_LIST = as_price_list AND ITEM_CODE = as_item_code AND LIST_TYPE = ls_type AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity AND EFF_FROM <= ad_tran_date AND VALID_UPTO >= ad_tran_date; exception when no_data_found then ls_plist := as_price_list; mrate := 0 ; while true loop SELECT (CASE WHEN PRICE_LIST__PARENT IS NULL THEN '' ELSE PRICE_LIST__PARENT END) into ls_price_list__parent FROM pricelist_mst WHERE PRICE_LIST = ls_plist and list_type = ls_type; /*if length(trim(ls_price_list__parent)) = 0 then exit; end if;*/ IF TRIM(ls_price_list__parent) IS NULL THEN exit; END IF; mrate := 0 ; begin if length(trim(ls_price_list__parent)) > 0 then SELECT RATE into mrate FROM PRICELIST WHERE PRICE_LIST = ls_price_list__parent AND ITEM_CODE = as_item_code AND LIST_TYPE = ls_type AND MIN_QTY <= as_quantity AND MAX_QTY >= as_quantity AND EFF_FROM <= ad_tran_date AND VALID_UPTO >= ad_tran_date; end if; if mrate > 0 then exit; end if; exception when no_data_found then ls_plist := ls_price_list__parent; end; end loop; end; elsif ls_type = 'I' then begin mrate := 0 ; if as_lot_sl = null or length(trim(as_lot_sl)) = 0 then SELECT RATE into mrate FROM STOCK WHERE ITEM_CODE = as_item_code AND SITE_CODE = as_site_code AND LOC_CODE = as_loc_code AND LOT_NO = as_lot_no; else SELECT RATE into mrate FROM STOCK WHERE ITEM_CODE = as_item_code AND SITE_CODE = as_site_code AND LOC_CODE = as_loc_code AND LOT_NO = as_lot_no AND LOT_SL = as_lot_sl; end if; exception when no_data_found then mrate := 0 ; end; end if; --return mrate; END DP_PICKRATE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_STATUS (SI_WAVE_ID IN CHAR) return CHAR IS STATUS CHAR; CNT NUMBER; CNT1 NUMBER; CNT2 NUMBER; BEGIN BEGIN SELECT count(*) INTO CNT FROM WAVE_TASK_DET WHERE WAVE_ID = SI_WAVE_ID; SELECT count(*) INTO CNT1 FROM WAVE_TASK_DET WHERE WAVE_ID = SI_WAVE_ID AND STATUS = 'Y'; SELECT COUNT(*) INTO CNT2 FROM WAVE_TASK_DET WHERE WAVE_ID = SI_WAVE_ID AND REF_SER <> 'S-DSP' AND WAVE_STATUS IN ('C','W','V') ; IF (CNT = cnt1 ) THEN STATUS := 'Y'; ELSE STATUS := 'N'; IF (CNT2 = '0' ) THEN STATUS := 'Y'; ELSE STATUS := 'N'; END IF; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN STATUS :='N'; END; RETURN STATUS; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_MM_IN_TIME (AS_MIN number) return varchar2 is a_time varchar2(6); begin if (AS_MIN <= 0) then return a_time; end if; if (length(trunc(AS_MIN/60)) >= 3) then a_time := trunc(AS_MIN/60) || ':' || lpad(to_char(AS_MIN-(trunc(AS_MIN/60) * 60)),2,'0'); else a_time := lpad(trunc(AS_MIN/60),2,'0') || ':' || lpad(to_char(AS_MIN-(trunc(AS_MIN/60) * 60)),2,'0'); end if; return a_time; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION VALIDATEPAN (pan in varchar2) return varchar2 is retVal varchar2(30) ; inputed varchar2(30) ; output boolean; begin output := false; retVal:='false'; if pan IS NULL OR pan='' then retVal:='true'; return retVal; end if; if length(pan) != 30 then output := false; end if; if(pan = 'PANNOTAVBL') then retVal:='true'; return retVal; end if; inputed := upper(pan); output := REGEXP_LIKE(inputed , '[A-Z]{3}[C|P|H|F|A|T|B|L|J|G]{1}[A-Z]{1}[0-9]{4}[A-Z]{1}') ; --return output ; if(output) then retVal:='true'; else retVal:='false'; end if ; return retVal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RTN_ACC_DET (as_tran_id porcp.tran_id%type , as_type number ) return string is ls_acct_det varchar2(200); begin if as_type = 1 then select acct_code__dr into ls_acct_det from porcpdet where tran_id = as_tran_id; end if; if as_type = 2 then select cctr_code__dr into ls_acct_det from porcpdet where tran_id = as_tran_id; end if; if as_type = 3 then select acct_code__cr into ls_acct_det from porcpdet where tran_id = as_tran_id; end if; if as_type = 4 then select cctr_code__cr into ls_acct_det from porcpdet where tran_id = as_tran_id; end if; if as_type = 5 then select to_char(nvl(net_amt,0)) into ls_acct_det from porcpdet where tran_id = as_tran_id; end if; return ls_acct_det ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_QUANTITY ( p_quantity IN NUMBER, -- (2.QUANTITY) p_denomination IN NUMBER -- (2.DENOMINATION) ) RETURN NUMBER IS v_result NUMBER := 0; -- Default to invalid BEGIN -- Initialize validation result v_result := 0; -- Check if denomination is entered IF p_denomination IS NULL THEN RETURN v_result; -- Return 0 if denomination is not entered END IF; -- Check if quantity is valid (>= 0) IF p_quantity >= 0 THEN v_result := 1; -- Set to valid if all conditions are met END IF; RETURN v_result; EXCEPTION WHEN OTHERS THEN -- Log error if needed -- Return 0 to indicate validation failure RETURN 0; END FN_CHECK_QUANTITY; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_DRCR AFTER UPDATE OF CONFIRMED ON DRCR_RCP REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ll_reasoncnt number := 0; ls_reasoncode char(1); ll_sreturncnt number := 0; ls_einv_gen_flag char(1); ls_var_value varchar2(30); ------PRAGMA AUTONOMOUS_TRANSACTION; BEGIN -- begin -- SELECT COUNT(SR.STATUS) into ll_reasoncnt FROM SRETURN_REASON SR, SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE; -- if(ll_reasoncnt > 0) -- then -- SELECT SR.STATUS into ls_reasoncode FROM SRETURN_REASON SR,SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE AND ROWNUM = 1; -- else -- ls_reasoncode := 'X'; -- end if; -- end; begin SELECT COUNT(RET.TRAN_TYPE) into ll_sreturncnt FROM SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no; SELECT count(*) into ls_var_value FROM disparm where var_name = 'EXCLUDE_EINV_SR_TRAN_TYPE' and length(trim(var_value)) > 0; if(ll_sreturncnt > 0 and ls_var_value > 0 ) then select case when ( select count(*) from sreturn where tran_id = :new.sreturn_no and tran_type in ( WITH input_data AS (SELECT var_value FROM disparm where var_name = 'EXCLUDE_EINV_SR_TRAN_TYPE') SELECT REGEXP_SUBSTR(var_value, '[^,]+', 1, level) AS value FROM input_data CONNECT BY REGEXP_SUBSTR(var_value, '[^,]+', 1, level) IS NOT NULL AND PRIOR var_value = var_value AND PRIOR SYS_GUID() IS NOT NULL)) > 0 then 'N' else 'Y' end into ls_einv_gen_flag from dual; else -- ls_einv_gen_flag := 'Y'; begin SELECT COUNT(SR.STATUS) into ll_reasoncnt FROM SRETURN_REASON SR, SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE; if(ll_reasoncnt > 0) then SELECT (case when SR.STATUS not in ('D','E') then 'Y' else 'N' end) into ls_einv_gen_flag FROM SRETURN_REASON SR,SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE AND ROWNUM = 1; else ls_einv_gen_flag := 'Y'; end if; end; end if; end; --IF :old.confirmed = 'N' and :new.confirmed = 'Y' and :new.drcr_flag in ('D', 'C') THEN -- IF ls_reasoncode <> 'D' and ls_reasoncode <> 'E' and((:old.confirmed = 'N' and :new.confirmed = 'Y' and :new.drcr_flag in ('D', 'C')) or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y' and :new.drcr_flag in ('D', 'C')) ) IF ls_einv_gen_flag <> 'N' and((:old.confirmed = 'N' and :new.confirmed = 'Y' and :new.drcr_flag in ('D', 'C')) or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y' and :new.drcr_flag in ('D', 'C')) ) THEN begin delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser in ('DRNRCP','CRNRCP') and ref_id = :new.tran_id); delete from e_invoice where ref_ser in ('DRNRCP','CRNRCP') and ref_id = :new.tran_id; select count(1) into ll_count from e_invoice where ref_ser in ('DRNRCP','CRNRCP') and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, Tran_code, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, round_adj, site_code ) SELECT ls_seq as tran_id, :new.tran_date TRAN_DATE, :new.tran_type as tran_type, buyer.einv_reqd as einv_opt, :new.TRAN_SER ref_ser, :new.tran_id ref_id , :new.tran_date as ref_date, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, so.SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= ship.site_code AND ref_code='GSTIN_NO' ) gstn_ship, ship.descr trade_name_ship, ship.descr legal_name_ship, ship.ADD1 add1_ship, ship.ADD2 add2_ship, ship.CITY city_ship, ship.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = ship.STATE_CODE) state_ship, ship.TELE1 tele_ship, ship.EMAIL_ADDR email_id_ship, :new.cust_code cust_code, --buyer.TAX_REG_2 gstn_buy, case when buyer.TAX_REG_2='UNREGISTER' then 'URP' else buyer.TAX_REG_2 end gstn_buy, buyer.CUST_NAME trade_name_buy, buyer.CUST_NAME legal_name_buy, -- (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) pos_buy, case when fn_supplytype(:new.TRAN_SER, trim(:new.tran_id), trim(buyer_state.count_code), trim(seller_state.count_code),:new.site_code) = 'B2B' then (SELECT GST_CODE FROM STATE WHERE STATE_CODE = ship.STATE_CODE) else '96' end as pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.CITY city_buy, buyer.state_code state_code__buy, buyer.drug_lic_no drug_lic_no_buy, buyer.PIN pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.TELE1 tele_buy, buyer.EMAIL_ADDR email_id_buy, i.CUST_CODE__BIL CUST_CODE__BIL, so.CUST_CODE__DLV CUST_CODE__DLV, dlv.CUST_NAME name_dlv, dlv.ADDR1 add1_dlv, dlv.ADDR2 add2_dlv, dlv.PIN pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = dlv.STATE_CODE) state_dlv, dlv.state_code state_code__dlv, dlv.drug_lic_no drug_lic_no_dlv, round( ((SELECT SUM(DRCR_RDET.DRCR_AMT) FROM DRCR_RDET WHERE DRCR_RDET.TRAN_ID=:new.TRAN_ID ) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') ),0)) * :new.exch_rate,2) AS INV_AMT , round( ((SELECT SUM(DRCR_RDET.NET_AMT) FROM DRCR_RDET WHERE DRCR_RDET.TRAN_ID=:new.TRAN_ID ) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') ),0)) * :new.exch_rate,2) AS NET_AMT , round(((SELECT SUM(DRCR_RDET.NET_AMT - DRCR_RDET.TAX_AMT) FROM DRCR_RDET WHERE DRCR_RDET.TRAN_ID=:new.TRAN_ID )+((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)))+ nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') ),0) ) * :new.exch_rate,2) AS ASSESABLE_VALUE, 0 DISC_AMT, i.SALE_ORDER ORDER_NO, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, Round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='K') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, ---0 as OTHER_AMT, 'N' proc_stat, sysdate proc_date, 'P' resp_stat, --0 distance, (select nvl(distance,0) from site_customer where site_code = :new.site_code and cust_code = :new.cust_code) as distance, null Trans_Mode, null Tran_code, i.lr_date, i.lr_no, i.lorry_no, null Vehicle_Type, null DOC_NO, null DOC_DATE, round(:new.round_adj,2) round_adj, :new.site_code site_code FROM INVOICE I, --DRCR_RCP INV, SORDER SO, CUSTOMER BUYER, CUSTOMER DLV, site seller, site ship, state seller_state, state buyer_state WHERE i.invoice_id = :new.invoice_id and SO.sale_order = i.sale_order and buyer.cust_code = :new.CUST_CODE and DLV.cust_code = so.CUST_CODE__DLV and seller.site_code = :new.site_code and ship.site_code = so.site_code__ship and seller_state.state_code = seller.state_code and buyer_state.state_code = buyer.state_code; --and INV.tran_ID= :new.tran_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.ITEM_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, '' AS LINE_TYPE, round( (((it.quantity * it.RATE) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') ),0)) ) * :new.exch_rate,2) as INV_AMT, round( ((case when it.DISCOUNT > 0 then round((it.quantity * it.RATE) -((it.quantity * it.RATE)/100 * it.DISCOUNT),2) +nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0) else round((it.quantity * it.RATE),2) +(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) end)+ nvl( (select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') ),0)) * :new.exch_rate,2) as ASS_AMT, round(((it.quantity * it.RATE)/100 * it.DISCOUNT) + (nvl((select sum(-1 * tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) AS DISCOUNT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code =:new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in ('C')) and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=t.unit ) AS UNIT, it.quantity AS QUANTITY, it.RATE AS RATE, item.hsn_no AS HSN_CODE, case when length(trim(it.LOT_NO)) = 0 or trim(it.LOT_NO) is null then 'NOT-APPLICABLE' else it.LOT_NO end as LOT_NO, t.EXP_DATE as EXP_DATE, t.MFG_DATE as MFG_DATE, --it.NET_AMT as TOT_ITEM_VAL, round(((it.DRCR_AMT - ((it.quantity * it.RATE)/100 * it.DISCOUNT) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and taxtran.line_no = lpad(to_char(it.line_no),3,' ') and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J')) and tax_perc <> 0 and tax_amt <> 0),0)+(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )+ nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') ),0)) * :new.exch_rate,2) as TOT_ITEM_VAL, fn_gst_rate_amt(:new.TRAN_SER ,it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt(:new.TRAN_SER ,it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt(:new.TRAN_SER ,it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt(:new.TRAN_SER ,it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate(:new.TRAN_SER ,it.tran_id, it.line_no) as GST_RATE, --(select case when item.stk_opt = '0' then 'Y' else 'N' end from item where item.item_code = it.item_code) (select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code and item.item_ser = itemser.item_ser and rownum = 1) as service_yn FROM drcr_rdet it, item, invoice_trace t WHERE t.invoice_id = it.invoice_id and t.line_no = it.LINE_NO__INVTRACE and item.item_code= it.item_code AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BILL_SITE_CITY (as_purcorder char) return varchar2 is ls_city varchar2(100); begin select nvl(site.city,'') into ls_city from site, porder where porder.purc_order = as_purcorder and site.site_code = porder.site_code__bill; return ls_city; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GLTRAN_MSITES (m_frst_date in date, m_date_from in date, m_acct_code in char, m_site_code in site.site_code%type,m_acct_prd in period.acct_prd%type,m_code in period.code%type) return number is ld_day_op_bal number(14,3); ls_site_code site.site_code%type; ld_cr_amt__base number(14,3); id_dr_amt__base number(14,3); CURSOR c_site is SELECT site_code FROM SITE WHERE site_code IN (SELECT COLUMN_VALUE FROM TABLE(fn_get_site_input(m_site_code))); begin ls_site_code := ''; ld_day_op_bal := 0.0; ld_cr_amt__base := 0.0; id_dr_amt__base := 0.0; OPEN c_site; LOOP FETCH c_site into ls_site_code; EXIT WHEN c_site%notfound; ld_day_op_bal := ld_day_op_bal + fn_rdayop_gltran(m_frst_date, m_date_from, m_acct_code,ls_site_code); select nvl(sum(acctbal.cr_amt__base),0) ,nvl(sum(acctbal.dr_amt__base),0) into ld_cr_amt__base,id_dr_amt__base from acctbal, site WHERE ACCTBAL.SITE_CODE = site.SITE_CODE AND acctbal.site_code = ls_site_code AND acctbal.acct_prd = m_acct_prd AND acctbal.prd_code < m_code AND acctbal.acct_code = m_acct_code ; ld_day_op_bal := ld_day_op_bal + id_dr_amt__base - ld_cr_amt__base; END LOOP; CLOSE c_site; return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MATCH_ADVTAX (as_tranid in voucher.tran_id%type) RETURN NUMBER IS ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_vouchtype voucher.vouch_type%type ; begin begin select vouch_type, tax_env into ls_vouchtype,ls_taxenv from voucher where tran_id = as_tranid; exception when others then ls_vouchtype := 'P'; ls_taxenv := null; end; if ls_vouchtype = 'A' and ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_mismatch_cnt from vouchdet where tran_id = as_tranid and case when tax_env is null then ' ' else tax_env end <> ls_taxenv ; exception when others then ll_mismatch_cnt := 0; end; else ll_mismatch_cnt := 0; end if; if ll_mismatch_cnt > 0 then ll_retval := 1; end if; RETURN ll_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RECEIPT_GPNO ( as_TranSer in char, as_TranCode in char) return char is ls_GPno Char(15); ls_InvId char(10); ls_DespId char(10); begin if as_TranSer = 'S-INV' then -- 'Invoice' Section; begin select DESP_ID into ls_DespId from invoice where INVOICE_ID = as_TranCode; begin select gp_no into ls_GPno from despatch where DESP_ID = ls_DespId; exception when others then ls_GPno := ' '; end; exception when others then ls_GPno := ' '; end; elsif as_TranSer = 'DRNRCP' then --'Debit Note' Section begin select gp_no into ls_GPno from drcr_rcp where tran_id = as_TranCode; -- begin exception when others then ls_GPno := ' '; end; else ls_GPno := ' '; end if; return ls_GPno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PO_DLV_QTY ( as_tranid in char, as_linenoord in char) return number is lc_dlvqty number(14,3); begin begin select p.dlv_qty into lc_dlvqty from porddet p, asn_hdr h, asn_det d where h.tran_id = d.tran_id and p.purc_order = h.purc_order and (d.line_no__ord) = (p.line_no) and h.tran_id = as_tranid; exception when others then lc_dlvqty := 0; end; if lc_dlvqty is null then lc_dlvqty := 0; end if; return lc_dlvqty; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ENC_LVEBAL ( ls_emp_code char, ls_lve_code char, ld_laps_on_date date, ld_ench_date date, ls_empsite char , ls_worksite char, ls_paysite char, ls_grade char, ls_cadre char, ls_lve_tblno char ) Return Number Is Lc_Bal_Days Number(14,1); Lc_Bal_Days1 Number(14,1); lc_used_days1 Number(14,1); begin lc_bal_days1 := 0.00; lc_used_days1 := 0.00; SELECT Sum(LEAVEBAL.BAL_DAYS) as bal_days into lc_bal_days1 FROM leavebal where leavebal.lve_code = ls_lve_code AND leavebal.emp_code = ls_emp_code AND Leavebal.Exp_Date >= Ld_Laps_On_Date; Select Sum(Emplve_Trace.Lves_Alloc) Into Lc_Used_Days1 From Emplve_Trace Where Emplve_Trace.Emp_Code = Ls_Emp_Code And Emplve_Trace.Lve_Code = Ls_Lve_Code and emplve_trace.lve_date_fr > ld_laps_on_date ; If Lc_Bal_Days1 Is Null Then Lc_Bal_Days1 := 0; end if; If Lc_Used_Days1 Is Null Then Lc_Used_Days1 := 0; End If; lc_bal_days := lc_bal_days1 + lc_used_days1; return lc_bal_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_UNAPPR_LEV ( ls_empcode char, ls_lvecode char, ls_tranid char) return number is ls_unappr_lev number (5,1) ; begin select sum(no_days) into ls_unappr_lev from empleave where (emp_code = ls_empcode) and (lve_code = ls_lvecode) and (status = 'R') and (tran_id <> nvl(ls_tranid, ' ')) ; return ls_unappr_lev; exception WHEN NO_DATA_FOUND THEN return 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SYSBASE_MSG_SENTMSG ON SYSBASE_MSG (SENT_MSG) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_VENDOR_EXIST ( as_supp_code__mnfr CHAR, as_site_code CHAR, as_item_code CHAR ) RETURN NUMBER IS FLAG NUMBER(1); as_no_mfg number(1); as_no_siteitem number(1); as_no_item number(1); as_vendor_qualify supplier.vendor_qualify%type; as_appr_supp siteitem.appr_supp%type; BEGIN SELECT COUNT(*) INTO as_no_siteitem FROM SITEITEM WHERE SITE_CODE = as_site_code AND ITEM_CODE = as_item_code AND APPR_SUPP = 'Y'; IF as_no_siteitem > 0 then IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 0; -- NOT ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE SELECT COUNT(SUPP_CODE) SUPP_CODE INTO as_no_mfg FROM SUPPLIER WHERE SUPP_CODE = as_supp_code__mnfr AND VENDOR_QUALIFY = 'Y'; IF as_no_mfg > 0 THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; -- NOT ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; END IF; END IF; END IF; SELECT COUNT(NVL(APPR_SUPP,'N')) INTO as_no_siteitem FROM SITEITEM WHERE SITE_CODE =as_site_code AND ITEM_CODE = as_item_code AND NVL(APPR_SUPP,'N') = 'N' ; IF as_no_siteitem > 0 then IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 1 ; RETURN FLAG; -- ALLOWED TO SAVE THE TRANSACTION. ELSE SELECT COUNT(SUPP_CODE) SUPP_CODE INTO as_no_mfg FROM SUPPLIER WHERE SUPP_CODE = as_supp_code__mnfr ; IF as_no_mfg > 0 THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; RETURN FLAG; -- NOT ALLOWED TO SAVE THE TRANSACTION. END IF; End if; ELSE SELECT COUNT(*) INTO as_no_item FROM ITEM WHERE ITEM_CODE = as_item_code AND APPR_SUPP = 'Y' ; IF as_no_item > 0 THEN IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 0; RETURN FLAG; -- NOT ALLOWED TO SAVE THE TRANSACTION. ELSE SELECT COUNT(SUPP_CODE) SUPP_CODE INTO as_no_mfg FROM SUPPLIER WHERE SUPP_CODE = as_supp_code__mnfr AND VENDOR_QUALIFY = 'Y'; IF as_no_mfg > 0 THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; -- NOT ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; END IF; END IF; ELSE IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 1 ; RETURN FLAG; -- ALLOWED TO SAVE THE TRANSACTION. ELSE SELECT COUNT(SUPP_CODE) SUPP_CODE INTO as_no_mfg FROM SUPPLIER WHERE SUPP_CODE = as_supp_code__mnfr ; IF as_no_mfg > 0 THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; RETURN FLAG; -- NOT ALLOWED TO SAVE THE TRANSACTION. END IF; End if; END IF; END IF; RETURN FLAG; EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; return flag; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_EMP_DESIGNATION ( as_report_to char) return varchar2 is designation_descr varchar2(45); begin select designation into designation_descr from employee where emp_code = as_report_to; return NVL(designation_descr,' '); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ADHOC_REPL_PERC (LS_CUST_CODE IN VARCHAR2,LS_SITE_CODE IN CHAR) RETURN NUMBER IS LN_ADHOC_REPL_PERC NUMBER(5,2); BEGIN SELECT ADHOC_REPL_PERC INTO LN_ADHOC_REPL_PERC FROM SITE_CUSTOMER WHERE CUST_CODE =LS_CUST_CODE AND SITE_CODE =LS_SITE_CODE ; if (LN_ADHOC_REPL_PERC is null) or (LN_ADHOC_REPL_PERC = 0) then SELECT ADHOC_REPL_PERC INTO LN_ADHOC_REPL_PERC FROM CUSTOMER WHERE CUST_CODE = LS_CUST_CODE; if (LN_ADHOC_REPL_PERC is null) or (LN_ADHOC_REPL_PERC = 0) then SELECT ADHOC_REPL_PERC INTO LN_ADHOC_REPL_PERC FROM SITE WHERE SITE_CODE = LS_SITE_CODE; if (LN_ADHOC_REPL_PERC is null) or (LN_ADHOC_REPL_PERC = 0) then SELECT TO_NUMBER(VAR_VALUE) INTO LN_ADHOC_REPL_PERC FROM DISPARM WHERE PRD_CODE ='999999' AND VAR_NAME = 'ADHOC_REPL_PERC'; END IF ; END IF; END IF; RETURN LN_ADHOC_REPL_PERC; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UNQ_CLASS_CODE_INDX ON STRG_CUST_CLASS (CUST_TYPE, CLASS_CODE, CLASS_CODE_DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_INIT_BD_X ON PROJ_INIT_BD (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CUMM_SMO ( as_event_date date, as_sales_pers char ) Return Number as as_cumm_smo number(8,2); Begin Select nvl(count(dcr_id),0) into as_cumm_smo from STRG_MEET_ORDER SMO where (dcr_id,Strg_Code) In ( select dcr_id,strg_code from Strg_Meet Where strg_type = 'C' And SALES_PERS = as_sales_pers AND event_date >= trunc(to_date(as_event_date),'mon') AND event_date <= as_event_date ) and SMO.Quantity > 0; Return as_cumm_smo; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_QC_QTY_CHK BEFORE UPDATE OF status ON qc_order referencing old as old new as new FOR EACH ROW DECLARE ll_invcount number(3) := 0; ll_qclotcount number(3) := 0; lc_qcqty number(14,3) := 0; lc_traceqty number(14,3) := 0; ll_balcount number(3) := 0; BEGIN if :new.status = 'C' then begin select count(1) into ll_qclotcount from qc_order_lots where qorder_no = :new.QORDER_NO; exception when others then ll_qclotcount := 0; end; if ll_qclotcount > 0 then begin select sum(quantity) into lc_qcqty from qc_order_lots where qorder_no = :new.QORDER_NO; exception when others then lc_qcqty := 0; end; else begin select quantity into lc_qcqty from qc_order where qorder_no = :new.QORDER_NO; exception when others then lc_qcqty := 0; end; end if; begin select sum(case when ref_ser = 'S-ISS' then eff_qty * -1 else eff_qty end) into lc_traceqty from invtrace where ref_ser in('S-ISS','QC-ORD') and ref_id = :new.QORDER_NO and (ref_ser = 'S-ISS' or eff_qty > 0 ) ; exception when others then lc_traceqty := 0; end; if lc_traceqty <> lc_qcqty then raise_application_error( -20601, 'Invtrace not updated for all quantity [' || to_char(lc_traceqty) || '] QC quantity [' || to_char(lc_qcqty) || ']' ); end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_GET_STAGE_QTY (SITECODE CHAR,LS_ITEM_CODE CHAR,WO_NO CHAR,OPR number) RETURN number is OK_QTY number(14,3); WO_QTY number(14,3); LS_ROUTE_CODE VARCHAR2(10); PREV_OPR number(5); FIRST_OPR number(5); REJ_QTY number(14,3); OPR_QTY number(14,3); begin SELECT MIN(OPERATION) into FIRST_OPR FROM WORDER_ROUTE WHERE WORK_ORDER = WO_NO ; SELECT MAX(OPERATION) into PREV_OPR FROM WORDER_ROUTE WHERE WORK_ORDER = WO_NO AND OPERATION < OPR ; IF OPR > FIRST_OPR THEN begin SELECT SUM(nvl(QTY_REPORTED,0)) into wo_qty FROM WORKORDER_FEEDBACK WHERE SITE_CODE = SITECODE AND ITEM_CODE = LS_ITEM_CODE AND WORK_ORDER = WO_NO AND OPERATION = PREV_OPR AND CONFIRMED = 'Y'; exception when others then wo_qty := 0; end; if wo_qty is null then wo_qty := 0; end if; begin SELECT nvl(SUM(nvl(B.QUANTITY,0)),0) into REJ_QTY FROM WORKORDER_FEEDBACK A,WO_FEEDBACK_DET B,ITEM C,ITEMSER D WHERE A.TRAN_ID = B.TRAN_ID AND B.ITEM_CODE = C.ITEM_CODE AND C.ITEM_SER = D.ITEM_SER AND A.SITE_CODE = SITECODE AND A.ITEM_CODE = LS_ITEM_CODE AND A.WORK_ORDER = WO_NO AND A.OPERATION = PREV_OPR AND A.CONFIRMED = 'Y' --AND D.PRODUCT_LINE NOT IN('RM','STR') ; exception when others then REJ_QTY := 0; end; ELSE begin REJ_QTY := 0; SELECT nvl(current_batch_qty,0) into wo_qty FROM WORKORDER WHERE WORK_ORDER = WO_NO; exception when others then wo_qty := 0; end; END IF; begin SELECT SUM(nvl(QTY_REPORTED,0)) into OPR_QTY FROM WORKORDER_FEEDBACK WHERE SITE_CODE = SITECODE AND ITEM_CODE = LS_ITEM_CODE AND WORK_ORDER = WO_NO AND OPERATION = OPR AND CONFIRMED = 'Y'; exception when others then OPR_QTY := 0; end; if WO_QTY is null then WO_QTY := 0; end if; if REJ_QTY is null then REJ_QTY := 0; end if; if OPR_QTY is null then OPR_QTY := 0; end if; OK_QTY := WO_QTY - REJ_QTY - OPR_QTY; RETURN OK_QTY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SUN_FORM16_TAX_SUMMARY_X ON SUN_FORM16_TAX_SUMMARY (ACCT_PRD, EMP_CODE, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INVOICE_TOT_NONTA ( as_invoice_id char, as_lot_sl char) return decimal is mnontax decimal(13,2); begin select sum(net_amt) into mnontax from invoice_trace where invoice_id = as_invoice_id and tax_amt = 0; return mnontax ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXAMT_PERCWISE ( mtran_id taxtran.tran_id%type, mtax_perc taxtran.tax_perc%type, mtax_code taxtran.tran_code%type, flag char ) return number is ln_amts number (12,3); begin --A = Tax Amount if flag = 'A' then select sum(nvl(TAXTRAN.TAX_AMT,0)) into ln_amts from TAXTRAN ,invoice_trace where taxtran.tran_code = 'S-INV' and taxtran.tran_id = invoice_trace.invoice_id and taxtran.line_no = invoice_trace.line_no and taxtran.tax_amt <> 0 and TAXTRAN.TAX_CODE not like '%OCT%' and (invoice_trace.rate = 0 and invoice_trace.tax_amt > 0 ) and invoice_trace.invoice_id = mtran_id and taxtran.tax_code = mtax_code and taxtran.tax_perc = mtax_perc; dbms_output.put_line('Tax Amount For ' || to_char(ln_amts,'0.000') || ' For Tax Perc ::' || to_char(mtax_perc) || '% Invoice Id ::' || mtran_id); else --B = Taxable Amount select sum(nvl(TAXTRAN.TAXABLE_AMT,0)) into ln_amts from TAXTRAN ,invoice_trace where taxtran.tran_code = 'S-INV' and taxtran.tran_id = invoice_trace.invoice_id and taxtran.line_no = invoice_trace.line_no and taxtran.tax_amt <> 0 and TAXTRAN.TAX_CODE not like '%OCT%' and (invoice_trace.rate = 0 and invoice_trace.tax_amt > 0 ) and invoice_trace.invoice_id = mtran_id and taxtran.tax_code = mtax_code and taxtran.tax_perc = mtax_perc; dbms_output.put_line('Taxable Amount For ' || to_char(ln_amts,'0.000') || ' For Tax Perc ::' || to_char(mtax_perc) || '% Invoice Id ::' || mtran_id); end if; return ln_amts; if ln_amts is null then ln_amts := 0; end if; dbms_output.put_line('Amount is ' || to_char(ln_amts,'0.000') || ' For Tax Perc ::' || to_char(mtax_perc)); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICKLBL_FMT (AS_SALE_ORDER SORDER.SALE_ORDER%TYPE) RETURN varchar2 IS LS_FMTDISPLAY varchar2(500); LS_CUSTCD VARCHAR2(10) ; BEGIN SELECT TRIM(CUST_CODE) INTO LS_CUSTCD FROM SORDER WHERE SALE_ORDER =AS_SALE_ORDER; SELECT TRIM(VAR_VALUE) INTO LS_FMTDISPLAY FROM DISPARM WHERE VAR_NAME = LS_CUSTCD || '_PKLBLFMT'; if LS_FMTDISPLAY is null or length(trim(LS_FMTDISPLAY)) = 0 then LS_FMTDISPLAY := '99'; end if; RETURN LS_FMTDISPLAY ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN '99' ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_USR_NAME ( CODE IN VARCHAR2 ) RETURN VARCHAR2 IS USRNAME VARCHAR2(100); cursor c1 is SELECT users.name FROM USERS users WHERE users.CODE = CODE; BEGIN open c1; fetch c1 into USRNAME; close c1; return trim(usrname); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHECK_COUNT ( AS_SYS_DATE IN DATE, AS_NO_VISIT IN NUMBER) RETURN NUMBER IS AS_SUM NUMBER(10) ; AS_DATE DATE; J NUMBER(20); BEGIN AS_SUM :=0; J :=0; AS_DATE :=LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1 ; FOR I IN 1..AS_NO_VISIT LOOP J:=J+1; IF AS_SYS_DATE>= AS_DATE AND AS_SYS_DATE<=AS_DATE + trunc((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)-1 THEN AS_SUM :=J; ELSE IF AS_SYS_DATE>=AS_DATE AND AS_SYS_DATE<=AS_DATE + (trunc((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)-1)+( mod((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1))),AS_NO_VISIT)) THEN AS_SUM :=J; END IF ; end if; AS_DATE :=AS_DATE+ trunc(((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)); END LOOP; RETURN AS_SUM ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_RET_VAL (as_purcorder in char) return varchar is ls_stringval varchar2(5000); ls_retval varchar2(5000) ; ls_taxcode taxtran.tax_code%type; lc_tax_perc taxtran.tax_perc%type; ls_rate_type taxtran.rate_type%type; ls_tax_form taxtran.tax_form%type; ls_tax_descr tax.descr%type; cursor cur_tax is select taxtran.tax_code,nvl(taxtran.tax_perc,0),taxtran.rate_type,taxtran.tax_form from taxtran,tax where taxtran.tran_code = 'P-ORD' and taxtran.tran_id = as_purcorder and taxtran.tax_code = tax.tax_code and tax.print_tax = 'Y' and taxtran.line_no = (select min(line_no) from porddet where purc_order = as_purcorder ) and taxtran.tax_code in (select distinct tax_code from taxtran where tran_code = 'P-ORD' and tran_id = as_purcorder and nvl(tax_amt,0) <> 0 ) order by line_no__tax ; begin ls_retval := ' ' ; if ddf_match_tax(as_purcorder) = 'N' then return ls_retval ; end if; open cur_tax; LOOP fetch cur_tax into ls_taxcode, lc_tax_perc, ls_rate_type, ls_tax_form ; EXIT WHEN (cur_tax%NOTFOUND) ; if (ls_taxcode is not null) and (length(ltrim(rtrim(ls_taxcode))) > 0) then select descr into ls_tax_descr from tax where tax_code = ls_taxcode; if ls_rate_type = 'P' then if length(ltrim(rtrim(ls_retval))) > 0 then ls_retval := ls_retval || chr(13) || ls_tax_descr || ' (@ ' || ltrim(to_char(lc_tax_perc,'9999990.99')) || ' %)' ; else ls_retval := ls_tax_descr || ' (@ ' || ltrim(to_char(lc_tax_perc,'9999990.99')) || ' %)' ; end if; else if ls_rate_type = 'F' then if ls_tax_form is null then ls_tax_form := ' ' ; end if; if length(ltrim(rtrim(ls_retval))) > 0 then ls_retval := ls_retval || chr(13) || ls_tax_descr || ' ' || ls_tax_form ; else ls_retval := ls_tax_descr || ' ' || ls_tax_form ; end if; else if length(ltrim(rtrim(ls_retval))) > 0 then ls_retval := ls_retval || chr(13) || ls_tax_descr ; else ls_retval := ls_tax_descr ; end if; end if; end if; end if; END LOOP ; close cur_tax ; return ls_retval ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE EFF_DOC_NOTMET_DM AS FUNCTION getDocNotMetInfo(empCode in char, prdCode in char) RETURN EFF_DOC_NOT_MET_TB PIPELINED; END EFF_DOC_NOTMET_DM; CREATE OR REPLACE PACKAGE BODY EFF_DOC_NOTMET_DM AS FUNCTION getDocNotMetInfo (empCode in char, prdCode in char) RETURN EFF_DOC_NOT_MET_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); END_DATE DATE; BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE CODE = prdCode; WITH MGR_DATA AS ( SELECT A.EMP_CODE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ) SELECT COUNT(1) INTO UNCONFIRM_CNT FROM SPRS_ACT_TRAN SAT, MGR_DATA MGR_DATA WHERE SAT.EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND SAT.CONFIRMED = 'Y' AND SAT.SALES_PERS = MGR_DATA.EMP_CODE; if (UNCONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; SELECT CODE INTO AS_PRD_CODE FROM PERIOD WHERE FR_DATE = AS_FR_DATE AND TO_DATE = AS_TO_DATE; select (case when (select to_char( sysdate, 'YYYYMM' ) from dual) = AS_PRD_CODE THEN SYSDATE ELSE (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) end) INTO END_DATE from dual; for x in ( SELECT DOC_NMET.SC_CODE, DOC_NMET.DR_NAME, DOC_NMET.SPECIALITY, DOC_NMET.PLANNED_VISIT, DOC_NMET.CLASS_CODE, DOC_NMET.CATEGORY, DOC_NMET.LOCALITY, DOC_NMET.ROUTE_TYPE, DOC_NMET.LAST_VISIT, NVL(DOC_NMET.VISIT_SINCE,0) AS VISIT_SINCE, AS_PRD_CODE AS PRD_CODE, DOC_NMET.MGR_SUB, DOC_NMET.EMP_CODE, DOC_NMET.EMP_NAME, DOC_NMET.DESIGN, DOC_NMET.DIVISION, DOC_NMET.HEAD_QUAT FROM ( WITH MGR_DATA AS ( SELECT A.EMP_CODE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ) SELECT SS.SC_CODE AS SC_CODE, (SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS DR_NAME, SPL.DESCR AS SPECIALITY, SS.NO_VISIT AS PLANNED_VISIT, (SELECT DESCR FROM STRG_SER_CLASS WHERE ITEM_SER = (SELECT ITEM_SER FROM SALES_PERS WHERE SALES_PERS = MGR_DATA.EMP_CODE) AND CLASS_CODE = SS.CLASS_CODE) CLASS_CODE, SS.CATEGORY, LOC.DESCR LOCALITY, --ROUTE.ROUTE_TYPE, (SELECT ROUTE_TYPE FROM SPRS_ROUTE ROUTE WHERE ROUTE.SPRS_CODE = SS.SALES_PERS AND ROUTE.ROUTE_ID = SS.ROUTE_ID) ROUTE_TYPE, MAX(EVENT_DATE) AS LAST_VISIT, ROUND((END_DATE) - MAX(EVENT_DATE)) AS VISIT_SINCE, SS.SALES_PERS AS MGR_SUB, EMP.EMP_CODE, (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) AS EMP_NAME,EMP.DESIGNATION AS DESIGN, ITEMSER.DESCR AS DIVISION, ST.DESCR as HEAD_QUAT FROM MGR_DATA MGR_DATA, SALES_PERS SP ,ITEMSER ITEMSER,STATION ST, EMPLOYEE EMP,STRG_SERIES SS LEFT OUTER JOIN STRG_MEET SM ON SM.STRG_CODE = SS.SC_CODE AND SM.SALES_PERS=SS.SALES_PERS AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' AND SM.EVENT_DATE <= END_DATE LEFT OUTER JOIN FIELDACTIVITY FA ON SM.EVENT_TYPE = FA.ACTIVITY_CODE AND FA.ACTIVITY_TYPE = 'FW' LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE = SPL.SPL_CODE, STRG_CUSTOMER SC LEFT OUTER JOIN LOCALITY LOC ON SC.LOCALITY_CODE = LOC.LOCALITY_CODE WHERE SS.SC_CODE = SC.SC_CODE AND SS.SALES_PERS = MGR_DATA.EMP_CODE AND SP.SALES_PERS = SS.SALES_PERS AND SP.ITEM_SER = ITEMSER.ITEM_SER AND EMP.EMP_CODE = SS.SALES_PERS AND EMP.STAN_CODE__HQ = ST.STAN_CODE -- AND SS.STATUS = 'Y' AND 'Y' = ( CASE WHEN SS.STATUS = 'Y' AND SS.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' WHEN SS.STATUS = 'N' AND SS.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SS.CHG_DATE >= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) AND SC.CUST_TYPE = 'D' AND SS.SC_CODE NOT IN (SELECT DISTINCT SM.STRG_CODE FROM STRG_MEET SM, FIELDACTIVITY F WHERE SM.SALES_PERS = MGR_DATA.EMP_CODE AND SM.EVENT_DATE BETWEEN (SELECT FR_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SM.EVENT_TYPE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' ) GROUP BY SS.SC_CODE, SC.FIRST_NAME ,SC.MIDDLE_NAME ,SC.LAST_NAME,SPL.DESCR, SS.NO_VISIT, SS.CLASS_CODE, SS.CATEGORY, LOC.DESCR, SS.ROUTE_ID, SS.SALES_PERS, MGR_DATA.EMP_CODE,EMP.EMP_CODE, EMP.EMP_FNAME, EMP.EMP_MNAME, EMP.EMP_LNAME, EMP.DESIGNATION, ITEMSER.DESCR, ST.DESCR ) DOC_NMET ) LOOP PIPE ROW (EFF_DOC_NOTMET_MST( x.SC_CODE,x.DR_NAME,x.SPECIALITY,x.PLANNED_VISIT,x.CLASS_CODE,x.CATEGORY,x.LOCALITY,x.ROUTE_TYPE,x.LAST_VISIT, x.VISIT_SINCE, x.PRD_CODE, x.MGR_SUB, x.DIVISION, x.EMP_CODE, x.EMP_NAME, x.HEAD_QUAT, x.DESIGN)); END LOOP; RETURN; END; END EFF_DOC_NOTMET_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCH_RATE_AGREED (AS_TRAN_ID forex_req_det_summ.TRAN_ID%TYPE,AS_CURR_CODE forex_req_det_summ.CURR_CODE%TYPE, AS_FLG CHAR) return NUMBER is LS_EXCH_RATE_AGR NUMBER(14,3) ; begin IF AS_FLG='EXCH_RATE' THEN SELECT exch_rate__agreed INTO LS_EXCH_RATE_AGR FROM forex_req_det_summ WHERE TRAN_ID =AS_TRAN_ID AND CURR_CODE = AS_CURR_CODE ; ELSIF AS_FLG='SERVICE' THEN SELECT SERVICE_CHRGS INTO LS_EXCH_RATE_AGR FROM forex_req_det_summ WHERE TRAN_ID =AS_TRAN_ID AND CURR_CODE = AS_CURR_CODE ; END IF; return LS_EXCH_RATE_AGR; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_LOT_NO_ITEM_SL ON STOCK (LOT_NO, ITEM_CODE, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SPERC_SPNAME (as_level_code CHAR, as_table_no CHAR, as_version CHAR) return varchar2 is ls_errcode VARCHAR2(100); cursor c_sales_pers_name is select hierarchy_det.sales_pers , sales_pers.sp_name from hierarchy_det, sales_pers where hierarchy_det.sales_pers = sales_pers.sales_pers and hierarchy_det.level_code = as_level_code and hierarchy_det.table_no = as_table_no and hierarchy_det.version_id = as_version ; ls_sales_pers_cd varchar2(15) ; ls_sales_pers_name varchar2(15) ; begin for i in c_sales_pers_name loop ls_errcode := i.sales_pers || ' '|| i.sp_name ; end loop; return ls_errcode; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MARITALCHG_NAMECHG (AS_TRAN_ID EMP_MARITALCHG.TRAN_ID%TYPE, AS_STATUS EMP_MARITALCHG.WF_STATUS%TYPE, AS_CONFIRMED EMP_MARITALCHG.CONFIRM%TYPE,AS_FLAG varchar) RETURN VARCHAR2 IS LS_RETURN VARCHAR2(200) :=' '; a_obj_sign_count number(10):=0 ; a_wf_prc_status_count number(10):=0 ; ls_emp_aprv varchar2(120); ls_sign_date DATE; ls_trn_date DATE; ls_sign_remarks VARCHAR2(200) :=' '; BEGIN IF AS_CONFIRMED ='Y' and AS_STATUS='Y' and AS_FLAG='SECOND_CONF__BY' then select count(1) into a_obj_sign_count from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and rownum=1; if a_obj_sign_count > 0 then select user_id__sign into ls_emp_aprv from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and sign_status='S' AND user_id__sign is not null and rownum=1 order by sign_date desc ; LS_RETURN := ls_emp_aprv; end if; ELSIF AS_CONFIRMED ='Y' and AS_STATUS='Y' and AS_FLAG='SECOND_CONF__DATE' then select count(1) into a_obj_sign_count from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG')and rownum=1; if a_obj_sign_count > 0 then select sign_date into ls_sign_date from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and sign_status='S' AND user_id__sign is not null and rownum=1 order by sign_date desc ; LS_RETURN := ls_sign_date; end if; ELSIF AS_CONFIRMED ='Y' and (AS_STATUS='O' or AS_STATUS='Y') and AS_FLAG='SECOND_TRAN__DATE' then select count(1) into a_wf_prc_status_count from wf_prc_status where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG')and rownum=1; if a_wf_prc_status_count > 0 then select status_date into ls_trn_date from wf_prc_status where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and rownum=1 ; LS_RETURN := ls_trn_date; elsif a_wf_prc_status_count = 0 then LS_RETURN := fn_sysdate; end if; ELSIF AS_CONFIRMED ='Y' and AS_STATUS='O' and AS_FLAG='SECOND_REJECT_REMARK' then select count(1) into a_obj_sign_count from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG'); if a_obj_sign_count > 0 then select sign_remarks into ls_sign_remarks from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and sign_status='R' AND role_code__sign iN ('MSTCHG_HR1','MSTCHG_HR2','MSTCHG_HR3') AND user_id__sign is not null and rownum=1 order by line_no desc ; LS_RETURN := ls_sign_remarks; end if; ELSIF AS_CONFIRMED ='Y' and AS_STATUS='R' and AS_FLAG='SECOND_REJECT_REMARK' then select count(1) into a_obj_sign_count from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG'); if a_obj_sign_count > 0 then select sign_remarks into ls_sign_remarks from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and sign_status='R' AND role_code__sign iN ('MSTCHG_HR1','MSTCHG_HR2','MSTCHG_HR3') AND user_id__sign is not null and rownum=1 order by line_no desc ; LS_RETURN := ls_sign_remarks; end if; ELSIF AS_CONFIRMED ='Y' and NVL(AS_STATUS,'K') = 'K' and AS_FLAG='SECOND_TRAN__DATE' then LS_RETURN:=trunc(sysdate); ELSIF AS_CONFIRMED ='Y' and AS_FLAG='SECOND_STATUS' then IF AS_CONFIRMED ='Y' and AS_STATUS = 'S' THEN LS_RETURN := 'PENDING WITH HR'; end if; IF AS_CONFIRMED ='Y' and AS_STATUS = 'O' THEN LS_RETURN := 'REJECTED BY HR'; end if; IF AS_CONFIRMED ='Y' and AS_STATUS = 'Y' THEN LS_RETURN := 'APPROVED'; END IF; IF NVL(AS_STATUS,'K') = 'K' THEN LS_RETURN := ' '; END IF; else LS_RETURN := ' '; end if; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CONSUME_ISS_CONF_DATE_TRAN_CD ON CONSUME_ISS (CONF_DATE, TRAN_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ALL_BOMCODES (as_bomcode bom.bom_code%type ,as_sitecode site.site_code%type) return varchar2 is ret_itemcodes varchar2(1000); ls_itemcode bom.item_code%type; ls_bomcode bom.bom_code%type; cursor c1 is select item_code from bomdet where bom_code = as_bomcode; begin open c1; loop fetch c1 into ls_itemcode; exit when c1%notfound; ls_bomcode := ''; begin select bom_code into ls_bomcode from siteitem where site_code = as_sitecode and supp_sour = 'M' and bom_code is not null and item_code = ls_itemcode; exception when no_data_found then ls_bomcode := ''; end; if (ls_bomcode = ' ') then ret_itemcodes := ret_itemcodes || ls_itemcode || ','; else ret_itemcodes := ret_itemcodes || ls_itemcode || ','; ret_itemcodes := ret_itemcodes || ddf_get_all_bomcodes(ls_bomcode,as_sitecode); end if ; end loop ; close c1; return ret_itemcodes; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVALLOC_SITE_ITEM_LOC_LOT ON INVALLOC_TRACE (SITE_CODE, ITEM_CODE, LOC_CODE, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_UNLIST_MST force AS OBJECT ( SC_CODE VARCHAR2(30), CHEM_NAME VARCHAR2(150), ROUTE_TYPE VARCHAR2(60), CLASS_DESCR VARCHAR2(60), CHEM_ADDR VARCHAR2(500), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUNDRY_NAME_ADDR (as_type in char, as_code in char) return varchar2 as as_party varchar2(250); begin if as_type = 'S' then select supp_name||'. ('||nvl(addr1,' ')||', '||nvl(addr2,' ')||', '||nvl(addr3,' ')||', '||nvl(city,' ')||', '||nvl(count_code,' ')||')' into as_party from supplier where supp_code = as_code; elsif as_type = 'C' then select cust_name|| '. ('||nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ')||', '||nvl(city,' ')||', '||nvl(count_code,' ')||')' into as_party from customer where cust_code = as_code; elsif as_type = 'O' then select descr||'. ('||nvl(add1,' ')||', '||nvl(add2,' ')||', '||nvl(add3,' ')||', '||nvl(city,' ')||')' into as_party from site where site_code = as_code; elsif as_type='A' then select substr(trim(cust_name),1,40) into as_party from customer where cust_code=as_code; elsif as_type='B' then select substr(trim(addr3),1,100) into as_party from customer where cust_code=as_code; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MULTI_VEND_STATUS_BOM ( as_supp_code__mnfr VARCHAR2, as_bom_code CHAR, AS_item_code CHAR, as_ref_ser CHAR, as_tran_date DATE, bom_type CHAR ) RETURN NUMBER IS FLAG NUMBER(1); --- change the type of TMP_site_code,as_site_code to site.site_code%type on 25-Nov-2014 --- Start ----- TMP_site_code site.site_code%type; as_site_code site.site_code%type; --- change the type of TMP_site_code,as_site_code to site.site_code%type on 25-Nov-2014 --- End ----- site_chk_cnt NUMBER; tmp_tran_date DATE; dt_cnt number; supp_chk_cnt NUMBER; BEGIN TMP_site_code :='X'; site_chk_cnt :=0; dt_cnt :=0; supp_chk_cnt :=0; select LENGTH(TRIM(as_supp_code__mnfr)) INTO supp_chk_cnt from DUAL; IF supp_chk_cnt > 0 THEN IF bom_type ='A-BOM' THEN -------FOR ALT BOM TRANSACTION select site_code,LENGTH(SITE_CODE) INTO TMP_site_code,site_chk_cnt from bom where bom_code=as_bom_code; IF site_chk_cnt >0 THEN as_site_code := TMP_site_code; ELSE ---TAKE FROM DISPARM if its not exist in bom SELECT VAR_VALUE INTO as_site_code FROM DISPARM WHERE VAR_NAME='ALT_BOM_SITE'; END IF; ELSE -------FOR BOM TRANSACTION as_site_code := as_bom_code; END IF; select LENGTH(as_tran_date) INTO dt_cnt from dual; IF dt_cnt > 5 THEN tmp_tran_date := as_tran_date ; else select TO_CHAR(current_date,'DD-MON-YY') INTO tmp_tran_date from dual; END IF; --CALL THE FUNCTION FUNCTION SELECT FN_CHK_MULTI_VENDOR_STATUS(as_supp_code__mnfr,as_site_code,AS_item_code,as_ref_ser,tmp_tran_date ) INTO FLAG FROM dual; RETURN FLAG; else Flag := 1; RETURN flag; END IF; -------- CHECK WHETHER THE ENTRY EXISTS IN ITEM MASTER OR NOT ------------ EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; RETURN flag; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UOMTMP_X ON UOMTMP (UNIT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PAYMENT_EXP_CHK BEFORE INSERT OR UPDATE OF confirmed ON payment_exp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_acctcount from paydet_exp where tran_id = :new.tran_id; exception when others then ll_acctcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'E-PAY' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select net_amt into lc_hdramt from paydet_exp --where tran_id = :new.tran_id; lc_hdramt := :old.net_amt ; exception when others then lc_hdramt := 0; end; if (lc_hdramt <> 0 or ll_acctcount <> 0) and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_acctcount) || '] rows in detail or header amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'E-PAY' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHNAGE_HOLIDAY (AS_HOL_TBLNO CHAR ,AS_HOL_DATE DATE,AS_EMP_CODE char) return date is a_hol_date date; begin SELECT distinct h.hol_date into a_hol_date FROM holiday H WHERE H.HOL_DATE NOT IN( SELECT HOL_DATE_FOR FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND H.HOL_TBLNO=HOL_TBLNO AND HOL_DATE_FOR =AS_HOL_DATE) AND HOL_DATE =AS_HOL_DATE AND HOL_TBLNO=AS_HOL_TBLNO; return a_hol_date; exception when no_data_found then begin SELECT DISTINCT HOL_DATE_TO into a_hol_date FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND HOL_TBLNO = AS_HOL_TBLNO AND HOL_DATE_FOR =AS_HOL_DATE; return a_hol_date; end; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_BUDGET_AMT (as_tran_code in char,as_site_code in char,as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_dept_code in char, as_flag in char) return number is ac_budget_amt number(14,3); ld_tran_date date; ls_var_value char(10); ls_site char(5); ll_count number(3); ls_SITE_CODE__BUDGET char(5); ls_anal_code char(5); ls_dept_code char(5); ls_cctr_code char(5); begin begin select SITE_CODE__BUDGET into ls_SITE_CODE__BUDGET from site where site_code = as_site_code; if (length(trim(ls_SITE_CODE__BUDGET)) = 0) then ac_budget_amt := -1; return ac_budget_amt; end if; if ls_SITE_CODE__BUDGET is null then ac_budget_amt := -1; return ac_budget_amt; end if; select trunc(sysdate) into ld_tran_date from dual; if as_anal_code iS NULL then ls_anal_code := ' '; else ls_anal_code := as_anal_code; end IF; IF as_dept_code IS NULL THEN ls_dept_code := ' '; else ls_dept_code := as_dept_code; END IF; IF as_cctr_code IS NULL THEN ls_cctr_code := ' '; else ls_cctr_code := as_cctr_code; END IF; if ltrim(rtrim(as_flag)) = 'A' then begin select budget_amt into ac_budget_amt from acctbudget where from_date <= ld_tran_date and to_date >= ld_tran_date --budget_id = ls_var_value --and trim(fin_entity) = substr(ls_SITE_CODE__BUDGET,1,2) --added by pravin 05-05-2011 and acct_code = as_acct_code and cctr_code = ls_cctr_code and anal_code = ls_anal_code ; exception when others then ac_budget_amt := 0; return ac_budget_amt ; end; if ac_budget_amt is null then ac_budget_amt := 0; return ac_budget_amt; end if; elsif ltrim(rtrim(as_flag)) = 'D' then begin select budget_amt into ac_budget_amt from acctbudget where from_date <= ld_tran_date and to_date >= ld_tran_date --budget_id = ls_var_value --and trim(fin_entity) = substr(ls_SITE_CODE__BUDGET,1,2) --added by pravin 05-05-2011 and acct_code = as_acct_code and cctr_code = ls_cctr_code and dept_code = ls_dept_code; exception when others then ac_budget_amt := 0; return ac_budget_amt ; end; if ac_budget_amt is null then ac_budget_amt := 0; return ac_budget_amt; end if; else begin select SUM(budget_amt) into ac_budget_amt from acctbudget where from_date <= ld_tran_date and to_date >= ld_tran_date --budget_id = ls_var_value --and trim(fin_entity) = substr(ls_SITE_CODE__BUDGET,1,2) --added by pravin 05-05-2011 and acct_code = as_acct_code and cctr_code = ls_cctr_code; exception when others then ac_budget_amt := 0; return ac_budget_amt ; end; if ac_budget_amt is null then ac_budget_amt := 0; return ac_budget_amt; end if; end if; exception when others then ac_budget_amt := 0; return ac_budget_amt ; end; return ac_budget_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TASKDESCR (AS_REF_SERIES REFSER.REF_SER%TYPE) RETURN VARCHAR2 IS LS_FMTDISPLAY REFSER.DESCR%TYPE; BEGIN SELECT DESCR INTO LS_FMTDISPLAY FROM REFSER WHERE REF_SER = AS_REF_SERIES; RETURN LS_FMTDISPLAY ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BENEFIX_TRACE_X ON BENEFIT_TRACE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RCWITHOWNER_AUTH (roleCode char,empCode char) RETURN NUMBER as count_owner NUMBER:=0; BEGIN SELECT count(u.emp_code) into count_owner FROM users u, wf_role_users ru, wf_role w WHERE w.role_code=ru.role_code AND ru.userid=u.code AND w.role_code=roleCode AND u.emp_code=empCode; RETURN count_owner; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_COACH_COUNT ( as_survery_code IN CHAR, as_sprs_code IN CHAR, as_opt IN CHAR, as_frm_date IN DATE, as_to_date IN DATE) RETURN NUMBER IS cnt NUMBER(14); ls_count NUMBER(14); BEGIN IF as_opt = 'CUSTCNT' then --for attend count SELECT COUNT(SM.STRG_CODE) INTO ls_count FROM STRG_MEET SM, SPRS_COACHING SCOCH, SURVEY_MASTER SURVM WHERE SM.DCR_ID = SCOCH.DCR_ID AND SM.TRAN_ID = SCOCH.TRAN_ID AND SM.STRG_CODE = SCOCH.STRG_CODE AND SCOCH.SURVEY_CODE = SURVM.SURVEY_CODE AND SURVM.RESULT_TYPE = 'L' AND SM.EVENT_DATE BETWEEN as_frm_date AND as_to_date AND SCOCH.SURVEY_CODE = as_survery_code AND SCOCH.SPRS_CODE__WW = as_sprs_code; END IF; IF as_opt='COACHCNT' THEN --for coaching count SELECT COUNT(distinct SM.TRAN_ID) into ls_count FROM STRG_MEET SM, SPRS_COACHING SCOCH, SURVEY_MASTER SURVM WHERE SM.DCR_ID = SCOCH.DCR_ID AND SM.TRAN_ID = SCOCH.TRAN_ID AND SM.STRG_CODE = SCOCH.STRG_CODE AND SCOCH.SURVEY_CODE = SURVM.SURVEY_CODE AND SURVM.RESULT_TYPE = 'L' AND SM.EVENT_DATE BETWEEN as_frm_date AND as_to_date AND SCOCH.SURVEY_CODE = as_survery_code AND SCOCH.SPRS_CODE__WW = as_sprs_code; END IF; IF as_opt='TOTQS' THEN --for Total Coaching Question count SELECT COUNT(SM.TRAN_ID) into ls_count FROM STRG_MEET SM, SPRS_COACHING SCOCH, SURVEY_MASTER SURVM WHERE SM.DCR_ID = SCOCH.DCR_ID AND SM.TRAN_ID = SCOCH.TRAN_ID AND SM.STRG_CODE = SCOCH.STRG_CODE AND SCOCH.SURVEY_CODE = SURVM.SURVEY_CODE AND SURVM.RESULT_TYPE = 'L' AND SM.EVENT_DATE BETWEEN as_frm_date AND as_to_date AND SCOCH.SURVEY_CODE = as_survery_code AND SCOCH.SPRS_CODE__WW = as_sprs_code; END IF; IF as_opt='TOTYS' THEN --for Total Coaching Y's count SELECT COUNT(SM.TRAN_ID) into ls_count FROM STRG_MEET SM, SPRS_COACHING SCOCH, SURVEY_MASTER SURVM WHERE SM.DCR_ID = SCOCH.DCR_ID AND SM.TRAN_ID = SCOCH.TRAN_ID AND SM.STRG_CODE = SCOCH.STRG_CODE AND SCOCH.SURVEY_CODE = SURVM.SURVEY_CODE AND SCOCH.RESULT= SURVM.CORRECT_ANS AND SM.EVENT_DATE BETWEEN as_frm_date AND as_to_date AND SCOCH.SURVEY_CODE = as_survery_code AND SCOCH.SPRS_CODE__WW = as_sprs_code; END IF; cnt := ls_count; RETURN cnt; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOTENCY_DESCR ( AS_MATCH_POTENCY IN VARCHAR, AS_POTENCY_PERC IN NUMBER, AS_QUANTITY IN NUMBER, AS_potency_adj IN NUMBER, AS_min_potency_perc IN NUMBER, AS_adj_potency IN VARCHAR) RETURN VARCHAR IS RET_VAL VARCHAR(200); BEGIN IF AS_MATCH_POTENCY ='Y' THEN RET_VAL := 'Qty on '; IF AS_POTENCY_PERC IS NULL THEN RET_VAL := RET_VAL || TO_CHAR(100) ; ELSE RET_VAL := RET_VAL || TO_CHAR(AS_POTENCY_PERC) ; END IF; RET_VAL := RET_VAL ||'% basis= ' ; IF AS_QUANTITY IS NULL THEN RET_VAL := RET_VAL ; ELSE RET_VAL := RET_VAL || TO_CHAR(AS_QUANTITY); END IF; RET_VAL := RET_VAL || ' ( '; IF AS_potency_adj IS NULL THEN RET_VAL := RET_VAL || TO_CHAR(AS_QUANTITY)|| ' X ' || TO_CHAR(AS_min_potency_perc) || '% as is basis ) '; ELSE RET_VAL := RET_VAL || TO_CHAR(AS_QUANTITY+AS_potency_adj)|| ' X ' || TO_CHAR(AS_min_potency_perc) || '% as is basis ) '; END IF; ELSE IF AS_adj_potency IS NULL THEN RET_VAL := RET_VAL; ELSE -- SET RR = AS_adj_potency ; RET_VAL := AS_adj_potency ; END IF; IF AS_potency_adj > 0 THEN RET_VAL := RET_VAL || ' ( ' || TO_CHAR(AS_potency_adj) || ' ) '; END IF; END IF; RETURN RET_VAL; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WAREHOUSE_NAME (as_remarks varchar) return char is as_descr disparm.var_value%type; begin select var_value into as_descr from disparm where var_name = 'WAREHOUSE_NAME_'||as_remarks; return as_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MASTER_GEN_TABLE_X ON MASTER_GEN_TABLE (MST_TABLE, MASTER_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_VOUCHER_DATE_SITE ON MISC_VOUCHER (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BANK_DETAILS (as_empcode char,ls_voucherno char) return varchar2 is ls_return varchar2(100) ; begin declare ls_paymode char(1); ls_tranid char(10); ls_voucher char(10); ls_bank char(10); ls_flag char(1); ls_stan char(5); ls_descr varchar2(60); ls_instr_no char(20); ls_ref_no char(20); ls_paymode_emp char(1); ls_bank_emp char(10) ; ls_stan_emp char(5) ; ls_bankacct_emp varchar2(30) ; BEGIN begin ls_flag := ' ' ; select nvl(tran_id,'0'),nvl(stan_code,'0'),nvl(instr_no,'0') into ls_tranid,ls_stan,ls_instr_no from misc_paydet where tran_ser = 'P-VOUC' and vouch_no = ls_voucherno and rownum = 1 order by tran_id desc; EXCEPTION WHEN NO_DATA_FOUND then ls_stan := '0'; ls_instr_no := '0'; ls_tranid := '0' ; end ; select nvl(pay_mode,' '),nvl(bank_code,' '), nvl(stan_code,' '),nvl(bank_acct,' ') into ls_paymode_emp,ls_bank_emp, ls_stan_emp ,ls_bankacct_emp from employee where emp_code =as_empcode ; BEGIN select nvl(pay_mode ,'0'),nvl(bank_code,'DUPE'),nvl(ref_no,'0') into ls_paymode ,ls_bank ,ls_ref_no from misc_payment where tran_id = ls_tranid ; EXCEPTION WHEN NO_DATA_FOUND then ls_paymode := ls_paymode_emp ; ls_bank:= 'DUPE' ; end ; if (ls_bank = 'DUPE') then ls_bank := ls_bank_emp; ls_stan := ls_stan_emp; end if ; begin select nvl(drawn_at,' ') into ls_descr from bank_stan_serv where bank_code = ls_bank and stan_code = ls_stan ; EXCEPTION WHEN NO_DATA_FOUND then ls_descr := ' '; end ; if ls_paymode = '0' or length(ltrim(rtrim(ls_paymode))) = 0 then ls_paymode := ls_paymode_emp; end if ; if ls_paymode = 'D' then ls_return := ls_instr_no ; end if; if ls_paymode = 'Q' then ls_return := ls_ref_no; end if; if ls_paymode = 'T' then ls_return := ls_bankacct_emp ; end if ; return ls_paymode||'!'||ls_flag||rtrim(ltrim(ls_descr))||'^'||ls_return ; end ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CASENO_MAX1 (as_tran_id in inv_pack_rcp.tran_id%type,as_lot_no inv_pack_rcp.lot_no%type) return char is ls_range varchar2(15); ls_packinst varchar2(15); ls_ret varchar2(15); ls_max varchar2(15); ll_ret number(10); ls_source number(10); ll_cnt number(10); begin select inv_pack_rcp.pack_instr INTO ls_max from inv_pack_rcp where (inv_pack_rcp.tran_id = as_tran_id) and LINE_NO =(SELECT MAX(LINE_NO) FROM INV_PACK_RCP WHERE TRAN_ID = as_tran_id and lot_no = as_lot_no ) ; ls_ret := ddf_get_token(ls_packinst,'-'); if ls_ret > 0 then ls_range := substr(ls_max,ls_ret+1,length(ls_max) ) ; else ls_range := ls_max; end if; return ls_range; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STAN_COST_ANAL_X ON STAN_COST_ANAL (ANAL_CODE, CCTR_CODE, STAN_CODE, EFF_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRG_MISC_DRCR_RDET_TAXENV before insert or update on Misc_Drcr_Rdet referencing old as old new as new for each row Declare taxClass Misc_Drcr_Rdet.tax_class%type; taxEnv Misc_Drcr_Rdet.tax_env%type; Taxchap Misc_Drcr_Rdet.Tax_Chap%Type; Anal_Code Misc_Drcr_Rdet.Anal_Code%Type; ls_balwofftype misc_drcr_rcp.tran_type%type; ls_curtrantype misc_drcr_rcp.tran_type%type; Begin ls_balwofftype := '@@@'; ls_curtrantype := '###'; If :new.tran_id is not null and length(trim(:new.tran_id)) > 0 then begin select var_value into ls_balwofftype from finparm where prd_code = '999999' and var_name = 'BAL_WOFF_TYPE' ; exception when others then ls_balwofftype := '@@@'; end; If ls_balwofftype is null or length(trim(ls_balwofftype)) = 0 then ls_balwofftype := '@@@'; end if; begin select tran_type into ls_curtrantype from misc_drcr_rcp where tran_id = :new.tran_id ; exception when others then ls_curtrantype := '###'; end; If ls_curtrantype is null or length(trim(ls_curtrantype)) = 0 then ls_curtrantype := '###'; end if; end if; if trim(ls_curtrantype) <> trim(ls_balwofftype) then Select Nvl(Trim(:New.Tax_Class), 'N'), Nvl(Trim(:New.Tax_Chap), 'N'), Nvl(Trim(:New.Tax_Env), 'N'), Nvl(Trim(:New.Anal_Code), 'N') Into Taxclass, Taxenv, Taxchap, Anal_Code From Dual; If (:New.Item_Code Is Null) And (:New.Tax_Amt is not null) and (Taxclass = 'N' or Taxenv = 'N' or Taxchap = 'N' or Anal_Code = 'N') Then raise_application_error (-20999,'Tax_Class, Tax_Chap, Tax_Env and Analysis(HSN) are Mandatory. For Line Number[' || :new.line_no || '] with Item Code[' || :new.Acct_Code || ']'); End If; end if; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PVOUCHDET_AMT (AS_TRAN_ID PAYR_VOUCHDET.TRAN_ID%TYPE, AS_LINE_NO PAYR_VOUCHDET.LINE_NO%type) RETURN NUMBER IS A_AMOUNT PAYR_VOUCHDET.AMOUNT%type; BEGIN BEGIN SELECT AMOUNT INTO A_AMOUNT FROM PAYR_VOUCHDET WHERE TRAN_ID = AS_TRAN_ID AND TRIM(LINE_NO) = TRIM(AS_LINE_NO); EXCEPTION WHEN NO_DATA_FOUND THEN A_AMOUNT := 0; END; RETURN CASE WHEN A_AMOUNT IS NULL THEN 0 ELSE A_AMOUNT END; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_REFMODEDESCR ( as_ref_mode char) return varchar2 is ls_descr varchar2(120); begin begin select descr into ls_descr from gencodes where fld_value = as_ref_mode and fld_name = 'REF_MODE'; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SOD_SORT_STRING (p_string in varchar2) return varchar deterministic as rv varchar2(4000); ch varchar2(1); type vcArray is table of varchar(4000) index by varchar2(1); sorted vcArray; key varchar2(1); begin for i in 1 .. length(p_string) loop ch := substr(p_string, i, 1); if (sorted.exists(ch)) then sorted(ch) := sorted(ch) || ch; else sorted(ch) := ch; end if; end loop; rv := ''; key := sorted.FIRST; WHILE key IS NOT NULL LOOP rv := rv || sorted(key); key := sorted.NEXT(key); END LOOP; return rv; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CUSTOMER_TRANID_X ON CUSTOMER_EDIT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CCTR_BREAKUP_AMT (input_str IN VARCHAR2) RETURN NUMBER IS total NUMBER := 0; BEGIN FOR x IN (SELECT REGEXP_SUBSTR(input_str, '[^,]+', 1, LEVEL) AS value FROM DUAL CONNECT BY LEVEL <= REGEXP_COUNT(input_str, ',') + 1) LOOP total := total + NVL(TO_NUMBER(REGEXP_SUBSTR(x.value, '\d+(\.\d+)?$', 1, 1)), 0); END LOOP; RETURN total; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STK_PLAN (as_site_code in char, as_item_code in char, ad_from_date in date, as_plan_prod in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = as_site_code and a.item_code = as_item_code and instr(as_plan_prod,b.plan_prod) > 0; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity - nvl(a.alloc_qty,0)) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = as_site_code and a.item_code = as_item_code and instr(as_plan_prod,b.plan_prod) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.item_code = as_item_code and a.site_code = as_site_code and a.tran_date > ad_from_date and instr(as_plan_prod,c.plan_prod) > 0); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALC_EXPIRY (adt_mfg_date in date,ad_months in number) return date is ldt_mfg_date date; ldt_exp_date date; year_part number(5); month_part number(5); day_part number(5); ad_mon number(5); begin if ad_months < 0 then ad_mon := ad_months + 1; else ad_mon := ad_months - 1; end if; ldt_mfg_date := add_months(adt_mfg_date,ad_months); ldt_exp_date := last_day(ldt_mfg_date); if ad_mon < 0 then select trunc(ldt_exp_date,'MM') into ldt_exp_date from dual; end if; return ldt_exp_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TRACK_STATUS (as_porcpno char, as_teststat in char) RETURN NUMBER IS ls_workorder workorder.work_order%type; ll_status_cnt number(6) := 0; ll_update_cnt number(6) := 0; ll_retval number(1) := 0; BEGIN if as_teststat = 'P' or as_teststat = 'F' then begin SELECT work_order into ls_workorder FROM workorder_receipt WHERE tran_id = as_porcpno; if ls_workorder is not null and length(trim(ls_workorder)) > 0 then begin select count(1) into ll_status_cnt from wo_track_status where ref_id = ls_workorder; exception when others then ll_status_cnt := 0 ; end; begin select count(1) into ll_update_cnt from wo_track_update where ref_id = ls_workorder and case when STATUS_FLAG is null then '2' else STATUS_FLAG end = '1'; exception when others then ll_update_cnt := 0 ; end; if ll_update_cnt < ll_status_cnt and ll_status_cnt > 0 then ll_retval := 1 ; end if; ELSE ll_retval := 0 ; END if; exception when others then ll_retval := 0 ; end; end if; RETURN ll_retval ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_STATUS ( lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char, lloc_from in char, lloc_to in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code >= lloc_from and a.loc_code <= lloc_to and instr(lavailable,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code >= lloc_from and a.loc_code <= lloc_to and instr(lavailable,b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code >= lloc_from and a.loc_code <= lloc_to and a.tran_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code >= lloc_from and a.loc_code <= lloc_to and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and a.loc_code >= lloc_from and a.loc_code <= lloc_to and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.tran_date > ad_from_date and a.loc_code >= lloc_from and a.loc_code <= lloc_to and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AR_STATUSDESR (Vi_Tran_Id_1 In VARCHAR2) Return Varchar2 Is History_Descr Varchar2(200); Vi_Use_Flag Char(1); Vi_Tran_Id varchar2(15); Vi_Status char(1); Vi_Wrkflw_Status char(1); vi_auth_sign char(1); Vi_EMP_CODE VARCHAR2(10); sign_date VARCHAR2(10); ls_emp_fname VARCHAR2(10); ls_emp_mname VARCHAR2(10); ls_emp_lname VARCHAR2(10); historyFormat VARCHAR2(200); empCode VARCHAR2(10); fullName VARCHAR2(50); signStatus CHAR(1); reportTo VARCHAR2(10); reportToAdmin VARCHAR2(10); reportToFullName VARCHAR2(200); reportToAdminFullName VARCHAR2(200); counter number; BEGIN Vi_Tran_Id := trim(Vi_Tran_Id_1) ; Select status , wrkflw_status, auth_sign, report_to, report_to__admin Into vi_status , Vi_Wrkflw_Status , Vi_Auth_Sign, reportto, reporttoadmin From attd_regularize Where Tran_Id = Vi_Tran_Id; if Vi_Status is null then -- Transaction is done form old portal application if Vi_Wrkflw_Status = 'A' then History_Descr := 'Approved'; elsif Vi_Wrkflw_Status = 'C' then History_Descr := 'Cancelled'; elsif Vi_Wrkflw_Status = 'D' then History_Descr := 'Rejected'; elsif Vi_Wrkflw_Status = 'R' then History_Descr := 'Requested'; elsif Vi_Wrkflw_Status = 'X' then History_Descr := 'Cancellation pending'; end if; return History_Descr; end if; IF Vi_Status = 'C' THEN IF Vi_Wrkflw_Status='X' THEN History_Descr := 'Cancelled'; ELSE History_Descr := 'Rejected'; END IF; elsif Vi_Status = 'A' then History_Descr := 'Approved'; elsif vi_auth_sign = 'R' then Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'AR_RE_SIGN' ; if(counter>0) then Select sign_status Into signStatus From ( Select sign_status From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'AR_RE_SIGN' order by line_no desc )a where rownum = 1 ; if(signStatus='U') then History_Descr := 'Pending from Recommender' ; elsif (signStatus='R') then History_Descr := 'Rejected' ; elsif (reportto <> reporttoadmin) then Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'AR_AP_SIGN' ; if(counter>0) then Select sign_status Into signStatus From ( Select sign_status From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'AR_AP_SIGN' order by line_no desc ) a where rownum = 1; if(signStatus='U') then History_Descr := 'Pending from Approver' ; elsif (signStatus='R') then History_Descr := 'Rejected' ; else History_Descr := 'Pending for System Process' ; end if; end if; end if; else History_Descr := 'Pending from Recommender' ; end if; elsif vi_auth_sign = 'A' then Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'AR_AP_SIGN' ; if(counter>0) then Select sign_status Into signStatus From ( Select sign_status From Obj_Sign_Trans Where Ref_Ser = 'AR' And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'AR_AP_SIGN' order by line_no desc ) a where rownum = 1; if(signStatus='U') then History_Descr := 'Pending from Approver' ; elsif (signStatus='R') then History_Descr := 'Rejected' ; else History_Descr := 'Pending for System Process' ; end if; else History_Descr := 'Pending from Approver' ; end if; end if; if History_Descr is null or length(trim(History_Descr)) = 0 then History_Descr := 'Pending for System Process' ; end if; return History_Descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSUNDRY_NAME (lsundry_type in char,lsundry_code in char,lname in char) return char is ls_name char(60); ls_fname char(20); ls_mname char(20); ls_lname char(20); begin if lsundry_type ='O' then ls_name := ' '; elsif lsundry_type ='T' then if lname = 'C' then select chq_name into ls_name from transporter where tran_code = lsundry_code; else select tran_name into ls_name from transporter where tran_code = lsundry_code; end if; elsif lsundry_type = 'B' then select bank_name into ls_name from bank where bank_code = lsundry_code; elsif lsundry_type = 'X' then select tauth_name into ls_name from tax_authority where tauth_code = lsundry_code; elsif lsundry_type = 'E' then select nvl(trim(rtrim(emp_fname)),' ')||' '||nvl(trim(rtrim(emp_lname)),' ') ||' '||nvl(trim(rtrim(emp_mname)),' ') into ls_name from employee where emp_code = lsundry_code; elsif lsundry_type = 'P' then if lname = 'C' then select chq_name into ls_name from sales_pers where sales_pers = lsundry_code; else select sp_name into ls_name from sales_pers where sales_pers = lsundry_code; end if; elsif lsundry_type ='S' then if lname = 'C' then select chq_name into ls_name from supplier where supp_code = lsundry_code; else select supp_name into ls_name from supplier where supp_code = lsundry_code; end if; elsif lsundry_type ='C' then if lname = 'C' then select chq_name into ls_name from customer where cust_code = lsundry_code; else select cust_name into ls_name from customer where cust_code = lsundry_code; end if; elsif lsundry_type = 'L' then if lname = 'C' then select chq_name into ls_name from loanparty where party_code = lsundry_code; else select party_name into ls_name from loanparty where party_code = lsundry_code; end if; elsif lsundry_type = 'R' then select nvl(trim(rtrim(first_name)),' ')||' '||nvl(trim(rtrim(middle_name)),' ') ||' '||nvl(trim(rtrim(last_name)),' ') into ls_name from STRG_CUSTOMER where SC_CODE = lsundry_code; end if; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_SUNDRYPAN (as_sundry_type char,as_sundry_code char) return varchar2 is ls_sundrypan varchar2(30); begin if as_sundry_type='T' then select pan_no into ls_sundrypan from transporter where tran_code = as_sundry_code; elsif as_sundry_type='S' then select pan_no into ls_sundrypan from supplier where supp_code = as_sundry_code; elsif as_sundry_type='P' then select pan_no into ls_sundrypan from sales_pers where sales_pers = as_sundry_code; elsif as_sundry_type = 'R' then select pan_no into ls_sundrypan from strg_customer where sc_code=as_sundry_code; else ls_sundrypan :=' '; end if ; return ls_sundrypan; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CCTR_ANAL_X ON CCTR_ANAL (CCTR_CODE, ANAL_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_TNC_ACCEPT ON TNC_ACCEPT (USER_CODE, TNC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DESPATCH_CONSISTENCY BEFORE insert or UPDATE ON despatch referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_despatchcount number(3) := 0; ll_count number(6) := 0; ll_mismatchcount number(3) := 0; ls_msg varchar2(4000); lc_allocqty invalloc_trace.alloc_qty%type := 0; ls_allocflag char(1); BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_despatchcount from despatchdet d, item i where d.item_code = i.item_code and d.desp_id = :new.desp_id and i.stk_opt <> '0'; exception when others then ll_despatchcount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'S-DSP' and ref_id = :new.desp_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_despatchcount then raise_application_error( -20601, 'Invtrace not updated for all the details trace count [' || to_char(ll_invcount) || '] detail count [' || to_char(ll_despatchcount) ||']'); end if; begin select alloc_flag into ls_allocflag from sorder where sale_order = :new.sord_no; exception when others then ls_allocflag := 'Y'; end; --- 30-jun-2025 manoharan check for any order line qty_desp is more than quantity begin select count(1) into ll_mismatchcount from ( select d.sord_no, d.line_no__sord, sum(nvl(d.quantity_real,d.quantity)) as desp_qty, s.quantity from despatchdet d, sorditem s where d.sord_no = s.sale_order and d.line_no__sord = s.line_no and s.line_type = 'I' and d.sord_no = :new.sord_no group by d.sord_no, d.line_no__sord,s.quantity having sum(d.quantity_real) > s.quantity ) ; exception when others then ll_mismatchcount := 0; end; if ll_mismatchcount > 0 then raise_application_error( -20601, 'Despatch quantity exceeds order quantity'); end if; -- check invalloc_trace ll_mismatchcount := 0; ls_msg := ''; /* if ls_allocflag <> 'M' then for cur_despdet in ( select LINE_NO, SORD_NO,LINE_NO__SORD,EXP_LEV,ITEM_CODE,LOT_NO,LOT_SL,LOC_CODE from despatchdet where desp_id = :new.desp_id ) loop begin lc_allocqty := 0; begin select sum(ALLOC_QTY) into lc_allocqty from invalloc_trace where ref_ser = 'S-DSP' and ref_id = :new.desp_id and to_number(trim(ref_line)) = to_number(trim(cur_despdet.line_no )) --(select line_no from despatchdet where LINE_NO__SORD = cur_despdet.LINE_NO__SORD and despatchdet.sord_no = cur_despdet.sord_no and despatchdet.lot_no = cur_despdet.lot_no and despatchdet.lot_sl = cur_despdet.lot_sl and despatchdet.loc_code = cur_despdet.loc_code)--= cur_despdet.line_no ) and item_code = cur_despdet.ITEM_CODE and loc_code = cur_despdet.LOC_CODE and lot_no = cur_despdet.LOT_NO and lot_sl = cur_despdet.LOT_SL; exception when others then lc_allocqty := 0; end; if lc_allocqty <> 0 then ll_mismatchcount := ll_mismatchcount + 1; ls_msg := ls_msg || 'SORD_NO ['||cur_despdet.SORD_NO ||'] ls_allocflag [' || ls_allocflag ||'] Line number [' || cur_despdet.line_no || '] aloc_qty [' || to_char(lc_allocqty) ||'] '; end if; end; end loop; */ if ll_mismatchcount > 0 then raise_application_error( -20601, 'Allocation trace net quantity is non-zero for ' || ls_msg); end if; -- end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE PROC_BOMITEM (bomcode bom.bom_code%type ,assitecode site.site_code%type) is begin declare AllBomItem nvarchar2(4000); AllBomItem1 nvarchar2(4000); itemCodes char(10); ll_cnt number(1) := 0; begin dbms_output.put_line('Hiiiiiiiiiiiiiiiiiiiiiiiii'); select ddf_get_all_bomcodes(bomcode,assitecode) into AllBomItem from dual; dbms_output.put_line('AllBomItem says my length is ' || length(AllBomItem)); begin while (length(AllBomItem) > 0 ) loop dbms_output.put_line('Hi Loop'); select ddf_get_token_MRP(AllBomItem,',') into itemCodes from dual; select count(*) into ll_cnt from MRPbomItems where item_code = itemCodes; if ll_cnt = 0 then dbms_output.put_line('Inserted in MRPbomItems ####.'); dbms_output.put_line('item_code ::-> ' || itemCodes); insert into MRPbomItems(item_code,rundate) values (itemCodes,sysdate); if sqlcode = 0 then AllBomItem1 := substr(AllBomItem,length(itemCodes)+2,LENGTH(AllBomItem)); AllBomItem := AllBomItem1; dbms_output.put_line('After Insert AllBomItem ' || length(AllBomItem)); else dbms_output.put_line(SQLERRM); end if; else AllBomItem1 := substr(AllBomItem,length(itemCodes)+2,LENGTH(AllBomItem)); dbms_output.put_line('Duplicate From proc_BOMITEM'); AllBomItem := AllBomItem1; end if; end loop; end; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER CHECK_SPECIAL_CHAR before insert or update on misc_voucher referencing old as old new as new FOR EACH ROW declare billno MISC_VOUCHER.BILL_NO%type; billno1 MISC_VOUCHER.BILL_NO%type; begin billno:=:new.bill_no; --select bill_no into billno from MISC_VOUCHER where TRAN_ID = :old.tran_id and REGEXP_LIKE(:old.bill_no,'[a-z]|[A-Z]|[0-9]|[-]|[/]'); select Replace(translate(billno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890 -','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into billno1 from dual; if (billno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WOFF (ls_emp_code char, ls_prd_code char) return number is lc_woff number(14,2); ll_wof1 number (2) :=0; ll_wof2 number (2) :=0; ll_wof3 number (2) :=0; ll_wof4 number (2) :=0; begin select nvl(sum(nvl(a.no_days,0)),0) into ll_wof1 from holiday a, employee b, period c where c.code = ls_prd_code and a.hol_tblno = b.hol_tblno and b.emp_code = ls_emp_code and a.hol_date between c.fr_date and c.to_date and a.hol_type ='W'; select nvl(sum(nvl(a.no_days,0)),0) into ll_wof2 from change_holiday d, holiday a, period c where d.emp_code = ls_emp_code and d.hol_tblno = a.hol_tblno and d.hol_date_for = a.hol_date and a.hol_type ='W' and c.code = ls_prd_code and a.hol_date between fr_date and to_date ; select nvl(sum(nvl(a.no_days,0)),0) into ll_wof3 from change_holiday d, holiday a, period c where d.emp_code = ls_emp_code and d.hol_tblno = a.hol_tblno and d.hol_date_for = a.hol_date and a.hol_type ='W' and c.code = ls_prd_code and d.hol_date_to between c.fr_date and c.to_date; select nvl(sum(nvl(a.no_days,0)),0) into ll_wof4 from empleave a ,holiday b, employee c where a.emp_code = ls_emp_code and a.prd_code = ls_prd_code and a.lve_code not in ('CL','SL') and a.status = 'A' and a.use_flag = 'C' and a.emp_code = c.emp_code and b.hol_tblno = c.hol_tblno and b.hol_date between a.lve_date_fr and a.lve_date_to and b.hol_type ='W'; return (ll_wof1 - ll_wof2 + ll_wof3 - ll_wof4); end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE VISITPLANMASTER AS OBJECT ( Report_to char(10), Designation VARCHAR2(25) , Visited_with VARCHAR2(80), LEVEL_NO NUMBER(3) ); -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE TFO_EMP_LINK AS OBJECT ( EMP_CODE CHAR(10) ) -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PRICELIST_ORDER_TYPE_EFF_VALID ON PRICELIST (EFF_FROM, VALID_UPTO, ORDER_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SPRS_ROUTE_SPRS_LOC ON SPRS_ROUTE (SPRS_CODE, LOCALITY_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITEM_LOT_DOCKEY ON MIN_RATE_HISTORY (ITEM_CODE, LOT_NO, SITE_CODE, DOC_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRY_DETAILS ( ls_sundry_type in char, ls_sundry_code in char ) return varchar2 is ls_val varchar2(200); ls_name varchar2(40); ls_addr1 varchar2(40); ls_addr2 varchar2(40); ls_addr3 varchar2(40); ls_city varchar2(20); ls_pin varchar2(10); begin if ls_sundry_type = 'C' then select cust_name, addr1, addr2, addr3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin from customer where cust_code = ls_sundry_code; ElsIf ls_sundry_type = 'S' then Select supp_name, addr1, addr2, addr3, city, pin into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin From supplier Where supp_code = ls_sundry_code; ElsIf ls_sundry_type = 'L' Then Select party_name, addr1, addr2, addr3, city, pin Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin From loanparty Where party_code = ls_sundry_code; ElsIf ls_sundry_type = 'X' Then Select tauth_name, addr1, addr2, addr3, city, pin Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin From tax_authority Where tauth_code = ls_sundry_code; ElsIf ls_sundry_type = 'P' Then Select sp_name, addr1, addr2, addr3, city, pin Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin From sales_pers Where sales_pers = ls_sundry_code; ElsIf ls_sundry_type = 'T' Then Select tran_name, addr1, addr2, addr3, city, pin Into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin From transporter Where tran_code = ls_sundry_code; End If; ls_name := nvl(ls_name, ' '); ls_addr1 := nvl(ls_addr1,' '); ls_addr2 := nvl(ls_addr2,' '); ls_addr3 := nvl(ls_addr3,' '); ls_city := nvl(ls_city, ' '); ls_pin := nvl(ls_pin, ' '); ls_val := ls_name || '~n' || ls_addr1 || '~n' || ls_addr2 || '~n' || ls_addr3 || '~n' || ls_city || '~n' || ls_pin; Return ls_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DATEWISE_RX_COUNT ( AS_STRG_CODE CHAR,AS_TRAN_DATE date,as_brand_code in VARCHAR2,as_tran_id in VARCHAR2) Return Char Is datewise_Rx_Cnt NUMBER; Begin Select SUM(OUTCOME_NUM) Into Datewise_Rx_Cnt From Sprs_Campgn_Items Items,Sprs_Campgn Sp where Sp.Tran_Id =Items.Tran_Id AND Items.Strg_Code=AS_STRG_CODE AND Sp.Tran_Date=AS_TRAN_DATE And Sp.Tran_Type='P' AND Items.Tran_Id=as_tran_id and Items.item_code IN ( select item_code from item where brand_code = as_brand_code ) ; Return datewise_Rx_Cnt; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CHM_SPEECH_SURVEY_X ON CHM_SPEECH_SURVEY (EMAIL_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALES_PERS_SER_SHORT_ID ON STRG_SERIES (SALES_PERS, ITEM_SER, SHORT_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AVG_CONSUMP_ITEM_GRADE (as_site_code site.site_code%type, as_item_code item.item_code%type, mstkdtto invtrace.tran_date%type,as_grade invtrace.grade%type) return number is ad_fr_date date; an_eff_qty number; an_months number; avg_sum number; begin select fr_date into ad_fr_date from acctprd where mstkdtto between fr_date and to_date; select sum(decode(sign(eff_qty),-1,eff_qty * -1,0)) into an_eff_qty from invtrace where invtrace.site_code = as_site_code and invtrace.item_code = as_item_code and invtrace.grade = as_grade and tran_date between ad_fr_date and mstkdtto; select months_between(mstkdtto, ad_fr_date) into an_months from dual; avg_sum := an_eff_qty/an_months; return avg_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CONSIGNEE_ADD ( as_sundry_dtls varchar2) return varchar2 is newAddress varchar2(2000); ls_data varchar2(300) ; ls_data1 varchar2(300); ls_datanew varchar2(300); as_sundry_dtls1 varchar2(5000) := as_sundry_dtls; begin if as_sundry_dtls1 is not null and length(trim(as_sundry_dtls1)) > 0 then while length(as_sundry_dtls1) > 0 loop ls_data1 := DDF_GET_TOKEN(as_sundry_dtls1,'|'); dbms_output.put_line('ls_data1 ::::::::))))))' || ls_data1); ls_data := ls_data || ls_data1 || chr(10); ls_datanew := substr(as_sundry_dtls1,length(ls_data1)+2,LENGTH(as_sundry_dtls1)); as_sundry_dtls1 := ls_datanew; end loop; newAddress := ls_data; end if; return newAddress; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_WO_ISS_DEMAND (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_SUNDRY_CODE__FOR (as_acct_code in char, as_sundry_code__for in char) return varchar2 is ls_retval char(1); begin if (as_acct_code in ('3327','3351','3352','3353','3354','3355','3356','3357','3358','3332') and nvl(trim(as_sundry_code__for),'$') = '$' ) then ls_retval := '1'; else ls_retval := '0'; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_KRATABLEDET ON KRATABLEDET (KRA_TABLE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EMPLEAVE_DATE (Vi_Tran_Id In EMPLEAVE.TRAN_ID%TYPE, Vi_Date_From In Date, Vi_Date_To In Date) Return Number Is Result_Val Number; vi_count number; Begin Begin Select Count(Tran_Id) As Count1 Into Vi_Count From Empleave Where Tran_Id = Vi_Tran_Id and ((EMPLEAVE.LVE_DATE_FR >= Vi_Date_From AND EMPLEAVE.LVE_DATE_FR <= Vi_Date_To) OR (EMPLEAVE.LVE_DATE_TO >= Vi_Date_From AND EMPLEAVE.LVE_DATE_TO <= Vi_Date_To) OR (Vi_Date_From between EMPLEAVE.LVE_DATE_FR and EMPLEAVE.LVE_DATE_TO ) OR (Vi_Date_To between EMPLEAVE.LVE_DATE_FR and EMPLEAVE.LVE_DATE_TO ) ) ; If(Vi_Count > 0 )Then Result_Val := 1; Else Result_Val := 0; End If; Exception When No_DatA_Found Then Result_Val := 2; End; RETURN Result_Val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_SORDER_CONSISTENCY BEFORE INSERT OR UPDATE OF CONFIRMED ON SORDER REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE BEGIN IF INSERTING AND :NEW.CONFIRMED = 'Y' THEN --CHANGED BY KANDARP ON 12/JAN/19 TO ENSURE RECORD IS NOT GETTING INSERTED IN CONFIRMED MODE RAISE_APPLICATION_ERROR( -20601, 'INCONSISTENT CONFIRMATION DETECTED, CONFIRMATION CAN NOT BE YES WHILE ADDING NEW RECORD'); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UTL_QMS_DATA_X ON UTL_QMS_DATA (SR_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PURC_TAXDET (ls_tran_id varchar2,ls_ser varchar2,ls_exch number ,ls_grp varchar2 ) return decimal is ls_tax_amt decimal(12,2) ; begin SELECT SUM((nvl(tax_amt,0) * ls_exch )) into ls_tax_amt FROM TAXTRAN , TAX WHERE trim(TAXTRAN.TRAN_CODE)=trim( ls_ser) AND TAXTRAN.TRAN_ID= ls_tran_id and trim(tax.bal_group) = trim( ls_grp) AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TAX_AMT <> 0 ; return trim(ls_tax_amt) ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TOTAL_PARCEL (as_tran_id char) return number is ls_ret_total number(14,3); begin select sum(inv_pack_rcp.no_art) into ls_ret_total from inv_pack_rcp where inv_pack_rcp.tran_id between as_tran_id and as_tran_id and inv_pack_rcp.line_no in(select line_no from (select distinct inv_pack_rcp.pack_instr,min(inv_pack_rcp.line_no) as line_no from inv_pack_rcp where inv_pack_rcp.tran_id between as_tran_id and as_tran_id group by inv_pack_rcp.pack_instr)); return ls_ret_total; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_SL_BANK_STMT ( ad_ason in date, as_sundrycode in char, as_sundrytype in char, as_sitecode in char ) return number is lc_day_op_bal number(14,3) ; lc_prd_op_bal number(14,3); lc_dr_amt number(14,3); lc_cr_amt number(14,3); ls_prd char(6); ls_acct_prd char(6); ld_fr_date date; begin select code, acct_prd ,fr_date into ls_prd, ls_acct_prd, ld_fr_date from period where ad_ason between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and sundry_type = as_sundrytype and sundry_code = as_sundrycode and site_code = as_sitecode; select nvl(sum(amount),0) into lc_cr_amt from banktran_log where tran_type = 'P' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode ; select nvl(sum(amount),0) into lc_dr_amt from banktran_log where tran_type = 'R' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode; lc_day_op_bal := lc_dr_amt - lc_cr_amt ; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal ; return lc_day_op_bal ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_EMP_DETAILS (AS_EMP_CODE char,AS_TYPE char) return char is a_cadre employee.cadre%type; a_grade employee.grade%type; a_GROSS employee.gross%type; a_emp_site employee.emp_site%type; a_dept_code employee.dept_code%type; a_work_site employee.work_site%type; a_FUNC_GROUP emp_employ_events.FUNC_GROUP__FR%type; a_wrk_site employee.work_site%type; a_work_shift employee.work_shift%type; a_DESIGN__FROM emp_employ_events.DESIGN__FROM%type; a_dept_descr DEPARTMENT.DESCR%type; a_hr_descr DEPARTMENT.DESCR%type; a_location DEPARTMENT.DESCR%type; a_status varchar2(60); -- a_GROSS varchar2(20); a_eff_date date; a_conf_date date; a_chg_date date; a_count number(5); begin select COUNT(*) into a_count from emp_employ_events where emp_code = AS_EMP_CODE; DBMS_OUTPUT.PUT_LINE('a_count'); DBMS_OUTPUT.PUT_LINE(a_count); if a_count > 0 then select MIN(EMP_EMPLOY_EVENTS.EFF_DATE) into a_eff_date from emp_employ_events where emp_code = AS_EMP_CODE; DBMS_OUTPUT.PUT_LINE('a_eff_date'); DBMS_OUTPUT.PUT_LINE(a_eff_date); select SITE_CODE__WRK_FR,DEPT_CODE__FR,DESIGN__FROM,trim(to_char(GROSS_FR,'9999999999')),GRADE_CODE_FR,(case when FUNC_GROUP__FR is null then '' else FUNC_GROUP__FR end) into a_work_site,a_dept_code,a_DESIGN__FROM,a_GROSS,a_grade,a_FUNC_GROUP from emp_employ_events where emp_code = AS_EMP_CODE and eff_date = a_eff_date; DBMS_OUTPUT.PUT_LINE('a_GROSS 1'); DBMS_OUTPUT.PUT_LINE(a_GROSS); select case when d.descr is null then ' ' else d.descr end INTO a_dept_descr from department d where d.DEPT_CODE = a_dept_code; DBMS_OUTPUT.PUT_LINE('a_dept_descr 1'); DBMS_OUTPUT.PUT_LINE(a_dept_descr); SELECT case when UDF2 is null then ' ' else UDF2 end into a_location FROM SITE WHERE SITE_CODE = a_work_site; DBMS_OUTPUT.PUT_LINE('a_location 1'); DBMS_OUTPUT.PUT_LINE(a_location); -- select (case when descr is null then ' ' else descr end) INTO a_hr_descr from department where DEPT_CODE = a_FUNC_GROUP; begin select (case when descr is null then ' ' else descr end) INTO a_hr_descr from department where DEPT_CODE = a_FUNC_GROUP AND dept_type='F'; EXCEPTION WHEN NO_DATA_FOUND THEN a_hr_descr := ' '; END; -- select case when e.descr is null then ' ' else e.descr end INTO a_hr_descr from department E where E.DEPT_CODE = a_FUNC_GROUP; DBMS_OUTPUT.PUT_LINE('a_HR_descr 1'); DBMS_OUTPUT.PUT_LINE(a_hr_descr); ELSE DBMS_OUTPUT.PUT_LINE('a_GROSS 222'); DBMS_OUTPUT.PUT_LINE(a_GROSS); select work_site,DEPT_CODE,DESIGNATION,trim(to_char(GROSS,'9999999999')),GRADE,FUNC_GROUP into a_work_site,a_dept_code,a_DESIGN__FROM,a_GROSS,a_grade,a_FUNC_GROUP from EMPLOYEE where emp_code = AS_EMP_CODE; DBMS_OUTPUT.PUT_LINE('a_DESIGN__FROM'); DBMS_OUTPUT.PUT_LINE(a_DESIGN__FROM); select d.descr INTO a_HR_descr from department d where DEPT_CODE = a_FUNC_GROUP and dept_type='F'; DBMS_OUTPUT.PUT_LINE('a_HR_descr'); DBMS_OUTPUT.PUT_LINE(a_HR_descr); select d.descr INTO a_dept_descr from department d where DEPT_CODE = a_dept_code; SELECT UDF2 into a_location FROM SITE WHERE SITE_CODE = a_work_site; DBMS_OUTPUT.PUT_LINE('a_dept_descr'); DBMS_OUTPUT.PUT_LINE(a_dept_descr); end if; DBMS_OUTPUT.PUT_LINE('a_GROSS 2'); DBMS_OUTPUT.PUT_LINE(a_GROSS); if (AS_TYPE = 'H') then a_status := a_HR_descr; elsif (AS_TYPE = 'G') then a_status := a_grade; elsif (AS_TYPE = 'F') then a_status := a_DESIGN__FROM; elsif (AS_TYPE = 'D') then a_status := a_dept_descr; elsif (AS_TYPE = 'L') then a_status := a_location; elsif (AS_TYPE = 'S') then a_status := trim(to_char(a_GROSS,'9999999999.00')); end if; DBMS_OUTPUT.PUT_LINE('A_STATUS'); DBMS_OUTPUT.PUT_LINE(A_STATUS); RETURN A_STATUS; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NUMTOWORD_TIME (var1 in number) return varchar2 is amt number; strt number; val number; var number; str varchar2(15); c_str varchar2(400); flag number:=0; begin var:=var1; val:=round(var,2); amt:=floor(val); str:=to_char(amt); if var1 = 0 then c_str :='Zero Hrs Zero Min'; else if val > 0 then if length(str) >= 8 and length(str) <=10 then strt:=(length(str)-7); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' '; amt:=to_number(substr(to_char(amt),(strt+1),7)); flag:=0; end if; str:=to_char(amt); if ((length(str) >= 6 and length(str) <= 7) or flag = 1) then strt:=(length(str) - 5); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' '; amt:=to_number(substr(to_char(amt),(strt+1),5)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 5 ) or flag = 1) then c_str:=c_str || initcap(case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end); end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := case when c_str = '' or c_str is null then 'Zero Hrs and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end || ' Min' else c_str || ' Hrs ' || 'and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end || ' Min' end; else c_str := c_str || ' Hrs ' || ' Only'; end if; end if; return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_COMPETETOR_DESCR ( as_comp_code char) return varchar2 is ls_descr varchar2(60); begin begin select descr into ls_descr from competetor where comp_code = as_comp_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_QCTRF_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON qc_transfer referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_qccount number(3) := 0; ll_count number(6) := 0; lc_effqty number(14,3) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_qccount from qc_transfer s, item i where s.item_code = i.item_code and s.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_qccount := 0; end; begin select count(1),sum(eff_qty) into ll_invcount, lc_effqty from invtrace where ref_ser = 'QC-TRF' and ref_id = :new.tran_id; exception when others then ll_invcount := 0; end; if ll_qccount > 0 and (ll_invcount <= 0 or lc_effqty <> 0 )then raise_application_error( -20601, 'Invtrace not updated for all the details'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_DENOMINATION ( p_denomination IN NUMBER -- (2.DENOMINATION) ) RETURN NUMBER IS v_result NUMBER := 0; -- Default to invalid BEGIN -- Input parameter validation IF p_denomination IS NULL THEN -- Return 0 for null input RETURN 0; END IF; -- Check if denomination is greater than 0 IF p_denomination > 0 THEN v_result := 1; -- Valid denomination ELSE v_result := 0; -- Invalid denomination END IF; RETURN v_result; EXCEPTION WHEN OTHERS THEN -- Log error if needed -- Return 0 to indicate validation failure RETURN 0; END FN_CHECK_DENOMINATION; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GRADE_DESC ( as_grade_code char) return varchar is ls_val varchar ( 200 ) ; begin select descr into ls_val from grade where grade_code = as_grade_code; return ls_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_DETAILS_TRAN_LINE (ls_tran_code in char,ls_tran_id in char, ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value char(30); as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(abs(tax_amt),0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select avg(abs(tax_perc )) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select sum(abs(taxable_amt)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then select exch_rate into lc_exch_rate from invoice where invoice_id = ls_tran_id ; if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_REGION_DESCR (marea_code in char) return char is mregion_code char(5); mregion_descr varchar2(40); begin select level_code__parent into mregion_code from hierarchy where level_code = marea_code; select level_descr into mregion_descr from hierarchy where level_code = mregion_code; return mregion_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TRANSIT_RCPDT (sitedlv in char,issdate in date,issueid in char) return char is rcpdt date; begin select tran_date into rcpdt from distord_rcp where site_code = sitedlv and tran_date >= issdate and substr(remarks,1,10) = issueid and confirmed = 'Y'; return rcpdt; exception when no_data_found then return null; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DISPLAY_LAST_REMARK (as_sales_pers IN CHAR ,as_strg_code IN CHAR ) return varchar2 is last_meet_summ varchar2 (120); begin select sm.remarks into last_meet_summ from strg_meet sm where sm.sales_pers=as_sales_pers and sm.event_date=(select max(event_date) from strg_meet where sales_pers=SM.SALES_PERS and strg_code=sm.strg_code and remarks is not null) and sm.strg_code=as_strg_code and sm.remarks is not null AND ROWNUM=1; return last_meet_summ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE IOSUNDRYMASTERTABLE AS TABLE OF iosundryMaster -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_LANDING_RATE_NEW (as_itemcode in char,P_MONTH in char,P_YEAR IN CHAR) Return Number Is landing_rate Number(14,3); Begin Begin Select Coalesce(Landing_Rate,0) Into landing_rate From Landing_Rate_mst Where Item_Code = as_itemcode And TO_DATE(P_YEAR||P_MONTH||'01','YYYYMMDD') Between Eff_From And Valid_Upto; Exception When No_Data_Found Then landing_rate :=0; End; Return landing_rate; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SALE_QTY ( tranId IN varchar, lineNo IN number ) return number is sale_qty number(14,3); begin select sum(b.quantity) into sale_qty from invoice a, invoice_trace b, charge_back cb, charge_back_det cd where a.invoice_id = b.invoice_id and cb.tran_id = cd.tran_id and cb.tran_id = tranId and a.cust_code = ( select cust_code from charge_back where tran_id = tranId ) and a.site_code = ( select site_code from charge_back where tran_id = tranId ) and a.tran_date <= ( select tran_date from charge_back where tran_id = tranId ) and b.item_code = ( select item_code from charge_back_det where tran_id = tranId and line_no = lineNo ) and b.lot_no = ( select lot_no from charge_back_det where tran_id = tranId and line_no = lineNo ) and a.confirmed = 'Y'; return(sale_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DATE_YEAR (as_tran_date IN VARCHAR2) RETURN VARCHAR2 IS tran_date DATE; current_date VARCHAR2(2); current_year VARCHAR2(4); result VARCHAR2(6); BEGIN -- Convert input string to a date tran_date := TO_DATE(as_tran_date, 'DD-MM-YY'); -- Extract day and year current_date := TO_CHAR(tran_date, 'DD'); current_year := TO_CHAR(tran_date, 'YYYY'); -- Concatenate day and year result := current_date || current_year; RETURN result; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ISATTACHMENT (as_tran_id char,as_refSer char) return char is ls_val char(3); cnt number(10); begin select count(*) into cnt from doc_contents where doc_id in(select doc_id from doc_transaction_link where ref_id=as_tran_id and ref_ser=as_refser); if(cnt =0 and as_refser='T-CST' ) then select count(*) into cnt from doc_contents where doc_id in(select doc_id from doc_transaction_link where ref_id=as_tran_id and ref_ser='es3seq'); end if; if cnt > 0 then ls_val:='YES'; else ls_val:='NO'; end if; return ls_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROCESS_ACTIONS_X ON PROCESS_ACTIONS (ACTION_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE STOCK_SUMMARY_CREATE ( MSITE_CODE IN CHAR , MITEM_CODE IN CHAR , MLOC_CODE IN CHAR, MINV_STAT IN CHAR , MQTY IN NUMBER , MALLOC_QTY NUMBER, MOLD_QTY IN NUMBER, MOLD_ALLOC_QTY IN NUMBER, MACT IN CHAR) AS CTR NUMBER:=0; BEGIN IF MACT = 'A' THEN SELECT COUNT(*) INTO CTR FROM STOCK_SUMMARY WHERE SITE_CODE = MSITE_CODE AND ITEM_CODE = MITEM_CODE AND LOC_CODE = MLOC_CODE AND INV_STAT = MINV_STAT; IF CTR = 1 THEN UPDATE STOCK_SUMMARY SET QUANTITY = QUANTITY + MQTY, ALLOC_QTY = ALLOC_QTY + MALLOC_QTY WHERE SITE_CODE = MSITE_CODE AND ITEM_CODE = MITEM_CODE AND LOC_CODE = MLOC_CODE AND INV_STAT = MINV_STAT; ELSE INSERT INTO STOCK_SUMMARY( SITE_CODE, ITEM_CODE, LOC_CODE, INV_STAT, QUANTITY, ALLOC_QTY) VALUES( MSITE_CODE, MITEM_CODE, MLOC_CODE, MINV_STAT, MQTY, MALLOC_QTY); END IF; END IF; IF MACT = 'U' THEN UPDATE STOCK_SUMMARY SET QUANTITY = QUANTITY + (MQTY - MOLD_QTY), ALLOC_QTY = ALLOC_QTY + (MALLOC_QTY - MOLD_ALLOC_QTY) WHERE SITE_CODE = MSITE_CODE AND ITEM_CODE = MITEM_CODE AND LOC_CODE = MLOC_CODE AND INV_STAT = MINV_STAT; END IF; IF MACT = 'D' THEN UPDATE STOCK_SUMMARY SET QUANTITY = QUANTITY - MOLD_QTY, ALLOC_QTY = ALLOC_QTY - MOLD_ALLOC_QTY WHERE SITE_CODE = MSITE_CODE AND ITEM_CODE = MITEM_CODE AND LOC_CODE = MLOC_CODE AND INV_STAT = MINV_STAT; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE IOSUNDRYMASTER AS OBJECT ( Sundry_Code VARCHAR2(10), Sundry_Name VARCHAR2(80), City VARCHAR2(40), division varchar2(40), state VARCHAR2(40), order_type VARCHAR2(3) ) -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PIND_QTY ( as_sitecode in char, as_itemcode in char) return number is lc_pindqty number(14,3) := 0; begin begin select sum(quantity) into lc_pindqty from indent where item_code = as_itemcode and site_code__dlv = as_sitecode and status in ( 'A','O' ) ; exception when others then lc_pindqty := 0; end; if lc_pindqty is null then lc_pindqty := 0; end if; return (lc_pindqty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DR_TRAVEL_INSERT AFTER INSERT or update or delete ON SPRS_TRAVEL FOR EACH ROW DECLARE CNT number(10); line_cnt number(10); ls_from_stan_code char(5); ls_stan_code char(5); ls_sales_pers_mgr char(30); ls_old_sales_pers_mgr char(30); ls_locality_code varchar(10); max_line_no number(10); ls_travel_mode_id number(5); ls_from_stan_route_id number(3); ls_work_route_descr VARCHAR(60); ls_from_route_descr varchar(60); ls_locality_type varchar (5); ls_work_locality_descr varchar(60); ls_work_stan_descr varchar(60); ls_visit_order number(3); ls_activity_code char(2); POSTAGE_EXP NUMBER(3); TELEPHONE_EXP NUMBER(3); OTHER_EXP NUMBER(3); dr_main_cnt number(3); sprsacttran_cnt number(3); ls_confirmed char(1); ld_chg_date date; ls_remark VARCHAR(100); ls_chg_user char(10); ls_chg_term char(15); ls_copy_plan char(1); ls_emp_site char(5); ls_dr_visit CHAR(1); ROUTE_TYPE CHAR(1); BEGIN POSTAGE_EXP := 0; TELEPHONE_EXP := 0; OTHER_EXP := 0; dr_main_cnt :=0; cnt :=0; line_cnt:=0; if(:old.sprs_code__ww is not null and length(trim(:old.sprs_code__ww)) > 0 ) then ls_old_sales_pers_mgr := :old.sprs_code__ww; else ls_old_sales_pers_mgr := :old.sales_pers; end if; if deleting then DELETE FROM DR_TRAVEL_DETAILS where WORK_DATE = :old.travel_date and sales_pers = :old.sales_pers and WORK_LOCALITY_CODE= :old.locality_code and SALES_PERS_MGR = ls_old_sales_pers_mgr ; else if(:new.sprs_code__ww is not null and length(trim(:new.sprs_code__ww)) > 0 ) then ls_sales_pers_mgr := :new.sprs_code__ww; else ls_sales_pers_mgr := :new.sales_pers; end if; if ( :new.travel_mode is not null AND length(trim( :new.travel_mode) ) > 0 AND :new.travel_mode= 'ROAD' ) THEN ls_travel_mode_id := 1 ; end if ; if ( :new.travel_mode is not null AND length(trim( :new.travel_mode) ) > 0 AND :new.travel_mode= 'RAIL' ) THEN ls_travel_mode_id := 2 ; end if ; if ( :new.travel_mode is not null AND length(trim( :new.travel_mode) ) > 0 AND :new.travel_mode= 'AIR' ) THEN ls_travel_mode_id := 3 ; end if ; if(ls_travel_mode_id is null) then ls_travel_mode_id := :new.travel_mode; end if; if (:new.dr_visit is not null AND length(trim( :new.dr_visit) ) > 0 ) then ls_dr_visit := :new.dr_visit; else ls_dr_visit := 'N'; end if; select count(*) into dr_main_cnt from DR_MAIN where sales_pers = :new.sales_pers and WORK_DATE = :new.travel_date; select count(*) into sprsacttran_cnt from SPRS_ACT_TRAN where sales_pers = :new.sales_pers and EVENT_DATE = :new.travel_date; if dr_main_cnt = 0 and sprsacttran_cnt > 0 THEN select REMARK, confirmed, chg_date, chg_user, chg_term, copy_plan into ls_remark, ls_confirmed, ld_chg_date, ls_chg_user,ls_chg_term,ls_copy_plan from sprs_act_tran where sales_pers = :new.sales_pers and EVENT_DATE = :new.travel_date; INSERT INTO DR_MAIN(SALES_PERS ,WORK_DATE ,REMARK,SUBMISSION_DATE ,POSTAGE_EXP ,TELEPHONE_EXP ,OTHER_EXP ,LAST_UPDATE ,UPDATED_BY ,CHG_DATE ,CHG_USER ,CHG_TERM ,ACTIVITY_CODE ,COMPLETION_FLAG,copy_plan,CONFIRMATION_FLAG) VALUES (:new.sales_pers ,:new.travel_date ,ls_remark, ld_chg_date,POSTAGE_EXP ,TELEPHONE_EXP ,OTHER_EXP ,ld_chg_date ,:new.sales_pers ,ld_chg_date ,ls_chg_user ,ls_chg_term ,:new.activity_code ,'Y',ls_copy_plan,ls_confirmed) ; END IF; if(updating) then select count(*) into CNT from DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers and WORK_LOCALITY_CODE= :new.locality_code and work_route_id=:new.route_id and SALES_PERS_MGR = ls_sales_pers_mgr ; if CNT > 0 THEN if CNT = 1 THEN DELETE FROM DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers and WORK_LOCALITY_CODE= :new.locality_code and work_route_id=:new.route_id and SALES_PERS_MGR = ls_sales_pers_mgr ; else select count(*) into CNT from DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers and WORK_LOCALITY_CODE= :new.locality_code and work_route_id=:new.route_id and SALES_PERS_MGR = ls_sales_pers_mgr and visit_order=:new.order_of_visit ; if CNT > 0 THEN DELETE FROM DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers and WORK_LOCALITY_CODE= :new.locality_code and work_route_id=:new.route_id and SALES_PERS_MGR = ls_sales_pers_mgr and visit_order=:new.order_of_visit ; END IF; end if; end if; else select count(*) into CNT from DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers and WORK_LOCALITY_CODE= :new.locality_code and work_route_id=:new.route_id and SALES_PERS_MGR = ls_sales_pers_mgr and visit_order=:new.order_of_visit ; if CNT > 0 THEN DELETE FROM DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers and WORK_LOCALITY_CODE= :new.locality_code and work_route_id=:new.route_id and SALES_PERS_MGR = ls_sales_pers_mgr and visit_order=:new.order_of_visit ; END IF; end if; select count(*) into line_cnt from DR_TRAVEL_DETAILS where WORK_DATE = :new.travel_date and sales_pers = :new.sales_pers ; if line_cnt > 0 THEN select max(line_no) into max_line_no from DR_TRAVEL_DETAILS where work_date = :new.travel_date and sales_pers = :new.sales_pers; max_line_no := nvl(max_line_no , 0) + 1; ELSE max_line_no :=1; END IF; begin SELECT DISTINCT (case when ROUTE_DESCR is null then descr else ROUTE_DESCR end ) INTO ls_work_route_descr FROM SPRS_ROUTE WHERE stan_code = :new.stan_code and locality_code=:new.locality_code and route_id=:new.route_id and sprs_code=ls_sales_pers_mgr and status='Y' and ROWNUM=1; end; begin if (:new.route_id_from is not null AND length(trim( :new.route_id_from) ) > 0) then ls_from_stan_route_id :=:new.route_id_from; else ls_from_stan_route_id := -1; end if; end; begin if ( :new.stan_code__from is not null AND length(trim( :new.stan_code__from) ) > 0 and :new.locality_code_from is not null and length(trim( :new.locality_code_from) ) > 0 and :new.route_id_from is not null AND length(trim( :new.route_id_from) ) > 0) THEN SELECT DISTINCT (case when ROUTE_DESCR is null then descr else ROUTE_DESCR end ) INTO ls_from_route_descr FROM SPRS_ROUTE WHERE stan_code = :new.stan_code__from and locality_code =:new.locality_code_from and route_id=:new.route_id_from and ROWNUM=1; end if; end; begin SELECT DISTINCT locality_type,descr INTO ls_locality_type,ls_work_locality_descr FROM locality where locality_code=:new.locality_code ; end; begin select descr INTO ls_work_stan_descr from station where stan_code=:new.stan_code; end; begin SELECT DISTINCT (case when ROUTE_DESCR is null then descr else ROUTE_DESCR end ) INTO ls_work_route_descr FROM SPRS_ROUTE WHERE stan_code = :new.stan_code and sprs_code=ls_sales_pers_mgr and locality_code =:new.locality_code and route_id=:new.route_id and status='Y' and ROWNUM=1; end; begin INSERT INTO DR_TRAVEL_DETAILS ( SALES_PERS , WORK_DATE , WORK_STAN_CODE , FROM_STAN_CODE , TRAVEL_MODE_ID , UPDATED_BY , ACTIVITY_CODE , WORK_ROUTE_ID , FROM_ROUTE_ID , WRK_ROUTE_DESCR , SALES_PERS_MGR , LINE_NO , FROM_ROUTE_DESCR , LOCALITY_TYPE , STATION_TYPE , WORK_STAN_DESCR , WORK_LOCALITY_CODE , WORK_LOCALITY_DESCR,VISIT_ORDER,LAST_UPDATE,NIGHT_STAY,DR_VISITED,ROUTE_TYPE ) VALUES ( :new.sales_pers , :new.travel_date , :new.stan_code ,:new.stan_code__from, ls_travel_mode_id , :new.sales_pers, :new.activity_code, :new.route_id , ls_from_stan_route_id, ls_work_route_descr , ls_sales_pers_mgr , max_line_no , ls_from_route_descr , ls_locality_type , :new.station_type , ls_work_stan_descr , :new.locality_code ,ls_work_locality_descr,:new.order_of_visit,:new.chg_date,'N',ls_dr_visit,:new.ROUTE_TYPE ) ; end; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_FLD_WRK_DY (AS_EMP_CODE IN EMPLOYEE.EMP_CODE%TYPE, AS_PERIOD CHAR) RETURN NUMBER IS LS_CALL_VALUE NUMBER(14,3); FULL_DAY_W NUMBER(14,3); HALF_DAY_W NUMBER(14,3); AS_FR_DATE DATE; AS_TO_DATE DATE; UN_CONFIRM_CNT NUMBER(3); AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; BEGIN select fr_date, to_date into AS_PRD_FR_DATE, AS_PRD_TO_DATE from period where code = AS_PERIOD; SELECT COUNT(1) INTO UN_CONFIRM_CNT FROM SPRS_ACT_TRAN WHERE EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND CONFIRMED = 'Y' AND SALES_PERS = AS_EMP_CODE; if (UN_CONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; SELECT COUNT(EVENT_DATE) INTO FULL_DAY_W FROM SPRS_ACT_TRAN WHERE ACTIVITY_CODE IN (SELECT ACTIVITY_CODE FROM FIELDACTIVITY WHERE ACTIVITY_TYPE ='FW' and ACTIVITY_CODE NOT IN (SELECT COLUMN_VALUE FROM TABLE( CSV_TO_ROW( (select param_value from KPI_PARAM where PARAM_NAME = 'SHINE_HALF_DAYS'))))) AND SALES_PERS = AS_EMP_CODE AND CONFIRMED = 'Y' AND EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE; SELECT (COUNT(EVENT_DATE) / 2) INTO HALF_DAY_W FROM SPRS_ACT_TRAN WHERE ACTIVITY_CODE IN (SELECT ACTIVITY_CODE FROM FIELDACTIVITY WHERE ACTIVITY_TYPE ='FW' and ACTIVITY_CODE IN (SELECT COLUMN_VALUE FROM TABLE( CSV_TO_ROW( (select param_value from KPI_PARAM where PARAM_NAME = 'SHINE_HALF_DAYS'))))) AND SALES_PERS = AS_EMP_CODE AND CONFIRMED = 'Y' AND EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE; LS_CALL_VALUE:= FULL_DAY_W + HALF_DAY_W; RETURN LS_CALL_VALUE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DESPDET_CHAP BEFORE insert or update ON despatchdet FOR EACH ROW DECLARE ls_stk_opt char(1); lc_overshipperc number(14,3) := 0; lc_extraallowed number(14,3) := 0; ls_sotaxchap char(10); ls_soitem char(10); BEGIN begin Select item_code__ord,tax_chap into ls_soitem, ls_sotaxchap From sorddet Where sale_order = :new.sord_no And line_no = :new.LINE_NO__sord ; exception when others then ls_soitem := ' '; ls_sotaxchap := ' '; end; if trim(:new.item_code__ord) = trim(ls_soitem) and trim(:new.tax_chap) <> trim(ls_sotaxchap) then raise_application_error( -20601, 'SO detail item [' || ls_soitem || '] same as despatch item [' || :new.item_code__ord ||'] but SO tax chap [' || trim(ls_sotaxchap) ||'] not matching with despatch ['|| trim(:new.tax_chap) ||']'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SUPPLIER_TAX_X ON SUPPLIER_TAX (SUPP_CODE, FROM_DATE, TO_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LEAVE_CLOSING_BAL (AS_EMP_CODE char,AS_DATE date,AS_LVE_CODE char) return number is a_allowed number(6,1) := 0; a_nodays number(6,1) := 0; a_nodays1 number(6,1) := 0; a_nodays2 number(6,1) := 0; a_eff_date date; a_leave_ends empleave.leave_ends%type; a_leave_starts empleave.leave_starts%type; begin begin select min(eff_date) into a_eff_date from leavebal where emp_code = AS_EMP_CODE and eff_date <= AS_DATE and lve_code = AS_LVE_CODE and exp_date >= AS_DATE; if (a_eff_date is not null) then a_eff_date := to_date('01-'||to_char(a_eff_date,'MON')||'-'||to_char(a_eff_date,'YYYY')); end if; select nvl(sum(nvl(a.no_days,0)),0) into a_nodays from empleave_summary a,period b where a.emp_code = AS_EMP_CODE and a.lve_code = AS_LVE_CODE and b.code = a.prd_code and b.code >= to_char(a_eff_date,'YYYYMM') and b.code <= to_char(AS_DATE,'YYYYMM'); end; begin declare cursor c_lvetrace is select tran_id,lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc from emplve_trace where emp_code = AS_EMP_CODE and lve_date_fr < a_eff_date and lve_code = AS_LVE_CODE and eff_date >= a_eff_date and nvl(use_flag,' ') <> 'F' group by tran_id,lve_date_fr,lve_date_to; begin a_nodays1 := 0; for i in c_lvetrace loop if (i.lve_date_to >= a_eff_date) then a_nodays1 := a_nodays1 + i.lve_aloc - (i.lve_date_to - a_eff_date + 1); select leave_ends into a_leave_ends from empleave where tran_id = i.tran_id; if (a_leave_ends = 'M') then a_nodays1 := a_nodays1 + 0.5; end if; else a_nodays1 := a_nodays1 + i.lve_aloc; end if; end loop; end; declare cursor c_lvetrace is select tran_id,lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc from emplve_trace where emp_code = AS_EMP_CODE and lve_date_to >= a_eff_date and lve_code = AS_LVE_CODE and eff_date < a_eff_date and nvl(use_flag,' ') <> 'F' group by tran_id,lve_date_fr,lve_date_to; begin a_nodays2 := 0; for i in c_lvetrace loop if (i.lve_date_fr < a_eff_date) then a_nodays2 := a_nodays2 + i.lve_aloc - (a_eff_date - i.lve_date_fr); select leave_starts into a_leave_starts from empleave where tran_id = i.tran_id; if (a_leave_starts = 'M') then a_nodays2 := a_nodays2 + 0.5; end if; else a_nodays2 := a_nodays2 + i.lve_aloc; end if; end loop; end; select nvl(sum(nvl(avail_days,0) + nvl(conv_days,0)),0) into a_allowed from leavebal where emp_code = AS_EMP_CODE and eff_date <= AS_DATE and lve_code = AS_LVE_CODE and exp_date >= AS_DATE; end; return (a_allowed + a_nodays2 - a_nodays1 - a_nodays); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TRANTYPE (as_refser in char, as_refid in char) return char is ls_trantype char(3); begin if trim(as_refser) = 'RCP' then select tran_type into ls_trantype from receipt where tran_id = as_refid; else ls_trantype := '@'; end if; return ls_trantype; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_GST_RECOVERY (ls_tranid in char) RETURN NUMBER IS ll_retval number(1):=0; ll_retval2 number(1):=0; ll_retval3 number(1):=0; ls_sql varchar2(4000); ls_trantype char(4); ls_sitecodedlv char(5); ls_sitecodeissue char(5); ls_recovergst char(3); ls_recovertrantype char(3); ls_sitetypeissue char(5); ls_sitetypedlv char(5); begin ll_retval := 1; ls_sitecodedlv := ' '; ls_sitecodeissue := ' '; ls_recovergst := ' '; ls_recovertrantype := ' '; ls_sitetypeissue := ' '; ls_sitetypedlv := ' '; begin select tran_type,site_code__dlv,site_code into ls_trantype,ls_sitecodedlv,ls_sitecodeissue from distord_iss where tran_id =ls_tranid; end; begin select recover_gst ,recover_trantype into ls_recovergst,ls_recovertrantype from distorder_type where tran_type =ls_trantype; end; if ls_recovergst = 'Y' then begin select site_type into ls_sitetypeissue from site where site_code =ls_sitecodeissue; end; begin select site_type into ls_sitetypedlv from site where site_code =ls_sitecodedlv; end; if (ls_sitetypeissue <> 'F' or ls_sitetypeissue <>'M') and ls_sitetypedlv <>'F' then if ls_recovertrantype ='CG' then begin select count(*) into ll_retval2 from site_customer where site_code__ch =ls_sitecodedlv and site_code =ls_sitecodeissue and channel_partner = 'Y' and case when Active_YN is null then 'N' else Active_YN end = 'Y'; end; if ll_retval2 =0 then begin select count(*) into ll_retval3 from customer where site_code = ls_sitecodeissue and case when channel_partner is null then 'N' else channel_partner end = 'Y'; end; if ll_retval3 > 1 then ll_retval := 0; end if; if ll_retval3 = 0 then ll_retval := 0; end if; end if;-- end if of ll_retval2 =0 if ll_retval2 > 1 then ll_retval := 0; end if; end if;--end if ls_recovertrantype ='CG' if ls_recovertrantype ='RG' then begin select count(*) into ll_retval2 from site_supplier where site_code__ch =ls_sitecodedlv and site_code =ls_sitecodeissue and channel_partner = 'Y'; end; if ll_retval2 =0 then begin select count(*) into ll_retval3 from supplier where site_code =ls_sitecodeissue and case when channel_partner is null then 'N' else channel_partner end = 'Y'; end; if ll_retval3 > 1 then ll_retval := 0; end if; if ll_retval3 = 0 then ll_retval := 0; end if; end if;-- end if of ll_retval2 =0 if ll_retval2 > 1 then ll_retval := 0; end if;---end if of ll_retval2 = 1 end if;--end if ls_recovertrantype =RG end if;---recovergst is Y end if; RETURN ll_retval ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_VOUCHDET_BILL_DATE ON MISC_VOUCHDET (BILL_NO, BILL_DATE, SUNDRY_CODE__FOR, SUNDRY_TYPE__FOR, TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SMS_QUERY_CONTEXT_X ON SMS_QUERY_CONTEXT (CONTEXT_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_SUNDRY_YTD (AS_SUNDRY_TYPE CHAR,AS_SUNDRY_CODE CHAR) Return number is sundry_ytd_bal number(14,3); op_bal number(14,3); ld_dr_cr number(14,3); Begin select nvl(SUM(DR_AMT__BASE - CR_AMT__BASE),0) into op_bal from sundrybal where Sundry_Type = AS_SUNDRY_TYPE And Sundry_Code = AS_SUNDRY_CODE AND ACCT_PRD = (Select Code From Acctprd where to_date(sysdate) between fr_date and to_date) AND PRD_CODE < (Select Code From Period where to_date(sysdate) between fr_date and to_date); Select Nvl(Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)),0) into ld_dr_cr from gltrace where sundry_type = AS_SUNDRY_TYPE and sundry_code= AS_SUNDRY_CODE and tran_date >= (Select fr_date From Period where to_date(sysdate) between fr_date and to_date) and tran_date <= to_date(sysdate); sundry_ytd_bal := nvl((op_bal+ld_dr_cr),0); return sundry_ytd_bal; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RCPDISHNR_TDATE_SITE ON RCPDISHNR (SITE_CODE, TRAN_DATE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_ASSET_DEPR (From_Date IN DATE,To_Date IN DATE ,CODE IN char) RETURN NUMBER IS V_Total_Value NUMBER(14,3); LS_VAR DATE; BEGIN SELECT SYSDATE INTO LS_VAR FROM DUAL; IF To_Date = LS_VAR THEN SELECT SUM(total_value) INTO V_Total_Value From asset_register where asset_code = CODE And use_date < From_Date; ELSE Select sum(Total_Value) INTO V_Total_Value FROM asset_register where asset_code=CODE AND use_date >= From_Date AND use_date <= To_Date; END IF; IF V_Total_Value IS NULL THEN V_Total_Value := 0; END IF; RETURN V_Total_Value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_TRAN_DATE_SITE ON INVOICE (TRAN_DATE, SITE_CODE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BOMQTY (as_tran_id in char,as_var_val in char) return varchar is ls_qty number(15); ls_varval varchar2(500); begin select var_value into ls_varval FROM MFGPARM where VAR_NAME = as_var_val; select nvl(SUM( QUANTITY__ALT),0)+nvl(sum(potency_adj),0) into ls_qty from worder_issdet_rnd,item where worder_issdet_rnd.item_code = item.item_code and worder_issdet_rnd.tran_id = as_tran_id and instr(ls_varval,item.grp_code)>0 ; return ls_qty ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RX_COUNT ( AS_STRG_CODE CHAR,as_brand_code in VARCHAR2)Return Char Is RX_CNT NUMBER; Begin select SUM(OUTCOME_NUM) into rx_cnt from sprs_campgn_items where Strg_Code=AS_STRG_CODE and item_code IN ( select item_code from item where brand_code = as_brand_code ); Return RX_CNT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STAN_DESCR (as_misc_vouch_sundry_type char, as_misc_voucher_misc_empcode char) return varchar2 is ls_stan_code varchar2(40); begin if as_misc_vouch_sundry_type='T' then select station.descr into ls_stan_code from transporter , station where transporter.stan_code = station.stan_code and tran_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='B' then select bank.city into ls_stan_code from bank where bank.bank_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='X' then select station.descr into ls_stan_code from tax_authority , station where tax_authority.stan_code = station.stan_code and tauth_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='E' then select station.descr into ls_stan_code from employee , station where employee.stan_code__hq = station.stan_code and emp_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='P' then select station.descr into ls_stan_code from sales_pers , station where sales_pers.stan_code = station.stan_code and sales_pers.sales_pers = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='S' then select station.descr into ls_stan_code from supplier , station where supplier.stan_code = station.stan_code and supp_code =as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='C' then select station.descr into ls_stan_code from customer , station where customer.stan_code = station.stan_code and cust_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='R' then select station.descr into ls_stan_code from strg_customer , station where strg_customer.stan_code = station.stan_code and sc_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='L' then select station.descr into ls_stan_code from loanparty , station where party_code = as_misc_voucher_misc_empcode; elsif as_misc_vouch_sundry_type='D' then select station.descr into ls_stan_code from strg_customer , station where sc_code = as_misc_voucher_misc_empcode; else ls_stan_code:=''; end if; return ls_stan_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083723 ON RESOURCE_CONS (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYROLL_PRD_EMP_SITE_DEPR ON PAYROLL (PRD_CODE, SITE_CODE__PAY, DEPT_CODE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_NM_ADDR (as_type in varchar2, as_code in varchar2) return varchar2 IS as_party varchar2(250); begin if as_type = 'S' then select supp_name||'. ('||nvl(addr1,' ')||', '||nvl(addr2,' ')||', '||nvl(addr3,' ')||', '||nvl(city,' ')||', '||nvl(count_code,' ')||')' INTO as_party from supplier where supp_code = as_code ; elsif as_type = 'C' then select cust_name|| '. ('||nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ')||', '||nvl(city,' ')||', '||nvl(count_code,' ')||')' INTO as_party from customer where cust_code = as_code ; elsif as_type = 'O' then select descr||'. ('||nvl(add1,' ')||', '||nvl(add2,' ')||', '||nvl(add3,' ')||', '||nvl(city,' ')||')' INTO as_party from site where site_code = as_code ; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MINRATE_INSERT BEFORE INSERT ON min_rate_history FOR EACH ROW BEGIN SELECT lpad(to_char(min_rate_seq.nextval),20,'0') INTO :new.unique_id FROM dual; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TF_EMP_LINK_INFO ( AS_EMP_CODE EMPLOYEE.EMP_CODE%TYPE ) RETURN TFT_EMP_LINK PIPELINED IS OUT_REC TFO_EMP_LINK := TFO_EMP_LINK( NULL); LS_EMP_CODE1 EMPLOYEE.EMP_CODE%TYPE; LS_EMP_CODE2 EMPLOYEE.EMP_CODE%TYPE; BEGIN LS_EMP_CODE1 := AS_EMP_CODE; LS_EMP_CODE2 := NULL; WHILE LS_EMP_CODE1 IS NOT NULL LOOP BEGIN OUT_REC.EMP_CODE := LS_EMP_CODE1; pipe row ( out_rec ); LS_EMP_CODE2 := NULL; SELECT EMP_CODE__LINK INTO LS_EMP_CODE2 FROM EMPLOYEE WHERE EMP_CODE = LS_EMP_CODE1; IF LS_EMP_CODE2 IS NULL OR LENGTH(TRIM(LS_EMP_CODE2)) = 0 THEN EXIT; END IF; LS_EMP_CODE1 := LS_EMP_CODE2; END; END LOOP; RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SPECS (as_itemcode in char,as_rettype in char) return varchar2 is ls_specs varchar2(200); ls_itemtype item_type.item_type%type; ls_attrib1 item_type.phy_attrib_1%type; ls_attrib2 item_type.phy_attrib_2%type; ls_attrib3 item_type.phy_attrib_3%type; ls_attrib4 item_type.phy_attrib_4%type; ls_attrib5 item_type.phy_attrib_5%type; ls_attrib6 item_type.phy_attrib_6%type; ls_attrib7 item_type.phy_attrib_7%type; ls_attrib8 item_type.phy_attrib_8%type; ls_attrib9 item_type.phy_attrib_9%type; ls_attrib10 item_type.phy_attrib_10%type; ls_attrib11 item_type.phy_attrib_11%type; ls_attrib12 item_type.phy_attrib_12%type; ls_spec1 item.phy_attrib_1%type; ls_spec2 item.phy_attrib_2%type; ls_spec3 item.phy_attrib_3%type; ls_spec4 item.phy_attrib_4%type; ls_spec5 item.phy_attrib_5%type; ls_spec6 item.phy_attrib_6%type; ls_spec7 item.phy_attrib_7%type; ls_spec8 item.phy_attrib_8%type; ls_spec9 item.phy_attrib_9%type; ls_spec10 item.phy_attrib_10%type; ls_spec11 item.phy_attrib_11%type; ls_spec12 item.phy_attrib_12%type; begin ls_specs := ' '; select a.item_type,a.phy_attrib_1,a.phy_attrib_2,a.phy_attrib_3,a.phy_attrib_4, a.phy_attrib_5,a.phy_attrib_6,a.phy_attrib_7,a.phy_attrib_8, a.phy_attrib_9,a.phy_attrib_10,a.phy_attrib_11,a.phy_attrib_12, b.phy_attrib_1,b.phy_attrib_2,b.phy_attrib_3,b.phy_attrib_4, b.phy_attrib_5,b.phy_attrib_6,b.phy_attrib_7,b.phy_attrib_8, b.phy_attrib_9,b.phy_attrib_10,b.phy_attrib_11,b.phy_attrib_12 into ls_itemtype,ls_spec1,ls_spec2,ls_spec3,ls_spec4, ls_spec5,ls_spec6,ls_spec7,ls_spec8, ls_spec9,ls_spec10,ls_spec11,ls_spec12, ls_attrib1,ls_attrib2,ls_attrib3,ls_attrib4, ls_attrib5,ls_attrib6,ls_attrib7,ls_attrib8, ls_attrib9,ls_attrib10,ls_attrib11,ls_attrib12 from item a, item_type b where a.item_type = b.item_type and a.item_code = as_itemcode ; if ls_attrib1 is not null and length(ltrim(rtrim(ls_attrib1))) > 0 and ls_spec1 is not null and length(ltrim(rtrim(ls_spec1))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec1) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib2 is not null and length(ltrim(rtrim(ls_attrib2))) > 0 and ls_spec2 is not null and length(ltrim(rtrim(ls_spec2))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec2) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib3 is not null and length(ltrim(rtrim(ls_attrib3))) > 0 and ls_spec3 is not null and length(ltrim(rtrim(ls_spec3))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec3) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib4 is not null and length(ltrim(rtrim(ls_attrib4))) > 0 and ls_spec4 is not null and length(ltrim(rtrim(ls_spec4))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec4) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib5 is not null and length(ltrim(rtrim(ls_attrib5))) > 0 and ls_spec5 is not null and length(ltrim(rtrim(ls_spec5))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec5) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib6 is not null and length(ltrim(rtrim(ls_attrib6))) > 0 and ls_spec6 is not null and length(ltrim(rtrim(ls_spec6))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec6) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib7 is not null and length(ltrim(rtrim(ls_attrib7))) > 0 and ls_spec7 is not null and length(ltrim(rtrim(ls_spec7))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec7) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib8 is not null and length(ltrim(rtrim(ls_attrib8))) > 0 and ls_spec8 is not null and length(ltrim(rtrim(ls_spec8))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec8) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib9 is not null and length(ltrim(rtrim(ls_attrib9))) > 0 and ls_spec9 is not null and length(ltrim(rtrim(ls_spec9))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec9) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib10 is not null and length(ltrim(rtrim(ls_attrib10))) > 0 and ls_spec10 is not null and length(ltrim(rtrim(ls_spec10))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec10) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib11 is not null and length(ltrim(rtrim(ls_attrib11))) > 0 and ls_spec11 is not null and length(ltrim(rtrim(ls_spec11))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec11) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib12 is not null and length(ltrim(rtrim(ls_attrib12))) > 0 and ls_spec12 is not null and length(ltrim(rtrim(ls_spec12))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_spec12) ; end if ; ls_specs := ltrim(rtrim(ls_specs)) ; return ls_specs; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DIST_RCP_QTY1 ( ltran_id in char) return number is ld_qty number(14,3); begin begin SELECT SUM(QUANTITY) INTO ld_qty From Distord_Rcpdet Where Tran_Id=Ltran_Id; exception when others then ld_qty := 0; end; Return (Ld_Qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCK_EXPIRY (as_site stock.site_code%type, as_item stock.item_code%type, as_loc stock.loc_code%type, as_lot stock.lot_no%type, as_lotsl stock.lot_sl%type) return date is ld_date date; ld_temp date; begin ld_temp := '01-jan-1947'; select exp_date into ld_date from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and lot_sl = as_lotsl; if sysdate + 14 >= ld_date then return ld_date; else return ld_temp; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EMP_INFO ( as_infotype in char, as_empcode in char) return varchar is info char(250); begin if trim(as_infotype) = 'H' then begin select decode( stan_code__hq, null, stan_code__hq, ' ', stan_code__hq, stan_code__hq ) into info from employee where emp_code = as_empcode; end; end if; if trim(as_infotype) = 'D' then begin select decode( st.descr, null, st.descr, ' ', st.descr, st.descr ) into info from employee e, station st where e.stan_code__hq = st.stan_code(+) and e.emp_code = as_empcode; end; end if; if trim( as_infotype) = 'N' then begin select decode(emp_fname, null, nvl(rtrim(emp_mname),' ')||' '||nvl(rtrim(emp_lname),' ') ||' '||nvl(rtrim(emp_fname),' '), ' ', nvl(rtrim(emp_fname),' ')||' '||nvl(rtrim(emp_mname),' ') ||' '||nvl(rtrim(emp_lname),' '), nvl(rtrim(emp_fname),' ')||' '||nvl(rtrim(emp_mname),' ') ||' '||nvl(rtrim(emp_lname),' ')) into info from employee where emp_code = as_empcode; end; end if; return info; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RWSSCORE_DOC2 (as_sales_pers char, as_from_date date, as_to_date date) return number is ls_return number (14,0); begin begin select count(*) into ls_return from (SELECT sm.strg_code, COUNT(SM.STRG_CODE) as as_count FROM STRG_MEET SM JOIN SALES_PERS S ON SM.SALES_PERS = S.SALES_PERS WHERE SM.EVENT_DATE BETWEEN as_from_date AND as_to_date AND sm.sales_pers=as_sales_pers and SM.STRG_TYPE = 'D' AND SM.STRG_CLASS_CODE = 'E' AND S.ITEM_SER ='OTC' group by sm.strg_code having COUNT(SM.STRG_CODE) >1 )a ; exception when no_Data_found then ls_return:=0; end; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_BOM_USE_INVSTATUS (mwo_type in char, mbom_code in char) return number is mcount number(1) := null; begin if mwo_type in ('F', 'P') then -- validation applies only for Fresh or Packing workorder select nvl(count(1), 0) -- count the number of records in the specified bom into mcount -- where use_invstatus is usable/non-usable from bomdet where bom_code = mbom_code and use_invstatus = 'B'; dbms_output.put_line('Count: '||mcount||'.'); if mcount > 0 then -- if record with non-usable/usable is found return error return 0; else return 1; end if; end if; exception when others then return 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVDRDATE1 (as_lr_date in despatch.lr_Date%type) return number is FLAG NUMBER(1); ls_count number(10,0); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_DESP_LRDT'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then SELECT COUNT(1) into ls_count FROM DUAL WHERE to_date(as_lr_date) < to_date(sysdate); if ls_count = 0 then RETURN 0; Else RETURN 1; end if; else RETURN 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE ORDERMASTER AS OBJECT ( order_no VARCHAR2(10), order_date date, party_code char(10), party_Name VARCHAR2(80), City VARCHAR2(40), division varchar2(40), state VARCHAR2(40) ) -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RWSSCORE_DOC1 (as_sales_pers char, as_from_date date, as_to_date date) return number is ls_return number (14,0); begin begin select count(*) into ls_return from (SELECT sm.strg_code, COUNT(SM.STRG_CODE) as as_count FROM STRG_MEET SM JOIN SALES_PERS S ON SM.SALES_PERS = S.SALES_PERS WHERE SM.EVENT_DATE BETWEEN as_from_date AND as_to_date AND sm.sales_pers=as_sales_pers and SM.STRG_TYPE = 'D' AND SM.STRG_CLASS_CODE = 'E' AND S.ITEM_SER ='OTC' group by sm.strg_code having COUNT(SM.STRG_CODE) =1 )a ; exception when no_Data_found then ls_return:=0; end; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FINPARM_VALUE (as_varname finparm.var_name%type, as_prdcode finparm.prd_code%type) return char is as_value finparm.var_value%type; begin select var_value into as_value from finparm where var_name = as_varname and prd_code = as_prdcode; return as_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LASTPURRATE ( as_itemcode item.item_code%type, adt_todate date, as_site_code item.site_code%type ) return decimal is lc_rate decimal(14,3) ; ldt_lastdate date; BEGIN begin select max(c.ord_date) into ldt_lastdate from porder c,porddet d where c.purc_order = d.purc_order and d.ITEM_CODE = as_itemcode and c.ord_date <= adt_todate -- same sql condition is written in item info button of w_indent_req and d.site_code = as_site_code and c.confirmed = 'Y'; exception when no_data_found then lc_rate := 0; when others then lc_rate := 0; end; begin if ldt_lastdate is not null then SELECT lc_rate INTO lc_rate FROM ( select b.rate as lc_rate from porder a,porddet b where a.purc_order = b.purc_order and b.item_code = as_itemcode and -- rownum = 1 and a.ord_date = ldt_lastdate and a.confirmed = 'Y' order by a.ord_date desc, a.purc_order desc ) WHERE ROWNUM = 1; end if; exception when no_data_found then lc_rate := 0; when others then lc_rate := 0; end; return lc_rate ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANDATE (ldate_fr in date,lsite_code in char,lacct_code in char) return NUMBER is lc_day_op_bal NUMBER(16,3); lc_prd_op_bal NUMBER(16,3); ls_prd char(6); ls_acctprd char(6); ls_fent char(10); mfr_date date; begin select acct_prd, code, fr_date into ls_acctprd, ls_prd, mfr_date from period where ldate_fr between fr_date and to_date; select fin_entity into ls_fent from site where site_code = lsite_code; select NVL(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and site_code = lsite_code and acct_code = lacct_code; -- lc_prd_op_bal:= nvl(lc_prd_op_bal,0); Select NVL(Sum(dr_amt - cr_amt),0) into lc_day_op_bal from gltran where site_code= lsite_code and tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code ; --lc_day_op_bal := nvl(lc_day_op_bal,0); lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOC_LOT ( lsite_code in char, litem_code in char, llot_no in char, llot_sl in char, ad_from_date in date, ltype in char, lavailable in char, lloc_code in char, lgetQV in char, lexc_opt in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; ls_available varchar2(2); begin if lavailable = 'B' then ls_available := 'YN' ; else ls_available := lavailable ; end if; if ltype = 'I' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b, location c where a.loc_code = c.loc_code and c.inv_stat = b.inv_stat and a.site_code = lsite_code and b.stat_type <> 'S' and a.item_code = litem_code and a.loc_code = lloc_code and a.lot_sl = llot_sl and instr(ls_available,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (Select decode(lgetQV,'Q', sum( a.quantity), sum(a.quantity * decode(lexc_opt, 'E',nvl(a.rate,0), nvl(a.gross_rate,0)))) qty from stock a, invstat b, location c where a.loc_code = c.loc_code and c.inv_stat = b.inv_stat and a.site_code = lsite_code and a.loc_code = lloc_code and a.item_code = litem_code and a.lot_sl = llot_sl and a.lot_no = llot_no and instr(ls_available,b.available) > 0 and b.stat_type <> 'S' union all select decode(lgetQV,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * decode(lexc_opt,'E',nvl(d.rate,0),nvl(d.gross_rate,0))) * -1),0) ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_sl = llot_sl and a.lot_no = llot_no and c.stat_type <> 'S' and a.eff_date > ad_from_date and instr(ls_available,c.available) > 0); end if; if ltype = 'B' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b, location c where a.loc_code = c.loc_code and c.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and a.lot_no = llot_no and b.stat_type <> 'S' and a.lot_sl = llot_sl and instr(ls_available, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (SELECT decode(lgetQV,'Q', sum( a.quantity), sum(a.quantity * decode(lexc_opt, 'E',nvl(a.rate,0), nvl(a.gross_rate,0)))) qty from stock a, invstat b, location c where a.loc_code = c.loc_code and c.inv_stat = b.inv_stat and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_no = llot_no and b.stat_type <> 'S' and a.lot_sl = llot_sl and instr(ls_available, b.available) > 0 union all select decode(lgetQV,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * decode(lexc_opt,'E',nvl(a.rate,0),nvl(a.gross_rate,0))) * -1),0) ) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and a.loc_code = lloc_code and b.inv_stat = c.inv_stat and c.stat_type <> 'S' and a.lot_sl = llot_sl and a.eff_date > ad_from_date and instr(ls_available,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHECK_DESP_STATUS BEFORE insert or UPDATE OF status ON despatchdet FOR EACH ROW declare ls_nature sorddet.nature%type; ls_ordtype sorder.order_type%type; ls_pobtype disparm.var_value%type; BEGIN if :NEW.status = 'N' then raise_application_error( -20601, 'Wrong value being set in status [' || :new.sord_no || '] line [' || :new.LINE_NO__SORD ||'] exp_lev [' || trim(:new.exp_lev) ||']'); end if; if :new.RATE__STDUOM = 0 then begin select var_value into ls_pobtype from disparm where prd_code = '999999' and var_name = 'POB_ORD_TYPE'; exception when others then ls_pobtype := ' '; end; if ls_pobtype is not null and length(trim(ls_pobtype)) > 0 then begin select order_type into ls_ordtype from sorder where sale_order = :new.sord_no; exception when others then ls_ordtype := ' '; end; if instr(ls_pobtype,trim(ls_ordtype)) > 0 then null; else begin select nature into ls_nature from sorditem where sale_order = :new.SORD_NO and line_no = :new.LINE_NO__SORD and exp_lev = :new.exp_lev; exception when others then ls_nature := ' '; end; if ls_nature = 'C' then raise_application_error( -20601, 'Nature is chargeable rate cannot be 0 sales order [' || :new.sord_no || '] line [' || :new.LINE_NO__SORD ||'] exp_lev [' || trim(:new.exp_lev) ||']'); end if; end if; end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WORKORDER_WORK_ORDER ON WORKORDER (WORK_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEM_SER (ls_item_code in char, ls_site_code in char) return char is ls_item_ser char(5); begin select nvl(item_ser,' ') into ls_item_ser from siteitem where site_code = ls_site_code and item_code = ls_item_code ; if (length(ltrim(rtrim(ls_item_ser))) = 0) then select item_ser into ls_item_ser from item where item_code = ls_item_code ; end if; return(ls_item_ser); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANS_CR (ldate_fr in date,ldate_to in date, lsite_code in char,lacct_code in char) return number is lc_cr_sum number(16,3); begin Select nvl(Sum(cr_amt),0) into lc_cr_sum from gltran where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SITEITEM_GEN_X ON SITEITEM_GEN (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_CALC_METH_VAR ON CALC_METHOD_VAR (CALC_METHOD, CALC_SEQ) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_STRGCUST_APPL_FOR_SITE (as_sccode in STRG_CUSTOMER.SC_CODE%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_STRGCUST'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from SITE_STRG_CUSTOMER where site_code = as_sitecode and SC_CODE = as_sccode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TAX_AUTHORITY_TAUNAME ON TAX_AUTHORITY (TAUTH_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PAYAGEING_AMT_REP ( as_refser IN Char , as_refno IN Char , ad_asondate IN Date , ac_outstamt IN Number) Return Number IS ac_outst_amt Number(14,3); lc_outstamt number(14,3) ; lc_adjamt number(14,3) ; Begin lc_outstamt := ac_outstamt ; -- tot_amt - adj_amt Select Nvl(Sum(A.pay_amt),0) Into lc_adjamt From Misc_Paydet A, Misc_Payment B Where A.tran_id = B.tran_id And A.tran_ser = as_refser And A.vouch_no = as_refno And B.tran_date > ad_asondate And B.confirmed = 'Y' ; lc_outstamt := lc_outstamt + lc_adjamt ; Select Nvl(Sum(A.adj_amt),0) Into lc_adjamt From Misc_Payables_Adj A , Misc_Payables B Where Decode(Trim(a.ref_ser_adj),'',A.ref_ser,A.ref_ser_adj) = B.tran_ser(+) And Decode(Trim(a.ref_no_adj),'',A.ref_no,A.ref_no_adj) = B.ref_no(+) And A.ref_ser = as_refser And A.ref_no = as_refno And ( B.tran_date > ad_asondate Or B.tran_date Is Null ); lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.pay_amt),0) Into lc_adjamt From Misc_Payment_Canc A , Misc_Payment_Cancdet B , Misc_Payment C Where A.tran_id = B.tran_id And A.payment_no = C.tran_id And B.tran_ser = as_refser And B.vouch_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt - lc_adjamt; Select Nvl(Sum(B.tot_amt),0) Into lc_adjamt From Pay_Ibca A , Pay_Ibca_Det B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Return lc_outstamt; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_POS AFTER UPDATE OF CONFIRMED ON POS REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ----PRAGMA AUTONOMOUS_TRANSACTION;set echo on; BEGIN --IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN IF (((:old.confirmed = 'N' and :new.confirmed = 'Y') or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y')) and (:new.tran_type = 'S')) THEN begin delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser = 'S-POS' and ref_id = :new.tran_id); delete from e_invoice where ref_ser = 'S-POS' and ref_id = :new.tran_id; select count(1) into ll_count from e_invoice where ref_ser = 'S-POS' and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, TRAN_gstn, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, SUPPLY_TYPE, gst_port, refund_claim, gst_currency, count_code, export_duty, tran_name ) SELECT ls_seq as tran_id, :new.TRAN_DATE as tran_date, :new.tran_type as tran_type, buyer.einv_reqd as einv_opt, 'S-POS' as ref_ser, :new.tran_id ref_id , :new.tran_date as ref_date, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) as gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, :new.site_code SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_ship, seller.descr trade_name_ship, seller.descr legal_name_ship, seller.ADD1 add1_ship, seller.ADD2 add2_ship, seller.CITY city_ship, seller.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_ship, seller.TELE1 tele_ship, seller.EMAIL_ADDR email_id_ship, :new.cust_code cust_code, (SELECT tax_reg_2 FROM customer WHERE cust_code=buyer.cust_code ) gstn_buy, buyer.CUST_NAME trade_name_buy, buyer.CUST_NAME legal_name_buy, --case when fn_supplytype('S-POS', trim(:new.tran_id), trim(buyer_state.count_code), trim(seller_state.count_code),:new.site_code) = 'B2B' then (SELECT GST_CODE FROM STATE WHERE STATE_CODE = ship.STATE_CODE) else '96' end as pos_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.CITY city_buy, buyer.state_code state_code__buy, buyer.drug_lic_no drug_lic_no_buy, buyer.PIN pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.TELE1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.CUST_CODE CUST_CODE__BIL, :new.CUST_CODE CUST_CODE__DLV, buyer.cust_name name_dlv, buyer.ADDR1 add1_dlv, buyer.ADDR2 add2_dlv, buyer.pin pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_dlv, buyer.state_code state_code__dlv, buyer.drug_lic_no drug_lic_no_dlv, round(((select sum(quantity * rate) from posdet where tran_id = :new.tran_id) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id --and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, ---- 02-sep-2022 and tax_code in ('FRS01','SDISP','SDISF','SMHC0','SMHS0','SMHCS') )) * :new.exch_rate,2) as INV_AMT, round(((select sum(quantity * rate) from posdet where tran_id = :new.tran_id)- (select sum(quantity * rate * discount / 100) from posdet where tran_id = :new.tran_id) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','K')) and tax_perc <> 0 and tax_amt <> 0),0)+nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('D')) and tax_perc < 0 and tax_amt < 0),0) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SMHC0','SMHS0','SMHCS') )) * :new.exch_rate,2) AS NET_AMT, round(((select sum(quantity * rate) from posdet where tran_id = :new.tran_id) +(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) - (select sum((it.quantity * it.RATE)/100 * it.DISCOUNT) from posdet it where it.tran_id = :new.tran_id ) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id --and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) AS ASSESABLE_VALUE, and tax_code in ('FRS01','SDISP','SDISF','SMHC0','SMHS0','SMHCS') )) * :new.exch_rate,2) AS ASSESABLE_VALUE, --round(:new.DISC_AMT,2), 0, --(select sum(( it.quantity__stduom * it.RATE__STDUOM)/100 * it.DISCOUNT) from invoice_trace it where it.invoice_id = :new.invoice_id ) disc_amt, null ORDER_NO, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, ----additional round bracket added before the *.:new.exch_rate round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='K') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, ----additional round bracket added before the *.:new.exch_rate --0 as OTHER_AMT,select * from aldevis.invoice where desp_id = 'TEDI0019'; 'N' proc_stat, sysdate proc_date, 'P' resp_stat, --0 distance, (select nvl(distance,0) from site_customer where site_code = :new.site_code and cust_code = :new.cust_code) as distance, --(select case when trans_mode = 'R' then '1' when trans_mode = 'L' then '2' when trans_mode = 'A' then '3' when trans_mode = 'S' then '4' else '1' end from despatch where desp_id = :new.desp_id) Trans_Mode, -- Road-1, Rail-2, Air-3, Ship-4 --(select case when t.tax_reg_2 = 'UNREGISTER' then ' ' else t.tax_reg_2 end from transporter t, despatch d where d.tran_code = t.tran_code and d.desp_id = :new.desp_id) Tran_gstn, null Trans_Mode, null Tran_gstn, --:new.lr_date, --:new.lr_no, --(select lr_date from despatch where desp_id = :new.desp_id), --(select lr_no from despatch where desp_id = :new.desp_id), null, null, --:new.lorry_no, --(select lorry_no from despatch where desp_id = :new.desp_id), null, '' Vehicle_Type, null DOC_NO, null DOC_DATE, fn_supplytype('S-POS', trim(:new.tran_id), trim(buyer_state.count_code), trim(seller_state.count_code),:new.site_code) as SUPPLY_TYPE, seller.stan_code as gst_port, fn_refundclaim('S-POS', trim(:new.tran_id)) refund_claim, 'INR' gst_currency, country.iso3166 as count_code, nvl(((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='L') and tax_perc <> 0 and tax_amt <> 0)) * :new.exch_rate,0) as export_duty, (select tran_name from transporter where tran_code = buyer.tran_code) Tran_name FROM CUSTOMER buyer, currency, country, state seller_state, state buyer_state, site seller WHERE seller.site_code = :new.site_code and buyer.cust_code = :new.cust_code and seller_state.state_code = seller.state_code and buyer_state.state_code = buyer.state_code and currency.curr_code = buyer.curr_code and country.count_code = buyer.count_code; --and station.stan_code = despatch.stan_code --and despatch.desp_id = :new.desp_id; --and INV.INVOICE_ID = :new.invoice_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.ITEM_CODE__ORD as ITEM_CODE , item.DESCR as ITEM_DESC, null AS LINE_TYPE, round(((it.quantity * it.RATE) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id --and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, -- 02-sep-2022 and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SDISP','SDISF','SMHC0','SMHS0','SMHCS') )) * :new.exch_rate,2) as INV_AMT, round((case when it.DISCOUNT > 0 then round(((it.quantity * it.RATE) -((it.quantity * it.RATE)/100 * it.DISCOUNT)) * :new.exch_rate,2) +round(( (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) else round((it.quantity * it.RATE) + round(( (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) ,2) END + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SDISP','SDISF','SMHC0','SMHS0','SMHCS') ) ) * :new.exch_rate,2) --------additional round bracket with *.:new exch_rate added as ASS_AMT, abs(round(((it.quantity * it.RATE)/100 * it.DISCOUNT) + ((nvl( -1 * (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0))) * :new.exch_rate,2)) AS DISCOUNT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in('C','K') ) and tax_code not in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=it.unit ) AS UNIT, it.quantity AS QUANTITY, it.RATE * :new.exch_rate AS RATE, item.hsn_no AS HSN_CODE, case when length(trim(it.LOT_NO)) = 0 or trim(it.LOT_NO) is null then 'NOT-APPLICABLE' else it.LOT_NO end as LOT_NO, null as EXP_DATE, null as MFG_DATE, round( (case when it.DISCOUNT > 0 then round(((it.quantity * it.RATE) -((it.quantity * it.RATE)/100 * it.DISCOUNT)) * :new.exch_rate,2) +round(( (nvl((select sum( tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) else round((it.quantity * it.RATE) + round(( (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)) )* :new.exch_rate,2) ,2) END + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=:new.tran_id and trim(line_no)=trim(it.line_no) and tax_code in ('FRS01','SDISP','SDISF','SMHC0','SMHS0','SMHCS') ) +nvl((select tax_amt from taxtran where taxtran.tran_code = 'S-POS' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type = 'G') and tax_perc <> 0 and tax_amt <> 0),0) )* :new.exch_rate,2) as TOT_ITEM_VAL, fn_gst_rate_amt('S-POS',it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt('S-POS',it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt('S-POS',it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt('S-POS',it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate('S-POS',it.tran_id, it.line_no) as GST_RATE, --(select case when item.stk_opt = '0' then 'Y' else 'N' end from item where item.item_code = it.item_code) (select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code__ord and item.item_ser = itemser.item_ser) FROM posdet it, item WHERE item.item_code= it.item_code__ord AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; -- end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RECRSL_PAYDET_X ON RECRSL_PAYDET (VAC_NO, LINE_NO, AD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FORM16_ACKNOWLEDGE_X ON FORM16_ACKNOWLEDGE (FIN_ENTITY, SITE_CODE, ACCT_PRD, PRD_QTR, REVISION_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LOAN_INT_REG_X ON LOAN_INT_REG (LOAN_NO, FROM_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LOANPARTY_PARTY_NAME ON LOANPARTY (PARTY_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX OBJ_VIEW_SOURCE_X ON OBJ_VIEW_SOURCE (OBJ_NAME, OBJ_CONTEXT, VIEW_MODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOAN_SUM_PRINP (as_loan_no CHAR, prd_code_fr CHAR, prd_code_to CHAR) return NUMBER is CURSOR principle is SELECT payrolldet.prd_code FROM period, payrolldet, payroll WHERE ( period.code = payrolldet.prd_code ) and ( payrolldet.emp_code = payroll.emp_code ) and ( payrolldet.prd_code = payroll.prd_code ) and ( ( payrolldet.ref_type = 'L' ) AND ( payrolldet.ref_no = as_loan_no ) AND ( payroll.voucher_no is not NULL ) and ( payrolldet.prd_code >= prd_code_fr and payrolldet.prd_code <= prd_code_to)); lc_prinp NUMBER(14,2) := 0.00; prinp_amt NUMBER(14,2); ld_frdate DATE; ld_todate DATE; reco_sum NUMBER(14,2); arrears_sum NUMBER(14,2); BEGIN For i in principle Loop SELECT nvl(ddf_loan_prinp(as_loan_no, i.prd_code),0) into prinp_amt from dual; lc_prinp := lc_prinp + prinp_amt; End loop; select fr_date into ld_frdate from period where code = prd_code_fr; select to_date into ld_todate from period where code = prd_code_to; select nvl(ddf_loan_sum_reco(as_loan_no,ld_frdate,ld_todate),0) into reco_sum from dual; select nvl(ddf_loan_sum_arrears(as_loan_no,prd_code_fr,prd_code_to),0) into arrears_sum from dual; lc_prinp := lc_prinp + reco_sum + arrears_sum; if lc_prinp < 0 then lc_prinp := 0.00; end if; return lc_prinp; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DET1_INFO ( as_infotype in char, as_versionId in char, as_tableNo in char, as_posCode in char ) return varchar is info char(250); begin if trim(as_infotype) = 'D' then begin select descr into info from org_structure where version_id = as_versionId and table_no = as_tableNo and pos_code = as_posCode; end; end if; if trim(as_infotype) = 'R' then begin select pos_code__repto into info from org_structure where version_id = as_versionId and table_no = as_tableNo and pos_code = as_posCode; end; end if; if info is null then info := ''; end if; return info; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_GET_ITEM_CODE__REF (ls_cust_code in char,ls_item_code in char) return char is ls_item_code__ref char(20); begin select item_code__ref into ls_item_code__ref from customeritem where cust_code = ls_cust_code and item_code = ls_item_code ; return ls_item_code__ref ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUDGETS_X ON BUDGETS (BUDGET_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFF_DOCMET_DT_WISE_MST force AS OBJECT ( SC_CODE VARCHAR2(30), DR_NAME VARCHAR2(120), SPECIALITY VARCHAR2(120), PLANNED_VISIT NUMBER(3), CLASS_DESCR VARCHAR2(60), CATEGORY VARCHAR2(60), LOCALITY VARCHAR2(120), ROUTE_TYPE VARCHAR2(60), WORK_DATE DATE, PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), DIVISION VARCHAR2(30), EMP_CODE VARCHAR2(30), EMP_NAME VARCHAR2(50), HEAD_QUAT VARCHAR2(50), DESIGN VARCHAR2(30) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INC_MAXRUN (AS_TRCD CHAR, AS_QTR CHAR) RETURN NUMBER IS LC_MAXRUN NUMBER(2); BEGIN SELECT MAX(PROC_NO) INTO LC_MAXRUN FROM INCQTR WHERE TERR_CODE=AS_TRCD AND QTR=AS_QTR AND CONFIRMED='Y'; RETURN NVL(LC_MAXRUN,0); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_SPLCHAR ( INPSTR VARCHAR2 ) Return Number Is LI_RET_VAL Number(1); LS_INPSTR VARCHAR2(4000); LI_CHRNO NUMBER(10); LI_LEN NUMBER(10); LI_ASC NUMBER(10); begin LI_RET_VAL := 0; LS_INPSTR := TRIM(INPSTR); LI_LEN := LENGTH(LS_INPSTR); FOR LI_CHRNO IN 1 .. LI_LEN LOOP LI_ASC := ASCII(SUBSTR(LS_INPSTR , LI_CHRNO , 1)); IF LI_ASC < 47 OR (LI_ASC > 57 AND LI_ASC < 65) OR (LI_ASC > 90 AND LI_ASC < 97) OR LI_ASC > 122 THEN LI_RET_VAL := 1; EXIT; END IF; END LOOP; RETURN LI_RET_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_STDUNIT (as_po in char, as_line in char) return varchar2 is ls_stdunit varchar2(10); begin select unit into ls_stdunit from porddet where purc_order = as_po and rtrim(ltrim(line_no)) = rtrim(ltrim(as_line)) ; return ls_stdunit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_DUPLICATE_BILLNO (ls_supp_code in char,ls_bill_no in char,ls_ref_ser in char,ld_bill_date in date,ls_tran_id in char,ls_sundry_type in char) RETURN NUMBER IS ll_retval number(1):=0; ll_retval2 number(1):=0; ll_retval3 number(1):=0; ll_count_no number(10):=0; ld_from_date DATE; ld_to_date DATE; ls_sql varchar2(4000); BEGIN ll_retval := 1; begin select fr_date,to_date into ld_from_date,ld_to_date from acctprd where ld_bill_date between fr_date and to_date; exception when others then ld_from_date :=''; ld_to_date :=''; end; if(ls_ref_ser = 'VOUCH') then if ls_tran_id is not null and length(trim(ls_tran_id)) > 0 then begin select count(*) into ll_count_no from voucher where bill_no=ls_bill_no and supp_code=ls_supp_code and bill_date between ld_from_date and ld_to_date and tran_id <> ls_tran_id; exception when others then ll_count_no := 0; end; if(ll_count_no = 0) then--if count 0 from voucher then misc voucher begin select count(*) into ll_count_no from misc_voucher where bill_no=ls_bill_no and sundry_code=ls_supp_code and bill_date between ld_from_date and ld_to_date and tran_id <> ls_tran_id; exception when others then ll_count_no := 0; end; end if; if ll_count_no <> 0 then ll_retval := 0; end if; else--ls_tran_id is null begin select count(*) into ll_count_no from voucher where bill_no=ls_bill_no and supp_code=ls_supp_code and bill_date between ld_from_date and ld_to_date ; exception when others then ll_count_no := 0; end; if ll_count_no <> 0 then ll_retval := 0; end if; if(ll_count_no = 0) then--if count 0 from voucher then misc voucher for tran id null begin select count(*) into ll_count_no from misc_voucher where bill_no=ls_bill_no and sundry_code=ls_supp_code and bill_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if ll_count_no <> 0 then ll_retval := 0; end if; end if; end if;---end of vouch if(ls_ref_ser = 'M-VOUCH') then if ls_tran_id is not null and length(trim(ls_tran_id)) > 0 then begin select count(*) into ll_count_no from misc_voucher where bill_no=ls_bill_no and sundry_code=ls_supp_code and sundry_type = ls_sundry_type and bill_date between ld_from_date and ld_to_date and tran_id <> ls_tran_id; exception when others then ll_count_no := 0; end; if(ll_count_no = 0) then --- if ll_count_no is 0 then from voucher begin select count(*) into ll_count_no from voucher where bill_no=ls_bill_no and supp_code=ls_supp_code and bill_date between ld_from_date and ld_to_date and tran_id <> ls_tran_id; exception when others then ll_count_no := 0; end; end if; if ll_count_no <> 0 then ll_retval := 0; end if; else--tran id null begin select count(*) into ll_count_no from misc_voucher where bill_no=ls_bill_no and sundry_code=ls_supp_code and sundry_type = ls_sundry_type and bill_date between ld_from_date and ld_to_date ; exception when others then ll_count_no := 0; end; if(ll_count_no = 0) then---case when count from misc voucher is 0 then from voucher begin select count(*) into ll_count_no from voucher where bill_no=ls_bill_no and supp_code=ls_supp_code and bill_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if(ll_count_no = 0) then ---case when count from voucher is 0 then from misc_vouchdet begin select count(*) into ll_count_no from misc_vouchdet where bill_no=ls_bill_no and sundry_code__for=ls_supp_code and sundry_type__for=ls_sundry_type and bill_date between ld_from_date and ld_to_date and tran_id <> ls_tran_id; exception when others then ll_count_no := 0; end; end if; if(ll_count_no = 0) then ---case when count from misc_vouchdet is 0 then porcp begin select count(*) into ll_count_no from porcp where invoice_no=ls_bill_no and supp_code=ls_supp_code and invoice_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if ll_count_no > 0 then ll_retval := 0; end if; end if; end if;---end of ref ser m-vouch if(ls_ref_ser = 'PORCP') then if ls_tran_id is not null and length(trim(ls_tran_id)) > 0 then begin select count(*) into ll_count_no from porcp where invoice_no=ls_bill_no and supp_code=ls_supp_code and invoice_date between ld_from_date and ld_to_date and tran_id <> ls_tran_id; exception when others then ll_count_no := 0; end; if(ll_count_no = 0) then --count_no is 0 from porcp then misc_voucher begin select count(*) into ll_count_no from misc_voucher where bill_no=ls_bill_no and sundry_code=ls_supp_code and bill_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if(ll_count_no = 0) then --count_no is 0 from misc_voucher then check from misc_voucherdet begin select count(*) into ll_count_no from misc_vouchdet where bill_no=ls_bill_no and sundry_code__for=ls_supp_code and sundry_type__for=ls_sundry_type and bill_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if ll_count_no <> 0 then ll_retval := 0; end if; else begin select count(*) into ll_count_no from porcp where invoice_no=ls_bill_no and supp_code=ls_supp_code and invoice_date between ld_from_date and ld_to_date ; exception when others then ll_count_no := 0; end; if(ll_count_no = 0) then --count_no is 0 from porcp then misc_voucher begin select count(*) into ll_count_no from misc_voucher where bill_no=ls_bill_no and sundry_code=ls_supp_code and bill_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if(ll_count_no = 0) then --count_no is 0 from misc_voucher then check from misc_voucherdet begin select count(*) into ll_count_no from misc_vouchdet where bill_no=ls_bill_no and sundry_code__for=ls_supp_code and sundry_type__for=ls_sundry_type and bill_date between ld_from_date and ld_to_date; exception when others then ll_count_no := 0; end; end if; if ll_count_no <> 0 then ll_retval := 0; end if; end if; end if; RETURN ll_retval ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MOVING_STATUS ( as_sitecode in site.site_code%type, as_itemcode in item.item_code%type, adt_asondate in date, ac_slow in number, ac_nonmove in number) return char is ls_retval char(1); ldt_trandate date; lc_days number(14,0) ; lc_months number (14,2); begin select max(eff_date) into ldt_trandate from invtrace where site_code = as_sitecode and item_code = as_itemcode and eff_qty < 0 and ref_ser in ('C-ISS','W-ISS','D-ISS','S-DSP') and eff_date <= adt_asondate; if ldt_trandate is null then return 'N'; end if; select to_date(adt_asondate) - to_date(ldt_trandate) into lc_days from dual; if lc_days is null then lc_days := 0; end if; lc_months := abs(lc_days / 30) ; if lc_months >= ac_nonmove then ls_retval := 'N' ; else if lc_months >= ac_slow then ls_retval := 'L' ; else ls_retval := 'X' ; end if; end if; if ls_retval is null then ls_retval := 'X' ; end if; return ls_retval; exception When NO_DATA_FOUND then begin lc_days := 0; ls_retval := 'N' ; return ls_retval; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SAMPLE_CREATE_TYPE (LR_NO CHAR ) RETURN CHAR IS CREATE_TYPE CHAR(1); BEGIN IF LR_NO IS NULL THEN RETURN 'I'; ELSE RETURN 'F'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DEALLOCQTY ( as_workorder in char, as_sitecode in char, as_itemcode in char, as_explev in char ) Return Number is ld_deallocqty number(14,3); Begin Select sum(Nvl(B.dealloc_qty,0)) Into ld_deallocqty From Inv_allocate A, inv_alloc_det B Where A.tran_id = B.tran_id And A.work_order = as_workorder And A.site_code = as_sitecode And B.item_code = as_itemcode And B.exp_lev = as_explev And NVl(A.confirmed,'N') = 'Y' And Nvl(B.deallocated,'N') <> 'Y'; Return ld_deallocqty; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_INV_HLD_REL_TR ON INV_HOLD_REL_TRACE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_MDRCR_TENV1 (Ls_Cust_Code In Char, Ls_Site_Code In Char, ls_tax_env in char,ls_tran_type in char) return number Is Ln_Cust_State CHAR(5); ln_site_state CHAR(5); Begin Select Trim(State_Code) Into Ln_Cust_State From Customer Where Cust_Code=Ls_Cust_Code; Select Trim(State_Code) Into Ln_Site_State From Site Where Site_Code=Ls_Site_Code; If Ln_Cust_State <> ln_site_state and ls_tax_env in ('SIGST01','SEP01','SEPDEEM','TENVFDESR','GSTEXP') then Return 0; ElsIf Ln_Cust_State = ln_site_state and Ls_Tax_Env In ('SDN ','SLD ','SAN ','SAS ','SAR ','SCG ','SJH ','SML ','SMN ','SMZ ','SNL ','SOR ','SSK ','STR ','SWB ','SBR ','SCH ','SDL ','SHP ','SHR ','SJK ','SMP ','SPB ','SUP ','SUA ','SAP ','SKL ','SKA ','SPY ','STN ','STS ','SDD ','SGJ ','SGA ','SMH ','SRJ ','SRCMI01 ','SRCML01 ','TENVFDESR','GSTEXP') Then Return 0; else Return 1; End If; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_DRUG_LIC ( as_var_name char ,as_fin_ent char, as_site_code char) return char is ls_reg_no char (500); mvar_value char (25); as_var_name1 char (25); as_fin_ent1 char (25); as_site_code1 char (25); begin if as_var_name is null or length(as_var_name) = 0 then as_var_name1 := '' ; else as_var_name1 := as_var_name; end if; if as_fin_ent is null or length(as_fin_ent) = 0 then as_fin_ent1 := '' ; else as_fin_ent1 := as_fin_ent ; end if; if as_site_code is null or length(as_site_code) = 0 then as_site_code1 := '' ; else as_site_code1 := as_site_code; end if; select var_value into mvar_value from disparm where prd_code = '999999' and var_name = as_var_name; select reg_no || ' ' || to_char(reg_date,'dd/mm/yy') into ls_reg_no from siteregno where fin_entity = as_fin_ent and site_code = as_site_code and ref_code = mvar_value; if ls_reg_no is not null then return ls_reg_no; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_EMP_SHORT_NAME (VI_REF_SER IN CHAR ,VI_REF_Id IN VARCHAR) RETURN VARCHAR2 IS EMP_SHORT_NAME VARCHAR2(500); BEGIN IF(VI_REF_SER = 'P-PICK' OR VI_REF_SER = 'C-PICK' OR VI_REF_SER = 'A-PICK' OR VI_REF_SER = 'M-PICK') THEN select nvl(pick_ord_hdr.ASSIGN_TO,' ') into EMP_SHORT_NAME from pick_ord_hdr where pick_ord_hdr.pick_order = VI_REF_Id; RETURN EMP_SHORT_NAME; ELSIF (VI_REF_SER = 'R-TASK' OR VI_REF_SER = 'RP-PND' OR VI_REF_SER = 'R-CPA' OR VI_REF_SER = 'R-PND' OR VI_REF_SER = 'S-DOC' OR VI_REF_SER = 'RP-ACT' OR VI_REF_SER = 'RR-DSA' OR VI_REF_SER = 'RD-DSA' OR VI_REF_SER = 'R-DSO' OR VI_REF_SER = 'RS-DSO' OR VI_REF_SER = 'RN-DSA') THEN select nvl(repl_ord_hdr.ASSIGN_TO,' ') into EMP_SHORT_NAME from repl_ord_hdr where repl_ord_hdr.repl_order = VI_REF_Id; END IF; RETURN EMP_SHORT_NAME; EXCEPTION WHEN NO_DATA_FOUND THEN EMP_SHORT_NAME :=' '; RETURN EMP_SHORT_NAME; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_CUST_LNAME ON STRG_CUSTOMER (LAST_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CONF_QTY ( tranId IN varchar, lineNo IN number ) return number is conf_qty number(14,3); begin select sum(case when b.quantity is null then 0 else b.quantity end) into conf_qty from charge_back a, charge_back_det b where a.tran_id = b.tran_id and a.cust_code = ( select cust_code from charge_back where tran_id = tranId ) and a.site_code = ( select site_code from charge_back where tran_id = tranId ) and b.item_code = ( select item_code from charge_back_det where tran_id = tranId and line_no = lineNo ) and b.lot_no = ( select lot_no from charge_back_det where tran_id = tranId and line_no = lineNo ) and a.confirmed = 'Y'; return(conf_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SRETURNDET_SORD ON SRETURNDET (SALE_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IDX_MAIL_LIST_ID ON MAILING_LIST_DET (MAIL_LIST_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_FIN_SCHEME_PERC_TAX ( as_fin_entity in char ) return number is lc_sch_amt number(14,3); begin begin select sch_amt into lc_sch_amt from fin_scheme where fin_scheme = as_fin_entity; exception when no_data_found then lc_sch_amt := 0 ; end; return lc_sch_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FINENT (as_site_code site.site_code%type ) return char is ls_fin_entity finent.fin_entity%type ; begin select finent.fin_entity into ls_fin_entity from site , finent where site.fin_entity = finent.fin_entity and site.site_code = as_site_code ; if ls_fin_entity is null then ls_fin_entity := ' '; end if; return ls_fin_entity; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_OUTST_REPO_REMARKS (as_transer char,as_tranid char) return char is ls_remarks char(60); begin if as_transer='VOUCH' then select nvl(remarks,' ') into ls_remarks from voucher where tran_id = as_tranid ; elsif as_transer = 'M-VOUC' then select nvl(remarks,' ') into ls_remarks from misc_voucher where tran_id=as_tranid ; elsif as_transer = 'P-VOUC' then select nvl(remarks,' ') into ls_remarks from payr_voucher where tran_id = as_tranid ; elsif as_transer = 'P-IBCA' then select nvl(remarks,' ') into ls_remarks from PAY_IBCA where tran_id = as_tranid ; elsif as_transer = 'DRNPAY' then select nvl(remarks,' ') into ls_remarks from DRCR_PAY where tran_id = as_tranid ; elsif as_transer = 'CRNPAY' then select nvl(remarks,' ') into ls_remarks from DRCR_PAY where tran_id = as_tranid ; end if; return ls_remarks; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE LOCALITYDARCODEMASTER AS OBJECT ( LOCALITY_CODE CHAR(10), DESCR VARCHAR2(60) , STOCKIST_CODE CHAR(10), STOCKIST_NAME varchar2(120), VISITED_WITH_TEAM char(10), ROUTE_ID CHAR(3) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STDUNIT (as_po varchar2, as_line number) -- Rahul K Khanolkar -- 24-jul-02 -- -- Return std unit for that PO and line. return varchar2 is ls_stdunit varchar2(10); begin select unit into ls_stdunit from porddet where purc_order = as_po and line_no = as_line; return ls_stdunit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXC_RATE_STN_RCP_TAX (as_tran_code in char, as_tran_id in char) return number is lc_tax_amt number(14,2); begin Select nvl(sum(tax_amt),0) into lc_tax_amt from ( SELECT nvl(sum(tax_amt),0) tax_amt FROM taxtran, tax WHERE ( taxtran.tax_code = tax.tax_code ) and ( ( tran_code = as_tran_code ) AND ( tran_id = as_tran_id ) ) GROUP BY taxtran.tax_perc, tax.descr, taxtran.line_no__tax ) ; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BANK_CHG_PERC (ac_bkchg in number, ac_transer in char, as_tranno char ) return number is lc_amount number(14,3); lc_exchrate number(14,3); begin if ac_transer='M-PAY' then select exch_rate into lc_exchrate from misc_payment where tran_id = as_tranno ; lc_amount := ( ac_bkchg * (10/100)) / lc_exchrate ; lc_amount := nvl(lc_amount,0) ; return ROUND(lc_amount,3) ; elsif ac_transer='F-XFR' then select exch_rate into lc_exchrate from fundtransfer where tran_id = as_tranno ; lc_amount := ( ac_bkchg * (10/100)) / lc_exchrate ; lc_amount := nvl(lc_amount,0) ; return ROUND(lc_amount,3) ; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_UNIT_AREA ( as_itemcode in char) return number is lc_unitarea number(16,5) ; begin select to_number(nvl(phy_attrib_11,'0')) + to_number(nvl(phy_attrib_12,'0')) into lc_unitarea from item where item_code = as_itemcode ; return lc_unitarea; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION VALIDATEEMAILID (as_emp_type IN CHAR ,as_email_id_off IN CHAR ) return number is li_count number(1); begin if as_emp_type ='P' then if length(as_email_id_off) > 0 and instr(as_email_id_off,'@') > 1 then li_count :=1; else li_count :=0; end if; else li_count :=1; end if; return li_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_EVAL_TABLE_DET_X ON PROJ_EVAL_TABLE_DET (EVAL_TABLE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CENVAT_REGNO_DIST (as_ref_id distord_rcp.tran_id%type,as_ref_code siteregno.ref_code%type) return varchar2 is ls_regno siteregno.reg_no%type; ls_site distord_rcp.site_code__ship%type; begin select distord_rcp.site_code__ship into ls_site from distord_rcp where distord_rcp.tran_id=as_ref_id ; select reg_no into ls_regno from siteregno where site_code = ls_site and REF_CODE = as_ref_code ; return ls_regno ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_SITE_ACCESS ( AS_OBJECT_NAME VARCHAR2, AS_USER_ID USERS.CODE%TYPE, AS_EMP_CODE EMPLOYEE.EMP_CODE%TYPE, AS_SITE_CODE SITE.SITE_CODE%TYPE, AS_LOGIN_SITE SITE.SITE_CODE%TYPE ) RETURN NUMBER IS LI_RET_VAL NUMBER(1); LC_USR_LEV USERS.USR_LEV%TYPE; LS_ROW_SECURITY CHAR(1); LS_SITE_ACC_COL TRANSETUP.SITE_ACC_COL%TYPE; LI_CNT NUMBER(5); BEGIN LI_RET_VAL := 0; LS_ROW_SECURITY := '0'; BEGIN SELECT USR_LEV INTO LC_USR_LEV FROM USERS WHERE CODE = AS_USER_ID; EXCEPTION WHEN NO_DATA_FOUND THEN LC_USR_LEV := 2; END ; IF LC_USR_LEV <= 1 THEN LI_RET_VAL := 1; ELSE SELECT COUNT(1) INTO LI_CNT FROM TRANSETUP WHERE TRAN_WINDOW = AS_OBJECT_NAME AND (SITE_ACC_COL IS NULL OR TRIM(SITE_ACC_COL) IS NULL OR LENGTH(TRIM(SITE_ACC_COL)) = 0); IF LI_CNT = 0 THEN LS_ROW_SECURITY := '2'; ELSE BEGIN SELECT VAR_VALUE INTO LS_ROW_SECURITY FROM PAYRPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'HR_SITE_SEC_LEVEL'; EXCEPTION WHEN NO_DATA_FOUND THEN LS_ROW_SECURITY := '1'; END ; IF LS_ROW_SECURITY IS NULL OR TRIM(LS_ROW_SECURITY) NOT IN ('0','2') THEN LS_ROW_SECURITY := '1'; ELSE LS_ROW_SECURITY := TRIM(LS_ROW_SECURITY); END IF; END IF; IF (LS_ROW_SECURITY = '0') OR (LS_ROW_SECURITY = '1' AND TRIM(AS_SITE_CODE) = TRIM(AS_LOGIN_SITE)) THEN LI_RET_VAL := 1; ELSE LI_CNT := 0; SELECT COUNT(1) INTO LI_CNT FROM USER_SITE WHERE USER_ID = AS_USER_ID AND SITE_CODE = AS_SITE_CODE; IF LI_CNT > 0 THEN LI_RET_VAL := 1; ELSE LI_RET_VAL := 0; END IF; END IF; END IF; RETURN CASE WHEN LI_RET_VAL IS NULL THEN 0 ELSE LI_RET_VAL END; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRD_TBL_X ON PRD_TBL (SITE_CODE, REF_CODE, FR_DATE, TO_DATE, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANS_DR (ldate_fr in date, ldate_to in date, lsite_code in char, lacct_code in char) return number is lc_dr_sum number(16,3); begin Select nvl(Sum(dr_amt),0) into lc_dr_sum from gltran where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_TRACE_XX1 ON INVOICE_TRACE (SORD_NO, ITEM_CODE, LOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EXP_AUTH (as_emp_code char,as_aprv_lev number) return char is ls_ret_emp_code char(10); ls_emp_code char(10); ls_report_to char(10); ls_with_held char(1); ld_relieve date; lc_count number(2); lc_no number(3); begin lc_count := 0; ls_ret_emp_code := ''; select report_to into ls_emp_code from employee where emp_code = as_emp_code; if ls_emp_code is null or length(trim(ls_emp_code)) = 0 then return ''; end if; loop select report_to , case when with_held is null then 'N' else with_held end, relieve_date into ls_report_to,ls_with_held,ld_relieve from employee where emp_code =ls_emp_code; if ls_with_held = 'Y' or ld_relieve is not null then if ls_report_to is null or length(trim(ls_report_to)) = 0 then exit; end if; ls_emp_code := ls_report_to; else lc_count := lc_count + 1; if lc_count < as_aprv_lev then if ls_report_to is null or length(trim(ls_report_to)) = 0 then exit; end if; ls_emp_code := ls_report_to; else ls_ret_emp_code := ls_emp_code; exit; end if; end if; end loop; return ls_ret_emp_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDESCR2 ( AS_conv__qty IN NUMBER, AS_unit__alt IN VARCHAR, AS_qty IN NUMBER, AS_recovery IN VARCHAR) RETURN VARCHAR IS RET_VAL VARCHAR(200); BEGIN IF AS_conv__qty <>1 THEN RET_VAL := AS_unit__alt || ' = (' || TO_CHAR(AS_QTY) || '/' || TO_CHAR(ROUND(AS_conv__qty,3)) || ' = ' ; IF AS_RECOVERY ='' THEN RET_VAL := RET_VAL || TO_CHAR(ROUND((AS_QTY/AS_CONV__QTY),3)) ||' )'; ELSE RET_VAL := RET_VAL || TO_CHAR(ROUND((AS_QTY * AS_CONV__QTY),3)) || ' )'; END IF; ELSE RET_VAL := ''; END IF; RETURN RET_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDESCR3 ( AS_qty IN NUMBER, AS_min_potency_perc IN NUMBER, AS_potency_perc IN NUMBER, AS_uom1 IN VARCHAR) RETURN VARCHAR IS RET_VAL VARCHAR(200); BEGIN RET_VAL := '(' || TO_CHAR(AS_QTY) || '/' || TO_CHAR(AS_min_potency_perc) || ' ) X' || TO_CHAR(AS_potency_perc) || '= ' || TO_CHAR(ROUND(((AS_QTY/AS_min_potency_perc) * AS_potency_perc) ,3 )); IF AS_UOM1 ='MU' THEN RET_VAL := RET_VAL || ' GRM'; ELSE RET_VAL := RET_VAL ; END IF; RETURN RET_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_FIELD_STAFF_EMPLOYEE (as_emp_code char) RETURN varchar2 IS is_staff_emp number; a_retval number(1) := 0; prop_whitespace VARCHAR2(500); as_prope_value VARCHAR2(500) ; begin SELECT PROP_VALUE into as_prope_value FROM PROPERTIES WHERE PROP_NAME = 'FIELDSTAFF_SITELIST_SUBMISSION' AND ITEM_SER = 'ALL'; select regexp_replace(as_prope_value,'\s') into prop_whitespace from dual; select (case when instr(','||prop_whitespace||',',','||(select TRIM(emp_site) from employee where emp_code = as_emp_code )||',') > 0 then 1 else 0 end) into a_retval FROM DUAL; return a_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_TOT_OUTLETS_MST force AS OBJECT ( SC_CODE VARCHAR2(30), CHEM_NAME VARCHAR2(150), CLASS_DESCR VARCHAR2(60), ROUTE_TYPE VARCHAR2(60), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), CHEM_ADDR VARCHAR2(500) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX POWER_ATT_REG_X ON POWER_ATT_REG (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORKORDER_ORD_DATE_SITE ON WORKORDER (ORD_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETVALIDREC_DGM (AS_LOG_EMP char,AS_ORG_EMP char,AS_CHG_USER char,AS_DIV_CODE char) return number is a_acc_parm1 users.acc_parm1%type; a_entity_code users.entity_code%type; a_ret_val number(1) := 0; a_count number(1) := 0; begin select max(acc_parm1) into a_acc_parm1 from users where emp_code = AS_LOG_EMP; select entity_code into a_entity_code from users where code = AS_CHG_USER; if (a_acc_parm1 = 'HIERARCHY') then select count(distinct emp_code) into a_count from employee where emp_code = AS_LOG_EMP -- Done by vishal on 04-Feb-10 for request by milindbhai to show details to resigned and withheld employee also -- and relieve_date is null -- and with_held = 'N' start with emp_code in (AS_ORG_EMP,a_entity_code) connect by prior report_to = emp_code; if (a_count = 1) then a_ret_val := 1; end if; elsif (a_acc_parm1 = 'ALL') then a_ret_val := 1; elsif (a_acc_parm1 is not null) then if (instr(','||trim(a_acc_parm1)||',',','||trim(AS_DIV_CODE)||',') > 0) then a_ret_val := 1; end if; end if; return a_ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TOTAL_AMOUNT (as_tran_id IN rcpdet_form.TRAN_ID%TYPE) return NUMBER is total_amount NUMBER(14,3); begin total_amount:=0; begin select sum(rcp_amt) INTO total_amount from rcpdet_form where tran_id=as_tran_id; exception when others then total_amount := 0 ; return total_amount; end; return total_amount; end fn_total_amount; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CON_DAYS (AS_EMP_CODE char,AS_PRD_CODE char) return number is a_days number(2) := 0; a_count number(5); a_count1 number(5); a_fr_date date; a_to_date date; a_date date; a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; a_hol_tblno holiday.hol_tblno%type; begin select fr_date,to_date into a_fr_date,a_to_date from period where code = AS_PRD_CODE; select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (a_fr_date < a_date_join) then a_fr_date := a_date_join; end if; if (a_to_date > a_relieve_date) then a_to_date := a_relieve_date; end if; for i in 1..(a_to_date-a_fr_date+1) loop a_date := a_fr_date + i - 1; a_hol_tblno := ddf_get_holtblno(AS_EMP_CODE,a_date); for ii in 1..1 loop select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = a_date and hol_type = 'H'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = a_date and hol_type = 'H' and confirmed = 'Y'; if (a_count1 = 0) then a_days := a_days + 1; exit; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = a_date and hol_type = 'H' and confirmed = 'Y'; if (a_count1 <> 0) then a_days := a_days + 1; exit; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = a_date and hol_type = 'W'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = a_date and hol_type = 'W' and confirmed = 'Y'; if (a_count1 = 0) then exit; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = a_date and hol_type = 'W' and confirmed = 'Y'; if (a_count1 <> 0) then exit; end if; select count(*) into a_count from attendance_day where attd_date = a_date and emp_code = AS_EMP_CODE; if (a_count <> 0) then a_days := a_days + 1; exit; end if; if (AS_PRD_CODE >= '201102') then select count(*) into a_count from tour where emp_code = AS_EMP_CODE and a_date >= date_from and a_date <= date_to and status = 'A'; if (a_count <> 0) then a_days := a_days + 1; exit; end if; end if; end loop; end loop; return a_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_GRADE ( lsite_code in char, litem_code in char, llot_no in char, ad_to_date in date, ltype in char, lavailable in char, lloc_code in char, lgetQV in char, lexc_opt in char, as_grade in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and a.grade = as_grade and instr(lavailable,b.available) > 0; if ad_to_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from ( select decode(lgetQV,'Q',nvl((sum (nvl(a.eff_qty,0))),0), nvl(sum ((nvl(a.eff_qty,0) * decode(lexc_opt,'N',nvl(a.rate,0),nvl(a.gross_rate,0)) ) ),0) ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.tran_date <= ad_to_date and d.grade = as_grade and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 ; if ad_to_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from ( select decode(lgetQV,'Q',nvl((sum (nvl(a.eff_qty,0))),0), nvl(sum ((nvl(a.eff_qty,0) * decode(lexc_opt,'N',nvl(a.rate,0),nvl(a.gross_rate,0)) ) ),0) ) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and a.loc_code = lloc_code and b.inv_stat = c.inv_stat and a.tran_date <= ad_to_date and instr(lavailable,c.available) > 0); end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_DT_LINK ON DOC_TRANSACTION_LINK (TRIM(REF_ID), DOC_TYPE_ATTACH) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_POTENCY_CAL (f_req_qty in number , f_bal_qty in number , f_site_code in char , f_item_code in char , f_loc_code in char , f_lot_no in char , f_lot_sl in char ) return number is --lc_baqty number(14,3); lc_quantity number(14,3) := 0.00; ld_stockpotencyperc number(14,3); ld_itemstdpotency number(14,3); ld_quantity number(14,3); ld_moisture_content number(5,3); ls_loctype char(3); ls_qc_no char(10); ls_actual_rs char(10); ls_var_val char(100); lc_tmpqty number(14,3) := 0.00; cursor c1 is select a.qorder_no from qc_order a , qc_order_lots b where a.qorder_no = b.qc_order and a.site_code = f_site_code and b.item_code = f_item_code and b.loc_code = f_loc_code and b.lot_no = f_lot_no and b.lot_sl = f_lot_sl ; begin select nvl(potency_perc,100) into ld_itemstdpotency from item where item_code = f_item_code; select potency_perc into ld_stockpotencyperc from stock where item_code = f_item_code and site_code = f_site_code and loc_code = f_loc_code and lot_no = f_lot_no and lot_sl = f_lot_sl ; if f_req_qty < f_bal_qty then --check the condition before final run. -- insufficient stock case if ld_stockpotencyperc < ld_itemstdpotency then lc_quantity := f_req_qty - (f_req_qty * ld_stockpotencyperc / ld_itemstdpotency) ; end if; else -- sufficent stock case. if ld_stockpotencyperc < ld_itemstdpotency then lc_quantity := (( f_bal_qty / ld_stockpotencyperc * ld_itemstdpotency) - f_bal_qty ); end if; end if; begin select qorder_no into ls_qc_no from qc_order where site_code = f_site_code and item_code = f_item_code and loc_code = f_loc_code and lot_no = f_lot_no and lot_sl = f_lot_sl; exception when no_data_found then ls_qc_no := null; end; if ld_stockpotencyperc < 99 then begin select var_value into ls_var_val from mfgparm where prd_code = '999999' and var_name = 'MOISTURE_CONTENT' ; exception when no_data_found then Return lc_quantity ; end; if ls_var_val is not null then if ls_qc_no is null then open c1; begin fetch c1 into ls_qc_no ; select actual_result into ls_actual_rs from qc_ord_res a , qc_ord_res_spec b where a.tran_id = b.tran_id and a.qorder_no = ls_qc_no and b.spec_code = ls_var_val; exception when no_data_found then Return lc_quantity ; end; close c1; else begin select actual_result into ls_actual_rs from qc_ord_res a , qc_ord_res_spec b where a.tran_id = b.tran_id and a.qorder_no = ls_qc_no and b.spec_code = ls_var_val; exception when no_data_found then Return lc_quantity ; end; end if; end if; end if; -- change ls_actual_rs from char to number if isnumber(ls_actual_rs) = 0 then ld_moisture_content := to_number(ls_actual_rs); else --ld_moisture_content := 0; Return lc_quantity ; end if; If ld_stockpotencyperc >= 99 Then if f_req_qty < f_bal_qty then --check the condition before final run. -- insufficient stock case if ld_stockpotencyperc < ld_itemstdpotency then lc_quantity := f_req_qty - (f_req_qty * ld_stockpotencyperc / ld_itemstdpotency) ; end if; else -- sufficent stock case. if ld_stockpotencyperc < ld_itemstdpotency then lc_quantity := ( f_bal_qty / ld_stockpotencyperc * ld_itemstdpotency) - f_bal_qty; end if; end if; Else if f_req_qty < f_bal_qty then --check the condition before final run. -- insufficient stock case if ld_stockpotencyperc < ld_itemstdpotency then lc_quantity := f_req_qty - ( ((f_req_qty * ld_stockpotencyperc / ld_itemstdpotency) * 100 ) / (100 - ld_moisture_content) ) ; Else lc_quantity := f_req_qty - ( (f_req_qty * 100 ) / (100 - ld_moisture_content) ) ; end if; else -- sufficent stock case. if ld_stockpotencyperc < ld_itemstdpotency then lc_quantity := (( f_bal_qty / ld_stockpotencyperc * ld_itemstdpotency) * 100 /( 100 - ld_moisture_content) ) - f_bal_qty; Else lc_quantity := (f_bal_qty *100 ) / ( 100 - ld_moisture_content) - f_bal_qty; end if; end if; End If; return lc_quantity; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STKREV (ls_tranid in char, ls_qty in number, ls_rate in number) RETURN NUMBER is ls_siteship_fin site.fin_entity%type; ls_site_fin site.fin_entity%type; LS_VALUE NUMBER(14,3) := 0; ls_siteship char(5); ls_site char(5); BEGIN begin select site_code__ship, site_code into ls_siteship,ls_site from distord_rcp where tran_id =ls_tranid; exception when others then ls_siteship_fin := '0'; end; begin select nvl(fin_entity,'0') into ls_siteship_fin from site where site_code =ls_siteship; exception when others then ls_siteship_fin := '0'; end; begin select fin_entity into ls_site_fin from site where site_code =ls_site; exception when others then ls_site_fin := '0'; end; if trim(ls_siteship_fin) =trim(ls_site_fin) then LS_VALUE := 0 ; else LS_VALUE := 100 ; --ls_qty *ls_rate * -1; end if ; return LS_VALUE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TRANSFERSTK (LOCCODE_FROM IN CHAR,LOCCODE_TO IN CHAR) RETURN CHAR IS LOCGRP_FROM CHAR(10); LOCGRP_TO CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT LOC_GROUP INTO LOCGRP_FROM FROM LOCATION WHERE LOC_CODE=LOCCODE_FROM ; SELECT LOC_GROUP INTO LOCGRP_TO FROM LOCATION WHERE LOC_CODE=LOCCODE_TO ; IF RTRIM(LOCGRP_FROM) <> RTRIM(LOCGRP_TO) THEN RETURN '1'; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAV_COUP_UTLZ_X ON TRAV_COUP_UTLZ (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SCHEME_APPLICABILITY ON SCHEME_APPLICABILITY (ITEM_CODE, APP_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRG_UPD_FFS_CONF Before Insert Or Update On FULLFINAL_HDR REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN IF :OLD.CONFIRMED = 'X' THEN IF :NEW.CONFIRMED = 'F' THEN raise_application_error(-20000 , 'FFS Transaction is cancelled, hence can not be confirmed'); END IF; ELSIF :NEW.CONFIRMED = 'F' THEN :NEW.CONFIRMED := 'I'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DISC_TAX_NEW (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_tax_code in char, ls_type in char ) return number is lc_tax_amt number(14,3); ls_var_value tax.tax_code%type; as_line_no char(3); begin if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 3 then as_line_no := rtrim(ltrim(ls_line_no)); end if; -- tax % if ls_type = 'P' then select max(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and tax_code in ( select column_value from TABLE(csv_to_row(ls_tax_code)) ) AND TAX_AMT <>0 ; end if; if ls_type = 'A' then select sum(nvl(Tax_Amt,0)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and tax_code in ( select column_value from TABLE(csv_to_row(ls_tax_code)) ) ; end if; --exception when no_data_found then --lc_tax_amt := 0 ; RETURN LC_TAX_AMT; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_LIC_VALIDITY_PRD (as_custcode IN customer.cust_code%type ) return number as ldt_licdt customer.DRUG_LICNO_UPTO%type; ldt_licdt1 customer.DRUG_LICNO1_UPTO%type; ldt_licdt2 customer.DRUG_LICNO2_UPTO%type; ls_checkvalid NUMBER(14,3); BEGIN select to_number(var_value) into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'CHK_DRUG_LIC_EXP_DT'; SELECT DRUG_LICNO_UPTO ,DRUG_LICNO1_UPTO,DRUG_LICNO2_UPTO INTO ldt_licdt,ldt_licdt1,ldt_licdt2 FROM customer WHERE cust_code=as_custcode; IF (ldt_licdt <= trunc(sysdate) + ls_checkvalid) then return 0; end if; if (ldt_licdt1 <= trunc(sysdate) + ls_checkvalid) then return 0; end if; if (ldt_licdt2 <= trunc(sysdate) + ls_checkvalid) then return 0; end if; RETURN 1; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_GEO_LOC ( lgeo_loc in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c , site d where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = d.site_code and d.geo_loc = lgeo_loc and a.item_code = litem_code and instr(lavailable,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity) qty from stock a, invstat b , location c , site d where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = d.site_code and d.geo_loc = lgeo_loc and a.item_code = litem_code and instr(lavailable,b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c , site d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = d.site_code and d.geo_loc = lgeo_loc and a.tran_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c , site d where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = d.site_code and d.geo_loc = lgeo_loc and a.item_code = litem_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b , location c , site d where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = d.site_code and d.geo_loc = lgeo_loc and a.lot_no = llot_no and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c , site d where a.site_code = d.site_code and d.geo_loc = lgeo_loc and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.tran_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHEQITMSER_DISTRCP (as_tranid in char ) RETURN NUMBER IS LL_ROW NUMBER(5); LS_RESULT NUMBER(1); ll_count number(5); ls_itemcode varchar2(10); ls_sitecode varchar2(5); ls_itemser varchar2(10); ll_loopcount number(5); CURSOR C1 IS SELECT DISTINCT(b.ITEM_CODE),a.SITE_CODE ,C.ITEM_SER FROM distord_rcp a ,distord_rcpdet b ,ITEM C where a.tran_id = b.tran_id AND B.ITEM_CODE = C.ITEM_CODE and a.tran_id = as_tranid ; begin LL_ROW :=0; open c1; loop fetch c1 into ls_itemcode,ls_sitecode,ls_itemser ; exit when c1% notfound; if TRIM(ls_itemser) in ('RM1','PM1','BD','BDI','LRM','LPM','OM') then select count(*) into ll_count from siteitem a where a.item_code = ls_itemcode and a.site_code = ls_sitecode and a.site_code not in('SA214') and a.item_ser in ('RM1','PM1','BD','BDI','LRM','LPM','OM') AND QC_REQD='Y' ; LL_ROW := LL_ROW + ll_count; ll_loopcount := c1%rowcount ; else ll_row := 1; return ll_row; end if ; end loop; close c1; IF ll_loopcount = ll_row then ll_row := 1; else ll_row := 0; end if ; RETURN LL_ROW; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX POAMD_HDR_DATE_SITE_ORD ON POAMD_HDR (AMD_DATE, SITE_CODE__ORD) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 26214400 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_PAN_ITDECL (pan in varchar2, empCode in varchar2 ,acctPrd in varchar2,declType in varchar2,qtrNo in varchar2, adCode in varchar2,tranId in varchar2, PAN_FLD_NAME in varchar2 default ' ') return varchar2 is retVal varchar2(30) ; inputed varchar2(30) ; output boolean; begin output := false; retVal:='false'; if pan IS NULL OR pan='' then retVal:='true'; return retVal; end if; if length(pan) != 30 then output := false; end if; if(pan = 'PANNOTAVBL') then retVal:='true'; return retVal; end if; inputed := upper(pan); output := REGEXP_LIKE(inputed , '[A-Z]{3}[C|P|H|F|A|T|B|L|J|G]{1}[A-Z]{1}[0-9]{4}[A-Z]{1}') ; --return output ; if(output) then retVal:=''; else retVal:='VTITPRFS28'; end if ; return retVal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_TDSTAX_MISCDET (as_tran_id char,as_ref_ser char,as_flag char) return varchar2 is as_tran_ret varchar2(500); as_tran varchar2(500); as_tran_ser varchar2(500); as_tran_ser1 varchar2(500); as_tran1 varchar2(500); cursor c1 is select distinct misc_voucher_trace.tran_id ,misc_voucher_trace.tran_id__ser from misc_voucher_trace ,TAX where misc_voucher_trace.TAX_CODE = TAX.TAX_CODE AND misc_voucher_trace.tran_id__ref =as_tran_id and misc_voucher_trace.ref_ser =as_ref_ser AND misc_voucher_trace.amount <>0 and tax.tax_group in ('ITDS ','SRTDS','ECTDS','SHTDS'); begin open c1 ; loop fetch c1 into as_tran ,as_tran_ser ; exit when c1%notfound ; as_tran1 := as_tran1||as_tran||' ,' ; as_tran_ser1 := as_tran_ser1||as_tran_ser||' ,' ; end loop; close c1; if as_flag = 'I' then as_tran_ret := as_tran1 ; elsif as_flag = 'S' then as_tran_ret := as_tran_ser1 ; end if ; if as_tran_ret is null then as_tran_ret := ' '; end if ; return as_tran_ret ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALES_BUDGET_IS ON SALES_BUDGET (PRD_CODE, ITEM_SER, SITE_CODE__SALES, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CREDIT_LIMIT (ls_cust_code in char, ls_item_ser in char, ls_period_from in char, ls_period_to in char, ls_factor in char) return number is lc_credit_limit number(14,3); lc_sales number(14,3); ll_number number(3); begin select isnumber(ls_factor) into ll_number from dual; if ll_number = 0 then lc_credit_limit := to_number(ls_factor); else select avg(net_sales) into lc_sales from ( select sum(nvl(sales_val,0) - nvl(return_val,0) + nvl(repl_val,0)) net_sales from sm_sales_cust where cust_code = ls_cust_code and item_ser = ls_item_ser and prd_code >= ls_period_from and prd_code <= ls_period_to group by prd_code); lc_credit_limit := lc_sales * ddf_decode_string(ls_factor,lc_sales); end if; return lc_credit_limit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STOCK_DIST_X ON STOCK_DIST (ITEM_CODE, SITE_CODE, LOC_CODE, LOT_NO, LOT_SL, REMARKS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PREV_CLASS (lsite_code in char, litem_code in char, ad_from_date in date) return char is ls_abc_class char(1); begin select abc_class into ls_abc_class from item_inv_rec where to_date = (select min(to_date) from item_inv_rec where site_code = lsite_code and item_code = litem_code and to_date < ad_from_date) and site_code = lsite_code and item_code = litem_code; return (ls_abc_class); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_PRESC_CNT (as_sales_pers in Char,as_sales_prod_grp in Char,as_strg_code in Char,as_event_date in Date) Return Number is as_presc_no number(3); Begin Begin Select nvl(Max(Presc_No),0) into as_presc_no From Strg_Meet_Items SMI Inner Join Strg_Meet SM On SM.DCR_ID = SMI.DCR_ID And SM.Strg_Code = SMI.Strg_Code Where SM.STRG_TYPE = 'D' And SM.Sales_Pers = as_sales_pers And SMI.Sales_Prod_Grp = as_sales_prod_grp And SM.Strg_Code = as_strg_code And SM.Event_Date = as_event_date; exception when no_data_found then as_presc_no := 0; end; RETURN as_presc_no ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_ITEMSERCODE ON ITEM (ITEM_SER, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_TRANSFER_JV_X ON SALES_TRANSFER_JV (INVOICE_ID, JV_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_EMP_DESIGN_CODE ( as_report_to char) return varchar2 is design_code varchar2(10); begin select design_code into design_code from employee where emp_code = as_report_to; return NVL(design_code,' '); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORKORDER_ISSDSL_TRNISSEXPLIN ON WORKORDER_ISSDET_SL (TRAN_ID__ISS, EXP_LEV, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ITEMSER_CHANGE (as_item_code in item.item_code%type,as_tran_date in CUST_STOCK.TRAN_DATE%type) return varchar2 as LS_ITEMSER varchar(10); cnt number(5); begin select COUNT(item_ser) into cnt from itemser_change where item_code = as_item_code and ( eff_date <= (case when as_tran_date is null then sysdate else as_tran_date end) and ( valid_upto >= (case when as_tran_date is null then sysdate else as_tran_date end) or valid_upto is null )); if cnt = 0 then select count(item_ser__old) into cnt from itemser_change where item_code = as_item_code and ( eff_date >= (case when as_tran_date is null then sysdate else as_tran_date end) and ( valid_upto >= (case when as_tran_date is null then sysdate else as_tran_date end) or valid_upto is null)) and eff_date = (select min(eff_date) from itemser_change where item_code = as_item_code); if cnt = 0 then select item_ser into ls_itemser from item where item_code = as_item_code ; else select item_ser__old into ls_itemser from itemser_change where item_code = as_item_code and ( eff_date >= (case when as_tran_date is null then sysdate else as_tran_date end) and ( valid_upto >= (case when as_tran_date is null then sysdate else as_tran_date end) or valid_upto is null )) and eff_date = (select min(eff_date) from itemser_change where item_code = as_item_code); end if; else select item_ser into ls_itemser from itemser_change where item_code = as_item_code and ( eff_date <= (case when as_tran_date is null then sysdate else as_tran_date end) and ( valid_upto >= (case when as_tran_date is null then sysdate else as_tran_date end) or valid_upto is null)); end if; return ls_itemser; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_BIS_RESPONSE_STATUS ( RESP_RETURN in char) return VARCHAR2 is response VARCHAR(20); begin select case when RESP_RETURN = '1' then 'Success' when RESP_RETURN = '2' then 'Session Expired' when RESP_RETURN = '3' then 'Exception' else 'Failed' end as Response into response from dual; return response; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SER_REQ_FEEDBKDTL_X ON SER_REQ_FEEDBKDTL (FEEDBK_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RECEIPT_GPNO (as_TranSer in char,as_TranCode in char) return char is ls_GPno Char(15); ls_InvId char(10); ls_DespId char(10); begin if as_TranSer = 'S-INV' then -- 'Invoice' Section; begin select DESP_ID into ls_DespId from invoice where INVOICE_ID = as_TranCode; begin select gp_no into ls_GPno from despatch where DESP_ID = ls_DespId; exception when others then ls_GPno := ' '; end; exception when others then ls_GPno := ' '; end; elsif as_TranSer = 'DRNRCP' then --'Debit Note' Section begin select INVOICE_ID into ls_InvId from drcr_rcp where tran_id = as_TranCode; begin select DESP_ID into ls_DespId from invoice where INVOICE_ID = as_TranCode; begin select gp_no into ls_GPno from despatch where DESP_ID = ls_DespId; exception when others then ls_GPno := ' '; end; exception when others then ls_GPno := ' '; end; exception when others then ls_GPno := ' '; end; else ls_GPno := ' '; end if; return ls_GPno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHECK_PRINT2_NEW (AS_SALES_PERS IN VARCHAR2, AS_SYS_DATE IN DATE, AS_NO_VISIT IN NUMBER, AS_SC_CODE IN VARCHAR2, AS_CURR_NO IN NUMBER ) RETURN NUMBER IS AS_SUM NUMBER(30) ; AS_DATE DATE; AS_OUTPUT DATE; J NUMBER(30); BEGIN AS_SUM :=0; J :=0; AS_DATE :=LAST_DAY(ADD_MONTHS(AS_SYS_DATE,-1))+1 ; FOR I IN 1..AS_NO_VISIT LOOP J:=J+1; IF J<>AS_NO_VISIT OR AS_NO_VISIT=1 THEN SELECT MAX(EVENT_DATE) INTO AS_OUTPUT FROM strg_meet where sales_pers = AS_SALES_PERS and event_date<=AS_SYS_DATE and strg_code = AS_SC_CODE AND EVENT_DATE BETWEEN AS_DATE AND AS_DATE + trunc((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)-1 order by strg_code,event_date ; ELSE SELECT MAX(EVENT_DATE) INTO AS_OUTPUT FROM strg_meet where sales_pers = AS_SALES_PERS and event_date<=AS_SYS_DATE and strg_code =AS_SC_CODE AND EVENT_DATE BETWEEN AS_DATE AND AS_DATE + (trunc((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)-1)+( mod((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1))),AS_NO_VISIT)) order by strg_code,event_date ; END IF ; IF AS_CURR_NO=J THEN IF AS_OUTPUT IS NOT NULL THEN AS_SUM :=1; ELSE AS_SUM :=0; END IF; EXIT; END IF; AS_DATE :=AS_DATE+ trunc(((last_day(AS_SYS_DATE)-(add_months(last_day(AS_SYS_DATE),-1)))/AS_NO_VISIT)); END LOOP; RETURN AS_SUM ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RND_PROJ_HEAD_NAME (as_projcd char) return varchar2 is ls_name char(50); begin select nvl(trim(emp_fname),'') || ' ' || nvl(trim(emp_mname),'')|| ' ' || nvl(trim(emp_lname),'') EmpName into ls_name from employee where emp_code in (select emp_code__head from proj_team where team_code in ( select team_code from project where proj_code = as_projcd)); return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE INS_PERIOD_DIM is mprd_key number := 0; begin select nvl(max(period_key), 0)+1 into mprd_key from period_dim; insert into period_dim (period_key, tran_date, site_key, item_ser, sales_period, last_day_of_sales_period, last_day_of_sales_qtr, fin_period, week_of_month, week_of_year, day_of_week, last_day_of_fin_period, last_day_of_fin_qtr, week_end, day_before_weekend, day_after_weekend, holiday, day_before_holiday, day_after_holiday, season, vacation_period, festival_season) select mprd_key, to_char(trunc(sysdate)-1, 'dd-mon-rr'), b.site_code, substr(b.ref_code, 1, 5), a.prd_code, decode(trunc(sysdate)-1, a.to_date, 'Y', 'N') last_day_of_sales_period, decode(trunc(sysdate)-1, a.to_date, decode(to_char(trunc(sysdate)-1,'MM'), '03', 'Y', 'N')) last_day_of_sales_qtr, to_char(trunc(sysdate)-1, 'yyyymm') fin_period, to_char(sysdate, 'w') week_of_month, to_char(sysdate, 'ww') week_of_year, to_char(trunc(sysdate)-1, 'DY') day_of_week, decode(last_day(trunc(sysdate)-1), trunc(sysdate)-1, 'Y', 'N'), decode(last_day(trunc(sysdate)-1), trunc(sysdate)-1, decode(to_char(trunc(sysdate)-1,'MM'), '03', 'Y', 'N')) last_day_of_fin_qtr, decode(to_char(trunc(sysdate)-1, 'DY'), 'SAT', 'Y', 'SUN', 'Y', 'N') week_end, decode(to_char(trunc(sysdate)-1, 'DY'), 'FRI', 'Y', 'N') day_before_weekend, decode(to_char(trunc(sysdate)-1, 'DY'), 'MON', 'Y', 'N') day_after_weekend, decode(to_char(trunc(sysdate)-1, 'DY'), 'SUN', 'Y', 'N') holiday, decode(to_char(trunc(sysdate)-1, 'DY'), 'SAT', 'Y', 'SUN', NULL, 'N') day_before_holiday, decode(to_char(trunc(sysdate)-1, 'DY'), 'MON', 'Y', 'SUN', NULL, 'N') day_after_holiday, decode(to_char(trunc(sysdate)-1, 'mm'), '01', 'WINTER', '12', 'WINTER') season, decode(to_char(trunc(sysdate)-1, 'mm'), '04', 'Y', 'N') vacation, decode(to_char(trunc(sysdate)-1, 'mm'), '01', 'Y', 'N') festival from period_tbl a, period_appl b where a.prd_tblno = b.prd_tblno and trunc(sysdate)-1 between a.fr_date and a.to_date; commit; /* Updating for Calendar Month */ update period_dim a set (a.fin_period, a.fin_round, a.fin_quarter, a.fin_quatret, a.fin_half, a.fin_year) = (select code, prd_round, prd_qtr, prd_quatret, decode( substr( code, 5, 2), '04', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '05', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '06', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '07', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '08', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '09', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '10', substr( code, 1, 4)||'10-'||to_char( to_number( substr( code, 1, 4))+1)||'03', '11', substr( code, 1, 4)||'10-'||to_char( to_number( substr( code, 1, 4))+1)||'03', '12', substr( code, 1, 4)||'10-'||to_char( to_number( substr( code, 1, 4))+1)||'03', '01', to_char( to_number( substr( code, 1, 4))-1)||'10-'||substr( code, 1, 4)||'03', '02', to_char( to_number( substr( code, 1, 4))-1)||'10-'||substr( code, 1, 4)||'03', '03', to_char( to_number( substr( code, 1, 4))-1)||'10-'||substr( code, 1, 4)||'03'), acct_prd from period where code = to_char(trunc(sysdate)-1, 'yyyymm')) where tran_date = trunc(trunc(sysdate)-1); /* Updating for Sales Period Closing */ update period_dim a set (a.sales_round, a.sales_quarter, a.sales_quatret, a.sales_half, a.sales_year) = (select prd_round, prd_qtr, prd_quatret, decode( substr( code, 5, 2), '04', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '05', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '06', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '07', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '08', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '09', substr( code, 1, 4)||'04-'||substr( code, 1, 4)||'09', '10', substr( code, 1, 4)||'10-'||to_char( to_number( substr( code, 1, 4))+1)||'03', '11', substr( code, 1, 4)||'10-'||to_char( to_number( substr( code, 1, 4))+1)||'03', '12', substr( code, 1, 4)||'10-'||to_char( to_number( substr( code, 1, 4))+1)||'03', '01', to_char( to_number( substr( code, 1, 4))-1)||'10-'||substr( code, 1, 4)||'03', '02', to_char( to_number( substr( code, 1, 4))-1)||'10-'||substr( code, 1, 4)||'03', '03', to_char( to_number( substr( code, 1, 4))-1)||'10-'||substr( code, 1, 4)||'03'), acct_prd from period where code = a.sales_period) where tran_date = trunc(trunc(sysdate)-1); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GL_ALLAC_DEMO (m_frst_date in date, m_date_from in date, m_sundry_type in char, m_sundry_code in char,m_finent in char) return number is ls_site_code char(10) ; ld_op_bal number(14,3); cursor c1 is Select DISTINCT (site_code) from gltrace where FIN_ENTITY = m_finent and tran_date >= m_frst_date and tran_date < m_date_from and sundry_type = m_sundry_type and sundry_code= m_sundry_code; begin OPEN c1; LOOP fetch c1 into ls_site_code; ld_op_bal:= fn_rdayop_gl_allac(m_frst_date , m_date_from, m_sundry_type, m_sundry_code, ls_site_code); exit when c1%NOTFOUND; end loop; CLOSE c1; return ld_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_MFGDATE (as_ordtype in char, adt_orddate in date, adt_mfgdate in date) return varchar2 is ls_itemser itemser.item_ser%type; ls_sitecode site.site_code%type; ll_count number(6,0) := 0; ls_retval varchar2(1) := '0'; begin if adt_mfgdate is null then return ls_retval ; end if; if ltrim(rtrim(as_ordtype)) = 'P' and (to_date(adt_mfgdate) > to_date(adt_orddate)) then return '1'; end if; if ltrim(rtrim(as_ordtype)) = 'F' and (to_date(adt_mfgdate) < to_date(adt_orddate)) then return '1'; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE SUNDRYMASTERTABLE AS TABLE OF sundryMaster -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_LINE_NO_RES_ALLOC (AS_PROJ_CODE IN CHAR,AS_LINE_NO__TSK IN NUMBER) RETURN NUMBER IS LINE_NO_T NUMBER(3); BEGIN LINE_NO_T := 1; --THIS FUNCTION ADDED BY NISAR AHMAD ON 21/08/09 FOR AUTO INCREMENT LINE NO-- SELECT CASE WHEN MAX(NVL(LINE_NO,0)) IS NULL THEN 1 ELSE MAX(NVL(LINE_NO,0))+1 END INTO LINE_NO_T FROM PROJ_TASK_RES_ALLOC WHERE PROJ_CODE=AS_PROJ_CODE AND LINE_NO__TSK=AS_LINE_NO__TSK; RETURN LINE_NO_T; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 1; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX APPR_GROUPDET_PK ON APPR_GROUPDET (APPR_GROUP, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EDUCESSAMT ( as_tran_id char , as_transer char ) return decimal is lc_tax_amt decimal (14,3); ls_var_value varchar2(100); begin select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = 'EDU_CESS_TAXCODE'; if length(trim(ls_var_value)) > 0 then select nvl(sum(tax_amt),0) into lc_tax_amt from taxtran where tran_code = as_transer and instr(ls_var_value,rtrim(tax_code)) > 0 and tran_id = as_tran_id; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPLIT_STOCKRCP_TRACE_X ON SPLITSTOCK_RCP (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_FORM16A_CHNO (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_chno varchar2(20) ; ls_chno_det varchar2(20); ctr number(3); cursor c1 is select nvl(handover_chno,'') from misc_payment where tran_id in ( select tran_id from misc_paydet where tran_ser = ls_ref_ser and vouch_no = ls_vouch_no ) order by handover_date desc ; begin open c1; ctr := 0; ls_chno := ' ' ; loop fetch c1 into ls_chno_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_chno_det)) > 0 then ls_chno_det := ','||ls_chno_det ; end if ; end if ; ls_chno := rtrim(ls_chno)||''|| ls_chno_det ; ctr := ctr + 1; end loop ; close c1; return ls_chno ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_PROCESSSIZE (as_wo workorder.work_order%type, as_route procroute.route_code%type, as_opr procroute.operation%type) return number is ll_size number(14,3); begin select nvl(quantity,0) into ll_size from worder_route where work_order = as_wo and route_code = as_route and operation = as_opr and rownum = 1; return ll_size; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_MFG_CDNM (as_ref_id in invoice_trace.invoice_id%type,as_ref_line in invoice_trace.inv_line_no%type,as_ref_ser in invtrace.ref_ser%type,as_ret_type in char) return varchar is ls_mfg_cdnm varchar2(500) :=' '; ls_supp_code__mfg CHAR(10):=' '; ls_supp_name VARCHAR2(50):=' '; ls_sh_name VARCHAR2(40):=' '; ls_udf_1 VARCHAR2(60):=' '; ----S-INV for A cursor c1 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' '),nvl(ff.supp_name,' '),nvl(ff.udf_1,' ') from despatchdet aa, despatch ee,invoice bb, invoice_trace cc,stock dd,supplier ff where bb.invoice_id = cc.invoice_id and bb.desp_id = ee.desp_id and aa.desp_id = ee.desp_id and cc.desp_id = ee.desp_id and cc.desp_line_no = aa.line_no and bb.site_code = dd.site_code and aa.item_code = dd.item_code and aa.loc_code = dd.loc_code and aa.lot_no = dd.lot_no and aa.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.invoice_id = as_ref_id; --and cc.inv_line_no in as_ref_line; ----S-INV for C cursor c2 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' ') from despatchdet aa, despatch ee,invoice bb, invoice_trace cc,stock dd,supplier ff where bb.invoice_id = cc.invoice_id and bb.desp_id = ee.desp_id and aa.desp_id = ee.desp_id and cc.desp_id = ee.desp_id and cc.desp_line_no = aa.line_no and bb.site_code = dd.site_code and aa.item_code = dd.item_code and aa.loc_code = dd.loc_code and aa.lot_no = dd.lot_no and aa.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.invoice_id = as_ref_id and cc.desp_line_no = as_ref_line; --and cc.inv_line_no = as_ref_line; ----D-RCP for C cursor c3 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' ') from DISTORD_RCP aa,DISTORD_RCPDET bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id and bb.line_no = as_ref_line; ----D-RCP for A cursor c4 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' '),nvl(ff.supp_name,' '),nvl(ff.udf_1,' ') from DISTORD_RCP aa,DISTORD_RCPDET bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id; ----D-ISS for C cursor c5 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' ') from distord_iss aa,distord_issdet bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id and bb.line_no = as_ref_line; ----D-ISS for A cursor c6 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' '),nvl(ff.supp_name,' '),nvl(ff.udf_1,' ') from distord_iss aa,distord_issdet bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id ; ----S-RET for A cursor c7 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' '),nvl(ff.supp_name,' '),nvl(ff.udf_1,' ') from SRETURN aa,SRETURNDET bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id ; ----S-RET for C cursor c8 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' ') from SRETURN aa,SRETURNDET bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id and bb.line_no = as_ref_line; ----CRNRCP for A cursor c9 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' '),nvl(ff.supp_name,' '),nvl(ff.udf_1,' ') from drcr_rcp aa,drcr_rdet bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code --and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id ; ----CRNRCP for C cursor c10 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' ') from drcr_rcp aa,drcr_rdet bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code --and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id and bb.line_no = as_ref_line; ----MDRCRC for A cursor c11 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' '),nvl(ff.supp_name,' '),nvl(ff.udf_1,' ') from MISC_DRCR_RCP aa,MISC_DRCR_RDET bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code --and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id ; ------MDRCRC for C cursor c12 is select distinct nvl(dd.supp_code__mfg,' '),nvl(ff.sh_name,' ') from MISC_DRCR_RCP aa,MISC_DRCR_RDET bb,stock dd,supplier ff where aa.TRAN_ID = bb.TRAN_ID and aa.site_code = dd.site_code and bb.item_code = dd.item_code --and bb.loc_code = dd.loc_code and bb.lot_no = dd.lot_no and bb.lot_sl = dd.lot_sl and dd.supp_code__mfg = ff.supp_code(+) and bb.tran_id = as_ref_id and bb.line_no = as_ref_line; begin if as_ref_ser='S-INV' and as_ret_type = 'A' then begin open c1; loop fetch c1 into ls_supp_code__mfg,ls_sh_name, ls_supp_name, ls_udf_1 ; exit when c1%NOTFOUND; if ls_supp_code__mfg != ' ' then ls_mfg_cdnm := ls_mfg_cdnm || ls_sh_name||':'|| ls_supp_name ||':'|| ls_udf_1 ||chr(10); end if; end loop; close c1; end; elsif as_ref_ser='S-INV'and as_ret_type = 'C' then begin open c2; loop fetch c2 into ls_supp_code__mfg,ls_sh_name; exit when c2%NOTFOUND; ls_mfg_cdnm := ls_sh_name; end loop; close c2; end; elsif as_ref_ser='D-RCP'and as_ret_type = 'C' then begin open c3; loop fetch c3 into ls_supp_code__mfg,ls_sh_name; exit when c3%NOTFOUND; ls_mfg_cdnm := ls_sh_name; end loop; close c3; end; elsif as_ref_ser='D-RCP'and as_ret_type = 'A' then begin open c4; loop fetch c4 into ls_supp_code__mfg,ls_sh_name, ls_supp_name, ls_udf_1 ; exit when c4%NOTFOUND; if ls_supp_code__mfg != ' ' then ls_mfg_cdnm := ls_mfg_cdnm || ls_sh_name||':'|| ls_supp_name ||':'|| ls_udf_1 ||chr(10); end if; end loop; close c4; end; elsif as_ref_ser='D-ISS'and as_ret_type = 'C' then begin open c5; loop fetch c5 into ls_supp_code__mfg,ls_sh_name; exit when c5%NOTFOUND; ls_mfg_cdnm := ls_sh_name; end loop; close c5; end; elsif as_ref_ser='D-ISS' and as_ret_type = 'A' then begin open c6; loop fetch c6 into ls_supp_code__mfg,ls_sh_name, ls_supp_name, ls_udf_1 ; exit when c6%NOTFOUND; if ls_supp_code__mfg != ' ' then ls_mfg_cdnm := ls_mfg_cdnm || ls_sh_name||':'|| ls_supp_name ||':'|| ls_udf_1 ||chr(10); end if; end loop; close c6; end; elsif as_ref_ser='S-RET' and as_ret_type = 'A' then begin open c7; loop fetch c7 into ls_supp_code__mfg,ls_sh_name, ls_supp_name, ls_udf_1 ; exit when c7%NOTFOUND; if ls_supp_code__mfg != ' ' then ls_mfg_cdnm := ls_mfg_cdnm || ls_sh_name||':'|| ls_supp_name ||':'|| ls_udf_1 ||chr(10); end if; end loop; close c7; end; elsif as_ref_ser='S-RET'and as_ret_type = 'C' then begin open c8; loop fetch c8 into ls_supp_code__mfg,ls_sh_name; exit when c8%NOTFOUND; ls_mfg_cdnm := ls_sh_name; end loop; close c8; end; elsif as_ref_ser='CRNRCP' and as_ret_type = 'A' then begin open c9; loop fetch c9 into ls_supp_code__mfg,ls_sh_name, ls_supp_name, ls_udf_1 ; exit when c9%NOTFOUND; if ls_supp_code__mfg != ' ' then ls_mfg_cdnm := ls_mfg_cdnm || ls_sh_name||':'|| ls_supp_name ||':'|| ls_udf_1 ||chr(10); end if; end loop; close c9; end; elsif as_ref_ser='CRNRCP'and as_ret_type = 'C' then begin open c10; loop fetch c10 into ls_supp_code__mfg,ls_sh_name; exit when c10%NOTFOUND; ls_mfg_cdnm := ls_sh_name; end loop; close c10; end; elsif as_ref_ser='MDRCRC' and as_ret_type = 'A' then begin open c11; loop fetch c11 into ls_supp_code__mfg,ls_sh_name, ls_supp_name, ls_udf_1 ; exit when c11%NOTFOUND; if ls_supp_code__mfg != ' ' then ls_mfg_cdnm := ls_mfg_cdnm || ls_sh_name||':'|| ls_supp_name ||':'|| ls_udf_1 ||chr(10); end if; end loop; close c11; end; elsif as_ref_ser='MDRCRC'and as_ret_type = 'C' then begin open c12; loop fetch c12 into ls_supp_code__mfg,ls_sh_name; exit when c12%NOTFOUND; ls_mfg_cdnm := ls_sh_name; end loop; close c12; end; end if; return (case when ls_mfg_cdnm is null then '' else rtrim(ls_mfg_cdnm,',') end); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_DUP_STRGCUST ( as_locality_code varchar2 , as_first_name varchar2 , as_middle_name varchar2 , as_last_name varchar2 , as_mobile_no varchar2 , as_reg_no varchar2 , as_sc_code char , as_cust_type char) return number is mvar_n_count number(5); begin declare mvar_n_count number(5); begin mvar_n_count := 0; select count(*) into mvar_n_count from strg_customer where locality_code = as_locality_code and case when first_name is null then ' ' else trim(upper(first_name)) end = case when as_first_name is null then ' ' else trim(upper(as_first_name)) end and case when middle_name is null then ' ' else trim(upper(middle_name)) end = case when as_middle_name is null then ' ' else trim(upper(as_middle_name)) end and case when last_name is null then ' ' else trim(upper(last_name)) end = case when as_last_name is null then ' ' else trim(upper(as_last_name)) end and case when mobile_no is null then ' ' else trim(upper(mobile_no)) end = case when as_mobile_no is null then ' ' else trim(upper(as_mobile_no)) end and case when reg_no is null then ' ' else trim(upper(reg_no)) end = case when as_reg_no is null then ' ' else trim(upper(as_reg_no)) end and sc_code <> as_sc_code and cust_type = as_cust_type; if mvar_n_count is null then mvar_n_count := 0; end if; return mvar_n_count; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE BUSINESS_PARNTER_TAXENV AS FUNCTION getTaxEnv (stateCode in CHAR,siteCode in CHAR, contType in CHAR) RETURN taxEnvironmentTable PIPELINED ; END; CREATE OR REPLACE PACKAGE BODY BUSINESS_PARNTER_TAXENV AS FUNCTION getTaxEnv (stateCode in CHAR,siteCode in CHAR, contType in CHAR) RETURN taxEnvironmentTable PIPELINED AS ls_type varchar(10); ls_udftype varchar(10); BEGIN select UDF_STR1 into ls_udftype from gencodes where mod_name ='W_BUSINESS_PARTNER' and fld_name='CONTACT_TYPE' and FLD_VALUE = contType; SELECT REGEXP_SUBSTR(ls_udftype, '[^,]+', 1, level) into ls_type FROM dual CONNECT BY REGEXP_SUBSTR(ls_udftype, '[^,]+', 1, level) IS NOT NULL and rownum = 1; IF trim(ls_type) in ('S', 'T', 'TA' ,'SP') THEN FOR X IN (SELECT H.TAX_ENV,H.DESCR FROM TAXENV H, TENVSTAN D WHERE H.TAX_ENV = D.TAX_ENV AND INSTR(H.BUSI_PROC_USE,'P') > 0 AND D.STATE_CODE__FR = stateCode AND D.STATE_CODE__TO = (SELECT STATE_CODE FROM SITE WHERE SITE_CODE = siteCode) AND NVL(H.STATUS,'A') = 'A') LOOP PIPE ROW (taxEnvtable(x.TAX_ENV,x.DESCR)); END LOOP; RETURN; ELSIF trim(ls_type) in ('C', 'CS') then For x IN (SELECT H.TAX_ENV,H.DESCR FROM TAXENV H, TENVSTAN D WHERE H.TAX_ENV = D.TAX_ENV AND INSTR(H.BUSI_PROC_USE,'S') > 0 AND D.STATE_CODE__FR = (SELECT STATE_CODE FROM SITE WHERE SITE_CODE = siteCode) AND D.STATE_CODE__TO = stateCode AND NVL(H.STATUS,'A') = 'A') LOOP PIPE ROW (taxEnvtable(x.TAX_ENV,x.DESCR)); END LOOP; RETURN; ELSE FOR x IN (select TAX_ENV,descr from TAXENV where NVL(STATUS ,'O') <> 'C') Loop PIPE ROW (taxEnvtable(x.TAX_ENV,x.DESCR)); END LOOP; RETURN; END IF; END getTaxEnv; END BUSINESS_PARNTER_TAXENV; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMPLOYEE_SITE_NAME ON EMPLOYEE_BAK (EMP_SITE, EMP_FNAME, EMP_MNAME, EMP_LNAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ATTENDANCEMASTER_IND ON ATTENDANCEMASTER (EMP_CD, DATE_PUNCH, TIME_PUNCH) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ADV_AMT (as_sundry_type char, as_sundry_code in char,as_acct_prd in char,as_sitewcode char) return number is lc_advamt number(14,3); begin select nvl(sum(sundrybal.adv_amt),0) into lc_advamt from sundrybal where ( sundrybal.acct_prd = as_acct_prd ) AND ( sundrybal.prd_code = 'zzzzzz' ) AND ( sundrybal.site_code = as_sitewcode ) AND ( sundrybal.sundry_type = as_sundry_type ) AND ( sundrybal.sundry_code = as_sundry_code ) ; return lc_advamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPROV_DT (AS_EMP_CODE CHAR, as_cctr_code char) RETURN char AS PROV_DT date; BEGIN select min(to_date) into PROV_DT from misc_voucher , employee, period where misc_voucher.sundry_code = employee.emp_code and misc_voucher.bill_no = period.code and misc_voucher.sundry_code = as_emp_code and employee.cctr_code__sal = as_cctr_code and misc_voucher.sundry_type = 'E' and VOUCH_TYPE = 'F' and misc_voucher.confirmed = 'Y' order by misc_voucher.bill_no; RETURN PROV_DT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_MTHLY_TDS_ELIG (AS_EMP_CODE char,AS_AD_CODE char,AS_PRD_CODE char,AS_AD_SLAB char) return number is a_prd_fr period.code%type; a_prd_to period.code%type; a_amount number(12,3) := 0; a_actual_amt number(12,3) := 0; a_slab_amt number(12,3) := 0; a_count number(1) := 0; a_count1 number(1) := 0; begin select count(*) into a_count from acctprd a,period b where b.code = AS_PRD_CODE and b.fr_date between a.it_fr_date and a.it_to_date; if (a_count <> 0) then select to_char(a.it_fr_date,'YYYYMM'),to_char(a.it_to_date,'YYYYMM') into a_prd_fr,a_prd_to from acctprd a,period b where b.code = AS_PRD_CODE and b.fr_date between a.it_fr_date and a.it_to_date; else select to_char(a.fr_date,'YYYYMM'),to_char(a.to_date,'YYYYMM') into a_prd_fr,a_prd_to from acctprd a,period b where b.code = AS_PRD_CODE and b.fr_date between a.fr_date and a.to_date; end if; select count(*) into a_count from employee where emp_code = AS_EMP_CODE and relieve_date is not null; declare cursor c1 is select code from period where code between a_prd_fr and a_prd_to order by code; begin for i in c1 loop select count(*) into a_count1 from payroll where prd_code = i.code and emp_code = AS_EMP_CODE and voucher_no is not null and voucher_no <> 'PAYROLL'; if (i.code < AS_PRD_CODE) or (a_count = 1) or (a_count1 = 1) then select sum(amount) into a_actual_amt from ( select sum(a.amount) amount from payrolldet a,payroll b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code = i.code and a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and b.voucher_no is not null union all select sum(a.diff_amt) amount from arreardet a,arrears b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code__acc = b.prd_code__acc and a.prd_code = i.code and a.emp_code = AS_EMP_CODE and a.prd_code__acc between a_prd_fr and a_prd_to and a.ad_code = AS_AD_CODE and b.voucher_no is not null ); else select sum(amount) into a_actual_amt from payroll_projdet where prd_code = AS_PRD_CODE and emp_code = AS_EMP_CODE and ad_code = AS_AD_CODE; end if; a_actual_amt := nvl(a_actual_amt,0); select nvl(sum(amount),0) into a_slab_amt from ad_slabs where ad_code = AS_AD_SLAB and i.code between min_base_amt and max_base_amt; if (a_actual_amt > a_slab_amt and a_slab_amt <> 0) then a_amount := a_amount + a_slab_amt; else a_amount := a_amount + a_actual_amt; end if; end loop; end; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_LOCATION_HR ON LOCATION_HR (LOC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECK_PHYSCAN_VALUE (LS_ITEM_CODE IN CHAR, LS_SITE_CODE IN CHAR, LS_LOC_CODE IN CHAR, LS_LOT_NO IN CHAR, LS_LOT_SL IN CHAR, LS_EXP_LOCK IN CHAR, LS_N_EXP_LOCK IN CHAR) RETURN NUMBER IS LS_NUM NUMBER ; LS_CNT NUMBER; BEGIN BEGIN SELECT COUNT(*) INTO LS_CNT FROM INV_HOLD_DET IHD , INV_HOLD IH WHERE TRIM(IHD.SITE_CODE) = TRIM(LS_SITE_CODE) AND TRIM(IHD.ITEM_CODE) = TRIM(LS_ITEM_CODE) AND TRIM(IHD.LOC_CODE) = TRIM(LS_LOC_CODE) AND TRIM(IHD.LOT_NO) = TRIM(LS_LOT_NO) AND TRIM(IHD.LOT_SL) = TRIM(LS_LOT_SL) AND IHD.TRAN_ID = IH.TRAN_ID AND TRIM(IH.LOCK_CODE) IN (TRIM(LS_EXP_LOCK),TRIM(LS_N_EXP_LOCK)) AND IHD.HOLD_STATUS = 'H'; IF (LS_CNT = 0) THEN LS_NUM := 0 ; ELSE LS_NUM := 1; END IF ; EXCEPTION WHEN NO_DATA_FOUND THEN LS_NUM := 0 ; END; RETURN LS_NUM ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MFG_EXP_DATE (as_site_code stock.site_code%type, as_item_code stock.item_code%type, as_lot_no stock.lot_no%type) return char is ls_string char(35); ls_unit char(10); ls_mfgdate char(10); ls_expdate char(10); ld_mfgdate date; ld_expdate date; begin select DECODE(mfg_date,null,lpad(' ',5),substr(to_char(mfg_date,'dd/mm/yy'),1,5)), DECODE(exp_date,null,lpad(' ',5),substr(to_char(exp_date,'dd/mm/yy'),1,5)) into ls_mfgdate, ls_expdate from stock where site_code = as_site_code and item_code = as_item_code and lot_no = as_lot_no and rownum = 1; select NVL(unit,'')||lpad(' ', 6) into ls_unit from item where item_code = as_item_code; select ls_unit || ls_mfgdate || ls_expdate into ls_string from dual; return (ls_string); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_OP_BAL_GL_TRACE (m_frst_date date,m_date_from date,m_sundry_type char ,m_sundry_code char, m_site_code char, m_acct_code char,macct_prd char ,mprd_fr char) Return number is ld_day_op_bal_tot number(14,3); dr_amt_b integer(14,3); cr_amt_b integer(14,3); ld_day_op_bal integer(14,3); begin select sum(decode(sundrybal.acct_prd, macct_prd, sundrybal.cr_amt__base, 0)) , sum(decode(sundrybal.acct_prd, macct_prd, sundrybal.dr_amt__base, 0)) into cr_amt_b , dr_amt_b FROM SUNDRYBAL where ( sundrybal.site_code in (m_site_code ))and ( sundrybal.acct_prd >= macct_prd ) and ( sundrybal.prd_code < mprd_fr ) AND ( sundrybal.sundry_code in ( m_sundry_code) ) AND ( sundrybal.acct_code in (m_acct_code) ) and ( sundrybal.sundry_type = m_sundry_type ) ; Select NVL(Sum((NVL(dr_amt,0) * NVL(exch_rate,0)) - (NVL(cr_amt,0) * NVL(exch_rate,0))),0) into ld_day_op_bal from gltrace where site_code=m_site_code and tran_date >=m_frst_date and tran_date <= m_date_from and sundry_type = m_sundry_type and sundry_code = m_sundry_code and acct_code in (m_acct_code); IF cr_amt_b IS NULL THEN cr_amt_b := 0; End if ; IF dr_amt_b IS NULL THEN dr_amt_b := 0 ; End if; ld_day_op_bal_tot := (dr_amt_b - cr_amt_b ) +NVL(ld_day_op_bal,0) ; If (ld_day_op_bal_tot) is null Then ld_day_op_bal_tot:=0 ; End if; Return ld_day_op_bal_tot; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKMOBILE ( p_whatsapp_mobile IN VARCHAR2 --(1.WHATSAPP_MOBILE) ) RETURN NUMBER IS -- Object Name: applicant_mgmt_applicant_info -- Event Type: field_validation -- Form Number: 1 -- Field Name: WHATSAPP_MOBILE -- Business Logic: length must be 10 -- Function Name: checkMobile v_is_valid NUMBER := 0; -- Variable to store validation result BEGIN -- Check if the length of the mobile number is exactly 10 IF LENGTH(p_whatsapp_mobile) = 10 AND REGEXP_LIKE(p_whatsapp_mobile, '^\d{10}$') THEN v_is_valid := 1; -- Set to 1 if valid ELSE v_is_valid := 0; -- Set to 0 if invalid END IF; RETURN v_is_valid; -- Return the validation result END checkMobile; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ESICF6_REMARK (p_empcd char,p_frprd char,p_toprd char ) return char is v_remark char(30); v_join char(15); v_relieve char(15); begin begin SELECT 'A - '||to_char(date_join,'dd/mm/yy') into v_join FROM employee WHERE emp_code = p_empcd and date_join between to_date('01/'||substr(p_frprd,5,2)||'/'||substr(p_frprd,1,4),'dd/mm/yyyy') AND last_day(to_date('01/'||substr(p_toprd,5,2)||'/'||substr(p_toprd,1,4) ,'dd/mm/yyyy')); EXCEPTION when no_data_found then v_join:=' '; end; begin SELECT 'L - '||to_char(relieve_date,'dd/mm/yy') into v_relieve FROM employee WHERE emp_code = p_empcd and relieve_date between to_date('01/'||substr(p_frprd,5,2)||'/'||substr(p_frprd,1,4),'dd/mm/yyyy') AND last_day(to_date('01/'||substr(p_toprd,5,2)||'/'||substr(p_toprd,1,4),'dd/mm/yyyy')); EXCEPTION when no_data_found then v_relieve:=' '; end ; v_remark:= v_join || v_relieve; return v_remark; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SAL_CCTR (as_invoice in char) return varchar2 is ls_retval varchar2(4); begin select cctr_code__sal into ls_retval from invoice where invoice_id = as_invoice ; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SPRS_WORK_WITH_STAN_TYPE (ls_sales_pers sprs_travel.sales_pers%type, ld_travel_date sprs_travel.travel_date%type, ls_sprs_code__ww sprs_travel.sprs_code__ww%type) return varchar2 is ls_stan_type stantype.stan_type%type; begin select distinct(g.stan_type) into ls_stan_type from sprs_travel e,sprs_route f,stantype g where ( e.sales_pers = ls_sales_pers or e.sales_pers = ls_sprs_code__ww ) and e.travel_date = ld_travel_date and ( e.sales_pers = f.sprs_code or e.sprs_code__ww = f.sprs_code ) and f.locality_code = e.locality_code (+) and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from sprs_travel b, sprs_route c, stantype d where ( b.sales_pers = e.sales_pers or b.sprs_code__ww = e.sales_pers ) and b.travel_date = e.travel_date and ( b.sales_pers = c.sprs_code or b.sprs_code__ww =c.sprs_code ) and b.locality_code = c.locality_code (+) and d.stan_type = c.station_type); return ls_stan_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAXABLE_TAX ( as_trancode in char, as_tran_id in char , as_lineno in char, as_type in char ) return decimal is lc_tax_amt decimal (14,3); ls_var_value varchar2(100); begin begin select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = 'EXC_TAX_CODE'; exception when others then ls_var_value := ' '; end; begin if length(trim(ls_var_value)) > 0 then if as_type = 'T' then select nvl(sum(tax_amt),0) into lc_tax_amt from taxtran where tran_code = as_trancode and tran_id = as_tran_id and to_number(line_no) = to_number(as_lineno) and instr(ls_var_value,rtrim(tax_code)) > 0 ; else select nvl(sum(taxable_amt),0) into lc_tax_amt from taxtran where tran_code = as_trancode and tran_id = as_tran_id and to_number(line_no) = to_number(as_lineno) and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; end if; exception when others then lc_tax_amt := 0; end; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_UNCONF_ISSQTY ( as_workorder in char, as_sitecode in char, as_itemcode in char, as_explev in char, as_loccoode in char, as_lotno in char, as_lotsl in char ) Return Number is ld_qty number(14,3); Begin Select sum(case when B.quantity is null then 0 else B.quantity end ) + sum(case when B.potency_adj is null then 0 else B.potency_adj end ) Into ld_qty From workorder_iss A, workorder_issdet B Where A.tran_id = B.tran_id And A.work_order = as_workorder And A.site_code = as_sitecode And B.item_code = as_itemcode And B.exp_lev = as_explev And B.loc_code = as_loccoode And B.lot_no = as_lotno And B.lot_sl = as_lotsl And case when A.confirmed is null then 'N' else A.confirmed end = 'N'; Return ld_qty; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GENMST_SQLINPUT (sql_input VARCHAR2 ,mod_name VARCHAR2 )RETURN VARCHAR2 is tranCol varchar2(100); sqlinput varchar2(100); tranidcolumn varchar2(100); comma_exists number := 0; string_exists number := 0; count1 number := 0; result number := 0; str VARCHAR2(500); BEGIN select lower(tran_id_col) into tranCol from TRANSETUP where tran_window = lower(mod_name); if tranCol is not null or length(trim(tranCol)) > 0 then BEGIN select case when instr(tranCol, ',') > 0 THEN 1 ELSE 0 END into comma_exists FROM dual; END; end if; if (comma_exists > 0) then BEGIN SELECT REGEXP_REPLACE(lower(sql_input), '[^a-zA-Z]', '') into sqlinput FROM dual; SELECT REGEXP_REPLACE(tranCol, '[^a-zA-Z]', '') into tranidcolumn FROM dual; if (sqlinput = tranidcolumn ) then string_exists := 1; else SELECT CASE WHEN INSTR(sqlinput, tranidcolumn) = 1 THEN 1 ELSE 0 END into count1 FROM dual; if count1 = 1 then string_exists := 1; else string_exists := 0; end if; end if; if(string_exists = 0) then result := 1; end if; if(string_exists = 1) then result := 0; end if; END; else result := 0; end if; RETURN result; END FN_GENMST_SQLINPUT; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX OBJ_SIGN_STATUS_CHG_I ON OBJ_SIGN_STATUS_CHG (REF_SER, REF_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_COURSE_ATTEND (ls_user_id in VARCHAR2 ,ls_course_status in char) return NUMBER is ls_retval NUMBER; begin select COUNT(*) into ls_retval from COURSE_ATTEND where USER_ID = ls_user_id and COURSE_STATUS = ls_course_status; return ls_retval; exception when too_many_rows then return ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE POPHELPPACKAGEFORSUNDRYCODE AS FUNCTION getSundryCodePophelp (asSyndryType in char) RETURN sundryMasterTable PIPELINED; END; CREATE OR REPLACE PACKAGE BODY POPHELPPACKAGEFORSUNDRYCODE AS FUNCTION getSundryCodePophelp (asSyndryType in char) RETURN sundryMasterTable PIPELINED IS BEGIN IF asSyndryType = 'E' THEN FOR x IN (SELECT EMPLOYEE.EMP_CODE, EMPLOYEE.EMP_FNAME||' '||EMPLOYEE. EMP_MNAME||' '||EMPLOYEE.EMP_LNAME AS EMP_NAME,TRIM(STATION.DESCR) as CITY, TRIM(DEPARTMENT.DESCR) AS DIVISION, TRIM(STATE.DESCR) AS STATE FROM EMPLOYEE, SITE, STATION, DEPARTMENT, STATE WHERE EMPLOYEE.WORK_SITE = SITE.SITE_CODE (+) AND EMPLOYEE.STAN_CODE__HQ = STATION.STAN_CODE (+) AND STATION.STATE_CODE = STATE.STATE_CODE (+) AND EMPLOYEE.DEPT_CODE = DEPARTMENT.DEPT_CODE (+)) --AND (EMPLOYEE.WORK_SITE = asLoginSite) ) LOOP PIPE ROW (sundryMaster(x.EMP_CODE,x.EMP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'S' THEN FOR x IN (SELECT SUPPLIER.SUPP_CODE, SUPPLIER.SUPP_NAME, TRIM(NVL(SUPPLIER .CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SUPPLIER, STATE WHERE nvl(SUPPLIER.BLACK_LIST,'N') != 'Y' AND SUPPLIER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SUPP_CODE,x.SUPP_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'C' THEN FOR x IN (SELECT CUSTOMER.CUST_CODE, CUSTOMER.CUST_NAME, CUSTOMER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM CUSTOMER, STATE WHERE CUSTOMER.STATE_CODE = STATE.STATE_CODE (+) AND CUSTOMER.CUST_CODE IN (SELECT CUSTOMER.CUST_CODE__BIL FROM CUSTOMER)) LOOP PIPE ROW (sundryMaster(x.CUST_CODE,x.CUST_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'T' THEN FOR x IN (SELECT TRANSPORTER.TRAN_CODE, TRANSPORTER.TRAN_NAME, TRANSPORTER .CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TRANSPORTER, STATE WHERE TRANSPORTER.STATE_CODE = STATE.STATE_CODE (+) AND TRANSPORTER_TYPE= 'T') LOOP PIPE ROW (sundryMaster(x.TRAN_CODE,x.TRAN_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'P' THEN FOR x IN (SELECT SALES_PERS.SALES_PERS, SALES_PERS.SP_NAME, SALES_PERS. CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SALES_PERS, STATE WHERE SALES_PERS.ACTIVE_YN <> 'N' AND SALES_PERS.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SALES_PERS,x.SP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'X' THEN FOR x IN (SELECT TAX_AUTHORITY.TAUTH_CODE, TAX_AUTHORITY.TAUTH_NAME, TAX_AUTHORITY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TAX_AUTHORITY, STATE WHERE TAX_AUTHORITY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.TAUTH_CODE,x.TAUTH_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'L' THEN FOR x IN (SELECT LOANPARTY.PARTY_cODE, LOANPARTY.PARTY_NAME, LOANPARTY. CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM LOANPARTY, STATE WHERE LOANPARTY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.PARTY_CODE,x.PARTY_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'R' THEN FOR x IN (SELECT STRG_CUSTOMER.SC_cODE, STRG_CUSTOMER.FIRST_NAME||' '|| STRG_CUSTOMER.MIDDLE_NAME||' '||STRG_CUSTOMER.LAST_NAME AS SC_NAME, CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM STRG_CUSTOMER, STATE WHERE STRG_CUSTOMER.STATUS ='A' AND STRG_CUSTOMER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SC_CODE,x.SC_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'B' THEN FOR x IN (SELECT BANK.BANK_CODE, BANK.BANK_NAME, BANK.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM BANK, STATE WHERE BANK.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.BANK_CODE,x.BANK_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType is NULL THEN FOR x IN (SELECT CONTACT.Contact_code, CONTACT.name, CONTACT.CITY,NULL DIVISION, TRIM(STATE.DESCR) AS STATE,contact.count_code FROM CONTACT, STATE WHERE contact.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.Contact_code,x.name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; END popHelpPackageForSundryCode; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_ORD_VAL ( as_dcr_id char, as_event_date date, as_sales_pers char, as_loc_code char ) Return Number as as_ord_val number(8,2); Begin Select nvl(sum(value),0) into as_ord_val from STRG_MEET_ORDER SMO where (dcr_id,Strg_Code) In ( select dcr_id,strg_code from Strg_Meet Where dcr_id = as_dcr_id and event_date = as_event_date AND SALES_PERS = as_sales_pers and locality_Code = as_loc_code ) and SMO.Quantity > 0; Return as_ord_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_EMP_APRSL_HDR ON EMP_APRSL_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLOYEE_BOND_I2 ON EMPLOYEE_BOND (TRAN_ID__PVOUCH, LINE_NO__PVOUCH) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PO_SORD_NO (as_purcorder in char) return varchar2 is ls_retval varchar2(10); ls_saleorder varchar2(10); ls_saleorderend varchar2(10); begin select sale_order, sale_order__end into ls_saleorder, ls_saleorderend from porder where purc_order = as_purcorder ; if (ls_saleorderend is not null) and (length(ltrim(rtrim(ls_saleorderend))) > 0) then return ls_saleorderend; else if (ls_saleorder is not null) and (length(ltrim(rtrim(ls_saleorder))) > 0) then return ls_saleorder; else return 'X'; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGITEMDISPLAY_SETPKVAL Before Insert On Strg_Item_Display For Each Row declare max_line_no number(10); begin if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_item_display where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_item_display where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SUNDRY_DET (as_sun_type in varchar2,as_sun_code in varchar2 ,as_flg in varchar2) return varchar2 is ls_flg varchar2(200); ls_name varchar2(100); ls_addr1 varchar2(100); ls_addr2 varchar2(100); ls_addr3 varchar2(100); ls_fname varchar2(100); ls_mname varchar2(100); ls_lname varchar2(100); ls_ftname varchar2(100); ls_ltname varchar2(100); ls_mdname varchar2(100); ls_phoneno varchar2(100); ls_city varchar2(100); ls_pin varchar2(100); ls_ret varchar2(1000); ls_stan varchar2(100); ls_stanm varchar2(100); begin case as_sun_type when 'T' then if as_flg = 'N' then select tran_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from transporter where tran_code = as_sun_code; elsif as_flg = 'D' then select tran_name, addr1, addr2, addr3, city, pin , tele1 into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_phoneno from transporter where tran_code = as_sun_code; end if; when 'B' then if as_flg = 'N' then select bank_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from bank where bank_code = as_sun_code; elsif as_flg = 'D' then select bank_name, addr1, addr2, addr3, city, pin , tele1 into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_phoneno from bank where bank_code = as_sun_code; end if; when 'X' then if as_flg = 'N' then select tauth_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from tax_authority where tauth_name = as_sun_code; elsif as_flg = 'D' then select tauth_name, addr1, addr2, addr3, city, pin , tele1 into ls_name,ls_addr1,ls_addr2, ls_addr3, ls_city, ls_pin , ls_phoneno from tax_authority where tauth_name = as_sun_code; end if; when 'E' then if as_flg = 'N' then select emp_fname, emp_mname, emp_lname, cur_add1, cur_add2, cur_add3 into ls_fname, ls_mname, ls_lname, ls_addr1, ls_addr2, ls_addr3 from employee where emp_code = as_sun_code; ls_name := trim(ls_fname) || ' ' || trim(ls_mname) || ' ' || trim(ls_lname); elsif as_flg = 'D' then select emp_fname, emp_mname, emp_lname, cur_add1, cur_add2, cur_add3, cur_city, cur_pin ,cur_tel1 into ls_fname, ls_mname, ls_lname, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin,ls_phoneno from employee where emp_code = as_sun_code; ls_name := trim(ls_fname) || ' ' || trim(ls_mname) || ' ' || trim(ls_lname); end if; when 'P' then if as_flg = 'N' then select sp_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from sales_pers where sales_pers = as_sun_code; elsif as_flg = 'D' then select sp_name, addr1, addr2, addr3, city, pin , tele1 into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_phoneno from sales_pers where sales_pers = as_sun_code; end if; when 'S' then if as_flg = 'N' then select supp_name, alt_addr1, alt_addr2, alt_addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from supplier where supp_code = as_sun_code; elsif as_flg = 'D' then select supp_name, addr1, addr2, addr3, city, pin , tele1 into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin, ls_phoneno from supplier where supp_code = as_sun_code; end if; when 'C' then if as_flg = 'N' then select cust_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from customer where cust_code = as_sun_code; elsif as_flg = 'D' then select cust_name, addr1, addr2, addr3, city, pin , tele1 into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_phoneno from customer where cust_code = as_sun_code; end if; when 'R' then if as_flg = 'N' then select (case when first_name is null then '' else first_name end), (case when middle_name is null then '' else middle_name end), (case when last_name is null then '' else last_name end), addr1, addr2, addr3 into ls_ftname,ls_mdname,ls_ltname, ls_addr1, ls_addr2, ls_addr3 from strg_customer where sc_code = as_sun_code; ls_name := ls_ftname || ' ' || ls_mdname || ' ' || ls_ltname; elsif as_flg = 'D' then select (case when first_name is null then '' else first_name end), (case when middle_name is null then '' else middle_name end), (case when last_name is null then '' else last_name end), addr1, addr2, addr3, city, pin , tele1 into ls_ftname,ls_mdname,ls_ltname, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_phoneno from strg_customer where sc_code = as_sun_code; ls_name := ls_ftname || ' ' || ls_mdname || ' ' || ls_ltname; end if; end case; ls_name := nvl(ls_name, ' '); ls_fname := nvl(ls_fname, ' '); ls_mname := nvl(ls_mname, ' '); ls_lname := nvl(ls_lname, ' '); ls_addr1 := nvl(ls_addr1,' '); ls_addr2 := nvl(ls_addr2,' '); ls_addr3 := nvl(ls_addr3,' '); ls_city := nvl(ls_city, ' '); ls_pin := nvl(ls_pin, ' '); if TRIM(ls_phoneno) is null then ls_phoneno := ' '; else ls_phoneno := 'Phone ' || ls_phoneno; end if; if as_flg = 'N' then ls_ret := ls_name||chr(10) || ls_addr1 || ' ' ||ls_addr2|| ' ' ||ls_addr3; elsif as_flg = 'D' then ls_ret := ls_name||chr(10) ||ls_addr1|| ' ' ||ls_addr2|| ' ' ||ls_addr3 || ' ' || trim(ls_city)||' '||ls_pin|| ' ' ||ls_phoneno; end if; return ls_ret; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FIG_TO_WORDS ( num IN NUMBER ) return varchar2 is ret_str varchar2(1000) := ' ' ; begin declare u_num number :=round(to_char(num),2); dec varchar2(40) := ' ' ; dec1 varchar2(40) := ' ' ; dec2 varchar2(40) := ' ' ; hund varchar2(40) := ' ' ; sizes number := 0 ; times number := 0 ; i number ; loops number := 1 ; begin sizes:= length(trunc(u_num,0)) ; -- dbms_output.put_line('size'||to_char(sizes)); times:= round(length(trunc(u_num/1000))/2) ; -- dbms_output.put_line('times'||to_char(times)); --pradeep singh if u_num = 0 then dec := ltrim(to_char(u_num,'0'),' .0') ; dec :=to_char(to_date(dec,'YY'),'YYSP')||' ZERO PAISE '; end if ; if u_num < 0.9 and u_num <> 0 then dec := ltrim(to_char(u_num,'0.00'),' .0') ; dec := ' '|| to_char(to_date(dec,'YY'),'YYSP')||' PAISE '; end if ; if u_num > 0.9 and u_num < 1.00 then dec := ltrim(to_char(mod(u_num,1),'0.00'),' .0') ; dec := ' '|| to_char(to_date(dec,'YY'),'YYSP')||' PAISE '; end if ; if u_num > 1.00 then dec1 := ltrim(to_char(mod(u_num,1),'0.00'),' .0') ; dec :=to_char(to_date(dec1,'YY'),'YYSP'); if dec1 <> 0 then dec2 := ltrim(to_char(mod(u_num,1),'0.00'),' .0') ; dec := ' AND '|| to_char(to_date(dec2,'YY'),'YYSP')||' PAISE '; end if; end if; --end pradeep singh if mod(trunc(u_num,0),1000) != 0 then hund := to_char(to_date(mod(trunc(u_num,0),1000),'YYY'),'YYYSP') ; end if ; ret_str := hund||dec ; if sizes > 3 then u_num := trunc(u_num/1000,0) ; if times > 2 then loops := 2 ; else loops := times ; end if ; for i in 1..loops loop if mod(u_num,100) != 0 then select to_char(to_date(mod(u_num,100),'YY'),'YYSP')|| decode(i,1,' THOUSAND ',2,' LACS ',' ')||ret_str into ret_str from dual ; end if ; u_num := trunc(u_num/100) ; end loop ; if times >= 3 then ret_str := fig_to_words(u_num)||' CRORE '||ret_str ; end if ; end if ; -- dbms_output.put_line('record '||(ret_str)); return(replace(ret_str,'-',' ')) ; end ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_WORKORDER_ISSUE_RET (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_STK_CUST_SITE_FROM_TO_DT ON CUST_STOCK (CUST_CODE, SITE_CODE, FROM_DATE, TO_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE STRGCODEPOPHELP AS FUNCTION getstrgCodePophelpData (empCode in char) RETURN strgCodeMasterMasterTABLE PIPELINED; END STRGCODEPOPHELP; CREATE OR REPLACE PACKAGE BODY STRGCODEPOPHELP AS FUNCTION getstrgCodePophelpData (empCode in char) RETURN strgCodeMasterMasterTABLE PIPELINED IS ls_cnt number(35); ls_parm_value varchar2(30); BEGIN SELECT GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) INTO ls_parm_value FROM DUAL; if (ls_parm_value = 'SPRS_STOCKIST') THEN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; if(ls_cnt > 0) then for x in(SELECT SC.SC_CODE AS strg_code, SC.FIRST_NAME ||' ' ||SC.MIDDLE_NAME ||' ' ||SC.LAST_NAME AS STRG_NAME, SC.CUST_TYPE AS STRG_TYPE, CAST(SC.ADDRESS_AS AS NVARCHAR2(150)) AS ADDRESS_AS, SC.SEX AS GENDER, SC.ADDR1,SC.ADDR2,SC.ADDR3,SC.EMAIL_ADDR,SC.MOBILE_NO, spl.spl_code AS SPL_CODE, SPL.DESCR AS SPECIALITY_DESCR, ss.class_code AS STRG_CLASS_CODE, SS.CLASS_CODE_DESCR AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, FN_GET_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST, DDF_TOTAL_TAX_AMOUNT('CGST') AS TOTAL_CGST, DDF_TOTAL_TAX_AMOUNT('SGST') AS TOTAL_SGST, ST.DESCR||' ('||TRIM(st.state_code)||') ' AS STRG_STATE , SC.GST_NO AS STRG_GST_NO , TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, GET_TAGGED_LOCATION(SC.SC_CODE,SR.SPRS_CODE) AS TAGGED_LOCATION, GET_TAGGED_ADDRESS(SC.SC_CODE,SR.SPRS_CODE) AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, GET_SFAPARM_DATA('VARIANCE_DISTANCE_LMT',empCode) AS VARIANCE_DISTANCE, (SELECT SUBCLASS_DESCR AS SUBCLASS_DESCR FROM STRG_CUST_SUBCLASS WHERE CLASS_CODE = SS.CLASS_CODE AND CUST_TYPE = SC.CUST_TYPE AND SUBCLASS_CODE = SS.SUBCLASS_CODE ) AS SUBCLASS_DESCR, SC.PROMOTER_NAME AS PROMOTER_NAME,SC.MAN_POWER AS MAN_POWER,SC.GST_NO AS GST_NO,SS.SUBCLASS_CODE AS SUBCLASS_CODE,SC.PIN AS PIN,SCT.SH_DESCR AS SH_DESCR,TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',empCode) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, SS.NO_VISIT AS NO_VISIT, FN_DISPLAY_LAST_REMARK(empCode,SC.SC_CODE) AS LAST_MEET_SUMM, FN_DISPLAY_LAST_MEET_DATE(empCode,SC.SC_CODE) AS LAST_MEET_DATE, SC.REG_NO AS REG_NO, DDF_GET_NON_ECO_DET(SC.SC_CODE) AS NON_ECO_DET, FN_GET_DISC_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST__DISC, ST.GST_CODE AS GST_CODE, FN_GET_PRICE_LIST__PAYDIS(empCode,SC.SC_CODE) AS PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE, STRG_SERIES SS LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE=SPL.SPL_CODE WHERE SS.SC_CODE=SC.SC_CODE AND SR.LOCALITY_CODE=SC.LOCALITY_CODE AND SR.ROUTE_ID=SS.ROUTE_ID AND SS.SALES_PERS=SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.STATUS='Y' AND SCT.DCR_GROUP <> 'S' UNION SELECT CUST.CUST_CODE AS strg_code, CUST.CUST_NAME AS STRG_NAME, CUST.CUST_TYPE AS STRG_TYPE, CAST(CUST.SH_NAME AS NVARCHAR2(150)) AS ADDRESS_AS, '' AS GENDER, CUST.ADDR1,CUST.ADDR2,CUST.ADDR3, '' AS EMAIL_ADDR, '' AS MOBILE_NO, '' AS SPL_CODE, '' AS SPECIALITY_DESCR, '' AS STRG_CLASS_CODE, '' AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, '' AS PRICE_LIST, 0 AS TOTAL_CGST, 0 AS TOTAL_SGST, ST.DESCR||' ('||TRIM(st.state_code)||') ' AS STRG_STATE , '' AS STRG_GST_NO, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, GET_TAGGED_LOCATION(CUST.CUST_CODE,SR.SPRS_CODE) AS TAGGED_LOCATION, GET_TAGGED_ADDRESS(CUST.CUST_CODE,SR.SPRS_CODE) AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, GET_SFAPARM_DATA('VARIANCE_DISTANCE_LMT',empCode) AS VARIANCE_DISTANCE, '' AS SUBCLASS_DESCR, '' AS PROMOTER_NAME, 0 AS MAN_POWER, '' AS GST_NO, '' AS SUBCLASS_CODE, CUST.PIN AS PIN, SCT.SH_DESCR AS SH_DESCR,TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',empCode) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, 0 AS NO_VISIT, FN_DISPLAY_LAST_REMARK(empCode,CUST.CUST_CODE) AS LAST_MEET_SUMM, FN_DISPLAY_LAST_MEET_DATE(empCode,CUST.CUST_CODE) AS LAST_MEET_DATE, '' AS REG_NO, DDF_GET_NON_ECO_DET(CUST.CUST_CODE) AS NON_ECO_DET, '' AS PRICE_LIST__DISC, ST.GST_CODE AS GST_CODE, '' AS PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, CUSTOMER CUST LEFT OUTER JOIN STRG_CUST_TYPE SCT ON CUST.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = CUST.STATE_CODE, SPRS_STOCKIST SS WHERE SS.CUST_CODE = CUST.CUST_CODE AND SR.LOCALITY_CODE = CUST.LOCALITY_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SS.SPRS_CODE = SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.STATUS='Y' AND CUST.BLACK_LISTED <> 'Y' ORDER BY STRG_NAME ) LOOP PIPE ROW (strgCodeMaster(x.STRG_CODE, x.STRG_NAME, x.STRG_TYPE, x.ADDRESS_AS, x.GENDER, x.ADDR1, x.ADDR2, x.ADDR3, x.EMAIL_ADDR, x.MOBILE_NO, x.SPL_CODE, x.SPECIALITY_DESCR, x.STRG_CLASS_CODE, x.CLASS_CODE_DESCR, x.LOCALITY_CODE, x.LOCALITY_DESCR, x.PRICE_LIST, x.TOTAL_CGST, x.TOTAL_SGST, x.STRG_STATE, x.STRG_GST_NO, x.VISITED_WITH_TEAM, x.TAGGED_LOCATION, x.GEOPOS_ADDRESS, x.ALLWD_DELAY_PRD, x.VARIANCE_DISTANCE, x.SUBCLASS_DESCR, x.PROMOTER_NAME, x.MAN_POWER, x.GST_NO, x.SUBCLASS_CODE, x.PIN, x.SH_DESCR, x.ROUTE_ID, x.SURVEY_TEMPL, x.NO_VISIT, x.LAST_MEET_SUMM, x.LAST_MEET_DATE, x.REG_NO, x.NON_ECO_DET, x.PRICE_LIST__DISC, x.GST_CODE, x.PRICE_LIST__PAYDIS)); END LOOP; RETURN; END IF; if(ls_cnt <= 0) then for x in(SELECT SC.SC_CODE AS strg_code, SC.FIRST_NAME ||' ' ||SC.MIDDLE_NAME ||' ' ||SC.LAST_NAME AS STRG_NAME, SC.CUST_TYPE AS STRG_TYPE, CAST(SC.ADDRESS_AS AS NVARCHAR2(150)) AS ADDRESS_AS, SC.SEX AS GENDER, SC.ADDR1,SC.ADDR2,SC.ADDR3,SC.EMAIL_ADDR,SC.MOBILE_NO, spl.spl_code AS SPL_CODE, SPL.DESCR AS SPECIALITY_DESCR, ss.class_code AS STRG_CLASS_CODE, SS.CLASS_CODE_DESCR AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, FN_GET_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST, DDF_TOTAL_TAX_AMOUNT('CGST') AS TOTAL_CGST, DDF_TOTAL_TAX_AMOUNT('SGST') AS TOTAL_SGST, ST.DESCR||' ('||TRIM(st.state_code)||') ' AS STRG_STATE , SC.GST_NO AS STRG_GST_NO , TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, GET_TAGGED_LOCATION(SC.SC_CODE,SR.SPRS_CODE) AS TAGGED_LOCATION, GET_TAGGED_ADDRESS(SC.SC_CODE,SR.SPRS_CODE) AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, GET_SFAPARM_DATA('VARIANCE_DISTANCE_LMT',empCode) AS VARIANCE_DISTANCE, (SELECT SUBCLASS_DESCR AS SUBCLASS_DESCR FROM STRG_CUST_SUBCLASS WHERE CLASS_CODE = SS.CLASS_CODE AND CUST_TYPE = SC.CUST_TYPE AND SUBCLASS_CODE = SS.SUBCLASS_CODE ) AS SUBCLASS_DESCR, SC.PROMOTER_NAME AS PROMOTER_NAME,SC.MAN_POWER AS MAN_POWER,SC.GST_NO AS GST_NO,SS.SUBCLASS_CODE AS SUBCLASS_CODE,SC.PIN AS PIN,SCT.SH_DESCR AS SH_DESCR,TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',empCode) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, SS.NO_VISIT AS NO_VISIT, FN_DISPLAY_LAST_REMARK(empCode,SC.SC_CODE) AS LAST_MEET_SUMM, FN_DISPLAY_LAST_MEET_DATE(empCode,SC.SC_CODE) AS LAST_MEET_DATE, SC.REG_NO AS REG_NO, DDF_GET_NON_ECO_DET(SC.SC_CODE) AS NON_ECO_DET, FN_GET_DISC_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST__DISC, ST.GST_CODE AS GST_CODE, FN_GET_PRICE_LIST__PAYDIS(empCode,SC.SC_CODE) AS PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE, STRG_SERIES SS LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE=SPL.SPL_CODE WHERE SS.SC_CODE=SC.SC_CODE AND SR.LOCALITY_CODE=SC.LOCALITY_CODE AND SS.SALES_PERS=SR.SPRS_CODE AND SR.ROUTE_ID=SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.STATUS='Y' AND SCT.DCR_GROUP <> 'S' UNION SELECT CUST.CUST_CODE AS strg_code, CUST.CUST_NAME AS STRG_NAME, CUST.CUST_TYPE AS STRG_TYPE, CAST(CUST.SH_NAME AS NVARCHAR2(150)) AS ADDRESS_AS, '' AS GENDER, CUST.ADDR1,CUST.ADDR2,CUST.ADDR3,'' AS EMAIL_ADDR,'' AS MOBILE_NO, '' AS SPL_CODE, '' AS SPECIALITY_DESCR, '' AS STRG_CLASS_CODE, '' AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, '' AS PRICE_LIST, 0 AS TOTAL_CGST, 0 AS TOTAL_SGST, ST.DESCR||' ('||TRIM(st.state_code)||') ' AS STRG_STATE , '' AS STRG_GST_NO, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, GET_TAGGED_LOCATION(CUST.CUST_CODE,SR.SPRS_CODE) AS TAGGED_LOCATION, GET_TAGGED_ADDRESS(CUST.CUST_CODE,SR.SPRS_CODE) AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, GET_SFAPARM_DATA('VARIANCE_DISTANCE_LMT',empCode) AS VARIANCE_DISTANCE, '' AS SUBCLASS_DESCR, '' AS PROMOTER_NAME, 0 AS MAN_POWER, '' AS GST_NO, '' AS SUBCLASS_CODE, CUST.PIN AS PIN,SCT.SH_DESCR AS SH_DESCR,TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',empCode) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, 0 AS NO_VISIT, FN_DISPLAY_LAST_REMARK(empCode,CUST.CUST_CODE) AS LAST_MEET_SUMM, FN_DISPLAY_LAST_MEET_DATE(empCode,CUST.CUST_CODE) AS LAST_MEET_DATE, '' AS REG_NO, DDF_GET_NON_ECO_DET(CUST.CUST_CODE) AS NON_ECO_DET, '' AS PRICE_LIST__DISC, ST.GST_CODE AS GST_CODE, '' AS PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, CUSTOMER CUST LEFT OUTER JOIN STRG_CUST_TYPE SCT ON CUST.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = CUST.STATE_CODE, SPRS_STOCKIST SS WHERE SS.CUST_CODE = CUST.CUST_CODE AND SR.LOCALITY_CODE = CUST.LOCALITY_CODE AND SS.SPRS_CODE = SR.SPRS_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.STATUS='Y' AND CUST.BLACK_LISTED <> 'Y' ORDER BY STRG_NAME) LOOP PIPE ROW (strgCodeMaster(x.strg_code,x.STRG_NAME,x.STRG_TYPE,x.ADDRESS_AS,x.GENDER,x.ADDR1,x.ADDR2,x.ADDR3,x.EMAIL_ADDR,x.MOBILE_NO,x.SPL_CODE,x.SPECIALITY_DESCR,x.STRG_CLASS_CODE,x.CLASS_CODE_DESCR,x.LOCALITY_CODE,x.LOCALITY_DESCR,x.PRICE_LIST,x.TOTAL_CGST,x.TOTAL_SGST,x.STRG_STATE,x.STRG_GST_NO,x.VISITED_WITH_TEAM,x.TAGGED_LOCATION,x.GEOPOS_ADDRESS,x.ALLWD_DELAY_PRD,x.VARIANCE_DISTANCE,x.SUBCLASS_DESCR,x.PROMOTER_NAME,x.MAN_POWER,x.GST_NO,x.SUBCLASS_CODE,x.PIN,x.SH_DESCR,x.ROUTE_ID,x.SURVEY_TEMPL,x.NO_VISIT,x.LAST_MEET_SUMM,x.LAST_MEET_DATE,x.REG_NO,x.NON_ECO_DET,x.PRICE_LIST__DISC,x.GST_CODE,x.PRICE_LIST__PAYDIS)); END LOOP; RETURN; end if; ELSE SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; if(ls_cnt > 0) then for x in(SELECT SC.SC_CODE AS strg_code, SC.FIRST_NAME ||' ' ||SC.MIDDLE_NAME ||' ' ||SC.LAST_NAME AS STRG_NAME, SC.CUST_TYPE AS STRG_TYPE, CAST(SC.ADDRESS_AS AS NVARCHAR2(150)) AS ADDRESS_AS, SC.SEX AS GENDER, SC.ADDR1,SC.ADDR2,SC.ADDR3,SC.EMAIL_ADDR,SC.MOBILE_NO, spl.spl_code AS SPL_CODE, SPL.DESCR AS SPECIALITY_DESCR, ss.class_code AS STRG_CLASS_CODE, SS.CLASS_CODE_DESCR AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, FN_GET_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST, DDF_TOTAL_TAX_AMOUNT('CGST') AS TOTAL_CGST, DDF_TOTAL_TAX_AMOUNT('SGST') AS TOTAL_SGST, ST.DESCR||' ('||TRIM(st.state_code)||') ' AS STRG_STATE , SC.GST_NO AS STRG_GST_NO , TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, GET_TAGGED_LOCATION(SC.SC_CODE,SR.SPRS_CODE) AS TAGGED_LOCATION, GET_TAGGED_ADDRESS(SC.SC_CODE,SR.SPRS_CODE) AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, GET_SFAPARM_DATA('VARIANCE_DISTANCE_LMT',empCode) AS VARIANCE_DISTANCE, (SELECT SUBCLASS_DESCR AS SUBCLASS_DESCR FROM STRG_CUST_SUBCLASS WHERE CLASS_CODE = SS.CLASS_CODE AND CUST_TYPE = SC.CUST_TYPE AND SUBCLASS_CODE = SS.SUBCLASS_CODE ) AS SUBCLASS_DESCR, SC.PROMOTER_NAME AS PROMOTER_NAME,SC.MAN_POWER AS MAN_POWER,SC.GST_NO AS GST_NO,SS.SUBCLASS_CODE AS SUBCLASS_CODE,SC.PIN AS PIN,SCT.SH_DESCR AS SH_DESCR,TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',empCode) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, SS.NO_VISIT AS NO_VISIT, FN_DISPLAY_LAST_REMARK(empCode,SC.SC_CODE) AS LAST_MEET_SUMM, FN_DISPLAY_LAST_MEET_DATE(empCode,SC.SC_CODE) AS LAST_MEET_DATE, SC.REG_NO AS REG_NO, DDF_GET_NON_ECO_DET(SC.SC_CODE) AS NON_ECO_DET, FN_GET_DISC_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST__DISC, ST.GST_CODE AS GST_CODE, FN_GET_PRICE_LIST__PAYDIS(empCode,SC.SC_CODE) AS PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE, STRG_SERIES SS LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE=SPL.SPL_CODE WHERE SS.SC_CODE=SC.SC_CODE AND SR.LOCALITY_CODE=SC.LOCALITY_CODE AND SR.ROUTE_ID=SS.ROUTE_ID AND SS.SALES_PERS=SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.STATUS='Y' ORDER BY STRG_NAME) LOOP PIPE ROW (strgCodeMaster(x.STRG_CODE, x.STRG_NAME, x.STRG_TYPE, x.ADDRESS_AS, x.GENDER, x.ADDR1, x.ADDR2, x.ADDR3, x.EMAIL_ADDR, x.MOBILE_NO, x.SPL_CODE, x.SPECIALITY_DESCR, x.STRG_CLASS_CODE, x.CLASS_CODE_DESCR, x.LOCALITY_CODE, x.LOCALITY_DESCR, x.PRICE_LIST, x.TOTAL_CGST, x.TOTAL_SGST, x.STRG_STATE, x.STRG_GST_NO, x.VISITED_WITH_TEAM, x.TAGGED_LOCATION, x.GEOPOS_ADDRESS, x.ALLWD_DELAY_PRD, x.VARIANCE_DISTANCE, x.SUBCLASS_DESCR, x.PROMOTER_NAME, x.MAN_POWER, x.GST_NO, x.SUBCLASS_CODE, x.PIN, x.SH_DESCR, x.ROUTE_ID, x.SURVEY_TEMPL, x.NO_VISIT, x.LAST_MEET_SUMM, x.LAST_MEET_DATE, x.REG_NO, x.NON_ECO_DET, x.PRICE_LIST__DISC, x.GST_CODE, x.PRICE_LIST__PAYDIS)); END LOOP; RETURN; END IF; if(ls_cnt <= 0) then for x in(SELECT SC.SC_CODE AS strg_code, SC.FIRST_NAME ||' ' ||SC.MIDDLE_NAME ||' ' ||SC.LAST_NAME AS STRG_NAME, SC.CUST_TYPE AS STRG_TYPE, CAST(SC.ADDRESS_AS AS NVARCHAR2(150)) AS ADDRESS_AS, SC.SEX AS GENDER, SC.ADDR1,SC.ADDR2,SC.ADDR3,SC.EMAIL_ADDR,SC.MOBILE_NO, spl.spl_code AS SPL_CODE, SPL.DESCR AS SPECIALITY_DESCR, ss.class_code AS STRG_CLASS_CODE, SS.CLASS_CODE_DESCR AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, FN_GET_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST, DDF_TOTAL_TAX_AMOUNT('CGST') AS TOTAL_CGST, DDF_TOTAL_TAX_AMOUNT('SGST') AS TOTAL_SGST, ST.DESCR||' ('||TRIM(st.state_code)||') ' AS STRG_STATE , SC.GST_NO AS STRG_GST_NO , TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, GET_TAGGED_LOCATION(SC.SC_CODE,SR.SPRS_CODE) AS TAGGED_LOCATION, GET_TAGGED_ADDRESS(SC.SC_CODE,SR.SPRS_CODE) AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, GET_SFAPARM_DATA('VARIANCE_DISTANCE_LMT',empCode) AS VARIANCE_DISTANCE, (SELECT SUBCLASS_DESCR AS SUBCLASS_DESCR FROM STRG_CUST_SUBCLASS WHERE CLASS_CODE = SS.CLASS_CODE AND CUST_TYPE = SC.CUST_TYPE AND SUBCLASS_CODE = SS.SUBCLASS_CODE ) AS SUBCLASS_DESCR, SC.PROMOTER_NAME AS PROMOTER_NAME,SC.MAN_POWER AS MAN_POWER,SC.GST_NO AS GST_NO,SS.SUBCLASS_CODE AS SUBCLASS_CODE,SC.PIN AS PIN,SCT.SH_DESCR AS SH_DESCR,TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',empCode) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, SS.NO_VISIT AS NO_VISIT, FN_DISPLAY_LAST_REMARK(empCode,SC.SC_CODE) AS LAST_MEET_SUMM, FN_DISPLAY_LAST_MEET_DATE(empCode,SC.SC_CODE) AS LAST_MEET_DATE, SC.REG_NO AS REG_NO, DDF_GET_NON_ECO_DET(SC.SC_CODE) AS NON_ECO_DET, FN_GET_DISC_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST__DISC, ST.GST_CODE AS GST_CODE, FN_GET_PRICE_LIST__PAYDIS(empCode,SC.SC_CODE) AS PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE, STRG_SERIES SS LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE=SPL.SPL_CODE WHERE SS.SC_CODE=SC.SC_CODE AND SR.LOCALITY_CODE=SC.LOCALITY_CODE AND SS.SALES_PERS=SR.SPRS_CODE AND SR.ROUTE_ID=SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.STATUS='Y' ORDER BY STRG_NAME) LOOP PIPE ROW (strgCodeMaster(x.strg_code,x.STRG_NAME,x.STRG_TYPE,x.ADDRESS_AS,x.GENDER,x.ADDR1,x.ADDR2,x.ADDR3,x.EMAIL_ADDR,x.MOBILE_NO,x.SPL_CODE,x.SPECIALITY_DESCR,x.STRG_CLASS_CODE,x.CLASS_CODE_DESCR,x.LOCALITY_CODE,x.LOCALITY_DESCR,x.PRICE_LIST,x.TOTAL_CGST,x.TOTAL_SGST,x.STRG_STATE,x.STRG_GST_NO,x.VISITED_WITH_TEAM,x.TAGGED_LOCATION,x.GEOPOS_ADDRESS,x.ALLWD_DELAY_PRD,x.VARIANCE_DISTANCE,x.SUBCLASS_DESCR,x.PROMOTER_NAME,x.MAN_POWER,x.GST_NO,x.SUBCLASS_CODE,x.PIN,x.SH_DESCR,x.ROUTE_ID,x.SURVEY_TEMPL,x.NO_VISIT,x.LAST_MEET_SUMM,x.LAST_MEET_DATE,x.REG_NO,x.NON_ECO_DET,x.PRICE_LIST__DISC,x.GST_CODE,x.PRICE_LIST__PAYDIS)); END LOOP; RETURN; END IF; end if; END; END strgCodePophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CLSTK_QV_CCTR_ITEM_GRADE (as_sitecode in char, as_itemcode in char, adt_fromdate in date, as_available in char, as_cctr_code in char, as_qtyvalue in char, as_grade in char ) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) ),0), nvl(sum ((nvl(a.eff_qty,0) * nvl(a.rate,0) ) ),0) ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.item_code = d.item_code and a.site_code = d.site_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.grade = d.grade and a.item_code = as_itemcode and a.site_code = as_sitecode and d.grade = as_grade and d.cctr_code__inv = as_cctr_code and a.tran_date <= adt_fromdate and instr(as_available,c.available) > 0 ); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_LOT_RATE (mprice_list in char, mitem_code in char, mlot_no in char) return number is mrate number := 0; begin select nvl(rate, 0) into mrate from pricelist where price_list = mprice_list and item_code = mitem_code and sysdate between eff_from and valid_upto and mlot_no between lot_no__from and lot_no__to; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DISTANCEDET_X ON DISTANCEDET (STAN_CODE__FROM, STAN_CODE__TO, LOAD_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOAN_SUM_ARREARS (as_loan_no CHAR, prd_code_fr CHAR, prd_code_to CHAR) return NUMBER is lc_sum_arrears NUMBER(14,2) := 0.00; BEGIN SELECT sum(arreardet.diff_amt) into lc_sum_arrears FROM arreardet, arrears WHERE ( arreardet.prd_code = arrears.prd_code ) and ( arreardet.emp_code = arrears.emp_code ) and ( arreardet.prd_code__acc = arrears.prd_code__acc ) and ( ( arreardet.ref_type = 'L' ) AND ( arreardet.ref_no = as_loan_no ) AND ( arreardet.diff_amt <> 0 ) AND ( arrears.voucher_no is not NULL ) and ( arreardet.prd_code >= prd_code_fr and arreardet.prd_code <= prd_code_to)) ; if lc_sum_arrears is null then lc_sum_arrears := 0.00; end if; return lc_sum_arrears; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PERIOD_DESCR (as_prd_code char) return varchar2 is ls_prd_descr varchar2(40); begin begin select descr into ls_prd_descr from period where code = as_prd_code; exception when no_data_found then ls_prd_descr := null; end; return ls_prd_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION BI_RGET_ACT_CNT_N (as_sales_pers char, as_month varchar2, as_event_type char) return Number is Cnt number(3); begin select count(distinct event_date) into Cnt from strg_meet where sales_pers=as_sales_pers and event_type=as_event_type and to_char(event_date,'MONTH-YY')=as_month; return nvl(Cnt,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_AREADESCR ( LS_FLD_NAME VARCHAR , LS_MOD_NAME VARCHAR , LS_FLD_VALUE VARCHAR ) RETURN VARCHAR IS LS_DESCR VARCHAR ( 30 ) ; BEGIN SELECT DESCR INTO LS_DESCR FROM GENCODES WHERE TRIM(FLD_NAME) = LS_FLD_NAME AND TRIM(MOD_NAME) = LS_MOD_NAME AND TRIM(FLD_VALUE) = LS_FLD_VALUE; RETURN LS_DESCR ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TRAN_CURR_EXCH (as_ref_ser in char, as_ref_id in char) return varchar2 is ls_det varchar2(60); ls_curr varchar2(5); lc_exch number(17,6); begin select curr_code, exch_rate into ls_curr, lc_exch from gltrace where ref_ser = as_ref_ser and ref_id = as_ref_id and rownum = 1 order by tran_id; ls_det := 'Curr Code : '||ls_curr||' Exch rate: '||trim(to_char(lc_exch,'9999999999.999999')); return ls_det; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SITE_CUST (SITE IN CHAR ,SORDNO IN CHAR) RETURN CHAR IS MCTR NUMBER; MCUST VARCHAR2(10); BEGIN SELECT CUST_CODE INTO MCUST FROM SORDER WHERE SALE_ORDER = SORDNO; SELECT COUNT(*) INTO MCTR FROM site_customer WHERE site_code = SITE AND CUST_CODE = MCUST; IF MCTR = 1 THEN RETURN '1'; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IDX_STATUS ON PORDDET (STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MC_SLOT_HDR_X ON MC_SLOT_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TDESK_RATE_CONF ON TDESK_RATE (CONF_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INVOICE_DATE ( as_inv_id char) return Date is ldt_inv_date date; begin begin select tran_date into ldt_inv_date from invoice where invoice_id = as_inv_id; exception when no_data_found then ldt_inv_date := null; end; return ldt_inv_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_TNC_DOC_MST ON TNC_DOC_MST (TNC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VERSION_ID ON HIERARCHY (VERSION_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE SP_STK_MOVEMENT is ls_error exception ; ls_error1 exception ; begin declare cursor cur_stkval is select site_code,item_code ,lot_no ,inv_stat,period_code, sum(sret_rcp), sum(sret_iss), sum(porcp_qty), sum(drcp_qty), sum(wiss_qty), sum(diss_qty), sum(sdsp_qty), sum(pret_qty), sum(ciss_qty), sum(adjrcp_qty), sum(adjiss_qty), sum(totiss_qty), sum(totrcp_qty), sum(sret_rcp_val), sum(sret_iss_val), sum(porcp_qty_val), sum(drcp_qty_val), sum(wiss_qty_val), sum(diss_qty_val), sum(sdsp_qty_val), sum(pret_qty_val), sum(ciss_qty_val), sum(adjISS_qty_val), sum(adjrcp_qty_val), sum(totiss_qty_val), sum(totrcp_qty_val) From ( select a.site_code, a.item_code, a.lot_no, to_char(a.tran_date,'YYYYMM')period_code, (case when a.inv_stat is null then (select inv_stat from location where loc_code =a.loc_code) else a.inv_stat end)inv_stat, (case when trim(a.ref_ser) = 'S-RET' and sum(a.eff_qty) > 0 then sum(a.quantity) else 0 end ) sret_rcp, (case when trim(a.ref_ser) = 'S-RET' and sum(a.eff_qty) < 0 then sum(a.quantity) else 0 end ) sret_iss, (case when trim(a.ref_ser) = 'P-RCP' then sum(a.quantity) else 0 end ) porcp_qty, (case when trim(a.ref_ser) = 'D-RCP' then sum(a.quantity) else 0 end ) drcp_qty, (case when trim(a.ref_ser) = 'W-ISS' then sum(a.quantity) else 0 end ) wiss_qty, (case when trim(a.ref_ser) = 'D-ISS' then sum(a.quantity) else 0 end ) diss_qty , (case when trim(a.ref_ser) = 'S-DSP' then sum(a.quantity) else 0 end ) sdsp_qty , (case when trim(a.ref_ser) = 'P-RET' then sum(a.quantity) else 0 end ) pret_qty , (case when trim(a.ref_ser) = 'C-ISS' then sum(a.quantity) else 0 end ) ciss_qty , (case when trim(a.ref_ser) = 'ADJISS' then sum(a.quantity) else 0 end ) adjISS_qty , (case when trim(a.ref_ser) = 'ADJRCP' then sum(a.quantity) else 0 end ) adjrcp_qty , (case when sum(a.eff_qty) <= 0 then sum(a.quantity) else 0 end ) totiss_qty , (case when sum(a.eff_qty) >= 0 then sum(a.quantity) else 0 end ) totrcp_qty, (case when trim(a.ref_ser) = 'S-RET' and sum(a.quantity) > 0 then sum(a.quantity * a.rate) else 0 end ) sret_rcp_val, (case when trim(a.ref_ser) = 'S-RET' and sum(a.quantity ) < 0 then sum(a.quantity * a.rate) else 0 end ) sret_iss_val, (case when trim(a.ref_ser) = 'P-RCP' then sum(a.quantity * a.rate) else 0 end ) porcp_qty_val, (case when trim(a.ref_ser) = 'D-RCP' then sum(a.quantity * a.rate) else 0 end ) drcp_qty_val, (case when trim(a.ref_ser) = 'W-ISS' then sum(a.quantity * a.rate) else 0 end ) wiss_qty_val, (case when trim(a.ref_ser) = 'D-ISS' then sum(a.quantity * a.rate) else 0 end ) diss_qty_val, (case when trim(a.ref_ser) = 'S-DSP' then sum(a.quantity * a.rate) else 0 end ) sdsp_qty_val, (case when trim(a.ref_ser) = 'P-RET' then sum(a.quantity * a.rate) else 0 end ) pret_qty_val, (case when trim(a.ref_ser) = 'C-ISS' then sum(a.quantity * a.rate) else 0 end ) ciss_qty_val, (case when trim(a.ref_ser) = 'ADJISS' then sum(a.quantity * a.rate) else 0 end ) adjISS_qty_val, (case when trim(a.ref_ser) = 'ADJRCP' then sum(a.quantity * a.rate) else 0 end ) adjrcp_qty_val, (case when sum(a.eff_qty) < 0 then sum(a.quantity * a.rate) else 0 end ) totiss_qty_val, (case when sum(a.eff_qty) > 0 then sum(a.quantity * a.rate) else 0 end ) totrcp_qty_val from invtrace a group by site_code,item_code,lot_no,loc_code,inv_stat,to_char(TRAN_DATE,'YYYYMM'),a.ref_ser ) group by site_code,item_code,lot_no,inv_stat,period_code order by site_code,item_code,lot_no,inv_stat,period_code; ls_itemcode char(10) ; ls_site_code char(5) ; ls_lot_no char(15) ; ls_inv_stat char(5) ; lc_sret_rcp number(14,3); lc_sret_iss number(14,3); lc_porcp_qty number(14,3); lc_drcp_qty number(14,3); lc_wiss_qty number(14,3); lc_diss_qty number(14,3); lc_sdsp_qty number(14,3); lc_pret_qty number(14,3); lc_ciss_qty number(14,3); lc_adjrcp_qty number(14,3); ls_period_code char(6) ; lc_open_qty number(14,3); lc_open_value number(14,3); lc_sret_rcp_val number(14,3); lc_sret_iss_val number(14,3); lc_porcp_qty_val number(14,3); lc_drcp_qty_val number(14,3); lc_wiss_qty_val number(14,3); lc_diss_qty_val number(14,3); lc_sdsp_qty_val number(14,3); lc_pret_qty_val number(14,3); lc_ciss_qty_val number(14,3); lc_adjrcp_qty_val number(14,3); lc_close_qty number(14,3); lc_close_value number(14,3); lc_tot_mount number(14,3); lc_tot_rcp_qty number(14,3) := 0; lc_tot_rcp_value number(14,3) := 0; lc_tot_iss_qty number(14,3) := 0; lc_totrcp_qty number(14,3) := 0; lc_adjiss_qty number(14,3) := 0 ; lc_adjISS_qty_val number(14,3) := 0 ; lc_tot_iss_value number(14,3) := 0 ; Sql_stmt varchar2(4000); begin sql_stmt := 'truncate table stock_movement ' ; EXECUTE IMMEDIATE sql_stmt ; ---truncate table stock_movement; open cur_stkval; if cur_stkval%notfound then Raise ls_error; end if; loop fetch cur_stkval into ls_site_code, ls_itemcode, ls_lot_no, ls_inv_stat, ls_period_code, lc_sret_rcp, lc_sret_iss, lc_porcp_qty, lc_drcp_qty, lc_wiss_qty, lc_diss_qty, lc_sdsp_qty, lc_pret_qty, lc_ciss_qty, lc_adjrcp_qty, lc_adjiss_qty, lc_tot_iss_qty, lc_tot_rcp_qty, lc_sret_rcp_val, lc_sret_iss_val, lc_porcp_qty_val, lc_drcp_qty_val, lc_wiss_qty_val, lc_diss_qty_val, lc_sdsp_qty_val, lc_pret_qty_val, lc_ciss_qty_val, lc_adjISS_qty_val, lc_adjrcp_qty_val, lc_tot_iss_value, lc_tot_rcp_value; exit when cur_stkval %NOTFOUND; select sum(close_qty), sum(close_value) into lc_open_qty, lc_open_value from stock_movement where site_code = ls_site_code and item_code = ls_itemcode and lot_no = ls_lot_no and inv_stat = ls_inv_stat and period_code = ( select max(period_code) from stock_movement where site_code = ls_site_code and period_code < ls_period_code and item_code = ls_itemcode and lot_no = ls_lot_no and inv_stat = ls_inv_stat ); if lc_open_qty is null then lc_open_qty := 0 ; end if; if lc_open_value is null then lc_open_value := 0 ; end if; lc_close_qty := lc_open_qty + lc_tot_rcp_qty - lc_tot_iss_qty ; lc_close_value := lc_open_value + lc_tot_rcp_value - lc_tot_iss_value ; insert into stock_movement( site_code , period_code , item_code , lot_no , inv_stat , open_qty , open_value , po_rcp_qty , po_rcp_value , dis_rcp_qty , dis_rcp_value , sret_rcp_qty , sret_rcp_value, tot_rcp_qty , tot_rcp_value , wo_iss_qty , wo_iss_value , dis_iss_qty , dis_iss_value , sal_iss_qty , sal_iss_value , po_ret_qty , po_ret_value , sret_iss_qty , sret_iss_value, con_iss_qty , con_iss_value , pm_iss_qty , pm_iss_value , tot_iss_qty , tot_iss_value , adj_qty , adj_value , close_qty , close_value ) values ( ls_site_code , ls_period_code , ls_itemcode , ls_lot_no , ls_inv_stat , lc_open_qty , lc_open_value , lc_porcp_qty , lc_porcp_qty_val , lc_drcp_qty , lc_drcp_qty_val , lc_sret_rcp , lc_sret_rcp_val , lc_tot_rcp_qty , lc_tot_rcp_value, lc_wiss_qty , lc_wiss_qty_val , lc_diss_qty , lc_diss_qty_val , lc_sdsp_qty , lc_sdsp_qty_val , lc_pret_qty , lc_pret_qty_val , lc_sret_iss , lc_sret_iss_val , lc_ciss_qty , lc_ciss_qty_val , 0 , 0 , lc_tot_iss_qty , lc_tot_iss_value , lc_adjrcp_qty , lc_adjrcp_qty_val , lc_close_qty , lc_close_value ) ; if sql%notfound then Raise ls_error1; end if; commit; end loop; close cur_stkval; end; EXCEPTION when ls_error then DBMS_OUTPUT.PUT_LINE('No date found'); when ls_error1 then DBMS_OUTPUT.PUT_LINE('No data for insert or update'); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ADJ_AMT ( AS_SITE_CODE CHAR, AS_BAL_GROUP CHAR, AS_REF_SER CHAR, AS_REF_ID CHAR , AS_REF_LINE_NO CHAR) RETURN number IS LC_ADJ_AMT number ( 14 , 3 ); BEGIN IF AS_REF_LINE_NO = 'D' THEN SELECT NVL( SUM(ADJ_AMT) , 0 ) INTO LC_ADJ_AMT FROM TAX_PROCESS_TRACE WHERE SITE_CODE = AS_SITE_CODE AND BAL_GROUP = AS_BAL_GROUP AND REF_SER = AS_REF_SER AND REF_ID = AS_REF_ID ; ELSE SELECT SUM(NVL( ADJ_AMT , 0 )) INTO LC_ADJ_AMT FROM TAX_PROCESS_TRACE WHERE SITE_CODE = AS_SITE_CODE AND BAL_GROUP = AS_BAL_GROUP AND REF_SER = AS_REF_SER AND REF_ID = AS_REF_ID AND TRIM ( REF_LINE ) = TRIM ( AS_REF_LINE_NO ) ; END IF; IF LC_ADJ_AMT IS NULL THEN LC_ADJ_AMT := 0 ; END IF ; RETURN LC_ADJ_AMT ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BATCH_NO_S ( item_item_code IN VARCHAR2, despatchdet_desp_id IN VARCHAR2, despatchdet_lot_no IN VARCHAR2, despatchdet_dimension IN VARCHAR2 ) RETURN VARCHAR2 IS AS_VAL VARCHAR2(100) := ''; TYPE RC IS REF CURSOR; C RC; AS_VAR VARCHAR2(100); BEGIN OPEN C FOR SELECT despatchdet.lot_no FROM despatchdet WHERE despatchdet.desp_id = despatchdet_desp_id AND despatchdet.dimension = despatchdet_dimension AND despatchdet.item_code = item_item_code ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVTRACE_SITE_ITEM_DATE_LOT ON INVTRACE (TRAN_DATE, ITEM_CODE, SITE_CODE, LOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RBANKRECO_STMT ( ad_ason in date, as_sundrycode in char, as_sundrytype in char, as_sitecode in char ) return number is lc_day_op_bal number(14,3) ; lc_prd_op_bal number(14,3); lc_dr_amt number(14,3); lc_cr_amt number(14,3); ls_prd char(6); ls_acct_prd char(6); ld_fr_date date; begin select code, acct_prd ,fr_date into ls_prd, ls_acct_prd, ld_fr_date from period where ad_ason between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and sundry_type = as_sundrytype and sundry_code = as_sundrycode; select nvl(sum(amount),0) into lc_cr_amt from banktran_log where tran_type = 'P' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode; select nvl(sum(amount),0) into lc_dr_amt from banktran_log where tran_type = 'R' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode; lc_day_op_bal := lc_dr_amt - lc_cr_amt ; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal ; return lc_day_op_bal ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFF_DOC_NOT_MET_TB force AS TABLE OF EFF_DOC_NOTMET_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDSTAX_TOKEN (ls_ref_ser char , ls_vouch_no char,ls_flag char) return varchar2 is ls_str varchar2(200) ; ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ls_prd_qtr varchar2(50); ls_bank_acknow_ref varchar2(50); ctr number(3); cursor c1 is select distinct nvl(misc_payment.HANDOVER_CHNO,''), nvl(misc_payment.BANK_CODE__TAX,''),nvl(misc_payment.TOKEN_NO,''),nvl(misc_payment.PRD_QTR,' '), nvl(misc_payment.bank_acknow_ref,' ') from misc_paydet,misc_payment where misc_paydet.tran_id = misc_payment.tran_id and misc_paydet.tran_ser = 'M-VOUC' and misc_paydet.vouch_no in (select misc_voucher_trace.tran_id from misc_voucher_trace where tran_id__ref in ( ls_vouch_no ) ); begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_ch_no_det,ls_bank_cd_det,ls_token_no_det,ls_prd_qtr,ls_bank_acknow_ref; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_prd_qtr)) > 0 then ls_prd_qtr:= ','||ls_prd_qtr ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_acknow_ref)) > 0 then ls_bank_acknow_ref := ','||ls_bank_acknow_ref ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; if ls_flag='T' then ls_str := rtrim(ls_str)||ls_token_no_det; elsif ls_flag='Q' then ls_str := rtrim(ls_str)||ls_prd_qtr; elsif ls_flag='A' then ls_str := rtrim(ls_str)||ls_bank_acknow_ref; end if; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETSHIFTINFO ( attd_date In date, flag in varchar, EMP_CODE in employee.emp_code%type ) Return char Is shift_info workshft.shift%type; getShift workshft.shift%type; Begin select ddf_hr_status (EMP_CODE ,attd_Date, 'H') as shft into getShift from dual; if flag = 'SH' then shift_info := getShift; elsif flag='IN' then select b.in_time into shift_info from workshft b where b.shift=getShift and day_no = to_char(attd_Date ,'D') ; else select b.out_time into shift_info from workshft b where b.shift=getShift and day_no = to_char(attd_Date, 'D') ; end if; Return shift_info; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX COURSE_TEST_QUES_PK ON COURSE_TEST_QUES (COURSE_CHAPTER, COURSE_CODE, QUES_SET, SEQ_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INV_ALLOC_QTY0 BEFORE INSERT or UPDATE ON inv_alloc_det referencing old as old new as new FOR EACH ROW BEGIN if :new.quantity = 0 and :new.alloc_qty <> 0 then :new.quantity := :new.alloc_qty - nvl(:new.potency_adj,0); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXTRANAMT ( as_tranid char,as_trancode char,retflag char) return number is as_sum_amt number(10,2); as_tax_amt number(10,2); as_taxable_amt number(10,2); as_print_tax char(2); as_tax_code char(5); cursor curAmt is SELECT taxtran.tax_code,sum(taxtran.tax_amt) as_tax_amt, sum(taxable_amt) as_taxable_amt FROM taxtran WHERE taxtran.tran_id = as_tranid AND taxtran.tran_code = as_trancode AND taxtran.tax_amt <> 0 GROUP BY taxtran.tax_code ; begin open curAmt; as_sum_amt:= 0; loop fetch curAmt into as_tax_code,as_tax_amt,as_taxable_amt ; exit when curAmt%notFound; select print_tax into as_print_tax from tax where tax_code = as_tax_code; if as_print_tax = 'Y' then if retflag='A'then as_sum_amt := as_sum_amt + as_tax_amt; else as_sum_amt := as_sum_amt + as_taxable_amt; end if; end if; end loop ; close curAmt; return as_sum_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHQCANC_AMOUNT ( ls_ref_ser char, ls_ref_no char) return number as ls_amount number (15,2); begin if ls_ref_ser = 'E-PAY' then select net_amt into ls_amount from payment_exp where tran_id = ls_ref_no; elsif ls_ref_ser = 'M-PAY' then select net_amt into ls_amount from misc_payment where tran_id = ls_ref_no; end if; if ls_amount is null then ls_amount := 0; end if; return ls_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ACCTBAL_SITE_ACCT ON ACCTBAL (ACCT_PRD, PRD_CODE, SITE_CODE, ACCT_CODE, CCTR_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MISC_VOUCHADV_REF_SER_NO ON MISC_VOUCHADV (TRAN_ID, REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_POAPPR BEFORE UPDATE ON porder referencing old as old new as new FOR EACH ROW declare ldt_excutdate SER_REQ_FEEDBK.EXECUT_DT%type; BEGIN if nvl(:new.confirmed,'N') = 'Y' and :new.conf_date is null then raise_application_error( -20601, 'Confirm date is null but confirmed flag is updated as Y'); end if; if nvl(:new.confirmed,'N') = 'Y' and :new.emp_code__aprv is null then raise_application_error( -20601, 'Approved employee is null but confirmed flag is updated as Y'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXAMT_TAXPERC_KESSC (as_invoice in char,as_type in char,as_taxcode in char,al_taxperc number,FLAG CHAR) return number is ll_tax_amt number(14,2); begin if as_type='T' then /*By Mistake INV line number taken instead of Line Number.*/ if as_taxcode='Y' and al_taxperc = 4 THEN SELECT SUM(TAXTRAN.TAX_AMT) INTO ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID =as_invoice and INVOICE_TRACE.LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND INVOICE_TRACE.LOT_SL <> '2S' AND /*Added by Brijesh Soni for not to Add the 2S Tax Amount*/ TAXTRAN.TRAN_CODE = 'S-INV' AND TAXTRAN.TAX_CODE <>'KESSC' AND tax_perc = al_taxperc and --4 taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' ; Elsif as_taxcode='Y' and al_taxperc = 5 THEN SELECT SUM(TAXTRAN.TAX_AMT) INTO ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID =as_invoice and INVOICE_TRACE.LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND INVOICE_TRACE.LOT_SL <> '2S' AND /*Added by Brijesh Soni for not to Add the 2S Tax Amount*/ TAXTRAN.TRAN_CODE = 'S-INV' AND TAXTRAN.TAX_CODE <>'KESSC' AND tax_perc = al_taxperc and --5 taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' ; Elsif as_taxcode='Y' and al_taxperc = 12.5 THEN SELECT SUM(TAXTRAN.TAX_AMT) INTO ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID =as_invoice and INVOICE_TRACE.LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND TAXTRAN.TAX_CODE <>'KESSC' AND tax_perc = al_taxperc and --12.50 taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' ; Elsif as_taxcode='Y' and al_taxperc = 13.5 THEN SELECT SUM(TAXTRAN.TAX_AMT) INTO ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID =as_invoice and INVOICE_TRACE.LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND TAXTRAN.TAX_CODE <>'KESSC' AND tax_perc = al_taxperc and --13.50 taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' ; ELSif as_taxcode ='N' THEN IF FLAG = 'A' THEN SELECT SUM(TAXTRAN.TAX_AMT) INTO ll_tax_amt FROM invoice_trace , TAXTRAN , TAX , ITEM where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND INVOICE_TRACE.ITEM_CODE = ITEM.ITEM_CODE AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID = as_invoice and INVOICE_TRACE.LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND INVOICE_TRACE.LOT_SL <> '2S' AND /*Added by Brijesh Soni for not to Add the 2S Tax Amount*/ TAXTRAN.TRAN_CODE = 'S-INV' AND TAXTRAN.TAX_CODE ='KESSC' AND ITEM.LOC_TYPE not like 'F%' AND tax_perc = al_taxperc and --N 1 taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' ; ELSE SELECT SUM(TAXTRAN.TAX_AMT) INTO ll_tax_amt FROM invoice_trace , TAXTRAN , TAX , ITEM where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND INVOICE_TRACE.ITEM_CODE = ITEM.ITEM_CODE AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID = as_invoice and INVOICE_TRACE.LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND TAXTRAN.TAX_CODE ='KESSC' AND ITEM.LOC_TYPE like 'F%' AND tax_perc = al_taxperc and --N 1 taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' ; END IF; END IF; END IF; if ll_tax_amt is null then ll_tax_amt := 0 ; end if ; return ll_tax_amt; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRACE_REF ON GLTRACE (REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DISTRCP_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON DISTORD_RCP referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; BEGIN if :new.confirmed = 'Y' then begin begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_DRCP'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_distrcpdet in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM DISTORD_RCPDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id ) loop if cur_distrcpdet.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from distord_rcpdet where tran_id = :new.tran_id; exception when others then ll_count:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'D-RCP' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if ll_count > 0 then begin SELECT sum(rate * quantity) into lc_rate FROM distord_rcpdet where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'D-RCP' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; -- count end end; end if ;-- end of varvalue if end if; end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_PARTY ( AS_REF_SER VARCHAR, AS_REF_ID VARCHAR) RETURN VARCHAR IS LS_SITE_CODE VARCHAR ( 5 ) ; LS_DISPLAY VARCHAR ( 3 ) ; BEGIN IF AS_REF_SER = 'S-DSP' THEN SELECT SITE_CODE INTO LS_SITE_CODE FROM DESPATCH WHERE DESP_ID = AS_REF_ID ; LS_DISPLAY := 'YES'; ELSIF AS_REF_SER = 'D-ISS' THEN SELECT SITE_CODE__DLV INTO LS_SITE_CODE FROM DISTORD_ISS WHERE TRAN_ID = AS_REF_ID; LS_DISPLAY := 'YES' ; ELSIF AS_REF_SER = 'D-RCP' THEN SELECT SITE_CODE__SHIP INTO LS_SITE_CODE FROM DISTORD_RCP WHERE TRAN_ID = AS_REF_ID; LS_DISPLAY := 'YES' ; ELSIF AS_REF_SER = 'S-RET' THEN SELECT SITE_CODE INTO LS_SITE_CODE FROM SRETURN WHERE TRAN_ID = AS_REF_ID ; LS_DISPLAY := 'YES' ; ELSIF AS_REF_SER = 'P-RCP' THEN SELECT SITE_CODE INTO LS_SITE_CODE FROM PORCP WHERE TRAN_ID = AS_REF_ID; LS_DISPLAY := 'YES' ; ELSIF AS_REF_SER = 'P-RET' THEN SELECT SITE_CODE INTO LS_SITE_CODE FROM PORCP WHERE TRAN_ID = AS_REF_ID ; LS_DISPLAY := 'YES' ; END IF ; IF LS_DISPLAY = 'NO' THEN LS_SITE_CODE := ' ' ; END IF ; RETURN LS_SITE_CODE ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_IS_WO_SPECINSTR (as_workorder in char) return char is ls_retval char(1) := ' '; ls_remarks varchar2(800); begin select nvl(remarks,' ') || nvl(specific_instr, ' ') into ls_remarks from workorder where work_order = as_workorder; if (ls_remarks is not null) and length(ltrim(rtrim(ls_remarks))) > 0 then return 'Y' ; end if; return ls_retval ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CON_DAYS_MKM (AS_EMP_CODE CHAR , AS_PRD_CODE CHAR) RETURN NUMBER IS AL_CONY_DAYS number(14,3); A number(14,3); D Date; E number(14,3); H employee.hol_tblno%type; begin select to_date into D from period where code = AS_PRD_CODE; select ddf_get_holtblno(AS_EMP_CODE,D) into H from dual; -- excludes all paid holidays and weekly off from total punches select count(aa.in_time) INTO A from attendance_day aa, period bb where bb.code = AS_PRD_CODE and aa.attd_date between bb.fr_date and bb.to_date and aa.emp_code = AS_EMP_CODE and aa.in_time is not null and aa.attd_date not in (select cc.hol_date from holiday cc where cc.hol_tblno = H); -- Calculate for change holiday, to be added as punch for holiday entry will be ignored. select count(max(aa.hol_date_to)) INTO E from change_holiday aa,period cc,holiday dd,attendance_day ee where cc.code = AS_PRD_CODE and aa.emp_code = AS_EMP_CODE and aa.emp_code = ee.emp_code and aa.hol_tblno = H and dd.hol_tblno = H and aa.hol_date_for = dd.hol_date and dd.hol_date = ee.attd_date and aa.confirmed ='Y' and aa.hol_date_to between cc.fr_date and cc.to_date and dd.hol_type = 'W' group by aa.emp_code,aa.hol_date_for; AL_CONY_DAYS := A + E; return AL_CONY_DAYS ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MIN_MAX_TIME (AS_SALES_PERS VARCHAR2 , AS_EVENT_DATE DATE, AS_TYPE VARCHAR2) RETURN VARCHAR2 IS AS_MIN_TIME VARCHAR2(10); AS_MAX_TIME VARCHAR2(10); AS_EXC EXCEPTION; BEGIN IF AS_TYPE = 'MIN_VAL' THEN BEGIN SELECT MIN(PM) INTO AS_MIN_TIME FROM ( select (to_number( case when TRIM(SUBSTR(S.event_time_start,6,7)) = 'PM' and TRIM(SUBSTR(S.event_time_start,1,2)) <> 12 THEN SUBSTR(S.event_time_start,1,2) END ) + 12 || ( case when TRIM(SUBSTR(S.event_time_start,6,7)) = 'PM' and TRIM(SUBSTR(S.event_time_start,1,2)) <> 12 then (SUBSTR(S.event_time_start,3,8)) end ))as PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE union select ( case when TRIM(SUBSTR(S.event_time_start,6,7)) = 'AM' THEN SUBSTR(S.event_time_start,1,8) end ) AS PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE UNION SELECT (case when TRIM(SUBSTR(S.event_time_start,1,2)) = 12 THEN SUBSTR(S.event_time_start,1,8) END) as PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE UNION SELECT (CASE WHEN TRIM(SUBSTR(S.event_time_start,6,7)) IS NULL THEN SUBSTR(S.event_time_start,1,5) END) as PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE ); RETURN AS_MIN_TIME; END; END IF; IF AS_TYPE = 'MAX_VAL' THEN BEGIN SELECT MAX(PM) INTO AS_MAX_TIME FROM ( select (to_number( case when TRIM(SUBSTR(S.event_time_start,6,7)) = 'PM' and TRIM(SUBSTR(S.event_time_start,1,2)) <> 12 THEN SUBSTR(S.event_time_start,1,2) END ) + 12 || ( case when TRIM(SUBSTR(S.event_time_start,6,7)) = 'PM' and TRIM(SUBSTR(S.event_time_start,1,2)) <> 12 then (SUBSTR(S.event_time_start,3,8)) end ))as pm FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE union select ( case when TRIM(SUBSTR(S.event_time_start,6,7)) = 'AM' THEN SUBSTR(S.event_time_start,1,8) end ) AS PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE UNION SELECT (case when TRIM(SUBSTR(S.event_time_start,1,2)) = 12 THEN SUBSTR(S.event_time_start,1,8) END) as PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE UNION SELECT (CASE WHEN TRIM(SUBSTR(S.event_time_start,6,7)) IS NULL THEN SUBSTR(S.event_time_start,1,5) END) as PM FROM STRG_MEET s WHERE s.SALES_PERS = AS_SALES_PERS AND s.EVENT_DATE = AS_EVENT_DATE ); RETURN AS_MAX_TIME; END; END IF; RAISE AS_EXC; EXCEPTION WHEN AS_EXC THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PROJ_TEAM_EMP_CODES (as_login_emp_code char, as_emp_code char) return number is retVal number(1) := 0; ls_flag char(2); cursor c_emp_code is SELECT EMP_CODE__HEAD EMP_CODE FROM PROJ_TEAM WHERE EMP_CODE__HEAD = as_login_emp_code UNION ALL SELECT EMP_CODE FROM PROJ_TEAM_DET WHERE TEAM_CODE IN ( SELECT TEAM_CODE FROM PROJ_TEAM_DET WHERE EMP_CODE=as_login_emp_code) UNION ALL SELECT EMP_CODE FROM PROJ_TEAM_DET WHERE TEAM_CODE IN (SELECT TEAM_CODE FROM PROJ_TEAM WHERE EMP_CODE__HEAD=as_login_emp_code); begin begin FOR I IN c_emp_code LOOP if ( as_emp_code = I.emp_code) then retVal := 1; exit; end if; END LOOP; end; return retVal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QC_METHOD_DET_X ON QC_METHOD_DET (QC_METHOD, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXDESCR (as_taxcode tax.tax_code%type ) return varchar2 is ls_taxdescr tax.descr%type; begin select descr into ls_taxdescr from tax where tax_code = as_taxcode; return ls_taxdescr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_UPD_INVTRC_DRCR is ll_count number(3) := 0; ll_errorcount number(3) := 0; ldt_trandate date; ls_acctprd char(6); ls_acctcodedr char(10); ls_cctrcodedr char(4); ls_acctcodecr char(10); ls_cctrcodecr char(4); ls_tranid gltran.tran_id%type; ls_sitecodefr char(5); ls_sitecodeto char(5); ls_trantype distord_iss.tran_type%type; ls_sql varchar2(4000); l_code PLS_INTEGER;-- := SQLCODE; l_mesg VARCHAR2(32767);-- := SQLERRM; ls_refId invtrace.ref_id%type; ls_distorder char(10); begin for cur_tran in ( select o.tran_id,o.ref_ser,o.ref_id,o.ref_line,o.item_code, o.site_code, o.loc_code,o.lot_no,o.lot_sl, o.eff_qty, s.acct_code__inv, s.cctr_code__inv, i.item_ser from invtrace o, stock s, item i where i.item_code = o.item_code and s.item_code = o.item_code and s.site_code = o.site_code and s.loc_code = o.loc_code and s.lot_no = o.lot_no and s.lot_sl = o.lot_sl and o.site_code not like 'ST%' and (o.acct_code__dr is null or o.acct_code__cr is null) --and o.tran_date >= '01-apr-23' and trim(o.ref_ser) in ('D-ISS','D-RCP','R-BFS','D-CANC','S-DSP','S-RET','XFRX','QC-ORD','S-ISS','I-PKI','I-PKR' ) order by o.ref_ser,o.ref_id ) loop if trim(cur_tran.eff_qty) < 0 then ls_acctcodecr := cur_tran.acct_code__inv; ls_cctrcodecr := cur_tran.cctr_code__inv; else ls_acctcodedr := cur_tran.acct_code__inv; ls_cctrcodedr := cur_tran.cctr_code__inv; end if; if trim(cur_tran.ref_ser) = 'D-ISS' then if cur_tran.eff_qty < 0 then ls_sitecodefr := cur_tran.site_code; begin select tran_type,SITE_CODE__DLV into ls_trantype, ls_sitecodeto from distord_iss where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('1 - Error error getting dist issuer [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); ls_trantype := ' '; ls_sitecodeto := ' '; continue; --goto end_message; end; --dbms_output.put_line ('1a - dist issue [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] eff_qty [ '|| to_char(cur_tran.eff_qty)||'] site from ['||ls_sitecodefr ||'] to [' || ls_sitecodeto || ']' ); else ls_sitecodeto := cur_tran.site_code; begin select tran_type,SITE_CODE into ls_trantype, ls_sitecodefr from distord_iss where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('2 - Error error getting dist issue [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); ls_trantype := ' '; ls_sitecodeto := ' '; continue; --goto end_message; end; --dbms_output.put_line ('2a - dist issue [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] eff_qty [ '|| to_char(cur_tran.eff_qty)||'] site from ['||ls_sitecodefr ||'] to [' || ls_sitecodeto || ']' ); end if; begin select dist_order into ls_distorder from distord_iss where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; l_code := SQLCODE; l_mesg := SQLERRM; dbms_output.put_line ('2b - Error error getting dist order [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); dbms_output.put_line ('2b - Error error ref_line [' || cur_tran.ref_line ||'] eff_qty [ '|| to_char(cur_tran.eff_qty)||'] l_code [' ||to_char(l_code) ||'] l_mesg [' || l_mesg ||']' ); ls_distorder := ' '; continue; --goto end_message; end; if length(trim(ls_distorder)) > 0 then begin select site_code__ship,site_code__dlv into ls_sitecodefr,ls_sitecodeto from distorder where dist_order = ls_distorder; exception when others then ll_errorcount := 1; dbms_output.put_line ('2c - Error error getting site from/to [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); ls_sitecodefr := ' '; ls_sitecodeto := ' '; continue; --goto end_message; end; end if; begin ls_sql := 'select ACCT_CODE__RCP,CCTR_CODE__RCP from item_acct_detr_dist where item_ser = ''' ||cur_tran.item_ser ||''' and tran_type = ''' ||ls_trantype ||''' and site_code__from = ''' ||ls_sitecodefr ||''' and site_code__to = ''' ||ls_sitecodeto ||''';'; --dbms_output.put_line ('3 - ls_sql [' ||ls_sql ||']' ); select ACCT_CODE__RCP,CCTR_CODE__RCP into ls_acctcodedr, ls_cctrcodedr from item_acct_detr_dist where item_ser = cur_tran.item_ser and trim(tran_type) = trim(ls_trantype) and site_code__from = ls_sitecodefr and site_code__to = ls_sitecodeto and item_code = ' '; exception when others then ll_errorcount := 1; l_code := SQLCODE; l_mesg := SQLERRM; dbms_output.put_line ('3 - Error error getting item_acct_detr_dist ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] item_ser [' ||cur_tran.item_ser ||'] tran type[' || ls_trantype ||'] from [' || ls_sitecodefr ||'] To [' ||ls_sitecodeto ||']' ); dbms_output.put_line ('3 - Error error ref_line [' || cur_tran.ref_line ||'] eff_qty [ '|| to_char(cur_tran.eff_qty)||'] l_code [' ||to_char(l_code) ||'] l_mesg [' || l_mesg ||']' ); continue; --goto end_message; end; elsif trim(cur_tran.ref_ser) = 'D-RCP' then if cur_tran.eff_qty > 0 then ls_sitecodeto := cur_tran.site_code; begin select tran_type,SITE_CODE__ship into ls_trantype, ls_sitecodefr from distord_rcp where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('4 - Error error getting dist rcp [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); ls_trantype := ' '; ls_sitecodefr := ' '; goto end_message; end; else ls_sitecodeto := cur_tran.site_code; begin select tran_type,SITE_CODE__ship into ls_trantype, ls_sitecodefr from distord_rcp where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('5 - Error error getting dist rcp [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); ls_trantype := ' '; ls_sitecodefr := ' '; continue; --goto end_message; end; end if; begin select dist_order into ls_distorder from distord_rcp where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; ll_errorcount := 1; l_code := SQLCODE; l_mesg := SQLERRM; dbms_output.put_line ('5a - Error error getting dist order [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); dbms_output.put_line ('5a - Error error ref_line [' || cur_tran.ref_line ||'] eff_qty [ '|| to_char(cur_tran.eff_qty)||'] l_code [' ||to_char(l_code) ||'] l_mesg [' || l_mesg ||']' ); ls_distorder := ' '; continue; --goto end_message; end; if length(trim(ls_distorder)) > 0 then begin select site_code__ship,site_code__dlv into ls_sitecodefr,ls_sitecodeto from distorder where dist_order = ls_distorder; exception when others then ll_errorcount := 1; dbms_output.put_line ('2c - Error error getting site from/to [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||']' ); ls_sitecodefr := ' '; ls_sitecodeto := ' '; continue; --goto end_message; end; end if; begin -- dbms_output.put_line ('5.1 - info ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] item_ser [' ||cur_tran.item_ser ||'] tran type[' || ls_trantype ||'] from [' || ls_sitecodefr ||'] To [' ||ls_sitecodeto ||']' ); select ACCT_CODE__ISS,CCTR_CODE__ISS into ls_acctcodecr, ls_cctrcodecr from item_acct_detr_dist where item_ser = cur_tran.item_ser and trim(tran_type) = trim(ls_trantype) and site_code__from = ls_sitecodefr and site_code__to = ls_sitecodeto and item_code = ' '; exception when others then ll_errorcount := 1; dbms_output.put_line ('6 - Error error getting item_acct_detr_dist ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] item_ser [' ||cur_tran.item_ser ||'] tran type[' || ls_trantype ||'] from [' || ls_sitecodefr ||'] To [' ||ls_sitecodeto ||']' ); goto end_message; end; elsif trim(cur_tran.ref_ser) = 'D-CANC' then begin select tran_id__iss into ls_refId from distord_iss_canc where tran_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; ls_refId := ' '; dbms_output.put_line ('7 - Error error getting dist iss ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] item_ser [' ||cur_tran.item_ser ||'] tran type[' || ls_trantype ||'] from [' || ls_sitecodefr ||'] To [' ||ls_sitecodeto ||']' ); continue; --goto end_message; end; begin select acct_code__dr,acct_code__cr,cctr_code__dr,cctr_code__cr into ls_acctcodecr,ls_acctcodedr, ls_cctrcodecr, ls_cctrcodedr from invtrace where trim(ref_ser) = 'D-ISS' and trim(ref_id) = trim(ls_refId) and trim(ref_line) = trim(cur_tran.ref_line) and eff_qty < 0; exception when others then ll_errorcount := 1; l_code := SQLCODE; l_mesg := SQLERRM; dbms_output.put_line ('8 - Error error l_code [' ||to_char(l_code) ||'] l_mesg [' || l_mesg ||']' ); dbms_output.put_line ('8 - Error error getting accounts ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] dist iss id [' || ls_refId ||'] ref_line [' ||cur_tran.ref_line ||']' ); continue; --goto end_message; end; elsif trim(cur_tran.ref_ser) = 'S-DSP' then begin select acct_code,cctr_code into ls_acctcodedr,ls_acctcodedr from gltrace where trim(ref_ser) = 'S-DSP' and trim(ref_id) = trim(cur_tran.ref_id) and dr_amt <> 0 and rownum = 1; exception when others then ll_errorcount := 1; l_code := SQLCODE; l_mesg := SQLERRM; dbms_output.put_line ('10 - Error error l_code [' ||to_char(l_code) ||'] l_mesg [' || l_mesg ||']' ); dbms_output.put_line ('10 - Error error getting DR accounts ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] ref_line [' ||cur_tran.ref_line ||']' ); continue; --goto end_message; end; elsif trim(cur_tran.ref_ser) = 'S-RET' then begin if cur_tran.eff_qty > 0 then select acct_code,cctr_code into ls_acctcodecr,ls_acctcodecr from gltrace where trim(ref_ser) = 'S-RET' and trim(ref_id) = trim(cur_tran.ref_id) and cr_amt <> 0 and rownum = 1; else select acct_code,cctr_code into ls_acctcodedr,ls_acctcodedr from gltrace where trim(ref_ser) = 'S-RET' and trim(ref_id) = trim(cur_tran.ref_id) and cr_amt <> 0 and rownum = 1; end if; exception when others then ll_errorcount := 1; l_code := SQLCODE; l_mesg := SQLERRM; dbms_output.put_line ('10 - Error error l_code [' ||to_char(l_code) ||'] l_mesg [' || l_mesg ||']' ); dbms_output.put_line ('10 - Error error getting DR accounts ref_ser [' ||cur_tran.ref_ser ||'] ref_id [' || cur_tran.ref_id ||'] ref_line [' ||cur_tran.ref_line ||']' ); continue; --goto end_message; end; elsif trim(cur_tran.ref_ser) = 'XFRX' or trim(cur_tran.ref_ser) = 'QC-ORD' or trim(cur_tran.ref_ser) = 'S-ISS'or trim(cur_tran.ref_ser) = 'I-PKI'or trim(cur_tran.ref_ser) = 'I-PKR' then ls_acctcodecr := cur_tran.acct_code__inv; ls_cctrcodecr := cur_tran.cctr_code__inv; ls_acctcodedr := cur_tran.acct_code__inv; ls_cctrcodedr := cur_tran.cctr_code__inv; end if; begin update invtrace set acct_code__dr = ls_acctcodedr,cctr_code__dr = ls_cctrcodedr, acct_code__cr = ls_acctcodecr,cctr_code__cr = ls_cctrcodecr where tran_id = cur_tran.tran_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('9 - Error error updating invtrace' ); goto end_message; end; end loop; <> if ll_errorcount = 0 then --commit; null; else null; --rollback; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRD_CODE (as_tran_date in varchar) return char is prd_code char(6) ; begin select code into prd_code from period where to_date(as_tran_date ,'DD/MM/YY') between fr_date and to_date ; return prd_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_LOCK_EXISTS (as_lotno in char) return number is ll_flag number(2); begin ll_flag:=0; select count(1) into ll_flag from inv_hold_rel_trace where lot_no = as_lotno having (sum(case when hold_qty is null then 0 else hold_qty end)+sum(case when rel_qty is null then 0 else rel_qty end )) >0 ; return ll_flag; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_TRANS_HIERARCHY_2 ON TRANS_HIERARCHY (REF_ID__PARENT, REF_SER__PARENT, REF_TYPE__PARENT, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ASRCETTAX_PAYMENT (vouchno char,net_amt number,pay_amt number,exch_rate__vouch number, DIFF_AMT__EXCH NUMBER , taxgroup char) return number is srtax number; mexch_rate number; begin srtax := 0; SELECT (ROUND((((SUM(TAXTRAN.TAX_AMT) * (PAY_AMT))/ NET_AMT) * exch_rate__vouch),3)) / (ROUND(((((SUM(PAY_AMT * exch_rate__vouch) / COUNT(TAXTRAN.TAX_CODE)) + (CASE WHEN DIFF_AMT__EXCH <=0 THEN DIFF_AMT__EXCH * -1 ELSE DIFF_AMT__EXCH * -1 END)) / pay_amt)),3)) into srtax --NVL((SUM(TAXTRAN.TAX_AMT) * PAY_AMT )/ NET_AMT,0) * exch_rate__vouch / --(((SUM(PAY_AMT * exch_rate__vouch) + (CASE WHEN DIFF_AMT__EXCH <=0 THEN DIFF_AMT__EXCH * -1 ELSE DIFF_AMT__EXCH END))) / pay_amt) into srtax FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE IN ('M-VOUC','VOUCH','CRNINV','DRNPAY','CRNPAY') AND TAXTRAN.TRAN_ID=VOUCHNO AND TAX.TAX_GROUP IN (taxgroup) AND (TAXTRAN.ACCT_CODE IS NOT NULL OR TAXTRAN.ACCT_CODE__RECO IS NOT NULL) AND TAXTRAN.TAX_AMT <> 0; return srtax; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BILLAMT (htlBillId in varchar2,bookType in varchar2 , amtType in varchar2) return number is ls_amt number; begin if(htlBillId is not null) then begin if(amtType = 'A') then begin Select SUM(tot_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and bb_type = bookType; end; end if ; if(amtType = 'N') then begin Select SUM(net_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and bb_type = bookType; end; end if ; if(amtType = 'T') then begin Select SUM(tax_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and bb_type = bookType; end; end if ; end; end if; if (ls_amt is null) then ls_amt := 0; else ls_amt := ls_amt ; end if; return ls_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DWH_PUR_SI_RCPT_DT_X ON DWH_PURCHASE (SITE_CODE, RECEIPT_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EWAY_TAXRATE (as_cgst_perc gst_data_det.cgst_perc%type,as_sgst_perc gst_data_det.sgst_perc%type,as_igst_amt gst_data_det.igst_perc%type,as_cess_perc gst_data_det.cess_perc%type) return varchar is tax_rate varchar(20); BEGIN return as_cgst_perc||'-'||as_sgst_perc||'-'||as_igst_amt||'-'||as_cess_perc; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEMSER_APPL_FOR_CUST (as_itemser in itemser.item_ser%type,as_custcode customer.cust_code%type) return char is ls_retval char(1) := 'N'; ls_varvalue disparm.var_value%type; ll_count number := 0; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SER_SPECIFIC_CUST'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from customer_series where cust_code = as_custcode and item_ser = as_itemser; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_STKINV_TRANS_ID ON CUST_STOCK_INV (INVOICE_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FUNC_TOT_OUTSTANDING_AMT ( CUSTOMER_CODE IN VARCHAR2) RETURN NUMBER IS TOT_OUT_STANDING NUMBER(14,3); BEGIN SELECT SUM( (CASE WHEN TOT_AMT IS NULL THEN 0 ELSE TOT_AMT END ) - (CASE WHEN DISPUTE_AMT IS NULL THEN 0 ELSE DISPUTE_AMT END ) - (CASE WHEN ADJ_AMT IS NULL THEN 0 ELSE ADJ_AMT END )) INTO TOT_OUT_STANDING FROM RECEIVABLES WHERE CUST_CODE = CUSTOMER_CODE AND (CASE WHEN TOT_AMT IS NULL THEN 0 ELSE TOT_AMT END ) - (CASE WHEN DISPUTE_AMT IS NULL THEN 0 ELSE DISPUTE_AMT END ) - (CASE WHEN ADJ_AMT IS NULL THEN 0 ELSE ADJ_AMT END ) > 0; IF TOT_OUT_STANDING IS NULL THEN RETURN 0; ELSE RETURN (TOT_OUT_STANDING); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LAST_DCR_DATE ( ls_dcr_id char, ls_sales_pers char) return varchar2 is ls_last_dcr_date varchar2(30); ld_event_date date; begin begin SELECT TO_CHAR(MAX(EVENT_DATE),'DD/MM/YY') into ls_last_dcr_date FROM SPRS_ACT_TRAN WHERE EVENT_DATE <= CURRENT_DATE AND SALES_PERS = ls_sales_pers and dcr_id <> ls_dcr_id; exception when no_data_found then ls_last_dcr_date := ''; end; return ls_last_dcr_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER EMPLOYEE_AD_TRAN_ID BEFORE INSERT ON EMPLOYEE_AD FOR EACH ROW BEGIN IF(:NEW.TRAN_ID IS NULL ) THEN :NEW.TRAN_ID:= SUBSTR('0000000000'|| TRIM(TO_CHAR(EMPAD_TRANID.NEXTVAL)) , -10); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DESCR_GENCODES (ls_fldname in varchar2,ls_winname in varchar2,ls_val in varchar2) RETURN CHAR IS LS_DESCR VARCHAR2(120); ls_ev_desc VARCHAR2(120); BEGIN ls_ev_desc:=TRIM(ls_val); select descr into ls_descr from GENCODES where fld_value = ls_ev_desc and TRIM(fld_name)=TRIM(ls_fldname) and mod_name=ls_winname and rownum = 1; return trim(ls_descr); exception when no_data_found then begin select descr into ls_descr from GENCODES where fld_value = ls_ev_desc and TRIM(fld_name)=TRIM(ls_fldname) and mod_name='X' and rownum = 1; return trim(ls_descr); exception when no_data_found then return ' '; END; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_INV_QTYRATE BEFORE insert or update ON invoice_trace referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; lcTot number(28,17) := 0; lcStdTot number (28,17) := 0; BEGIN /* if round(nvl(:new.quantity,0) * nvl(:new.conv__qty_stduom,0),3) <> round(nvl(:new.quantity__stduom,0),3) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] x conv__qty_stduom [' || to_char(:new.conv__qty_stduom) || '] not matching with quantity__stduom['||to_char(:new.quantity__stduom)|| ']' ); end if; if abs(round(nvl(:new.rate,0) * nvl(:new.CONV__RTUOM_STDUOM,1),17) - round(nvl(:new.RATE__STDUOM,0),17)) > 1 then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] rate [' || to_char(:new.rate) || '] x CONV__RTUOM_STDUOM [' || to_char(:new.CONV__RTUOM_STDUOM) || '] not matching with RATE__STDUOM['||to_char(:new.RATE__STDUOM)|| ']' ); end if; */ lcTot := nvl(:new.quantity,0) * nvl(:new.rate,0); lcStdTot := nvl(:new.quantity__stduom,0) * nvl(:new.rate__stduom,0); if (abs(lcTot - lcStdTot) > 1) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] QUANTITY [' || to_char(:new.quantity) || '] x RATE [' || to_char(:new.rate) || '] does not match with QUANTITY__STDUOM [' || to_char(:new.quantity__stduom) || '] x RATE__STDUOM [' || to_char(:new.rate__stduom) ||']' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_BANK_RECO_STMT_CURR ( ad_ason in date, as_sundrycode in char, as_sundrytype in char, as_sitecode in char , ls_curr_code in char ) return number is lc_day_op_bal number(14,3) ; lc_prd_op_bal number(14,3); lc_dr_amt number(14,3); lc_cr_amt number(14,3); ls_prd char(6); ls_acct_prd char(6); ld_fr_date date; begin select code, acct_prd ,fr_date into ls_prd, ls_acct_prd, ld_fr_date from period where ad_ason between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and sundry_type = as_sundrytype and sundry_code = as_sundrycode and site_code = as_sitecode; select nvl(sum(amount),0) into lc_cr_amt from banktran_log where tran_type = 'P' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode and curr_code = ls_curr_code ; select nvl(sum(amount),0) into lc_dr_amt from banktran_log where tran_type = 'R' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode and curr_code = ls_curr_code; lc_day_op_bal := lc_dr_amt - lc_cr_amt ; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal ; return lc_day_op_bal ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DIFF_SITE (SALEORDER IN CHAR,SITE IN CHAR) RETURN CHAR IS MCTR NUMBER; MFLAG CHAR(1); MSITE CHAR(5); BEGIN SELECT COUNT(*) INTO MCTR FROM SORDDET WHERE SALE_ORDER = SALEORDER; IF MCTR = 0 THEN RETURN '1'; END IF; SELECT SITE_CODE INTO MSITE FROM SORDDET WHERE SALE_ORDER = SALEORDER AND RTRIM(LTRIM(LINE_NO)) = 1; IF MSITE = SITE THEN RETURN '1'; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DLV_SITE_ADDR_PO (as_purc_order porder.purc_order%type) return nvarchar2 is ls_addr varchar2(8000); ls_add1 varchar2(8000); ls_add2 varchar2(8000); ls_city varchar2(8000); ls_descr varchar2(8000); ls_pin varchar2(500); ls_state varchar2(500); begin --select nvl(site_add1,' '), nvl(site_add2,' '),nvl(city__site,' '),nvl(site_descr,' ') select case when site_add1 is null then ' ' else site_add1 end, case when site_add2 is null then ' ' else site_add2 end, case when city__site is null then ' ' else city__site end, case when site_descr is null then ' ' else site_descr end into ls_add1 , ls_add2, ls_city, ls_descr from porder where purc_order=as_purc_order; ls_addr := ls_descr||CHR(10)||ls_add1||CHR(10)||ls_add2||CHR(10)||ls_city; return ls_addr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TRANDATE_CHQCANC ( ls_ref_ser char, ls_tran_id char) RETURN date is ls_column_value date; begin if ls_ref_ser = 'E-PAY' then select tran_date into ls_column_value from payment_exp where tran_id = ls_tran_id; elsif ls_ref_ser = 'M-PAY' then select tran_date into ls_column_value from misc_payment where tran_id = ls_tran_id; end if; if ls_column_value is null then ls_column_value := ''; end if; return ls_column_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PANOLI_QMS_DATA_X ON PANOLI_QMS_DATA (SR_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION WRAPE_UN_APPR_LEAVE (EMP_CODE in CHAR, Pos In int, space_lve In Varchar2, tran_id in char,leaveDate In DATE) return number is unaprlve number(7,1); LV_CODE VARCHAR(20); begin select DDF_GET_LEAVE_TYPE(EMP_CODE, SPACE_LVE, POS,leaveDate) into LV_CODE from DUAL; select ddf_get_unappr_lev(EMP_CODE,LV_CODE,tran_id) into unaprlve from DUAL; Return Unaprlve; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INDENT_STATUS (as_ind_no indent_hdr.ind_no%type) return char is ls_status varchar2(10); ls_stat char(1); begin SELECT status INTO ls_stat FROM indent WHERE ind_no = as_ind_no; if ls_stat = 'A' then ls_status := 'Approved'; elsif ls_stat = 'U' then ls_status := 'Unapproved'; elsif ls_stat = 'O' then ls_status := 'Ordered'; elsif ls_stat = 'L' then ls_status := 'Complete'; elsif ls_stat = 'C' then ls_status := 'Close'; end if; return ls_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DW_STOCK_X ON DW_STOCK (SITE_KEY, LOC_KEY, PERIOD_KEY, PRODUCT_KEY, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPDETCHG_EMP_TRNDT_STATUS ON EMPLOYEE_DET_CHANGE (EMP_CODE, TRAN_DATE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RACCEPTED_QTY (as_purc_order in char, as_line_no in char, as_var in char) return number is lc_qty number (14,3); begin if trim(as_var) = 'A' then select sum(vouch_qty) into lc_qty from vouchrcp where purc_order=as_purc_order and line_no__pord=as_line_no; elsif trim(as_var) = 'R' then select sum(quantity__stduom) into lc_qty from porcp,porcpdet where porcp.tran_id = porcpdet.tran_id and porcpdet.purc_order = as_purc_order and porcpdet.line_no__ord = as_line_no and porcp.tran_ser = 'P-RET'; end if; if lc_qty is null then lc_qty := 0; end if; return lc_qty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SORDER_RATE (IN_HDR_PRICELIST IN CHAR, IN_DTL_ITEM_CODE IN CHAR,IN_DTL_RATE IN NUMBER,ad_pldate in varchar2) RETURN NUMBER AS RT NUMBER (1); DTL_RATE NUMBER(10,3); ld_pldate date ; BEGIN RT:=0; ld_pldate := to_date(trim(ad_pldate),'YYYY-MM-DD'); IF IN_HDR_PRICELIST IS NOT NULL and TRIM(IN_DTL_ITEM_CODE) not in ('3233002','3233003') THEN BEGIN --corrected on 31/03/2025 -- select NVL(max_rate,0) into DTL_RATE from pricelist where list_type='L' and price_list=IN_HDR_PRICELIST and item_code=IN_DTL_ITEM_CODE AND to_date(to_char(sysdate,'dd/mm/yyyy'),'dd/mm/yyyy') between eff_from and valid_upto; select NVL(max_rate,0) into DTL_RATE from pricelist where list_type='L' and price_list=IN_HDR_PRICELIST and item_code=IN_DTL_ITEM_CODE AND ld_pldate between eff_from and valid_upto; --select NVL(max_rate,0) into DTL_RATE from pricelist where list_type='L' and price_list=IN_HDR_PRICELIST and item_code=IN_DTL_ITEM_CODE AND sysdate>= eff_from and sysdate<= valid_upto; IF to_number(IN_DTL_RATE) <= DTL_RATE THEN RT := 1; ELSE RT := 0; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 0; END; ELSE RT:=1; END IF; RETURN RT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEUVABLES_CITDTA ON RECEIVABLES (CUST_CODE, ITEM_SER, TRAN_SER, DUE_DATE, TOT_AMT, ADJ_AMT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_UNITAREA ( as_bomcode in char) return number is lc_retval number(16,5) ; begin select qty_per into lc_retval from bomdet where bom_code = as_bomcode and rownum = 1; return lc_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BATCH_NO ( as_batch_no char ) return number is ret_val number(1); len1 number(3); len2 number(3); asc_code number(3); begin select ascii(as_batch_no) into asc_code from dual; if( asc_code<>32)then ret_val:=1; else ret_val:=0; end if; return ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETMAILSUBJECT_SIGNFOR_TRV (ls_tour tour.tour_id%type,flag varchar,apprv_flag varchar) return char Is retrun_string varchar(1000); e_r_name varchar(100); ls_emp_code varchar(100); date_from date; date_to date; no_days NUMBER(4,1); begin retrun_string := 'Tour '; select date_from,date_to,emp_code,no_days into date_from,date_to,ls_emp_code,no_days from tour where tour_id = ls_tour; if flag = 'M' then if apprv_flag = 'R' then retrun_string := retrun_string || 'recommendation of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; end if; select trim(ddf_get_masters_name('EMPLOYEE',ls_emp_code,'F')) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' from '|| initcap(TO_CHAR(date_from,'DD-Mon')) || ' to ' || initcap(TO_CHAR(date_to,'DD-Mon')) || ' for ' || no_days ; elsif flag = 'S' then if apprv_flag = 'R' then retrun_string := retrun_string || 'recommendation of '; elsif apprv_flag = 'A' then retrun_string := retrun_string || 'approval of '; end if; select trim(ddf_get_masters_name('EMPLOYEE',ls_emp_code,'F')) into e_r_name from dual; retrun_string := retrun_string ||''|| e_r_name || ' from '|| initcap(TO_CHAR(date_from,'DD-Mon')) || ' to ' || initcap(TO_CHAR(date_to,'DD-Mon')) || ' for ' || no_days ; end if; if no_days > 1 then retrun_string := retrun_string || ' days' ; else retrun_string := retrun_string || ' day' ; end if; return trim(retrun_string); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_BT_SIT_BK_ST ON BANK_STATEMENT (SITE_CODE, BANK_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_WORKORDER (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOAN_SUMINT (as_loan_no CHAR, prd_code_fr CHAR, prd_code_to CHAR) return NUMBER IS lc_int NUMBER(14,2) := 0.00; ls_prd_code CHAR(6); int_amt NUMBER(14,2); cursor prd is SELECT payrolldet.prd_code FROM payrolldet, payroll WHERE ( payrolldet.emp_code = payroll.emp_code ) and ( payrolldet.prd_code = payroll.prd_code ) and ( ( payrolldet.ref_type = 'L' ) AND ( payrolldet.ref_no = as_loan_no ) AND ( payroll.voucher_no is not NULL ) and ( payrolldet.prd_code >= prd_code_fr and payrolldet.prd_code <= prd_code_to) ); BEGIN for i in prd loop select NVL(ddf_loan_interest(as_loan_no, i.prd_code),0) into int_amt from dual; lc_int := lc_int + int_amt; end loop; return lc_int; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_TOT_PC ( as_dcr_id char, as_event_date date, as_sales_pers char, as_loc_code char ) Return Number as as_tot_pc number(4); Begin Select nvl(count(distinct strg_code),0) into as_tot_pc from STRG_MEET_ORDER SMO where (dcr_id,Strg_Code) In ( select dcr_id,strg_code from Strg_Meet Where dcr_id = as_dcr_id and event_date = as_event_date AND SALES_PERS = as_sales_pers and locality_Code = as_loc_code ) and SMO.Quantity > 0; Return as_tot_pc; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLOYEE_BOND_I1 ON EMPLOYEE_BOND (EMP_CODE, AD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STRG_OUTLET_DTL ( AS_TYPE VARCHAR2 , AS_EMP_CODE CHAR , AS_PRD_CODE CHAR) RETURN NUMBER AS AS_CNT NUMBER(10,0); AS_BHR EXCEPTION ; BEGIN IF AS_TYPE = 'RETAIL' THEN SELECT COUNT(1) INTO AS_CNT FROM (SELECT B.SALES_PERS , B.SC_CODE, MAX(B.NO_VISIT) AS NO_VISIT FROM STRG_SERIES B , STRG_CUSTOMER C, PERIOD D WHERE B.SC_CODE = C.SC_CODE AND C.CUST_TYPE = 'C' AND D.CODE = AS_PRD_CODE AND B.SALES_PERS = AS_EMP_CODE AND 'Y' = ( CASE WHEN B.STATUS = 'Y' AND B.EFF_DATE <= D.TO_DATE THEN 'Y' WHEN B.STATUS = 'N' AND B.EFF_DATE <= D.TO_DATE AND B.CHG_DATE >= D.TO_DATE THEN 'Y' ELSE 'N' END) GROUP BY B.SALES_PERS , B.SC_CODE ); ELSIF AS_TYPE = 'WSALER' THEN SELECT COUNT(1) INTO AS_CNT FROM (SELECT B.SALES_PERS , B.SC_CODE, MAX(B.NO_VISIT) AS NO_VISIT FROM STRG_SERIES B , STRG_CUSTOMER C, PERIOD D WHERE B.SC_CODE = C.SC_CODE AND C.CUST_TYPE = 'W' AND D.CODE = AS_PRD_CODE AND B.SALES_PERS = AS_EMP_CODE AND 'Y' = ( CASE WHEN B.STATUS = 'Y' AND B.EFF_DATE <= D.TO_DATE THEN 'Y' WHEN B.STATUS = 'N' AND B.EFF_DATE <= D.TO_DATE AND B.CHG_DATE >= D.TO_DATE THEN 'Y' ELSE 'N' END) GROUP BY B.SALES_PERS , B.SC_CODE ); ELSIF AS_TYPE = 'STOCKIEST' THEN SELECT COUNT(1) INTO AS_CNT FROM (SELECT B.SALES_PERS , B.SC_CODE, MAX(B.NO_VISIT) AS NO_VISIT FROM STRG_SERIES B , STRG_CUSTOMER C, PERIOD D WHERE B.SC_CODE = C.SC_CODE AND C.CUST_TYPE = 'S' AND D.CODE = AS_PRD_CODE AND B.SALES_PERS = AS_EMP_CODE AND 'Y' = ( CASE WHEN B.STATUS = 'Y' AND B.EFF_DATE <= D.TO_DATE THEN 'Y' WHEN B.STATUS = 'N' AND B.EFF_DATE <= D.TO_DATE AND B.CHG_DATE >= D.TO_DATE THEN 'Y' ELSE 'N' END) GROUP BY B.SALES_PERS , B.SC_CODE ); ELSIF AS_TYPE = 'TOTA_OUTLET' THEN SELECT COUNT(1) INTO AS_CNT FROM (SELECT B.SALES_PERS , B.SC_CODE, MAX(B.NO_VISIT) AS NO_VISIT FROM STRG_SERIES B , STRG_CUSTOMER C, PERIOD D WHERE B.SC_CODE = C.SC_CODE AND D.CODE = AS_PRD_CODE AND B.SALES_PERS = AS_EMP_CODE AND 'Y' = ( CASE WHEN B.STATUS = 'Y' AND B.EFF_DATE <= D.TO_DATE THEN 'Y' WHEN B.STATUS = 'N' AND B.EFF_DATE <= D.TO_DATE AND B.CHG_DATE >= D.TO_DATE THEN 'Y' ELSE 'N' END) GROUP BY B.SALES_PERS , B.SC_CODE ); ELSIF AS_CNT = 0 THEN SELECT COUNT(1) INTO AS_CNT FROM ( SELECT DISTINCT B.SC_CODE AS SC_CODE FROM STRG_SERIES B , STRG_STATUS_HIST H , STRG_CUSTOMER C, PERIOD D WHERE B.SALES_PERS = H.SALES_PERS AND B.SC_CODE = H.SC_CODE AND B.SC_CODE = C.SC_CODE AND D.CODE = AS_PRD_CODE AND B.SALES_PERS = AS_EMP_CODE AND 'Y' = ( CASE WHEN B.STATUS = 'N' AND H.EFF_FROM <= D.TO_DATE AND H.VALID_UPTO >= D.TO_DATE THEN 'Y' ELSE 'N' END) ); END IF; RETURN AS_CNT; RAISE AS_BHR ; EXCEPTION WHEN AS_BHR THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETMAILSUBJ_SIGNFOR_ERC ( ls_tran_id emp_reimb_claim.tran_id%type, tran_date emp_reimb_claim.tran_date%type, emp_code emp_reimb_claim.emp_code%type, site_code emp_reimb_claim.site_code%type, status emp_reimb_claim.status%type, Confirmed Emp_Reimb_Claim.Confirmed%Type, Emp_Code_Admin Emp_Reimb_Claim.EMP_CODE__ADMIN%Type, Emp_Code_Hr_Admin Emp_Reimb_Claim.EMP_CODE__HR_ADMIN%Type, Emp_Code_Hr_Head Emp_Reimb_Claim.EMP_CODE__HR_HEAD%Type, tot_claim_amt emp_reimb_claim.tot_claim_amt%type, Flag Varchar, apprv_flag varchar) return varchar Is retrun_string varchar(1000); e_r_name varchar(100); tamount NUMBER(16,3); begin Select Trim(Ddf_Get_Masters_Name('EMPLOYEE', Emp_Code, 'F')) Into E_R_Name From Dual; if trim(ls_tran_id) ='' or tot_claim_amt > 0 then tamount := tot_claim_amt ; else select tot_claim_amt into tamount from emp_reimb_claim where tran_id = ls_tran_id; end if; retrun_string := 'Reimbursment claim (ERC) approval request of ' ||''|| e_r_name || ' dated '|| initcap(TO_CHAR(tran_date , 'DD-Mon-YYYY')) || ' for amount Rs.'|| tamount ; return retrun_string; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_DRCR_ADJ ( as_invoice_id CHAR ,as_drcr1 char,as_drcr2 char,as_type CHAR) return varchar2 is ls_return varchar2(1000) ; ls_ref_no varchar2(1000) ; ls_amount number(17,3); counter number(15); begin if as_type = 'INV_NO' then declare cursor cur1 is select ref_no from ( SELECT receivables_adj.ref_no,receivables_adj.ref_ser FROM receivables_adj,invoice WHERE ( receivables_adj.ref_no = invoice.invoice_id ) and ( receivables_adj.ref_ser_adj = 'S-INV' ) and ( receivables_adj.ref_no_adj = as_invoice_id ) UNION SELECT receivables_adj.ref_no ,receivables_adj.ref_ser FROM receivables_adj,drcr_rcp WHERE ( drcr_rcp.tran_id = receivables_adj.ref_no) and ( receivables_adj.ref_ser_adj = 'S-INV' ) and ( receivables_adj.ref_no_adj = as_invoice_id) UNION SELECT receivables_adj.ref_no ,receivables_adj.ref_ser FROM receivables_adj,misc_drcr_rcp WHERE ( misc_drcr_rcp.tran_id = receivables_adj.ref_no) and ( receivables_adj.ref_ser_adj = 'S-INV' ) and ( receivables_adj.ref_no_adj = as_invoice_id) )where ref_ser in (as_drcr1,as_drcr2); begin counter := 0 ; for i in cur1 loop counter := counter + 1; if counter = 1 then ls_ref_no := TRIM(i.ref_no) ; else if i.ref_no is not null then ls_ref_no := ls_ref_no ||','|| TRIM(i.ref_no); end if; end if; end loop ; if ls_ref_no IS NOT NULL then ls_return := ls_ref_no ; else ls_return := ' '; end if ; return ls_return ; end ; elsif as_type = 'INV_AMT' then select sum(adj_amt) into ls_amount from ( SELECT receivables_adj.adj_amt,receivables_adj.ref_ser FROM receivables_adj,invoice WHERE ( receivables_adj.ref_no = invoice.invoice_id ) and ( receivables_adj.ref_ser_adj = 'S-INV' ) and ( receivables_adj.ref_no_adj = as_invoice_id ) UNION SELECT receivables_adj.adj_amt ,receivables_adj.ref_ser FROM receivables_adj,drcr_rcp WHERE ( drcr_rcp.tran_id = receivables_adj.ref_no) and ( receivables_adj.ref_ser_adj = 'S-INV' ) and ( receivables_adj.ref_no_adj = as_invoice_id ) UNION SELECT receivables_adj.adj_amt ,receivables_adj.ref_ser FROM receivables_adj,misc_drcr_rcp WHERE ( misc_drcr_rcp.tran_id = receivables_adj.ref_no) and ( receivables_adj.ref_ser_adj = 'S-INV' ) and ( receivables_adj.ref_no_adj = as_invoice_id ) )where ref_ser in (as_drcr1,as_drcr2); if ls_amount IS NOT NULL then ls_return := to_char(ls_amount) ; else ls_return := ' '; end if ; return ls_return ; else ls_return := ' '; return ls_return ; end if ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEMSER_DESCR ON ITEMSER (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LRNO_AND_DATE (AS_TRAN_ID CHAR) RETURN varchar IS As_LrNo_Date varchar(100); BEGIN SELECT ( LR_NO|| chr(10) ||to_char(LR_DATE,'dd/mm/yy')) INTO As_LrNo_Date FROM DESPATCH WHERE DESP_ID=AS_TRAN_ID; RETURN As_LrNo_Date; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_MENU_DESCR (as_win_name itm2menu.win_name%type) return varchar2 is ls_descr itm2menu.descr%type; li_count number; begin select count(1) into li_count from itm2menu where win_name = as_win_name; if li_count >= 1 then select descr into ls_descr from itm2menu where win_name = as_win_name and rownum=1; else select descr into ls_descr from itm2menu where win_name like ('%'||substr(as_win_name,3)||'%') and rownum=1; end if; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_PACK_TRAN_DATE_SITE ON INV_PACK (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSTOCK_RATE (as_site stock.site_code%type, as_item stock.item_code%type, as_loc stock.loc_code%type, as_lot stock.lot_no%type, as_LOT_SL stock.lot_SL%type) return number is ll_rate number(14,7); begin select nvl(rate,0) into ll_rate from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and lot_SL = as_lot_SL and rownum = 1; return ll_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE SDWH_SALES ( AS_FR_DATE DATE, AS_TO_DATE DATE) AS BEGIN IF (AS_TO_DATE >= AS_FR_DATE) THEN /*========== INSERT for DWH_SALES_SUM Started ==========*/ INSERT INTO DWH_SALES_SUM ( TRAN_ID, SITE_CODE, CUST_CODE, CUST_CODE__BIL, ITEM_CODE, LOT_NO, LINE_TYPE, DOC_DATE, POS_CODE, SALES_QTY, GROSS_SALES_VALUE, SALES_VALUE, FREE_QTY, FREE_SALES_VALUE, NET_SALES_QTY, NET_SALES_VALUE, REPL_QTY, REPL_VALUE, SALEABLE_RETURN_QTY, SALEABLE_RETURN_AMT, BREAKAGE_RETURN_QTY, BREAKAGE_RETURN_AMT, EXPIRY_RETURN_QTY, EXPIRY_RETURN_AMT, CORRECTION_RETURN_QTY, CORRECTION_RETURN_AMT, REPL_RETURN_QTY, REPL_RETURN_VALUE, RETURN_QTY, GROSS_RETURN_VALUE, RETURN_VALUE, NET_RETURN_VALUE, CGST_RATE, CGST_AMT, SGST_RATE, SGST_AMT, IGST_RATE, IGST_AMT, DISC_AMT, MRP, PTR, PTS, HSN_CODE, PACK, DUE_DATE, REF_SER, CITY, ITEM_BRAND, ITEM_SER ) SELECT DSSV.TRAN_ID, DSSV.SITE_CODE AS SITE_CODE, DSSV.CUST_CODE AS CUST_CODE, DSSV.CUST_CODE_BILL AS CUST_CODE__BIL, DSSV.ITEM_CODE AS ITEM_CODE, DSSV.LOT_NO AS LOT_NO, DSSV.LINE_TYPE AS LINE_TYPE, DSSV.TRAN_DATE AS DOC_DATE, DSSV.POS_CODE AS POS_CODE, SUM( DSSV.SALES_QTY ) AS SALES_QTY, SUM( DSSV.GROSS_SALES_VALUE - DSSV.DISC_AMT_INV ) AS GROSS_SALES_VALUE, SUM( DSSV.GROSS_SALES_VALUE ) AS SALES_VALUE, SUM( DSSV.FREE_QTY ) AS FREE_QTY, SUM( DSSV.FREE_SALES_VALUE ) AS FREE_SALES_VALUE, SUM( DSSV.SALES_QTY + DSSV.FREE_QTY + DSSV.REPL_QTY - DSSV.RETURN_QTY + DSSV.REPL_RETURN_QTY ) AS NET_SALES_QTY, SUM( ( DSSV.GROSS_SALES_VALUE - DSSV.DISC_AMT_INV ) - ( DSSV.GROSS_RETURN_VALUE - DSSV.DISC_AMT_RET ) + ( DSSV.REPL_RETURN_VALUE - DSSV.DISC_AMT_REPL_RET ) ) AS NET_SALES_VALUE, SUM( DSSV.REPL_QTY ) AS REPL_QTY, SUM( DSSV.REPL_VALUE - DSSV.DISC_AMT_REPL) AS REPL_VALUE, SUM( DSSV.SALEABLE_RETURN_QTY ) AS SALEABLE_RETURN_QTY, SUM( DSSV.SALEABLE_RETURN_AMT ) AS SALEABLE_RETURN_AMT, SUM( DSSV.BREAKAGE_RETURN_QTY ) AS BREAKAGE_RETURN_QTY, SUM( DSSV.BREAKAGE_RETURN_AMT ) AS BREAKAGE_RETURN_AMT, SUM( DSSV.EXPIRY_RETURN_QTY ) AS EXPIRY_RETURN_QTY, SUM( DSSV.EXPIRY_RETURN_AMT ) AS EXPIRY_RETURN_AMT, SUM( DSSV.CORRECTION_RETURN_QTY ) AS CORRECTION_RETURN_QTY, SUM( DSSV.CORRECTION_RETURN_AMT ) AS CORRECTION_RETURN_AMT, SUM( DSSV.REPL_RETURN_QTY ) AS REPL_RETURN_QTY, SUM( DSSV.REPL_RETURN_VALUE - DSSV.DISC_AMT_REPL_RET) AS REPL_RETURN_VALUE, SUM( DSSV.RETURN_QTY ) AS RETURN_QTY, SUM( DSSV.GROSS_RETURN_VALUE - DSSV.DISC_AMT_RET) AS GROSS_RETURN_VALUE, SUM( DSSV.GROSS_RETURN_VALUE ) AS RETURN_VALUE, SUM( DSSV.NET_RETURN_VALUE ) AS NET_RETURN_VALUE, DSSV.CGST_RATE, SUM(DSSV.CGST_AMT) AS CGST_AMT, DSSV.SGST_RATE, SUM(DSSV.SGST_AMT) AS SGST_AMT, DSSV.IGST_RATE, SUM(DSSV.IGST_AMT) AS IGST_AMT, SUM(DSSV.DISC_AMT_INV + DSSV.DISC_AMT_RET + DSSV.DISC_AMT_REPL + DSSV.DISC_AMT_REPL_RET) AS DISC_AMT, DSSV.MRP, DSSV.PTR, DSSV.PTS, DSSV.HSN_CODE, (SELECT DESCR FROM PACKING WHERE PACK_CODE = DSSV.PACK_CODE) AS PACK, DSSV.DUE_DATE, DSSV.REF_SER, NVL(DSSV.CITY , 'NOTSPECIFIED') AS CITY, DSSV.ITEM_BRAND, DSSV.ITEM_SER FROM (SELECT 'S-INV ' AS REF_SER, ITEM.ITEM_SER, INVOICE.INVOICE_ID AS TRAN_ID, INVOICE.SITE_CODE, INVOICE.CUST_CODE, INVOICE.CUST_CODE__BIL AS CUST_CODE_BILL, INVOICE_TRACE.ITEM_CODE, nvl(INVOICE_TRACE.LOT_NO,'NA') as lot_no, nvl(INVOICE_TRACE.LINE_TYPE,'NA') as line_type, INVOICE.TRAN_DATE, NVL((SELECT ORG.POS_CODE FROM ORG_STRUCTURE_CUST ORG WHERE ORG.CUST_CODE=INVOICE.CUST_CODE AND ORG.VERSION_ID IN (SELECT V.VERSION_ID FROM VERSION V WHERE TO_DATE(SYSDATE) BETWEEN V.EFF_FROM AND V.VALID_UPTO) AND ORG.TABLE_NO = ITEM.ITEM_SER ) ,'NA') AS POS_CODE, INVOICE.INV_TYPE AS TRAN_TYPE, ITEM.HSN_NO AS HSN_CODE, ITEM.PACK_CODE AS PACK_CODE, NVL(DC.CITY , 'NOTSPECIFIED') AS CITY, ITEM.PHY_ATTRIB_2 AS ITEM_BRAND, TO_CHAR(NVL(INVOICE.DUE_DATE,INVOICE.TRAN_DATE )) AS DUE_DATE, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'F', 'V') AND INVOICE_TRACE.RATE__STDUOM = 0 THEN 0 ELSE INVOICE_TRACE.QUANTITY__STDUOM END ) AS SALES_QTY, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN 0 ELSE INVOICE_TRACE.QUANTITY__STDUOM * INVOICE_TRACE.RATE__STDUOM END ) AS GROSS_SALES_VALUE, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'I', 'V') THEN INVOICE_TRACE.QUANTITY__STDUOM ELSE 0 END ) AS REPL_QTY, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN INVOICE_TRACE.QUANTITY__STDUOM ELSE 0 END ) AS FREE_QTY, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN INVOICE_TRACE.QUANTITY__STDUOM * NVL(FN_RPICK_RATE_PL(DC.PRICE_LIST, INVOICE.TRAN_DATE, INVOICE_TRACE.ITEM_CODE, INVOICE_TRACE.LOT_NO) , 0 ) ELSE 0 END ) AS FREE_SALES_VALUE, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'I', 'V') AND INVOICE_TRACE.RATE__STDUOM = 0 THEN INVOICE_TRACE.QUANTITY__STDUOM * NVL(FN_RPICK_RATE_PL(DC.PRICE_LIST, INVOICE.TRAN_DATE, INVOICE_TRACE.ITEM_CODE, INVOICE_TRACE.LOT_NO) , 0 ) ELSE 0 END ) AS REPL_VALUE, INVOICE_TRACE.NET_AMT AS NET_SALES_VALUE, 0 AS SALEABLE_RETURN_QTY, 0 AS SALEABLE_RETURN_AMT, 0 AS BREAKAGE_RETURN_QTY, 0 AS BREAKAGE_RETURN_AMT, 0 AS EXPIRY_RETURN_QTY, 0 AS EXPIRY_RETURN_AMT, 0 AS CORRECTION_RETURN_QTY, 0 AS CORRECTION_RETURN_AMT, 0 AS REPL_RETURN_QTY, 0 AS REPL_RETURN_VALUE, 0 AS RETURN_QTY, 0 AS GROSS_RETURN_VALUE, 0 AS NET_RETURN_VALUE, 0 AS FREE_RETURN_QTY, 0 AS FREE_RET_VALUE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','P'),0) AS CGST_RATE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','T'),0) AS CGST_AMT, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','P'),0) AS SGST_RATE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','T'),0) AS SGST_AMT, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','P'),0) AS IGST_RATE, NVL(FN_RGET_TAX_NEW('S-INV',INVOICE_TRACE.INVOICE_ID,CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','T'),0) AS IGST_AMT, ( (NVL((((NVL(INVOICE_TRACE.QUANTITY,0)*NVL(INVOICE_TRACE.RATE__STDUOM,0)*NVL(INVOICE.EXCH_RATE,0))*NVL(INVOICE_TRACE.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-INV', INVOICE_TRACE.INVOICE_ID, CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0)) ) AS DISC_AMT_INV, 0 AS DISC_AMT_RET, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') IN ( 'I', 'V') AND INVOICE_TRACE.RATE__STDUOM = 0 THEN ( (NVL((((NVL(INVOICE_TRACE.QUANTITY,0)*NVL(INVOICE_TRACE.RATE__STDUOM,0)*NVL(INVOICE.EXCH_RATE,0))*NVL(INVOICE_TRACE.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-INV', INVOICE_TRACE.INVOICE_ID, CAST(INVOICE_TRACE.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0)) ) ELSE 0 END ) AS DISC_AMT_REPL, 0 AS DISC_AMT_REPL_RET, NVL(FN_RPICK_MRP_PTR(INVOICE_TRACE.ITEM_CODE,INVOICE.TRAN_DATE,INVOICE_TRACE.LOT_NO,'MRP_GST'),0) AS MRP, NVL(FN_RPICK_MRP_PTR(INVOICE_TRACE.ITEM_CODE,INVOICE.TRAN_DATE,INVOICE_TRACE.LOT_NO,'PTR_GST'),0) AS PTR, NVL(FN_RPICK_MRP_PTR(INVOICE_TRACE.ITEM_CODE,INVOICE.TRAN_DATE,INVOICE_TRACE.LOT_NO,'PTS_GST'),0) AS PTS FROM INVOICE INNER JOIN INVOICE_TRACE ON INVOICE.INVOICE_ID = INVOICE_TRACE.INVOICE_ID INNER JOIN SITE ON INVOICE.SITE_CODE = SITE.SITE_CODE INNER JOIN ITEM ON INVOICE_TRACE.ITEM_CODE = ITEM.ITEM_CODE LEFT OUTER JOIN CUSTOMER DC ON INVOICE.CUST_CODE = DC.CUST_CODE WHERE INVOICE.CONFIRMED = 'Y' AND INVOICE.TRAN_DATE >= AS_FR_DATE AND INVOICE.TRAN_DATE <= AS_TO_DATE UNION ALL SELECT 'S-RET' AS REF_SER, ITEM.ITEM_SER, SRETURN.TRAN_ID, SRETURN.SITE_CODE, SRETURN.CUST_CODE, SRETURN.CUST_CODE__BILL AS CUST_CODE_BILL, SRETURNDET.ITEM_CODE, nvl(SRETURNDET.LOT_NO,'NA') as lot_no, nvl(SRETURNDET.LINE_TYPE,'NA') as line_type, SRETURN.TRAN_DATE, NVL((SELECT ORG.POS_CODE FROM ORG_STRUCTURE_CUST ORG WHERE ORG.CUST_CODE=SRETURN.CUST_CODE AND ORG.VERSION_ID IN (SELECT V.VERSION_ID FROM VERSION V WHERE TO_DATE(SYSDATE) BETWEEN V.EFF_FROM AND V.VALID_UPTO) AND ORG.TABLE_NO = ITEM.ITEM_SER ) ,'NA') AS POS_CODE, SRETURN.TRAN_TYPE, ITEM.HSN_NO AS HSN_CODE, ITEM.PACK_CODE AS PACK_CODE, ITEM.PHY_ATTRIB_2 AS ITEM_BRAND, NVL(DC.CITY , 'NOTSPECIFIED') AS CITY, TO_CHAR( SRETURN.TRAN_DATE) AS DUE_DATE, 0 AS SALES_QTY, 0 AS GROSS_SALES_VALUE, 0 AS REPL_QTY, 0 AS FREE_QTY, 0 AS FREE_SALES_VALUE, 0 AS REPL_VALUE, 0 AS NET_SALES_VALUE, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('SR') THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS SALEABLE_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('SR') THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS SALEABLE_RETURN_AMT, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('BR', 'DR') THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS BREAKAGE_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('BR', 'DR') THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS BREAKAGE_RETURN_AMT, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE = 'ER' AND SRETURNDET.DISCOUNT <> 100 THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS EXPIRY_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE = 'ER' AND SRETURNDET.DISCOUNT <> 100 THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS EXPIRY_RETURN_AMT, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('IC') THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS CORRECTION_RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' AND SRETURN.TRAN_TYPE IN('IC') THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS CORRECTION_RETURN_AMT, DECODE(SRETURNDET.RET_REP_FLAG, 'P', SRETURNDET.QUANTITY__STDUOM, 0) AS REPL_RETURN_QTY, DECODE(SRETURNDET.RET_REP_FLAG, 'P', SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM, 0) AS REPL_RETURN_VALUE, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END ) AS RETURN_QTY, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN SRETURNDET.QUANTITY__STDUOM * SRETURNDET.RATE__STDUOM ELSE 0 END ) AS GROSS_RETURN_VALUE, SRETURNDET.NET_AMT AS NET_RETURN_VALUE, ( CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN DECODE(INVOICE_TRACE.INVOICE_ID, NULL, 0, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN SRETURNDET.QUANTITY__STDUOM ELSE 0 END) ) ELSE 0 END) AS FREE_RETURN_QTY, (CASE WHEN SRETURNDET.RET_REP_FLAG = 'R' THEN DECODE(INVOICE_TRACE.INVOICE_ID, NULL, 0, ( CASE WHEN COALESCE(INVOICE_TRACE.LINE_TYPE,'C') = 'F' AND INVOICE_TRACE.RATE__STDUOM = 0 THEN SRETURNDET.QUANTITY__STDUOM * INVOICE_TRACE.RATE__STDUOM ELSE 0 END) ) ELSE 0 END) AS FREE_RET_VALUE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','P'),0) AS CGST_RATE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'CGST_TAX',' ',' ','T'),0) AS CGST_AMT, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','P'),0) AS SGST_RATE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'SGST_TAX',' ',' ','T'),0) AS SGST_AMT, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','P'),0) AS IGST_RATE, NVL(FN_RGET_TAX_NEW('S-RET',SRETURN.TRAN_ID,CAST(SRETURNDET.LINE_NO AS CHAR(3)),'IGST_TAX',' ',' ','T'),0) AS IGST_AMT, 0 AS DISC_AMT_INV, ((NVL((((NVL(SRETURNDET.QUANTITY__STDUOM,0)*NVL(SRETURNDET.RATE__STDUOM,0)*NVL(SRETURN.EXCH_RATE,0))*NVL(SRETURNDET.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-RET', SRETURN.TRAN_ID, CAST(SRETURNDET.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0))) AS DISC_AMT_RET, 0 AS DISC_AMT_REPL, DECODE(SRETURNDET.RET_REP_FLAG,'P',((NVL((((NVL(SRETURNDET.QUANTITY__STDUOM,0)*NVL(SRETURNDET.RATE__STDUOM,0)*NVL(SRETURN.EXCH_RATE,0))*NVL(SRETURNDET.DISCOUNT,0))/100),0) + NVL(FN_RGET_TAX_NEW('S-RET', SRETURN.TRAN_ID, CAST(SRETURNDET.LINE_NO AS CHAR(3)),'DISC_GST',' ',' ','T')*(-1),0))), 0) AS DISC_AMT_REPL_RET, NVL(FN_RPICK_MRP_PTR(SRETURNDET.ITEM_CODE, SRETURN.TRAN_DATE,SRETURNDET.LOT_NO,'MRP_GST'),0) AS MRP, NVL(FN_RPICK_MRP_PTR(SRETURNDET.ITEM_CODE, SRETURN.TRAN_DATE,SRETURNDET.LOT_NO,'PTR_GST'),0) AS PTR, NVL(FN_RPICK_MRP_PTR(SRETURNDET.ITEM_CODE, SRETURN.TRAN_DATE,SRETURNDET.LOT_NO,'PTS_GST'),0) AS PTS FROM SRETURN INNER JOIN SRETURNDET ON SRETURN.TRAN_ID = SRETURNDET.TRAN_ID INNER JOIN SITE ON SRETURN.SITE_CODE = SITE.SITE_CODE INNER JOIN ITEM ON SRETURNDET.ITEM_CODE = ITEM.ITEM_CODE LEFT OUTER JOIN CUSTOMER DC ON SRETURN.CUST_CODE = DC.CUST_CODE LEFT OUTER JOIN INVOICE_TRACE ON SRETURN.INVOICE_ID = INVOICE_TRACE.INVOICE_ID AND SRETURNDET.INVOICE_ID = INVOICE_TRACE.INVOICE_ID AND SRETURNDET.LINE_NO__INVTRACE = INVOICE_TRACE.LINE_NO WHERE SRETURN.CONFIRMED = 'Y' AND SRETURN.TRAN_DATE >= AS_FR_DATE AND SRETURN.TRAN_DATE <= AS_TO_DATE ) DSSV GROUP BY DSSV.TRAN_ID, DSSV.SITE_CODE, DSSV.CUST_CODE, DSSV.CUST_CODE_BILL, DSSV.ITEM_CODE, DSSV.LOT_NO, DSSV.LINE_TYPE, DSSV.TRAN_DATE, DSSV.POS_CODE, DSSV.MRP, DSSV.PTR, DSSV.PTS, DSSV.HSN_CODE, DSSV.PACK_CODE, DSSV.DUE_DATE, DSSV.ITEM_BRAND, NVL(DSSV.CITY , 'NOTSPECIFIED'), DSSV.CGST_RATE, DSSV.SGST_RATE, DSSV.IGST_RATE, DSSV.REF_SER, DSSV.ITEM_SER; /*========== INSERT for DWH_SALES_SUM Ended ==========*/ COMMIT ; /* ==================== DWH_SALES_SUM Data Insertion END ==================== */ END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(' Error occured '); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAXAMT_SUM1 (ls_tran_code in char,ls_tran_id in char,AS_ITEM_CODE IN CHAR,as_lot_no in CHAR,as_rate IN Number,ls_disparm_code in char) return number is AS_TAX_SUM number(14,3); ls_var_value disparm.var_value%type; BEGIN select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; SELECT NVL(sum(nvl(TAXTRAN.TAX_AMT,0)),0) INTO AS_TAX_SUM FROM TAXTRAN,DISTORD_ISSDET WHERE trim(TAXTRAN.TRAN_ID)=trim(ls_tran_id) AND trim(TAXTRAN.TRAN_ID)=trim(DISTORD_ISSDET.TRAN_ID) AND trim(DISTORD_ISSDET.ITEM_CODE)=trim(AS_ITEM_CODE) AND trim(TAXTRAN.TRAN_CODE)=trim(ls_tran_code) and DISTORD_ISSDET.line_no=taxtran.line_no and DISTORD_ISSDET.rate=as_rate and trim(DISTORD_ISSDET.lot_no)=trim(as_lot_no) and instr(ls_var_value,rtrim(tax_code)) > 0 GROUP BY DISTORD_ISSDET.ITEM_CODE,DISTORD_ISSDET.LOT_NO,DISTORD_ISSDET.RATE; RETURN AS_TAX_SUM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_REGION_CODE (marea_code in char) return char is mregion_code char(5); begin select level_code__parent into mregion_code from hierarchy where level_code = marea_code; return mregion_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYRVOUCH_EMPREFNO ON PAYR_VOUCHER (EMP_CODE, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ENTITY_DETAIL_DM AS FUNCTION getEntityDetail(entityType in char) RETURN ENTITY_DETAIL_TB PIPELINED; END ENTITY_DETAIL_DM; CREATE OR REPLACE PACKAGE BODY ENTITY_DETAIL_DM AS FUNCTION getEntityDetail(entityType in char) RETURN ENTITY_DETAIL_TB PIPELINED IS BEGIN IF entityType = 'C' THEN FOR x IN ( SELECT sc_code as entity_code, first_name || ' ' || middle_name || ' ' || last_name AS entity_name from strg_customer ) LOOP PIPE ROW (ENTITY_DETAIL_MST(x.entity_code,x.entity_name)); END LOOP; RETURN; END IF; IF entityType = 'C' THEN FOR x IN ( SELECT sc_code as entity_code, first_name || ' ' || middle_name || ' ' || last_name AS entity_name from strg_customer ) LOOP PIPE ROW (ENTITY_DETAIL_MST(x.entity_code,x.entity_name)); END LOOP; RETURN; END IF; IF entityType = 'E' THEN FOR x IN ( SELECT emp_code as entity_code, emp_fname || ' ' || emp_mname || ' ' || emp_lname AS entity_name from employee ) LOOP PIPE ROW (ENTITY_DETAIL_MST(x.entity_code,x.entity_name)); END LOOP; RETURN; END IF; IF entityType = 'P' THEN FOR x IN ( SELECT sales_pers as entity_code, sp_name AS entity_name from sales_pers ) LOOP PIPE ROW (ENTITY_DETAIL_MST(x.entity_code,x.entity_name)); END LOOP; RETURN; END IF; IF entityType = 'T' THEN FOR x IN ( SELECT tran_code as entity_code, tran_name AS entity_name from transporter ) LOOP PIPE ROW (ENTITY_DETAIL_MST(x.entity_code,x.entity_name)); END LOOP; RETURN; END IF; END; END ENTITY_DETAIL_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION BI_GET_STATION_NAME (AS_STAN_CODE IN VARCHAR2) RETURN VARCHAR2 IS StationName varchar2(50) ; BEGIN select descr into StationName from station where stan_code = AS_STAN_CODE; RETURN NVL(StationName, 'NA') ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VOUCH_BTRAN_LOG (AS_TRAN_ID in varchar2 , AS_TRAN_SER in varchar2 ) Return varchar2 is ll_tran varchar2(12) ; begin select min(banktran_log.tran_id) into ll_tran from banktran_log where tran_ser = AS_TRAN_SER and tran_no = AS_TRAN_ID ; return ll_tran ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STP_CHNG_DATA (AS_SALES_PERS CHAR,AS_PARAMETER CHAR) RETURN VARCHAR IS DETAIL VARCHAR (60); BEGIN IF AS_PARAMETER = 'HO' THEN select stp.chg_user into DETAIL from sprs_stp_stat stp where stp.tran_id=(select max(s.tran_id) from sprs_stp_stat s where s.sales_pers=stp.sales_pers) and stp.sales_pers=AS_SALES_PERS; END IF ; IF AS_PARAMETER = 'DATE' THEN select to_char(stp.chg_date,'dd-Mon-yyyy') into DETAIL from sprs_stp_stat stp where stp.tran_id=(select max(s.tran_id) from sprs_stp_stat s where s.sales_pers=stp.sales_pers) and stp.sales_pers=AS_SALES_PERS; END IF ; RETURN DETAIL ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALID_MONTH (ref_date date ) RETURN number IS result number; --refDateOld date; ls_month number(3); begin --refDateOld :=ref_date; ls_month :=0; SELECT MONTHS_BETWEEN(SYSDATE,ref_date) into ls_month FROM DUAL; --if (ls_month < 0) then result:= ls_month; --else -- result:=false; --end if; return result; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXRATE_PLISTGEN (mitm in char, mtax in char, mtaxtable in char, mtype in char, meff_from in date) return number is mrate number; mctr number; mreg char(1); begin if mtype = 'E' then select count(*) into mctr FROM TAXSET A , TAXRATE B WHERE A.TAX_SET = B.TAX_SET AND A.TAX_TABLE = mtaxtable AND meff_from BETWEEN A.EFF_FROM AND A.VALID_UPTO AND TAX_CODE = mtax and TAX_CLASS = ' ' AND TAX_CHAP = mitm; if mctr = 0 then SELECT RATE into mrate FROM TAXSET A , TAXRATE B WHERE A.TAX_SET = B.TAX_SET AND A.TAX_TABLE = mtaxtable AND meff_from BETWEEN A.EFF_FROM AND A.VALID_UPTO AND TAX_CODE = mtax AND TAX_CHAP = ' ' and TAX_CLASS = ' '; elsif mctr > 0 then SELECT RATE into mrate FROM TAXSET A , TAXRATE B WHERE A.TAX_SET = B.TAX_SET AND A.TAX_TABLE = mtaxtable AND meff_from BETWEEN A.EFF_FROM AND A.VALID_UPTO AND TAX_CODE = mtax and TAX_CLASS = ' ' AND TAX_CHAP = mitm; end if; end if; if mtype = 'T' then select count(*) into mctr FROM TAXSET A , TAXRATE B WHERE A.TAX_SET = B.TAX_SET AND A.TAX_TABLE = mtaxtable AND SYSDATE BETWEEN A.EFF_FROM AND A.VALID_UPTO AND TAX_CODE = mtax and TAX_CLASS = ' ' AND TAX_CHAP = mitm; if mctr = 0 then SELECT RATE into mrate FROM TAXSET A , TAXRATE B WHERE A.TAX_SET = B.TAX_SET AND A.TAX_TABLE = mtaxtable AND SYSDATE BETWEEN A.EFF_FROM AND A.VALID_UPTO AND TAX_CODE = mtax AND TAX_CHAP = ' ' and TAX_CLASS = ' '; elsif mctr > 0 then SELECT RATE into mrate FROM TAXSET A , TAXRATE B WHERE A.TAX_SET = B.TAX_SET AND A.TAX_TABLE = mtaxtable AND SYSDATE BETWEEN A.EFF_FROM AND A.VALID_UPTO AND TAX_CODE = mtax and TAX_CLASS = ' ' AND TAX_CHAP = mitm; end if; end if; if mtype = 'M' then select REGULATED_PRICE into mreg from item where item_code = mitm; if mreg = 'Y' then select to_number(var_value) into mrate from disparm where var_name = 'STK_REG_PER'; elsif mreg = 'N' then select to_number(var_value) into mrate from disparm where var_name = 'STK_NONREG_PER'; end if; end if; if mtype = 'S' then select REGULATED_PRICE into mreg from item where item_code = mitm; if mreg = 'Y' then select to_number(var_value) into mrate from disparm where var_name = 'AML_REG_PER'; elsif mreg = 'N' then select to_number(var_value) into mrate from disparm where var_name = 'AML_NONREG_PER'; end if; end if; if mtype = 'A' then select to_number(var_value) into mrate from disparm where var_name = 'AML_MARGIN_VAT'; end if; if mtype = 'N' then select to_number(var_value) into mrate from disparm where var_name = 'SUN_REG_PER'; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MILESTNNAME ( as_proc_code char) return varchar2 is ls_descr varchar2(120); begin begin select distinct descr into ls_descr from process where proc_code = as_proc_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_DETAIL_PRJ (ls_tran_code in char,ls_tran_id in char,ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr('' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt tcurr if ls_type = 'T' then select nvl(sum(nvl(tax_amt__tcurr,0)),0) into lc_tax_amt from taxtran where trim(tran_code) = trim(ls_tran_code) and trim(tran_id) = trim(ls_tran_id) and trim(line_no) = trim(as_line_no) and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select MIN(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select MIN(taxable_amt) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then lc_exch_rate := ddf_get_exch_rate(ls_tran_code,ls_tran_id); if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_CUSTCODE (as_workorder in char) return varchar2 is ls_retval varchar2(10); ls_saleorder varchar2(10); ls_saleorderend varchar2(10); ls_custcodeend varchar2(10); begin select cust_code__end into ls_custcodeend from workorder where work_order = as_workorder; if (ls_custcodeend is null) or (length(ltrim(rtrim(ls_custcodeend))) = 0) then select sale_order, sale_order__end into ls_saleorder, ls_saleorderend from workorder where work_order = as_workorder ; if (ls_saleorderend is not null) and (length(ltrim(rtrim(ls_saleorderend))) > 0) then --return ls_saleorderend; ls_saleorderend := ltrim(rtrim(ls_saleorderend)); else if (ls_saleorder is not null) and (length(ltrim(rtrim(ls_saleorder))) > 0) then ls_saleorderend := ls_saleorder; else ls_saleorderend := ' '; end if; end if; if (ls_saleorderend is not null) and (length(ltrim(rtrim(ls_saleorderend))) > 0) then select cust_code into ls_custcodeend from sorder where sale_order = ls_saleorderend; return nvl(ls_custcodeend,'X'); end if; else return nvl(ls_custcodeend,'X'); end if; return nvl(ls_custcodeend,'X') ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_EARLY_GOING (AS_EMP_CODE char,AS_DATE_FR date,AS_DATE_TO date,AS_TYPE char) return number is a_minutes number(5); a_ret_value number(5) := 0; a_curr_date date; a_fr_date date := AS_DATE_FR; a_to_date date := AS_DATE_TO; a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; begin select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (a_date_join > a_fr_date) then a_fr_date := a_date_join; end if; if (a_relieve_date is not null and a_relieve_date < a_to_date) then a_to_date := a_relieve_date; end if; if (a_fr_date > a_to_date) then return a_ret_value; end if; for i in 1..(a_to_date-a_fr_date+1) loop a_curr_date := (a_fr_date+i-1); select nvl(sum(ddf_time_in_mm(b.out_time)+(case when (b.out_time < b.in_time) then 1440 else 0 end)-ddf_time_in_mm(a.out_time)),0) into a_minutes from attendance_day a,workshft b where b.shift = a.shift and b.day_no = a.day_no and a.attd_date = a_curr_date and a.emp_code= AS_EMP_CODE and (ddf_time_in_mm(b.out_time)+(case when (b.out_time < b.in_time) then 1440 else 0 end)-ddf_time_in_mm(a.out_time)) > 0 and trim(replace(a.out_time,':','')) is not null; if (a_minutes != 0) then if (nvl(ddf_get_holiday_for_date(AS_EMP_CODE,a_curr_date),' ') in ('W','H')) then a_minutes := 0; end if; end if; if (a_minutes != 0) then declare cursor c1 is select lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and a_curr_date between lve_date_fr and lve_date_to and use_flag = 'C' and status = 'A' order by lve_date_fr,lve_date_to; begin for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> a_curr_date and i.lve_date_to <> a_curr_date) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = a_curr_date and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = a_curr_date and i.leave_ends = 'E') or (i.lve_date_fr = a_curr_date and i.leave_starts = 'M') or (i.lve_date_to = a_curr_date and i.leave_ends = 'E') then a_minutes := 0; end if; end loop; end; end if; if (a_minutes != 0) then declare cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and a_curr_date between date_from and date_to and status = 'A' order by date_from,date_to; begin for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> a_curr_date and i.date_to <> a_curr_date) or (i.date_from <> i.date_to and i.date_from = a_curr_date and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = a_curr_date and i.tour_ends = 'E') or (i.date_from = a_curr_date and i.tour_starts = 'B') or (i.date_to = a_curr_date and i.tour_ends = 'E') then a_minutes := 0; end if; end loop; end; end if; if (a_minutes != 0) then if (AS_TYPE = 'M') then a_ret_value := a_ret_value + a_minutes; elsif (AS_TYPE = 'T') then a_ret_value := a_ret_value + 1; end if; end if; end loop; return a_ret_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ASSIGN_DATA (as_item_ser char,as_site_code char,as_dept_code char,as_emp_code char,as_req_typ char) return char is FEEDBACK__EMP_CODE char(10); FDBK__EMP_CODE_1 char(10); FDBK__EMP_CODE_2 char(10); GRADE_ALLOW VARCHAR2(200); DESIGNATION_ALLOW VARCHAR2(200); ESC__EMP_CODE_1 char(10); ESC__EMP_CODE_2 char(10); begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE IS NULL AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE is null AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER is null AND SITE_CODE =as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER = as_item_ser AND SITE_CODE is null AND DEPT_CODE is null AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); exception when no_data_found then begin SELECT FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO FEEDBACK__EMP_CODE,FDBK__EMP_CODE_1,FDBK__EMP_CODE_2,GRADE_ALLOW,DESIGNATION_ALLOW,ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER is null AND SITE_CODE is null AND DEPT_CODE =as_dept_code AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return FEEDBACK__EMP_CODE ||'@'||trim(FDBK__EMP_CODE_1) ||'@'|| trim(FDBK__EMP_CODE_2) ||'@'||GRADE_ALLOW||'@'||DESIGNATION_ALLOW||'@'||trim(ESC__EMP_CODE_1) ||'@'||trim(ESC__EMP_CODE_2); end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GST_RATE_AMT (as_trancode in taxtran.tran_code%type,as_tranid in taxtran.tran_id%type, al_lineno number, as_type in char, as_rateoramt in char) return number is lc_rateoramt number(16,2) := 0; ls_lineno char(3); -- as_type : G (sgst), H (cgst), I (igst) and J (cess) -- as_rateoramt : R or A begin begin -- get IGST rate select lpad(trim(to_char(al_lineno)),3, ' ') into ls_lineno from dual; exception when others then ls_lineno := ' '; end; if as_rateoramt = 'T' then begin -- taxable amount select taxable_amt into lc_rateoramt from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type in ('G','H','I') and tm.EFFECT = '+' and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tt.line_no = ls_lineno and taxable_amt <> 0 and rownum = 1; exception when others then lc_rateoramt := 0; end; else if as_rateoramt = 'R' then begin -- rate select sum(tax_perc) into lc_rateoramt from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type = as_type and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tt.line_no = ls_lineno; exception when others then lc_rateoramt := 0; end; else begin -- rate select sum(tax_amt) into lc_rateoramt from taxtran tt, tax tm --select sum(tax_amt__tcurr) into lc_rateoramt from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.EFFECT = '+' and tm.tax_type = as_type and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tt.line_no = ls_lineno; exception when others then lc_rateoramt := 0; end; end if; end if; return lc_rateoramt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KEY_PLIST_FR_TO ON PRICELIST (EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRJ_CUST ON PRJCUSTOMER (CUST_CODE, PROJ_CODE, MODULE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION BI_GET_SALES_PERSON_NAME (AS_SALES_PERS IN CHAR) RETURN VARCHAR2 IS SalesPersonName varchar2(40); BEGIN select sp_name into SalesPersonName from sales_pers where TRIM(sales_pers) = TRIM(AS_SALES_PERS) ; RETURN NVL(SalesPersonName , 'NA') ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_AMD_X ON SALES_QUOT_AMD (AMD_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BATCH_TRACE_X ON BATCH_TRACE (SITE_CODE, SEQ_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TOUR_DATE_FROM_EMP_CODE ON TOUR (DATE_FROM, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVTRACE_X3 ON INVTRACE (ITEM_CODE, SITE_CODE, LOC_CODE, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_NONECO_CNT (AS_SALES_PERS in char , AS_EVENT_DATE in date, AS_MTD in varchar2) RETURN VARCHAR2 IS WEEK_DAY VARCHAR2(500); NONECO_CNT NUMBER(6); AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; BEGIN select fr_date ,to_date INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE from period where AS_EVENT_DATE BETWEEN fr_date and to_date; select CASE to_number(to_char(to_date(AS_EVENT_DATE,'DD/MM/YYYY'),'W')) WHEN 1 THEN to_number(to_char(to_date(AS_EVENT_DATE,'DD/MM/YYYY'),'W')) || 'st ' || (select initcap(to_char(AS_EVENT_DATE, 'DAY')) from dual) WHEN 2 THEN to_number(to_char(to_date(AS_EVENT_DATE,'DD/MM/YYYY'),'W')) || 'nd ' || (select initcap(to_char(AS_EVENT_DATE, 'DAY')) from dual) WHEN 3 THEN to_number(to_char(to_date(AS_EVENT_DATE,'DD/MM/YYYY'),'W')) || 'rd ' || (select initcap(to_char(AS_EVENT_DATE, 'DAY')) from dual) ELSE to_number(to_char(to_date(AS_EVENT_DATE,'DD/MM/YYYY'),'W')) || 'th ' || (select initcap(to_char(AS_EVENT_DATE, 'DAY')) from dual) END into WEEK_DAY from dual; select COUNT(DISTINCT(SCE.SC_CODE)) into NONECO_CNT from STRG_CUST_EXCEPTION SCE left outer join strg_series SS on SCE.SC_CODE = SS.SC_CODE left outer join sprs_route SR on SR.ROUTE_ID = SS.ROUTE_ID and ss.sales_pers = SR.SPRS_CODE where SS.sales_pers = AS_SALES_PERS and sr.plan_days like ( '%' || trim(WEEK_DAY) || '%' ) and SS.STATUS = 'Y' and SR.STATUS = 'Y' AND SCE.EXCEP_FLAG = 1 AND SCE.PRC_DATE = AS_EVENT_DATE; RETURN NVL(NONECO_CNT,0); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPUR_REQ_AVGCON (as_itemcode in char) return number is lc_average1 workorder_issdet.quantity%type; lc_average2 consume_iss_det.quantity%type; average number(14,3); begin SELECT nvl(avg(workorder_issdet.quantity),0) into lc_average1 FROM workorder_issdet, workorder_iss WHERE ( workorder_iss.tran_id = workorder_issdet.tran_id ) and ( ( workorder_iss.conf_date >= sysdate - 90 ) AND ( workorder_iss.conf_date <= sysdate ) AND ( workorder_iss.tran_type = 'I' ) AND ( workorder_issdet.item_code = as_itemcode ) ) ; SELECT nvl(avg(consume_iss_det.quantity),0) into lc_average2 FROM consume_iss, consume_iss_det WHERE ( consume_iss.cons_issue = consume_iss_det.cons_issue ) and ( ( consume_iss.conf_date >= sysdate - 90 ) AND ( consume_iss.conf_date <= sysdate ) AND ( consume_iss.tran_code = as_itemcode ) ) ; average:=(lc_average1+lc_average2)/2; return (average); end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE SUNDRYMASTER AS OBJECT ( Sundry_Code VARCHAR2(10), Sundry_Name VARCHAR2(80), City VARCHAR2(40), division varchar2(40), state VARCHAR2(40) ) -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISC_PAYMENT_CHK BEFORE INSERT OR UPDATE OF confirmed ON misc_payment referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; lc_adjamt number(17,3) := 0; ll_mismatchcount number(6) := 0; ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_acctcount from misc_paydet where tran_id = :new.tran_id; exception when others then ll_acctcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'M-PAY' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin lc_hdramt := :new.net_amt; exception when others then lc_hdramt := 0; end; if (lc_hdramt <> 0 or ll_acctcount <> 0) and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_acctcount) || '] rows in detail or header amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'M-PAY' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; ll_mismatchcount := 0; for cur_paydet in ( select LINE_NO, TRAN_SER, VOUCH_NO,PAY_AMT from misc_paydet where TRAN_ID = :new.tran_id ) loop begin lc_adjamt := 0; begin select adj_amt into lc_adjamt from misc_payables where TRAN_SER = cur_paydet.TRAN_SER and REF_NO = cur_paydet.VOUCH_NO; exception when others then lc_adjamt := 0; end; if lc_adjamt = 0 or abs(lc_adjamt) < abs(cur_paydet.PAY_AMT) then ll_mismatchcount := ll_mismatchcount + 1; ls_msg := ls_msg || 'Line # [' || to_char(cur_paydet.line_no) || '] pay amount [' || to_char(cur_paydet.PAY_AMT) ||'] payables adj amount [' || to_char(lc_adjamt) || '] ' ; end if; end; end loop; if ll_mismatchcount > 0 then raise_application_error( -20601, 'Some payables are not adjusted as per payment detail, '|| ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_APRV_SUPPLIER (as_suppcode in char, as_itemcode in char) return number as ll_retval number(1); ls_apprsupp char(1); ll_count number(3) := 0; BEGIN ll_retval := 1; begin select case when APPR_SUPP is null then 'N' else APPR_SUPP end into ls_apprsupp from item where item_code = as_itemcode; exception when others then ls_apprsupp := 'N'; end; if ls_apprsupp = 'Y' then begin SELECT count(1) into ll_count from itemmnfr where item_code = as_itemcode AND SUPP_CODE__MNFR = as_suppcode AND STATUS = 'A' ; exception when others then ll_count := 0; end; if ll_count = 0 then ll_retval := 0; end if; end if; RETURN ll_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WORDER_FDBK (as_tran_id in char,as_sitecode in char,as_work_cntr in char,as_mccode in char) return varchar2 is val number := 0; ls_retval number := 0; begin if as_tran_id is null then select count(1) into val from workorder_feedback where site_code=as_sitecode and work_ctr=as_work_cntr and mc_code=as_mccode and confirmed='N'; if val=1 then ls_retval:= 1; else ls_retval:= 0; end if; return ls_retval; else return ls_retval; end if ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CUST_BANK_X2 ON CUSTOMER_BANK (CUST_CODE, BANK_CODE__BEN) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TBL_SPACE_X ON TBL_SPACE (TABLE_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_UNIT_DECIMAL_CHECKING (as_uom in char) return number is li_data number; ll_desc_opt integer; begin select nvl(dec_opt,0) into ll_desc_opt from uom where unit = as_uom; if ll_desc_opt <> 0 then li_data := 1; else li_data := 0; end if; return li_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PRIMARY_SALES_QTY (ls_site_code in char, ls_prd_code in char,ls_item_code in char, ls_item_ser in char,ls_cust_code in char) return number is lc_net_sales_qty number(14,3); begin select nvl(sales_qty,0) - nvl(return_qty,0) + nvl(repl_qty,0) net_sales_qty into lc_net_sales_qty from sm_sales_cust where site_code = ls_site_code and prd_code = ls_prd_code and item_code = ls_item_code and item_ser = ls_item_ser and cust_code = ls_cust_code ; return(lc_net_sales_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LOAN_PROJECTED_INT (AS_BALANCE_AMT number,AS_LOAN_NO char,AS_PERIOD char,AS_FR_DATE date,AS_TO_DATE date) return number is a_bal_amt loan_int_reg.amount%type := AS_BALANCE_AMT; a_int_amt loan_int_reg.int_amount%type; a_tot_int loan_int_reg.int_amount%type := 0; a_days number(2) := 0; cursor c1 is select nvl(a.amount,0) princ_dedn,b.loan_interest,to_char(a.tran_date,'dd') tran_day from loan_reg a,loan_reco b where b.reco_no = a.tran_no and a.loan_no = AS_LOAN_NO and a.tran_date between AS_FR_DATE AND AS_TO_DATE and a.tran_type in ('R') and nvl(a.amount,0) <> 0 and to_char(a.tran_date,'MON-YYYY') = AS_PERIOD order by a.tran_date; begin for i in c1 loop a_days := i.tran_day - a_days; a_int_amt := ((a_bal_amt * i.loan_interest/100)/365)*a_days; a_bal_amt := a_bal_amt - i.princ_dedn; a_tot_int := a_tot_int + a_int_amt; end loop; a_tot_int := round(a_tot_int,2); return a_tot_int; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDISPARM_VALUE (as_varname disparm.var_name%type, as_prdcode disparm.prd_code%type) return char is as_value disparm.var_value%type; begin select var_value into as_value from disparm where var_name = as_varname and prd_code = as_prdcode; return as_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SITE_PF ( as_site_code varchar2) return varchar2 is ls_sitecode varchar2(10); begin if length(ltrim(rtrim(as_site_code))) <=5 then ls_sitecode := substr(as_site_code,1,5); else ls_sitecode := '99999'; end if; RETURN LS_SITECODE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORK_ENHANCE_WORD_TYPE ON WORKORDER_ENHANC (WORK_ORDER, ENHANC_TYPE, OPERATION, OPERATION_LEVEL, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SO_TAX (IN_TAX_CLASS IN CHAR, IN_TAX_CHAP IN CHAR, IN_TAX_ENV IN CHAR) return number as PVAL number(1); CLASS_CNT NUMBER; CHAP_CNT NUMBER; ENC_CNT NUMBER; BEGIN SELECT COUNT(*) INTO CLASS_CNT FROM TAXCLASS WHERE TAX_CLASS=IN_TAX_CLASS; SELECT COUNT(*) INTO CHAP_CNT FROM TAXCHAP WHERE TAX_CHAP=IN_TAX_CHAP; SELECT COUNT(*) INTO ENC_CNT FROM TAXENV WHERE TAX_ENV=IN_TAX_ENV; IF CLASS_CNT > 0 THEN IF CHAP_CNT > 0 THEN IF ENC_CNT > 0 THEN PVAL := 1; ELSE PVAL := 0; END IF; ELSE PVAL := 0; END IF; ELSE PVAL := 0; END IF; RETURN PVAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISC_VOUCHER_CHK BEFORE INSERT OR UPDATE OF confirmed ON misc_voucher referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_advamt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_acctcount from misc_vouchacct where tran_id = :new.tran_id; exception when others then ll_acctcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'M-VOUC' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select net_amt, adv_amt into lc_hdramt, lc_advamt from misc_voucher --where tran_id = :new.tran_id; lc_hdramt := :old.net_amt ; lc_advamt := :old.adv_amt ; exception when others then lc_hdramt := 0; lc_advamt := 0; end; if (lc_hdramt <> 0 or ll_acctcount <> 0) and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_acctcount) || '] rows in detail or cheque amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'M-VOUC' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if (lc_hdramt <> 0 or lc_advamt <> 0) and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ASSET_SHIFT_X ON ASSET_SHIFT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_ADJ_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from adj_issrcp where tran_id=as_tran_id and ref_ser='ADJISS'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE STRGUNEMPANELLED AS FUNCTION getStrgUnEmpanelled (empCode in char) RETURN strgCodeMasterMasterTABLE PIPELINED; END STRGUNEMPANELLED; CREATE OR REPLACE PACKAGE BODY STRGUNEMPANELLED AS FUNCTION getStrgUnEmpanelled (empCode in char) RETURN strgCodeMasterMasterTABLE PIPELINED IS ls_cnt number(35); ls_parm_value varchar2(30); BEGIN for x in(SELECT SC.SC_CODE AS strg_code, UPPER(SC.FIRST_NAME)||' '||UPPER(SC.MIDDLE_NAME)||' '||UPPER(SC.LAST_NAME) AS STRG_NAME, SC.CUST_TYPE AS STRG_TYPE, CAST(SC.ADDRESS_AS AS NVARCHAR2(75)) AS ADDRESS_AS, SC.SEX AS GENDER, SC.ADDR1, SC.ADDR2, SC.ADDR3, SC.EMAIL_ADDR, SC.MOBILE_NO, TO_CHAR('') AS SPL_CODE, TO_CHAR('') AS SPECIALITY_DESCR, SC.CLASS_CODE AS STRG_CLASS_CODE, (SELECT SCC.CLASS_CODE_DESCR FROM STRG_CUST_CLASS SCC WHERE SCC.CUST_TYPE=SC.CUST_TYPE AND SCC.CLASS_CODE=SC.CLASS_CODE) AS CLASS_CODE_DESCR, TRIM(SR.LOCALITY_CODE) AS LOCALITY_CODE, (CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END ) AS LOCALITY_DESCR, FN_GET_PRICELIST(empCode,SC.SC_CODE) AS PRICE_LIST, '' AS TOTAL_CGST, '' AS TOTAL_SGST, ST.DESCR AS STRG_STATE, SC.GST_NO AS STRG_GST_NO, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM, TO_CHAR('') AS TAGGED_LOCATION, TO_CHAR ('') AS GEOPOS_ADDRESS, GET_ALLWD_DELAY_PRD(empCode) AS ALLWD_DELAY_PRD, TO_CHAR('') VARIANCE_DISTANCE, (SELECT SUBCLASS_DESCR AS SUBCLASS_DESCR FROM STRG_CUST_SUBCLASS WHERE CLASS_CODE = SC.CLASS_CODE AND CUST_TYPE = SC.CUST_TYPE AND SUBCLASS_CODE = SC.SUBCLASS_CODE) AS SUBCLASS_DESCR, SC.PROMOTER_NAME AS PROMOTER_NAME, SC.MAN_POWER AS MAN_POWER, SC.GST_NO AS GST_NO, SC.SUBCLASS_CODE AS SUBCLASS_CODE, SC.PIN AS PIN, SCT.SH_DESCR AS SH_DESCR, TRIM(SR.ROUTE_ID) AS ROUTE_ID, (case when SCT.SURVEY_TEMPL is null then GET_SFAPARM_DATA('CHC_SURVEY',(empCode)) else SCT.SURVEY_TEMPL END) AS SURVEY_TEMPL, SC.NO_VISIT AS NO_VISIT, TO_CHAR('') AS LAST_MEET_SUMM, TO_DATE('') AS LAST_MEET_DATE, SC.REG_NO AS REG_NO, TO_CHAR('') AS NON_ECO_DET, '' AS PRICE_LIST__DISC, '' AS GST_CODE, '' as PRICE_LIST__PAYDIS FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE WHERE TRIM(SC.LOCALITY_CODE)=TRIM(SR.LOCALITY_CODE) AND sr.sprs_code IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SC.STATUS='U' ORDER BY STRG_NAME) LOOP PIPE ROW (strgCodeMaster(x.strg_code,x.STRG_NAME,x.STRG_TYPE,x.ADDRESS_AS,x.GENDER,x.ADDR1,x.ADDR2,x.ADDR3,x.EMAIL_ADDR,x.MOBILE_NO ,x.SPL_CODE,x.SPECIALITY_DESCR,x.STRG_CLASS_CODE,x.CLASS_CODE_DESCR,x.LOCALITY_CODE,x.LOCALITY_DESCR,x.PRICE_LIST,x.TOTAL_CGST ,x.TOTAL_SGST,x.STRG_STATE,x.STRG_GST_NO,x.VISITED_WITH_TEAM,x.TAGGED_LOCATION,x.GEOPOS_ADDRESS,x.ALLWD_DELAY_PRD,x.VARIANCE_DISTANCE ,x.SUBCLASS_DESCR,x.PROMOTER_NAME,x.MAN_POWER,x.GST_NO,x.SUBCLASS_CODE,x.PIN,x.SH_DESCR,x.ROUTE_ID,x.SURVEY_TEMPL,x.NO_VISIT ,x.LAST_MEET_SUMM,x.LAST_MEET_DATE,x.REG_NO,x.NON_ECO_DET,x.PRICE_LIST__DISC,x.GST_CODE,x.PRICE_LIST__PAYDIS)); END LOOP; RETURN; END; END STRGUNEMPANELLED; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX IBCA_PAY_CTRL_X ON IBCA_PAY_CTRL (FIN_ENTITY__FROM, FIN_ENTITY__TO, SITE_CODE__FROM, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRV_DISTANCE_X ON TRV_DISTANCE (STAN_CODE__FROM, STAN_CODE__TO, EFF_FROM, TRV_MODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUSTOMER_TCSPERC (AS_CUST_CODE__BIL CHAR,AS_CUST_CODE CHAR,AS_TAX_DATE DATE, AS_DESP_DATE DATE,AS_TRAN_DATE DATE, AS_TRAN_TYPE CHAR) RETURN NUMBER IS LS_RETURN NUMBER (14,3) := 0; V_PAN_NO CUSTOMER.PAN_NO%TYPE; V_TAX_CLASS CUSTOMER.TAX_CLASS%TYPE; V_TAX_DATE DATE; V_CUST_CODE CHAR(10); LS_COUNT NUMBER(10); ls_var_value DISPARM.VAR_VALUE%TYPE; BEGIN ---Check if tran type is Full return type. If match with disparm value then TCS value will be returned select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = 'SRET_FULL_TRANTYPE'; SELECT (CASE WHEN trim(AS_TRAN_TYPE) IN (SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value))) THEN 1 ELSE 0 END) INTO LS_COUNT FROM DUAL; IF LS_COUNT =0 and AS_TRAN_TYPE is not null THEN LS_RETURN :=0 ; RETURN LS_RETURN; ELSE --If cust code bill is null the cust_cod will be set IF AS_CUST_CODE__BIL IS NOT NULL THEN V_CUST_CODE := AS_CUST_CODE__BIL; ELSE V_CUST_CODE := AS_CUST_CODE; END IF; --If method is called on despatch then desp date will be not null and date will be set as desp date --If method is called on other than despatch transaction then tax date will be set if tax date is also null then tran date will be set IF AS_DESP_DATE IS NOT NULL THEN V_TAX_DATE := AS_DESP_DATE; ELSIF AS_TAX_DATE IS NOT NULL THEN V_TAX_DATE := AS_TAX_DATE; ELSE V_TAX_DATE := AS_TRAN_DATE; END IF; -- Return the Pan no and tax class from customer master SELECT NVL(PAN_NO,'PANNOTAVBL'), NVL(TAX_CLASS,'BLANK') INTO V_PAN_NO, V_TAX_CLASS FROM CUSTOMER WHERE CUST_CODE = V_CUST_CODE; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE BETWEEN TO_DATE('01-SEP-2020','DD-MON-YYYY') AND TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 1 ; END IF; IF V_PAN_NO <> 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE BETWEEN TO_DATE('01-SEP-2020','DD-MON-YYYY') AND TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 0.075 ; END IF; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE > TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 1 ; END IF; IF V_PAN_NO <> 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE > TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 0.1 ; END IF; IF V_TAX_CLASS <> 'TCGST' THEN LS_RETURN := 0 ; END IF; END IF; RETURN LS_RETURN; EXCEPTION WHEN OTHERS THEN LS_RETURN := 0 ; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_BANK_X ON EMPLOYEE_BANK (EMP_CODE, BANK_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_VERSION_ID return char is ls_retval varchar2(120); begin select version_id into ls_retval from version where trunc(sysdate) between eff_from and valid_upto; return ls_retval ; exception when too_many_rows then return ' ' ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_REL_NAME (as_emp char , as_reltype char) return char is ls_relname char(30) ; begin begin ls_relname := null; SELECT member_name into ls_relname FROM empfamily WHERE emp_code = as_emp and TRIM(relation) = as_reltype ; EXCEPTION WHEN NO_DATA_FOUND THEN ls_relname := null ; END ; return ls_relname; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_2 (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char) return number is mrate number(14,3); ls_type char(1); begin begin select list_type into ls_type from pricelist where price_list = as_price_list and rownum = 1; exception when others then ls_type := 'L'; end; if ls_type = 'L' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif ls_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CONTACT_INFO (p_sorg_code IN VARCHAR2) RETURN VARCHAR2 AS v_result VARCHAR2(1000); BEGIN select 'No of communication in last 90 days: ' || count(1) INTO v_result from contact_comm cc ,strg_customer sc where cc.comm_date <= trunc(sysdate) and cc.comm_date >= trunc(sysdate)-90 AND CC.STRG_CODE = SC.SC_CODE and sc.sorg_code = p_sorg_code; RETURN v_result; END DDF_GET_CONTACT_INFO; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_SERIES_SAL_PER ON STRG_SERIES (SALES_PERS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE STRGCODERETAILPOPHELP AS FUNCTION getstrgCodeRetailPophelpData (empCode in char) RETURN strgCodeRetailMasterTABLE PIPELINED; END strgCodeRetailPophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WORKORDER_FEEDBKH_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON WORKORDER_FEEDBACK referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); tablepost varchar2(10); lc_exit boolean:= false; BEGIN if :new.confirmed = 'Y' then begin --workorder feedback begin select var_value into varvalue from finparm where prd_code = '999999' and var_name = 'INV_ACCT_PRODFDBK'; exception when others then varvalue:= 'N'; end; if varvalue = 'Y' then if (:new.ohd_table__post is not null and length(trim(:new.ohd_table__post)) > 0 ) then begin -- 1. check count and gltrace count begin select count(*) into ll_count from gltrace where ref_ser = 'W-FBK' and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if(ll_count = 0) then raise_application_error( -20601, 'OverHeads not posted in gltrace' ); end if; if(ll_count > 0)then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'W-FBK' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if;--end count end; end if ;-- end of tablepost if end if;--end varvalue end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOTSL (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, as_lot_sl in char, lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.lot_sl = as_lot_sl and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and a.lot_sl = as_lot_sl and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.tran_date > ad_from_date and a.lot_no = llot_no and a.lot_sl = as_lot_sl and instr(lavailable,c.available) > 0); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MR_ACTIVITY (as_sales_pers char, as_mth varchar2, as_year varchar2, as_option varchar2) return number is HolTblNo char(5); CntDay Number(9); begin if(as_option='FW') then select count(distinct event_date) into CntDay from strg_meet where trim(sales_pers)=trim(as_sales_pers) and to_char(event_date,'MM')= as_mth and to_char(event_date,'yyyy')= as_year and event_type in ('53','FW','HM','HS'); elsif(as_option='LV') then select count(distinct event_date) into CntDay from strg_meet where trim(sales_pers)=trim(as_sales_pers) and to_char(event_date,'MM')= as_mth and to_char(event_date,'yyyy')= as_year and event_type IN ('SL','CL','TL','PL'); elsif(as_option='MEET') then select count(distinct event_date) into CntDay from strg_meet where trim(sales_pers)=trim(as_sales_pers) and to_char(event_date,'MM')= as_mth and to_char(event_date,'yyyy')= as_year and event_type in('HM','CM','R'); elsif(as_option='TRANSIT') then select count(distinct event_date) into CntDay from strg_meet where trim(sales_pers)=trim(as_sales_pers) and to_char(event_date,'MM') = as_mth and to_char(event_date,'yyyy')= as_year and event_type IN ('TR','TH'); elsif(as_option='CME') then select count(distinct event_date) into CntDay from strg_meet where trim(sales_pers)=trim(as_sales_pers) and to_char(event_date,'MM') = as_mth and to_char(event_date,'yyyy')= as_year and event_type='C'; elsif(as_option='AD') then select (fn_rget_holiday_c(as_sales_pers,as_mth,as_year,'M') -fn_rget_holiday_c(as_sales_pers,as_mth,as_year,'W') -fn_rget_holiday_c(as_sales_pers,as_mth,as_year,'H')) into CntDay from dual; end if; return nvl(CntDay,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LICENCE_NO (LS_SITE_CODE VARCHAR2,LS_FIN_ENTITY VARCHAR2,LS_VAR_NAME VARCHAR2) RETURN VARCHAR IS LS_VAR_VALUE VARCHAR2(50); LS_REG_NO VARCHAR2(50); BEGIN SELECT VAR_VALUE INTO LS_VAR_VALUE FROM DISPARM WHERE RTRIM(VAR_NAME) = RTRIM(LS_VAR_NAME); SELECT REG_NO INTO LS_REG_NO FROM SITEREGNO WHERE RTRIM(SITE_CODE) = RTRIM(LS_SITE_CODE) AND RTRIM(FIN_ENTITY) = RTRIM(LS_FIN_ENTITY) AND RTRIM(REF_CODE) = RTRIM(LS_VAR_VALUE); RETURN LS_REG_NO; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_GET_PACK_CODE ( as_item_code char, as_unit char, as_lot_no char,as_quantity number) return number is as_pack_qty number(14,3); ls_unit_pack char(5); mround char(10); newqty number(14,3); mconv number(14,3); mrndto number(14,3); mcnt number(14,3); begin select unit__pack into ls_unit_pack from item_lot_packsize where item_code = as_item_code and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no ; if ls_unit_pack = as_unit then as_pack_qty := as_quantity ; end if; Select Count(*) into mcnt from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = as_item_code; if mcnt = 0 then Select Count(*) into mcnt from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = 'X'; if mcnt > 0 then Select Fact, Round, round_to into mconv,mround,mrndto from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = 'X'; end if; else Select Fact, Round, round_to into mconv,mround,mrndto from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = as_item_code; end if; newqty := as_quantity / mconv ; if Upper(mround) = 'X' then newqty := newqty - mod(newqty, mrndto) + mrndto; elsif Upper(mround) = 'P' then newqty := newqty - mod(newqty, mrndto); elsif Upper(mround) = 'R' then if mod(newqty, mrndto) < mrndto/2 then newqty := newqty - mod(newqty, mrndto); else newqty := newqty - mod(newqty, mrndto) + mrndto; end if ; end if; if newqty is null or newqty <= 0 then newqty := 0 ; end if; as_pack_qty := newqty ; return as_pack_qty ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_NAME_LENGTH ( as_name in varchar2) return number is ls_cnt number(14); begin if length(as_name) > 25 then ls_cnt := 1; else ls_cnt := 0; end if; return ls_cnt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MIN_TO_DEC_HRS (A_MIN NUMBER) RETURN NUMBER IS R_HRS NUMBER(12,2); I_MIN NUMBER(10); N_SIGN NUMBER(1); I_PART1 NUMBER(10); I_PART2 NUMBER(10); BEGIN I_MIN := A_MIN; R_HRS := 0; IF I_MIN <> 0 THEN IF I_MIN < 0 THEN N_SIGN := -1; I_MIN := ABS(I_MIN); END IF; END IF; I_PART1 := FLOOR(I_MIN / 60); I_PART2 := I_MIN - (I_PART1 * 60); R_HRS := I_PART1 + (I_PART2 / 100); RETURN R_HRS; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SL_TRANS_DEBIT (ldate_fr in date,ldate_to in date,lsundry_code in char,lsundry_type in char, lsite_code in char,lacct_code in char) return number is lc_dr_sum number(14,3); begin Select nvl(Sum(dr_amt * exch_rate),0) into lc_dr_sum from gltrace where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE GET_ASSET_ATTRIBUTES ( p_asset_code IN VARCHAR2, p_cursor OUT SYS_REFCURSOR ) AS v_sql CLOB; v_cols CLOB; BEGIN SELECT LISTAGG( 'MAX(CASE WHEN TIA.ATTRIB_HEADING = ''' || ATTRIB_HEADING || ''' THEN TIA.ATTRIB_VALUE END) AS ' || ATTRIB_HEADING || '', ', ' ) INTO v_cols FROM ( SELECT DISTINCT ATTRIB_HEADING FROM TRANS_ITEM_ATTRIBUTES WHERE TRIM(REF_ID) = p_asset_code || ':' ); v_sql := ' SELECT E.EMP_FNAME || '' '' || E.EMP_LNAME AS ASSIGNED_TO, AA.EFFECTIVE_FROM AS FROM_DATE, AA.VALID_UPTO AS TO_DATE, AR.DESCR AS DESCRIPTION, ' || v_cols || ' FROM ASSET_REGISTER AR LEFT JOIN TRANS_ITEM_ATTRIBUTES TIA ON TRIM(TIA.REF_ID) = TRIM(AR.ASSET_CODE) || '':'' JOIN ASSET_ASSIGN AA ON AR.ASSET_CODE = AA.ASSET_CODE JOIN ITEM IT ON AR.ITEM_CODE = IT.ITEM_CODE JOIN EMPLOYEE E ON AA.EMP_CODE__ASSIGN = E.EMP_CODE WHERE AR.ASSET_CODE = ''' || p_asset_code || ''' GROUP BY E.EMP_FNAME, E.EMP_LNAME, AA.EFFECTIVE_FROM, AA.VALID_UPTO, AR.DESCR'; OPEN p_cursor FOR v_sql; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPFAMILY_IDX ON EMPFAMILY (EMP_CODE, DEPENDENT_MEMBER_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALID_REPL (as_replorder in char) return varchar2 is ls_validrepl varchar2(1) := 'Y'; ls_waveid wave_task.wave_id%type ; ls_ptcn wave_task_det.ptcn%type ; ls_cancel char(1) := 'N'; ll_count number(3) := 0; begin begin select h.wave_id,d.ptcn,case when h.cancel is null then 'N' else h.cancel end into ls_waveid, ls_ptcn, ls_cancel from wave_task_det d, wave_task h where h.wave_id = d.wave_id and d.ref_id = as_replorder and rownum = 1; exception when others then ls_waveid := ' '; ls_ptcn := ' '; ls_cancel := ' '; end; if ls_cancel = 'Y' then begin select count(1) into ll_count from pick_ord_det p,wave_task_det w, wave_task wh where w.wave_id = wh.wave_id and w.ref_id = p.pick_order and wh.wave_id <> ls_waveid and case when wh.cancel is null then 'N' else wh.cancel end = 'N' and (p.repl_order, p.line_no__repl) in (select repl_order,line_no from repl_ord_det where repl_order = as_replorder); end; --else end if; return ls_validrepl ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DRCR_RDET_X ON DRCR_RDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRI_KEY ON WOI_LOTCHANGE_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_BANK_RECO_STMT ( ad_ason in date, as_sundrycode in char, as_sundrytype in char, as_sitecode in char ) return number is lc_day_op_bal number(14,3) ; lc_prd_op_bal number(14,3); lc_dr_amt number(14,3); lc_cr_amt number(14,3); ls_prd char(6); ls_acct_prd char(6); ld_fr_date date; begin select code, acct_prd ,fr_date into ls_prd, ls_acct_prd, ld_fr_date from period where ad_ason between fr_date and to_date ; select nvl(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and sundry_type = as_sundrytype and sundry_code = as_sundrycode and site_code = as_sitecode; select nvl(sum(amount),0) into lc_cr_amt from banktran_log where tran_type = 'P' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode ; select nvl(sum(amount),0) into lc_dr_amt from banktran_log where tran_type = 'R' and tran_date >= ld_fr_date and tran_date <= ad_ason and bank_code = as_sundrycode; lc_day_op_bal := lc_dr_amt - lc_cr_amt ; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal ; return lc_day_op_bal ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TRANS_APPL_FOR_SITE (as_trancode in TRANSPORTER.TRAN_CODE%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_TRANS'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from SITE_TRANSPORTER where site_code = as_sitecode and TRAN_CODE = as_trancode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WIP_SCANNING_HDR_X ON WIP_SCANNING_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_RECV_TRACE is ll_count number(10) := 0; ll_updatecount number := 0; lc_adjamt number := 0; lc_totamt number := 0; ldt_statdate date; ls_amtafter number := 0; my_code NUMBER; my_errm VARCHAR2(32000); begin begin /* for cur_custcode in ( select sundry_code,sum(sundrybal) sundrybal, sum(receiv) receiv, sum(sundrybal) - sum(receiv) diff_amt from ( select sundry_code,sum(dr_amt__base - cr_amt__base) sundrybal,sum(0) receiv from sundrybal where sundry_type = 'C' and acct_prd = '21-22' and prd_code <= '202108' group by sundry_code union all select cust_code,sum(0), sum(tot_amt - adj_amt) from receivables where tot_amt - adj_amt <> 0 group by cust_code ) group by sundry_code -- having (sum(sundrybal) <> 0 or sum(receiv) <> 0) and abs(sum(sundrybal) - sum(receiv)) > 1 ) loop */ for cur_recv in ( select tran_ser,ref_no,tran_id,tot_amt, adj_amt, ref_date,due_date,Cr_term,cust_code, site_code,exch_rate,bank_code,curr_code from receivables order by ref_date --where cust_code = cur_custcode.sundry_code order by tran_date ) loop lc_totamt := cur_recv.tot_amt; insert into receivables_trace ( tran_id, tran_id__rcv, ref_ser, ref_no, ref_ser__adj, ref_no__adj, adj_amt, amt_before, amt_after, ref_date, Due_date, Cr_term, Cust_code__bill, Cust_code, Site_code, Curr_code, Exch_rate, tran_type, Remarks, Doc_ref, Doc_ref_type, Doc_ref_date, Bank_code, change_type, OS_STAT, status_date, chg_user, chg_date, eff_date ) select lpad(recvtc_seq.nextval,12,'0') tran_id, cur_recv.tran_id tran_id__rcv, cur_recv.tran_ser ref_ser, cur_recv.ref_no ref_no, null ref_ser__adj, null ref_no__adj, 0 adj_amt, 0 amt_before, cur_recv.tot_amt amt_after, cur_recv.ref_date ref_date, cur_recv.due_date Due_date, cur_recv.cr_term Cr_term, cur_recv.cust_code Cust_code__bill, cur_recv.cust_code Cust_code, cur_recv.site_code Site_code, cur_recv.curr_code Curr_code, cur_recv.exch_rate Exch_rate, 'I' tran_type, 'Insert by Proteus' Remarks, to_char(cur_recv.adj_amt) Doc_ref, 'O' Doc_ref_type, sysdate Doc_ref_date, cur_recv.bank_code Bank_code, 'I' change_type, 'U' status, cur_recv.ref_date status_date, 'Proteus' chg_user, sysdate chg_date, eff_date from receivables where tran_ser = cur_recv.tran_ser and ref_no = cur_recv.ref_no; for cur_tran in ( select ref_ser_adj,tran_id,conf_date,eff_date,adj_amt from ( select 'RCP' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'RCP' and i.ref_id = h.tran_id and rownum = 1) conf_date, h.tran_date eff_date,d.rcp_amt adj_amt from receipt h, rcpdet d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'RCP' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'RCP' and i.ref_id = h.tran_id and rownum = 1) conf_date, h.tran_date eff_date,d.ADJ_AMT adj_amt from receipt h, rcpadv d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'R-IBCA' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-IBCA' and i.ref_id = h.tran_id and rownum = 1) conf_date, h.tran_date eff_date,d.TOT_AMT adj_amt from rcp_ibca h, rcp_ibca_det d where d.tran_id = h.tran_id and h.confirmed = 'Y' and trim(h.tran_ser) = 'I' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'R-DIS' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-DIS' and i.ref_id = h.tran_id and rownum = 1) conf_date, h.tran_date eff_date,-1 * d.rcp_amt adj_amt from rcpdishnr h, rcpdishnr_det d where d.tran_id = h.tran_id and h.confirmed = 'Y' and h.tran_ser = 'R' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'R-DIS' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-DIS' and i.ref_id = h.tran_id and rownum = 1) conf_date, h.tran_date eff_date, -1 * (select adv_amt from receipt where tran_id = cur_recv.ref_no) adj_amt from rcpdishnr h where h.confirmed = 'Y' and h.tran_ser = 'R' and h.receipt_no = cur_recv.ref_no union all select 'R-ADJ' ref_ser_adj, case when trim(cur_recv.tran_ser) = 'S-INV' then d.ref_no else d.ref_no_adj end tran_id,(select i.post_date from gltrace i where (( i.ref_ser = 'S-INV' and i.ref_id = h.invoice_id)) and rownum = 1) conf_date,h.tran_date eff_date, d.adj_amt from invoice h, receivables_adj d where h.confirmed = 'Y' and (d.ref_no = h.invoice_id or d.ref_no_adj = h.invoice_id) and (select count(1) from misc_drcr_rcp m where m.tran_id = d.ref_no_adj and trim(m.tran_type) = 'BW' ) = 0 and ((d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no) or (d.ref_ser_adj = cur_recv.tran_ser and d.ref_no_adj = cur_recv.ref_no)) union all -- balance write off select 'BWOFF' ref_ser_adj, d.ref_no_adj tran_id,(select i.post_date from gltrace i where (( i.ref_ser in ('MDRCRC','MDRCRD') and i.ref_id = h.tran_id)) and rownum = 1) conf_date,h.tran_date eff_date, case when cur_recv.tot_amt < 0 and h.amount > 0 or cur_recv.tot_amt > 0 and h.amount < 0 then -1 else 1 end * h.amount from misc_drcr_rcp h, receivables_adj d where h.confirmed = 'Y' and d.ref_no_adj = h.tran_id and trim(h.tran_type) = 'BW' and ((d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no) or (d.ref_ser_adj = cur_recv.tran_ser and d.ref_no_adj = cur_recv.ref_no)) union all select case when h.DRCR_FLAG = 'D' then 'MDRCRD' else 'MDRCRC' end ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser in( 'MDRCRC','MDRCRD') and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser in( 'MDRCRC','MDRCRD') and i.ref_id = h.tran_id and rownum = 1) eff_date,d.adj_amt from misc_drcr_rcp h, MISC_DRCR_RCPINV d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select case when h.DRCR_FLAG = 'D' then 'DRNRCP' else 'CRNRCP' end ref_ser_adj, h.tran_id,(select i.post_date from gltrace i where i.ref_ser in( 'CRNRCP','DRCRCP') and i.ref_id = h.tran_id and rownum = 1) conf_date,h.tran_date eff_date,d.adj_amt from drcr_rcp h, DRCR_RCPINV d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'RCPPAY' ref_ser_adj,h.tran_id,h.tran_date conf_date,h.tran_date eff_date,d.trf_amt adj_amt from rec_pay_trf_det d ,rec_pay_trf h where h.tran_id = d.tran_id and h.trf_type = '1' and h.confirmed = 'Y' and d.tran_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no ) order by conf_date ) loop begin ldt_statdate := cur_tran.conf_date; /* begin select post_date into ldt_statdate from gltrace where ref_id = cur_tran.tran_id and rownum = 1; exception when others then ldt_statdate := cur_tran.conf_date; end; */ lc_adjamt := cur_tran.adj_amt; if trim(cur_recv.tran_ser) = 'S-INV' and trim(cur_tran.ref_ser_adj) = 'R-ADJ' then lc_adjamt := -1 * lc_adjamt ; end if; insert into receivables_trace ( tran_id, tran_id__rcv, ref_ser, ref_no, ref_ser__adj, ref_no__adj, adj_amt, amt_before, amt_after, ref_date, Due_date, Cr_term, Cust_code__bill, Cust_code, Site_code, Curr_code, Exch_rate, tran_type, Remarks, Doc_ref, Doc_ref_type, Doc_ref_date, Bank_code, change_type, OS_STAT, status_date, chg_user, chg_date, eff_date ) select lpad(recvtc_seq.nextval,12,'0') tran_id, cur_tran.tran_id tran_id__rcv, cur_recv.tran_ser ref_ser, cur_recv.ref_no ref_no, cur_tran.ref_ser_adj ref_ser__adj, cur_tran.tran_id ref_no__adj, lc_adjamt adj_amt, lc_totamt amt_before, lc_totamt - lc_adjamt amt_after, cur_recv.ref_date ref_date, cur_recv.due_date Due_date, cur_recv.cr_term Cr_term, cur_recv.cust_code Cust_code__bill, cur_recv.cust_code Cust_code, cur_recv.site_code Site_code, cur_recv.curr_code Curr_code, cur_recv.exch_rate Exch_rate, 'U' tran_type, 'Update by Proteus' Remarks, 'UPD' Doc_ref, 'O' Doc_ref_type, sysdate Doc_ref_date, cur_recv.bank_code Bank_code, 'U' change_type, case when lc_totamt - lc_adjamt = 0 then 'A' else 'P' end status, ldt_statdate status_date, 'Proteus' chg_user, sysdate chg_date, cur_tran.eff_date from receivables where tran_ser = cur_recv.tran_ser and ref_no = cur_recv.ref_no; lc_totamt := lc_totamt - lc_adjamt; exception when others then my_code := SQLCODE; my_errm := SQLERRM; dbms_output.put_line('Exception updating my_code[' || my_code ||'] my_errm [' || my_errm ||']' ); end; end loop; end loop; -- end loop; exception when others then my_code := SQLCODE; my_errm := SQLERRM; dbms_output.put_line('Exception outer my_code[' || my_code ||'] my_errm [' || my_errm ||']' ); rollback; end; commit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_EMP_APRSL_SPEC ON EMP_APRSL_SPEC (APRSL_TBLNO, SPEC_CODE, SLAB_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RCPDET_REF_SER_REF_NO ON RCPDET (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETCOLLECT_LINE before insert on STRG_MEET_COLLECT for each row declare max_line_no number(10); begin if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then begin select tran_id into :new.tran_id from strg_meet where dcr_id = :new.dcr_id and strg_code = :new.strg_code and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_collect where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_collect where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_collect where dcr_id = :new.dcr_id; :NEW.LINE_NO := NVL(MAX_LINE_NO , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETTEAM_SETPKVAL before insert on strg_meet_team for each row declare max_line_no number(10); begin if (:new.strg_code = '0000000000' ) then begin :new.tran_id := :new.dcr_id; end; else begin if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then begin select tran_id into :new.tran_id from strg_meet where dcr_id = :new.dcr_id and strg_code = :new.strg_code and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_team where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_team where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_team where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DESC_SPECS (as_itemcode in char,as_rettype in char) return varchar2 is ls_specs varchar2(200); ls_itemtype item_type.item_type%type; ls_attrib1 item_type.phy_attrib_1%type; ls_attrib2 item_type.phy_attrib_2%type; ls_attrib3 item_type.phy_attrib_3%type; ls_attrib4 item_type.phy_attrib_4%type; ls_attrib5 item_type.phy_attrib_5%type; ls_attrib6 item_type.phy_attrib_6%type; ls_attrib7 item_type.phy_attrib_7%type; ls_attrib8 item_type.phy_attrib_8%type; ls_attrib9 item_type.phy_attrib_9%type; ls_attrib10 item_type.phy_attrib_10%type; ls_attrib11 item_type.phy_attrib_11%type; ls_attrib12 item_type.phy_attrib_12%type; ls_spec1 item.phy_attrib_1%type; ls_spec2 item.phy_attrib_2%type; ls_spec3 item.phy_attrib_3%type; ls_spec4 item.phy_attrib_4%type; ls_spec5 item.phy_attrib_5%type; ls_spec6 item.phy_attrib_6%type; ls_spec7 item.phy_attrib_7%type; ls_spec8 item.phy_attrib_8%type; ls_spec9 item.phy_attrib_9%type; ls_spec10 item.phy_attrib_10%type; ls_spec11 item.phy_attrib_11%type; ls_spec12 item.phy_attrib_12%type; begin ls_specs := ' '; select a.item_type,a.phy_attrib_1,a.phy_attrib_2,a.phy_attrib_3,a.phy_attrib_4, a.phy_attrib_5,a.phy_attrib_6,a.phy_attrib_7,a.phy_attrib_8, a.phy_attrib_9,a.phy_attrib_10,a.phy_attrib_11,a.phy_attrib_12, b.phy_attrib_1,b.phy_attrib_2,b.phy_attrib_3,b.phy_attrib_4, b.phy_attrib_5,b.phy_attrib_6,b.phy_attrib_7,b.phy_attrib_8, b.phy_attrib_9,b.phy_attrib_10,b.phy_attrib_11,b.phy_attrib_12 into ls_itemtype,ls_spec1,ls_spec2,ls_spec3,ls_spec4, ls_spec5,ls_spec6,ls_spec7,ls_spec8, ls_spec9,ls_spec10,ls_spec11,ls_spec12, ls_attrib1,ls_attrib2,ls_attrib3,ls_attrib4, ls_attrib5,ls_attrib6,ls_attrib7,ls_attrib8, ls_attrib9,ls_attrib10,ls_attrib11,ls_attrib12 from item a, item_type b where a.item_type = b.item_type and a.item_code = as_itemcode ; if ls_attrib1 is not null and length(ltrim(rtrim(ls_attrib1))) > 0 and ls_spec1 is not null and length(ltrim(rtrim(ls_spec1))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib1) || ' : ' || rtrim(ls_spec1) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib2 is not null and length(ltrim(rtrim(ls_attrib2))) > 0 and ls_spec2 is not null and length(ltrim(rtrim(ls_spec2))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib2) || ' : ' || rtrim(ls_spec2) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib3 is not null and length(ltrim(rtrim(ls_attrib3))) > 0 and ls_spec3 is not null and length(ltrim(rtrim(ls_spec3))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib3) || ' : ' || rtrim(ls_spec3) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib4 is not null and length(ltrim(rtrim(ls_attrib4))) > 0 and ls_spec4 is not null and length(ltrim(rtrim(ls_spec4))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib4) || ' : ' || rtrim(ls_spec4) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib5 is not null and length(ltrim(rtrim(ls_attrib5))) > 0 and ls_spec5 is not null and length(ltrim(rtrim(ls_spec5))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib5) || ' : ' || rtrim(ls_spec5) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib6 is not null and length(ltrim(rtrim(ls_attrib6))) > 0 and ls_spec6 is not null and length(ltrim(rtrim(ls_spec6))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib6) || ' : ' || rtrim(ls_spec6) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib7 is not null and length(ltrim(rtrim(ls_attrib7))) > 0 and ls_spec7 is not null and length(ltrim(rtrim(ls_spec7))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib7) || ' : ' || rtrim(ls_spec7) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib8 is not null and length(ltrim(rtrim(ls_attrib8))) > 0 and ls_spec8 is not null and length(ltrim(rtrim(ls_spec8))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib8) || ' : ' || rtrim(ls_spec8) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib9 is not null and length(ltrim(rtrim(ls_attrib9))) > 0 and ls_spec9 is not null and length(ltrim(rtrim(ls_spec9))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib9) || ' : ' || rtrim(ls_spec9) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib10 is not null and length(ltrim(rtrim(ls_attrib10))) > 0 and ls_spec10 is not null and length(ltrim(rtrim(ls_spec10))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib10) || ' : ' || rtrim(ls_spec10) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib11 is not null and length(ltrim(rtrim(ls_attrib11))) > 0 and ls_spec11 is not null and length(ltrim(rtrim(ls_spec11))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib11) || ' : ' || rtrim(ls_spec11) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib12 is not null and length(ltrim(rtrim(ls_attrib12))) > 0 and ls_spec12 is not null and length(ltrim(rtrim(ls_spec12))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib12) || ' : ' || rtrim(ls_spec12) ; end if ; ls_specs := ltrim(rtrim(ls_specs)) ; return ls_specs; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_ITPROOF_ON_APPROV (AS_TRAN_ID CHAR) RETURN VARCHAR2 IS LS_RETURN VARCHAR2(4000); begin SELECT FN_VAL_EMP_IT_PROOF(AS_TRAN_ID, 'Y', 'CONFIRM', '') INTO LS_RETURN FROM DUAL; RETURN NVL(LS_RETURN, ''); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDER_CUST_CODE__BIL ON SORDER (CUST_CODE__BIL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082938 ON SORDITEM_SPEC (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_GET_VOUCHNO (AS_TRANID IN VARCHAR2) RETURN VARCHAR2 IS LS_TRANID VARCHAR2(100); CURSOR CUR_RCPNO IS SELECT DISTINCT VOUCHRCP.TRAN_ID FROM PORCP, VOUCHRCP WHERE PORCP.TRAN_ID = VOUCHRCP.PRCP_ID AND PORCP.TRAN_ID = AS_TRANID; BEGIN FOR I IN CUR_RCPNO LOOP LS_TRANID := LS_TRANID || ' ' || rtrim(I.TRAN_ID); END LOOP; RETURN LS_TRANID; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION NAME (lsundry_type in char,lsundry_code in char,lname in char) return char is ls_name char(60); ls_fname char(20); ls_mname char(20); ls_lname char(20); begin if lsundry_type ='O' then ls_name := ' '; elsif lsundry_type ='T' then if lname = 'C' then select chq_name into ls_name from transporter where tran_code = lsundry_code; else select tran_name into ls_name from transporter where tran_code = lsundry_code; end if; elsif lsundry_type = 'B' then select bank_name into ls_name from bank where bank_code = lsundry_code; elsif lsundry_type = 'X' then select tauth_name into ls_name from tax_authority where tauth_code = lsundry_code; elsif lsundry_type = 'E' then select nvl(trim(rtrim(emp_fname)),' ')||' '||nvl(trim(rtrim(emp_lname)),' ') ||' '||nvl(trim(rtrim(emp_mname)),' ') into ls_name from employee where emp_code = lsundry_code; elsif lsundry_type = 'P' then if lname = 'C' then select chq_name into ls_name from sales_pers where sales_pers = lsundry_code; else select sp_name into ls_name from sales_pers where sales_pers = lsundry_code; end if; elsif lsundry_type ='S' then if lname = 'C' then select chq_name into ls_name from supplier where supp_code = lsundry_code; else select supp_name into ls_name from supplier where supp_code = lsundry_code; end if; elsif lsundry_type ='C' then if lname = 'C' then select chq_name into ls_name from customer where cust_code = lsundry_code; else select cust_name into ls_name from customer where cust_code = lsundry_code; end if; elsif lsundry_type = 'L' then if lname = 'C' then select chq_name into ls_name from loanparty where party_code = lsundry_code; else select party_name into ls_name from loanparty where party_code = lsundry_code; end if; elsif trim( lsundry_type) = 'R' then select nvl(trim(first_name),' ')||' '||nvl(trim(middle_name),' ') ||' '||nvl(trim(last_name),' ') into ls_name from strg_customer where sc_code = lsundry_code; end if; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUMIT RETURN DATE IS BEGIN RETURN SYSDATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001105005 ON CRM_CONTACTS (CONTACT_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DISTORD_MRP_VALUE (as_rd_perno distord_iss.rd_permit_no%type) return number is ls_mrp number(14,3); begin select SUM(((nvl(distord_issdet.quantity,0.00)*nvl(distord_issdet.rate__clg,0.00)) +(nvl(distord_issdet.tax_amt,0.00)))) into ls_mrp from distord_iss,distord_issdet where distord_iss.tran_id=distord_issdet.tran_id and distord_iss.rd_permit_no = as_rd_perno ; return ls_mrp; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_QV_ITEM_GRADE (as_sitecode in char, as_itemcode in char, adt_fromdate in date, as_qtyvalue in char, as_grade in char ) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = as_itemcode and a.site_code = as_sitecode and a.grade = as_grade ; if adt_fromdate < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT decode(as_qtyvalue,'Q', sum( a.quantity), sum((a.quantity) * nvl(a.rate,0))) qty from stock a, invstat b where a.item_code = as_itemcode and a.site_code = as_sitecode and a.grade = as_grade union all select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * nvl(d.rate,0) ) * -1),0) ) qty from invtrace a, invstat c, stock d where a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = as_itemcode and a.site_code = as_sitecode and a.grade = as_grade and a.tran_date > adt_fromdate); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_QTY_FORM (as_itemcode in item.item_code%type,as_unitfrom in uom.unit%type,as_unitto in uom.unit%type, ac_quantity in number) return number is ls_order varchar2(50) := 'NOTFOUND'; newqty number(14,3) := 0; mconv number(18,7) := 0; errqty number (14,3) := -999999999; mcnt number(6) := 0; ls_unitfrom uom.unit%type; ls_unitto uom.unit%type; begin ls_unitfrom := trim(as_unitfrom); ls_unitto := trim(as_unitto); if ls_unitfrom = ls_unitto then return ac_quantity; end if; -- check for unit in actual order with item code begin select count(*) into mcnt from uomconv where unit__fr = ls_unitfrom and unit__to = ls_unitto and item_code = as_itemcode; exception when others then return errqty; end; if mcnt = 0 then -- check for unit in reverse order with item code begin Select Count(*) into mcnt from UomConv where unit__fr = ls_unitto and unit__to = ls_unitfrom and item_code = as_itemcode; exception when others then return errqty; end; if mcnt = 0 then -- check for unit in actual order and item code 'X' begin select count(*) into mcnt from uomconv where unit__fr = ls_unitfrom and unit__to = ls_unitto and item_code = 'X'; exception when others then return errqty; end; if mcnt = 0 then -- check for unit in reverse order and item code 'X' begin select count(*) into mcnt from uomconv where unit__fr = ls_unitto and unit__to = ls_unitfrom and item_code = 'X'; exception when others then return errqty; end; if mcnt = 0 then return errqty; else -- found unit in reverse order and item code 'X' begin select fact into mconv from uomconv where unit__fr = ls_unitto and unit__to = ls_unitfrom and item_code = 'X'; exception when others then return errqty; end; ls_order := 'REVORD'; end if; else -- found unit in actual order and item code 'X' begin Select Fact into mconv from UomConv where unit__fr = ls_unitfrom and unit__to = ls_unitto and item_code = 'X'; exception when others then return errqty; end; ls_order := 'ACTORD'; end if; else -- found in reverse order with item begin Select Fact into mconv from UomConv where unit__fr = ls_unitto and unit__to = ls_unitfrom and item_code = as_itemcode; exception when others then return errqty; end; ls_order := 'REVORD'; end if; else -- found in actual order with item begin Select Fact into mconv from UomConv where unit__fr = ls_unitfrom and unit__to = ls_unitto and item_code = as_itemcode; exception when others then return errqty; end; ls_order := 'ACTORD'; end if; if ls_order = 'NOTFOUND' then return errqty; end if; -- check whether conversion factor need to be assigned if ls_order = 'ACTORD' then newqty := mconv * ac_quantity; else newqty := 1 / mconv * ac_quantity; end if; return newqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_POTENCYTOTAL ( as_expr_no expr_bill.expr_no%type) return number is ll_potency number(14,3); ls_done char(20); ll_potency1 number(14,3); ll_opr expr_bill.operation%type; ll_qty_alt expr_bill.quantity__alt%type; ll_potncy_dj expr_bill.potency_adj%type; ls_metcdbom expr_bill.MATHOD_CODE_BOM%type; cursor cur_augs is select quantity__alt , potency_adj ,operation , MATHOD_CODE_BOM , (case when count((MATHOD_CODE_BOM)) >= 1 then 'Done' else 'Notdone' end) from expr_bill where expr_no = as_expr_no group by operation , MATHOD_CODE_BOM ,expr_bill.quantity__alt , expr_bill.potency_adj; begin ll_potency := 0; open cur_augs; LOOP fetch cur_augs into ll_qty_alt , ll_potncy_dj , ll_opr ,ls_metcdbom , ls_done; dbms_output.put_line('CHECKING: ' || LS_DONE ||'.'); exit when cur_augs%NOTFOUND; if ls_done = 'Done' then dbms_output.put_line('CHECKING ll_qty_alt : ' || ll_qty_alt ||'.'); dbms_output.put_line('CHECKING ll_potncy_dj: ' || ll_potncy_dj ||'.'); select sum(expr_bill.actual_qty ) into ll_potency1 from expr_bill where expr_no = as_expr_no and MATHOD_CODE_BOM is not null; --dbms_output.put_line('CHECKING ll_potency1: ' || ll_potency1 ||'.'); --dbms_output.put_line('CHECKING ll_potency1: ' || CHAR(expr_bill.potency_adj) ||'.'); --dbms_output.put_line('CHECKING ll_potency1: ' || CHAR(SUM( expr_bill.quantity__alt + expr_bill.potency_adj) ) ||'.'); if ll_potency = 0 then ll_potency := ll_potency1; --else -- ll_potency := ll_potency + ll_potency1; end if; end if; dbms_output.put_line('CHECKING ll_qty_alt : ' || LS_DONE ||'.'); dbms_output.put_line('CHECKING ll_potncy_dj: ' || ll_potncy_dj ||'.'); END LOOP; close cur_augs; dbms_output.put_line('CHECKING ll_potency: ' || ll_potency ||'.'); return ll_potency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SUNDRYTYPE_NEW (LTYPE IN CHAR,LCODE IN CHAR,LS_REF_ID IN CHAR,LS_REF_SER IN CHAR) RETURN CHAR IS LS_VAL CHAR(12); LS_TYPE CHAR(1); LS_CODE CHAR(10); BEGIN IF LTYPE = 'O' THEN IF LS_REF_SER = 'M-VOUC' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM MISC_VOUCHER WHERE TRAN_ID = LS_REF_ID ; ELSIF LS_REF_SER = 'P-VOUC' THEN SELECT EMP_CODE INTO LS_CODE FROM PAYR_VOUCHER WHERE TRAN_ID = LS_REF_ID ; LS_TYPE := 'E'; ELSIF LS_REF_SER = 'E-PAY' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM PAYMENT_EXP WHERE TRAN_ID = LS_REF_ID ; ELSIF LS_REF_SER = 'M-PAY' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM MISC_PAYMENT WHERE TRAN_ID = LS_REF_ID ; ELSIF LS_REF_SER = 'M-RCP' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM MISC_RECEIPT WHERE TRAN_ID = LS_REF_ID; ELSIF LS_REF_SER = 'RCP' THEN SELECT CUST_CODE INTO LS_CODE FROM RECEIPT WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'C'; ELSIF LS_REF_SER = 'MPCANC' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM MISC_PAYMENT_CANC WHERE TRAN_ID = LS_REF_ID ; ELSIF LS_REF_SER = 'P-RCP' THEN SELECT SUPP_CODE INTO LS_CODE FROM PORCP WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'S'; ELSIF LS_REF_SER = 'P-RET' THEN SELECT SUPP_CODE INTO LS_CODE FROM PORCP WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'S'; ELSIF LS_REF_SER = 'S-DSP' THEN SELECT CUST_CODE INTO LS_CODE FROM DESPATCH WHERE DESP_ID = LS_REF_ID; LS_TYPE := 'C'; ELSIF LS_REF_SER = 'S-RET' THEN SELECT CUST_CODE INTO LS_CODE FROM SRETURN WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'C'; ELSIF LS_REF_SER = 'MDRCRC' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM MISC_DRCR_RCP WHERE TRAN_ID = LS_REF_ID ; ELSIF LS_REF_SER = 'S-INV' THEN SELECT CUST_CODE INTO LS_CODE FROM INVOICE WHERE INVOICE_ID = LS_REF_ID ; LS_TYPE := 'C'; ELSIF LS_REF_SER = 'MDRCRD' THEN SELECT SUNDRY_TYPE,SUNDRY_CODE INTO LS_TYPE, LS_CODE FROM MISC_DRCR_RCP WHERE TRAN_ID = LS_REF_ID ; ELSIF LS_REF_SER = 'R-DIS' THEN SELECT CUST_CODE INTO LS_CODE FROM RCPDISHNR WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'C'; ELSIF LS_REF_SER = 'CRNRCP' THEN SELECT CUST_CODE INTO LS_CODE FROM DRCR_RCP WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'C'; ELSIF LS_REF_SER = 'VOUCH' THEN SELECT SUPP_CODE INTO LS_CODE FROM VOUCHER WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'S'; ELSIF LS_REF_SER = 'DRNRCP' THEN SELECT CUST_CODE INTO LS_CODE FROM DRCR_RCP WHERE TRAN_ID = LS_REF_ID; LS_TYPE := 'C'; END IF; END IF; LS_TYPE := NVL(LS_TYPE,' '); LS_CODE := NVL(LS_CODE,' '); LS_VAL := LS_TYPE || LS_CODE; RETURN LS_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_ITPROOF_CHGSCHEME (as_tran_id emp_itdecl_hdr.tran_id%type, as_login_empcode users.emp_code%type) return char is ls_return_str messages.msg_no%type; ls_itax_policy emp_itdecl_hdr.itax_policy%type; ls_scheme_adcode_list varchar2(200); ls_decl_type emp_itdecl_hdr.decl_type%type; ls_qtr_no emp_itdecl_hdr.qtr_no%type; ls_rej_cntr emp_itdecl_hdr.rej_cntr%type; cursor c_itdecl_det is select ad_code, amount_proof, amount_decl from emp_itdecl_det where tran_id = as_tran_id; begin ls_return_str := ''; select decl_type, qtr_no, itax_policy, fn_get_newscheme_adcodes(emp_code__decl, acct_prd), rej_cntr into ls_decl_type, ls_qtr_no, ls_itax_policy, ls_scheme_adcode_list, ls_rej_cntr from emp_itdecl_hdr where tran_id = as_tran_id; if ls_decl_type = 'P' and ls_qtr_no = 4 and ls_rej_cntr > 0 then ls_return_str := 'VTITCHGSCH'; return ls_return_str; end if; for i in c_itdecl_det loop if ls_decl_type = 'D' and ls_qtr_no = 0 then if instr(ls_scheme_adcode_list, i.ad_code) = 0 and i.amount_decl > 0 then ls_return_str := 'VTITCHGSCH'; END IF; elsif ls_decl_type = 'P' and ls_qtr_no = 4 then if instr(ls_scheme_adcode_list, i.ad_code) = 0 and i.amount_proof > 0 then ls_return_str := 'VTITCHGSCH'; END IF; end if; end loop; return ls_return_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_HOLIDAY1 (AS_EMP_CODE CHAR,AS_PRD_CODE_FR CHAR,AS_PRD_CODE_TO CHAR,AS_EMP_WORK_DATE DATE) return date is a_hol_date Date; begin select distinct hol_date into a_hol_date from holiday where hol_tblno = ddf_get_holtblno(AS_EMP_CODE,AS_EMP_WORK_DATE) and hol_date = AS_EMP_WORK_DATE; return a_hol_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_INDENT_PURC (as_indno in char) return char is ls_purcorder char(10); cursor c1 is select porddet.purc_order from porddet, porder where porddet.purc_order = porder.purc_order and porddet.ind_no = as_indno order by porder.ord_date desc, porddet.purc_order desc; begin ls_purcorder := ' '; for cdescr in c1 loop begin exit when c1%notfound; ls_purcorder := cdescr.purc_order; exit; end; end loop; return ls_purcorder ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ACCTPRD_DET (as_date porcp.tran_date%type,as_flag char) return varchar2 is ll_year period.code%type; ll_prd_qtr period.prd_qtr%type; begin if as_flag = 'D' then select code into ll_year from period where as_date between fr_date and to_date; return ll_year; elsif as_flag = 'Y' then select code into ll_year from acctprd where as_date between fr_date and to_date; return ll_year; elsif as_flag = 'Q'then select prd_qtr into ll_prd_qtr from period where as_date between fr_date and to_date; return ll_prd_qtr; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PAY_IBCA_CHK BEFORE INSERT OR UPDATE OF confirmed ON pay_ibca referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check gltrace count and gltrace count begin select count(1) into ll_glcount from gltrace where ref_ser = 'P-IBCA' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; -- 2. check header DR, CR and gltrace DR, CR begin --select amount into lc_hdramt from rcp_ibca --where tran_id = :new.tran_id; lc_hdramt := :old.amount ; exception when others then lc_hdramt := 0; end; begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'P-IBCA' and ref_id = :new.tran_id and site_code = :new.site_code__from; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and (lc_gldr <> lc_glcr or lc_glcr < lc_hdramt or lc_gldr < lc_hdramt) then raise_application_error( -20601, 'Debit or credit mismatch between IBCA (Payable) and gltrace IBCA Amount [' || to_char(lc_hdramt) || '] GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ESC_ASSIGN_DATA (as_item_ser char,as_site_code char,as_dept_code char,as_emp_code char,as_req_typ char,as_esc_employee char) return varchar2 as as_valid_fb_emp varchar2(10); ESC__EMP_CODE_1 char(10); ESC__EMP_CODE_2 char(10); begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE IS NULL AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N')) AND SITE_CODE is null AND DEPT_CODE is null AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER is null AND SITE_CODE =as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER = as_item_ser AND SITE_CODE is null AND DEPT_CODE is null AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; exception when no_data_found then begin SELECT ESC__EMP_CODE_1,ESC__EMP_CODE_2 INTO ESC__EMP_CODE_1,ESC__EMP_CODE_2 FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER is null AND SITE_CODE is null AND DEPT_CODE =as_dept_code AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; if (trim(ESC__EMP_CODE_1) = trim(as_esc_employee) or trim(ESC__EMP_CODE_2) = trim(as_esc_employee)) then as_valid_fb_emp := 'true'; else as_valid_fb_emp := 'false'; end if; return as_valid_fb_emp; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX GLTRAN_X ON GLTRAN (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 327680 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION F_GET_SRET_QTY (CCODE IN char,lotno IN CHAR ,itemcode IN CHAR) RETURN NUMBER AS ln_qty NUMBER(14,3); BEGIN BEGIN SELECT NVL(SUM(decode(ret_opt,'C',-b.quantity,b.quantity)),0) INTO ln_qty FROM SRETURN A, SRETURNDET B WHERE a.cust_code = CCODE AND a.tran_id = b.tran_id AND b.lot_no = lotno AND b.item_code = itemcode AND a.confirmed = 'Y'; EXCEPTION WHEN OTHERS THEN ln_qty := 0; END; RETURN ln_qty; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_ALTERNATE_QTY (ls_woBillItemCode in char, ls_woIssDetItemCode in char, ls_woIssWorkOrder in char, ls_itemRef in char, ll_quantity in NUMBER) RETURN NUMBER IS ll_altquantity number(14,3):=0; ll_qtyPerBom number(14,3):=0; ll_propotinateAltQty number(14,3):=0; ll_balanceQty number(14,3):=0; ls_bomCode char(10); BEGIN if (ls_woBillItemCode <> ls_woIssDetItemCode) then begin select bom_code into ls_bomCode from workorder where work_order = ls_woIssWorkOrder; exception when others then ls_bomCode := ''; end; begin select quantity into ll_altquantity from bom_alt where item_code = ls_woBillItemCode and item_code__alt = ls_woIssDetItemCode and bom_code = ls_bomCode; exception when others then ll_altquantity := 0; end; begin select qty_per into ll_qtyPerBom from bomdet where item_code = ls_woBillItemCode and bom_code = ls_bomCode and item_ref = ls_itemRef; exception when others then ll_qtyPerBom := 0; end; begin ll_propotinateAltQty := (ll_quantity / ll_altquantity) * ll_qtyPerBom; exception when ZERO_DIVIDE then ll_propotinateAltQty := 0; when others then ll_propotinateAltQty := 0; end; return ll_propotinateAltQty; else return ll_quantity; end if; END FN_CHK_ALTERNATE_QTY; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUN_DDF_GET_SORD_DESP_QTY (MSORD_NO IN CHAR, MSORD_LINE_NO IN CHAR) RETURN NUMBER IS MDESP_QTY NUMBER(14,3) := 0; BEGIN SELECT SUM(NVL(DESPATCHDET.QUANTITY, 0)) INTO MDESP_QTY FROM DESPATCHDET, DESPATCH WHERE DESPATCHDET.SORD_NO = MSORD_NO AND DESPATCHDET.LINE_NO__SORD = MSORD_LINE_NO AND DESPATCH.DESP_ID = DESPATCHDET.DESP_ID AND DESPATCH.CONFIRMED = 'Y'; RETURN MDESP_QTY; EXCEPTION WHEN OTHERS THEN RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RCPDISHCONF (as_cust_code in char, as_sitecode in char, as_schemecode in char) return number is lc_amt number(14,3); ls_cust_code varchar2(10); ls_site_code varchar2(5); begin lc_amt := 0; select nvl(sum(nvl(rcpdishnr_det.rcp_amt,0)),0), rcpdishnr.cust_code, rcpdishnr.site_code into lc_amt, ls_cust_code, ls_site_code from rcpdishnr_det, rcpdishnr, receipt, schemevalue, banktran_log where rcpdishnr_det.tran_id = rcpdishnr.tran_id and rcpdishnr.receipt_no = receipt.tran_id and schemevalue.scheme_code = as_schemecode and banktran_log.tran_no = receipt.tran_id and banktran_log.status ='R' and rcpdishnr.cust_code= as_cust_code and rcpdishnr.site_code = as_sitecode and rcpdishnr.confirmed = 'Y' group by rcpdishnr.cust_code, rcpdishnr.site_code ; return lc_amt; exception when NO_DATA_FOUND then return 0; WHEN OTHERS THEN return 0; return lc_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_HOLIDAYS (AS_EMP_CODE CHAR,AS_PRD_CODE_FR CHAR,AS_PRD_CODE_TO CHAR, AS_EMP_WORK_DATE DATE) return Date is lc_date Date ; A Date; B Date; C Date; D number(14,3); E number(14,3); F Date; G holiday.descr%type; H employee.hol_tblno%type; J number(14,3); w employee.work_site%type; begin select fr_date into A from period where code = AS_PRD_CODE_FR; select to_date into B from period where code = AS_PRD_CODE_TO; select nvl(count(*),0) into D from emp_employ_events where emp_code = AS_EMP_CODE and confirmed = 'Y'; C := AS_EMP_WORK_DATE; if (D > 0) then select nvl(count(*),0) into E from emp_employ_events where emp_code = AS_EMP_CODE and eff_date = ( select max(eff_date) from emp_employ_events where emp_code = AS_EMP_CODE and confirmed = 'Y' and eff_date <= C) and confirmed = 'Y'; if (E > 0) then select hol_tblno__to into H from emp_employ_events where emp_code = AS_EMP_CODE and eff_date = ( select max(eff_date) from emp_employ_events where emp_code = AS_EMP_CODE and confirmed = 'Y' and eff_date <= C) and confirmed = 'Y'; else select hol_tblno__fr into H from emp_employ_events where emp_code = AS_EMP_CODE and eff_date = ( select min(eff_date) from emp_employ_events where emp_code = AS_EMP_CODE and confirmed = 'Y' and eff_date > C) and confirmed = 'Y'; end if; end if; if length(ltrim(rtrim(H))) = 0 or H is null then select hol_tblno,work_site into H,W from employee where emp_code = AS_EMP_CODE; if length(ltrim(rtrim(H))) = 0 or H is null then select hol_tblno into H from site where site_code = W; end if; end if; select nvl(count(*),0) into J from holiday where hol_tblno = H and hol_date = C; if (J > 0) then select to_char(hol_date,'DD-MON-YYYY'),descr into F,G from holiday where hol_tblno = H and hol_date = C; lc_date := F; end if; return lc_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_REXPMFG_DATE (as_itemcode in char, as_sitecode in char, as_lotno in char, as_expmfg in char) return date is ldt_retval date; begin begin select min(decode(as_expmfg,'E',exp_date,mfg_date)) into ldt_retval from stock where item_code = as_itemcode and site_code = as_sitecode and lot_no = as_lotno; end; return ldt_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_DIMENSION_QTY (as_dimension in stock.dimension%type, as_unit in item.unit%type,ac_noart in number ) is lc_retval number(14,3) := 0; lc_dimension number(14,3) ; li_pos number(14,0) ; ls_dimpart varchar2(30); ls_dimension stock.dimension%type; ls_delimiter char(1); lc_noart number(14,3); lc_length number(14,3) := 1; lc_width number(14,3) := 1; lc_height number(14,3) := 0; lc_counter number(3) := 0; begin ls_delimiter := 'x' ; ls_dimension := as_dimension; lc_noart := ac_noart; if lc_noart is null or lc_noart = 0 then lc_noart := 1 ; end if ; -- default value to return lc_retval := 0 ; if ls_dimension is null or length(trim(ls_dimension)) = 0 then return ; end if ; ls_dimension := lower(ltrim(rtrim(ls_dimension))); -- remove unwanted characters like mm, cm, in, etc. select Replace(translate(trim(ls_dimension),'ABCDEFGHIJKLMNOPQRSTUVWYZ/abcdefghijklmnopqrstuvwyz-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_dimension from dual; dbms_output.put_line('Final dimension [' || ls_dimension || ']'); loop li_pos := nvl(instr(ls_dimension, ls_delimiter,1,1),0); if li_pos > 0 then ls_dimpart := substr(ls_dimension,1,li_pos - 1); ls_dimension := substr(ls_dimension,li_pos + 1); else ls_dimpart := ls_dimension ; ls_dimension := '' ; end if; lc_dimension := to_number(ls_dimpart) ; --if lc_dimension <> 0 then lc_counter := lc_counter + 1; --end if; if lc_counter = 1 then lc_length := lc_dimension; end if; if lc_counter = 2 then lc_width := lc_dimension; end if; if lc_counter = 3 then lc_height := lc_dimension; end if; dbms_output.put_line('unit [' || as_unit || '] dimension [' || ls_dimension || '] counter [' || to_char(lc_counter) || '] pos[' || to_char(li_pos) ||'] length [ ' || to_char(lc_length) || '] width [' || to_char(lc_width) || '] height [' || to_char(lc_height) ||']'); if length(trim(ls_dimension)) = 0 then exit ; end if ; if lc_counter >= 3 then exit; end if; end loop; if as_unit = 'CFT' then lc_retval := (lc_length * lc_width * lc_height * lc_noart) / 144 ; elsif as_unit = 'SQM' then lc_retval := ( lc_length * lc_width) * lc_noart; else lc_retval := 0; end if; dbms_output.put_line('unit [' || as_unit || '] length [ ' || to_char(lc_length) || '] width [' || to_char(lc_width) || '] height [' || to_char(lc_height) ||'] retval [' || to_char(lc_retval) ||']'); --return lc_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_HSN_NO (as_sitecode site.site_code%type,as_itemcode item.item_code%type) return varchar is ls_hsnno varchar(20); ls_count number; begin ls_hsnno:=''; ls_count:=0; select count(1) into ls_count from siteitem where site_code = as_sitecode and item_code = as_itemcode; if (ls_count>0) then select hsn_no into ls_hsnno from siteitem where site_code = as_sitecode and item_code = as_itemcode; end if; if ls_hsnno is null or length(trim(ls_hsnno)) = 0 then select hsn_no into ls_hsnno from item where item_code = as_itemcode; end if; return ls_hsnno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RNUM_TO_WORD_RUPEE (var in number,CURR IN VARCHAR) return varchar2 is amt number; strt number; val number; str varchar2(15); ls_dec_unit varchar(10); ls_currency varchar(50); c_str varchar2(400); flag number:=0; begin val:=round(var,2); amt:=floor(val); str:=to_char(amt); ls_dec_unit:=' '; ls_currency :=' ' ; select nvl(dec_unit,'Cents') into ls_dec_unit from currency where TRIM(curr_code)=TRIM(curr); IF (TRIM(curr)='INR' OR TRIM(CURR)='RS') THEN ls_currency:=''; ELSE select nvl(descr,'US DOLLAR') into ls_currency from currency where TRIM(curr_code)=TRIM(curr); END IF ; if val > 0 then if length(str) >= 8 and length(str) <=10 then strt:=(length(str)-7); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' crore '; amt:=to_number(substr(to_char(amt),(strt+1),7)); flag:=0; end if; str:=to_char(amt); if ((length(str) >= 6 and length(str) <= 7) or flag = 1) then strt:=(length(str) - 5); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' lakh '; amt:=to_number(substr(to_char(amt),(strt+1),5)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 5 ) or flag = 1) then c_str:=c_str || initcap(case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end); end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := ls_currency || ' ' || initcap(c_str) || ' and ' || initcap(spell(amt)) || ' ' || initcap(ls_dec_unit) || ' Only'; else c_str := ls_currency || ' ' || initcap(c_str) || ' Only'; end if; c_str:=replace(c_Str,'-',' '); return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EMP_CODE_AMEND (ls_fldname in varchar2) return char is emp_code_value varchar2(10); begin SELECT var_value into emp_code_value FROM disparm WHERE TRIM(var_name) = TRIM('TD_REQ_APPRV'); return trim(emp_code_value); exception when no_data_found then return ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KEY_PORDLNNOITMCODE ON PORDDET (PURC_ORDER, LINE_NO, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SHIFT_PATTERN_X ON SHIFT_PATTERN (PATTERN_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BATCHLOAD_MAIL_STAT ON BATCHLOAD (MAIL_STAT, EDI_ADDR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RTAXTRAN_RECO (as_tran_id in char, as_line_no in char) return number is lc_amount number(14,3); begin select nvl(sum(nvl(reco_amount,0)),0) into lc_amount from taxtran where ( taxtran.tran_code = 'P-RCP' ) and ( tran_id = as_tran_id ) and ( line_no = as_line_no ) and ( taxtran.tax_code in ('EXC','XCI','XCF')) ; return lc_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DRCR_RCP_TDATE_SITE ON DRCR_RCP (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PURCHASE_REQUISITION_AVGCONS (as_itemcode in char) return number is lc_average1 workorder_issdet.quantity%type; lc_average2 consume_iss_det.quantity%type; average number(14,3); begin SELECT nvl(avg(workorder_issdet.quantity),0) into lc_average1 FROM workorder_issdet, workorder_iss WHERE ( workorder_issdet.tran_id = workorder_iss.tran_id ) and ( ( workorder_iss.conf_date >= sysdate - 90 ) AND ( workorder_iss.conf_date <= sysdate ) AND ( workorder_iss.tran_type = 'I' ) AND ( workorder_issdet.item_code = as_itemcode ) ) ; SELECT nvl(avg(consume_iss_det.quantity),0) into lc_average2 FROM consume_iss, consume_iss_det WHERE ( consume_iss.cons_issue = consume_iss_det.cons_issue ) and ( ( consume_iss.conf_date >= sysdate - 90 ) AND ( consume_iss.conf_date <= sysdate ) AND ( consume_iss.tran_code = as_itemcode ) ) ; average:=(lc_average1+lc_average2)/2; return (average); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_PROC_CODE (as_route procroute.route_code%type, as_opr procroute.operation%type) return char is ls_pc procroute.proc_code%type ; begin select proc_code into ls_pc from procroute where route_code = as_route and operation = as_opr and rownum = 1; return ls_pc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUSTLEDG_DET (ls_ref_ser in char , ls_ref_no in char) return varchar2 is ls_det char(55); ls_sp_no char(10); ls_it_ser char(5); ls_so_no char(10); ls_gp_no char(10); ls_bank_no char(10); begin if ls_ref_ser = 'RCP' then select a.sale_order , a.bank_code , b.sales_pers , b.item_ser into ls_so_no , ls_bank_no , ls_sp_no , ls_it_ser from receipt a , sorder b where ( a.sale_order = b.sale_order (+) ) and ( a.tran_id = ls_ref_no) and ( rownum = 1) ; ls_det :=nvl(ls_sp_no,' ')||' ' ||nvl(ls_it_ser,' ')||' ' ||nvl(ls_bank_no,' ')||' '||nvl(ls_so_no,' ')||' '||nvl(ls_gp_no,' '); return ls_det; elsif ls_ref_ser = 'S-INV' then select invoice.sale_order , invoice.bank_code , despatch.desp_id , invoice.sales_pers, invoice.item_ser into ls_so_no , ls_bank_no ,ls_gp_no , ls_sp_no,ls_it_ser from invoice, sorder ,despatch where ( invoice.sale_order = sorder.sale_order ) and ( sorder.sale_order = despatch.sord_no )and ( invoice.invoice_id = ls_ref_no )and ( rownum = 1 ); ls_det :=nvl(ls_sp_no,' ')||' ' ||nvl(ls_it_ser,' ')||' ' ||nvl(ls_bank_no,' ')||' '||nvl(ls_so_no,' ')||' '||nvl(ls_gp_no,' '); return ls_det; elsif ls_ref_ser = 'DRNRCP' or ls_ref_ser = 'CRNRCP' then select invoice.sale_order , invoice.bank_code , despatch.desp_id , invoice.sales_pers , invoice.item_ser into ls_so_no , ls_bank_no ,ls_gp_no, ls_sp_no , ls_it_ser from invoice, sorder ,despatch , drcr_rcp where ( drcr_rcp.invoice_id = invoice.invoice_id ) and ( invoice.sale_order = sorder.sale_order ) and ( sorder.sale_order = despatch.sord_no )and ( drcr_rcp.tran_id = ls_ref_no )and ( rownum = 1 ); ls_det :=nvl(ls_sp_no,' ')||' ' ||nvl(ls_it_ser,' ')||' ' ||nvl(ls_bank_no,' ')||' '||nvl(ls_so_no,' ')||' '||nvl(ls_gp_no,' '); return ls_det; else ls_det :=nvl(ls_sp_no,' ')||' ' ||nvl(ls_it_ser,' ')||' ' ||nvl(ls_bank_no,' ')||' '||nvl(ls_so_no,' ')||' '||nvl(ls_gp_no,' '); return ls_det; end if; exception when no_data_found then ls_det :=nvl(ls_sp_no,' ')||' ' ||nvl(ls_it_ser,' ')||' ' ||nvl(ls_bank_no,' ')||' '||nvl(ls_so_no,' ')||' '||nvl(ls_gp_no,' '); return ls_det; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UC_CLUSTERPROJ ON PROJ_CLSTR (PHASE_CODE, PROJ_CODE, CLSTR_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SER_ACT_PLANEMP ON SER_REQ_ACT_DETL (ACTION_ID, EMP_CODE, PLANENDDATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOAD_NO (empCode in char,as_event_date in date) RETURN varchar2 IS load_no_wth_route varchar2(80); ls_load_no char(10); begin SELECT MAX(TO_NUMBER(CASE WHEN LOAD_NO IS NULL THEN '0' ELSE LOAD_NO END)) into ls_load_no FROM SPRS_DAY_SUMM WHERE SALES_PERS =empCode AND EVENT_DATE = (SELECT MAX(EVENT_DATE) FROM SPRS_DAY_SUMM WHERE SALES_PERS= empCode); return ls_load_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ATTD_ONWOFF_PANOLI (a_emp_code char,a_prd_code char) return number is cursor c1 is select hol_date from holiday a, employee b, period c where c.code = a_prd_code and a.hol_tblno = b.hol_tblno and b.emp_code = a_emp_code and a.hol_date between c.fr_date and c.to_date and a.hol_type ='H'; cursor c2 is select hol_date from holiday a, employee b, period c where c.code = a_prd_code and a.hol_tblno = b.hol_tblno and b.emp_code = a_emp_code and a.hol_date between c.fr_date and c.to_date and a.hol_type ='W'; b_fr_dt date; b_to_dt date; b_date date; b_total number := 0; b_count number := 0; b_day char(1); begin for i in c1 loop select count(*) into b_count from attendance_day where emp_code = a_emp_code and attd_date = i.hol_date; if (b_count <> 0) then b_total := b_total + 1; end if; end loop; for i in c2 loop select to_char(i.hol_date,'D') into b_day from dual; exit; end loop; select fr_date,to_date into b_fr_dt,b_to_dt from period where code = a_prd_code; for i in 1..(b_to_dt-b_fr_dt+1) loop b_date := b_fr_dt + i - 1; if (to_char(b_date,'D') = b_day) then select count(*) into b_count from holiday a, employee b where a.hol_tblno = b.hol_tblno and b.emp_code = a_emp_code and a.hol_date = b_date and a.hol_type ='H'; if (b_count <> 0) then b_total := b_total + 1; end if; end if; end loop; return b_total; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RE_STRUC_DET_X ON RE_STRUC_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_AMD_ITEMDET_X ON SALES_QUOT_AMD_ITEMDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_WP_TOTALWEIGHT (AS_PTCN IN VARCHAR2) RETURN NUMBER IS AS_TOTAL_WEIGHT NUMBER(25,3); AS_TOTAL_WEIGHT_1 NUMBER(25,3); AS_TOTAL_WEIGHT_2 NUMBER(25,3); AS_GRND_TOTAL NUMBER(25,3); BEGIN SELECT SUM(b.quantity*c.gross_weight) INTO AS_TOTAL_WEIGHT FROM wave_task_det a, pick_ord_det b, ITEM c WHERE a.ref_id = b.pick_order AND b.item_code = c.item_code AND A.REF_SER ='A-PICK' AND A.PTCN = AS_PTCN; SELECT SUM(b.no_art*c.gross_weight) INTO AS_TOTAL_WEIGHT_1 FROM wave_task_det a, pick_ord_det b,ITEM_LOT_PACKSIZE c WHERE a.ref_id = b.pick_order AND b.item_code = c.item_code AND A.REF_SER IN('C-PICK','M-PICK','P-PICK') AND A.PTCN =AS_PTCN; SELECT SUM(b.no_art*c.gross_weight) INTO AS_TOTAL_WEIGHT_2 FROM wave_task_det a, repl_ord_det b,ITEM_LOT_PACKSIZE c WHERE a.ref_id = b.repl_order AND b.item_code = c.item_code AND A.REF_SER IN('S-DOC','RS-DSO') AND A.PTCN =AS_PTCN; AS_GRND_TOTAL := nvl(AS_TOTAL_WEIGHT,0) + nvl(AS_TOTAL_WEIGHT_1,0) + nvl(AS_TOTAL_WEIGHT_2,0); RETURN NVL(AS_GRND_TOTAL,0); END FN_GET_WP_TOTALWEIGHT; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ACTIVE_ITEM (as_cust_code in char) return number is ll_count number(5,0); begin select count(item_ser) into ll_count from customer_series where cust_code = as_cust_code and item_ser <> 'CO'; return ll_count ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESPATCHQTY ( as_desp_id in char, as_item_code in char, as_lotsl in char) return number is lc_qty number(14,3); begin select nvl(sum(quantity__stduom),0) into lc_qty from despatchdet where desp_id = as_desp_id and item_code = as_item_code and lot_sl = as_lotsl ; return lc_qty ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ORGUNITMASTERPOPHELP AS FUNCTION getorgUnitType (orgUnitType in char) RETURN ORGUNITMASTERTABLE PIPELINED; END ORGUNITMASTERPOPHELP; CREATE OR REPLACE PACKAGE BODY ORGUNITMASTERPOPHELP AS FUNCTION getorgUnitType (orgUnitType in char) RETURN ORGUNITMASTERTABLE PIPELINED AS ls_org_unit_type varchar2(1); BEGIN if (orgUnitType = 'I') THEN for x in(SELECT TRIM(ITEM_SER) AS ITEM_SER, DESCR AS ITEM_DESCR FROM ITEMSER ) LOOP PIPE ROW (ORGUNITMASTER(x.ITEM_SER,x.ITEM_DESCR)); END LOOP; else if (orgUnitType = 'S') THEN for x in(SELECT TRIM(SITE_CODE) AS ITEM_SER, DESCR AS ITEM_DESCR FROM SITE ) LOOP PIPE ROW (ORGUNITMASTER(x.ITEM_SER,x.ITEM_DESCR)); END LOOP; else if (orgUnitType = 'D') THEN for x in(SELECT TRIM(DEPT_CODE) AS ITEM_SER, DESCR AS ITEM_DESCR FROM DEPARTMENT ) LOOP PIPE ROW (ORGUNITMASTER(x.ITEM_SER,x.ITEM_DESCR)); END LOOP; RETURN; end if; end if; end if; end; END ORGUNITMASTERPOPHELP; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYR_VOUCHER_TRAN_DATEEMP_CODE ON PAYR_VOUCHER (TRAN_DATE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SL_TRANS_CREDIT (ldate_fr in date,ldate_to in date,lsundry_code in char,lsundry_type in char, lsite_code in char,lacct_code in char) return number is lc_cr_sum number(14,3); begin Select nvl(Sum(cr_amt * exch_rate),0) into lc_cr_sum from gltrace where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_TRANDATE_MULTI_SITE (ldate_fr in date,lsite_code in char,lacct_code in char) return number is lc_day_op_bal number(14,3); lc_prd_op_bal number(14,3); ls_prd char(6); ls_acctprd char(6); ls_fent char(10); mfr_date date; begin select acct_prd, code, fr_date into ls_acctprd, ls_prd, mfr_date from period where ldate_fr between fr_date and to_date; select fin_entity into ls_fent from site where instr(lsite_code,TRIM(site_code)) > 0 and rownum = 1 ; select sum(dr_amt__base - cr_amt__base) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and instr(lsite_code,TRIM(site_code)) > 0 and acct_code = lacct_code; lc_prd_op_bal := nvl(lc_prd_op_bal,0); Select Sum(dr_amt - cr_amt) into lc_day_op_bal from gltran where instr(lsite_code,TRIM(site_code)) > 0 and tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code ; lc_day_op_bal := nvl(lc_day_op_bal,0); lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SCHEME_DISC (as_tran_code in varchar2, as_sorder_sord in varchar2, as_sorder in varchar2, as_sord_line_sord in varchar2, as_sord_line in varchar2, as_exp in varchar2, ac_taxperc in number, as_desp in varchar2, as_item in varchar2, as_invoice in varchar2, as_inv_line in varchar2 ) return number is ls_taxamt number(14,3); li_cnt number; ls_sordprnt varchar2(20); ls_item varchar2(20); ls_sorder varchar2(20); ls_item_inv varchar2(20); ls_line_sord varchar2(20); ls_desp_id varchar2(20); begin -- checking for split order situation. if (as_tran_code = 'S-ORD') then select nvl(sord_parent,'#') into ls_sordprnt from sorder where sale_order = as_sorder_sord; if ls_sordprnt <> '#' then select count(*) into li_cnt from sorditem where sale_order = ls_sordprnt and item_code <> item_code__ord ; if li_cnt = 0 then return ac_taxperc ; else select item_code into ls_item from sorditem where sale_order = ls_sordprnt and exp_lev like '1.1.%'; if ls_item <> as_item then return 0; else -- taking count of any former despatches done for this item. select count(*) into li_cnt from despatchdet where sord_no = as_sorder_sord and item_code = ls_item and desp_id <> as_desp; if li_cnt > 0 then return 0; else return ac_taxperc ; end if; end if; end if; else -- checking for normal situation in manual despatch begin select count(*) into li_cnt from sorditem where sale_order = as_sorder_sord and item_code <> item_code__ord ; exception when no_data_found then return ac_taxperc; when others then return ac_taxperc; end; if li_cnt = 0 then return ac_taxperc ; end if; if trim(as_exp) > '1.1.' then return 0; end if; return ac_taxperc ; end if; elsif as_tran_code = 'S-DSP' then select nvl(sord_parent,'#') into ls_sordprnt from sorder where sale_order = as_sorder; if ls_sordprnt <> '#' then select count(*) into li_cnt from sorditem where sale_order = ls_sordprnt and item_code <> item_code__ord ; if li_cnt = 0 then return ac_taxperc ; else select item_code into ls_item from sorditem where sale_order = ls_sordprnt and exp_lev like '1.1.%'; if ls_item <> as_item then return 0; else -- taking count of any former despatches done for this item. select count(*) into li_cnt from despatchdet where sord_no = as_sorder and item_code = ls_item and desp_id <> as_desp; if li_cnt > 0 then return 0; else return ac_taxperc ; end if; end if; end if; else -- checking for normal situation in manual despatch begin select count(*) into li_cnt from sorditem where sale_order = as_sorder and item_code <> item_code__ord ; exception when no_data_found then return ac_taxperc; when others then return ac_taxperc; end; if li_cnt = 0 then return ac_taxperc ; end if; if trim(as_exp) > '1.1.' then return 0; end if; return ac_taxperc ; end if; elsif substr(as_tran_code,2) = 'RNRCP' then select sord_no, item_code, sord_line_no, desp_id into ls_sorder, ls_item_inv, ls_line_sord, ls_desp_id from invoice_trace where invoice_id = as_invoice and inv_line_no = to_number(as_inv_line ); select nvl(sord_parent,'#') into ls_sordprnt from sorder where sale_order = ls_sorder; if ls_sordprnt <> '#' then select count(*) into li_cnt from sorditem where sale_order = ls_sorder and item_code <> item_code__ord ; if li_cnt = 0 then return ac_taxperc ; else select item_code into ls_item from sorditem where sale_order = ls_sordprnt and exp_lev like '1.1.%'; if ls_item <> ls_item_inv then return 0; else -- taking count of any former despatches done for this item. select count(*) into li_cnt from despatchdet where sord_no = ls_sorder and item_code = ls_item_inv and desp_id <> ls_desp_id; if li_cnt > 0 then return 0; else return ac_taxperc ; end if; end if; end if; else -- checking for normal situation in manual despatch begin select count(*) into li_cnt from sorditem where sale_order = ls_sorder and item_code <> item_code__ord ; exception when no_data_found then return ac_taxperc; when others then return ac_taxperc; end; if li_cnt = 0 then return ac_taxperc ; end if; if trim(as_exp) > '1.1.' then return 0; end if; return ac_taxperc ; end if; elsif as_tran_code = 'S-INV' then select nvl(sord_parent,'#') into ls_sordprnt from sorder where sale_order = as_sorder; if ls_sordprnt <> '#' then select count(*) into li_cnt from sorditem where sale_order = ls_sordprnt and item_code <> item_code__ord ; if li_cnt = 0 then return ac_taxperc ; else select item_code into ls_item from sorditem where sale_order = ls_sordprnt and exp_lev like '1.1.%'; if ls_item <> as_item then return 0; else -- taking count of any former despatches done for this item. select count(*) into li_cnt from despatchdet where sord_no = as_sorder and item_code = ls_item and desp_id <> as_desp; if li_cnt > 0 then return 0; else return ac_taxperc ; end if; end if; end if; else -- checking for normal situation in manual despatch begin select count(*) into li_cnt from sorditem where sale_order = as_sorder and item_code <> item_code__ord ; exception when no_data_found then return ac_taxperc; when others then return ac_taxperc; end; if li_cnt = 0 then return ac_taxperc ; end if; if trim(as_exp) > '1.1.' then return 0; end if; return ac_taxperc ; end if; end if; exception when no_data_found then return ac_taxperc; when others then return ac_taxperc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPROV_AMT (AS_EMP_CODE CHAR, as_cctr_code char) RETURN NUMBER AS PROV_AMT NUMBER(14,3); BEGIN select sum (tot_amt)into PROV_AMT FROM (select misc_voucher.tot_amt from misc_voucher , employee where misc_voucher.sundry_code = employee.emp_code and misc_voucher.sundry_code = as_emp_code and employee.cctr_code__sal = as_cctr_code and misc_voucher.sundry_type = 'E' and VOUCH_TYPE = 'F' and misc_voucher.confirmed = 'Y' order by misc_voucher.bill_no desc) WHERE ROWNUM <= 4; RETURN PROV_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GLTRACE (m_frst_date in date, m_date_from in date, m_sundry_type in char, m_sundry_code in char, m_site_code in char, m_acct_code1 in char, m_acct_code2 in char, m_acct_code3 in char) return number is ld_day_op_bal number(14,3); begin Select Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)) into ld_day_op_bal from gltrace where site_code = m_site_code and tran_date >= m_frst_date and tran_date < m_date_from and sundry_type = m_sundry_type and sundry_code = m_sundry_code and acct_code in (m_acct_code1 ,m_acct_code2, m_acct_code3); if ld_day_op_bal is null then ld_day_op_bal := 0; end if; Return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_REQ_TYPE (as_item_ser char,as_site_code char,as_dept_code char,as_emp_code char,as_req_typ char) return char is REQ_TYPE char(10); begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE = as_site_code AND DEPT_CODE is null AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE = as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW IS NULL AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE is null AND DEPT_CODE = as_dept_code AND GRADE_ALLOW IS NULL AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE is null AND DEPT_CODE IS NULL AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ((ITEM_SER = as_item_ser and consider_itemser='Y') or (consider_itemser='N' or consider_itemser is null)) AND SITE_CODE is null AND DEPT_CODE is null AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_GRADE(GRADE_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER IS NULL AND SITE_CODE IS NULL AND DEPT_CODE = as_dept_code AND SUBMISSION_DESIGNATION(DESIGNATION_ALLOW,as_emp_code)='exists' AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER is null AND SITE_CODE =as_site_code AND DEPT_CODE IS NULL AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER = as_item_ser AND SITE_CODE is null AND DEPT_CODE is null AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; exception when no_data_found then begin SELECT REQ_TYPE INTO REQ_TYPE FROM SER_COMPL_ASSIGN WHERE REQ_TYPE = as_req_typ AND ITEM_SER is null AND SITE_CODE is null AND DEPT_CODE =as_dept_code AND GRADE_ALLOW is null AND DESIGNATION_ALLOW IS NULL AND STATUS='Y' AND ROWNUM=1; return REQ_TYPE; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINV_ALLOC_CLSTK1 (LSITE_CODE in VARCHAR2 , LITEM_CODE in VARCHAR2 , LLOT_NO in VARCHAR2 ,AD_FROM_DATE in date, LTYPE in VARCHAR2 , LAVAILABLE in VARCHAR2 ) RETURN number is LC_TOTAL_QTY number (17, 6) ; LD_EFF_QTY number ( 17 , 6 ) ; LD_INVTRACE_QTY number ( 17 , 6 ) ; LDT_CREA_DATE date ; BEGIN IF LTYPE = 'I' THEN SELECT MIN ( A . CREA_DATE ) into LDT_CREA_DATE FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT SUM ( A . alloc_qty ) into LD_EFF_QTY FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; END IF ; IF LTYPE = 'B' THEN SELECT MIN ( A . CREA_DATE ) into LDT_CREA_DATE FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; SELECT SUM ( A . QUANTITY ) into LD_EFF_QTY FROM STOCK A , INVSTAT B , LOCATION C WHERE A . LOC_CODE = C . LOC_CODE AND B . INV_STAT = C . INV_STAT AND NVL ( B . STAT_TYPE , ' ' ) <> 'S' AND A . SITE_CODE = LSITE_CODE AND A . ITEM_CODE = LITEM_CODE AND A . LOT_NO = LLOT_NO AND INSTR ( LAVAILABLE , B . AVAILABLE ) > 0 ; END IF ; LC_TOTAL_QTY := LD_EFF_QTY; RETURN LC_TOTAL_QTY ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BANKDET (as_refid varchar2,as_codeorname varchar2,as_code varchar2) return varchar2 is ls_return varchar2(200); ls_code varchar2(20); ls_name varchar2(100); ls_address varchar2(300) ; begin if as_codeorname ='C' then select distinct bank_code into ls_code from banktran_log where tran_Ser in ('M-RCP','RCP','M-PAY','E-PAY','F-XFR') and tran_no = as_refid ; ls_return:=ls_code ; elsif as_codeorname='N' then select distinct bank_code into ls_code from banktran_log where tran_Ser in ('M-RCP','RCP','M-PAY','E-PAY','F-XFR') and tran_no= as_refid; select bank_name into ls_return from bank where bank_code= ls_code ; elsif as_codeorname='A' then select distinct bank_code into ls_code from banktran_log where tran_Ser in ('M-RCP','RCP','M-PAY','E-PAY','F-XFR') and tran_no= as_refid; select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(CITY,' ')||' - ' ||nvl(PIN,' ')||','||nvl(STATE_CODE,' ') ||',' ||nvl(COUNT_CODE,' ') into ls_return from bank where bank_code = ls_code; elsif as_codeorname='X' then select distinct bank_code into ls_code from banktran_log where tran_Ser in ('M-RCP','RCP','M-PAY','E-PAY','F-XFR') and tran_no = as_refid; select tax_reg_st into ls_return from bank where bank_code = ls_code; end if ; return ls_return ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX JOURNAL_TRAN_DATE_SITE ON JOURNAL (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX AUDIT_TABLE_TABLE_NAME ON AUDIT_TABLE (TABLE_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SORD_LINE_CUST (as_refser in invtrace.ref_ser%type, as_refid in invtrace.ref_id%type, as_type in char) return char is ls_saleorder varchar2(50); ls_lineno varchar2(50); ls_customer varchar2(50); ls_rcpid char(10); begin if as_refser = 'QC-ORD' then select a.sale_order,a.line_no,c.tran_id into ls_saleorder, ls_lineno, ls_rcpid from workorder a, qc_order b, workorder_receipt c where a.work_order = c.work_order and b.porcp_no = c.tran_id and b.qorder_no = as_refid and rownum = 1 ; else select order_id, ref_line into ls_saleorder, ls_lineno from invtrace where ref_ser = as_refser and ref_id = as_refid and rownum = 1; end if; if as_type = 'S' then return ls_saleorder ; elsif as_type = 'L' then return ls_lineno ; elsif as_type = 'G' then return ls_rcpid ; else select a.cust_name into ls_customer from customer a, sorder b where a.cust_code = b.cust_code and b.sale_order = ls_saleorder; end if; return ls_customer ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SITEITEM_PUR_LMT_X ON SITEITEM_PUR_LMT (ITEM_CODE, SITE_CODE, MAX_VALUE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SITE_REGNO ( AS_FINENTITY CHAR,as_site_code CHAR, as_ref_code CHAR) RETURN VARCHAR2 IS ls_reg_no varchar2(40); BEGIN BEGIN Select reg_no into ls_reg_no from siteregno where fin_entity =AS_FINENTITY AND site_code = as_site_code and ref_code = as_ref_code; EXCEPTION when no_data_found then ls_reg_no := ''; END; return ls_reg_no; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_LOT_NOS (as_invoiceid in char,al_lineno in number) return varchar is ls_lotno varchar2(200); cursor clot is select distinct lot_no from invoice_trace where invoice_id = as_invoiceid and inv_line_no = al_lineno; begin ls_lotno := ''; for r in clot loop if length(ls_lotno) > 0 then ls_lotno := ls_lotno || ', ' || ltrim(rtrim(r.lot_no)) ; else ls_lotno := ltrim(rtrim(r.lot_no)) ; end if; end loop; return ls_lotno ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_SITEITEM (as_itemcode in char, as_sitecode in char) return varchar2 is ls_itemser itemser.item_ser%type; ll_count number(6,0) := 0; ls_retval varchar2(1) := '0'; begin begin select item_ser into ls_itemser from item where item_code = as_itemcode; exception when no_data_found then ls_itemser := '@@'; end; if instr('RM1 PM1 BD LPM LRM BDI',ltrim(rtrim(ls_itemser))) = 0 then return ls_retval ; end if; begin select count(1) into ll_count from siteitem where site_code = as_sitecode and item_code = as_itemcode and qc_reqd='Y'; exception when no_data_found then ll_count := 0; end; if ll_count <> 1 then return '1'; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INVOICE_TOT_TAX ( as_invoice_id char, as_lot_sl char) return decimal is mtax decimal(13,2); begin select sum ( ( quantity__stduom *rate__stduom ) - ( ( quantity__stduom *rate__stduom )*invoice_trace.discount *0.01 ) ) into mtax from invoice_trace where invoice_trace.invoice_id = as_invoice_id and invoice_trace.invoice_id IN (select taxtran.tran_id from taxtran , tax where taxtran.tax_code =tax.tax_code and taxtran.tran_id = as_invoice_id and taxtran.tran_code ='S-INV' and taxtran.tax_amt <> 0 and tax.print_tax ='Y' ); if sqlcode() <> 0 then return -1; end if; if mtax='' then mtax := 0; end if; return mtax ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_IND_DLV_QTY (ls_ind in char) return number is ld_qty number(14,3); begin select nvl(sum(dlv_qty),0) into ld_qty from porddet where ind_no = ls_ind; return(ld_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_DW_FLAG_SITE_CUST ON INVOICE (DOWNLOAD_FLAG, SITE_CODE, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_MINRATE is ll_count number(6) := 0; begin begin for cur_transitstk in ( select doc_key from min_rate_history) loop begin update min_rate_history set unique_id = lpad(to_char(min_rate_seq.nextval),20,'0'); exception when others then dbms_output.put_line('Exception inner'); rollback; end; end loop; exception when others then dbms_output.put_line('Exception outer'); rollback; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_OPEN_AMOUNT ( p_sundry_code IN VARCHAR2, p_date IN DATE ) RETURN NUMBER IS result NUMBER; BEGIN SELECT SUM(nvl(CR_AMT,0) - nvl(DR_AMT,0)) INTO result FROM SUNDRYBAL WHERE sundry_code = p_sundry_code AND prd_code < (SELECT DISTINCT code FROM period WHERE p_date BETWEEN fr_date AND to_date) AND acct_prd = (SELECT DISTINCT acct_prd FROM period WHERE p_date BETWEEN fr_date AND to_date) GROUP BY SUNDRY_TYPE; RETURN result; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PDCL_QMS_DATA_X ON PDCL_QMS_DATA (SR_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DESPATCH_SORD_NO ON DESPATCH (SORD_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_MIN_STATUSCHGSCORE ON MIN_STATUSCHGSCORE (GRADE_CODE, EMP_STATUS__FROM, EMP_STATUS__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RCPBACKFLUSH_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON receipt_backflush referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_rcpbackflushcount number(3) := 0; ll_count number(6) := 0; lc_allocqty number(14,3) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_rcpbackflushcount from receipt_backflush_det f, item i where f.item_code = i.item_code and f.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_rcpbackflushcount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'R-BFS' and ref_id = :new.tran_id and eff_qty <> 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_rcpbackflushcount + 1 then raise_application_error( -20601, 'Invtrace not updated for all the details ll_invcount[' || to_char(ll_invcount) || '] ll_rcpbackflushcount [' || to_char(ll_rcpbackflushcount + 1) || ']' ); end if; ------------- allocation check to be added here begin lc_allocqty := 0; begin select sum(ALLOC_QTY) into lc_allocqty from invalloc_trace where ref_ser = 'R-BFS' and ref_id = :new.tran_id; exception when others then lc_allocqty := 0; end; if lc_allocqty <> 0 then raise_application_error( -20601, 'All allocation are not deallocated pending allocation [' || to_char(lc_allocqty) ||']'); end if; end; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RCPDISHNR_CHK BEFORE INSERT OR UPDATE OF confirmed ON rcpdishnr referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_glcount from gltrace where ref_ser = 'R-DIS' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select net_amt into lc_hdramt from rcpdishnr --where tran_id = :new.tran_id; lc_hdramt := :old.net_amt ; exception when others then lc_hdramt := 0; end; if lc_hdramt <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but net amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'R-DIS' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TWD_WRK (as_empcode char,as_prd_codefr char,as_prd_codeto char) return number is lc_tot_days number(14,3); lc_probation employee.probation%type; lc_frdate date; lc_todate date; lc_probation_date date; lc_relieve_date date; BEGIN select probation,probation_date,relieve_date into lc_probation,lc_probation_date,lc_relieve_date from employee where emp_code = as_empcode; if lc_probation <> 'Y' then return 0; end if; select fr_date into lc_frdate from period where code = as_prd_codefr; select to_date into lc_todate from period where code = as_prd_codeto; if (lc_probation_date > lc_frdate and lc_probation_date is not null) then lc_frdate := lc_probation_date; end if; if (lc_relieve_date < lc_todate and lc_relieve_date is not null) then lc_todate := lc_relieve_date; end if; select nvl(sum(work_days),0) into lc_tot_days from attd_reg where emp_code = as_empcode and attd_date >= lc_frdate and attd_date <= lc_todate; return lc_tot_days; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_POSDET_TRANFLOW (as_pos_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.QUANTITY ,b.rate,b.tax_amt,b.net_amt from item a ,posdet b where a.item_code = b.item_code__ord and b.tran_id=as_pos_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||'Tax Amount'||''||''||'Net Amount'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082960 ON UPTIME_LOG (REQUEST_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_INVUNPOST_GTPL is ll_count number(3) := 0; newacctcode char(10); ll_errorcount number(3) := 0; ldt_trandate date; ll_lineno number(3) := 1; begin ldt_trandate := to_date('01-nov-21'); for cur_tran in ( select o.TRAN_ID,o.SITE_CODE,o.FIN_ENTITY,o.ACCT_PRD,o.PRD_CODE, o.TRAN_DATE,o.REF_SER,o.REF_ID,o.ACCT_CODE,o.CCTR_CODE,o.DR_AMT,o.CR_AMT, o.CURR_CODE,o.EXCH_RATE,o.SUNDRY_CODE,o.SUNDRY_TYPE from gltrace o where o.ref_ser = 'S-INV' and o.ref_id in ( select i.invoice_id from invoice i where i.invoice_id = o.ref_id and nvl(i.confirmed,'N') = 'N' and i.tran_date >= ldt_trandate ) ) loop begin -- 1. update acctbal update acctbal set dr_amt = dr_amt - cur_tran.dr_amt, cr_amt = cr_amt - cur_tran.cr_amt, dr_amt__base = dr_amt__base - (cur_tran.dr_amt * cur_tran.exch_rate), cr_amt__base = cr_amt__base - (cur_tran.cr_amt * cur_tran.exch_rate) where acct_prd = cur_tran.acct_prd and prd_code = cur_tran.prd_code and fin_entity = cur_tran.fin_entity and site_code = cur_tran.site_code and acct_code = cur_tran.acct_code and cctr_code = cur_tran.cctr_code; exception when others then ll_errorcount := 1; dbms_output.put_line ('1 - Error update acctbal [' || cur_tran.ref_id ||']' ); goto end_message; end; if cur_tran.sundry_type <> 'O' then begin -- 2. update sundrybal update sundrybal set dr_amt = dr_amt - cur_tran.dr_amt, cr_amt = cr_amt - cur_tran.cr_amt, dr_amt__base = dr_amt__base - (cur_tran.dr_amt * cur_tran.exch_rate), cr_amt__base = cr_amt__base - (cur_tran.cr_amt * cur_tran.exch_rate) where acct_prd = cur_tran.acct_prd and prd_code = cur_tran.prd_code and fin_entity = cur_tran.fin_entity and site_code = cur_tran.site_code and sundry_type = cur_tran.sundry_type and sundry_code = cur_tran.sundry_code and acct_code = cur_tran.acct_code and cctr_code = cur_tran.cctr_code; exception when others then ll_errorcount := 1; dbms_output.put_line ('2 - Error updating sundrybal [' || cur_tran.ref_id ||']' ); goto end_message; end; end if; -- 3. check/delete receivables ll_count := 0; select count(1) into ll_count from receivables where tran_ser = 'S-INV' and ref_no = cur_tran.ref_id; if ll_count >0 then begin -- 3. delete receivables delete from receivables where tran_ser = 'S-INV' and ref_no = cur_tran.ref_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('3 - Error deleting receivables [' || cur_tran.ref_id ||']' ); goto end_message; end; end if; -- 4. delete gltran begin delete from gltran where ref_ser = 'S-INV' and ref_id = cur_tran.ref_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('4 - Error deleting gltran [' || cur_tran.ref_id ||']' ); goto end_message; end; -- 5. delete gltrace begin delete from gltrace where tran_id = cur_tran.tran_id; exception when others then ll_errorcount := 1; dbms_output.put_line ('5 - Error deleting gltrace4 [' || cur_tran.ref_id ||']' ); goto end_message; end; end loop; <> if ll_errorcount = 0 then commit; else rollback; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOC_PACKWISE (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char, lloc_code in char, lgetQV in char, lexc_opt in char, lpack_code in char) return number is ld_eff_qty NUMBER(17,3); ldt_crea_date date; ls_available varchar2(2); begin if lavailable = 'B' then ls_available := 'YN' ; else ls_available := lavailable ; end if; if ltype = 'I' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and instr(ls_available,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT (CASE WHEN lgetQV ='Q' THEN sum( a.quantity) ELSE sum( a.quantity * (CASE WHEN lexc_opt ='E' THEN nvl(a.rate,0) ELSE nvl(a.gross_rate,0) END))END)QTY from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.loc_code = lloc_code and a.item_code = litem_code and a.pack_code = lpack_code and instr(ls_available,b.available) > 0 union all select (CASE WHEN lgetQV ='Q' THEN nvl((sum (nvl(a.eff_qty,0)) * -1),0) ELSE nvl(sum ((nvl(a.eff_qty,0) * (CASE WHEN lexc_opt ='E' THEN nvl(d.rate,0) ELSE nvl(d.gross_rate,0) END)) * -1),0)END ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and d.pack_code = lpack_code and a.tran_date > ad_from_date and instr(ls_available,c.available) > 0); end if; if ltype = 'B' then select sum(qty) into ld_eff_qty from (SELECT (CASE WHEN lgetQV ='Q' THEN sum( a.quantity) ELSE sum( a.quantity * (CASE WHEN lexc_opt ='E' THEN nvl(a.rate,0) ELSE nvl(a.gross_rate,0) END)) END)QTY from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_no = llot_no and nvl(a.pack_code,'DUMMY') = lpack_code and instr(ls_available, b.available) > 0 union all select (CASE WHEN lgetQV = 'Q' THEN nvl((sum (nvl(a.eff_qty,0)) * -1),0) ELSE nvl(sum ((nvl(a.eff_qty,0) * (CASE WHEN lexc_opt ='E' THEN nvl(a.rate,0) ELSE nvl(a.gross_rate,0) END )) * -1),0) END)QTY from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and a.loc_code = lloc_code and b.inv_stat = c.inv_stat and a.tran_date > ad_from_date and instr(ls_available,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_BANK_RECO_STMT_BAL ( as_bankcode in char, ad_ason in date ) return number is lc_total number(14,3) ; lc_tot_p1 number(14,3); lc_tot_r1 number(14,3); lc_tot_p2 number(14,3); lc_tot_r2 number(14,3); begin select nvl(sum(amount-amt_adj),0) into lc_tot_p1 from banktran_log where bank_code = as_bankcode and status <> 'R' and tran_date <= ad_ason and tran_type='P'; select nvl(sum(amount-amt_adj),0) into lc_tot_r1 from banktran_log where bank_code = as_bankcode and status <> 'R' and tran_date <= ad_ason and tran_type = 'R'; select nvl(sum(amount-amt_adj),0) into lc_tot_p2 from bank_statement where bank_code = as_bankcode and status <> 'R' and eff_date <= ad_ason and tran_type = 'P'; select nvl(sum(amount-amt_adj),0) into lc_tot_r2 from bank_statement where bank_code = as_bankcode and status <> 'R' and eff_date <= ad_ason and tran_type = 'R'; lc_total := (lc_tot_p1 - lc_tot_r1 - lc_tot_p2 + lc_tot_r2) ; return lc_total ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WO_ISS_REQ_CANC_X ON WO_ISS_REQ_CANC (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_QUALDESCR (LS_QLF_CODE CHAR) return char is LS_QUALDESCR varchar2(40); begin select descr into LS_QUALDESCR from qualification where QLF_CODE =LS_QLF_CODE ; RETURN LS_QUALDESCR; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RESTR_TMPL_ADNL_DET_X ON RESTR_TMPL_ADNL_DET (TEMPLATE_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPLIT_STOCKISS_TRACE_X ON SPLITSTOCK_ISS (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_DRCR_TAX_SUM (ref_ser char , ref_no char , line_no number) return number is lc_sum number(14,3); ls_line char(3); begin ls_line := lpad(to_char(line_no),3); select sum(tax_amt) into lc_sum from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code = ref_ser and a.tran_id = ref_no and a.line_no = ls_line and b.print_tax = 'N'; return lc_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EMPNAME ( as_emp_code char ) return varchar2 is emp_name varchar2(60); ls_fname varchar2(15); begin begin select emp_fname || ' ' || emp_mname || ' ' || emp_lname into emp_name from employee where emp_code = as_emp_code; exception when no_data_found then emp_name := ''; end; RETURN emp_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RCPDET_SUMAMT (as_site varchar,as_tran_id drcr_rcp.tran_id%type, as_confirmed distord_rcp.confirmed%type,as_flag varchar) return number is finchg_amt number(14,3); begin if as_flag ='A' then SELECT nvl(SUM(drcr_rdet.drcr_amt ),0) into finchg_amt FROM drcr_rcp, invoice, receipt, rcpdet, customer,site,finent,drcr_rdet WHERE drcr_rcp.cust_code = customer.cust_code and drcr_rcp.site_code = site.site_code and receipt.tran_id = rcpdet.tran_id and drcr_rdet.tran_id__rcp = rcpdet.tran_id and drcr_rdet.INVOICE_ID = rcpdet.ref_no and rcpdet.ref_no = invoice.invoice_id and drcr_rcp.fin_entity = finent.fin_entity and drcr_rcp.site_code = as_site AND drcr_rcp.tran_id = as_tran_id AND drcr_rcp.tran_id = drcr_rdet.tran_id ; elsif as_flag ='B' then SELECT nvl(SUM(distord_rcpdet.QUANTITY * distord_rcpdet.RATE),0) into finchg_amt FROM distord_rcp, distord_rcpdet WHERE ( distord_rcpdet.tran_id = distord_rcp.tran_id ) and ( ( distord_rcp.site_code = as_site ) AND ( distord_rcp.tran_id =as_tran_id ) ) and ( distord_rcp.confirmed = as_confirmed ) GROUP BY distord_rcpdet.TRAN_ID,distord_rcpdet.dist_order; elsif as_flag ='C' then SELECT NVL(SUM(ddf_get_finchg(rcpdet.rcp_amt,(case when receipt.rcp_mode = 'Q' then to_date(receipt.eff_date,'dd-mon-yyyy hh24:mi:ss') when receipt.rcp_mode = 'D' then to_date(receipt.ref_date,'dd-mon-yyyy hh24:mi:ss') else to_date(receipt.eff_date,'dd-mon-yyyy hh24:mi:ss') end - to_date(invoice.due_date,'dd-mon-yyyy hh24:mi:ss')),invoice.cr_term,invoice.tran_date )),0) into finchg_amt FROM drcr_rcp, invoice, receipt, rcpdet, customer,site,finent,drcr_rdet WHERE drcr_rcp.cust_code = customer.cust_code and drcr_rcp.site_code = site.site_code and receipt.tran_id = rcpdet.tran_id and drcr_rdet.tran_id__rcp = rcpdet.tran_id and drcr_rdet.INVOICE_ID = rcpdet.ref_no and rcpdet.ref_no = invoice.invoice_id and drcr_rcp.fin_entity = finent.fin_entity and drcr_rcp.site_code = as_site AND drcr_rcp.tran_id = as_tran_id AND drcr_rcp.tran_id = drcr_rdet.tran_id ; end if ; return finchg_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUD_GRP_ALLODET_Y ON BUD_GRP_ALLODET (TRAN_ID, BUD_GROUP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUD_GRP_ALLODET_X ON BUD_GRP_ALLODET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MUFSUPP_REMARK (AS_TRAN_ID char) return varchar2 is a_return varchar2(200); begin A_RETURN:=''; select SIGN_REMARKS into A_RETURN from OBJ_SIGN_TRANS a where REF_SER = 'SUPP' and REF_ID =AS_TRAN_ID and line_no = (select max(LINE_NO) from OBJ_SIGN_TRANS B where B.REF_ID = A.REF_ID AND REF_SER = 'SUPP'); return A_RETURN; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_TRAN_DATE_CUST_ITEM ON INVOICE (TRAN_DATE, CUST_CODE, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PMNTEXP_PO ON PAYMENT_EXP (PURC_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_COMPARE_SITE (as_site_code in char, as_site_code__mfg in char) return char is ls_value char(1); ls_finent char(10) ; ls_finent_mfg char(10) ; begin select fin_entity into ls_finent from site where site_Code = as_site_code ; select fin_entity into ls_finent_mfg from site where site_Code = as_site_code__mfg ; if ls_finent = ls_finent_mfg then ls_value := 'Y'; else ls_value := 'N'; end if ; return (ls_value); end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_FSO5 (as_poolcode_5 in char, as_terr_descr in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(LEVEL_5.POS_CODE),0) into no_of_fso FROM TERRITORY T, ORG_STRUCTURE LEVEL_5 WHERE TRIM(T.TERR_CODE)=TRIM(LEVEL_5.POOL_CODE) AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND LEVEL_5.POOL_CODE = as_poolcode_5 AND T.DESCR = as_terr_descr GROUP BY T.TERR_CODE; return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082956 ON SQL_EXEC_LOG (TRAN_ID, ENTERPRISE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_FSO4 (as_poolcode_4 in char, as_terr_descr in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(LEVEL_5.POS_CODE),0) into no_of_fso FROM TERRITORY T, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5 WHERE TRIM(T.TERR_CODE)=TRIM(LEVEL_5.POOL_CODE) AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND LEVEL_4.POOL_CODE = as_poolcode_4 AND T.DESCR = as_terr_descr GROUP BY T.TERR_CODE; return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_FSO3 (as_poolcode_3 in char, as_terr_descr in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(LEVEL_5.POS_CODE),0) into no_of_fso FROM TERRITORY T, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5 WHERE TRIM(T.TERR_CODE)=TRIM(LEVEL_5.POOL_CODE) AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND LEVEL_3.POOL_CODE = as_poolcode_3 AND T.DESCR = as_terr_descr GROUP BY T.TERR_CODE; return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_FSO2 (as_poolcode_2 in char, as_terr_descr in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(LEVEL_5.POS_CODE),0) into no_of_fso FROM TERRITORY T, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5 WHERE TRIM(T.TERR_CODE)=TRIM(LEVEL_5.POOL_CODE) AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND LEVEL_2.POOL_CODE = as_poolcode_2 AND T.DESCR = as_terr_descr GROUP BY T.TERR_CODE; return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DF_GETCUSTNAMEFROMWRKORD (P_WORK_ORDER IN VARCHAR2) RETURN VARCHAR2 IS custname VARCHAR2(100); BEGIN SELECT cust.CUST_NAME INTO custname FROM customer cust JOIN sorder s ON cust.cust_code = s.cust_code JOIN workorder w ON w.sale_order = s.sale_order WHERE TRIM(w.work_order) = TRIM(P_WORK_ORDER) FETCH FIRST 1 ROWS ONLY; RETURN custname; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'no data found'; WHEN OTHERS THEN RETURN SQLERRM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BREAKSTRING (tran_id porder.purc_order%type, as_itmcode item.item_code%type, as_line porddet.line_no%type) return varchar2 is ls_string varchar2(500); ls_datas varchar2(500); ls_newdatas varchar2(500); ls_string1 varchar2(500); begin select spec_metadata into ls_string from porddet where purc_order = tran_id and item_code = as_itmcode and line_no = as_line; if length(ls_string) > 0 then while length(ls_string) > 0 loop select ddf_get_token(ls_string,'/l/')into ls_datas from dual; --dbms_output.put_line('ls_string ::: ' || length(ls_string)); ls_newdatas := ls_newdatas || ls_datas || chr(10); ls_string1 := substr(ls_string,length(ls_datas)+5,LENGTH(ls_string)); ls_string := ls_string1; --dbms_output.put_line('ls_string1 ::: ' || ls_string1); end loop; end if; return ls_newdatas; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESPATCHFLAG ( as_desp_id in char, as_item_code in char) return char is ls_flag char(1); lc_rate number(14,3); lc_cnt number(2); begin begin select count(*) into lc_cnt from scheme_applicability where scheme_code in( select item_code__ord from despatchdet where desp_id = as_desp_id ); if lc_cnt > 0 then ls_flag := 'N'; else ls_flag := 'Y'; end if; Exception when NO_DATA_FOUND then ls_flag := 'Y'; return ls_flag; end; return ls_flag; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_WOI_WO ON WORKORDER_ISS (WORK_ORDER, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_SO_TERM_TBLDET ON SO_TERM_TBLDET (TERM_TABLE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_REFSER_RATE (as_ref_ser in char, as_ref_id in char, as_item_code in char, as_site_code in char, as_line_no in char) return number is mrate number(14,3); begin if as_ref_ser = 'S-DSP' then -- select nvl(rate__stduom,0) into mrate -- from despatchdet, despatch -- where despatch.desp_id = as_ref_id -- and despatch.site_code = as_site_code -- and despatchdet.desp_id = despatch.desp_id -- and despatchdet.item_code = as_item_code -- and despatchdet.line_no = as_line_no; select nvl(rate,0) into mrate from invoice_trace, despatch where invoice_trace.desp_id = as_ref_id and invoice_trace.desp_id = despatch.desp_id and despatch.site_code = as_site_code and invoice_trace.desp_line_no = as_line_no and invoice_trace.item_code = as_item_code ; elsif as_ref_ser = 'S-RET' then select nvl(rate__stduom,0) into mrate from sreturndet, sreturn where sreturn.tran_id = as_ref_id and sreturn.site_code = as_site_code and sreturndet.tran_id = sreturn.tran_id and sreturndet.item_code = as_item_code and sreturndet.line_no = to_number(as_line_no); elsif as_ref_ser = 'P-RCP' or as_ref_ser = 'P-RET' then select nvl(rate__stduom,0) into mrate from porcpdet, porcp where porcp.tran_id = as_ref_id and porcp.site_code = as_site_code and porcpdet.tran_id = porcp.tran_id and porcpdet.item_code = as_item_code and porcpdet.line_no = as_line_no; else select nvl(rate,0) into mrate from invtrace where invtrace.ref_id = as_ref_id and invtrace.site_code = as_site_code and invtrace.item_code = as_item_code and invtrace.ref_line = as_line_no and rownum = 1; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RECEIPT_PAY_IN_SLIP_X ON RECEIPT_PAY_IN_SLIP (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SYSBASE_MSG_SITE ON SYSBASE_MSG (SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C00152286 ON WO_OBSRV_HDR (TRAN_ID, WORK_ORDER, OPERATION, SEQ_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUPPLYTYPE (as_refser in char, as_refid in char, as_countryfrom in char, as_countryto in char, as_sitecode in char) RETURN VARCHAR IS ls_retval varchar2(6); ls_taxclass taxclass.tax_class%type; ls_supptype char(1); ls_refid invoice.invoice_id%type; ls_refser taxtran.tran_code%type; ls_eou char(1); begin /* 1 B2B - B2B 2 Export with Payment - EXPWP 3 Export without payment - EXPWOP 4 SEZ with payment - SEZWP 5 SEZ without payment - SEZWOP 6 Deemed Export - DEXP */ ls_refser := trim(as_refser); ls_refid := trim(as_refid); select nvl(s.eou,'N') into ls_eou from site s where s.site_code = as_sitecode; if ls_eou is null then ls_eou :='N'; end if; if trim(as_countryfrom) = trim(as_countryto) and ls_eou ='N' then return 'B2B'; else if trim(ls_refser) = 'S-INV' then begin select tax_class into ls_taxclass from invoice where invoice_id = ls_refid; exception when others then ls_taxclass := ' '; end; if ls_taxclass is null or length(trim(ls_taxclass)) is null or length(trim(ls_taxclass)) = 0 then begin select tax_class into ls_taxclass from invoice_trace where invoice_id = ls_refid and line_no = 1; exception when others then ls_taxclass := ' '; end; end if; end if; if ls_taxclass is not null and length(trim(ls_taxclass)) is not null and length(trim(ls_taxclass)) > 0 then begin select supp_type into ls_supptype from taxclass where tax_class = ls_taxclass; exception when others then ls_supptype := '1'; end; if ls_supptype is null or ls_supptype = ' ' then ls_supptype := '1'; end if; if ls_supptype = '1' then ls_retval := 'B2B'; elsif ls_supptype = '2' then ls_retval := 'EXPWP'; elsif ls_supptype = '3' then ls_retval := 'EXPWOP'; elsif ls_supptype = '4' then ls_retval := 'SEZWP'; elsif ls_supptype = '5' then ls_retval := 'SEZWOP'; elsif ls_supptype = '6' then ls_retval := 'DEXP'; else ls_retval := 'B2B'; end if; else ls_retval := 'B2B'; end if; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_HRS_TO_MIN (A_HRS IN NUMBER) RETURN NUMBER IS R_MIN NUMBER(10); C_HRS NUMBER(10,2); N_SIGN NUMBER(1); I_PART1 NUMBER(10); I_PART2 NUMBER(10); BEGIN C_HRS := A_HRS; R_MIN := 0; IF C_HRS <> 0 THEN IF C_HRS < 0 THEN N_SIGN := -1; C_HRS := ABS(C_HRS); END IF; END IF; I_PART1 := FLOOR(C_HRS / 1); I_PART2 := ((C_HRS - (I_PART1)) * 100); R_MIN := (I_PART1 * 60) + (I_PART2); RETURN R_MIN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_VOUC_DUEDATE (lsref_ser char,lsref_id char) return date is ld_date date; begin if lsref_ser = 'M-VOUC' then select due_date into ld_date from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; end if; return ld_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUNDRYBAL (as_sitecode in char, as_sundrytype in char, as_sundrycode in char, adt_fromdate in date) return number is lc_opbal number(14,3) := 0; lc_curbal number(14,3) := 0; ls_prdcode char(6); ls_acctprd char(6); adt_todate date; begin begin select code, acct_prd, to_date into ls_prdcode, ls_acctprd, adt_todate from period where adt_fromdate between fr_date and to_date; exception when others then ls_prdcode := ''; ls_acctprd := ''; end; begin select sum(DR_AMT - CR_AMT) into lc_opbal from sundrybal where site_code = as_sitecode and sundry_type = as_sundrytype and sundry_code = as_sundrycode and prd_code <= ls_prdcode and acct_prd = ls_acctprd; exception when others then lc_opbal := 0; end; begin select sum(dr_amt - cr_amt) into lc_curbal from gltrace where site_code = as_sitecode and sundry_type = as_sundrytype and sundry_code = as_sundrycode and tran_date >= adt_fromdate and tran_date <= adt_todate; exception when others then lc_curbal := 0; end; if lc_opbal is null then lc_opbal := 0; end if; if lc_curbal is null then lc_curbal := 0; end if; lc_opbal := lc_opbal - lc_curbal; if lc_opbal is null then lc_opbal := 0; end if; return lc_opbal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER MISCDRCR_AFTER_INS_UPD AFTER UPDATE of confirmed ON MISC_DRCR_RCP FOR EACH ROW DECLARE CONFVAL CHAR(1); REFCOUNT NUMBER(10,2) DEFAULT 0; SRETURN VARCHAR(10); BEGIN SELECT COUNT(REF_ID) INTO REFCOUNT FROM DWH_TRAN_LOAD WHERE REF_ID=:NEW.TRAN_ID AND REF_SER='S-INV' ;--AND REF_DATE=:NEW.TRAN_DATE AND UPDATE_STAT='P' ; CONFVAL:=:NEW.CONFIRMED; SRETURN:=:NEW.SRETURN_NO; IF(CONFVAL = 'Y' AND TRIM(SRETURN) is null) THEN -- Insert record into DWH_TRAN_LOAD table INSERT INTO DWH_TRAN_LOAD ( REF_ID, REF_SER, REF_DATE, UPDATE_STAT ) VALUES ( :NEW.TRAN_ID, :NEW.TRAN_SER, :NEW.TRAN_DATE, 'P' ); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EXP_WALLET_SMS_X ON EXP_WALLET_SMS (EXP_WALLET, SEQ_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TAX_BOND_DATE (as_tran_code char,as_tran_id char,as_tax_code char) return date is ld_tax_form_date date; ls_var_value varchar2(30); ls_tax_form_date varchar2(30); ls_errcode varchar2(30); begin select distinct tax_form_date into ld_tax_form_date from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code ; if ld_tax_form_date='' then ls_tax_form_date:=''; end if; return ld_tax_form_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PURCHASE_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON PORCP referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; BEGIN if :new.confirmed = 'Y' then begin -- porcp and poreturn begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_PORCP'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_porcp in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM PORCPDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id ) loop if cur_porcp.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; -- end of varvalue if if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from porcpdet where tran_id = :new.tran_id; exception when others then ll_count:= 0; end; if (:new.tran_ser = 'P-RCP') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'P-RCP' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; end if; if (:new.tran_ser = 'P-RET') then begin select count(1) into ll_glcount from gltrace where ref_ser = 'P-RET' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; end if; if ll_count > 0 then begin SELECT sum(rate * quantity) into lc_rate FROM porcpdet where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR if (:new.tran_ser = 'P-RCP') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'P-RCP' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if; if (:new.tran_ser = 'P-RET') then begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'P-RET' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; end if ; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; -- count end end; end if ;-- end of varvalue if end if;--end exit end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_AUDT_USRDATE ON AUDIT_TRAIL (CHG_USER, CHG_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 6291456 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETSHIFTTIME (attd_date In date, flag in varchar, EMP_CODE in varchar ) Return Varchar2 Is shifttime Varchar2(10); getShift varchar2(10); Begin select ddf_hr_status (EMP_CODE ,attd_Date, 'H') as shft into getShift from dual; if flag='IN' then select b.in_time into shiftTime from workshft b where b.shift=getShift and day_no = to_char(to_date(attd_Date, 'dd-mm-yyyy'), 'D') ; else select b.out_time into shiftTime from workshft b where b.shift=getShift and day_no = to_char(to_date(attd_Date, 'dd-mm-yyyy'), 'D') ; end if; Return shiftTime; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX JOURNAL_REF_SER_NO ON JOURNAL (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXCRT_STNRCPTAX (as_tran_code in char,as_tran_id in char) return number is lc_tax_amt number(14,2); Begin Select nvl(sum(tax_amt),0) into lc_tax_amt from ( SELECT nvl(sum(tax_amt),0) tax_amt FROM taxtran, tax WHERE ( taxtran.tax_code = tax.tax_code ) and ( ( tran_code = as_tran_code ) AND ( tran_id = as_tran_id ) ) GROUP BY taxtran.tax_perc, tax.descr, taxtran.line_no__tax ) ; Return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_OVER_SHIPPED (as_despid in Despatch.desp_id%type) RETURN NUMBER IS lc_sordqty number(14,3) := 0; lc_despatchedqty number(14,3) := 0; ll_mismatchcount number(3) := 0; lc_overshipperc number(14,3) := 0; lc_extraallowed number(14,3) := 0; begin begin for cur_despdet in ( select SORD_NO,LINE_NO__SORD,EXP_LEV,sum(quantity) as quantity from despatchdet where desp_id = as_despid group by SORD_NO,LINE_NO__SORD,EXP_LEV ) loop begin lc_sordqty := 0; lc_despatchedqty := 0; begin select quantity,qty_desp into lc_sordqty,lc_despatchedqty from sorditem where sale_order = cur_despdet.SORD_NO and line_no = cur_despdet.LINE_NO__SORD and exp_lev = cur_despdet.EXP_LEV; exception when others then lc_sordqty := 0; lc_despatchedqty := 0; end; begin Select over_ship_perc into lc_overshipperc From sorddet Where sale_order = cur_despdet.SORD_NO And line_no = cur_despdet.LINE_NO__SORD ; exception when others then lc_overshipperc := 0; end; if lc_overshipperc is null then lc_overshipperc := 0; end if; if lc_sordqty is null then lc_sordqty := 0; end if; if lc_despatchedqty is null then lc_despatchedqty := 0; end if; if lc_overshipperc <> 0 then lc_extraallowed := CEIL(lc_sordqty * lc_overshipperc / 100) ; end if; if lc_extraallowed is null then lc_extraallowed := 0; end if; if (lc_despatchedqty + cur_despdet.quantity) > (lc_sordqty + lc_extraallowed) then ll_mismatchcount := ll_mismatchcount + 1; end if; end; end loop; exception when others then null; end; RETURN ll_mismatchcount ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NON_ECO_DET (LS_SC_CODE IN CHAR) RETURN VARCHAR2 IS LS_NON_ECO_DET VARCHAR2(220); LS_REC_CNT NUMBER(5); BEGIN SELECT COUNT(*) INTO LS_REC_CNT FROM STRG_CUST_EXCEPTION WHERE SC_CODE = LS_SC_CODE AND (PRODUCT_CODE IS NULL OR UPPER(PRODUCT_CODE) = 'NULL') AND (ITEM_CODE IS NULL OR UPPER(ITEM_CODE) = 'NULL') AND EXCEP_FLAG = '1'; IF LS_REC_CNT > 0 THEN SELECT ('CUST-' || STRG_SER.SC_CODE || '_SEP_' || ROUND(SYSDATE - NVL(STRG_SER.LAST_ORDER_DATE, SYSDATE+1))) INTO LS_NON_ECO_DET FROM STRG_CUST_EXCEPTION STRG_CUST_EXCP, STRG_SERIES STRG_SER WHERE STRG_CUST_EXCP.SC_CODE = STRG_SER.SC_CODE AND STRG_CUST_EXCP.SC_CODE = LS_SC_CODE AND (STRG_CUST_EXCP.PRODUCT_CODE IS NULL OR UPPER(STRG_CUST_EXCP.PRODUCT_CODE) = 'NULL') AND (STRG_CUST_EXCP.ITEM_CODE IS NULL OR UPPER(STRG_CUST_EXCP.ITEM_CODE) = 'NULL') AND EXCEP_FLAG = '1' AND ROWNUM <= 1; ELSE SELECT COUNT(*) INTO LS_REC_CNT FROM STRG_CUST_EXCEPTION WHERE SC_CODE = LS_SC_CODE AND PRODUCT_CODE IS NOT NULL AND (ITEM_CODE IS NULL OR UPPER(ITEM_CODE) = 'NULL') AND EXCEP_FLAG = '1'; IF LS_REC_CNT > 0 THEN SELECT ('PROD-' || LISTAGG( TRIM(PROD.DESCR) || '_SEP_' || ROUND(SYSDATE - NVL(STRG_PROD.LAST_ORDER_DATE, SYSDATE+1)),',') WITHIN GROUP (ORDER BY STRG_PROD.LAST_ORDER_DATE)) INTO LS_NON_ECO_DET FROM STRG_CUST_EXCEPTION STRG_CUST_EXCP, STRG_PRODUCT STRG_PROD, PRODUCT PROD WHERE STRG_CUST_EXCP.SC_CODE = STRG_PROD.SC_CODE AND STRG_CUST_EXCP.PRODUCT_CODE = STRG_PROD.PRODUCT_CODE AND PROD.PRODUCT_CODE = STRG_PROD.PRODUCT_CODE AND STRG_CUST_EXCP.SC_CODE = LS_SC_CODE AND (STRG_CUST_EXCP.PRODUCT_CODE IS NOT NULL OR UPPER(STRG_CUST_EXCP.PRODUCT_CODE) != 'NULL') AND (STRG_CUST_EXCP.ITEM_CODE IS NULL OR UPPER(STRG_CUST_EXCP.ITEM_CODE) = 'NULL') AND (STRG_PROD.ITEM_CODE IS NULL OR UPPER(STRG_PROD.ITEM_CODE) = 'NULL') AND EXCEP_FLAG = '1' AND ROWNUM <= 5; ELSE SELECT COUNT(*) INTO LS_REC_CNT FROM STRG_CUST_EXCEPTION WHERE SC_CODE = LS_SC_CODE AND (PRODUCT_CODE IS NOT NULL OR UPPER(PRODUCT_CODE) != 'NULL') AND (ITEM_CODE IS NOT NULL OR UPPER(ITEM_CODE) != 'NULL') AND EXCEP_FLAG = '1'; IF LS_REC_CNT > 0 THEN SELECT ('ITEM-' || LISTAGG( TRIM(ITEM.DESCR) || '_SEP_' || ROUND(SYSDATE - NVL(STRG_PROD.LAST_ORDER_DATE, SYSDATE+1)),',') WITHIN GROUP (ORDER BY STRG_PROD.LAST_ORDER_DATE)) INTO LS_NON_ECO_DET FROM STRG_CUST_EXCEPTION STRG_CUST_EXCP, STRG_PRODUCT STRG_PROD, ITEM ITEM WHERE STRG_CUST_EXCP.SC_CODE = STRG_PROD.SC_CODE AND STRG_CUST_EXCP.PRODUCT_CODE = STRG_PROD.PRODUCT_CODE AND STRG_CUST_EXCP.ITEM_CODE = STRG_PROD.ITEM_CODE AND ITEM.ITEM_CODE = STRG_PROD.ITEM_CODE AND STRG_CUST_EXCP.SC_CODE = LS_SC_CODE AND (STRG_CUST_EXCP.PRODUCT_CODE IS NOT NULL OR UPPER(STRG_CUST_EXCP.PRODUCT_CODE) != 'NULL') AND (STRG_CUST_EXCP.ITEM_CODE IS NOT NULL OR UPPER(STRG_CUST_EXCP.ITEM_CODE) != 'NULL') AND EXCEP_FLAG = '1' AND ROWNUM <= 5; END IF; END IF; END IF; RETURN LS_NON_ECO_DET; EXCEPTION WHEN TOO_MANY_ROWS THEN RETURN ' '; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUSTOMER_TDSPERC_SRETURN (AS_CUST_CODE__BIL CHAR,AS_CUST_CODE CHAR,AS_TAX_DATE DATE,AS_TRAN_DATE DATE, AS_TRAN_TYPE CHAR) RETURN NUMBER IS LS_RETURN NUMBER (14,3) := 0; V_PAN_NO CUSTOMER.PAN_NO%TYPE; V_TAX_CLASS CUSTOMER.TAX_CLASS%TYPE; V_TAX_DATE DATE; V_CUST_CODE CHAR(10); LS_COUNT NUMBER(10); ls_var_value DISPARM.VAR_VALUE%TYPE; BEGIN ---Check if tran type is Full return type. If match with disparm value then TCS value will be returned select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = 'SRET_FULL_TRANTYPE'; SELECT (CASE WHEN trim(AS_TRAN_TYPE) IN (SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value))) THEN 1 ELSE 0 END) INTO LS_COUNT FROM DUAL; IF LS_COUNT =0 and AS_TRAN_TYPE is not null THEN LS_RETURN :=0 ; RETURN LS_RETURN; ELSE --If cust code bill is null the cust_cod will be set IF AS_CUST_CODE__BIL IS NOT NULL THEN V_CUST_CODE := AS_CUST_CODE__BIL; ELSE V_CUST_CODE := AS_CUST_CODE; END IF; --If method is called on despatch then desp date will be not null and date will be set as desp date --If method is called on other than despatch transaction then tax date will be set if tax date is also null then tran date will be set --- IF AS_DESP_DATE IS NOT NULL THEN --- V_TAX_DATE := AS_DESP_DATE; IF AS_TAX_DATE IS NOT NULL THEN V_TAX_DATE := AS_TAX_DATE; ELSE V_TAX_DATE := AS_TRAN_DATE; END IF; -- Return the Pan no and tax class from customer master SELECT NVL(PAN_NO,'PANNOTAVBL'), NVL(TAX_CLASS,'BLANK') INTO V_PAN_NO, V_TAX_CLASS FROM CUSTOMER WHERE CUST_CODE = V_CUST_CODE; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'T1SSM' AND V_TAX_DATE >= TO_DATE('01-JUL-2021','DD-MON-YYYY') THEN LS_RETURN := 0.1 ; END IF; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'T1SSM' AND V_TAX_DATE < TO_DATE('01-JUL-2021','DD-MON-YYYY') THEN LS_RETURN := 0 ; END IF; IF V_TAX_CLASS <> 'T1SSM' THEN LS_RETURN := 0 ; END IF; END IF; RETURN LS_RETURN; EXCEPTION WHEN OTHERS THEN LS_RETURN := 0 ; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDER_PROV_ID_CONF ON PORDER (PURC_ORDER, PROVI_TRAN_ID, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SL_PERS_NAME ( as_level_code in char) return char is ls_name char(500); --ls_empcode varchar2(20); ls_fname varchar2(20); ls_lname varchar2(20); li_ctr number(1); cursor c1 is select b.emp_fname,b.emp_lname from hierarchy_det a, employee b where a.level_code = as_level_code and a.sales_pers = b.emp_code; begin li_ctr := 0; open c1 ; loop fetch c1 into ls_fname, ls_lname; li_ctr := li_ctr + 1; exit when c1%notfound; if li_ctr = 1 then ls_name := rtrim(ltrim(ls_fname))||' '||rtrim(ltrim(ls_lname)); else ls_name := rtrim(ltrim(ls_name))||', '||rtrim(ltrim(ls_fname))||' '||rtrim(ltrim(ls_lname)); end if; end loop; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_INV_FLDS (minvoice_id varchar2,value_of varchar2) return varchar2 as ret_value varchar2(15); Begin if value_of = 'gross_amt' then --Total Gross Amount Begin select ROUND(inv_amt,2) into ret_value from invoice where invoice_id = minvoice_id; End; elsif value_of = 'sp_disc_amt' then -- Special Discount Amount (on PTS) Begin null; End; elsif value_of = 'vat_mrp' then --VAT (MRP) Begin select null into ret_value from dual; End; elsif value_of = 'vat_pts' then --VAT (PTS) Begin select ROUND(tax_amt,2) into ret_value from invoice where invoice_id = minvoice_id; End; elsif value_of = 'vat_free_good' then --VAT on Free Goods Begin SELECT to_char(NVL(sum(ROUND(TAXTRAN.tax_amt,2)),0)) into ret_value from TAXTRAN ,invoice_trace,tax where tax.tax_code = taxtran.tax_code and taxtran.tran_code = 'S-INV' and taxtran.tran_id = invoice_trace.invoice_id and taxtran.line_no = invoice_trace.line_no and invoice_trace.invoice_id = minvoice_id and (invoice_trace.rate = 0 and invoice_trace.tax_amt > 0 AND TAXTRAN.tax_code not like '%OCT%') and taxtran.tax_amt <> 0 and ( tax.print_tax = 'Y' ); End; elsif value_of = 'octroi_reim' then --Octroi Reimbursement Begin SELECT to_char(sum(nvl(ROUND(TAXTRAN.TAX_AMT,2),0))) into ret_value FROM TAXTRAN WHERE taxtran.tran_code = 'S-INV' and taxtran.tran_id = minvoice_id and TAXTRAN.TAX_CODE LIKE '%OCT%' AND taxtran.tax_amt <> 0; End; elsif value_of = 'debit_note_amt' then --Debit Note Amount Begin SELECT ddf_inv_drcr_adj(minvoice_id,'DRNRCP','MDRCRD','INV_AMT') into ret_value from dual; End; elsif value_of = 'cr_note_amt_1' then --Credit Note One - Amount (PTS) Begin SELECT ddf_inv_drcr_adj(minvoice_id,'CRNRCP','MDRCRC','INV_AMT') into ret_value from dual; End; elsif value_of = 'any_other' then --Any other +/- Begin select '' into ret_value from dual; End; elsif value_of = 'bill_disc_perc' then --Bill Discount Percentage Begin select '' into ret_value from dual; End; elsif value_of = 'bill_disc_amt' then --Bill Discount Amount Begin select '' into ret_value from dual; End; elsif value_of = 'round_off' then --Round Off Begin select round_adj into ret_value from invoice where invoice_id = minvoice_id; End; elsif value_of = 'bill_disc_amt' then --Bill Discount Amount Begin select ROUND(disc_amt,2) into ret_value from invoice where invoice_id = minvoice_id; End; elsif value_of = 'net_amount' then --Bill Discount Amount Begin select net_amt into ret_value from invoice where invoice_id = minvoice_id; End; --For record type T elsif value_of = 'val_applied_on' then --VAT applied on Begin select '' into ret_value from dual; End; elsif value_of = 'excise_duity' then --Excise Duty Begin select '' into ret_value from dual; End; elsif value_of = 'sp_disc_amt_pts' then --Special Discount Amount on PTS Begin select '' into ret_value from dual; End; End if; return ret_value ; End fn_get_inv_flds; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INCIDENTTYPE_X ON INCIDENTTYPE (INCIDENT_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GROSS_AMT (as_tran_id char,as_type char) return NUMBER is lc_gross_amt NUMBER(15,3); ld_tax_total NUMBER(15,3); ld_cost_total NUMBER(15,3); ls_type CHAR(3); begin if as_type='D' then select nvl(sum(quantity__stduom * rate__stduom),0) into lc_gross_amt from despatchdet where desp_id = as_tran_id; elsif as_type='I' then select order_type into ls_type from distord_iss where tran_id = as_tran_id; if SUBSTR(ls_type,1,1) = 'E' then select nvl(sum(quantity * rate__clg),0) into lc_gross_amt from distord_issdet where tran_id = as_tran_id; else select nvl(sum(quantity * rate),0) into lc_gross_amt from distord_issdet where tran_id = as_tran_id; end if; elsif as_type='P-RET' then ld_cost_total:=0; select nvl(sum(porcpdet.quantity__stduom*porcpdet.rate__stduom) -sum(porcpdet.quantity__stduom*porcpdet.rate__stduom*porcpdet.discount)/100 ,0) into ld_cost_total from porcpdet where tran_id = as_tran_id; if ld_cost_total='' then ld_cost_total:=0; end if; select nvl(sum(tax_amt) ,0) into ld_tax_total from taxtran where tran_id =as_tran_id and tran_code=as_type and effect <> 'N'; if ld_tax_total='' then ld_tax_total:=0; end if; lc_gross_amt:= ld_cost_total + ld_tax_total; elsif as_type='DRNRCP' then select nvl(sum(drcr_amt),0) into lc_gross_amt from drcr_rdet where tran_id =as_tran_id; else lc_gross_amt:= ''; end if; if lc_gross_amt='' then lc_gross_amt:= 0; end if; return lc_gross_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_TAX_ENV ( IN_string IN VARCHAR2, IN_date IN DATE, -- Invoice date IN_tran_code IN VARCHAR2, IN_tran_date IN DATE -- Transaction date ) RETURN NUMBER IS v_result NUMBER := 0; v_setting VARCHAR2(1); v_cutoff_date DATE; v_fin_year VARCHAR2(7); BEGIN IF TRIM(IN_string) = 'SR' THEN -- Check config SELECT NVL(VAR_VALUE, 'N') INTO v_setting FROM disparm WHERE VAR_NAME = 'SRET_INVREF_MANDATORY' AND PRD_CODE = '999999'; IF v_setting = 'Y' THEN -- Calculate financial year based on invoice date IF EXTRACT(MONTH FROM IN_date) <= 3 THEN -- Jan–Mar → belongs to previous FY (e.g., Feb-2024 → 2023-24) v_fin_year := TO_CHAR(IN_date, 'YYYY') - 1 || '-' || TO_CHAR(IN_date, 'YY'); ELSE -- Apr–Dec → same FY (e.g., Dec-2024 → 2024-25) v_fin_year := TO_CHAR(IN_date, 'YYYY') || '-' || ( TO_CHAR(IN_date, 'YY') + 1) ; END IF; -- Build cutoff date: 31-OCT of second year v_cutoff_date := TO_DATE('31-OCT-' || SUBSTR(v_fin_year, 6, 2), 'DD-MON-RR'); IF IN_tran_date > v_cutoff_date AND TRIM(IN_tran_code) <> 'GSTEXP' THEN v_result := 1; END IF; END IF; END IF; RETURN v_result; EXCEPTION WHEN OTHERS THEN RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_WOFF_LVE_COMB (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select a.lve_code,a.lve_date_fr,a.lve_date_to,a.leave_starts,a.leave_ends,b.payable from empleave a,leaves b where a.lve_code = b.lve_code and a.emp_code = AS_EMP_CODE and AS_DATE between a.lve_date_fr and a.lve_date_to and a.status = 'A' and a.use_flag = 'C' order by a.lve_date_fr,a.lve_date_to; cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and AS_DATE between date_from and date_to and status = 'A' order by date_from,date_to; a_status char(2); a_hol_tblno holiday.hol_tblno%type := ddf_get_holtblno(AS_EMP_CODE,AS_DATE); a_count number(5); a_count1 number(5); a_first char(1); a_second char(1); begin for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> AS_DATE and i.lve_date_to <> AS_DATE) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = AS_DATE and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = AS_DATE and i.leave_ends = 'E') then if (i.payable = 'Y') then a_status := 'LL'; else a_status := 'AA'; end if; return a_status; else if (i.lve_date_fr = AS_DATE and i.leave_starts = 'B') then if (i.payable = 'Y') then a_first := 'L'; else a_first := 'A'; end if; elsif (i.lve_date_fr = AS_DATE and i.leave_starts = 'M') then if (i.payable = 'Y') then a_second := 'L'; else a_second := 'A'; end if; elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'M') then if (i.payable = 'Y') then a_first := 'L'; else a_first := 'A'; end if; elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'E') then if (i.payable = 'Y') then a_second := 'L'; else a_second := 'A'; end if; end if; end if; end loop; for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> AS_DATE and i.date_to <> AS_DATE) or (i.date_from <> i.date_to and i.date_from = AS_DATE and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = AS_DATE and i.tour_ends = 'E') then a_status := 'TT'; return a_status; else if (i.date_from = AS_DATE and i.tour_starts = 'S') then a_first := 'T'; elsif (i.date_from = AS_DATE and i.tour_starts = 'B') then a_second := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'B') then a_first := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'E') then a_second := 'T'; end if; end if; end loop; if (a_first is null) and (a_second is not null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= (ddf_time_in_mm(b.in_time)+b.grace_time)) and (ddf_time_in_mm(a.out_time) >= (ddf_time_in_mm(b.in_time)+(b.hd_hrs*60))); if (a_count = 0) then a_first := 'A'; else a_first := 'P'; end if; elsif (a_first is not null) and (a_second is null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= ddf_time_in_mm(b.hd_in_time)) and (ddf_time_in_mm(a.out_time) >= (case when (b.out_time < b.hd_in_time) then (ddf_time_in_mm(b.out_time)+1440) else ddf_time_in_mm(b.out_time) end)); if (a_count = 0) then a_second := 'A'; else a_second := 'P'; end if; elsif (a_first is null) and (a_second is null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= (ddf_time_in_mm(b.in_time)+b.grace_time)) and (ddf_time_in_mm(a.out_time) >= (case when (b.out_time < b.in_time) then (ddf_time_in_mm(b.out_time)+1440) else ddf_time_in_mm(b.out_time) end)); if (a_count <> 0) then a_status := 'PP'; return a_status; end if; select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= (ddf_time_in_mm(b.in_time)+b.grace_time)) and (ddf_time_in_mm(a.out_time) >= (ddf_time_in_mm(b.in_time)+(b.hd_hrs*60))); if (a_count <> 0) then a_status := 'PA'; return a_status; end if; select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and (ddf_time_in_mm(a.in_time) <= ddf_time_in_mm(b.hd_in_time)) and (ddf_time_in_mm(a.out_time) >= (case when (b.out_time < b.hd_in_time) then (ddf_time_in_mm(b.out_time)+1440) else ddf_time_in_mm(b.out_time) end)); if (a_count <> 0) then a_status := 'AP'; return a_status; end if; a_status := 'AA'; return a_status; end if; a_status := a_first || a_second; return a_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GENCODE_DESC ( as_fld_name in char , as_mod_name in char , as_fld_value in char , as_descr char ) return char is ls_retval varchar(120) ; begin select decode(as_descr, 'D', descr, sh_descr) into ls_retval from gencodes where fld_name = as_fld_name and fld_value = as_fld_value and ( mod_name = as_mod_name or mod_name ='X' ) ; return ls_retval ; exception when too_many_rows then return ' ' ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_PRCP BEFORE UPDATE of confirmed ON porcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from porcpdet where tran_id = :tran_id'; OPEN cur_out FOR ls_sql USING :new.tran_id ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = :new.TRAN_SER and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = :new.TRAN_SER and tran_id = :new.tran_id and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STATUTORY_IT_DET_X ON STATUTORY_IT_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_FW_CNT (AS_OPT CHAR, AS_SALES_PERS CHAR, AS_DATE DATE, AS_TYPE CHAR) RETURN NUMBER IS FW_CNT NUMBER; AS_FR_DATE DATE; AS_TO_DATE DATE; FWD NUMBER; TOTAL_FW NUMBER; FW_AVG NUMBER; BEGIN IF AS_OPT = 'MTD' THEN SELECT COUNT(1) INTO FW_CNT FROM SPRS_ACT_TRAN SAT, FIELDACTIVITY F WHERE SAT.SALES_PERS = AS_SALES_PERS AND SAT.ACTIVITY_CODE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SAT.CONFIRMED = 'Y' AND TO_CHAR(TO_DATE(SAT.EVENT_DATE),'mm/yy')= TO_CHAR(TO_DATE(AS_DATE,'dd/mm/yy'),'mm/yy'); END IF; IF AS_OPT = 'YTD' THEN SELECT FR_DATE, TO_DATE(AS_DATE) INTO AS_FR_DATE, AS_TO_DATE FROM ACCTPRD WHERE TO_DATE(AS_DATE) BETWEEN FR_DATE AND TO_DATE; SELECT PARAM_VALUE into AS_FR_DATE FROM KPI_PARAM WHERE PARAM_NAME = 'SHINE_DB_STDATE' AND MOD_NAME = 'W_CUSTOM_DATE'; SELECT COUNT(1) INTO FW_CNT FROM SPRS_ACT_TRAN SAT, FIELDACTIVITY F WHERE SAT.SALES_PERS = AS_SALES_PERS AND SAT.ACTIVITY_CODE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SAT.CONFIRMED = 'Y' AND SAT.EVENT_DATE BETWEEN AS_FR_DATE AND AS_TO_DATE; END IF; RETURN FW_CNT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISC_RECEIPT_CHK BEFORE INSERT OR UPDATE OF confirmed ON misc_receipt referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_detcount number(3) := 0; ll_advcount number(3) := 0; ll_acctcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_glcount from gltrace where ref_ser = 'M-RCP' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select net_amt into lc_hdramt from misc_receipt --where tran_id = :new.tran_id; lc_hdramt := :old.net_amt; exception when others then lc_hdramt := 0; end; if lc_hdramt <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but net amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'M-RCP' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX USER_OBJ_FAV_PK ON USER_OBJ_FAV (OBJ_NAME, USER_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_PAY_CR_TERM (LS_REF_ID CHAR) RETURN CHAR IS LS_CR_TERM VARCHAR2(5); ls_count number; BEGIN LS_COUNT :=0; SELECT COUNT(tran_id) INTO LS_COUNT FROM MISC_VOUCHER WHERE TRAN_ID= trim(LS_REF_ID); IF LS_COUNT >0 THEN SELECT CR_TERM INTO LS_CR_TERM FROM MISC_VOUCHER WHERE TRAN_ID= trim(LS_REF_ID); ELSE SELECT CR_TERM INTO LS_CR_TERM FROM VOUCHER WHERE TRAN_ID= trim(LS_REF_ID); end if; return LS_CR_TERM ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_SITEITEM (ITEMCODE IN CHAR,LOCCODE IN CHAR,LOCCODE_INSP IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ES3_POS_CODE2 (AS_EMP_CODE in varchar2,FUNTYPE in varchar2) return TYP_EMPCODE PIPELINED is begin if funType ='E' then for r_empcode in ( SELECT distinct C.emp_code as emp_code FROM ORG_STRUCTURE C START WITH C.POS_CODE= (SELECT POS_CODE FROM EMPLOYEE A WHERE trim(A.EMP_CODE)=trim(as_emp_Code) ) CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO AND C.VERSION_ID = (select FN_GET_VERSION_ID from dual)) LOOP PIPE ROW (EMPPOS(r_empcode.EMP_CODE)); end LOOP; elsif funType ='P' then BEGIN for r_poscode in ( SELECT distinct C.POS_CODE as pos_code FROM ORG_STRUCTURE C START WITH C.POS_CODE= (SELECT POS_CODE FROM EMPLOYEE A WHERE trim(A.EMP_CODE)=trim(as_emp_Code) ) CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO AND C.VERSION_ID = (select FN_GET_VERSION_ID from dual)) LOOP PIPE ROW (EMPPOS(r_poscode.pos_code)); end loop; END; end if; RETURN; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_GST_IR_REFID ON GST_IR_INFO (REF_SER, REF_ID, REG_STAT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WF_ROLE_USERS_X ON WF_ROLE_USERS (ROLE_CODE, USERID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NUMBERTOWORD (var in number) return varchar2 is amt number; strt number; val number; str varchar2(15); c_str varchar2(400); flag number:=0; begin val:=round(var,2); amt:=floor(val); str:=to_char(amt); if val > 0then if length(str) >= 8 and length(str) <=10 then strt:=(length(str)-7); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' crore '; amt:=to_number(substr(to_char(amt),(strt+1),7)); flag:=0; end if; str:=to_char(amt); if ((length(str) >= 6 and length(str) <= 7) or flag = 1) then strt:=(length(str) - 5); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' lakh '; amt:=to_number(substr(to_char(amt),(strt+1),5)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 5 ) or flag = 1) then c_str:=c_str || initcap(case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end); end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := case when c_str = '' or c_str is null then 'Rupees Zero and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end || ' Paise Only' else 'Rupees ' || c_str || ' and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end || ' Paise Only' end; else c_str := 'Rupees ' || c_str || ' Only'; end if; return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX IBCA_RCP_CTRL_X ON IBCA_RCP_CTRL (FIN_ENTITY__FROM, FIN_ENTITY__TO, SITE_CODE__FROM, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_POSCODE_DESC ( as_versionid in char, as_tableno in char, as_poscoderepto in char) return varchar is descr char(250); begin select decode( descr, null, descr, ' ', descr, descr ) into descr from org_structure where version_id = as_versionid and table_no = as_tableno and pos_code = as_poscoderepto; return descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083439 ON ENTITY_DOC_SHARE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MRH_ITEM_SITE_CUST ON MIN_RATE_HISTORY (ITEM_CODE, SITE_CODE, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GETAMT (AS_ACCTPRD CHAR , AS_EMP_CODE CHAR , AS_PRD_CODE CHAR, AS_VAR_NAME CHAR ) RETURN NUMBER IS lc_amt number(14,3); varvalue char(200); begin select var_value into varvalue from payrparm where prd_code = AS_PRD_CODE and rtrim(var_name) = rtrim(AS_VAR_NAME); select amount into lc_amt from it_calcdet where acct_prd = AS_ACCTPRD and emp_code = AS_EMP_CODE and ad_code= varvalue; return lc_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PYRL_CALC (AS_EMPCODE CHAR,AS_PRDCODE CHAR,AS_PROCTYPE VARCHAR2,AS_CALCTYPE CHAR,AC_NEWAMT NUMBER,AS_ADCODE CHAR) RETURN NUMBER IS LC_AMT NUMBER(14,2); LC_PYRL_AMT NUMBER(14,2); LC_ARR_AMT NUMBER(14,2); BEGIN IF AS_PROCTYPE = 'AR' THEN IF AS_ADCODE = 'PF' OR AS_ADCODE = 'PF1' OR AS_ADCODE = 'EFPF' THEN IF AS_CALCTYPE='B' THEN LC_PYRL_AMT := 0; LC_ARR_AMT := 0; SELECT SUM(NVL(BASE_AMT,0)) INTO LC_PYRL_AMT FROM PAYROLLDET WHERE PRD_CODE = AS_PRDCODE AND EMP_CODE = AS_EMPCODE AND AD_CODE = AS_ADCODE; SELECT SUM(NVL(DIFF_BASE_AMT,0)) INTO LC_ARR_AMT FROM ARREARDET,ARREARS WHERE ARREARS.PRD_CODE = ARREARDET.PRD_CODE AND ARREARS.EMP_CODE = ARREARDET.EMP_CODE AND ARREARS.PRD_CODE__ACC = ARREARDET.PRD_CODE__ACC AND ARREARDET.PRD_CODE = AS_PRDCODE AND ARREARDET.EMP_CODE = AS_EMPCODE AND ARREARDET.AD_CODE = AS_ADCODE AND ARREARS.CONFIRMED = 'Y'; IF NVL(AC_NEWAMT,0) >= (NVL(LC_PYRL_AMT,0) + NVL(LC_ARR_AMT,0)) THEN RETURN NVL(AC_NEWAMT,0); ELSE RETURN (NVL(LC_PYRL_AMT,0) + NVL(LC_ARR_AMT,0)); END IF; END IF; ELSIF AS_ADCODE = 'PFA' THEN IF AS_CALCTYPE='B' THEN LC_PYRL_AMT := 0.00; LC_ARR_AMT := 0.00; SELECT SUM(NVL(BASE_AMT,0)) INTO LC_PYRL_AMT FROM PAYROLLDET WHERE PRD_CODE = AS_PRDCODE AND EMP_CODE = AS_EMPCODE AND AD_CODE = 'PF'; SELECT NVL(SUM(NVL(DIFF_BASE_AMT,0)),0) INTO LC_ARR_AMT FROM ARREARDET,ARREARS WHERE ARREARS.PRD_CODE = ARREARDET.PRD_CODE AND ARREARS.EMP_CODE = ARREARDET.EMP_CODE AND ARREARS.PRD_CODE__ACC = ARREARDET.PRD_CODE__ACC AND ARREARDET.PRD_CODE = AS_PRDCODE AND ARREARDET.EMP_CODE = AS_EMPCODE AND ARREARDET.AD_CODE = 'PF' AND ARREARS.CONFIRMED = 'Y'; IF NVL(AC_NEWAMT,0) <= (LC_PYRL_AMT + LC_ARR_AMT) THEN RETURN (LC_PYRL_AMT + LC_ARR_AMT - AC_NEWAMT); ELSE RETURN 0; END IF; END IF; ELSIF AS_ADCODE = 'PF1A' THEN IF AS_CALCTYPE='B' THEN LC_PYRL_AMT := 0.00; LC_ARR_AMT := 0.00; SELECT SUM(NVL(BASE_AMT,0)) INTO LC_PYRL_AMT FROM PAYROLLDET WHERE PRD_CODE = AS_PRDCODE AND EMP_CODE = AS_EMPCODE AND AD_CODE = 'PF1'; SELECT NVL(SUM(NVL(DIFF_BASE_AMT,0)),0) INTO LC_ARR_AMT FROM ARREARDET,ARREARS WHERE ARREARS.PRD_CODE = ARREARDET.PRD_CODE AND ARREARS.EMP_CODE = ARREARDET.EMP_CODE AND ARREARS.PRD_CODE__ACC = ARREARDET.PRD_CODE__ACC AND ARREARDET.PRD_CODE = AS_PRDCODE AND ARREARDET.EMP_CODE = AS_EMPCODE AND ARREARDET.AD_CODE = 'PF1' AND ARREARS.CONFIRMED = 'Y'; IF NVL(AC_NEWAMT,0) <= (LC_PYRL_AMT + LC_ARR_AMT) THEN RETURN (LC_PYRL_AMT + LC_ARR_AMT - AC_NEWAMT); ELSE RETURN 0.00; END IF; END IF; ELSIF (AS_ADCODE = 'EFPFA') THEN IF (AS_CALCTYPE = 'B') THEN SELECT NVL(SUM(BASE_AMT),0) INTO LC_PYRL_AMT FROM PAYROLLDET WHERE PRD_CODE = AS_PRDCODE AND EMP_CODE = AS_EMPCODE AND AD_CODE = 'EFPF'; SELECT NVL(SUM(DIFF_BASE_AMT),0) INTO LC_ARR_AMT FROM ARREARDET,ARREARS WHERE ARREARS.PRD_CODE = ARREARDET.PRD_CODE AND ARREARS.EMP_CODE = ARREARDET.EMP_CODE AND ARREARS.PRD_CODE__ACC = ARREARDET.PRD_CODE__ACC AND ARREARDET.PRD_CODE = AS_PRDCODE AND ARREARDET.EMP_CODE = AS_EMPCODE AND ARREARDET.AD_CODE = 'EFPF' AND ARREARS.CONFIRMED = 'Y'; IF (NVL(AC_NEWAMT,0) <= (LC_PYRL_AMT + LC_ARR_AMT)) THEN RETURN (LC_PYRL_AMT + LC_ARR_AMT - AC_NEWAMT); ELSE RETURN 0; END IF; END IF; ELSIF (AS_ADCODE = 'PF3A') THEN IF (AS_CALCTYPE = 'B') THEN SELECT NVL(SUM(BASE_AMT),0) INTO LC_PYRL_AMT FROM PAYROLLDET WHERE PRD_CODE = AS_PRDCODE AND EMP_CODE = AS_EMPCODE AND AD_CODE = 'PF3'; SELECT NVL(SUM(DIFF_BASE_AMT),0) INTO LC_ARR_AMT FROM ARREARDET,ARREARS WHERE ARREARS.PRD_CODE = ARREARDET.PRD_CODE AND ARREARS.EMP_CODE = ARREARDET.EMP_CODE AND ARREARS.PRD_CODE__ACC = ARREARDET.PRD_CODE__ACC AND ARREARDET.PRD_CODE = AS_PRDCODE AND ARREARDET.EMP_CODE = AS_EMPCODE AND ARREARDET.AD_CODE = 'PF3' AND ARREARS.CONFIRMED = 'Y'; IF (NVL(AC_NEWAMT,0) <= (LC_PYRL_AMT + LC_ARR_AMT)) THEN RETURN (LC_PYRL_AMT + LC_ARR_AMT - AC_NEWAMT); ELSE RETURN 0; END IF; END IF; END IF; ELSE RETURN AC_NEWAMT; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GEN_DESCR (as_fld_name char,as_mod_name char,as_fld_value char,as_descr char) return char is v_descr gencodes.sh_descr%type; begin select decode(as_descr, 'D', descr, sh_descr) into v_descr from gencodes where fld_name = as_fld_name and fld_value = as_fld_value and ( mod_name = as_mod_name or mod_name ='X') ; If v_descr is null then v_descr := ''; end if; return v_descr; Exception when OTHERS then return ''; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPACK_INSTR (as_item_code stock.item_code%type, as_site_code stock.site_code%type, as_loc_code stock.loc_code%type, as_lot_no stock.lot_no%type, as_lot_sl stock.lot_sl%type, as_exp_lev workorder_issdet.exp_lev%type, as_tran_type workorder_iss.tran_type%type, as_workorder workorder.work_order%type) return char is ls_pack_instr stock.pack_instr%type; ls_loc_code stock.loc_code%type; begin if as_tran_type = 'R' then select loc_code into ls_loc_code from workorder_iss a, workorder_issdet b where a.tran_id = b.tran_id and a.site_code = as_site_code and a.work_order = as_workorder and b.exp_lev = as_exp_lev and b.item_code = as_item_code and b.lot_no = as_lot_no and b.lot_sl = as_lot_sl and rownum = 1; else ls_loc_code := as_loc_code; end if; select pack_instr into ls_pack_instr from stock where item_code = as_item_code and site_code = as_site_code and loc_code = ls_loc_code and lot_no = as_lot_no and lot_sl = as_lot_sl and inv_stat = 'SALE'; return (ls_pack_instr); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVTRACE_REF_SER_REF_ID_SITE ON INVTRACE (REF_SER, REF_ID, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING STORAGE(INITIAL 31457280 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEM_DESCR_SITE ON ITEM (DESCR, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAXVAL_PUR ( ls_tran_code In Char, ls_tran_id In Char, ls_line_no In Char, ls_tax_type In Char) return decimal is lc_retval decimal(17,6); lc_tax_amt decimal(17,6); ls_lineno char(3); begin ls_lineno := ls_line_no; if (length(trim(ls_lineno)) = 1) then ls_lineno := concat(' ',trim(ls_lineno)); end if; if (length(trim(ls_lineno)) = 2) then ls_lineno := concat(' ',trim(ls_lineno)); end if; if ls_tax_type = 'E' then select sum ( taxtran.tax_amt ) into lc_tax_amt from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_lineno and tax.tax_type = ls_tax_type and taxtran.tax_amt <> 0 and tax.print_tax = 'Y' and taxtran.effect <> 'N'; elsif ls_tax_type = 'S' then select sum ( taxtran.tax_amt ) into lc_tax_amt from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_lineno and tax.tax_type = ls_tax_type and taxtran.tax_amt <> 0 and tax.print_tax = 'Y' and taxtran.effect <> 'N'; else select sum ( taxtran.tax_amt ) into lc_tax_amt from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = ls_tran_code and taxtran.tran_id = ls_tran_id and taxtran.line_no = ls_lineno and taxtran.tax_amt <> 0 and tax.tax_type not in ( 'S' , 'E' , 'D' ) and tax.print_tax = 'Y' and taxtran.effect <> 'N'; end if; return lc_tax_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DESPATCH_SCANDET_X ON DESPATCH_SCANDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_PLAN_QTY (as_sitecode char, as_itemcode char, as_prdcode char ) return number as ret_qty number(14,3); begin select nvl(sum(b.quantity),0) into ret_qty from salesforecast_hdr a, salesforecast_det b where a.tran_id = b.tran_id and a.site_code = as_sitecode and b.item_code = as_itemcode and b.prd_code__for = as_prdcode; return ret_qty; end ddf_inv_plan_qty; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_ROLE_SPEC ON ROLE_SPEC (ROLE_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RE_STRUC_RESULT_X ON RE_STRUC_RESULT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_DETAIL (ls_tran_code in char,ls_tran_id in char, ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select MIN(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select MIN(taxable_amt) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then lc_exch_rate := fn_rget_exch_rate(ls_tran_code,ls_tran_id); if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MASTER_GEN_COLS_X ON MASTER_GEN_COLS (MASTER_CODE, COL_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BI_OBJ_RESOURCE_X ON BI_OBJ_RESOURCE (OBJ_OWNER, OBJ_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QC_STABILITY_TESTSCH_DET_X ON QC_STABILITY_TESTSCH_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOAN_SUM_RECO (as_loan_no CHAR, ld_date_fr DATE, ld_date_to DATE) return NUMBER is lc_sum_reco NUMBER(14,2) := 0.00; ls_reco_no CHAR(10); BEGIN SELECT ddf_get_ref_loan(as_loan_no, ld_date_fr, ld_date_to) into ls_reco_no from dual; SELECT sum(loan_reco.reco_amt) into lc_sum_reco FROM loan_reco, loans WHERE ( loan_reco.loan_no = loans.loan_no ) and ( ( loan_reco.loan_no = as_loan_no ) AND ( loan_reco.confirmed = 'Y' ) and ( loan_reco. RECO_DATE >=ld_date_fr and loan_reco.reco_date <= ld_date_to ) and ( ls_reco_no is null or loan_reco.reco_no <> ls_reco_no)) ; if lc_sum_reco is null then lc_sum_reco := 0.00; end if ; return lc_sum_reco; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_VALUE ( LS_TRAN_CODE in char , LS_TRAN_ID in char , LS_LINE_NO in char , LS_TAX_TYPE in char ) RETURN number is LC_TAX_AMT number(17, 6) ; AS_LINE_NO char(3) ; BEGIN IF ( LENGTH ( TRIM ( LS_LINE_NO ) ) = 1 ) THEN AS_LINE_NO := CONCAT ( ' ' , TRIM ( LS_LINE_NO ) ) ; END IF ; IF ( LENGTH ( TRIM ( LS_LINE_NO ) ) = 2 ) THEN AS_LINE_NO := CONCAT ( ' ' , TRIM ( LS_LINE_NO ) ) ; END IF ; IF LS_TAX_TYPE = 'E' THEN SELECT SUM ( TAXTRAN.TAX_AMT ) into LC_TAX_AMT FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = LS_TRAN_CODE AND TAXTRAN.TRAN_ID = LS_TRAN_ID AND TAXTRAN.LINE_NO = AS_LINE_NO AND TAX.TAX_TYPE = LS_TAX_TYPE AND TAX_AMT > 0 ; ELSIF LS_TAX_TYPE = 'S' THEN SELECT SUM (TAXTRAN.TAX_AMT) into LC_TAX_AMT FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = LS_TRAN_CODE AND TAXTRAN.TRAN_ID = LS_TRAN_ID AND TAXTRAN.LINE_NO = AS_LINE_NO AND TAX.TAX_TYPE = LS_TAX_TYPE AND TAX_AMT > 0 ; ELSE SELECT SUM ( TAXTRAN.TAX_AMT ) into LC_TAX_AMT FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX . TAX_CODE AND TAXTRAN.TRAN_CODE = LS_TRAN_CODE AND TAXTRAN.TRAN_ID = LS_TRAN_ID AND TAXTRAN.LINE_NO = AS_LINE_NO AND TAX.TAX_TYPE NOT IN ( 'S' , 'E' , 'D' ) AND TAX_AMT > 0 ; END IF ; RETURN ( LC_TAX_AMT ) ; exception when NO_DATA_FOUND THEN RETURN 0 ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ISNUMBER (ls_lot_sl in char) return number is lb_number number(14,3); ll_len number; ll_asc number; ls_char char; begin ll_len := length(rtrim(ls_lot_sl)); if ll_len is null then return -1; end if; for i in 1..ll_len loop ls_char := substr(ls_lot_sl,i,1); select ascii(ls_char) into ll_asc from dual; if (ll_asc < 48 or ll_asc > 57) and ll_asc <> 46 then return -1; end if; end loop; return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DF_GETCUSTNUMBERFROMWRKORD (P_WORK_ORDER IN VARCHAR2) RETURN VARCHAR2 IS phone_number VARCHAR2(30); BEGIN SELECT cust.tele1 INTO phone_number FROM customer cust JOIN sorder s ON cust.cust_code = s.cust_code JOIN workorder w ON w.sale_order = s.sale_order WHERE TRIM(w.work_order) = TRIM(P_WORK_ORDER) FETCH FIRST 1 ROWS ONLY; RETURN phone_number; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'no data found'; WHEN OTHERS THEN RETURN SQLERRM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DOC_COUNT (as_sales_pers char,as_option varchar2) return number is CntDay Number(9); begin if(as_option='SERIES') then select count(distinct sc_code) into CntDay from strg_series where sales_pers=as_sales_pers and sc_code in (select distinct sc_code from strg_customer where cust_type='D'); elsif(as_option='MEET') then select count(distinct strg_code) into CntDay from strg_meet where sales_pers=as_sales_pers and strg_code is not null and strg_type='D'; end if; return nvl(CntDay,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001181535 ON ENTITY_LOCATION (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_VENDOR_SCOPE ( as_vendor_scope CHAR ,as_vendor_qualify CHAR ) RETURN NUMBER IS FLAG NUMBER(1); as_vendor_no number(1); BEGIN IF as_vendor_qualify = 'Y' THEN IF as_vendor_scope = NULL OR LENGTH(as_vendor_scope) =0 THEN FLAG := 0; RETURN FLAG; ELSE SELECT COUNT(*) INTO as_vendor_no FROM GENCODES WHERE FLD_NAME = 'APPRV_SCOPE' AND MOD_NAME like 'W_SUPP_APPRV%' AND FLD_VALUE = as_vendor_scope ; IF as_vendor_no > 0 THEN FLAG := 1; RETURN FLAG; ELSE FLAG := 0; RETURN FLAG; END IF; END IF; END IF; EXCEPTION when others then Flag :=3; return FLAG; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CASHDISCOUNT (ls_CUST_code in CHAR, ls_sundrytype in char,ls_trantype in char) RETURN NUMBER is lscustcode customer.cust_code%type; llocated customer.located_at%type; lcrterm customer.cr_term%type; llcomparison number(1); LS_VALUE NUMBER(10,3); BEGIN if trim(ls_trantype) = 'RC' then return 0; else lscustcode := ls_CUST_code; select located_at, cr_term into llocated,lcrterm from customer where cust_code=lscustcode or cust_code=ls_sundrytype; select case when lcrterm in (select fld_value from gencodes where fld_name='CD_CRTERM' and mod_name='W_CUSTOMER' and active ='Y') then 1 else 0 end into llcomparison from dual; if(llcomparison=1) then select trim(UDF_STR1) into LS_VALUE from gencodes where fld_value=llocated and FLD_NAME='LOCATED_AT' and MOD_NAME='W_CUSTOMER'; return LS_VALUE; else return 0; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TIME_IN_MM (AS_TIME char) return number is a_position number(1); a_length number(1); a_hours number(2); a_min number(2); a_tot_min number(5) := 0; a_time varchar2(5); a_neg_tag boolean := false; begin if (substr(trim(AS_TIME),1,1) = '-') then a_neg_tag := true; end if; a_time := trim(replace(AS_TIME,'-','')); if (a_time = ':') or (a_time is null) then return a_tot_min; end if; a_length := length(a_time); a_position := instr(a_time,':'); if (a_position = 0) then a_position := instr(a_time,'.'); end if; if (a_position <> 0) then a_hours := nvl(substr(a_time,1,(a_position-1)),0); a_min := nvl(rpad(substr(a_time,(a_position+1),(a_length-a_position)),2,'0'),0); else a_hours := nvl(substr(a_time,1,2),0); a_min := nvl(rpad(substr(a_time,3,2),2,'0'),0); end if; a_tot_min := (a_hours * 60) + a_min; if a_neg_tag then a_tot_min := -(a_tot_min); end if; return a_tot_min; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_BUFUNC_DESCR ( as_func_code char) return varchar2 is ls_descr varchar2(120); begin begin select descr into ls_descr from BUSI_FUNCTIONS where func_code = as_func_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_QUOT_DET_TRANFLOW (as_quot_no char) return CLOB is v_str CLOB; type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.enq_no as enquiry_no, nvl(b.qamend_no,' ') as amendment_no, b.QUANTITY ,b.rate from item a ,pquot_det b where a.item_code = b.item_code and b.quot_no=as_quot_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3, v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=' Item Description Enquiry NoAmendment NoQuantityRate'||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_FT_REFDATE BEFORE INSERT OR UPDATE ON fundtransfer referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.ref_date is null then :new.ref_date := :new.eff_date; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RCPDETAIL (as_invoice char,as_site char ,ls_flag char) return varchar2 is as_recipt_det varchar2(100); as_tranid varchar2(20); as_trandt date; as_rcpamt number(14,2); ctr number(2); cursor c1 is select rcpdet.tran_id,receipt.tran_date, round(rcpdet.rcp_amt,2) from rcpdet ,receipt where rcpdet.tran_id = receipt.tran_id and rcpdet.ref_no = as_invoice and receipt.site_code = as_site and receipt.confirmed = 'Y' and receipt.tran_id not in ( select receipt_no from rcpdishnr where confirmed = 'Y'); begin open c1 ; ctr:=1; loop fetch c1 into as_tranid,as_trandt,as_rcpamt ; exit when c1%notfound ; if ls_flag = 'I' then if ctr =1 then as_recipt_det := as_tranid; else as_recipt_det := as_recipt_det ||' | '|| as_tranid; end if ; elsif ls_flag = 'D' then if ctr =1 then as_recipt_det := to_char(as_trandt); else as_recipt_det := as_recipt_det ||' | '|| to_char(as_trandt); end if ; elsif ls_flag = 'A' then if ctr = 1 then as_recipt_det := to_char(as_rcpamt); else as_recipt_det := as_recipt_det ||' | '|| to_char(as_rcpamt); end if ; end if ; ctr := 0; end loop; close c1; return as_recipt_det; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_ITEMSER_ADD BEFORE INSERT ON itemser referencing old as old new as new FOR EACH ROW declare ldt_excutdate date; BEGIN raise_application_error( -20601, 'Item Series addition not allowed and it depends on other configuration'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INCIDENT_ITEMS_X ON INCIDENT_ITEMS (INCIDENT_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHK_LOC_GROUP (as_sale_order char, as_loc_code char) return number is ret_val number; ls_loc_group char(5); ls_loc_groupd char(5); ls_count number(3); begin select loc_group into ls_loc_group from sorder where sale_order=as_sale_order; select loc_group into ls_loc_groupd from location where loc_code=as_loc_code; if ls_loc_group is not null then select count(1) into ret_val from dual where ls_loc_group=ls_loc_groupd; end if; if ls_loc_group is null then select count(1) into ret_val from dual where ls_loc_groupd <> 'NP'; end if; return ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DISSD_CHK_INV_RATE BEFORE insert or update ON distord_issdet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; ls_pricelist char(5); ls_listtype char(1); ls_sitecode char(5); lc_stkrate stock.rate%type; BEGIN if nvl(:new.rate,0) = 0 and nvl(:new.cost_rate,0) <> 0 then begin select price_list into ls_pricelist from distorder where dist_order = :new.dist_order ; exception when others then ls_pricelist := null; end; if ls_pricelist is not null and length(trim(ls_pricelist)) > 0 then begin select list_type into ls_listtype from pricelist_mst where price_list = ls_pricelist ; exception when others then ls_listtype := 'B'; end; if ls_listtype = 'I' then raise_application_error( -20601, 'For price list [' || trim(ls_pricelist) || '] is inventory rate but line # [' ||:new.line_no ||'] rate [' || to_char(nvl(:new.rate,0)) || '] cost rate [' || to_char(nvl(:new.cost_rate,0)) || '] both cannot be different ' ); end if; -- pricelist is of inventory type end if; -- pricelist specified in order end if; -- rate 0 but cost_rate not 0 if nvl(:new.cost_rate,0) = 0 then begin select site_code into ls_sitecode from distord_iss where tran_id = :new.tran_id; exception when others then ls_sitecode := ' '; end; begin select rate into lc_stkrate from stock where item_code = :new.item_code and site_code = ls_sitecode and loc_code = :new.loc_code and lot_no = :new.lot_no and lot_sl = :new.lot_sl; exception when others then lc_stkrate := 0; end; if lc_stkrate <> :new.cost_rate then raise_application_error( -20601, 'For line #[' || to_char(:new.line_no) || '] is inventory rate [' ||to_char(lc_stkrate) ||'] rate [' || to_char(nvl(:new.rate,0)) || '] cost rate [' || to_char(nvl(:new.cost_rate,0)) || '] both cannot be different ' ); end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NUM_TO_WORDS_INTL ( number_to_convert number , mCurr_cd char, mformat char ) return varchar2 is mretval varchar2(1000) := ' '; --Created by Brijesh Soni on 20-02-08 for Hungary Cheque Printing migrate in to RP report mdec_unit currency.dec_unit%type; mCurr_descr currency.descr%type; Curr_cd char(5) := trim(mCurr_cd); Curr_cdnew varchar2(40); --lsnum2convrt varchar(20) := to_char(number_to_convert,'00000.000000'); begin select trim(dec_unit), trim(descr) into mdec_unit , mCurr_descr from currency where curr_code = Curr_cd ; if sqlcode = 0 then Curr_cdnew := trim(mCurr_descr) || ' '; end if; if number_to_convert = 0 then --pradeep Singh date 09/12/08 Curr_cdnew :=Curr_cdnew ||'ZERO ONLY' ; -- end pradeep return Curr_cdnew ; end if; if mdec_unit is null or length(mdec_unit) = 0 then mdec_unit := ' Cents '; end if; if to_number(substr(number_to_convert,length(number_to_convert)-1)) > 0 then if number_to_convert > 1 then -- mretval := Curr_cdnew || ' '|| ddf_get_figures(number_to_convert,mformat) || mdec_unit || ' Only'; mretval := Curr_cdnew || ' '|| fig_to_words(number_to_convert) || ' ONLY'; else if trim(mCurr_cd) = '$' then -- mretval := Curr_cdnew || ' ' || 'Zero And ' || ddf_get_figures(number_to_convert,mformat) || mdec_unit || ' Only'; mretval := Curr_cdnew || ' ' || 'Zero And ' || fig_to_words(number_to_convert) || 'ONLY'; -- mretval := ddf_get_figures(number_to_convert,mformat) || mdec_unit || ' Only'; mretval := fig_to_words(number_to_convert) || mdec_unit || ' ONLY'; end if; end if; else if trim(mCurr_cd) = '$' then -- mretval := Curr_cdnew || ' ' || ddf_get_figures(number_to_convert,mformat) || 'And Zero Cents Only'; mretval := Curr_cdnew || ' ' || fig_to_words(number_to_convert) || 'And Zero Cents ONLY'; else --mretval := Curr_cdnew || ' ' || ddf_get_figures(number_to_convert,mformat) || ' Only'; mretval := Curr_cdnew || ' ' || fig_to_words(number_to_convert) || ' ONLY'; end if; end if; --pradeep Singh date 09/12/08 if number_to_convert < 1 then -- mretval := Curr_cdnew || ' '|| ddf_get_figures(number_to_convert,mformat) || mdec_unit || ' Only'; mretval := Curr_cdnew || ''|| fig_to_words(number_to_convert) || ' ONLY'; end if; -- end pradeep return mretval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_JOUR_AMT (as_tran_id char) return number is as_jour_amt number(14,2); begin select sum((case when drcr_flag = 'C' then amount else (case when drcr_flag ='D' then amount*(-1) else 0 end ) end ) ) into as_jour_amt from jourdet where tran_id =as_tran_id and acct_code in substr(( select VAR_VALUE from finparm where var_name ='PROV_COMM_ACCT'),1,10); return as_jour_amt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_DEALLOC_ARTDET (SI_PTCN IN CHAR, SI_CARTON_NO IN CHAR ) RETURN number is FLAG number ; CNT NUMBER; --CNT1 NUMBER; BEGIN BEGIN SELECT count(*) INTO CNT FROM DEALLOC_ART DA, DEALLOC_ART_DET DAD WHERE PTCN = SI_PTCN AND DAD.CARTON_NO = SI_CARTON_NO AND DA.TRAN_ID = DAD.TRAN_ID; IF (CNT > 0 ) THEN FLAG := 1; ELSE FLAG :=0; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG :=2; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_DESP_QCTRANS (as_sitecode in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; begin begin Select count(*) into ll_qccount from qc_order where site_code=as_sitecode and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; exception when others then ll_qccount := 0; end; begin select count(*) into ll_qt2count from qc_order where site_code=as_sitecode and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; exception when others then ll_qt2count := 0; end; begin select count(*) into ll_qt3count from qc_order where site_code=as_sitecode and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; exception when others then ll_qt3count := 0; end; begin Select count(*) into ll_qtcount from qc_transfer where site_code=as_sitecode and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; exception when others then ll_qtcount := 0; end; begin select count(*) into ll_qt1count from qc_transfer where site_code=as_sitecode and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; exception when others then ll_qt1count := 0; end; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_GEN_DESCR ( p_mod_name IN VARCHAR2, p_fld_value IN VARCHAR2 ) RETURN VARCHAR2 IS v_descr VARCHAR2(1000); BEGIN SELECT descr INTO v_descr FROM gencodes WHERE mod_name = p_mod_name AND fld_value = TRIM(p_fld_value); RETURN v_descr; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'Not Found'; WHEN OTHERS THEN RETURN 'Error'; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EMPDETAIL_STATUS_DESCR (ls_status empdetail_chg.status%type) return varchar2 is ls_return varchar2(4000); begin if ls_status = 'E' then ls_return := 'PENDING'; elsif ls_status = 'C' then ls_return := 'APPROVED'; elsif ls_status = 'X' then ls_return := 'REJECTED'; end if; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE SUNDRYMASTERTABLE_CHGBK AS TABLE OF sundryMaster_chgbk; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CASENO_MIN (as_tran_id in inv_pack_rcp.tran_id%type ) return char is ls_range varchar2(15); ls_packinst varchar2(15); ls_packinst1 varchar2(15); ls_ret varchar2(15); ls_min varchar2(15); ls_max varchar2(15); ls_max1 varchar2(15); ll_max number(10); ll_ret number(10); ls_source number(10); cursor cur_pack is select inv_pack_rcp.pack_instr from inv_pack_rcp where (inv_pack_rcp.tran_id = as_tran_id) order by line_no,pack_instr; begin open cur_pack ; fetch cur_pack into ls_packinst; while(cur_pack%FOUND) LOOP ls_ret := ddf_get_token(ls_packinst,'-'); ll_ret := length(ls_ret); if (ls_min)is null or length(trim(ls_min)) = 0 then ls_min := ls_ret; else if (ls_max)is null or length(trim(ls_max)) = 0 then ls_max := ls_ret ; else if ll_max <= ll_ret then ls_max := ls_ret; end if ; ll_max := length(ls_max); end if; end if; fetch cur_pack into ls_packinst; end loop; close cur_pack ; ls_range := ls_min; return ls_range; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIPT_REF_NO ON RECEIPT (REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SCHEME_VALID_ORD_ITEM ON SCHEME_APPLICABILITY (ITEM_CODE, APP_FROM, VALID_UPTO, ORDER_TYPE, SCHEME_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETTOPPOITEMS (PONUmber in char) RETURN VARCHAR2 IS item_descr varchar2(500); BEGIN select LISTAGG(initcap(item.SH_DESCR),', ') within group (order by item.SH_DESCR) into item_descr from ITEM item, porddet product where product.ITEM_CODE=item.ITEM_CODE and product.purc_order = PONUmber and rownum < 6; RETURN item_descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCK_QTYPERART (as_sitecode stock.site_code%type, as_itemcode stock.item_code%type, as_lotno stock.lot_no%type, as_loc_code stock.loc_code%type, as_lotsl stock.lot_sl%type) return number is ll_qtyperart stock.qty_per_art%type; begin select nvl(stock.qty_per_art,0) into ll_qtyperart from stock where site_code = as_sitecode and stock.item_code = as_itemcode and stock.lot_no = as_lotno and stock.loc_code = as_loc_code and stock.lot_sl= as_lotsl ; return ll_qtyperart; exception when no_Data_found then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GEN_DESC ( as_fld_name in char , as_fld_value in char ) return char is ls_retval varchar(120) ; begin select descr into ls_retval from gencodes where fld_name = as_fld_name and fld_value = as_fld_value and rownum =1 ; return ls_retval ; exception when too_many_rows then return ' ' ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE INSTRUMENTNO AS OBJECT ( TRAN_SER VARCHAR2(6), REF_NO VARCHAR2(20), REF_DATE DATE, BAL_AMT NUMBER(18,3) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_EVAL_PAR_X ON PROJ_EVAL_PAR (EVAL_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DIST_ISS_QTY1 ( ltran_id in char) return number is ld_qty number(14,3); begin begin SELECT SUM(QUANTITY) INTO ld_qty From Distord_Issdet Where Tran_Id=Ltran_Id; exception when others then ld_qty := 0; end; return (ld_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AREADESCR ( LS_FLD_NAME VARCHAR , LS_MOD_NAME VARCHAR , LS_FLD_VALUE VARCHAR ) RETURN VARCHAR IS LS_DESCR VARCHAR2 ( 120 ) ; BEGIN SELECT DESCR INTO LS_DESCR FROM GENCODES WHERE TRIM(FLD_NAME) = LS_FLD_NAME AND TRIM(MOD_NAME) = LS_MOD_NAME AND TRIM(FLD_VALUE) = LS_FLD_VALUE; RETURN LS_DESCR ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPICK_RATE_MAC ( as_var_name in char , ad_tran_date in date, as_item_code in char , as_lot_no in char, as_state_code in varchar ) return number is mrate number(14,3); ls_val varchar(20) ; as_price_list varchar(20); begin select trim(var_value) into ls_val from disparm where trim(var_name) = trim(as_var_name) and rownum = 1; if ls_val is null then ls_val :=' '; end if; as_price_list:= trim(as_state_code) || trim(ls_val) ; --return as_price_list; select nvl(rate,0) into mrate from pricelist where trim(price_list) = trim(as_price_list) and trim(item_code) = trim(as_item_code) and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and trim(lot_no__from)<=trim(as_lot_no) and trim(lot_no__to)>=trim(as_lot_no) and rownum = 1; return NVL(mrate,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX ( as_desp_id char) return number is ld_amount number(14,3); ld_amt number(14,3); ld_tax_amt number(14,3); begin select nvl(sum(tax_amt),0) into ld_tax_amt from taxtran where tran_id = as_desp_id and tran_code = 'S-DSP' and nvl(tax_amt,0) <> 0; select nvl(sum(quantity * rate__stduom),0) into ld_amt from despatchdet where desp_id = as_desp_id ; ld_amount := ld_amt + ld_tax_amt; return ld_amount ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAXCHAP_CHK_SOI before insert or update ON sorditem referencing old as old new as new FOR EACH ROW DECLARE ls_taxchap char(10); ls_msg varchar2(4000); BEGIN if :new.item_flag = 'I' then begin select tax_chap into ls_taxchap from item where item_code = :new.item_code__ord; exception when others then ls_taxchap := ' '; end; if trim(ls_taxchap) <> trim(:new.tax_chap) then raise_application_error( -20601, 'Tax chapter [' ||:new.tax_chap || '] not matching with item [' ||ls_taxchap ||']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDIST_ISS_DATE (ls_tran_code char) return date is iss_date date; begin select tran_date into iss_date from DISTORD_ISS where trim(tran_id) = trim(ls_tran_code); return iss_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_LOT_NO ON STOCK (LOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PAYABLES_TRF_X ON PAYABLES_TRF (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RECEIVED_LOC (as_emp_code IN CHAR ,as_item_code IN CHAR ) return char is loc_code CHAR(8); begin begin select A.LOC_CODE__APRV INTO loc_code from SITEITEM A, LOCATION B where A.LOC_CODE__APRV = B.LOC_CODE AND A.site_code= (select emp_site from employee where emp_code=as_emp_code) and A.item_code= as_item_code AND B.LOC_TYPE='RL'; EXCEPTION WHEN NO_DATA_FOUND THEN SELECT LOC_CODE INTO loc_code FROM ITEM WHERE ITEM_CODE=as_item_code; end; return loc_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INDENT_DET_ITEM ON INDENT_DET (ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRV_ALLOW_LMT_X ON TRV_ALLOW_LMT (ALLOW_CODE, EFF_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SERVICE_TAX_REG_NO (as_type in char, as_code in char) return varchar2 as as_party varchar2(250); begin if as_type = 'S' then select nvl(TAX_REG_ST,'NA') into as_party from supplier where supp_code = as_code; elsif as_type = 'C' then select nvl(TAX_REG_ST,'NA') into as_party from customer where cust_code = as_code; elsif as_type = 'T' then select nvl(TAX_REG_ST,'NA') into as_party from transporter where tran_code = as_code; elsif as_type = 'B' then select nvl(TAX_REG_ST,'NA') into as_party from bank where bank_code = as_code; elsif as_type = 'X' then select nvl(TAX_REG_ST,'NA') into as_party from tax_authority where tauth_code = as_code; elsif as_type = 'P' then select nvl(TAX_REG_ST,'NA') into as_party from sales_pers where sales_pers = as_code; elsif as_type = 'L' then select nvl(TAX_REG_ST,'NA') into as_party from loanparty where party_code = as_code; elsif as_type = 'E' then RETURN 'NA'; elsif as_type = 'O' then RETURN 'NA'; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAXTRAN_PICK_AMOUNT ( ls_ref_Ser in char, ls_ref_id in char, lc_line_no in number ) return number is lc_tax_amt number(14,3) ; begin select nvl(sum(tax_amt),0) into lc_tax_amt from taxtran where tran_code = ls_ref_ser and tran_id = ls_ref_id and line_no = lc_line_no group by tran_id ; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FULLFINAL_HDR_EMP_CODE ON FULLFINAL_HDR (EMP_CODE, RELIEVE_DATE, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 2097152 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBSYSDATE return date is ld_date date; begin return sysdate; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUN_DDF_GET_PLACE_WORK (AS_SALES_PERS CHAR, as_work_date date) return varchar2 is mplace_work varchar2(500); scount number(13) := 0; cursor c1 is select wrk_route_descr place_work from dr_main, dr_travel_details where dr_main.sales_pers = dr_travel_details.sales_pers and dr_main.work_date = dr_travel_details.work_date and dr_main.confirmation_flag ='Y' and dr_main.sales_pers = as_sales_pers and dr_main.work_date = as_work_date; begin for i in c1 loop scount := scount + 1; if (scount = 1) then mplace_work := mplace_work || i.place_work; else mplace_work := mplace_work || ', ' || i.place_work; end if; end loop; return mplace_work; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_PARTY_SITE (as_ref_ser in char, as_ref_id in char) return varchar2 as ls_site_code varchar2(5); ls_display char(3); begin if as_ref_ser = 'S-DSP' then select site_code into ls_site_code from despatch where desp_id = as_ref_id; ls_display := 'YES'; elsif as_ref_ser = 'D-ISS' then select site_code__dlv into ls_site_code from distord_iss where tran_id = as_ref_id; ls_display := 'YES'; elsif as_ref_ser = 'D-RCP' then select site_code__ship into ls_site_code from distord_rcp where tran_id = as_ref_id; ls_display := 'YES'; elsif as_ref_ser = 'S-RET' then select site_code into ls_site_code from sreturn where tran_id = as_ref_id; ls_display := 'YES'; elsif as_ref_ser = 'P-RCP' then select site_code into ls_site_code from porcp where tran_id = as_ref_id; ls_display := 'YES'; elsif as_ref_ser = 'P-RET' then select site_code into ls_site_code from porcp where tran_id = as_ref_id; ls_display := 'YES'; end if; if ls_display = 'NO' then ls_site_code := ' '; end if; return ls_site_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EMP_NAME_DUM ( ls_emp_code__aprv char , ls_type char default 'F') return varchar2 is ls_emp_aprv_name varchar2(200); begin select INITCAP(trim(emp_fname)) ||' '||INITCAP(trim(emp_lname)) into ls_emp_aprv_name from employee where emp_code = ls_emp_code__aprv; RETURN LS_EMP_APRV_NAME; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CRE_DET_TRANFLOW (as_cred_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.ref_no ,b.quantity,b.net_amt,b.rate from accounts a ,misc_drcr_rdet b where a.acct_code = b.acct_code and b.tran_id=as_cred_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Account Description '||''||''||'Reference No'||''||''||'Quantity'||''||''||'Net Amount'||''||''||'Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BANKRECO_TRACE_X ON BANKRECO_TRACE (TRAN_ID__LOG, TRAN_ID__STAT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_POTENCY_DED (as_porcp_no char,as_porcp_line_no char) return number is lc_act_pot number(14,3); lc_std_pot number(14,3); lc_qty number(14,3); lc_rate number(14,3); lc_tax number(14,3); lc_count number(14,0); begin begin select count(1) into lc_count from qc_order where porcp_no = as_porcp_no and porcp_line_no = as_porcp_line_no; exception when no_data_found then return 0; when others then return 0; end; begin select item_potency into lc_act_pot from qc_order where porcp_no = as_porcp_no and porcp_line_no = as_porcp_line_no; select a.potency_perc, b.quantity, b.rate into lc_std_pot, lc_qty, lc_rate from item a, porcpdet b where a.item_code = b.item_code and b.tran_id = as_porcp_no and b.line_no = as_porcp_line_no; lc_rate := nvl(lc_rate,0); lc_qty := nvl(lc_qty,0); lc_std_pot := nvl(lc_std_pot,100); lc_act_pot := nvl(lc_act_pot,0); -- 21-01-2005 if lc_act_pot < lc_std_pot then lc_tax := (lc_qty * lc_rate) - ((lc_qty * lc_rate * lc_act_pot)/lc_std_pot); end if; return lc_tax; exception when no_data_found then lc_tax := 0; when others then lc_tax := 0; end; return lc_tax; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MARITALCHG_NAMECHG_DATE (AS_TRAN_ID EMP_MARITALCHG.TRAN_ID%TYPE, AS_STATUS EMP_MARITALCHG.WF_STATUS%TYPE, AS_CONFIRMED EMP_MARITALCHG.CONFIRM%TYPE,AS_FLAG varchar) RETURN date IS LS_RETURN date; a_obj_sign_count number(1):=0 ; a_wf_prc_status_count number(1):=0 ; ls_emp_aprv varchar2(120); ls_sign_date DATE; ls_trn_date DATE; ls_sign_remarks VARCHAR2(200) :=' '; BEGIN IF AS_CONFIRMED ='Y' and AS_STATUS='Y' and AS_FLAG='SECOND_CONF__DATE' then select count(1) into a_obj_sign_count from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG')and rownum=1; if a_obj_sign_count > 0 then select sign_date into ls_sign_date from obj_sign_trans where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and sign_status='S' AND user_id__sign is not null and rownum=1 order by sign_date desc ; LS_RETURN := ls_sign_date; end if; ELSIF AS_CONFIRMED ='Y' and (AS_STATUS='O' or AS_STATUS='Y' OR AS_STATUS='S') and AS_FLAG='SECOND_TRAN__DATE' then select count(1) into a_wf_prc_status_count from wf_prc_status where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG')and rownum=1; if a_wf_prc_status_count > 0 then select status_date into ls_trn_date from wf_prc_status where ref_id =AS_TRAN_ID and REF_SER IN ('MNMCHG') and rownum=1 ; LS_RETURN := ls_trn_date; elsif a_wf_prc_status_count = 0 then LS_RETURN := fn_sysdate; end if; ELSIF AS_CONFIRMED ='Y' and NVL(AS_STATUS,'K') = 'K' and AS_FLAG='SECOND_TRAN__DATE' then LS_RETURN:=trunc(sysdate); end if; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MOD (V_NUMBER in number, V_DIVIDER in number) return number is ln_result number; begin select mod(V_NUMBER,V_DIVIDER) into ln_result from dual; return ln_result; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLVE_TRACE__EMP_DATE_LVE ON EMPLVE_TRACE (EMP_CODE, LVE_DATE_FR, LVE_DATE_TO, LVE_CODE, EFF_DATE, UPTO_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_CUSTOMER_STATION (as_emp_code char, as_cust_code char, as_cust_type char) return varchar is custStation varchar2(50); ls_parm_value varchar2(30); ls_dcr_group char(1); noof_row number(10); begin SELECT GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',as_emp_code) INTO ls_parm_value FROM DUAL; noof_row := 0; select count(*) into noof_row from strg_cust_type where type = as_cust_type; if noof_row > 0 then SELECT DCR_GROUP INTO ls_dcr_group FROM STRG_CUST_TYPE WHERE TYPE = as_cust_type; end if; if (ls_parm_value = 'SPRS_STOCKIST' and ls_dcr_group = 'S') THEN select descr into custStation from station where stan_code = (select stan_code from customer where cust_code = as_cust_code); return custStation; else select descr into custStation from station where stan_code = (select stan_code from strg_customer where sc_code = as_cust_code); return custStation; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ENTITY_DETAIL_MST force AS OBJECT ( ENTITY_CODE VARCHAR2(10), ENTITY_NAME VARCHAR2(150) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDS_SUNDRY_CATEGORY (ls_ref_ser varchar2,ls_ref_id varchar2) return varchar2 is ls_sundry_category varchar2(50); ls_ret varchar2(500); cursor c1 is select distinct tax.pay_from from taxtran , tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code= ls_ref_ser and taxtran.tran_id= ls_ref_id and tax.tax_group='ITDS' and taxtran.tax_amt <> 0; begin open c1; loop fetch c1 into ls_sundry_category; exit when c1%notfound ; ls_ret := ls_ret||ls_sundry_category||' '; end loop; close c1; return ls_ret; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORDER_DET_DIS_ITEM ON DISTORDER_DET (DIST_ORDER, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX FUNTRF_TRAN_ID__REF ON FUNDTRANSFER (LINK_TYPE, TRAN_ID__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ENTITY_CODE_APO (apo_number varchar2) RETURN Employee.Emp_Code%type IS ref_id1 varchar2(10) := apo_number; max_line_no number:=0 ; last_appr_emp_code Employee.Emp_Code%type := ''; BEGIN Select Entity_Code , Max(Line_No) Into Last_Appr_Emp_Code , Max_Line_No from obj_sign_trans where TRIM(ref_id) = TRIM(ref_id1) and ref_Ser = 'P-AMD' and sign_status = 'S' and line_no = (select max(line_no) from obj_sign_trans where TRIM(ref_id) = TRIM(ref_id1) ) GROUP BY entity_code ; Return last_appr_emp_code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX HIERARCHY_LEVEL_NO_PARENT ON HIERARCHY (LEVEL_NO, LEVEL_CODE, LEVEL_CODE__PARENT, TABLE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LC_VOUCHER_X ON LC_VOUCHER (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_DAILY_SHORT_FALL (AS_EMP_CODE char,AS_DATE date) return number is cursor c1 is select lve_code,lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and AS_DATE between lve_date_fr and lve_date_to and status = 'A' and use_flag = 'C' order by lve_date_fr,lve_date_to; cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and AS_DATE between date_from and date_to and status = 'A' order by date_from,date_to; a_count number(5); a_count1 number(5); a_minutes number(5) := 0; a_in_actual number(5); a_out_actual number(5); a_in_shift number(5); a_out_shift number(5); a_hdin_shift number(5); a_fd_hrs number(5); a_hd_hrs number(5); a_tour_in number(5); a_tour_out number(5); a_tour_hrs number(5) := 0; a_first varchar2(1); a_second varchar2(1); a_hol_tblno holiday.hol_tblno%type := ddf_get_holtblno(AS_EMP_CODE,AS_DATE); begin select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'H'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 = 0) then return a_minutes; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'H' and confirmed = 'Y'; if (a_count1 <> 0) then return a_minutes; end if; select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = AS_DATE and hol_type = 'W'; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 = 0) then return a_minutes; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = AS_DATE and hol_type = 'W' and confirmed = 'Y'; if (a_count1 <> 0) then return a_minutes; end if; for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> AS_DATE and i.lve_date_to <> AS_DATE) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = AS_DATE and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = AS_DATE and i.leave_ends = 'E') then return a_minutes; else if (i.lve_date_fr = AS_DATE and i.leave_starts = 'B') then a_first := 'L'; elsif (i.lve_date_fr = AS_DATE and i.leave_starts = 'M') then a_second := 'L'; elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'M') then a_first := 'L'; elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_second := 'L'; end if; end if; end loop; for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> AS_DATE and i.date_to <> AS_DATE) or (i.date_from <> i.date_to and i.date_from = AS_DATE and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = AS_DATE and i.tour_ends = 'E') then return a_minutes; else if (i.date_from = AS_DATE and i.tour_starts = 'S') then a_first := 'T'; elsif (i.date_from = AS_DATE and i.tour_starts = 'B') then a_second := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'B') then a_first := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'E') then a_second := 'T'; end if; end if; end loop; select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE and (in_time is null or out_time is null or trim(replace(in_time,':','')) is null or trim(replace(out_time,':','')) is null); if (a_count <> 0) then return a_minutes; end if; if (a_first is null) and (a_second is null) then select count(*) into a_count from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE and ((ddf_time_in_mm(a.out_time) - ddf_time_in_mm(a.in_time)) / 60) < b.fd_hrs; if (a_count = 0) then return a_minutes; else select (b.fd_hrs * 60) - (ddf_time_in_mm(a.out_time) - ddf_time_in_mm(a.in_time)) into a_minutes from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE; return a_minutes; end if; elsif (a_first is not null) and (a_second is not null) then return a_minutes; elsif (a_first = 'L' or a_second = 'L') then select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count <> 0) then select ddf_time_in_mm(a.in_time),ddf_time_in_mm(a.out_time),ddf_time_in_mm(b.in_time),ddf_time_in_mm(b.out_time), ddf_time_in_mm(b.hd_in_time),b.hd_hrs*60 into a_in_actual,a_out_actual,a_in_shift,a_out_shift,a_hdin_shift,a_hd_hrs from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE; if (a_out_shift < a_in_shift) then a_out_shift := a_out_shift + 1440; end if; if (a_hdin_shift < a_in_shift) then a_hdin_shift := a_hdin_shift + 1440; end if; if (a_first = 'L') then a_hd_hrs := a_out_shift - a_hdin_shift; end if; if ((a_out_actual-a_in_actual) < a_hd_hrs) then a_minutes := a_hd_hrs - (a_out_actual-a_in_actual); end if; return a_minutes; end if; return a_minutes; elsif (a_first = 'T' or a_second = 'T') then select count(*) into a_count from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count <> 0) then select ddf_time_in_mm(a.in_time),ddf_time_in_mm(a.out_time),ddf_time_in_mm(b.in_time),ddf_time_in_mm(b.out_time), ddf_time_in_mm(b.hd_in_time),b.fd_hrs*60,b.hd_hrs*60 into a_in_actual,a_out_actual,a_in_shift,a_out_shift, a_hdin_shift,a_fd_hrs,a_hd_hrs from attendance_day a,workshft b where b.day_no = a.day_no and b.shift = a.shift and a.attd_date = AS_DATE and a.emp_code = AS_EMP_CODE; if (a_out_shift < a_in_shift) then a_out_shift := a_out_shift + 1440; end if; if (a_hdin_shift < a_in_shift) then a_hdin_shift := a_hdin_shift + 1440; end if; if (a_first = 'T') then if (a_in_actual <= (a_in_shift+a_hd_hrs)) and (a_out_actual >= a_in_shift) then a_tour_in := a_in_actual; a_tour_out := a_out_actual; if (a_tour_in < a_in_shift) then a_tour_in := a_in_shift; end if; if (a_tour_out > (a_in_shift+a_hd_hrs)) then a_tour_out := a_in_shift+a_hd_hrs; end if; a_tour_hrs := a_tour_out-a_tour_in; end if; if (((a_out_actual-a_in_actual)-a_tour_hrs+a_hd_hrs) < a_fd_hrs) then a_minutes := a_fd_hrs - ((a_out_actual-a_in_actual)-a_tour_hrs+a_hd_hrs); end if; return a_minutes; end if; if (a_second = 'T') then if (a_in_actual <= a_out_shift) and (a_out_actual >= a_hdin_shift) then a_tour_in := a_in_actual; a_tour_out := a_out_actual; if (a_tour_in < a_hdin_shift) then a_tour_in := a_hdin_shift; end if; if (a_tour_out > a_out_shift) then a_tour_out := a_out_shift; end if; a_tour_hrs := a_tour_out-a_tour_in; end if; if (((a_out_actual-a_in_actual)-a_tour_hrs+(a_out_shift-a_hdin_shift)) < a_fd_hrs) then a_minutes := a_fd_hrs - ((a_out_actual-a_in_actual)-a_tour_hrs+(a_out_shift-a_hdin_shift)); end if; return a_minutes; end if; end if; return a_minutes; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETCONVQUANTITYFACT (as_fruom char,touom char,foritem char,toconvert number) Return Number As v_mConv number(29,4); v_mRound varchar2(100); v_mRndTo number(15,4); v_newqty number(29,4); msg varchar2(1000):='Conversion factor not defined.'; begin if as_fruom = touom then v_mConv := 1; v_newqty := toconvert * v_mConv; return v_newqty; end if; begin SELECT FACT, ROUND,ROUND_TO into v_mConv,v_mRound,v_mRndTo FROM UOMCONV WHERE UNIT__FR = as_fruom AND UNIT__TO = touom AND ITEM_CODE = foritem; if v_mConv is not null and v_mRound is not null and v_mRndTo is not null then v_newqty := v_mConv*toconvert; v_newqty :=getrndamt(v_newqty,v_mRound,v_mRndTo); return v_newqty; Else Dbms_Output.Put_Line(msg); end if; Exception when no_data_found then Begin SELECT FACT,ROUND,ROUND_TO into v_mConv,v_mRound,v_mRndTo FROM UOMCONV WHERE UNIT__FR =touom AND UNIT__FR =as_fruom AND ITEM_CODE =foritem; if v_mConv is not null and v_mRound is not null and v_mRndTo is not null then v_newqty := v_mConv/toconvert; V_Newqty :=Getrndamt(V_Newqty,V_Mround,V_Mrndto); return v_newqty; Else Dbms_Output.Put_Line(msg); end if; Exception when no_data_found then Begin SELECT FACT, ROUND, ROUND_TO into v_mConv,v_mRound,v_mRndTo FROM UOMCONV WHERE UNIT__FR = as_fruom AND UNIT__TO = TOUOM AND ITEM_CODE = 'X'; IF V_MCONV IS NOT NULL AND V_MROUND IS NOT NULL AND V_MRNDTO IS NOT NULL THEN Dbms_Output.Put_Line(V_MCONV||V_MROUND||V_MRNDTO); v_newqty := v_mConv*toconvert; v_newqty :=getrndamt(v_newqty,v_mRound,v_mRndTo); return v_newqty; Else Dbms_Output.Put_Line(msg); end if; Exception when no_data_found then Begin SELECT FACT, ROUND, ROUND_TO into v_mConv,v_mRound,v_mRndTo FROM UOMCONV WHERE UNIT__FR = touom AND UNIT__TO = as_fruom AND ITEM_CODE = 'X'; if v_mConv is not null and v_mRound is not null and v_mRndTo is not null then v_newqty := toconvert/v_mConv; v_newqty :=getrndamt(v_newqty,v_mRound,v_mRndTo); return v_newqty; Else Dbms_Output.Put_Line(msg); end if; exception When No_Data_Found Then v_mConv :=0; v_mRound :=null; v_mRndTo :=0; dbms_output.put_line(msg); end; end; end; end; return v_newqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE ORGUNITMASTER AS OBJECT ( ITEM_SER VARCHAR2(5), DESCR VARCHAR2(60) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TRAN_AMOUNT (as_tran_code IN char,as_tran_id IN char) return number as lc_amount number(14,2); begin if as_tran_code = 'S-DSP' then select sum(nvl(quantity__stduom,0) * nvl(rate__clg,0)) into lc_amount from despatchdet where desp_id = as_tran_id; elsif as_tran_code = 'D-ISS' then select sum(amount) into lc_amount from distord_issdet where tran_id = as_tran_id; end if; return(lc_amount); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LAST_ISSDATE_ITEM_GRADE (as_sitecode in site.site_code%type, as_itemcode in item.item_code%type, as_grade in invtrace.grade%type) return date is ldt_retdate stock.last_iss_date%type ; begin select max(last_iss_date) into ldt_retdate from stock where item_code = as_itemcode and site_code = as_sitecode and grade = as_grade ; return ldt_retdate ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PREV_BAL (bal_date DATE, bal_amt NUMBER, as_loan_no CHAR, prd_code_fr CHAR, prd_code_to CHAR, as_emp_code CHAR) return NUMBER IS ac_bal_amt NUMBER(14,2) := NVL(bal_amt,0); ls_ded_code CHAR(5); ls_int_code CHAR(5); ls_intterm CHAR(5); ld_frdate DATE; lc_reco NUMBER(14,2) := 0; ls_recono CHAR(10); lc_intamt number(12,2) := 0; BEGIN select fr_date into ld_frdate from period where code = prd_code_fr; if bal_date > ld_frdate then select a.ad_code__ded, a.ad_code__int into ls_ded_code, ls_int_code from loan_scheme a, loans b where b.loan_no = as_loan_no and a.scheme_no = b.scheme_no; declare cursor c1 is select a.prd_code, a.emp_code, a.ad_code, a.amount from payarr_det a , period b where a.prd_code = b.code and b.code >= prd_code_fr and a.emp_code = as_emp_code and a.ad_code in (ls_ded_code,ls_int_code) and a.ref_no = as_loan_no; begin for i in c1 loop if (i.ad_code = ls_ded_code) then ac_bal_amt := ac_bal_amt + i.amount; if i.prd_code < '200105' then begin select int_term , interest_amt into ls_intterm , lc_intamt from loans_interest where loan_no = as_loan_no and prd_code = i.prd_code; exception when no_data_found then ls_intterm := null; lc_intamt := 0; end; if ls_intterm = 'EMI' then ac_bal_amt := ac_bal_amt - lc_intamt; end if; end if; else begin select int_term into ls_intterm from loans_interest where loan_no = as_loan_no and prd_code = i.prd_code; exception when no_data_found then ls_intterm := null; end; -- if (ls_intterm = 'EMI') and i.prd_code <= '200109' then -- ac_bal_amt := ac_bal_amt - i.amount; -- end if; end if; end loop; select fr_date into ld_frdate from period where code = prd_code_fr ; select ddf_get_ref_loan(ltrim(rtrim(as_loan_no)),ld_frdate,bal_date) into ls_recono from dual; if (ls_recono is not null and length(ls_recono) > 0) then select nvl(sum(reco_amt),0) into lc_reco from loan_reco where reco_no <> ls_recono and reco_date between ld_frdate and bal_date; else select nvl(sum(reco_amt),0) into lc_reco from loan_reco where loan_no = as_loan_no and reco_date >= ld_frdate; end if; end; end if; return (ac_bal_amt + lc_reco); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_REAS_DET (as_crnote_id in varchar2) return varchar2 is ls_reas_code varchar2(10) ; ls_reas_desc varchar2(100); ls_ret_reasdet varchar(400); ls_ctr number; cursor c1 is select distinct reas_code from drcr_rdet where TRIM(tran_id) = TRIM(as_crnote_id) ; begin ls_ctr :=0; open c1; fetch c1 into ls_reas_code; loop exit when c1%notfound; select fn_rget_areadescr('REAS_CODE','W_DRCRRCP',TRIM(ls_reas_code)) into ls_reas_desc from dual; if ls_reas_desc is not null and length (ls_reas_desc) >0 then ls_ctr := ls_ctr + 1; if ls_ctr = 1 then ls_ret_reasdet := ls_ret_reasdet || NVL(ls_reas_code,'') || ' - ' || NVL(ls_reas_desc,'') ; else ls_ret_reasdet := ls_ret_reasdet || ' , ' || NVL(ls_reas_code,'') || ' - ' || NVL(ls_reas_desc,'') ; end if; end if; fetch c1 into ls_reas_code; end loop; close c1; return ls_ret_reasdet; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_HOLDAY_DESCR (AS_EMP_CODE CHAR, AS_EMP_HOL_DATE DATE) return char is lc_holday_descr varchar2(20); begin select distinct descr into lc_holday_descr from holiday where hol_tblno = ddf_get_holtblno(AS_EMP_CODE,AS_EMP_HOL_DATE) and hol_date = AS_EMP_HOL_DATE; return lc_holday_descr; exception when no_data_found then begin SELECT H.DESCR into lc_holday_descr FROM CHANGE_HOLIDAY B, HOLIDAY H WHERE H.HOL_TYPE = B.HOL_TYPE And H.HOL_TBLNO = B.HOL_TBLNO and B.HOL_DATE_FOR = H.HOL_DATE AND B.HOL_TBLNO=ddf_get_holtblno(AS_EMP_CODE,AS_EMP_HOL_DATE) AND B.HOL_DATE_TO=AS_EMP_HOL_DATE AND B.EMP_CODE=AS_EMP_CODE AND ROWNUM=1; return lc_holday_descr; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DRUG_LIC (as_var_name in char,as_fin_ent in char,as_site_code in char) return varchar2 is mreg_no varchar2(45); mvar_value varchar2(45); ls_var_name varchar2(50); ls_fin_ent varchar2(15); ls_site_code varchar(15); Begin --mreg_no := ; if as_var_name Is Null or length(as_var_name) = 0 then ls_var_name := ''; else ls_var_name := as_var_name; END IF; if as_fin_ent is null or length(as_fin_ent) = 0 then ls_fin_ent := ''; else ls_fin_ent := as_fin_ent ; END IF; if as_site_code is null or length(as_site_code) = 0 then ls_site_code := ''; else ls_site_code := as_site_code ; end if; select var_value into mvar_value from disparm where prd_code = '999999' and trim(var_name) = trim(ls_var_name); select reg_no into mreg_no from siteregno where trim(fin_entity) = trim(ls_fin_ent) and trim(site_code) = trim(ls_site_code) and trim(ref_code) = trim(mvar_value); return mreg_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001035529 ON TRANS_ITEM_ATTRIBUTES (REF_SER, REF_ID, ATTRIB_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXAMT_TAXPERC (as_invoice in char , al_exch_rt in number , as_lotsl in char, al_taxperc number , as_type char,as_mrp_type char) return number is ll_tax_amt number(14,2) ; begin if as_type = 'T' then if al_taxperc = 0 then SELECT nvl(sum((case when invoice_trace.lot_sl = as_lotsl then (case when substr(tax_env,1,2) = substr(tax_env,3,2) then ( case when sign(invoice_trace.tax_amt)=1 then (invoice_trace.net_amt * al_exch_rt) else 0 end) else 0 end ) else 0 end)),0) into ll_tax_amt FROM invoice_trace where invoice_id = as_invoice ; else if al_taxperc = 4 then SELECT nvl(sum((case when (rtrim(invoice_trace.tax_class))='FORMC' then 0 else (case when sign(invoice_trace.tax_amt) =1 then (case when rtrim(invoice_trace.lot_sl)=as_lotsl then ((invoice_trace.net_amt - invoice_trace.tax_amt) * al_exch_rt) end)end) end)),0) into ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID = as_invoice and INVOICE_TRACE.INV_LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' AND TAXTRAN.TAX_PERC = al_taxperc; elsif al_taxperc = 5 then SELECT nvl(sum((case when (rtrim(invoice_trace.tax_class))='FORMC' then 0 else (case when sign(invoice_trace.tax_amt) =1 then (case when rtrim(invoice_trace.lot_sl)=as_lotsl then ((invoice_trace.net_amt - invoice_trace.tax_amt) * al_exch_rt) end)end) end)),0) into ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID = as_invoice and INVOICE_TRACE.INV_LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' AND TAXTRAN.TAX_PERC = al_taxperc; elsif al_taxperc = 12.5 then SELECT nvl(sum((case when (rtrim(invoice_trace.tax_class))='FORMC' then 0 else (case when sign(invoice_trace.tax_amt) =1 then ((invoice_trace.net_amt - invoice_trace.tax_amt) * al_exch_rt) end)end)),0) into ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID = as_invoice and INVOICE_TRACE.INV_LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' AND TAXTRAN.TAX_PERC = al_taxperc; elsif al_taxperc = 13.5 then SELECT nvl(sum((case when (rtrim(invoice_trace.tax_class))='FORMC' then 0 else (case when sign(invoice_trace.tax_amt) =1 then ((invoice_trace.net_amt - invoice_trace.tax_amt) * al_exch_rt) end)end)),0) into ll_tax_amt FROM invoice_trace , TAXTRAN , TAX where INVOICE_TRACE.INVOICE_ID = TAXTRAN.TRAN_ID AND invoice_id = as_invoice AND TAXTRAN.TRAN_ID = as_invoice and INVOICE_TRACE.INV_LINE_NO = TAXTRAN.LINE_NO AND TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE = 'S-INV' AND taxtran.tax_amt <> 0 AND tax.print_tax = 'Y' AND TAXTRAN.TAX_PERC = al_taxperc; end if; end if; elsif as_type = 'M' then if as_mrp_type = 'T' then select sum(taxable_amt) into ll_tax_amt from invoice_trace , taxtran where invoice_trace.invoice_id = taxtran.tran_id and invoice_trace.line_no = taxtran.line_no and invoice_trace.invoice_id= as_invoice and taxtran.tran_id = as_invoice and taxtran.tran_code = 'S-INV' and lot_sl = '1S' and tax_perc in (4,5) ; elsif as_mrp_type = 'N' then SELECT sum(MRP_Nontaxable) MRP_Nontaxable into ll_tax_amt FROM ( SELECT (case when SUM(GET_CHG_NO(invoice_trace.ITEM_CODE , invoice_trace.LOT_NO , invoice_trace.RATE))=1 then (case when trim(invoice_trace.lot_sl)='2S' then (case when sign(invoice_trace.rate)= 1 then sum(invoice_trace.rate__clg * INVOICE_TRACE.quantity__stduom * al_exch_rt )else 0 end )else 0 end)else 0 end ) + (CASE WHEN SUM(GET_CHG_NO(invoice_trace.ITEM_CODE , invoice_trace.LOT_NO , invoice_trace.RATE))= 0 then (case when trim(invoice_trace.lot_sl)= '2S' then (case when sign(invoice_trace.rate)=1 then sum(invoice_trace.rate__clg * INVOICE_TRACE.quantity__stduom * al_exch_rt) else 0 end )else 0 end ) ELSE 0 END) MRP_NonTaxable FROM invoice_trace where INVOICE_TRACE.invoice_id=as_invoice GROUP BY INVOICE_TRACE.ITEM_CODE,INVOICE_TRACE.LOT_NO, INVOICE_TRACE.LOT_SL,INVOICE_TRACE.RATE,INVOICE_TRACE.QUANTITY, INVOICE_TRACE.RATE__CLG); end if; elsif as_type = 'C' then select nvl(SUM(TAX_AMT),0) into ll_tax_amt from invoice_trace where invoice_id = as_invoice AND LOT_SL = as_lotsl ; end if; if ll_tax_amt is null then ll_tax_amt := 0 ; end if ; return ll_tax_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_IND_DET_TRANFLOW (as_IND_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.QUANTITY ,b.max_rate,b.req_date from item a ,indent b where a.item_code = b.item_code and b.ind_no=as_ind_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Max rate'||''||''||'Required on'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RESTR_PRC_RESULT_X ON RESTR_PRC_RESULT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RE_STRUC_HDR_X ON RE_STRUC_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX GATE_REGISTER_X ON GATE_REGISTER (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE STRGCODERETAILMASTER AS OBJECT ( STRG_CODE CHAR(10), STRG_NAME VARCHAR2(120), STRG_TYPE CHAR(1), ADDRESS_AS VARCHAR2(25) , GENDER CHAR(1), ADDR1 VARCHAR2(40) , ADDR2 VARCHAR2(40) , ADDR3 VARCHAR2(40), EMAIL_ADDR VARCHAR2(40), MOBILE_NO VARCHAR2(15), SPL_CODE CHAR(10), SPECIALITY_DESCR VARCHAR2(40), STRG_CLASS_CODE CHAR(1), CLASS_CODE_DESCR VARCHAR2(15), LOCALITY_CODE CHAR(10), LOCALITY_DESCR VARCHAR2(60) , VISITED_WITH_TEAM char(10), TAGGED_LOCATION VARCHAR2(60), ALLWD_DELAY_PRD NUMBER(3), VARIANCE_DISTANCE VARCHAR2(60), SUBCLASS_DESCR VARCHAR2(50), PROMOTER_NAME VARCHAR2(60) , MAN_POWER NUMBER(3) , GST_NO VARCHAR2(40), SUBCLASS_CODE CHAR(2) , PIN VARCHAR2(10) , SH_DESCR VARCHAR2(15) , ROUTE_ID CHAR(3), SURVEY_TEMPL CHAR(10) , NO_VISIT NUMBER(2) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORKORDER_ISSDSL_TRNISSLINISS ON WORKORDER_ISSDET_SL (TRAN_ID__ISS, LINE_NO__ISS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AGING_DAYS_NEW (as_plan_start_date Date,as_actual_start_date Date,as_due_date Date) RETURN NUMBER as ld_tot_days NUMBER:=0; ld_start_days NUMBER := 0; ld_end_days NUMBER := 0; BEGIN if (as_plan_start_date > as_actual_start_date) then ld_start_days := 0; else ld_start_days := as_actual_start_date - as_plan_start_date; end if; if (as_due_date > sysdate) then ld_end_days := 0; else ld_end_days := sysdate - as_due_date; end if; ld_tot_days := ld_start_days + ld_end_days; RETURN ld_tot_days; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CSV_TO_ROW (p_list IN VARCHAR2) RETURN row_of_csv AS l_string VARCHAR2(32767) := p_list || ','; l_comma_index PLS_INTEGER; l_index PLS_INTEGER := 1; l_tab row_of_csv := row_of_csv(); BEGIN LOOP l_comma_index := INSTR(l_string, ',', l_index); EXIT WHEN l_comma_index = 0; l_tab.EXTEND; l_tab(l_tab.COUNT) := TRIM(SUBSTR(l_string, l_index, l_comma_index - l_index)); l_index := l_comma_index + 1; END LOOP; RETURN l_tab; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PORCP_STD_AMT (AS_PORCP IN CHAR , AS_TYPE IN CHAR, AT_DTFR IN DATE, AT_DTTO IN DATE ) RETURN NUMBER IS LC_AMOUNT NUMBER(14,3); LC_MRAAMT NUMBER(14,3); LC_BILLAMT NUMBER(14,3); LC_MRAQTY NUMBER(14,3); LC_BILLQTY NUMBER(14,3); ls_posttype CHAR(1); BEGIN select nvl(POST_TYPE,'A') into ls_posttype from porcp where tran_id = AS_PORCP ; if ls_posttype = 'S' then SELECT NVL(SUM(A.QUANTITY),0),ROUND(NVL(SUM(A.QUANTITY * STD_RATE),0),2) INTO LC_MRAQTY,LC_MRAAMT FROM PORCPDET A, PORCP B WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = AS_PORCP ; else SELECT NVL(SUM(A.QUANTITY),0), ROUND(NVL(SUM(A.NET_AMT),0),2) INTO LC_MRAQTY,LC_MRAAMT FROM PORCPDET A, PORCP B WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = AS_PORCP ; end if ; BEGIN if ls_posttype = 'S' then SELECT NVL(SUM(A.VOUCH_QTY),0) , ROUND(NVL(SUM(A.VOUCH_QTY * A.STD_RATE),0),2) INTO LC_BILLQTY, LC_BILLAMT FROM VOUCHRCP A, VOUCHER B WHERE A.TRAN_ID = B.TRAN_ID AND CONFIRMED = 'Y' AND A.PRCP_ID = AS_PORCP AND B.TRAN_DATE >= AT_DTFR AND B.TRAN_DATE <= AT_DTTO ; ELSE SELECT NVL(SUM(A.VOUCH_QTY),0), ROUND(NVL(SUM(A.NET_AMT),0),2) INTO LC_BILLQTY, LC_BILLAMT FROM VOUCHRCP A, VOUCHER B WHERE A.TRAN_ID = B.TRAN_ID AND CONFIRMED = 'Y' AND A.PRCP_ID = AS_PORCP AND B.TRAN_DATE >= AT_DTFR AND B.TRAN_DATE <= AT_DTTO ; END IF ; EXCEPTION WHEN NO_DATA_FOUND THEN LC_BILLAMT := 0 ; END ; IF AS_TYPE = 'Q' THEN LC_AMOUNT := ABS(LC_MRAQTY) - ABS(LC_BILLQTY) ; ELSIF AS_TYPE = 'MQ' THEN LC_AMOUNT := ABS(LC_MRAQTY) ; ELSE LC_AMOUNT := ABS(LC_MRAAMT) - ABS(LC_BILLAMT) ; END IF ; RETURN LC_AMOUNT; EXCEPTION WHEN NO_DATA_FOUND THEN LC_AMOUNT := 0 ; RETURN LC_AMOUNT; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_POTENCY_TECH ( as_workorder in workorder.work_order%type, as_itemcode in item.item_code%type ) return number is ls_sitecode site.site_code%type; ls_bomcode bom.bom_code%type; ls_lotnnoiss varchar2(120); lc_quantity number(14,3) := 0; lc_potencyqty number(14,3) := 0; lc_potencyperc number(14,3) := 0; lc_batchqty number(14,3) := 0; lc_woqty number(14,3) := 0; begin begin -- get the lot_no__issue (of technical) from workorder select site_code,lot_no__issue, bom_code, quantity into ls_sitecode, ls_lotnnoiss, ls_bomcode, lc_woqty from workorder where work_order = as_workorder; exception when no_data_found then return 0; when others then return 0; end; if ls_lotnnoiss is null or length(trim(ls_lotnnoiss)) = 0 then return 0; end if; begin -- get the bom batch_qty select batch_qty into lc_batchqty from bom where bom_code = ls_bomcode; exception when no_data_found then return 0; when others then return 0; end; begin -- get the quantity and potency_perc from stock for the technical select a.quantity, a.potency_perc into lc_quantity, lc_potencyperc from stock a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and c.available = 'Y' and a.item_code in (select distinct item_code from bomdet where bom_code = ls_bomcode) and a.site_code = ls_sitecode and instr(ls_lotnnoiss,trim(a.lot_no)) > 0 and a.quantity - nvl(a.alloc_qty,0) > 0; end; return lc_quantity ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WORDER_ITEM_DESCR ( tran_id porder.purc_order%type, as_line porddet.line_no%type) return varchar2 is ls_descr item.descr%type; begin select descr into ls_descr from item where item_code in (select item_code from workorder where work_order in (select work_order from porddet where purc_order = tran_id and line_no = as_line)); return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_X ON SALES_QUOT (QUOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITEM_CREDIT_PERC_X ON ITEM_CREDIT_PERC (ITEM_CODE, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PDC_GIVENDET_REF_ID ON PDC_GIVENDET (REF_SER, REF_NO, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXEMPTEDAMT ( as_ref_ser in char,as_ref_id in char , as_item_code in char , as_lot_no in char) return number is ll_amt number(16,2); begin begin if as_ref_ser = 'D-ISS' then select amount into ll_amt From distord_issdet Where tran_id= as_ref_id and item_code=as_item_code and lot_no=as_lot_no; elsif as_ref_ser = 'S-DSP' then select quantity * nvl(rate__clg,0) into ll_amt from DESPATCHDET where DESP_ID= as_ref_id and item_code=as_item_code and lot_no=as_lot_no; elsif as_ref_ser = 'P-RET' then select quantity * nvl(rate,0) into ll_amt from porcpdet where tran_id = as_ref_id and item_code=as_item_code and lot_no=as_lot_no; end if; exception when others then ll_amt := 0; end; RETURN ll_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_POAMD_DET BEFORE insert or update of line_no__ord ON poamd_det referencing old as old new as new FOR EACH ROW DECLARE ls_sql varchar2(500); BEGIN :new.line_no__ord := lpad(trim(:new.line_no__ord),3,' ') ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX NCL_STRG_CUSTOMER_STAN ON NCL_STRG_CUSTOMER (STAN_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_SUMM_NEW (ls_tran_code in char, ls_tran_id in char, ls_disparm_code in char, ls_disparm_code_1 in char, ls_disparm_code_2 in char, ls_type in char) return number is lc_tax_amt number(14,3); LS_VAR_VALUE VARCHAR(2000); LS_VAR_VALUE1 VARCHAR(2000); LS_VAR_VALUE2 VARCHAR(2000); lc_exch_rate number(17,6); begin begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = LS_DISPARM_CODE; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code AND TRAN_ID = LS_TRAN_ID AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); --end if; -- taxable amt ELSIF ls_type = 'B' then select nvl(sum(nvl(Taxable_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code AND TRAN_ID = LS_TRAN_ID AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); --end if; -- tax % ELSIF ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code AND TRAN_ID = LS_TRAN_ID AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) AND TAX_AMT <>0 ; --end if; -- taxable amt ELSIF LS_TYPE = 'A' THEN SELECT (RTRIM(VAR_VALUE)) into ls_var_value1 from disparm WHERE PRD_CODE = '999999' AND VAR_NAME = ls_disparm_code_1; SELECT (RTRIM(VAR_VALUE)) into ls_var_value2 from disparm WHERE PRD_CODE = '999999' AND VAR_NAME = LS_DISPARM_CODE_2; select coalesce(SUM(taxable_amt), 0) into lc_tax_amt from taxtran,tax WHERE tax.tax_code = taxtran.tax_code and tran_code = ls_tran_code and tran_id = ls_tran_id And tax_perc <> 0 AND (TAX.TAX_TYPE) IN ('H','I','J') AND (TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE1)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE2)) ) ); end if; exception when no_data_found then lc_tax_amt := 0 ; end ; RETURN LC_TAX_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_STOCK_COSISTENCY BEFORE INSERT OR Update OF ALLOC_QTY, QUANTITY, no_art, hold_qty ON STOCK referencing old as old new as new FOR EACH ROW declare ls_available char(1); ls_inv_stat char(5); ls_msg varchar2(2000); ls_stattype char(1); trace_alloc number(18,7); begin if inserting and :new.qty_per_art is null then ls_msg := ' site_code [' || :new.site_code || '] item_code [' || :new.item_code || '] loc_code [' || :new.loc_code || '] Lot_no [' || :new.lot_no || '] Lot_sl [' || :new.lot_sl || '] quantity ' || to_char(:new.quantity) || ' alloc_qty ' ||to_char(:new.alloc_qty); raise_application_error( -20601, 'Quantity per Article cannot be null for ' || ls_msg); end if; if updating('NO_ART') and :new.no_art < 0 then if :new.quantity > 0 then :new.no_art := 1; else :new.no_art := 0; end if; end if; ls_msg := ' site ' || :new.site_code || ' item ' || :new.item_code || ' location ' || :new.loc_code || ' Lot no ' || :new.lot_no || ' Lot sl ' || :new.lot_sl || ' quantity ' || to_char(:new.quantity) || ' alloc_qty ' ||to_char(:new.alloc_qty); begin select inv_stat into ls_inv_stat from location where loc_code = :new.loc_code; select case when stat_type is null then 'M' else stat_type end,available into ls_stattype, ls_available from invstat where inv_stat = ls_inv_stat and rownum = 1; end; if (ls_stattype <> 'S' and ls_available = 'Y' and :new.quantity < 0) then raise_application_error( -20601, 'Stock cannot be negative for ' || ls_msg); end if; if ((ls_stattype <> 'S' and :new.alloc_qty > :new.quantity) or (:new.alloc_qty < 0) ) then raise_application_error( -20602, 'Allocated stock cannot be negative / more than available quantity for ' || ls_msg); end if; if :new.hold_qty < 0 then raise_application_error( -20602, 'Hold quantity cannot be negative for ' || ls_msg); end if; if updating then if (ls_stattype <> 'S' and :new.alloc_qty <> :old.alloc_qty) then select sum(alloc_qty) INTO trace_alloc from invalloc_trace where invalloc_trace.site_code = :old.site_code and invalloc_trace.item_code= :old.item_code and invalloc_trace.loc_code= :old.loc_code and invalloc_trace.lot_no= :old.lot_no and invalloc_trace.lot_sl= :old.lot_sl; ls_msg := ls_msg || ' trace allocation [' || to_char(trace_alloc) || ']'; if round(trace_alloc,3) <> round(:new.alloc_qty,3) THEN raise_application_error( -20602, 'Allocation does not match with allocation trace for ' || ls_msg); end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_ITEM_AMD_X ON SALES_QUOT_ITEM_AMD (AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ACCTCODE_CR_VAL (as_porder varchar,as_acctcode_cr varchar) return number as ls_currcode porder.curr_code%type; begin select curr_code into ls_currcode from porder where purc_order = as_porder; if ls_currcode = 'RS' then if instr(as_acctcode_cr,0411) > 0 or instr(as_acctcode_cr,0412) > 0 then return 1; else return 0; end if; else if instr(as_acctcode_cr,0416) > 0 or instr(as_acctcode_cr,0417) > 0 then return 1; else return 0; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_TRANS_DEBIT (ldate_fr in date, ldate_to in date, lsite_code in char, lacct_code in char) return number is lc_dr_sum number(14,3); begin Select nvl(Sum(dr_amt),0) into lc_dr_sum from gltran where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EESI_AMT (as_fr_emp char , as_to_emp char , as_fr_prd char , as_to_prd char , as_ad_code char ) return number is lc_eesi number(12,2) ; begin lc_eesi := 0; begin SELECT nvl(sum(nvl(amount,0)),0) into lc_eesi FROM payarr_det WHERE prd_code between as_fr_prd and as_to_prd and emp_code between as_fr_emp and as_to_emp and ad_code = as_ad_code ; EXCEPTION WHEN NO_DATA_FOUND THEN lc_eesi := 0 ; END ; return lc_eesi; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TYPE_X ON PROJ_TYPE (PROJ_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RETURNEXP_DATE (AS_mfg_date__start DATE, AS_item_shelf_life NUMBER) RETURN DATE IS ldt_exp_date WORKORDER.MFG_DATE__START%TYPE; ADT_MFG_DATE WORKORDER.MFG_DATE__START%TYPE; AD_MONTHS ITEM.SHELF_LIFE%TYPE; ldt_mfg_date WORKORDER.MFG_DATE__START%TYPE; BEGIN BEGIN ADT_MFG_DATE := AS_mfg_date__start; AD_MONTHS := AS_item_shelf_life; IF (AD_MONTHS < 0) THEN AD_MONTHS := AD_MONTHS + 1 ; ELSE AD_MONTHS := AD_MONTHS - 1 ; END IF; ldt_mfg_date := ADD_MONTHS(ADT_MFG_DATE, AD_MONTHS); ldt_exp_date := LAST_DAY(ldt_mfg_date); END; RETURN ldt_exp_date; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RECEIPTTRANSIT_VALUE (as_retflag varchar2, as_tranid varchar2,as_item_code varchar2,as_item_ser varchar2,as_cust_code varchar2) return number is as_final_value number(10,2); invid varchar2(20); as_itemcode varchar2(20); as_itemser varchar2(20); as_sum_freeqty number(10,2); as_sum_value number(10,2); as_sum_totalfreeqty number(10,2); as_sum_totalvalue number(10,2); as_quantity__stduom number(10,2); as_sum_totalprevvalue number(10,2); as_rate__stduom number(10,2); as_sum_totalfreevalue number(10,2); cursor curAmt is select invoice_id,as_item_code as asitemcode,as_item_ser as asitemser from CUST_STOCK_INV where tran_id= as_tranid and dlv_flg= as_retflag; cursor curval is SELECT itrace.quantity__stduom FROM invoice invoice,invoice_trace itrace WHERE invoice.invoice_id = Itrace.invoice_id AND invoice.invoice_id = invid AND item_code = as_item_code AND itrace.item_ser__prom = as_item_ser AND rate__stduom = 0.001; begin open curAmt; as_sum_totalfreeqty:= 0; as_sum_totalvalue:= 0; as_sum_totalprevvalue:= 0; loop begin fetch curAmt into invid,as_itemcode,as_itemser ; exit when curAmt%notFound; SELECT NVL(SUM(TOTFREEQTY),0),NVL(SUM(TOTFREEVALUE),0) INTO AS_SUM_FREEQTY,AS_SUM_VALUE FROM (SELECT INVOICE_ID, SUM(NVL(QUANTITY,0)) TOTFREEQTY, SUM(NVL(RATE,0)), SUM(NVL(QUANTITY,0))*SUM(NVL(RATE,0)) AS TOTFREEVALUE FROM (SELECT INVOICE.INVOICE_ID AS INVOICE_ID, 0 QUANTITY, MAX(RATE__STDUOM) RATE FROM INVOICE INVOICE, INVOICE_TRACE ITRACE WHERE INVOICE.INVOICE_ID = ITRACE.INVOICE_ID AND INVOICE.INVOICE_ID = invid AND trim(ITEM_CODE) = as_itemcode AND ( trim(ITRACE.ITEM_SER__PROM) =as_itemser OR((ITRACE.ITEM_SER__PROM,ITRACE.ITEM_CODE) IN (SELECT ITEM_SER, ITEM_CODE FROM ITEM_CREDIT_PERC WHERE trim(ITEM_SER) ! = as_itemser )) ) AND RATE__STDUOM>0.001 GROUP BY INVOICE.INVOICE_ID UNION ALL SELECT INVOICE.INVOICE_ID AS INVOICE_ID, QUANTITY__STDUOM QUANTITY, 0 RATE FROM INVOICE INVOICE, INVOICE_TRACE ITRACE WHERE INVOICE.INVOICE_ID = ITRACE.INVOICE_ID AND INVOICE.INVOICE_ID = invid AND trim(ITEM_CODE) = as_itemcode AND ( trim(ITRACE.ITEM_SER__PROM) = as_itemser OR((ITRACE.ITEM_SER__PROM,ITRACE.ITEM_CODE) IN (SELECT ITEM_SER, ITEM_CODE FROM ITEM_CREDIT_PERC WHERE trim(ITEM_SER) ! = as_itemser )) ) AND RATE__STDUOM<=0.001 ) GROUP BY INVOICE_ID ) --HAVING SUM(TOTFREEVALUE) >0 --AND SUM(TOTFREEQTY) >0 ; IF AS_SUM_VALUE >0 THEN as_sum_totalvalue := as_sum_totalvalue+AS_SUM_VALUE; END IF; open curval; loop fetch curval into as_quantity__stduom; exit when curval%notFound; SELECT rate__stduom into as_rate__stduom FROM invoice_trace itrace WHERE itrace.invoice_id = invid and itrace.item_code = as_item_code AND Itrace.rate__stduom >0.001; as_sum_totalprevvalue := as_sum_totalprevvalue + nvl((as_rate__stduom*as_quantity__stduom),0); end loop ; close curval; -- IF AS_SUM_VALUE is null or AS_SUM_VALUE='' THEN -- as_sum_totalvalue := as_sum_totalvalue||invid; -- as_sum_totalvalue := as_sum_totalvalue+0; -- ELSE -- as_sum_totalvalue := as_sum_totalvalue||invid||'-'||to_char(AS_SUM_VALUE)||','; --as_sum_totalvalue := as_sum_totalvalue+as_sum_value; -- END IF; end; end loop ; close curAmt; as_final_value :=as_sum_totalvalue+as_sum_totalprevvalue; return as_final_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_NEW ( ls_tran_code CHAR, ls_tran_id CHAR, ls_line_no CHAR, ls_disparm_code CHAR, ls_disparm_code_1 CHAR, ls_disparm_code_2 CHAR, ls_type CHAR ) RETURN NUMBER IS lc_tax_amt NUMBER(14,3); ls_var_value disparm.var_value%TYPE; ls_var_value1 disparm.var_value%TYPE; ls_var_value2 disparm.var_value%TYPE; as_line_no CHAR(3); lc_exch_rate NUMBER(17,6); BEGIN IF LENGTH(TRIM(ls_line_no)) = 1 THEN as_line_no := ' ' || RTRIM(LTRIM(ls_line_no)); ELSIF LENGTH(TRIM(ls_line_no)) = 2 THEN as_line_no := ' ' || RTRIM(LTRIM(ls_line_no)); ELSIF LENGTH(TRIM(ls_line_no)) = 3 THEN as_line_no := RTRIM(LTRIM(ls_line_no)); END IF; SELECT (',' || RTRIM(var_value) || ',') INTO ls_var_value FROM disparm WHERE prd_code = '999999' AND var_name = ls_disparm_code; -- tax amt IF ls_type = 'T' THEN SELECT NVL(SUM(NVL(Tax_Amt,0)), 0) INTO lc_tax_amt FROM taxtran WHERE tran_code = ls_tran_code AND tran_id = ls_tran_id AND line_no = as_line_no -- AND INSTR(ls_var_value,(',' || RTRIM(tax_code) || ',')) > 0; AND tax_code IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value)) ) AND TAX_AMT <>0 ; END IF; -- taxable amt IF ls_type = 'B' THEN SELECT NVL(SUM(NVL(Taxable_amt,0)), 0) INTO lc_tax_amt FROM taxtran WHERE tran_code = ls_tran_code AND tran_id = ls_tran_id AND line_no = as_line_no -- AND INSTR(ls_var_value,(',' || RTRIM(tax_code) || ',')) > 0; AND tax_code IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value)) ) AND TAX_AMT <>0 ; END IF; -- tax % IF ls_type = 'P' THEN SELECT MAX(tax_perc) INTO lc_tax_amt FROM taxtran WHERE tran_code = ls_tran_code AND tran_id = ls_tran_id AND line_no = as_line_no --AND INSTR(ls_var_value,(',' || RTRIM(tax_code) || ',')) > 0 AND tax_code IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value)) ) AND TAX_AMT <> 0; END IF; -- taxable amt IF ls_type = 'A' THEN SELECT NVL(SUM( CASE WHEN tax_type = 'H' THEN NVL(taxable_amt, 0) WHEN tax_type = 'I' THEN NVL(taxable_amt, 0) WHEN tax_type = 'J' THEN NVL(taxable_amt, 0) ELSE 0 END), 0) INTO lc_tax_amt FROM taxtran JOIN tax ON tax.tax_code = taxtran.tax_code WHERE tran_code = ls_tran_code AND tran_id = ls_tran_id AND line_no = as_line_no AND tax_perc <> 0 AND tax.tax_type IN ('H', 'I', 'J') AND ( TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE1)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE2)) ) ); END IF; RETURN lc_tax_amt; EXCEPTION WHEN NO_DATA_FOUND THEN lc_tax_amt := 0; RETURN lc_tax_amt; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_PRET_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from porcp where tran_id=as_tran_id and tran_ser='P-RET'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CHA_TRACE_X ON CHA_TRACE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_SORDER_SCHEME ON SORDER_SCHEME (TRAN_ID, AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRECRIPTION_DESCR ( as_brand_descr varchar,as_item_descr varchar ,as_emp_code char) return CHAR is ls_precription_descr VARCHAR2(120) ; param_value VARCHAR2(60); begin SELECT get_sfaparm_data('CAMP_BRAND_SKU',as_emp_code) into param_value from dual; if (param_value = 'BRAND') THEN ls_precription_descr :=as_brand_descr; END IF; if (param_value = 'ITEM') THEN ls_precription_descr :=as_item_descr; END IF; return ls_precription_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_ENHANC_PRESENT (as_workorder workorder_iss.work_order%type, as_operation workorder_iss.operation%type) return char is ls_opt char(1); ll_count number(3); begin select count(*) into ll_count from workorder_enhanc where work_order = as_workorder and ( operation = as_operation or operation_level = as_operation or ( operation >= as_operation and operation_level <= as_operation )); if ll_count = 0 then return 'N'; else return 'Y'; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_SITE_CHK BEFORE update of FIN_ENTITY ON SITE referencing old as OLD new as NEW FOR EACH ROW declare ll_count number; BEGIN if trim(:NEW.FIN_ENTITY) <> trim(:OLD.FIN_ENTITY) then begin select count(1) into ll_count from gltrace where site_code = :new.site_code; exception when others then ll_count := 0; end; if ll_count > 0 then raise_application_error( -20601, 'Change of Financial Entiry is not allowed as there is already [' || to_char(ll_count) ||'] rows in gltrace for the site' ); end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX COURSE_CONTENT_PK ON COURSE_CONTENT (COURSE_CHAPTER, COURSE_CODE, CONTENT_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WISS_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from workorder_iss where tran_id=as_tran_id and tran_type='I'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_RPT_CTL ON RPT_PRINT_CTRL (REPORT_NAME, PARAMETER_VAL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEET_SETPKVAL before insert or update on strg_meet for each row declare ls_entry_mode varchar(10); noof_row number(10); max_line_no number(10); max_order_of_visit number(10); dr_visit char(1); chem_visit char(1); stockist_visit char(1); other_visit char(1); stan_code char(5); locality_code_from varchar(10); stan_code__from char(5); route_id__from char(3); load_count number(10); ls_load_no char(10); veh_no varchar(20); allow_multi_DCRDay VARCHAR2(60); begin ls_entry_mode := 'XFORM'; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0) then begin if (:new.tran_id is not null and length(trim(:new.tran_id)) > 0 and upper(substr(:new.tran_id,1,1)) <> 'W') then ls_entry_mode := 'XFORM'; end if; noof_row := 0; load_count := 0; SELECT count(*) into load_count FROM sprs_day_summ where event_date <= :new.event_date and sales_pers = :new.sales_pers and load_status='N'; SELECT PARM_VALUE into allow_multi_DCRDay FROM SFAPARM WHERE ORG_UNIT='ALL' AND PARM_NAME='ALLOW_MULTI_DCR_DAY' AND ACTIVE='Y'; if load_count > 0 then SELECT LOAD_NO,VEH_NO INTO ls_load_no,veh_no FROM sprs_day_summ where event_date <= :new.event_date and sales_pers = :new.sales_pers and load_status='N'; end if; if (ls_load_no is not null and length(trim(ls_load_no)) > 0 ) then select count(*) into noof_row from sprs_act_tran where event_date = :new.event_date and sales_pers = :new.sales_pers and activity_code <> 'PR' and LOAD_NO = ls_load_no; ELSE select count(*) into noof_row from sprs_act_tran where event_date = :new.event_date and sales_pers = :new.sales_pers and activity_code <> 'PR'; end if; if noof_row > 0 then if (ls_load_no is not null and length(trim(ls_load_no)) > 0 ) then select s.dcr_id into :new.dcr_id from sprs_act_tran s, fieldactivity f where s.activity_code = f.activity_code and s.event_date = :new.event_date and s.sales_pers = :new.sales_pers and f.activity_type = (select activity_type from fieldactivity where activity_code = :new.event_type) and s.LOAD_NO = ls_load_no; ELSE select s.dcr_id into :new.dcr_id from sprs_act_tran s, fieldactivity f where s.activity_code = f.activity_code and s.event_date = :new.event_date and s.sales_pers = :new.sales_pers and f.activity_type = (select activity_type from fieldactivity where activity_code = :new.event_type); end if; end if; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0) then begin select 'WF' || substr( '0000000000' || fastdcr_seq.nextval , -8 ) into :new.dcr_id from dual; insert into sprs_act_tran(tran_id , event_date , activity_code , sales_pers , chg_date , chg_user , chg_term , dcr_id,copy_plan,LOAD_NO,VEH_NO) values(:new.dcr_id , :new.event_date , :new.event_type , :new.sales_pers , :new.chg_date , :new.chg_user , :new.chg_term , :new.dcr_id,:new.copy_plan,ls_load_no,veh_no); end; end if; end; end if; if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then begin ls_entry_mode := 'WIZARD'; select substr('0000000000' || strgmeet_seq.nextval , -10) into :new.tran_id from dual; if (:new.ref_tran_id is null or length(trim(:new.ref_tran_id)) = 0) then begin noof_row := 0; select count(*) into noof_row from sprs_travel where sales_pers = :new.sales_pers and travel_date = :new.event_date and locality_code = :new.locality_code and rownum=1; if noof_row > 0 then select tran_id into :new.ref_tran_id from sprs_travel where sales_pers = :new.sales_pers and travel_date = :new.event_date and locality_code = :new.locality_code and rownum=1; end if; end; end if ; end; end if; if (:new.tran_id is not null and length(trim(:new.tran_id)) > 0 ) then begin noof_row := 0; dr_visit :='N'; chem_visit :='N'; stockist_visit :='N'; other_visit :='N'; if (:new.strg_type='D') then dr_visit :='Y'; end if; if (:new.strg_type='C') then chem_visit :='Y'; end if; if (:new.strg_type='S') then stockist_visit :='Y'; end if; if (:new.strg_type='O') then other_visit :='Y'; end if; select count(*) into noof_row from sprs_travel where travel_date = :new.event_date and sales_pers = :new.sales_pers and locality_code= :new.locality_code and (sprs_code__ww = :new.sprs_code__ww or sprs_code__ww is null); if noof_row = 0 then begin select max(order_of_visit) into max_order_of_visit from sprs_travel where travel_date = :new.event_date and sales_pers = :new.sales_pers; max_order_of_visit := nvl(max_order_of_visit , 0) + 1; end; begin select max(line_no) into max_line_no from sprs_travel where travel_date = :new.event_date and sales_pers = :new.sales_pers; max_line_no := nvl(max_line_no , 0) + 1; end; begin SELECT count(*) into noof_row FROM SPRS_TRAVEL ST, LOCALITY LOC WHERE ORDER_OF_VISIT = ( SELECT MAX( ORDER_OF_VISIT) FROM SPRS_TRAVEL WHERE SALES_PERS= :new.sales_pers AND TRAVEL_DATE =(SELECT MAX(TRAVEL_DATE) FROM SPRS_TRAVEL WHERE SALES_PERS=:new.sales_pers AND TRAVEL_DATE <= :new.event_date) ) AND LOC.LOCALITY_CODE = ST.LOCALITY_CODE AND ST.SALES_PERS= :new.sales_pers AND ST.TRAVEL_DATE =(SELECT MAX(TRAVEL_DATE) FROM SPRS_TRAVEL WHERE SALES_PERS=:new.sales_pers AND TRAVEL_DATE <= :new.event_date); if noof_row = 0 then IF(:NEW.sprs_code__ww IS NOT NULL AND LENGTH(trim(:NEW.sprs_code__ww)) > 0 ) THEN select locality_code, stan_code,route_id into locality_code_from, stan_code__from,route_id__from from sprs_route where sprs_code = :new.sprs_code__ww and stan_code = (select stan_code__hq from employee where emp_code = :new.sprs_code__ww) and rownum = 1; ELSE select locality_code, stan_code,route_id into locality_code_from, stan_code__from,route_id__from from sprs_route where sprs_code = :new.sales_pers and stan_code = (select stan_code__hq from employee where emp_code = :new.sales_pers) and rownum = 1; end if; ELSE SELECT ST.LOCALITY_CODE, ST.stan_code,route_id into locality_code_from, stan_code__from,route_id__from FROM SPRS_TRAVEL ST, LOCALITY LOC WHERE ORDER_OF_VISIT = ( SELECT MAX( ORDER_OF_VISIT) FROM SPRS_TRAVEL WHERE SALES_PERS= :new.sales_pers AND TRAVEL_DATE =(SELECT MAX(TRAVEL_DATE) FROM SPRS_TRAVEL WHERE SALES_PERS=:new.sales_pers AND TRAVEL_DATE <= :new.event_date) ) AND LOC.LOCALITY_CODE = ST.LOCALITY_CODE AND ST.SALES_PERS= :new.sales_pers AND ST.TRAVEL_DATE =(SELECT MAX(TRAVEL_DATE) FROM SPRS_TRAVEL WHERE SALES_PERS=:new.sales_pers AND TRAVEL_DATE <= :new.event_date) and rownum = 1; end if; end; begin if(:new.locality_code is not null and length(trim(:new.locality_code)) > 0 ) then select stan_code into stan_code from LOCALITY where locality_code = :new.locality_code; insert into sprs_travel(tran_id, sales_pers, travel_date,locality_code, stan_code, travel_mode, over_night, activity_code, chg_date, chg_user, chg_term, order_of_visit, dcr_id, line_no, dr_visit, chem_visit, stockist_visit,other_visit, add_geopos, chg_geopos, sprs_code__ww,STAN_CODE__FROM,LOCALITY_CODE_FROM,STATION_TYPE,ROUTE_ID,ROUTE_ID_FROM) values(:new.tran_id, :new.sales_pers, :new.event_date, :new.locality_code, stan_code , '1', 'N', :new.event_type, :new.chg_date, :new.chg_user, :new.chg_term, max_order_of_visit , :new.dcr_id, max_line_no, dr_visit, chem_visit, stockist_visit, other_visit, :new.ADD_GEOPOS, :new.CHG_GEOPOS, :new.sprs_code__ww,stan_code__from,locality_code_from,:new.station_type,:new.route_id,route_id__from); end if; end; end if; end; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_LOCATION (as_loc_code char) return number is ls_count number(1); ls_useable char(1); begin select usable into ls_useable from location where loc_code=as_loc_code; if( ls_useable ='N') then ls_count :=0; else ls_count:=1; end if; return ls_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01031: insufficient privileges -- CREATE OR REPLACE TRIGGER DT_DOTYPE_ADD BEFORE INSERT ON DISTORDER_TYPE referencing old as old new as new FOR EACH ROW declare ldt_excutdate date; BEGIN raise_application_error( -20601, 'Item Series addition not allowed and it depends on other configuration'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_STK_ACC_CCTR BEFORE insert ON stock referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; ls_pricelist char(5); ls_listtype char(1); BEGIN if nvl(:new.acct_code__inv,' ') = ' ' or length(trim(:new.acct_code__inv)) = 0 then begin select acct_code__inv into :new.acct_code__inv from item_lot_info where item_code = :new.item_code and lot_no = :new.lot_no; exception when others then null; end; end if; if nvl(:new.cctr_code__inv,' ') = ' ' or length(trim(:new.cctr_code__inv)) = 0 then begin select cctr_code__inv into :new.cctr_code__inv from item_lot_info where item_code = :new.item_code and lot_no = :new.lot_no; exception when others then null; end; end if; if length(rtrim(:new.lot_no)) <> length(trim(:new.lot_no)) then raise_application_error( -20602, 'Leading space not allowed in lot number'); end if; if length(rtrim(:new.lot_sl)) <> length(trim(:new.lot_sl)) then raise_application_error( -20602, 'Leading space not allowed in lot serial'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRIG_WORKORDER_BILL_QTY BEFORE INSERT OR UPDATE on WORKORDER_BILL FOR EACH ROW BEGIN IF :NEW.QUANTITY = 0 AND CASE WHEN :NEW.CRIT_ITEM IS NULL THEN 'N' ELSE :NEW.CRIT_ITEM END = 'Y' THEN RAISE_APPLICATION_ERROR( -20601, 'Quantity can not be zero for critical item. Work Order:'||:NEW.WORK_ORDER||' Operation:'||:NEW.OPERATION || ' Exp Lev::'||:NEW.EXP_LEV ||' Ref Qty:'||:NEW.REF_QTY||' Item Code:'|| :NEW.ITEM_CODE); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKGEO_FENCE_OPTION ( p_geo_fence_enable IN CHAR --(1.GEO_FENCE_ENABLE) ) RETURN NUMBER IS -- Object Name: UGM_manage_users_geofence -- Event Type: field_validation -- Form Number: 1 -- Field Name: GEO_FENCE_OPTION -- Business Logic: check if GEO_FENCE_ENABLE = 2 mandatory -- Function Name: checkGEO_FENCE_OPTION v_result NUMBER := 0; -- Variable to store the result of validation BEGIN -- Check if GEO_FENCE_ENABLE is equal to 2 IF p_geo_fence_enable = '2' THEN v_result := 1; -- Set result to 1 indicating valid data ELSE v_result := 0; -- Set result to 0 indicating invalid data END IF; RETURN v_result; -- Return the validation result END CHECKGEO_FENCE_OPTION; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NUMBERTOWORD1 (var in number,curr_code varchar2 ) return varchar2 is amt number; strt number; val number; str varchar2(15); c_str varchar2(400); flag number:=0; begin val:=round(var,2); amt:=floor(val); str:=to_char(amt); if val > 0then if length(str) >= 8 and length(str) <=10 then strt:=(length(str)-7); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' crore '; amt:=to_number(substr(to_char(amt),(strt+1),7)); flag:=0; end if; str:=to_char(amt); if ((length(str) >= 6 and length(str) <= 7) or flag = 1) then strt:=(length(str) - 5); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' lakh '; amt:=to_number(substr(to_char(amt),(strt+1),5)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 5 ) or flag = 1) then c_str:=c_str || initcap(case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end); end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := case when c_str = '' or c_str is null then 'Zero and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end || ' Paise Only' else curr_code || c_str || ' and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end || ' Paise Only' end; else c_str := curr_code ||'-'|| c_str || ' Only'; end if; return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DEMAND_QTY ( ls_site_code in char, ls_item_code in char, ls_prd_code_plan in char, ls_prd_code_for in char) return number is ld_qty number(14,3); ld_fr_date date; ld_to_date date; begin select fr_date,to_date into ld_fr_date,ld_to_date from period where code = ls_prd_code_for; select sum(quantity) into ld_qty from sales_demand where site_code = ls_site_code and item_code = ls_item_code and due_date between ld_fr_date and ld_to_date ; return(ld_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RETURNSORDTYPE (as_tranid IN char) RETURN CHAR IS LS_TYPE CHAR(2); BEGIN select rtrim(order_type) into ls_type from SORDER where SALE_ORDER in (select sord_no from distorder where DIST_ORDER in (select DIST_ORDER FROM DISTORD_ISS WHERE TRAN_ID=AS_TRANID)); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_INIT_MKT_X ON PROJ_INIT_MKT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECK_POS_CODE (as_emp_site char, as_pos_code char) return number is m_return number(1) :=0; m_pos_cnt number(1); begin if (as_emp_site ='SP876' and trim(as_pos_code) is null) then m_return := 1; else select count(1) into m_pos_cnt from org_structure a, version b where a.version_id = b.version_id and a.pos_code = as_pos_code and sysdate between b.eff_from and b.valid_upto and a.emp_code is null; end if; if m_pos_Cnt <> 1 then m_return := 1; end if; return m_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_SITEITEM_MFG_TYPE ( as_site_code in char, as_item_code in char, as_mfg_type in char) return number is i_row integer; begin begin select nvl(decode(as_mfg_type,'R', 1, count(1) ),1) into i_row from siteitem where site_code = as_site_code and item_code = as_item_code and mfg_type = as_mfg_type ; exception WHEN NO_DATA_FOUND THEN begin if as_mfg_type = 'R' then i_row := 1 ; else i_row := 0 ; end if; end; WHEN OTHERS THEN begin i_row := 0; end; end; return i_row; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CENVAT_AMT (as_tran_id char,as_type char) return number is lc_basic number(17,3); ls_prcp_id char(10); begin select prcp_id into ls_prcp_id from vouchrcp where tran_id= as_tran_id; if as_type = 'CN' then select sum(tax_processed.adj_amt ) into lc_basic from tax_processed where tax_processed.ref_id =ls_prcp_id and tax_processed.bal_group LIKE 'CEN%'; elsif as_type = 'CS' then select sum(tax_processed.adj_amt ) into lc_basic from tax_processed where tax_processed.ref_id =ls_prcp_id and tax_processed.bal_group LIKE 'CES%' ; elsif as_type = 'SH' then select sum(tax_processed.adj_amt ) into lc_basic from tax_processed where tax_processed.ref_id =ls_prcp_id and ( tax_processed.bal_group LIKE 'SHE%' OR tax_processed.bal_group LIKE 'SER%') ; end if; return lc_basic; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_COSTCTR_DESCR (mcctr_code in char) return varchar2 is mcctr_descr costctr.descr%type := null; begin select descr into mcctr_descr from costctr where cctr_code = mcctr_code; return mcctr_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RM_BOM_FG_DESCR (m_code in char) return varchar2 is v_temp varchar2(4000); cursor c1 is select distinct item_code from bomdet where item_code = m_code; cursor c2( v_item bomdet.item_code%type) is select distinct b.descr from bom a , item b where a.item_code = b.item_code and a.bom_code in ( select distinct bom_code from bomdet where item_code=v_item); begin for x in c1 loop for y in c2(x.item_code) loop v_temp := v_temp||rtrim(y.descr)||','; end loop; end loop; return v_temp; exception when others then return 'NA' ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INTERNAL_SALES (ls_prd_code_fr in char, ls_prd_code_to in char, ls_level_code in char, ls_item_ser in char) return number is lc_val number(14,3); begin select sum(sales_val - return_val + repl_val) into lc_val from sm_sales_site where item_ser=ls_item_ser and prd_code between ls_prd_code_fr and ls_prd_code_to and level_code = ls_level_code; return lc_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ADVPO_VOUCHERNO (as_purc_no porder.purc_order%type) return varchar2 is ls_data varchar2(1500); ls_tranid voucher.tran_id%type; cursor cur_vouch is select tran_id from voucher where purc_order = as_purc_no; begin open cur_vouch; loop fetch cur_vouch into ls_tranid; exit when cur_vouch%notfound; ls_data := ls_data || ls_tranid || chr(10) ; end loop; close cur_vouch; return ls_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RESTR_PRC_RESULT_DET_X ON RESTR_PRC_RESULT_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX APPR_FILE_X ON APPRAISAL_FILE (EMP_CODE, DATE1) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRYTYPE (as_type in char,as_code in char, as_refid in char,as_refser char,ls_flag char ) return varchar2 is as_var1 varchar2(100); ls_type char(10); ls_code char(10); begin if upper(trim(as_type)) = 'O' then if (as_refser = 'S-INV' ) then select 'C', cust_code into ls_type,ls_code from invoice where invoice_id = as_refid ; elsif ( as_refser ='CRNRCP' or as_refser ='DRNRCP') then select 'C', drcr_rcp.cust_code into ls_type,ls_code from drcr_rcp where tran_id = as_refid ; elsif (as_refser = 'MDRCRD'or as_refser ='MDRCRC') then select sundry_type,sundry_code into ls_type,ls_code from misc_drcr_rcp where tran_id = as_refid ; elsif (as_refser = 'M-VOUC') then select sundry_type,sundry_code into ls_type,ls_code from misc_voucher where tran_id = as_refid ; elsif (as_refser = 'VOUCH') then select supp_code into ls_code from voucher where tran_id = as_refid ; ls_type := 'S'; elsif (as_refser = 'P-VOUC') then select emp_code into ls_code from payr_voucher where tran_id = as_refid ; ls_type := 'E'; elsif (as_refser ='E-PAY') then select sundry_type,sundry_code into ls_type,ls_code from payment_exp where tran_id = as_refid ; elsif (as_refser ='M-PAY') then select sundry_type,sundry_code into ls_type,ls_code from misc_payment where tran_id = as_refid ; elsif (as_refser ='M-RCP') then select sundry_type,sundry_code into ls_type,ls_code from misc_receipt where tran_id = as_refid ; elsif (as_refser ='RCP') then select 'R','RCP' into ls_type,ls_code from receipt where tran_id = as_refid ; elsif(as_refser ='MPCANC') then select sundry_type,sundry_code into ls_type,ls_code from misc_payment_canc where tran_id = as_refid ; end if; end if ; if ls_flag = 'A' then as_var1:= ls_type ; elsif ls_flag = 'B' then as_var1:= ls_code ; elsif ls_flag = 'C' then as_var1:= ls_type||' '||ls_code; end if; return as_var1 ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_CUST_FNAME ON STRG_CUSTOMER (FIRST_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORDER_DET_ITEM_DUE ON DISTORDER_DET (ITEM_CODE, DUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_STOCK_RATE (as_site stock.site_code%type, as_item stock.item_code%type, as_loc stock.loc_code%type, as_lot stock.lot_no%type, as_LOT_SL stock.lot_SL%type) return number is ll_rate number(14,7); begin select nvl(rate,0) into ll_rate from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and lot_SL = as_lot_SL and rownum = 1; return ll_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STK_CONTAINER_WT_X ON STK_CONTAINER_WT (ITEM_CODE, SITE_CODE, LOC_CODE, LOT_NO, LOT_SL, LINE_NO_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CHECKLIST_REV_CHKL_CD ON CHECKLIST_REV (CHKLIST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_EXCH_RATE (ls_tran_code in char,ls_tran_id in char) return number is lc_exch_rate number(17,6); begin if rtrim(ls_tran_code) = 'P-RCP' or rtrim(ls_tran_code) = 'P-RET' then select exch_rate into lc_exch_rate from porcp where tran_id = ls_tran_id; end if; return lc_exch_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_MULTI_VENDOR_EXIST ( as_supp_code__mnfr VARCHAR2, as_site_code CHAR, as_item_code CHAR, as_ref_ser CHAR ) RETURN NUMBER IS FLAG NUMBER(1); as_no_mfg NUMBER(1); as_no_siteitem NUMBER(1); as_no_item NUMBER(1); as_vendor_qualify supplier.vendor_qualify%type; as_appr_supp siteitem.appr_supp%type; as_no_supp_cnt NUMBER(1); -------------- Following variable is added by Manoj Sarode on 02-Aug-2014 Start as_no_child_site NUMBER(1); as_no_parent_site NUMBER(1); as_asign_child_site site.site_code%type; as_parent_site site.site_code%type; as_cnt_appr_supp siteitem.appr_supp%type; as_no_chldsiteitem NUMBER(1); -------------- Above variable is added by Manoj Sarode on 02-Aug-2014 End BEGIN as_no_supp_cnt := 0; as_no_chldsiteitem :=0; as_asign_child_site := as_site_code; SELECT trim(LENGTH(as_supp_code__mnfr)) - trim(LENGTH(TRANSLATE(as_supp_code__mnfr, 'A,', 'A')))+1 INTO as_no_supp_cnt FROM dual; SELECT COUNT(*) INTO as_no_siteitem FROM SITEITEM WHERE SITE_CODE = as_asign_child_site AND ITEM_CODE = as_item_code AND APPR_SUPP = 'Y'; SELECT COUNT(*) INTO as_no_chldsiteitem FROM SITEITEM WHERE SITE_CODE = as_asign_child_site AND ITEM_CODE = as_item_code; -- Following If entry for child site is not exists in SiteItem table then check for it's Parent site code. on 04-Aug-2014 Start IF as_no_chldsiteitem = 0 THEN -- SELECT COUNT(QUALIFY_GRP__SITE) INTO as_no_parent_site FROM SITE WHERE SITE_CODE = as_site_code ; -- SELECT COUNT(QUALIFY_GRP__SITE) INTO as_cnt_appr_supp FROM SITE WHERE SITE_CODE = as_site_code ; -- COUNT(NVL(QUALIFY_GRP__SITE,site_Code)) SELECT COUNT(NVL(QUALIFY_GRP__SITE,site_Code)) INTO as_cnt_appr_supp FROM SITE WHERE SITE_CODE = as_site_code ; IF as_cnt_appr_supp = 1 THEN SELECT NVL(QUALIFY_GRP__SITE,site_Code) INTO as_parent_site FROM SITE WHERE SITE_CODE = as_site_code; SELECT COUNT(*) INTO as_no_siteitem FROM siteitem WHERE site_code = as_parent_site AND item_code = as_item_code AND APPR_SUPP = 'Y'; IF as_no_siteitem > 0 THEN SELECT NVL(appr_supp,'N') INTO as_appr_supp FROM siteitem WHERE site_code = as_parent_site AND item_code = as_item_code and item_ser in (SELECT FLD_VALUE FROM GENCODES WHERE MOD_NAME = 'VQ' AND FLD_NAME ='ITEM_SER' AND ACTIVE ='Y'); /* --- for future enhancement SELECT NVL(s.appr_supp,'N') INTO as_appr_supp FROM siteitem s, item i WHERE s.site_code = as_parent_site AND s.item_code = as_item_code AND s.item_code = i.item_code and s.item_ser in ('RM1','BD','BDI','PM1') and i.grp_code in (select grp_code from item where item_code in (select distinct item_code from supp_apprv_item)) and i.sgrp_code in (select sgrp_code from item where item_code in (select distinct item_code from supp_apprv_item)) ; */ ELSE as_appr_supp := 'N' ; END IF ; as_asign_child_site := as_parent_site; ELSE Flag := 0; -- If Parent site is not defined then dont allow to save. RETURN Flag; END IF; END IF; -- Above If entry for child site is not exists in SiteItem table then check for it's Parent site code. on 04-Aug-2014 End IF as_no_siteitem > 0 THEN IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 0; -- NOT ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE SELECT COUNT(SUPP_CODE) INTO as_no_mfg FROM SUPPLIER WHERE TRIM(SUPP_CODE) IN (SELECT regexp_substr(REPLACE(as_supp_code__mnfr,' '),'[^,]+', 1,level) FROM dual CONNECT BY regexp_substr(as_supp_code__mnfr, '[^,]+', 1, level) IS NOT NULL) AND VENDOR_QUALIFY = 'Y'; IF as_no_mfg > 0 AND as_no_mfg = as_no_supp_cnt THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; -- NOT ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; END IF; END IF; END IF; SELECT COUNT(NVL(APPR_SUPP,'N')) INTO as_no_siteitem FROM SITEITEM WHERE SITE_CODE =as_asign_child_site AND ITEM_CODE = as_item_code AND NVL(APPR_SUPP,'N') = 'N' and item_ser in (SELECT FLD_VALUE FROM GENCODES WHERE MOD_NAME = 'VQ' AND FLD_NAME ='ITEM_SER' AND ACTIVE ='Y'); /* --- for future enhancement SELECT NVL(s.appr_supp,'N') INTO as_appr_supp FROM siteitem s, item i WHERE s.SITE_CODE =as_asign_child_site AND s.ITEM_CODE = as_item_code AND NVL(s.APPR_SUPP,'N') = 'N' AND s.item_code = i.item_code and s.item_ser in ('RM1','BD','BDI','PM1') and i.grp_code in (select grp_code from item where item_code in (select distinct item_code from supp_apprv_item)) and i.sgrp_code in (select sgrp_code from item where item_code in (select distinct item_code from supp_apprv_item)) ; */ IF as_no_siteitem > 0 THEN IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 1 ; RETURN FLAG; -- ALLOWED TO SAVE THE TRANSACTION. ELSE SELECT COUNT(SUPP_CODE) INTO as_no_mfg FROM SUPPLIER WHERE TRIM(SUPP_CODE) IN (SELECT regexp_substr(REPLACE(as_supp_code__mnfr,' '),'[^,]+', 1,level) FROM dual CONNECT BY regexp_substr(as_supp_code__mnfr, '[^,]+', 1, level) IS NOT NULL ) ; IF as_no_mfg > 0 AND as_no_mfg = as_no_supp_cnt THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; RETURN FLAG; -- NOT ALLOWED TO SAVE THE TRANSACTION. END IF; END IF; ELSE SELECT COUNT(*) INTO as_no_item FROM ITEM WHERE ITEM_CODE = as_item_code AND APPR_SUPP = 'Y' AND item_ser in (SELECT FLD_VALUE FROM GENCODES WHERE MOD_NAME = 'VQ' AND FLD_NAME ='ITEM_SER' AND ACTIVE ='Y'); -- and grp_code in (select grp_code from item where item_code in (select distinct item_code from supp_apprv_item)) -- and sgrp_code in (select sgrp_code from item where item_code in (select distinct item_code from supp_apprv_item)) -- Following more condition is added by Manoj Sarode- If SiteItem entry not exists then blank Manufacture code allowed For Purchase Indent only 05-SEP-2014 ----------- -- i.e AND as_ref_ser <> 'R-IND' IF as_no_item > 0 AND as_ref_ser <> 'R-IND' THEN IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 0; RETURN FLAG; -- NOT ALLOWED TO SAVE THE TRANSACTION. ELSE SELECT COUNT(SUPP_CODE) INTO as_no_mfg FROM SUPPLIER WHERE TRIM(SUPP_CODE) IN (SELECT regexp_substr(REPLACE(as_supp_code__mnfr,' '),'[^,]+', 1,level) FROM dual CONNECT BY regexp_substr(as_supp_code__mnfr, '[^,]+', 1, level) IS NOT NULL ) AND VENDOR_QUALIFY = 'Y'; IF as_no_mfg > 0 AND as_no_mfg = as_no_supp_cnt THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; -- NOT ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; END IF; END IF; ELSE IF NVL(LENGTH(trim(as_supp_code__mnfr)),0) = 0 THEN FLAG := 1 ; RETURN FLAG; -- ALLOWED TO SAVE THE TRANSACTION. ELSE SELECT COUNT(SUPP_CODE) INTO as_no_mfg FROM SUPPLIER WHERE TRIM(SUPP_CODE) IN (SELECT regexp_substr(REPLACE(as_supp_code__mnfr,' '),'[^,]+', 1,level) FROM dual CONNECT BY regexp_substr(as_supp_code__mnfr, '[^,]+', 1, level) IS NOT NULL ) ; IF as_no_mfg > 0 AND as_no_mfg = as_no_supp_cnt THEN FLAG := 1; -- ALLOWED TO SAVE THE TRANSACTION. RETURN FLAG; ELSE FLAG := 0; RETURN FLAG; -- NOT ALLOWED TO SAVE THE TRANSACTION. END IF; END IF; END IF; END IF; RETURN FLAG; -------- CHECK WHETHER THE ENTRY EXISTS IN ITEM MASTER OR NOT ------------ EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; RETURN flag; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRIG_DWH_SALES_SEQ BEFORE INSERT ON DWH_SALES_SUM REFERENCING new AS new old AS old FOR EACH ROW declare seq_no NUMBER(12); begin if (:new.sr_no IS NULL ) THEN seq_no := dwh_sales_seq.nextval; end if; :new.sr_no := seq_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DISC_PER ( tranId IN varchar, lineNo IN number ) return number is disc_per number(5,2); begin select (( case when (b.rate__contr - b.rate__sell) > 0 then b.rate__sell else b.rate__contr end ) * b.discount_per) / 100 into disc_per from charge_back a, charge_back_det b where a.tran_id = b.tran_id and a.tran_id = tranId and b.line_no = lineNo; return( disc_per ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LAST_ISSDATE_ITEM ( as_sitecode in site.site_code%type, as_itemcode in item.item_code%type, as_loccode_from in char, as_loccode_to in char) return date is ldt_retdate stock.last_iss_date%type ; begin select max(last_iss_date) into ldt_retdate from stock where item_code = as_itemcode and site_code = as_sitecode and loc_code between as_loccode_from and as_loccode_to; return ldt_retdate ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TRAN_TYP (as_tran_type in varchar) return char is mod_name char(6) ; begin select trim(mod_name) into mod_name from tran_type_master where trim(tran_type)= trim(as_tran_type); IF mod_name = 'PMS' THEN mod_name :='PMS'; ELSIF mod_name = 'CNC' THEN mod_name :='CNC'; END IF; return mod_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_SESSION_TIME ( sess_time VARCHAR2 ) RETURN VARCHAR2 IS sessTime VARCHAR2(100); BEGIN CASE sess_time WHEN 'A' THEN sessTime := 'Another Day'; ELSE sessTime := 'Now'; END CASE; RETURN TRIM(sessTime); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LEAVES_DESCR ON LEAVES (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PERIOD_DIM_TRAN_DATE ON PERIOD_DIM (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TTS_VALUE (AS_ref_ser TRAN_TRACK_STATUS.ref_ser%TYPE, as_ref_id tran_track_status.ref_id%type) return VARCHAR2 is as_value TRAN_TRACK_STATUS.REF_ID%type; BEGIN SELECT distinct(REF_ID) INTO AS_VALUE FROM TRAN_TRACK_STATUS WHERE REF_ID = AS_REF_ID AND REF_SER = AS_REF_SER; RETURN AS_VALUE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TAX_CHK (as_refser in char, as_refid in char) RETURN NUMBER IS ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); begin if as_refser = 'S-RET' then ls_sql := 'Select line_no,tax_env from sreturndet where tran_id = :tran_id'; end if; if as_refser = 'S-DSP' then ls_sql := 'Select line_no,tax_env from despatchdet where desp_id = :tran_id'; end if; if as_refser = 'P-RCP' or as_refser = 'P-RET' then ls_sql := 'Select line_no,tax_env from porcpdet where tran_id = :tran_id'; end if; if as_refser = 'P-ORD' then ls_sql := 'Select line_no,tax_env from porddet where purc_order = :tran_id'; end if; if as_refser = 'D-ISS' then ls_sql := 'Select line_no,tax_env from distord_issdet where tran_id = :tran_id'; end if; if as_refser = 'D-RCP' then ls_sql := 'Select line_no,tax_env from distord_rcpdet where tran_id = :tran_id'; end if; if as_refser = 'P-CON' then ls_sql := 'Select line_no,tax_env from pcontract_det where contract_no = :tran_id'; end if; if as_refser = 'CRNRCP' or as_refser = 'DRNRCP' then ls_sql := 'Select line_no,tax_env from drcr_rdet where tran_id = :tran_id'; end if; if as_refser = 'S-ORD' then ls_sql := 'Select line_no,tax_env from sorddet where sale_order = :tran_id'; end if; OPEN cur_out FOR ls_sql USING as_refid ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = as_refser and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = as_refser and tran_id = as_refid and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then ll_retval := 1; end if; RETURN ll_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORDER_SALE_ORDER ON DISTORDER (SALE_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WFPRC_PROC_STATUS ON WF_PRC_STATUS (PROCESS_STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_RCPDET_DIS_ITEM ON DISTORD_RCPDET (DIST_ORDER, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CALL_BAL (AS_SLAES_PERS in char , AS_EVENT_DATE in date, AS_MTD in varchar2) RETURN VARCHAR2 IS AS_DR_COUNT NUMBER(3); ROUTES VARCHAR(1000); WEEK_DAY VARCHAR(500); PLAN_MEET NUMBER(6); ACTUAL_MEET NUMBER(6); CALL_BAL NUMBER(6); AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; BEGIN select fr_date ,to_date INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE from period where AS_EVENT_DATE BETWEEN fr_date and to_date; IF AS_MTD = 'Y' then select count(distinct(sc_code)) into PLAN_MEET from strg_series where status = 'Y' and sales_pers = AS_SLAES_PERS; select count(distinct strg_code) into actual_meet FROM Strg_Meet SM ,Sales_Pers SP Where SM.Event_Date BETWEEN AS_PRD_FR_DATE and AS_PRD_TO_DATE And SM.Sales_Pers In ( Select Emp_Code From Employee Start With Emp_code = (Select Emp_Code From Users Where Code = AS_SLAES_PERS) Connect By Prior Emp_Code = Report_To ); END IF; IF AS_MTD = 'N' then select count(distinct(sc_code)) into PLAN_MEET from strg_series where status = 'Y' and sales_pers = AS_SLAES_PERS; select count(distinct strg_code) into actual_meet FROM Strg_Meet SM ,Sales_Pers SP Where SM.Event_Date BETWEEN AS_PRD_FR_DATE and AS_PRD_TO_DATE And SM.Sales_Pers In ( Select Emp_Code From Employee Start With Emp_code = (Select Emp_Code From Users Where Code = AS_SLAES_PERS) Connect By Prior Emp_Code = Report_To ); else SELECT count(distinct(pe.strg_code)) into PLAN_MEET FROM TABLE(strgCodePophelp.getstrgCodePophelpData(AS_SLAES_PERS)) pe where pe.route_id in ( SELECT DISTINCT(route_id) FROM STRG_MEET WHERE TO_DATE(EVENT_DATE) = TO_DATE(AS_EVENT_DATE) and sales_pers = AS_SLAES_PERS ); select count(distinct strg_code) into actual_meet FROM Strg_Meet SM ,Sales_Pers SP Where TO_DATE(SM.Event_Date) = TO_DATE(AS_EVENT_DATE) And SM.Sales_Pers In ( Select Emp_Code From Employee Start With Emp_code = (Select Emp_Code From Users Where Code = AS_SLAES_PERS) Connect By Prior Emp_Code = Report_To ); end if; CALL_BAL:= plan_meet - actual_meet; IF CALL_BAL < 0 then CALL_BAL := 0; END IF; RETURN NVL(CALL_BAL,0); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RRECV_REP_FLD ( as_refser IN CHAR, as_refno IN CHAR, ad_asondate IN DATE, ac_outstamt IN NUMBER) RETURN NUMBER IS ac_outst_amt NUMBER(14,3) ; lc_outstamt NUMBER(14,3) ; lc_count NUMBER(1) ; lc_adjamt NUMBER(14,3) ; lc_adjamt1 NUMBER(14,3) ; BEGIN lc_outstamt := ac_outstamt ; -- tot_amt - adj_amt IF rtrim(as_refser) = 'R-ADV' THEN SELECT COUNT(1) INTO lc_count FROM rcpdishnr WHERE confirmed = 'Y' AND tran_ser = 'R' AND receipt_no = as_refno AND tran_date > ad_asondate ; IF lc_count = 1 THEN SELECT tot_amt INTO lc_adjamt FROM receivables WHERE tran_ser = as_refser AND ref_no = as_refno; lc_outstamt := lc_adjamt ; -- tot_amt - adj_amt END IF; SELECT NVL(SUM(rcpadv.adj_amt),0) INTO lc_adjamt FROM rcpadv, receipt WHERE rcpadv.tran_id = receipt.tran_id AND receipt.tran_date > ad_asondate AND receipt.confirmed = 'Y' AND rcpadv.ref_ser = as_refser AND rcpadv.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; /* SELECT NVL(SUM(rcpdet.rcp_amt),0) INTO lc_adjamt FROM rcpDET, receipt WHERE rcpdet.tran_id = receipt.tran_id AND receipt.tran_date > ad_asondate AND receipt.confirmed = 'Y' AND rcpdet.ref_ser = as_refser AND rcpdet.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; -- 15-sep-2021 manoharan SELECT NVL(SUM(b.rcp_amt),0) INTO lc_adjamt FROM rcpdishnr_det b WHERE b.tran_id IN (SELECT a.tran_id FROM rcpdishnr a WHERE a.tran_date > ad_asondate AND a.confirmed = 'Y' AND a.tran_ser = 'R' ) AND b.ref_ser = as_refser AND b.ref_no = as_refno; lc_outstamt := lc_outstamt - lc_adjamt ; SELECT NVL(SUM(RCP_IBCA_Det.Tot_Amt),0) INTO lc_adjamt FROM RCP_IBCA INNER JOIN RCP_IBCA_Det ON RCP_IBCA.Tran_Id = RCP_IBCA_Det.Tran_Id WHERE RCP_IBCA.Confirmed = 'Y' AND RCP_IBCA.Tran_Ser = 'I' AND RCP_IBCA_Det.Ref_Ser = as_refser AND RCP_IBCA_Det.Ref_No = as_refno AND RCP_IBCA.Tran_Date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt ; RETURN lc_outstamt; */ END IF; SELECT NVL(SUM(rcpdet.rcp_amt),0) INTO lc_adjamt FROM receipt, rcpdet WHERE receipt.tran_id = rcpdet.tran_id AND receipt.tran_date > ad_asondate AND receipt.confirmed = 'Y' AND rcpdet.ref_ser = as_refser AND rcpdet.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; SELECT NVL(SUM(a.adj_amt),0) INTO lc_adjamt FROM receivables_adj a WHERE a.ref_ser = as_refser AND a.ref_no = as_refno AND (a.ref_ser_adj, a.ref_no_adj) IN (SELECT c.tran_ser, c.ref_no FROM receivables c WHERE c.tran_ser = a.ref_ser_adj AND c.ref_no = a.ref_no_adj AND c.ref_date > ad_asondate ); lc_outstamt := lc_outstamt + lc_adjamt ; SELECT NVL(SUM(b.rcp_amt),0) INTO lc_adjamt FROM rcpdishnr_det b WHERE b.tran_id IN (SELECT a.tran_id FROM rcpdishnr a WHERE a.tran_date > ad_asondate AND a.confirmed = 'Y' AND a.tran_ser = 'R' ) AND b.ref_ser = as_refser AND b.ref_no = as_refno; lc_outstamt := lc_outstamt - lc_adjamt ; SELECT NVL(SUM(a.adj_amt),0) INTO lc_adjamt FROM receivables_adj a WHERE a.ref_ser_adj = as_refser AND a.ref_no_adj = as_refno AND (a.ref_ser, a.ref_no) IN (SELECT c.tran_ser, c.ref_no FROM receivables c WHERE c.tran_ser = a.ref_ser AND c.ref_no = a.ref_no AND c.ref_date > ad_asondate ); lc_outstamt := lc_outstamt - lc_adjamt ; select nvl(sum(a.net_amt),0) into lc_adjamt from receivables_adj a where a.ref_ser = as_refser and a.ref_no = as_refno and (a.ref_ser_adj, a.ref_no_adj) in (select c.tran_ser,c.tran_id from misc_payables c where c.tran_ser = a.ref_ser_adj and c.tran_id = a.ref_no_adj and c.tran_date > ad_asondate); lc_outstamt := lc_outstamt + lc_adjamt ; IF lc_outstamt <> 0 THEN lc_outstamt := lc_outstamt ; ELSE SELECT NVL(SUM(RCP_IBCA_Det.Tot_Amt),0) INTO lc_adjamt FROM RCP_IBCA INNER JOIN RCP_IBCA_Det ON RCP_IBCA.Tran_Id = RCP_IBCA_Det.Tran_Id WHERE RCP_IBCA.Confirmed = 'Y' AND RCP_IBCA.Tran_Ser = 'I' AND RCP_IBCA_Det.Ref_Ser = as_refser AND RCP_IBCA_Det.Ref_No = as_refno AND RCP_IBCA.Tran_Date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt ; END IF; return lc_outstamt ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_RECV_REPORT_FLD2 ( as_sitecode in char, as_itemser_fr in char, as_itemser_to in char, as_prdcode in char ) return number is ac_outst_amt number(14,3) ; begin select nvl(sum (sales_val),0) into ac_outst_amt from sm_sales_site where site_code = as_sitecode and item_ser >= as_itemser_fr and item_ser <= as_itemser_to and prd_code = as_prdcode ; return ac_outst_amt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_RECV_REPORT_FLD1 ( as_refser in char, as_refno in char, ad_asondate in date, ac_outstamt in number,as_site_code in char) return number is ac_outst_amt number(14,3) ; lc_outstamt number(14,3) ; lc_count number(1) ; lc_adjamt number(14,3) ; begin lc_outstamt := ac_outstamt ; -- tot_amt - adj_amt if rtrim(as_refser) = 'R-ADV' then select count(1) into lc_count from rcpdishnr where confirmed = 'Y' and tran_ser = 'R' and receipt_no = as_refno and tran_date > ad_asondate ; if lc_count = 1 then select tot_amt into lc_adjamt from receivables where tran_ser = as_refser and ref_no = as_refno; lc_outstamt := lc_adjamt ; -- tot_amt - adj_amt end if; select nvl(sum(rcpadv.adj_amt),0) into lc_adjamt from rcpadv, receipt where rcpadv.tran_id = receipt.tran_id and receipt.tran_date > ad_asondate and receipt.confirmed = 'Y' and rcpadv.ref_ser = as_refser and rcpadv.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(rcpdet.rcp_amt),0) into lc_adjamt from receipt, rcpdet where receipt.tran_id = rcpdet.tran_id and receipt.tran_date > ad_asondate and receipt.confirmed = 'Y' and rcpdet.ref_ser = as_refser and rcpdet.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; return lc_outstamt; end if; select nvl(sum(rcpdet.rcp_amt),0) into lc_adjamt from receipt, rcpdet where receipt.tran_id = rcpdet.tran_id and receipt.tran_date > ad_asondate and receipt.confirmed = 'Y' and rcpdet.ref_ser = as_refser and rcpdet.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(a.adj_amt),0) into lc_adjamt from receivables_adj a where a.ref_ser = as_refser and a.ref_no = as_refno and (a.ref_ser_adj, a.ref_no_adj) in (select c.tran_ser,c.ref_no from receivables c where c.tran_ser = a.ref_ser_adj and c.ref_no = a.ref_no_adj and c.ref_date > ad_asondate); lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(b.rcp_amt),0) into lc_adjamt from rcpdishnr_det b where b.tran_id in (select a.tran_id from rcpdishnr a where a.tran_date > ad_asondate and a.confirmed = 'Y' and a.tran_ser = 'R') and b.ref_ser = as_refser and b.ref_no = as_refno; lc_outstamt := lc_outstamt - lc_adjamt ; select nvl(sum(a.adj_amt),0) into lc_adjamt from receivables_adj a where a.ref_ser_adj = as_refser and a.ref_no_adj = as_refno and (a.ref_ser, a.ref_no) in (select c.tran_ser,c.ref_no from receivables c where c.tran_ser = a.ref_ser and c.ref_no = a.ref_no and c.ref_date > ad_asondate); lc_outstamt := lc_outstamt - lc_adjamt ; select nvl(sum(rcp_ibca_det.tot_amt),0) into lc_adjamt from rcp_ibca, rcp_ibca_det where rcp_ibca.tran_id = rcp_ibca_det.tran_id and rcp_ibca.tran_date > ad_asondate and rcp_ibca.confirmed = 'Y' and rcp_ibca_det.ref_ser = as_refser and rcp_ibca_det.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; return lc_outstamt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECK_CHAR_IN_LOC (LS_VLAUE IN CHAR, LS_UNIT IN CHAR ) RETURN NUMBER IS LS_NUM NUMBER ; LS_CNT NUMBER; BEGIN BEGIN IF( LS_VLAUE = 'U') THEN SELECT COUNT(*) INTO LS_CNT FROM UOM WHERE UNIT = TRIM(LS_UNIT); IF (LS_CNT > 0 ) THEN LS_NUM := 1 ; ELSE LS_NUM := 0; END IF ; ELSE LS_NUM := 2; END IF ; EXCEPTION WHEN NO_DATA_FOUND THEN LS_NUM := 3 ; END; RETURN LS_NUM ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TAX_PERC ( p_tran_id IN VARCHAR2, p_line_no IN NUMBER ) RETURN NUMBER IS v_tax_perc NUMBER; BEGIN SELECT TAXTRAN.TAX_PERC INTO v_tax_perc FROM taxtran INNER JOIN tax ON TAXTRAN.TAX_CODE = TAX.TAX_CODE LEFT JOIN sreturndet ON taxtran.TRAN_ID = sreturndet.TRAN_ID AND taxtran.LINE_NO = FN_RCON_LINENO_NUM(sreturndet.line_no) AND NVL(sreturndet.ret_rep_flag, 'P') = 'R' WHERE trim(taxtran.TRAN_ID) = trim(p_tran_id) AND trim(taxtran.LINE_NO) = trim(p_line_no) AND TAXTRAN.TRAN_CODE = 'S-RET' AND tax.print_tax = 'Y' AND taxtran.tax_amt <> 0; RETURN v_tax_perc; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_FINDTRANSFER_CHK BEFORE INSERT OR UPDATE OF status ON fundtransfer referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.status = 'C' then -- 1. check gltrace count and gltrace count begin select count(1) into ll_glcount from gltrace where ref_ser = 'F-XFR' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; -- 2. check header DR, CR and gltrace DR, CR begin lc_hdramt := :new.amount; exception when others then lc_hdramt := 0; end; if ll_glcount = 0 and lc_hdramt <> 0then raise_application_error( -20601, 'GL not posted but amount[' || to_char(lc_hdramt) || '] is not zero' ); end if; begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'F-XFR' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; --if lc_hdramt <> 0 and (lc_gldr <> lc_glcr or lc_glcr <> lc_hdramt or lc_gldr <> lc_hdramt) then if lc_hdramt <> 0 and (lc_gldr <> lc_glcr) then raise_application_error( -20601, 'Debit or credit mismatch between fundtransfer and gltrace FT Amount [' || to_char(lc_hdramt) || '] GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01031: insufficient privileges -- CREATE OR REPLACE TRIGGER DT_MVTYPE_ADD BEFORE INSERT ON MISC_VOUCH_TYPE referencing old as old new as new FOR EACH ROW declare ldt_excutdate date; BEGIN raise_application_error( -20601, 'Item Series addition not allowed and it depends on other configuration'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BOM_DEACTIVATE_X ON BOM_DEACTIVATE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CHANNEL_CUST (as_site_code in site.site_code%type, as_type in char, as_sundry_code in customer.cust_code%type) return char is ls_cust_code customer.cust_code%type; ls_site_code_ch site.site_code%type; begin if as_type = 'C' then begin ls_site_code_ch := fn_get_channel_site(as_sundry_code,'S',as_site_code) ; select cust_code into ls_cust_code from site_customer where site_code = ls_site_code_ch and site_code__ch = as_site_code and channel_partner = 'Y'; end; if ls_cust_code is null or length(trim(ls_cust_code)) = 0 then begin select cust_code into ls_cust_code from customer where channel_partner = 'Y' and site_code = as_site_code; exception when others then ls_cust_code := 'ERRORVTCPC'; end; end if; elsif as_type = 'S' then begin ls_site_code_ch := fn_get_channel_site(as_sundry_code,'C',as_site_code); select supp_code into ls_cust_code from site_supplier where site_code = ls_site_code_ch and site_code__ch = as_site_code and channel_partner = 'Y'; exception when others then ls_cust_code := null; end; if ls_cust_code is null or length(trim(ls_cust_code)) = 0 then begin select supp_code into ls_cust_code from supplier where channel_partner = 'Y' and site_code = as_site_code; exception when others then ls_cust_code := 'ERRORVTCPS'; end; end if; end if; return ls_cust_code ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_EVAL_GRP_X ON PROJ_EVAL_GRP (EVAL_GRP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_RELEASECONTRT_QTY (CONTRACTNO IN CHAR, PORDERN IN CHAR) RETURN NUMBER IS Checkqty NUMBER := 0; totalqty number:= 0; poquantity number:= 0; as_item_code CHAR(10); quantityrel number(14,3); maxqty number(14,3); BEGIN IF LENGTH(CONTRACTNO) > 0 THEN BEGIN FOR x IN (select item_code ,quantity from porddet where purc_order = PORDERN) LOOP BEGIN SELECT pcontract_det.quantity_rel,pcontract_det.max_qty INTO quantityrel, maxqty FROM pcontract_hdr, pcontract_det WHERE pcontract_hdr.contract_no = pcontract_det.contract_no AND pcontract_det.contract_no = CONTRACTNO AND pcontract_det.item_code = x.item_code; Exception When others then Checkqty := 0; END; totalqty := quantityrel; IF totalqty > maxqty THEN Checkqty := 1; END IF; END LOOP; End; END IF;--end if contract RETURN Checkqty; END FN_CHK_RELEASECONTRT_QTY; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_SUNDRY_DETAILS_TAROCHQ (as_sundry_type CHAR,as_sundry_code CHAR,AS_FLAg char) RETURN VARCHAR2 IS LS_RET varchar2(2000) ; ls_name supplier.supp_name%TYPE; ls_addr1 supplier.ALT_ADDR1%type; ls_addr2 supplier.ALT_ADDR2%type; ls_addr3 supplier.ALT_ADDR3%type; ls_city supplier.ALT_CITY%TYPE; ls_pin supplier.ALT_PIN%TYPE; ls_state supplier.state_code%TYPE; ls_count supplier.count_code%TYPE; BEGIN IF AS_SUNDRY_type='T' THEN IF AS_FLAG='N' THEN select tran_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from transporter where tran_code = as_sundry_code; ELSIF as_flag = 'D' then select tran_name, addr1, addr2, addr3, city, pin ,state_code ,count_code into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_state ,ls_count from transporter where tran_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='B' THEN if as_flag = 'N' then select bank_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from bank where bank_code = as_sundry_code; elsif as_flag = 'D' then select bank_name, addr1, addr2, addr3, city, pin,state_code ,count_code into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_state ,ls_count from bank where bank_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='X' THEN if as_flag = 'N' then select tauth_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from tax_authority where tauth_code = as_sundry_code; elsif as_flag = 'D' then select tauth_name, addr1, addr2, addr3, city, pin , state_code ,count_code into ls_name,ls_addr1,ls_addr2, ls_addr3, ls_city, ls_pin , ls_state , ls_count from tax_authority where tauth_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='E' THEN if as_flag = 'N' then select emp_fname||emp_mname||emp_lname, cur_add1, cur_add2, cur_add3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from employee where emp_code = as_sundry_code; elsif as_flag = 'D' then select emp_fname||emp_mname||emp_lname, cur_add1, cur_add2, cur_add3, cur_city, trim(cur_pin) ,cur_state into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_state from employee where emp_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='P' THEN if as_flag = 'N' then select sp_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from sales_pers where sales_pers = as_sundry_code; elsif as_flag = 'D' then select sp_name, addr1, addr2, addr3, city, pin , state_code ,count_code into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin ,ls_state ,ls_count from sales_pers where sales_pers = as_sundry_code; end if ; ELSIF AS_SUNDRY_tYPE='S' THEN if as_flag = 'N' then select supp_name, alt_addr1, alt_addr2, alt_addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from supplier where supp_code = as_sundry_code; elsif as_flag = 'D' then select supp_name, alt_addr1, alt_addr2, alt_addr3, alt_city, alt_pin , state_code , count_code into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_state , ls_count from supplier where supp_code = as_sundry_code; if length(rtrim(ls_addr1)) = 0 then select supp_name, alt_addr1, alt_addr2, alt_addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from supplier where supp_code = as_sundry_code; end if; end if; ELSIF AS_SUNDRY_tYPE='C' THEN if as_flag = 'N' then select cust_name, addr1, addr2, addr3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from customer where cust_code = as_sundry_code; elsif as_flag = 'D' then select cust_name, addr1, addr2, addr3, city, pin, state_code , count_code into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin , ls_state , ls_count from customer where cust_code = as_sundry_code; end if; ELSIF AS_SUNDRY_tYPE='L' THEN if as_flag = 'N' then select PARTY_NAME, ADDR1, ADDR2, ADDR3 into ls_name, ls_addr1, ls_addr2, ls_addr3 from loanparty where party_code = as_sundry_code; elsif as_flag = 'D' then select PARTY_NAME, ADDR1, ADDR2, ADDR3, city, pin , state_code , count_code into ls_name, ls_addr1, ls_addr2, ls_addr3, ls_city, ls_pin, ls_state , ls_count from loanparty where party_code = as_sundry_code; end if; end if; if length(rtrim(ls_addr1))=0 then ls_addr2 :=null ; end if; if length(rtrim(ls_addr2))=0 then ls_addr2 :=null ; end if; if length(rtrim(ls_addr3))=0 then ls_addr3 :=null; end if; if length(rtrim(ls_city))=0 then ls_city := null; end if; if length(rtrim(ls_pin))=0 then ls_pin := null; end if; if length(rtrim(ls_state))=0 then ls_state := null; end if; if length(rtrim(ls_count))=0 then ls_count := null; end if; if as_flag = 'N' then ls_ret := trim(ls_name)||chr(10)||trim(ls_addr1)||chr(10)||trim(ls_addr2)||chr(10)||trim(ls_addr3); elsif as_flag = 'D' then ls_ret := trim(ls_name)||chr(10)||trim(ls_addr1)||chr(10)||trim(ls_addr2)||chr(10)||trim(ls_addr3)||chr(10)||trim(ls_city)||chr(10)||trim(ls_state)||' '||trim(ls_count)||' '||trim(ls_pin); end if; return ls_ret; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RCP_IBCA_TRAN_ID__ISS ON RCP_IBCA (TRAN_SER, TRAN_ID__ISS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE SP_CHK_BUDGET_AMOUNT_PO (PURCORDER IN CHAR) IS -- Declare variables CHECKAMT NUMBER := 0; ACCTPRD CHAR(10); LSCOUNT NUMBER := 0; ACCTCODE NUMBER := 0; CCTRCODE NUMBER := 0; SUM_DR_AMT NUMBER(14,3); SUM_PO_AMT NUMBER(14,3); BUDGETAMT NUMBER(14,3); finEntity CHAR(10); siteCode CHAR(5); siteCodeBudget CHAR(5); siteBudgetId CHAR(10); budgetTrack CHAR(1); pordDate DATE; -- Declare variables for logging log_message VARCHAR2(200); -- Procedure to log messages PROCEDURE log_message_proc(msg IN VARCHAR2) IS BEGIN -- You can customize this to log messages in your preferred way DBMS_OUTPUT.PUT_LINE(msg); -- You can also log messages in a table or file if needed END log_message_proc; BEGIN BEGIN -- Retrieve ACCT_PRD from PERIOD table SELECT ACCT_PRD INTO ACCTPRD FROM PERIOD WHERE TRUNC(SYSDATE) BETWEEN FR_DATE AND TO_DATE; log_message_proc('ACCTPRD: ' || ACCTPRD); EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT := 0; log_message_proc('Error: ACCT_PRD not found in PERIOD table.'); END; BEGIN -- Retrieve site_code from PORDER table SELECT site_code__dlv, ord_date INTO siteCode, pordDate FROM porder WHERE purc_order = PURCORDER; log_message_proc('siteCode: ' || siteCode); EXCEPTION WHEN NO_DATA_FOUND THEN siteCode := ' '; log_message_proc('Error: site_code__dlv not found in PORDER table.'); END; BEGIN -- Retrieve site_code__budget from SITE table SELECT site_code__budget, budget_id INTO siteCodeBudget, siteBudgetId FROM site WHERE site_code = siteCode; log_message_proc('siteCodeBudget: ' || siteCodeBudget); log_message_proc('siteBudgetId: ' || siteBudgetId); EXCEPTION WHEN NO_DATA_FOUND THEN siteCodeBudget := ' '; siteBudgetId:=' '; log_message_proc('Error: site_code__budget not found in SITE table.'); END; -- Check if siteCodeBudget is not null or empty, then update siteCode IF siteCodeBudget IS NOT NULL OR LENGTH(TRIM(siteCodeBudget)) > 0 THEN siteCode := siteCodeBudget; END IF; log_message_proc('siteCode: ' || siteCode); FOR X IN (SELECT ACCT_CODE__DR, CCTR_CODE__DR FROM PORDDET WHERE PURC_ORDER = PURCORDER) LOOP BEGIN -- Retrieve budget_track from ACCOUNTS table SELECT budget_track INTO budgetTrack FROM accounts WHERE acct_code = X.ACCT_CODE__DR; log_message_proc('budgetTrack: ' || budgetTrack); EXCEPTION WHEN NO_DATA_FOUND THEN budgetTrack := NULL; log_message_proc('Error: budget_track not found in ACCOUNTS table.'); END; -- Check if budgetTrack is null log_message_proc('if budgetTrack: ' || budgetTrack); if budgetTrack is null or length(trim(budgetTrack)) = 0 or budgetTrack = 'null' Then CHECKAMT := 0; ELSE BEGIN -- Check if there is a budget entry for the given criteria in ACCTBUDGET table SELECT COUNT(*) INTO LSCOUNT FROM ACCTBUDGET WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE = X.CCTR_CODE__DR AND site_code = siteCode and budget_id = siteBudgetId and from_date <= pordDate and to_date >= pordDate; log_message_proc('LSCOUNT: ' || LSCOUNT); log_message_proc('X.ACCT_CODE__DR: [' || X.ACCT_CODE__DR || '] X.CCTR_CODE__DR [' ||X.CCTR_CODE__DR||']'); log_message_proc('pordDate [' || pordDate || '] pordDate [' ||pordDate||']'); EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT := 0; log_message_proc('Error: Budget entry not found in ACCTBUDGET table.'); END; -- Check if there is a budget entry, then proceed with further checks IF LSCOUNT > 0 THEN BEGIN -- Retrieve budget amount from ACCTBUDGET table SELECT nvl(sum(BUDGET_AMT),0) INTO BUDGETAMT FROM ACCTBUDGET WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE = X.CCTR_CODE__DR AND site_code = siteCode AND budget_id = siteBudgetId AND from_date <= pordDate AND to_date >= pordDate; log_message_proc('BUDGETAMT: ' || BUDGETAMT); EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT := 0; log_message_proc('Error: Budget amount not found in ACCTBUDGET table.'); END; BEGIN -- Retrieve sum of DR_AMT from ACCTBAL table select nvl(sum(dr_amt__base),0) into SUM_DR_AMT from acctbal where ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE= X.CCTR_CODE__DR and prd_code in (select p.code from budgets b, period p where pordDate between b.from_date and b.to_date and b.site_code = siteCode and b.budget_id = siteBudgetId and b.acct_prd = ACCTPRD and p.acct_prd = b.acct_prd and p.fr_date >= b.from_date and p.to_date <= b.to_date) ; log_message_proc('SUM_DR_AMT: ' || SUM_DR_AMT); /*IF budgetPrd = 'M' THEN SELECT NVL(SUM(DR_AMT), 0) INTO SUM_DR_AMT FROM ACCTBAL WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE = X.CCTR_CODE__DR AND PRD_CODE NOT IN ('000000', 'zzzzz') AND PRD_CODE = PRDCODE; log_message_proc('SUM_DR_AMT: ' || SUM_DR_AMT); ELSIF budgetPrd = 'Q' THEN SELECT nvl(SUM(DR_AMT),0) INTO SUM_DR_AMT FROM ACCTBAL WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE= X.CCTR_CODE__DR AND PRD_CODE NOT IN ('000000','zzzzz'); ELSIF budgetPrd = 'Y' THEN SELECT nvl(SUM(DR_AMT),0) INTO SUM_DR_AMT FROM ACCTBAL WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE= X.CCTR_CODE__DR AND PRD_CODE NOT IN ('000000','zzzzz'); END IF;*/ EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT := 0; log_message_proc('Error: Sum of DR_AMT not found in ACCTBAL table.'); END; BEGIN -- Retrieve sum of total amount from PORDDET table SELECT NVL(SUM(TOT_AMT), 0) INTO SUM_PO_AMT FROM PORDDET WHERE ACCT_CODE__DR = X.ACCT_CODE__DR AND CCTR_CODE__DR = X.CCTR_CODE__DR AND PURC_ORDER = PURCORDER; log_message_proc('SUM_PO_AMT: ' || SUM_PO_AMT); EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT := 0; log_message_proc('Error: Sum of TOT_AMT not found in PORDDET table.'); END; -- Check if sum of DR_AMT and sum of PO total amount is greater than budget amount IF (SUM_DR_AMT + SUM_PO_AMT) > BUDGETAMT THEN CHECKAMT := 1; log_message_proc('Warning: Budget exceeded for ACCT_CODE=' || X.ACCT_CODE__DR || ', CCTR_CODE=' || X.CCTR_CODE__DR); END IF; ELSE CHECKAMT := 0; END IF; -- end if budgets END IF; -- end if for budget track END LOOP; -- end loop -- Perform any additional actions or logging if needed based on CHECKAMT value log_message_proc('CHECKAMT: ' || CHECKAMT); END SP_CHK_BUDGET_AMOUNT_PO; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_UNLIST_TB force AS TABLE OF CHC_CHEM_UNLIST_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EXPENSE_BANNER_MST force AS OBJECT ( PRD_MONTH VARCHAR2(8), PRD_DATE VARCHAR2(50), TRAN_ID VARCHAR2(50), STATUS VARCHAR2(50), STATUS_DATE VARCHAR2(50), APRV_NAME VARCHAR2(50), HO_NAME VARCHAR2(50), CLAIM_AMT VARCHAR2(50), ADD_AMT VARCHAR2(50), DED_AMT VARCHAR2(50), PASSED_AMT VARCHAR2(50), ADV_ADJUSTED VARCHAR2(50), AMT_PAID VARCHAR2(50), PAYMENT_DAYS VARCHAR2(50), PAYMENT_DATE VARCHAR2(50), HARD_COPY_RECD_DATE VARCHAR2(50), EXP_RECD_DATE VARCHAR2(50), TRANSFER_DATE VARCHAR2(50), APRV_DATE VARCHAR2(50), APRV_STATUS VARCHAR2(50), HO_APRV_DATE VARCHAR2(50), HO_STATUS VARCHAR2(50), HD_STATUS VARCHAR2(50), DUE_DATE VARCHAR(50), HO_CODE VARCHAR(50), APRV_CODE VARCHAR2(50) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DD (lsref_ser char,lsref_id char) return varchar2 is ls_no varchar2(5000); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION MFG_GETPROCESSUNIT (a_exprNo char,a_operation number) return char is processUnit char(3); begin select unit__expr into processUnit from expr_route where expr_no = a_exprNo and operation = a_operation and rownum=1; return( processUnit ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_WO_ERR (msite_code in char, mitem_code in char) return char is ls_count number(5) := 0; ls_retval varchar2(1) := '0'; begin select count(*) into ls_count from workorder where site_code = msite_code and item_code = mitem_code and (status = 'F' or status = 'R') and (order_type = 'F' or order_type = 'P' ); if mitem_code = 'BD0038' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BD1118H' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RA20478' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RI10196' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RI10599' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RI10586' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RI10587' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BD0181' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BF7000' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BD0158' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BF0592' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RI10170' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'EUSBF0003' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'RI10405' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BD0814H' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD0103' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD0877H' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'RI10841' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'RI10985' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BD0187' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD0862D' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD0046B' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD0187R1' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'RI110247' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD0412' and ls_count >= 50 then return ls_retval; elsif mitem_code = 'BD1018H' and ls_count >= 35 then return ls_retval; elsif mitem_code = 'BD0076' and ls_count >= 35 then return ls_retval; elsif mitem_code not in ( 'BD0862D', 'BD0046B', 'BD0187R1', 'RI110247', 'BD0412', 'BD0038', 'RA20478', 'BD0181', 'RI10599', 'BF7000', 'BF0592', 'RI10586', 'RI10587', 'RI10196', 'BD0158', 'BD1018H', 'RI10170', 'EUSBF0003', 'BD1118H', 'BD0814H', 'BD0103', 'BD0877H', 'RI10841', 'BD0187', 'RI10985', 'RI10405', 'BD0076' ) and ls_count >= 25 then return ls_retval; else return '1'; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_SITE_CD_SUN_TY ON MISC_PAYABLES (SITE_CODE, SUNDRY_TYPE, SUNDRY_CODE, PAY_MODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WORDERRCP_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON WORKORDER_RECEIPT referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; ls_INV_ACCT char(1); lc_issamt number(17,3) := 0; lc_ohdAmt number(17,3) := 0; lc_rcpAmt number(17,3) := 0; lc_totwip number(17,3) := 0; ls_acct_code char(10); ls_itemser char(5); BEGIN if :new.confirmed = 'Y' then begin --workorder isse and return begin select var_value into ls_INV_ACCT from finparm where var_name = 'INV_ACCT_WRCP'; exception when others then ls_INV_ACCT := 'N'; end; if ls_INV_ACCT = 'S' then begin SELECT CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END into ls_INV_ACCT FROM WORKORDER_RECEIPT D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id; exception when others then ls_INV_ACCT := 'N'; end; end if; if ls_INV_ACCT = 'Y' then begin -- 1. check detail count and gltrace count begin select rate into lc_rate from workorder_receipt where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'W-RCP' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if lc_rate > 0 then begin SELECT sum(rate * (d.quantity + d.potency_adj)) into lc_rate FROM workorder_issdet d where work_order = :new.work_order; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then --raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); null; end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'W-RCP' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then --raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); null; end if;--end rate end if; -- count end end; /* if :new.canc_bo = 'Y' then begin SELECT item_ser into ls_itemser FROM ITEM where item_code = :new.item_code; exception when others then ls_itemser := ' '; end; begin select acct_code__yld_loss into ls_acct_code from item_acct_detr where item_code = :new.item_code and item_ser = ls_itemser and tran_type = ' '; exception when others then ls_acct_code := ' '; end; if length(trim(ls_acct_code)) = 0 then begin select acct_code__yld_loss into ls_acct_code from item_acct_detr where item_ser = ' ' and item_code = :new.item_code and tran_type = ' '; exception when others then ls_acct_code := ' '; end; end if; if length(trim(ls_acct_code)) = 0 then begin select acct_code__yld_loss into ls_acct_code from item_acct_detr where item_ser = ls_itemser and item_code = ' ' and tran_type = ' '; exception when others then ls_acct_code := ' '; end; end if; if length(trim(ls_acct_code)) = 0 then begin select acct_code__yld_loss into ls_acct_code from itemser where item_ser = ls_itemser ; exception when others then ls_acct_code := ' '; end; end if; begin select sum(((case when a.quantity is null then 0 else a.quantity end) + (case when a.potency_adj is null then 0 else a.potency_adj end)) * (case when i.rate is null then 0 else i.rate end)) into lc_issamt from workorder_issdet a, workorder_iss b, invtrace i where a.tran_id = b.tran_id and i.ref_ser in ('W-ISS','W-IRTN') and i.ref_id = b.tran_id and to_number(trim(i.ref_line)) = a.line_no and b.work_order = :new.work_order; exception when others then lc_issamt := 0; end; begin -- select posted overhead amount from the gltrace. select sum(dr_amt) into lc_ohdAmt from workorder_feedback a, gltrace b where a.tran_id = b.ref_id and a.work_order = :new.work_order and b.ref_ser = 'W-FBK' and dr_amt <> 0 ; exception when others then lc_ohdAmt := 0; end; if lc_issamt is null then lc_issamt := 0; end if; if lc_ohdAmt is null then lc_ohdAmt := 0; end if; lc_totwip := lc_issamt + lc_ohdAmt; begin select sum(dr_amt) into lc_rcpAmt from workorder_receipt a, gltrace b where a.tran_id = b.ref_id and (b.ref_id in ( select tran_id from workorder_receipt where work_order = :new.work_order and tran_type = 'F') or b.ref_id = :new.work_order) and b.ref_ser in( 'W-RCP','W-ORD') and dr_amt <> 0 ; exception when others then raise_application_error( -20601, 'Exception in getting rteceipt amount' ); lc_rcpAmt := 0; end; if lc_rcpAmt is null then lc_rcpAmt := 0; end if; if abs(lc_totwip - lc_rcpAmt) > 1 then raise_application_error( -20601, 'Total WIP [' || to_char(lc_totwip) || '] not matching with receipt amount posted [' || to_char(lc_rcpAmt) || ']' ); end if; end if;*/ end if ;-- end of varvalue if end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALCBACKTAX_SL (ls_invoice_id in char, ls_lot_sl in char, ls_item_code in char) return number is ld_tax_amt number(14,3); begin SELECT NVL(SUM(taxtran.tax_amt * -1),0) into ld_tax_amt FROM tax, taxtran , invoice_trace WHERE ( tax.tax_code = taxtran.tax_code ) AND ( taxtran.tran_id = invoice_trace.invoice_id ) and ( taxtran.line_no = invoice_trace.line_no ) and ( ( taxtran.tran_code = 'S-INV' ) AND ( taxtran.tran_id = ls_invoice_id ) AND ( UPPER(invoice_trace.lot_sl) = ls_lot_sl ) and ( invoice_trace.item_code = ls_item_code ) and ( taxtran.tax_amt <> 0 ) AND ( tax.print_tax = 'Y' ) ) ; return ld_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_PERIOD (msite in char, mtran_date in date, mitem_ser in char) return char is mprd char(6) := null; begin begin select prd_code into mprd from prd_tbl where site_code = msite and ref_code = mitem_ser and mtran_date between fr_date and to_date; return mprd; exception when no_data_found then if substr(msite, 1, 2) = 'SP' then select prd_code into mprd from prd_tbl where site_code = 'AM'||substr(msite, 3, 3) and ref_code = mitem_ser and mtran_date between fr_date and to_date; End if; return nvl(mprd, to_char(mtran_date, 'yyyymm')); when too_many_rows then return nvl(mprd, to_char(add_months(mtran_date,-12),'yyyymm')) ; when others then Return nvl(mprd, to_char(add_months(mtran_date,-12),'yyyymm')) ; end; exception when others then return nvl(mprd, to_char(add_months(mtran_date,-12),'yyyymm')); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UIDX_PROCROUTE ON PROCROUTE (ROUTE_CODE, OPERATION) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_DETAILS_TRAN (ls_tran_code in char,ls_tran_id in char, ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value char(30); lc_exch_rate number(17,6); begin select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(abs(tax_amt),0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select AVG(abs(tax_perc)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select SUM(NVL(abs(taxable_amt),0)) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; --tax count if ls_type = 'C' then select count(*) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then select exch_rate into lc_exch_rate from invoice where invoice_id = ls_tran_id ; if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SINV_DET_TRANFLOW (as_invoice_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(b.item_descr) || ' (' || trim(b.item_code) || ')' as descr ,b.QUANTITY ,b.rate from item a ,invdet b where a.item_code = b.item_code and b.invoice_id=as_invoice_id; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE CCTRMASTER AS OBJECT ( CCTR_CODE CHAR(4), DESCR VARCHAR2(40), SH_DESCR VARCHAR2(40) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LEAVE_DAYS (as_empcode char , ad_date_fr date, ad_date_to date, as_lvecode char , as_useflag char) return number is lc_nodays number(6,1) ; ls_useflag char(10); ld_date_fr date; begin ls_useflag := upper( as_useflag ); lc_nodays := 0; begin select min(eff_date) into ld_date_fr from leavebal where emp_code = as_empcode and lve_code = as_lvecode; if ld_date_fr = ad_date_fr then ld_date_fr := to_date('01-jan-0001','DD-MON-YYYY'); else ld_date_fr := ad_date_fr; end if; SELECT nvl(sum(nvl(no_days,0)),0) into lc_nodays FROM empleave_summary,period WHERE empleave_summary.EMP_CODE = as_empcode and empleave_summary.lve_code = as_lvecode and period.code = empleave_summary.prd_code and period.fr_date between ld_date_fr and ad_date_to and instr( ls_useflag , use_flag ) > 0 ; EXCEPTION WHEN NO_DATA_FOUND THEN lc_nodays := 0 ; END ; return lc_nodays; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOTTERY_ACK ( as_ref_id in char, as_row_no in char) return varchar2 is ls_status varchar2(50) ; ls_count NUMBER(2); -- ls_status CHAR; begin if as_row_no=1 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type = 'Pan Card' and ref_id=as_ref_id and DELETE_FLAG IS NULL ; END IF; if as_row_no=2 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type = 'Aadhar Card' and ref_id=as_ref_id and DELETE_FLAG IS NULL ; END IF; if as_row_no=3 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type LIKE '%Website%' and ref_id=as_ref_id and DELETE_FLAG IS NULL ; END IF; if as_row_no=4 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type LIKE 'Income%' and ref_id=as_ref_id and DELETE_FLAG IS NULL ; END IF; if as_row_no=5 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type = 'Affidavit' and ref_id=as_ref_id and DELETE_FLAG IS NULL ; END IF; if as_row_no=6 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type = 'Bank Sanction Letter' and ref_id=as_ref_id and DELETE_FLAG IS NULL; END IF; if as_row_no=7 then select count(doc_type_attach) into ls_count from doc_transaction_link l, obj_attach_config a where l.ref_ser= 'M-CUST' AND a.doc_type= l.doc_type_attach and doc_type = 'Other Upload Document' and ref_id=as_ref_id and DELETE_FLAG IS NULL ; END IF; if ls_count >= 0 THEN ls_status := 'Submitted'; end if; if ls_count = 0 THEN ls_status := 'Not Submitted' ; END IF; RETURN ls_status; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE GETDCRIDPACAKGE AS FUNCTION getDcrIDPacakgeData (empCode in char,as_event_date in date) RETURN getDcrIDMaster PIPELINED; END getDcrIDPacakge; CREATE OR REPLACE PACKAGE BODY GETDCRIDPACAKGE AS FUNCTION Getdcridpacakgedata (empCode in char,as_event_date in date) RETURN getDcrIDMaster PIPELINED AS as_max_day_summ_date DATE; as_min_day_summ_date DATE; BEGIN SELECT MAX(EVENT_DATE) INTO as_max_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(empCode) AND EVENT_DATE<=as_event_date; SELECT MIN(EVENT_DATE) INTO as_min_day_summ_date FROM SPRS_DAY_SUMM WHERE TRIM(SALES_PERS)=TRIM(empCode) AND EVENT_DATE > as_event_date ; IF as_min_day_summ_date IS NOT NULL THEN for x in( select dcr_id as dcr_id from sprs_Act_tran where TRIM(sales_pers) = trim(empCode) AND event_date >= as_max_day_summ_date AND event_date < as_min_day_summ_date) LOOP PIPE ROW (getDcrID(x.dcr_id)); END LOOP; else if (as_min_day_summ_date is null ) THEN for x in( Select dcr_id as dcr_id from sprs_Act_tran where TRIM(sales_pers) = trim(empCode) AND event_date >= as_max_day_summ_date ) LOOP PIPE ROW (getDcrID(x.dcr_id)); END LOOP; RETURN; end if; end if; end; END getDcrIDPacakge; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BUSINESS_LIMIT (ls_cust_code in char, ls_item_ser in char, ls_period_from in char, ls_period_to in char, ls_factor in char) return number is lc_busi_limit number(14,3); lc_sales number(14,3); ll_number number(3); begin select isnumber(ls_factor) into ll_number from dual; if ll_number = 0 then lc_busi_limit := to_number(ls_factor); else select avg(net_sales) into lc_sales from ( select sum(nvl(sales_val,0) - nvl(return_val,0) + nvl(repl_val,0)) net_sales from sm_sales_cust where cust_code = ls_cust_code and item_ser = ls_item_ser and prd_code >= ls_period_from and prd_code <= ls_period_to group by prd_code); lc_busi_limit := lc_sales * ddf_decode_string(ls_factor,lc_sales); end if; return lc_busi_limit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_RCP_DIST_ORD ON DISTORD_RCP (DIST_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_EMP_APRSL_FORMS ON EMP_APRSL_FORM (APRSL_TYPE, FORM_TYPE, APRSL_DATE_FR, APRSL_DATE_TO, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_GRADE_PACKWISE (lsite_code in char, litem_code in char, llot_no in char, ad_to_date in date, ltype in char, lavailable in char, lloc_code in char, lgetQV in char, lexc_opt in char, as_grade in char, as_pack_code in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and a.grade = as_grade and instr(lavailable,b.available) > 0; if ad_to_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select (CASE WHEN lgetQV ='Q' THEN nvl((sum (nvl(a.eff_qty,0))),0) ELSE nvl(sum ((nvl(a.eff_qty,0) * (CASE WHEN lexc_opt='N' THEN nvl(a.rate,0) ELSE nvl(a.gross_rate,0) END))),0)END)QTY from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.tran_date <= ad_to_date and d.grade = as_grade and d.pack_code= as_pack_code and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.loc_code = lloc_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 ; if ad_to_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select (CASE WHEN lgetQV ='Q' THEN nvl((sum (nvl(a.eff_qty,0))),0) ELSE nvl(sum ((nvl(a.eff_qty,0) * (CASE WHEN lexc_opt ='N' THEN nvl(a.rate,0) ELSE nvl(a.gross_rate,0) END))),0) END)QTY from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and a.loc_code = lloc_code and b.inv_stat = c.inv_stat and a.tran_date <= ad_to_date and instr(lavailable,c.available) > 0); end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUBSTR (as_value in varchar2, an_start_pos in number, an_length in number) return varchar2 is as_final varchar2(100); begin select substr(as_value, an_start_pos, an_length) into as_final from dual; return as_final; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LOAN_PROJECTED_BALANCE (AS_LOAN_NO char,AS_ACCT_PRD char,AS_LAST_PRDCODE char,AS_FR_DATE date) return number is a_loan_amt loans.loan_amt%type; a_emp_code loans.emp_code%type; a_int_term loans.int_term%type; a_balance_amt loans.balance_amt%type; a_int_amt loans_interest.interest_amt%type; a_amount loans.mon_inst%type; begin select loan_amt,emp_code,int_term into a_loan_amt,a_emp_code,a_int_term from loans where loan_no = AS_LOAN_NO and status in ('A','E'); declare cursor c1 is select (select b.interest from loans b where b.loan_no = AS_LOAN_NO) loan_perc, ddf_hr_loan_instal(AS_LOAN_NO,a.code,AS_LAST_PRDCODE) inst_amt,a.code, (case when ((select to_date(ddf_hr_payment_details(c.tran_id,c.emp_code)) from payr_voucher c where c.tran_type = 'LN' and c.emp_code = a_emp_code and c.ref_no = AS_LOAN_NO) between a.fr_date and a.to_date) then to_char(a.to_date - (select to_date(ddf_hr_payment_details(c.tran_id,c.emp_code)) from payr_voucher c where c.tran_type = 'LN' and c.emp_code = a_emp_code and c.ref_no = AS_LOAN_NO) + 1) else to_char(a.to_date,'DD') end) days from period a where a.code > nvl((select max(d.prd_code) from payarr_det d where d.emp_code = a_emp_code and d.ref_no = AS_LOAN_NO), (select max(e.code) from period e where e.code < (select to_char(f.issue_date,'YYYYMM') from loans f where f.loan_no = AS_LOAN_NO))) and a.code < (select min(g.code) from period g where g.acct_prd = AS_ACCT_PRD) order by a.code; begin select nvl(a_loan_amt - nvl(sum(amount),0),0) into a_balance_amt from loan_reg where loan_no = AS_LOAN_NO and tran_date <= as_fr_date - 1; for i in c1 loop if (trim(a_int_term) = 'EMI') THEN a_int_amt := round((((a_balance_amt * i.loan_perc) /100) /365) * i.days,2); dbms_output.put_line (i.code || ' ' || a_int_amt); a_amount := i.inst_amt - a_int_amt; if (a_amount < 0) then a_amount := 0; end if; else a_amount := i.inst_amt; end if; a_balance_amt := a_balance_amt - a_amount; end loop; if (a_balance_amt < 0) then a_balance_amt := 0; end if; return a_balance_amt; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ACTIVITY_STRG_UNLISTED ( ls_tran_id char) return varchar2 is ls_strg_unlisted varchar2(2000); uli_cnt number(7); CURSOR l_ulisted is SELECT trim(participant_name) AS unlisted_customer FROM event_exe_part WHERE tran_id =ls_tran_id AND participant_code IS NULL; l_cur_rec l_ulisted%ROWTYPE; begin uli_cnt :=0; OPEN l_ulisted; LOOP uli_cnt := uli_cnt + 1; FETCH l_ulisted INTO l_cur_rec; EXIT WHEN l_ulisted%NOTFOUND; if(uli_cnt = 1) then ls_strg_unlisted := l_cur_rec.unlisted_customer; else ls_strg_unlisted := ls_strg_unlisted || ',' || l_cur_rec.unlisted_customer ; end if; END LOOP; return ls_strg_unlisted; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WDEV_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from workorder_iss where tran_id=as_tran_id and tran_type='D'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE POPITEMCODE AS FUNCTION getItemPophelp(asTranType IN CHAR, asTranId IN CHAR, asDescr IN VARCHAR2) RETURN itemMasterTable PIPELINED; END POPITEMCODE ; CREATE OR REPLACE PACKAGE BODY POPITEMCODE AS FUNCTION getItemPophelp(asTranType IN CHAR, asTranId IN CHAR, asDescr IN VARCHAR2) RETURN itemMasterTable PIPELINED IS BEGIN IF asTranType = 'I' THEN FOR x IN ( SELECT GDT.ITEM_CODE, ITM.DESCR AS ITEMDESCR FROM GATE_REGISTER_DET GDT JOIN ITEM ITM ON GDT.ITEM_CODE = ITM.ITEM_CODE WHERE GDT.TRAN_ID = asTranId AND (ITM.DESCR LIKE '%' || asDescr || '%' OR GDT.ITEM_CODE LIKE '%' || asDescr || '%') AND ITM.ACTIVE='Y' ) LOOP PIPE ROW (ITEMMASTER(x.ITEM_CODE, x.ITEMDESCR)); END LOOP; ELSE FOR x IN ( SELECT ITEM_CODE, DESCR FROM ITEM WHERE (ITEM_CODE LIKE '%' || asDescr || '%' OR DESCR LIKE '%' || asDescr || '%') AND ACTIVE='Y' ) LOOP PIPE ROW (ITEMMASTER(x.ITEM_CODE, x.DESCR)); END LOOP; END IF; RETURN; END getItemPophelp; END POPITEMCODE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GENERIC_DATE (ls_type in char, ls_sprs in char, ls_sc_code in char, ls_min_max in char) return date is mdate date:=null; begin if ls_type = 'W' and ls_sc_code <> ' ' and ls_min_max = 'MAX' then select max(work_date) into mdate from dr_doctor_visit where sales_pers = ls_sprs and sc_code = ls_sc_code; elsif ls_type = 'W' and ls_sc_code <> ' ' and ls_min_max = 'MIN' then select min(work_date) into mdate from dr_doctor_visit where sales_pers = ls_sprs and sc_code = ls_sc_code; elsif ls_type = 'W' and ls_sc_code = ' ' and ls_min_max = 'MAX' then select max(work_date) into mdate from dr_main where sales_pers = ls_sprs; elsif ls_type = 'W' and ls_sc_code = ' ' and ls_min_max = 'MIN' then select min(work_date) into mdate from dr_main where sales_pers = ls_sprs; end if; return mdate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SORD_DET_TRANFLOW (as_sord_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.QUANTITY ,b.rate from item a ,sorddet b where a.item_code = b.item_code and b.SALE_ORDER=as_sord_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SPRS_WORK_WITH_STAN_TYPE (ls_sales_pers sprs_travel.sales_pers%type, ld_travel_date sprs_travel.travel_date%type, ls_sprs_code__ww sprs_travel.sprs_code__ww%type) return varchar2 is ls_stan_type stantype.stan_type%type; begin select distinct(g.stan_type) into ls_stan_type from sprs_travel e,sprs_route f,stantype g where ( e.sales_pers = ls_sales_pers or e.sales_pers = ls_sprs_code__ww ) and e.travel_date = ld_travel_date and ( e.sales_pers = f.sprs_code or e.sprs_code__ww = f.sprs_code ) and f.locality_code = e.locality_code (+) and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from sprs_travel b, sprs_route c, stantype d where ( b.sales_pers = e.sales_pers or b.sprs_code__ww = e.sales_pers ) and b.travel_date = e.travel_date and ( b.sales_pers = c.sprs_code or b.sprs_code__ww =c.sprs_code ) and b.locality_code = c.locality_code (+) and d.stan_type = c.station_type); return ls_stan_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPERIOD (AS_EFF_DATE DATE) RETURN varchar2 IS prdCode varchar2(10); begin select code into prdCode from period where AS_EFF_DATE between fr_date and to_date; return prdCode; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PORD_DET_TRANFLOW (as_pord_no char) return varchar2 is v_str varchar2(32767); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.QUANTITY ,b.rate,b.dlv_date from item a ,porddet b where a.item_code = b.item_code and b.purc_order=as_pord_no and rownum <= 20; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||'Delivery Date'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_DISTRCPDET_COSTRATE (as_tranid in char) IS --DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_drcpcount number(3) := 0; ll_count number(6) := 0; lc_stkrate number(15,4) := 0; BEGIN begin for cur_distrcpdet in ( SELECT h.site_code,d.item_code,d.loc_code,d.lot_no,d.lot_sl,d.cost_rate FROM DISTORD_rcpDET D, distord_rcp h WHERE h.tran_id = d.tran_id AND h.TRAN_ID = as_tranid ) loop begin dbms_output.put_line('Inside loop'); select rate into lc_stkrate from stock where item_code = cur_distrcpdet.item_code and site_code = cur_distrcpdet.site_code and loc_code = cur_distrcpdet.loc_code and lot_no = cur_distrcpdet.lot_no and lot_sl = cur_distrcpdet.lot_sl; exception when others then lc_stkrate := 0; end; dbms_output.put_line('Inside lc_stkrate [' || to_char(lc_stkrate) ||'] cost_rate ['|| to_char(cur_distrcpdet.cost_rate) ||']' ); if lc_stkrate <> cur_distrcpdet.cost_rate then -- raise_application_error( -20601, 'Received stock rate [' || to_char(lc_stkrate) ||'] is not matching with the cost rate of detail [' || to_char(cur_distrcpdet.cost_rate) ||']'); dbms_output.put_line('Inside lc_stkrate [' || to_char(lc_stkrate) ||'] cost_rate ['|| to_char(cur_distrcpdet.cost_rate) ||']' ); end if; end loop; exception when others then null; end; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE DAILYSALESDATAMODEL AS FUNCTION getDailySalesCardData (empCode in char) RETURN DailySalesMasterTABLE PIPELINED; END dailySalesDatamodel; CREATE OR REPLACE PACKAGE BODY DAILYSALESDATAMODEL AS FUNCTION getDailySalesCardData (empCode in char) RETURN DailySalesMasterTABLE PIPELINED IS BEGIN for x in(SELECT B.TC as TC,B.PC AS PC,(B.TC-B.PC) AS NPC,0 AS NA,(C.AMOUNT) AS AMOUNT,D.quantity,'TC' AS COLUMNNAME,'darkblue' AS THEME_COLOR FROM (select count(distinct(sm.strg_code)) as TC,count(distinct smi.strg_code) as PC from strg_meet sm,strg_meet_invoice smi where sm.dcr_id=smi.dcr_id and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))B, (SELECT sum(smi.quantity) as quantity FROM strg_meet_invoice smi WHERE smi.DCR_ID IN (SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))D, (select SUM (round(SM.AMOUNT)) AS AMOUNT from strg_meet sm ,strg_meet_collect smc where sm.tran_id=smc.tran_id and sm.strg_code=smc.strg_code and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe) )C UNION ALL SELECT B.PC AS TC,B.TC AS PC,(B.TC-B.PC) AS NPC,0 AS NA,(C.AMOUNT) AS AMOUNT,D.quantity,'PC' AS COLUMNNAME,'darkblue' AS THEME_COLOR FROM (select count(distinct(sm.strg_code)) as TC,count(distinct smi.strg_code) as PC from strg_meet sm,strg_meet_invoice smi where sm.dcr_id=smi.dcr_id and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))B, (SELECT sum(smi.quantity) as quantity FROM strg_meet_invoice smi WHERE smi.DCR_ID IN(SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe) ))D, (select SUM (round(SM.AMOUNT)) AS AMOUNT from strg_meet sm ,strg_meet_collect smc where sm.tran_id=smc.tran_id and sm.strg_code=smc.strg_code and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))C UNION ALL SELECT (B.TC-B.PC) AS TC,B.PC,B.TC AS NPC,0 AS NA,(C.AMOUNT) AS AMOUNT,D.quantity,'NPC' AS COLUMNNAME,'darkblue' AS THEME_COLOR FROM (select count(distinct(sm.strg_code)) as TC,count(distinct smi.strg_code) as PC from strg_meet sm,strg_meet_invoice smi where sm.dcr_id=smi.dcr_id and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))B, (SELECT sum(smi.quantity) as quantity FROM strg_meet_invoice smi WHERE smi.DCR_ID =(SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.event_date =trunc(sysdate) AND sm.sales_pers = empCode))D, (select SUM (round(SM.AMOUNT)) AS AMOUNT from strg_meet sm ,strg_meet_collect smc where sm.tran_id=smc.tran_id and sm.strg_code=smc.strg_code and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))C UNION ALL SELECT 0 AS TC,B.PC,(B.TC-B.PC) AS NPC,B.TC AS NA,(C.AMOUNT) AS AMOUNT,D.quantity,'NA' AS COLUMNNAME,'darkblue' AS THEME_COLOR FROM (select count(distinct(sm.strg_code)) as TC,count(distinct smi.strg_code) as PC from strg_meet sm,strg_meet_invoice smi where sm.dcr_id=smi.dcr_id and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe))B, (SELECT sum(smi.quantity) as quantity FROM strg_meet_invoice smi WHERE smi.DCR_ID IN(SELECT SM.DCR_ID FROM SPRS_ACT_TRAN SM WHERE sm.event_date =trunc(sysdate) AND sm.sales_pers = empCode))D, (select SUM (round(SM.AMOUNT)) AS AMOUNT from strg_meet sm ,strg_meet_collect smc where sm.tran_id=smc.tran_id and sm.strg_code=smc.strg_code and sm.dcr_id in(SELECT PE.dcr_id FROM TABLE(getDcrIDPacakge.getDcrIDPacakgeData(empCode,trunc(sysdate))) pe) )C ) LOOP PIPE ROW (DailySalesMaster(x.TC,x.PC,x.NPC,x.NA,x.AMOUNT,x.quantity,x.COLUMNNAME,x.THEME_COLOR)); END LOOP; RETURN; END; END dailySalesDatamodel; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAV_COUP_PURCHDET_X ON TRAV_COUP_PURCHDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STP_NO_OF_PLAN_DAYS ( AS_EMP_CODE CHAR, AS_WORK_LOCALITY CHAR, AS_PRD_CODE CHAR ) RETURN NUMBER IS AS_CNT_NO_OF_PLAN_DAY NUMBER; BEGIN SELECT --X.STAN_CODE AS WORK_ROUTE_ID, COUNT(X.POS_CODE) into AS_CNT_NO_OF_PLAN_DAY FROM ( SELECT B.POS_CODE, S.DAY_NO, C.STAN_CODE FROM SPRS_TOUR_PLAN B, SPRS_TOUR_PLANDET S, EMPLOYEE A, LOCALITY C ,SALES_PERS E WHERE B.TRAN_ID=S.TRAN_ID AND A.EMP_CODE = E.SALES_PERS AND A.EMP_CODE = B.SALES_PERS AND S.WORK_LOCALITY=C.LOCALITY_CODE and S.WORK_LOCALITY= AS_WORK_LOCALITY and E.SALES_PERS = AS_EMP_CODE and B.PRD_CODE__FROM = AS_PRD_CODE and B.TRAN_ID = (select max(TRAN_ID) from SPRS_TOUR_PLAN X where X.SALES_PERS= AS_EMP_CODE AND X.PRD_CODE__FROM = AS_PRD_CODE ) GROUP BY B.POS_CODE, S.DAY_NO, C.STAN_CODE ) X; RETURN AS_CNT_NO_OF_PLAN_DAY; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_TRANS_AMT_NEW ( LS_REF_SER IN INVTRACE.REF_SER%type, LS_REF_ID IN INVTRACE.REF_ID%type, LS_REF_LINE IN INVTRACE.REF_LINE%type, LS_SITE_CODE IN INVTRACE.SITE_CODE%type, LS_ITEM_CODE IN INVTRACE.ITEM_CODE%type, LS_LOC_CODE IN INVTRACE.LOC_CODE%type, LS_LOT_NO IN INVTRACE.LOT_NO%type) RETURN NUMBER IS TRANS_AMT NUMBER(14,3); BEGIN BEGIN IF LS_REF_SER = 'ADJISS' THEN ----------For REF_SER ADJISS Start---------- SELECT SUM(B.QUANTITY * B.RATE) INTO TRANS_AMT FROM adj_issrcp A , adj_issrcpdet B WHERE A.TRAN_ID = B.TRAN_ID AND A.REF_SER = 'ADJISS' AND A.TRAN_ID = LS_REF_ID AND B.LINE_NO = LS_REF_LINE AND site_code = LS_SITE_CODE AND item_code = LS_ITEM_CODE AND LOC_CODE = LS_LOC_CODE AND LOT_NO = LS_LOT_NO ; ----------For REF_SER ADJISS End---------- ELSIF LS_REF_SER = 'ADJRCP' THEN ----------For REF_SER ADJRCP Start---------- SELECT SUM(B.QUANTITY * B.RATE) INTO TRANS_AMT FROM adj_issrcp A , adj_issrcpdet B WHERE A.TRAN_ID = B.TRAN_ID AND A.REF_SER = 'ADJRCP' AND A.TRAN_ID = LS_REF_ID AND B.LINE_NO = LS_REF_LINE AND site_code = LS_SITE_CODE AND item_code = LS_ITEM_CODE AND LOC_CODE = LS_LOC_CODE AND LOT_NO = LS_LOT_NO ; ----------For REF_SER ADJRCP End---------- ELSIF LS_REF_SER = 'D-ISS' THEN ----------For REF_SER D-ISS Start---------- SELECT SUM(B.QUANTITY * B.RATE) INTO TRANS_AMT FROM distord_iss A , distord_issdet B WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = LS_REF_ID AND B.LINE_NO = LS_REF_LINE --and site_code = LS_SITE_CODE AND item_code = LS_ITEM_CODE --AND LOC_CODE = LS_LOC_CODE AND LOT_NO = LS_LOT_NO ; ----------For REF_SER D-ISS End---------- ELSIF LS_REF_SER = 'D-RCP' THEN ----------For REF_SER D-RCP Start---------- SELECT SUM(B.QUANTITY * B.RATE) INTO TRANS_AMT FROM distord_rcp A , distord_rcpdet B WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = LS_REF_ID AND B.LINE_NO = LS_REF_LINE AND site_code = LS_SITE_CODE AND item_code = LS_ITEM_CODE --AND LOC_CODE = LS_LOC_CODE AND LOT_NO = LS_LOT_NO ; ----------For REF_SER D-RCP End---------- ELSIF LS_REF_SER = 'S-DSP' THEN ----------For REF_SER S-DSP Start---------- SELECT SUM(B.QUANTITY__STDUOM * B.RATE__STDUOM) INTO TRANS_AMT FROM despatch A , despatchdet B WHERE A.desp_ID = B.desp_ID AND A.desp_ID = LS_REF_ID AND B.LINE_NO = LS_REF_LINE AND a.site_code = LS_SITE_CODE AND b.item_code = LS_ITEM_CODE AND b.LOC_CODE = LS_LOC_CODE AND b.LOT_NO = LS_LOT_NO ; ----------For REF_SER S-SDP End---------- ELSIF LS_REF_SER = 'S-RET' THEN ----------For REF_SER S-RET Start---------- SELECT SUM(B.QUANTITY__STDUOM * B.RATE__STDUOM) INTO TRANS_AMT FROM sreturn A , sreturndet B WHERE a.tran_id = B.tran_id AND A.tran_id = LS_REF_ID AND B.LINE_NO = LS_REF_LINE AND a.site_code = LS_SITE_CODE AND b.item_code = LS_ITEM_CODE AND b.LOC_CODE = LS_LOC_CODE AND b.LOT_NO = LS_LOT_NO ; ----------For REF_SER S-RET End---------- ELSIF LS_REF_SER = 'C-ISS' THEN ----------For REF_SER C-ISS Start---------- SELECT SUM(B.QUANTITY * B.RATE) INTO TRANS_AMT FROM consume_iss A , consume_iss_det B WHERE a.CONS_ISSUE = B.CONS_ISSUE AND A.CONS_ISSUE = LS_REF_ID AND B.LINE_NO = LS_REF_LINE AND a.site_code__REQ = LS_SITE_CODE AND b.item_code = LS_ITEM_CODE AND b.LOC_CODE = LS_LOC_CODE AND b.LOT_NO = LS_LOT_NO ; ----------For REF_SER C-ISS End---------- END IF; EXCEPTION WHEN no_data_found THEN TRANS_AMT:=0; END; RETURN TRANS_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CAL_AMOUNT ( p_denomination IN NUMBER, -- (2.DENOMINATION) p_quantity IN NUMBER -- (2.QUANTITY) ) RETURN VARCHAR2 IS -- Local variables v_amount NUMBER; v_return_json VARCHAR2(4000); BEGIN -- Input validation IF p_denomination IS NULL OR p_quantity IS NULL THEN -- Return empty JSON if inputs are null v_return_json := '{data: {AMOUNT: null}}'; RETURN v_return_json; END IF; -- Calculate amount v_amount := p_denomination * p_quantity; -- Construct JSON response v_return_json := '{data: {AMOUNT: ' || TO_CHAR(v_amount) || '}}'; RETURN v_return_json; EXCEPTION WHEN OTHERS THEN -- Return error JSON in case of exceptions v_return_json := '{data: {AMOUNT: null, error: ' || SQLERRM || '}}'; RETURN v_return_json; END FN_CAL_AMOUNT; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TAX_AMT ( p_tran_id IN VARCHAR2, p_line_no IN NUMBER ) RETURN NUMBER IS v_tax_amt NUMBER; BEGIN SELECT sum(TAXTRAN.TAX_AMT) INTO v_tax_amt FROM taxtran INNER JOIN tax ON TAXTRAN.TAX_CODE = TAX.TAX_CODE LEFT JOIN sreturndet ON taxtran.TRAN_ID = sreturndet.TRAN_ID AND taxtran.LINE_NO = FN_RCON_LINENO_NUM(sreturndet.line_no) AND NVL(sreturndet.ret_rep_flag, 'P') = 'R' WHERE trim(taxtran.TRAN_ID) = trim(p_tran_id) AND trim(taxtran.LINE_NO) = trim(p_line_no) AND TAXTRAN.TRAN_CODE = 'S-RET' AND tax.print_tax = 'Y' AND taxtran.tax_amt <> 0; RETURN v_tax_amt; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LEAVEBAL_STR (ls_emp_code empleave.emp_code%type, ld_lve_date_fr empleave.lve_date_fr%type, ls_infotype char) return varchar2 as ls_retstring varchar2(1000); begin ls_retstring := ' '; if ls_infotype = 'B' then ls_retstring := 'Balance: '; if length(trim(ddf_get_leave_type(ls_emp_code,',',1,ld_lve_date_fr))) > 0 then ls_retstring := ls_retstring || '[' || trim(ddf_get_leave_type(ls_emp_code,',',1,ld_lve_date_fr)) || ': ' || trim(to_char(nvl(wrape_leaves_dtls(ls_emp_code,1,',',ld_lve_date_fr),0))) || ' ]'; end if; IF length(trim(ddf_get_leave_type(ls_emp_code,',',2,ld_lve_date_fr))) > 0 then ls_retstring := ls_retstring || ' [ ' || trim(ddf_get_leave_type(ls_emp_code,',',2,ld_lve_date_fr)) || ': ' || trim(to_char(nvl(wrape_leaves_dtls(ls_emp_code,2,',',ld_lve_date_fr),0))) || ' ]'; end if; IF length(trim(ddf_get_leave_type(ls_emp_code,',',3,ld_lve_date_fr))) > 0 then ls_retstring := ls_retstring || ' [ ' || trim(ddf_get_leave_type(ls_emp_code,',',3,ld_lve_date_fr)) || ': ' || trim(to_char(nvl(wrape_leaves_dtls(ls_emp_code,3,',',ld_lve_date_fr),0))) || ' ]'; end if; elsif ls_infotype = 'U' then ls_retstring := 'Unapproved: '; if length(trim(ddf_get_leave_type(ls_emp_code,',',1,ld_lve_date_fr))) > 0 then ls_retstring := ls_retstring || '[ ' || trim(ddf_get_leave_type(ls_emp_code,',',1,ld_lve_date_fr)) || ': ' || trim(to_char(nvl(wrape_un_appr_leave(ls_emp_code,1,',','',ld_lve_date_fr),0))) || ' ]'; end if; if length(trim(ddf_get_leave_type(ls_emp_code,',',2,ld_lve_date_fr))) > 0 then ls_retstring := ls_retstring || ' [ ' || trim(ddf_get_leave_type(ls_emp_code,',',2,ld_lve_date_fr)) || ': ' || trim(to_char(nvl(wrape_un_appr_leave(ls_emp_code,2,',','',ld_lve_date_fr),0))) || ' ]'; end if; if length(trim(ddf_get_leave_type(ls_emp_code,',',3,ld_lve_date_fr))) > 0 then ls_retstring := ls_retstring ||' [ ' || trim(ddf_get_leave_type(ls_emp_code,',',3,ld_lve_date_fr)) || ': ' || trim(to_char(nvl(wrape_un_appr_leave(ls_emp_code,3,',','',ld_lve_date_fr),0))) || ' ]'; end if; end if; return ls_retstring; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_AT_OBJ ON AUDIT_TRAIL (OBJ_NAME, CHG_ID, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDSTAX_BSRNO (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_str varchar2(200) ; ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ctr number(3); cursor c1 is select DISTINCT nvl(misc_payment.BANK_CODE__TAX,'') from misc_paydet,misc_payment where misc_paydet.tran_id = misc_payment.tran_id and misc_paydet.tran_ser = 'M-VOUC' and misc_paydet.vouch_no in (select misc_voucher_trace.tran_id from misc_voucher_trace ,TAX where misc_voucher_trace.TAX_CODE = TAX.TAX_CODE AND misc_voucher_trace.amount <>0 and tax.tax_group in ('ITDS ','SRTDS','ECTDS','SHTDS') AND tran_id__ref in ( ls_vouch_no ) ); begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_bank_cd_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; ls_str := rtrim(ls_str)||ls_bank_cd_det; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_ITDECL_DET_X ON EMP_ITDECL_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_SITE_LOTNO_LOTSL ON STOCK (SITE_CODE, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SPECIALITY (LS_SC_CODE IN CHAR) return char is ls_spl_descr VARCHAR2(250); BEGIN SELECT LISTAGG(SPEC.DESCR,', ') WITHIN GROUP(ORDER BY SPEC.DESCR) INTO ls_spl_descr FROM STRG_SPECIALITY STRG_SPEC, SPECIALITY SPEC WHERE STRG_SPEC.SPL_CODE = SPEC.SPL_CODE AND STRG_SPEC.SC_CODE = LS_SC_CODE; return ls_spl_descr; exception when too_many_rows then RETURN ' '; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_EXCISE_AMT (AS_TRANCODE char,AS_TRANID CHAR ,AS_LINENO NUMBER ,AS_TYPE CHAR ) RETURN NUMBER IS lc_amt number(14,3); begin select NVL(sum(tax_amt),0) into lc_amt from taxtran a,tax b where a.tran_code=AS_TRANCODE and a.tran_id= AS_TRANID and a.line_no = LPAD(rtrim(TO_Char(AS_LINENO)),3,' ') and b.tax_type=AS_TYPE and b.tax_code= a.tax_code ; return lc_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECADJ_REFSER_NO ON RECEIVABLES_ADJ (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_NRV (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, as_invoice_id in char) return number is mrate number(14,3); msorder char(10); mplist char(5); mdisc_rate number(14,3); begin if as_type = 'L' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif as_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; select sale_order into msorder from invoice where invoice_id = as_invoice_id; select price_list__disc into mplist from sorder where sale_order = msorder; select rate into mdisc_rate from pricelist where price_list = mplist and item_code = as_item_code and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; mrate := mrate - ( (mrate * mdisc_rate) /100 ); return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DEALERTYPE ( ref_ser in char, ref_id in char) return char is ls_type char(1); begin if ref_ser = 'S-DSP' then select customer.cust_type into ls_type from despatch, customer where desp_id = ref_id and despatch.cust_code = customer.cust_code ; elsif ref_ser = 'S-RET' then select customer.cust_type into ls_type from sreturn, customer where tran_id = ref_id and sreturn.cust_code = customer.cust_code ; end if; return ls_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SERVICE_TAX_DETAILS (as_type in char, as_code in char) return varchar2 is as_party varchar2(250); begin if as_type = 'S' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||', '||nvl(addr3,' ')||', '||nvl(city,' ')||' - ' ||nvl(pin,' ')||', '||nvl(state_code,' ')||', '||nvl(count_code,' ') into as_party from supplier where supp_code = as_code; elsif as_type = 'C' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(city,' ')||' - ' ||nvl(pin,' ')||', '||nvl(state_code,' ')||', '||nvl(count_code,' ') into as_party from customer where cust_code = as_code; elsif as_type = 'T' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(city,' ')||' - ' ||nvl(pin,' ')||','||nvl(count_code,' ') into as_party from transporter where tran_code = as_code; elsif as_type = 'B' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(CITY,' ')||' - ' ||nvl(PIN,' ')||','||nvl(STATE_CODE,' ') ||',' ||nvl(COUNT_CODE,' ') into as_party from bank where bank_code = as_code; elsif as_type = 'X' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(city,' ')||' - ' ||nvl(pin,' ')||', '||nvl(state_code,' ')||','||nvl(count_code,' ') into as_party from tax_authority where tauth_code = as_code; elsif as_type = 'P' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(city,' ')||' - ' ||nvl(pin,' ')||', '||nvl(state_code,' ')||','||nvl(count_code,' ') into as_party from sales_pers where sales_pers = as_code; elsif as_type = 'L' then select nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ') ||', '||nvl(city,' ')||' - ' ||nvl(pin,' ')||', '||nvl(state_code,' ')||','||nvl(count_code,' ') into as_party from loanparty where party_code = as_code; elsif as_type = 'E' then select nvl(cur_add1,' ')||', '||nvl(cur_add2,' ')||','||nvl(cur_add3,' ') ||', '||nvl(cur_city,' ')||' - ' ||nvl(cur_pin,' ')||', '||nvl(cur_state,' ') into as_party from employee where emp_code = as_code; elsif as_type = 'O' then select nvl(add1,' ')||', '||nvl(add2,' ')||', '||nvl(add3,' ')||', '||nvl(city,' ') into as_party from site where site_code = as_code; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STOCK_PACK_INSTR ( as_site_code stock.site_code%type, as_item_code stock.item_code%type, as_loc_code stock.loc_code%type, as_lot_no stock.lot_no%type, as_lot_sl stock.lot_sl%type) return varchar2 is ls_pack_instr varchar2(1000); begin select nvl(pack_instr, '') into ls_pack_instr from stock where site_code = as_site_code and item_code = as_item_code and loc_code = as_loc_code and lot_no = as_lot_no and lot_sl = as_lot_sl; return ls_pack_instr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CHANNEL_SITE (as_supp_code in supplier.supp_code%type, as_type in char, as_site_code in site.site_code%type) return char is ls_site_code site.site_code%type; begin if as_type = 'S' then -- //supplier begin --// added by shubh 24-05-03 select site_code__ch into ls_site_code from site_supplier where site_code = as_site_code and supp_code = as_supp_code and channel_partner = 'Y'; exception when others then ls_site_code := null; end; if ls_site_code is null or length(trim(ls_site_code)) = 0 then begin --// ended by shubh 24-05-03 select site_code into ls_site_code from supplier where channel_partner = 'Y' and supp_code = as_supp_code; exception when others then ls_site_code := 'ERRORDS000'; -- + string(sqlca.sqldbcode) end; end if; elsif as_type = 'C' then -- 'C' //customer begin --// added by shubh 24-05-03 select site_code__ch into ls_site_code from site_customer where cust_code = as_supp_code and site_code = as_site_code and channel_partner = 'Y' ; exception when others then ls_site_code := null; end; if ls_site_code is null or length(trim(ls_site_code)) = 0 then begin --// ended by shubh 24-05-03 select site_code into ls_site_code from customer where channel_partner = 'Y' and cust_code = as_supp_code; exception when others then ls_site_code := 'ERRORDS000'; -- + string(sqlca.sqldbcode) end; end if; end if; return ls_site_code; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_CALC_ATTD_INC (AS_PRD_CODE char,AS_EMP_CODE char,AS_ABS_DAYS number,AS_PROC_TYPE char) return number is a_fr_date period.fr_date%type; a_to_date period.to_date%type; a_join_date employee.date_join%type; a_relieve_date employee.relieve_date%type; a_no_days empleave_summary.no_days%type; a_amount payrolldet.amount%type := 0; a_elig_check employee_ad.amount%type; a_tot_days number(2); a_abs_days payroll.abs_days%type := nvl(AS_ABS_DAYS,0); a_jr_days number(2) := 0; begin select fr_date,to_date,(to_date - fr_date+1) into a_fr_date,a_to_date,a_tot_days from period where code = AS_PRD_CODE; select nvl(sum(amount),0) into a_elig_check from employee_ad where emp_code = AS_EMP_CODE and ad_code = 'ATDI1' and a_to_date between eff_date and exp_date and confirmed = 'Y'; if (a_elig_check = 0) then return a_amount; end if; select date_join,relieve_date into a_join_date,a_relieve_date from employee where emp_code = AS_EMP_CODE; if ((a_join_date > a_to_date and a_join_date is not null) or (a_relieve_date < a_fr_date and a_relieve_Date is not null)) then return a_amount; end if; if (a_join_date between a_fr_date and a_to_date and a_join_date is not null) then a_jr_days := a_jr_days + (a_join_date - a_fr_date); end if; if (a_relieve_date between a_fr_date and a_to_date and a_relieve_date is not null) then a_jr_days := a_jr_days + (a_to_date - a_relieve_date); end if; select nvl(sum(a.no_days),0) into a_no_days from empleave_summary a,leaves b where b.lve_code = a.lve_code and a.emp_code = AS_EMP_CODE and a.lve_code != 'LWP' and a.prd_code = AS_PRD_CODE and a.use_flag = 'C' and b.payable = 'N'; if (AS_PROC_TYPE = 'PP') then a_abs_days := 0; a_no_days := 0; a_jr_days := 0; end if; if (AS_PRD_CODE between '201104' and '201106') then select amount into a_amount from ad_slabs where ad_code = 'ATDIN' and eff_date <= a_to_date and exp_date >= a_to_date and 0 between min_base_amt and max_base_amt; else select amount into a_amount from ad_slabs where ad_code = 'ATDIN' and eff_date <= a_to_date and exp_date >= a_to_date and (a_abs_days - a_no_days - a_jr_days) between min_base_amt and max_base_amt; end if; if (AS_PRD_CODE between '201104' and '201106') then if (a_abs_days != 0) then a_amount := round((a_amount * (a_tot_days - a_abs_days) / a_tot_days),2); end if; else if (a_amount != 0 and (a_no_days != 0 or a_jr_days != 0)) then a_amount := round((a_amount * (a_tot_days - a_no_days - a_jr_days) / a_tot_days),2); end if; end if; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ENTITY_NAME (as_entity_type char,as_entity_code char) return varchar is custName varchar2(60); begin if(as_entity_type='C') then select first_name || ' ' || last_name into custName from strg_customer where sc_code = as_entity_code; end if; if(as_entity_type='S') then select SUPP_NAME into custName from SUPPLIER where SUPP_CODE = as_entity_code; end if; if(as_entity_type='T') then select TRAN_NAME into custName from transporter where TRAN_CODE = as_entity_code; end if; if(as_entity_type='R') then select SP_NAME into custName from sales_pers where sales_pers = as_entity_code; end if; return custName; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_ASSET_TRANSFER_HDR ON ASSET_TRANSFER_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOTSL_LOC ( lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, llot_sl in char, lavailable in char, lloc_code in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from invstat b , location c, stock a where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' --to ignore location such as INTR and INTR1 and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.lot_sl = llot_sl and a.loc_code = lloc_code and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from invstat b , location c, stock a where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' --to ignore location such as INTR and INTR1 and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and a.lot_sl = llot_sl and a.loc_code = lloc_code and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from location b, invstat c, invtrace a where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' --to ignore location such as INTR and INTR1 and a.tran_date > ad_from_date and a.lot_sl = llot_sl and a.loc_code = lloc_code and instr(lavailable,c.available) > 0); if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MRP_DUEDATE (ld_retdate in date) return date is ld_date date; begin return ld_retdate - 1600; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVTRACE_TRAN_DATE ON INVTRACE (TRAN_DATE, SITE_CODE, REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING STORAGE(INITIAL 52428800 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TRAVCOUP_COUPON_NO ON TRAV_COUP_BAL (COUPON_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PAYMENT_MODE ( ls_pay_mode char) return CHAR is ls_payment_mode varchar2(120); begin select (CASE WHEN ls_pay_mode = 'C' THEN 'Cash' WHEN ls_pay_mode = 'Q' THEN 'Cheque' WHEN ls_pay_mode = 'T' THEN 'Electronic Transfer' WHEN ls_pay_mode= 'D' THEN 'Demand Draft' WHEN ls_pay_mode = 'P' THEN 'Pay Order' WHEN ls_pay_mode = 'R' THEN 'Credit Card' WHEN ls_pay_mode = 'I' THEN 'EDI' WHEN ls_pay_mode = 'Y' THEN 'Payment Advice' WHEN ls_pay_mode = 'G' THEN 'RTGS' WHEN ls_pay_mode = 'N' THEN 'NEFT' WHEN ls_pay_mode = 'W' THEN 'Cheque Print' ELSE '' END) INTO ls_payment_mode from dual; return ls_payment_mode; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHKLIST_DATA (as_chklst CHECKLIST_REV.CHKLIST_CODE%type, as_revno CHECKLIST_REV.REVISION_NO%type, as_flag char) return varchar2 is ls_data CHECKLIST_REV.REAS_DETAIL%type; ls_reasdet CHECKLIST_REV.REAS_DETAIL%type; ls_reasDescr CHECKLIST_REV.REAS_DETAIL%type; begin begin SELECT REAS_DETAIL , FN_GET_DESCR_GENCODES('REAS_CODE','W_CHECKLIST_REV',REAS_CODE) AS REASON_DESCR into ls_ReasDet, ls_reasDescr FROM CHECKLIST_REV WHERE CHKLIST_CODE = as_chklst AND REVISION_NO = as_revno; if as_flag ='A' THEN ls_data := ls_reasDet; return ls_data; elsif as_flag ='B' THEN ls_data := ls_reasDescr; return ls_data; end if; Exception when NO_DATA_FOUND then if as_flag ='A' THEN ls_data := 'New'; return ls_data ; elsif as_flag ='B' THEN ls_data := 'New'; return ls_data ; end if; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SUNDBAL_AC (ldate_fr in date, ldate_to in date, lsite_code in char, lacct_code in char , lsundry_type in char , lsundry_code in char) return number is lc_bal number(14,3); lc_sbal number(14,3); ls_acct_prd char(6); ls_prd_code char(6); begin select acct_prd , code into ls_acct_prd , ls_prd_code from period where ldate_fr between fr_date and to_date; select nvl(sum((dr_amt) - (cr_amt)),0) into lc_sbal from sundrybal where sundry_type = lsundry_type and sundry_code = lsundry_code and site_code = lsite_code and acct_prd = ls_acct_prd and prd_code < ls_prd_code and acct_code = lacct_code; Select nvl(sum((dr_amt * exch_rate) - (cr_amt * exch_rate)) , 0) into lc_bal from gltrace where site_code = lsite_code and tran_date >= ldate_fr and tran_date < ldate_to and sundry_type = lsundry_type and sundry_code= lsundry_code and acct_code = lacct_code; lc_bal := lc_sbal + lc_bal; Return lc_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SO_CUSTGSTNO_CHK (IN_CUST_CODE IN CHAR) return number as PVAL number(1); IN_GST_NO CUSTOMER.TAX_REG_2%TYPE; BEGIN SELECT TAX_REG_2 INTO IN_GST_NO FROM CUSTOMER WHERE CUST_CODE=IN_CUST_CODE; IF IN_GST_NO IS NOT NULL THEN PVAL := 1; ELSE PVAL := 0; END IF; RETURN PVAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUNDRYTRDT ( ls_ref_ser in char , ls_tran_id in char ) Return date is ls_tran_date invoice.tran_date%type; Begin If ls_ref_ser = 'S-INV' Then Select tran_date Into ls_tran_date From Invoice Where Trim(invoice_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'VOUCH' Then Select tran_date Into ls_tran_date From Voucher Where Trim(tran_id) = Trim(ls_tran_id) ; ElsIf ls_ref_ser = 'CRNPAY' Or ls_ref_ser = 'DRNPAY' Then Select tran_date Into ls_tran_date From DRCR_Pay Where Trim(tran_id) = Trim(ls_tran_id) ; ElsIf ls_ref_ser = 'CRNRCP' Or ls_ref_ser = 'DRNRCP' Then Select tran_date Into ls_tran_date From DRCR_Rcp Where Trim(tran_id) = Trim(ls_tran_id) ; ElsIf ls_ref_ser = 'D-RCP' Then Select tran_date Into ls_tran_date From DistOrd_Rcp Where Trim(tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'P-RCP' Then Select tran_date Into ls_tran_date From PORCP Where Trim(tran_id) = Trim(ls_tran_id); End If; Return ls_tran_date; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_TAX_CHK_DSP BEFORE UPDATE of confirmed ON despatch referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_tenvcount number(3) := 0; ll_taxcount number(3) := 0; ls_sql varchar2(4000); cur_out sys_refcursor; ll_retval number(1) := 0; ll_mismatch_cnt number(6) := 0; ls_lineno char(3); ls_taxenv char(10); ls_msg varchar2(4000); BEGIN if :new.confirmed = 'Y' then ls_msg := 'Taxtran count mismatch for line '; ls_sql := 'Select line_no,tax_env from porcpdet where tran_id = :tran_id'; OPEN cur_out FOR ls_sql USING :new.desp_id ; LOOP FETCH cur_out INTO ls_lineno, ls_taxenv; EXIT WHEN cur_out%NOTFOUND; if ls_taxenv is not null and length(trim(ls_taxenv)) > 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = 'S-DSP' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; if ll_tenvcount = 0 then begin select count(1) into ll_tenvcount from tenvseq where ref_ser = ' ' and tax_env = ls_taxenv ; exception when others then ll_tenvcount := 0; end; end if; --if ll_tenvcount > 0 then begin ls_lineno := substr(' ' || trim(ls_lineno) , -3); select count(1) into ll_taxcount from taxtran where tran_code = 'S-DSP' and tran_id = :new.desp_id and line_no = ls_lineno; exception when others then ll_taxcount := 0; end; --end if; if NVL(ll_tenvcount,0) <> NVL(ll_taxcount,0) then ls_msg := ls_msg || ls_lineno || ','; ll_mismatch_cnt := 1; end if; end if; END LOOP; if ll_mismatch_cnt > 0 then raise_application_error( -20601, ls_msg); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE PARSE /* Generalized delimited string parsing package Author: Steven Feuerstein, steven@stevenfeuerstein.com Latest version always available on PL/SQL Obsession: www.ToadWorld.com/SF Click on Trainings, Seminars and Presentations and then download the demo.zip file. Modification History Date Change 10-APR-2009 Add support for nested list variations Notes: * This package does not validate correct use of delimiters. It assumes valid construction of lists. * Import the Q##PARSE.qut file into an installation of Quest Code Tester 1.8.3 or higher in order to run the regression test for this package. */ IS SUBTYPE maxvarchar2_t IS VARCHAR2 (32767); /* Each of the collection types below correspond to (are returned by) one of the parse functions. items_tt - a simple list of strings nested_items_tt - a list of lists of strings named_nested_items_tt - a list of named lists of strings This last type also demonstrates the power and elegance of string-indexed collections. The name of the list of elements is the index value for the outer collection. */ TYPE items_tt IS TABLE OF maxvarchar2_t INDEX BY PLS_INTEGER; TYPE nested_items_tt IS TABLE OF items_tt INDEX BY PLS_INTEGER; TYPE named_nested_items_tt IS TABLE OF items_tt INDEX BY maxvarchar2_t; /* Parse lists with a single delimiter. Example: a,b,c,d Here is an example of using this function: DECLARE l_list parse.items_tt; BEGIN l_list := parse.string_to_list ('a,b,c,d', ','); END; */ FUNCTION string_to_list (string_in IN VARCHAR2, delim_in IN VARCHAR2) RETURN items_tt; /* Parse lists with nested delimiters. Example: a,b,c,d|1,2,3|x,y,z Here is an example of using this function: DECLARE l_list parse.nested_items_tt; BEGIN l_list := parse.string_to_list ('a,b,c,d|1,2,3,4', '|', ','); END; */ FUNCTION string_to_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ) RETURN nested_items_tt; /* Parse named lists with nested delimiters. Example: letters:a,b,c,d|numbers:1,2,3|names:steven,george Here is an example of using this function: DECLARE l_list parse.named_nested_items_tt; BEGIN l_list := parse.string_to_list ('letters:a,b,c,d|numbers:1,2,3,4', '|', ':', ','); END; */ FUNCTION string_to_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , name_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ) RETURN named_nested_items_tt; PROCEDURE display_list (string_in IN VARCHAR2 , delim_in IN VARCHAR2:= ',' ); PROCEDURE display_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ); PROCEDURE display_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , name_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ); PROCEDURE show_variations; /* Helper function for automated testing */ FUNCTION nested_eq (list1_in IN items_tt , list2_in IN items_tt , nulls_eq_in IN BOOLEAN ) RETURN BOOLEAN; END parse; CREATE OR REPLACE PACKAGE BODY PARSE IS FUNCTION string_to_list (string_in IN VARCHAR2, delim_in IN VARCHAR2) RETURN items_tt IS c_end_of_list CONSTANT PLS_INTEGER := -99; l_item maxvarchar2_t; l_startloc PLS_INTEGER := 1; items_out items_tt; PROCEDURE add_item (item_in IN VARCHAR2) IS BEGIN IF item_in = delim_in THEN /* We don't put delimiters into the collection. */ NULL; ELSE items_out (items_out.COUNT + 1) := item_in; END IF; END; PROCEDURE get_next_item (string_in IN VARCHAR2 , start_location_io IN OUT PLS_INTEGER , item_out OUT VARCHAR2 ) IS l_loc PLS_INTEGER; BEGIN l_loc := INSTR (string_in, delim_in, start_location_io); IF l_loc = start_location_io THEN /* A null item (two consecutive delimiters) */ item_out := NULL; ELSIF l_loc = 0 THEN /* We are at the last item in the list. */ item_out := SUBSTR (string_in, start_location_io); ELSE /* Extract the element between the two positions. */ item_out := SUBSTR (string_in , start_location_io , l_loc - start_location_io ); END IF; IF l_loc = 0 THEN /* If the delimiter was not found, send back indication that we are at the end of the list. */ start_location_io := c_end_of_list; ELSE /* Move the starting point for the INSTR search forward. */ start_location_io := l_loc + 1; END IF; END get_next_item; BEGIN IF string_in IS NULL OR delim_in IS NULL THEN /* Nothing to do except pass back the empty collection. */ NULL; ELSE LOOP get_next_item (string_in, l_startloc, l_item); add_item (l_item); EXIT WHEN l_startloc = c_end_of_list; END LOOP; END IF; RETURN items_out; END string_to_list; FUNCTION string_to_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ) RETURN nested_items_tt IS l_elements items_tt; l_return nested_items_tt; BEGIN /* Separate out the different lists. */ l_elements := string_to_list (string_in, outer_delim_in); /* For each list, parse out the separate items and add them to the end of the list of items for that list. */ FOR indx IN 1 .. l_elements.COUNT LOOP l_return (l_return.COUNT + 1) := string_to_list (l_elements (indx), inner_delim_in); END LOOP; RETURN l_return; END string_to_list; FUNCTION string_to_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , name_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ) RETURN named_nested_items_tt IS c_name_position constant pls_integer := 1; c_items_position constant pls_integer := 2; l_elements items_tt; l_name_and_values items_tt; l_return named_nested_items_tt; BEGIN /* Separate out the different lists. */ l_elements := string_to_list (string_in, outer_delim_in); FOR indx IN 1 .. l_elements.COUNT LOOP /* Extract the name and the list of items that go with the name. This collection always has just two elements: index 1 - the name index 2 - the list of values */ l_name_and_values := string_to_list (l_elements (indx), name_delim_in); /* Use the name as the index value for this list. */ l_return (l_name_and_values (c_name_position)) := string_to_list (l_name_and_values (c_items_position), inner_delim_in); END LOOP; RETURN l_return; END string_to_list; PROCEDURE display_list (string_in IN VARCHAR2 , delim_in IN VARCHAR2:= ',' ) IS l_items items_tt; BEGIN DBMS_OUTPUT.put_line ( 'Parse ' || string_in || ' using ' || delim_in || '' ); l_items := string_to_list (string_in, delim_in); FOR indx IN 1 .. l_items.COUNT LOOP DBMS_OUTPUT.put_line ('> ' || indx || ' = ' || l_items (indx)); END LOOP; END display_list; PROCEDURE display_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ) IS l_items nested_items_tt; BEGIN DBMS_OUTPUT.put_line( 'Parse ' || string_in || ' using ' || outer_delim_in || '-' || inner_delim_in || ''); l_items := string_to_list (string_in, outer_delim_in, inner_delim_in); FOR outer_index IN 1 .. l_items.COUNT LOOP DBMS_OUTPUT.put_line( 'List ' || outer_index || ' contains ' || l_items (outer_index).COUNT || ' elements'); FOR inner_index IN 1 .. l_items (outer_index).COUNT LOOP DBMS_OUTPUT.put_line( '> Value ' || inner_index || ' = ' || l_items (outer_index) (inner_index)); END LOOP; END LOOP; END display_list; PROCEDURE display_list (string_in IN VARCHAR2 , outer_delim_in IN VARCHAR2 , name_delim_in IN VARCHAR2 , inner_delim_in IN VARCHAR2 ) IS l_items named_nested_items_tt; l_index maxvarchar2_t; BEGIN DBMS_OUTPUT.put_line( 'Parse ' || string_in || ' using ' || outer_delim_in || '-' || name_delim_in || '-' || inner_delim_in || ''); l_items := string_to_list (string_in , outer_delim_in , name_delim_in , inner_delim_in ); l_index := l_items.FIRST; WHILE (l_index IS NOT NULL) LOOP DBMS_OUTPUT.put_line( 'List ' || l_index || ' contains ' || l_items (l_index).COUNT || ' elements'); FOR inner_index IN 1 .. l_items (l_index).COUNT LOOP DBMS_OUTPUT.put_line( '> Value ' || inner_index || ' = ' || l_items (l_index) (inner_index)); END LOOP; l_index := l_items.NEXT (l_index); END LOOP; END display_list; PROCEDURE show_variations IS PROCEDURE show_header (title_in IN VARCHAR2) IS BEGIN DBMS_OUTPUT.put_line (RPAD ('=', 60, '=')); DBMS_OUTPUT.put_line (title_in); DBMS_OUTPUT.put_line (RPAD ('=', 60, '=')); END show_header; BEGIN show_header ('Single Delimiter Lists'); display_list ('a,b,c'); display_list ('a;b;c', ';'); display_list ('a,,b,c'); display_list (',,b,c,,'); show_header ('Nested Lists'); display_list ('a,b,c,d|1,2,3|x,y,z', '|', ','); show_header ('Named, Nested Lists'); display_list ('letters:a,b,c,d|numbers:1,2,3|names:steven,george' , '|' , ':' , ',' ); END; FUNCTION nested_eq (list1_in IN items_tt , list2_in IN items_tt , nulls_eq_in IN BOOLEAN ) RETURN BOOLEAN IS l_return BOOLEAN := list1_in.COUNT = list2_in.COUNT; l_index PLS_INTEGER := 1; BEGIN WHILE (l_return AND l_index IS NOT NULL) LOOP l_return := list1_in (l_index) = list2_in (l_index); l_index := list1_in.NEXT (l_index); END LOOP; RETURN l_return; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE; END nested_eq; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_VOUCHER_SUNDRY_BILL ON MISC_VOUCHER (SUNDRY_TYPE, SUNDRY_CODE, BILL_NO, VOUCH_TYPE, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESPQTYFREE ( as_desp_id in char, as_item in char) return varchar is ls_return varchar2(15); lc_free number(5); lc_actual number(5); lc_qty number(5); lc_rate number(14,3); lc_cnt number(5); cursor c_free is select nvl(quantity__stduom,0), rate__stduom from despatchdet where desp_id = as_desp_id and item_code = as_item ; begin select min(rate__stduom) into lc_rate from despatchdet where desp_id = as_desp_id and item_code = as_item ; select count(distinct item_code) into lc_cnt from despatchdet where desp_id = as_desp_id ; if lc_cnt = 1 and lc_rate = 0 then lc_free := 0; lc_actual := 0; OPEN c_free; loop FETCH c_free INTO lc_qty, lc_rate; exit when c_free%NOTFOUND; if lc_rate = 0 then lc_free := lc_free + lc_qty; elsif lc_rate > 0 then lc_actual := lc_actual + lc_qty; end if; end LOOP; close c_free; if lc_actual = 0 then ls_return := '( ' || to_char(lc_free) || ' FREE)'; else ls_return := '( ' || to_char(lc_actual) || ' + ' || to_char(lc_free) || ' FREE)'; end if; else select nvl(sum(quantity__stduom),0) into lc_qty from despatchdet where desp_id = as_desp_id and item_code = as_item and nvl(rate__stduom,0) = 0; if lc_qty = 0 then ls_return := 'N'; else ls_return := '( ' || to_char(lc_qty) || ' FREE)'; end if; end if; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDDET_SITE_ITEM ON PORDDET (SITE_CODE, ITEM_CODE, DLV_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE LOCALITYCODEMASTERTABLE AS TABLE OF localityCodeMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SLPERS (as_sales_pers in char) return char is ls_name char(40); begin select nvl(sp_name,'') into ls_name from sales_pers where sales_pers = as_sales_pers; return ls_name ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALES_PERS_ITEM_SER ON SALES_PERS (SALES_PERS, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_MTL (mwork_order in char, mwo_rcp_qty in number) return char is cursor c1 is select item_code, ref_qty, sum(quantity) quantity, sum(iss_qty) iss_qty from workorder_bill where work_order = mwork_order and adj_potency is null and item_code like 'BF%' -- and usage_type = 'O' and consider_lot_no__issue = 'Y' group by item_code, ref_qty; ls_item_code char(10) := null; ls_wo_rcvd_qty number := 0; ls_qty number := 0; ls_retval char(1) := '0'; begin select nvl(sum(quantity__rcvd), 0) into ls_wo_rcvd_qty from workorder where work_order = mwork_order; ls_wo_rcvd_qty := mwo_rcp_qty + ls_wo_rcvd_qty; for x in c1 loop ls_qty := ls_wo_rcvd_qty * ( (x.quantity*0.9) / x.ref_qty ); if ( ls_qty > x.iss_qty ) or ( nvl(x.iss_qty, 0) = 0 ) then ls_retval := '1'; exit; end if; end loop; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_CLG_PRICELIST (as_clg_pl in sorder.price_list__clg%type,as_cust_code in sorder.cust_code%type) return number is ls_checkvalid char(1); ls_cust_type char(1); ls_order_type VARCHAR2(3); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'PIT_CLG_PL'; exception when others then ls_checkvalid := 'N'; end; select cust_type,order_type into ls_cust_type,ls_order_type from customer where cust_code = as_cust_code; if ls_checkvalid = 'Y' then if (ls_cust_type <> 'X' and ls_order_type <> 'EC') and as_clg_pl is null then RETURN 0 ; Else RETURN 1; end if; else RETURN 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MNFR_NAME (ls_qcorder in char) return char is ls_supp_name char(40); begin select nvl(supplier.supp_name,' ') into ls_supp_name from qc_order,porcpdet,supplier where (qc_order.porcp_no = porcpdet.tran_id (+)) and ((qc_order.porcp_line_no= porcpdet.line_no(+)) and (porcpdet.supp_code__mnfr = supplier.supp_code(+))) and ( qc_order.qorder_no = ls_qcorder ); return(ls_supp_name); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ORG_STAN_TRACE_X ON ORG_STAN_TRACE (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_TEST_STATUS_HTML ( p_qorder_no IN VARCHAR2 ) RETURN VARCHAR2 IS v_stat VARCHAR2(10); v_descr VARCHAR2(100); v_result VARCHAR2(4000); BEGIN -- Get test_stat from qc_order SELECT test_stat INTO v_stat FROM qc_order WHERE qorder_no = p_qorder_no; -- Get description using the test_stat value v_descr := GET_GEN_DESCR('W_QCORDER_NEW', TRIM(v_stat)); -- Build HTML string based on status /* v_result := 'Test Status: ' || CASE v_stat WHEN 'F' THEN '' || v_descr || '' WHEN 'P' THEN '' || v_descr || '' ELSE '' || v_descr || '' END;*/ v_result := 'Test Status: '|| v_descr; RETURN v_result; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'Test Status: NA'; WHEN OTHERS THEN RETURN 'Test Status: ERR'; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_UPR_CUSTNM ON CUSTOMER (UPPER(CUST_NAME)) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NUM_TO_WORDS_DOM ( number_to_convert number ) return varchar2 is mretval varchar2(1000) := ' '; begin if number_to_convert = 0 then mretval :='ZERO ' ; return mretval ; end if; if to_number(substr(number_to_convert,length(number_to_convert)-1)) > 0 then if number_to_convert > 1 then mretval := FIG_TO_WORDS(number_to_convert) ; end if; end if; return mretval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE VISTEMGRDARMASTER AS OBJECT ( SALES_PERS CHAR(10), SP_NAME VARCHAR2(62) , DESIGNATION VARCHAR2(45), SH_DESCR VARCHAR2(20) , STAN_DESCR VARCHAR2(40), STATE_DESCR VARCHAR2(40), LEVEL_NO NUMBER(3) , EMP_SITE CHAR(5) , RELIEVE_DATE DATE ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SCHQTY1 (as_site varchar2,as_tran_id varchar2, as_item_code varchar2, as_cust_code varchar2 , as_due_date date , as_flag number ) return decimal is as_qty_val decimal(12,3); ls_tranid varchar2(30); ls_price varchar2(20); ls_rate decimal(12,2); ls_qty decimal(12,3); ls_value decimal(12,3) ; ls_parent varchar2(30); begin ls_tranid := as_tran_id ||'%' ; select sum(nvl(sorddet.quantity,0) ) ,max(sorder.price_list ) into ls_qty ,ls_price from sorder,sorddet where sorder.sale_order = sorddet.sale_order and sorder.site_code = as_site and sorder.udf__str1 like ls_tranid and sorder.due_date = as_due_date and sorder.cust_code = as_cust_code and sorddet.item_code__ord = as_item_code; if ls_qty is null then ls_qty := 0; end if ; SELECT rate into ls_rate from pricelist where slab_no = (select MAX(SLAB_NO) from pricelist where price_list = ls_price AND ITEM_CODE = as_item_code) and price_list = ls_price AND ITEM_CODE = as_item_code ; ls_value := ls_rate * ls_qty ; if as_flag = 1 then as_qty_val := ls_qty ; elsif as_flag = 2 then as_qty_val := ls_value ; end if ; return as_qty_val ; exception when no_data_found then select price_list__parent into ls_parent from pricelist_mst_det where price_list = 'MRP' and price_list__tar = ls_price ; SELECT rate into ls_rate from pricelist where slab_no = (select MAX(SLAB_NO) from pricelist where price_list = ls_parent AND ITEM_CODE = as_item_code) and price_list = ls_parent AND ITEM_CODE = as_item_code; ls_value := ls_rate * ls_qty ; if as_flag = 1 then as_qty_val := ls_qty ; elsif as_flag = 2 then as_qty_val := ls_value ; end if ; return as_qty_val ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_MPTRACE_REFSERNO ON PAYABLES_TRACE (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MAX_DT (AS_SC_CODE VARCHAR2, AS_SALES_PERS VARCHAR2, AS_DATE DATE, AS_CUST_TYPE VARCHAR2) RETURN DATE IS LS_DATE DATE; BEGIN IF(AS_SC_CODE IS NOT NULL) THEN SELECT MAX(EVENT_DATE) INTO LS_DATE FROM STRG_MEET WHERE TRIM(STRG_CODE)=TRIM(AS_SC_CODE) AND TRIM(SALES_PERS)=TRIM(AS_SALES_PERS) AND TRIM(STRG_TYPE)=TRIM(AS_CUST_TYPE) AND EVENT_DATE<= AS_DATE; RETURN LS_DATE; ELSIF (AS_SC_CODE IS NULL) THEN RETURN ''; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN ''; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYTABLE_DESCR ON PAYTABLE (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SCHQTY2 (as_site varchar2,as_tran_id varchar2, as_item_code varchar2, as_cust_code varchar2 , as_due_date date ) return decimal is as_qty decimal(12,3); ls_tranid varchar2(30); begin ls_tranid := as_tran_id ||'%' ; select sum(nvl(sorddet.quantity,0) ) into as_qty from sorder,sorddet where sorder.sale_order = sorddet.sale_order and sorder.site_code = as_site and sorder.udf__str1 like ls_tranid and sorder.due_date = as_due_date and sorder.cust_code = as_cust_code and sorddet.item_code__ord = as_item_code; if as_qty is null then as_qty := 0; end if ; return as_qty ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DISTORDER_CLOSE_X ON DISTORDER_CLOSE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RETOPT (as_tranid in porcp.tran_id%type, as_opt in varchar , as_transer in varchar) return char is ls_dcno porcp.dc_no%type; ll_despcount number(6); ll_sretcount number(6); begin begin select dc_no into ls_dcno from porcp where tran_id = as_tranid; exception when others then ls_dcno := null; end; if ls_dcno is null then return 'Y'; end if; if as_transer = 'P-RCP' then begin select count(1) into ll_despcount from despatch where desp_id = ls_dcno; exception when others then ll_despcount := 0; end; else begin select count(1) into ll_sretcount from sreturn where tran_id = ls_dcno; exception when others then ll_sretcount := 0; end; end if ; if as_opt = 'B' and (ll_despcount > 0 or ll_sretcount > 0 ) then return 'Y'; elsif as_opt = 'C' and ll_despcount > 0 then return 'Y'; elsif as_opt = 'P' and ll_sretcount > 0 then return 'Y'; else return 'N'; end if; return 'N'; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PUREXPRECO_SITE_TRAN_DT ON PUR_EXP_RECO (SITE_CODE, TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOAN_PRINP (as_loan_no CHAR, as_prd_code CHAR) return NUMBER IS lc_prinp NUMBER(14,2) := 0.00; lc_int NUMBER; li_cnt NUMBER; lc_amt NUMBER(14,2); lc_tot_rec NUMBER(14,2); ld_dates DATE; ld_frdate DATE; ld_todate DATE; ld_fr_date DATE; ld_to_date DATE; BEGIN select payrolldet.amount into lc_prinp from payrolldet, payroll where payrolldet.prd_code = as_prd_code and payrolldet.ref_type = 'L' and payrolldet.ref_no =as_loan_no and payrolldet.prd_code = payroll.prd_code and payrolldet.emp_code = payroll.emp_code and payroll.voucher_no is not null; select count(*) into li_cnt from payrolldet where prd_code = as_prd_code and ref_type='N' and ref_no = as_loan_no; if (li_cnt = 0 and lc_prinp <> 0) and (as_prd_code = '200102' or as_prd_code = '200103' or as_prd_code ='200104') then select fr_date,to_date into ld_frdate, ld_todate from period where code = as_prd_code; ld_dates := ld_frdate - 1 ; ld_fr_date := ld_dates; ld_to_date := ld_todate; BEGIN select nvl(interest_amt,0.00) into lc_tot_rec from loans_interest where loan_no = as_loan_no and date__from between ld_fr_date and ld_to_date ; EXCEPTION WHEN NO_DATA_FOUND THEN lc_tot_rec := 0.00; END; lc_prinp := lc_prinp - nvl(lc_tot_rec,0); end if; return lc_prinp; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_WO_TRANID BEFORE INSERT OR UPDATE ON workorder FOR EACH ROW BEGIN :NEW.tran_id := :new.work_order; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSSOTERM1 (as_cr_term in sorder.cr_term%type) return number is ls_var_value VARCHAR2(50); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_UVSSOTERM1'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then select var_value into ls_var_value from finparm where var_name='DISHONOUR_CR_TERM' ; if as_cr_term = ls_var_value then return 0; else RETURN 1; end if; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BILLAMTSERCHR (htlBillId in varchar2,bookType in varchar2 , amtType in varchar2) return number is ls_amt number; begin if(htlBillId is not null) then begin if(amtType = 'A' and (bookType = 'M' or bookType = 'Q')) then begin Select SUM(tot_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and (bb_type = 'M' or bb_type = 'Q'); end; end if ; if(amtType = 'N' and (bookType = 'M' or bookType = 'Q')) then begin Select SUM(net_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and (bb_type = 'M' or bb_type = 'Q'); end; end if ; if(amtType = 'T' and (bookType = 'M' or bookType = 'Q')) then begin Select SUM(tax_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and (bb_type = 'M' or bb_type = 'Q'); end; end if ; if(amtType = 'A' and (bookType = 'L' or bookType = 'U')) then begin Select SUM(tot_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and (bb_type = 'L' or bb_type = 'U'); end; end if ; if(amtType = 'N' and (bookType = 'L' or bookType = 'U')) then begin Select SUM(net_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and (bb_type = 'L' or bb_type = 'U'); end; end if ; if(amtType = 'T' and (bookType = 'L' or bookType = 'U')) then begin Select SUM(tax_amt) into ls_amt from htl_bill_det where htl_bill_id = htlBillId and (bb_type = 'L' or bb_type = 'U'); end; end if ; end; end if; if (ls_amt is null) then ls_amt := 0; else ls_amt := ls_amt ; end if; return ls_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSUNDRY_SH_NAME ( AS_SUNDRY_CODE varchar2 , AS_SUNDRY_type varchar2 , AS_VAR_NAME varchar2 ) RETURN VARChaR2 IS ls_name VARCHAR2(2000); ls_fname VARCHAR2(20); ls_lname VARCHAR2(20); ls_mname VARCHAR(20); ls_temp_name VARCHAR2(20); begin CASE AS_VAR_NAME when 'O' then ls_name := ' ' ; when 'T' then if as_var_name = 'C' then select chq_name Into ls_name from transporter Where tran_code =AS_SUNDRY_CODE ; else select sh_name , tran_name into ls_name,ls_temp_name from transporter where tran_code =AS_SUNDRY_CODE; end if ; if ls_name is null or length(ls_name) = 0 then ls_name := substr(ls_temp_name,1,20) ; end if ; when 'B' then select sh_name, bank_name into ls_name , ls_temp_name from bank where bank_code = AS_SUNDRY_CODE; if ls_name is null or length(ls_name) = 0 then ls_name :=substr(ls_temp_name,1,20) ; end if; when 'X' then select sh_name, tauth_name into ls_name ,ls_temp_name from tax_authority where tauth_code =as_sundry_code; if ls_name is null or length(ls_name) = 0 then ls_name := substr(ls_temp_name,1,20) ; end if ; when 'E' then select short_name, emp_fname, emp_lname into ls_name , ls_fname ,ls_lname from employee where emp_code = as_sundry_code; if ls_name is null or length(ls_name) = 0 then if ls_name is null then ls_fname := '' ; ls_name := substr( (ls_fname + ls_lname) , 1 , 40 ) ; end if ; end if ; when 'P' then if as_var_name = 'C' then select chq_name into ls_name from sales_pers where sales_pers =as_sundry_code ; else select sh_name, sp_name into ls_name , ls_temp_name from sales_pers where sales_pers = as_sundry_code; end if ; if ls_name is null or length(ls_name) = 0 then ls_name := substr(ls_temp_name,1,20) ; end if ; when 'S' then if as_var_name = 'C' then select chq_name into ls_name from supplier where supp_code = as_sundry_code; else select sh_name, supp_name into ls_name ,ls_temp_name from supplier where supp_code = as_sundry_code; end if ; if ls_name is null or length(ls_name) = 0 then ls_name := substr(ls_temp_name,1,20) ; end if ; when 'C' then if as_var_name = 'C' then select chq_name into ls_name from customer where cust_code = as_sundry_code; else select sh_name, cust_name into ls_name ,ls_temp_name from customer where cust_code = as_sundry_code; if ls_name is null or length(ls_name) = 0 then ls_name := substr(ls_temp_name,1,20) ; end if ; end if ; when 'R' then if as_var_name = 'C' then select chq_name into ls_name from customer where cust_code = (select cust_code from strg_customer where sc_code = as_sundry_code); else select first_name into ls_temp_name from strg_customer where sc_code = as_sundry_code; end if; if ls_temp_name is null then ls_temp_name := '' ; ls_name := SUBSTR(ls_temp_name,1,20) ; end if ; when 'L' then if as_var_name = 'C' then select chq_name into ls_name from loanparty where party_code = as_sundry_code; else select sh_name, party_name into ls_name , ls_temp_name from loanparty where party_code =as_sundry_code; end if; if ls_name is null or length(ls_name) = 0 then ls_name := SUBSTR(ls_temp_name,1,20) ; end if ; else ls_name := ' ' ; end case; return ls_name ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LEAVE_TYPE (empCode In Varchar2,as_Sep In Varchar2, as_Pos In int,tranDate In date ) Return Varchar2 Is Type Type_Str Is Table Of Varchar2(200) Index By Binary_Integer; Li_Str_Tbl Type_Str; Li_Idx Binary_Integer := 1; Li_Pos_No Int; Li_Str Varchar2(1000); Li_Word Varchar2(100); as_String Varchar2(100); Begin select ddf_hr_site_env_value(empCode,tranDate,'LEAVE_ALLOWED_FOR_SI') into as_String from dual; Li_Str := Ltrim(Rtrim(as_String, as_Sep),as_Sep)||as_Sep; Li_Pos_No := Instr(Li_Str, as_Sep); While(Li_Pos_No > 0) Loop Li_Word := Substr(Li_Str, 1, (Li_Pos_No - 1)); Li_Str_Tbl(Li_Idx):= Li_Word; Li_Str := Substr(Li_Str, (Li_Pos_No + 1)); Li_Pos_No := Instr(Li_Str, as_Sep); Li_Idx := Li_Idx + 1; End Loop; If Li_Str_Tbl.Count < as_Pos Then Return 'Invalid No entered.'; Else Return Li_Str_Tbl(as_Pos); End If; Exception When Others Then Return 'Err '||Sqlerrm; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_DWH_PEVENT_SITEDATE ON DWH_PRODUCTION_DAY_EVENTS (SITE_CODE, TRAN_DATE, REF_TYPE, REF_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKFINANCEAMOUNT ( p_finance_amount IN NUMBER -- (1.FINANCE_AMOUNT) ) RETURN NUMBER IS -- Object Name: applicant_mgmt_applicant_info -- Event Type: field_validation -- Form Number: 1 -- Field Name: FINANCE_AMOUNT -- Business Logic: should be positive -- Function Name: CHECKFINANACEAOUNT v_is_valid NUMBER := 0; -- Variable to store validation result BEGIN -- Check if the amount is not null and greater than zero IF p_finance_amount IS NOT NULL AND p_finance_amount > 0 THEN v_is_valid := 1; END IF; RETURN v_is_valid; EXCEPTION WHEN OTHERS THEN -- Handle unexpected errors RETURN 0; END CHECKFINANCEAMOUNT; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRONO (as_trancode in char,as_prono in varchar2) return varchar2 is ls_prono varchar2(20) := as_prono; len number := 0; m number(17,2); rem number(17,2); c number; sumodd number := 0; sumeven number := 0; begin if trim(as_trancode) in ('TACO0001','TAUP0071') then m := as_prono / 7; rem := m-trunc(m); if rem = 0 then ls_prono := as_prono||'0'; elsif rem = .14 then ls_prono := as_prono||'1'; elsif (rem = .28 or rem = .29) then ls_prono := as_prono||'2'; elsif (rem = .42 or rem = .43) then ls_prono := as_prono||'3'; elsif rem = .57 then ls_prono := as_prono||'4'; elsif rem = .71 then ls_prono := as_prono||'5'; elsif (rem = .85 or rem = .86) then ls_prono := as_prono||'6'; end if; end if; if trim(as_trancode) in ('TAFE0039') then m := as_prono / 7; rem := trunc(m); rem := rem * 7; rem := as_prono - rem; ls_prono := as_prono||trim(rem); end if; return ls_prono ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WORK_STAN_TYPE (ls_sales_pers dr_travel_details.sales_pers%type, ld_work_date dr_travel_details.work_date%type) return varchar2 is ls_stan_type stantype.stan_type%type; travelCNT NUMBER; routeCNT NUMBER; mgrprcdnc NUMBER; sorprcdnc NUMBER; EMP_CODE_MGR char(10); LL_GRADE_TYPE char(1); begin travelCNT := 0 ; routeCNT := 0 ; mgrprcdnc := 0 ; sorprcdnc := 0 ; select a.stan_type into ls_stan_type from fieldactivity a where a.activity_code = (select max(activity_code) from dr_travel_details where sales_pers = ls_sales_pers and work_date = ld_work_date); if ls_stan_type is null then SELECT B.GRADE_TYPE into LL_GRADE_TYPE FROM EMPLOYEE A, GRADE B WHERE A.EMP_CODE = ls_sales_pers AND A.GRADE = B.GRADE_CODE ; --AND B.GRADE_TYPE = 'M'; if (LL_GRADE_TYPE is not null AND LL_GRADE_TYPE = 'M' ) then select COUNT(DISTINCT(WORK_LOCALITY_CODE)) into travelCNT from dr_travel_details where sales_pers =ls_sales_pers and work_date =ld_work_date ; select COUNT(DISTINCT(LOCALITY_CODE)) into routeCNT from sprs_route where sprs_code =ls_sales_pers and status='Y' and LOCALITY_CODE in (select WORK_LOCALITY_CODE from dr_travel_details where sales_pers =ls_sales_pers and work_date =ld_work_date ); if ( travelCNT = routeCNT ) then select max(g.stan_type) into ls_stan_type from dr_travel_details e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.work_date = ld_work_date --and f.sprs_code = e.sales_pers_mgr and f.sprs_code = e.sales_pers --and f.route_id = e.work_route_id and f.locality_code = e.WORK_LOCALITY_CODE and g.stan_type = f.station_type and f.status = 'Y' and g.precedence = (select min(d.precedence) from dr_travel_details b, sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.work_date = e.work_date --and c.sprs_code = b.sales_pers_mgr and c.sprs_code = b.sales_pers --and c.route_id = b.work_routE_id and c.locality_code = b.WORK_LOCALITY_CODE and d.stan_type = c.station_type and c.status = 'Y'); else select min(d.precedence) into mgrprcdnc from dr_travel_details b, sprs_route c, stantype d where b.sales_pers = ls_sales_pers and b.work_date = ld_work_date --and c.sprs_code = b.sales_pers_mgr and c.sprs_code = b.sales_pers --and c.route_id = b.work_routE_id and c.locality_code = b.WORK_LOCALITY_CODE and d.stan_type = c.station_type and c.status='Y'; select min(d.precedence) into sorprcdnc from dr_travel_details b, sprs_route c, stantype d where b.sales_pers = ls_sales_pers and b.work_date = ld_work_date and c.sprs_code = b.sales_pers_mgr --and c.route_id = b.work_routE_id and c.locality_code = b.WORK_LOCALITY_CODE and d.stan_type = c.station_type; if( mgrprcdnc > 0 and sorprcdnc > mgrprcdnc) then select max(g.stan_type) into ls_stan_type from dr_travel_details e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.work_date = ld_work_date --and f.sprs_code = e.sales_pers_mgr and f.sprs_code = e.sales_pers --and f.route_id = e.work_route_id and f.locality_code = e.WORK_LOCALITY_CODE and g.stan_type = f.station_type and f.status = 'Y' and g.precedence = (select min(d.precedence) from dr_travel_details b,sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.work_date = e.work_date --and c.sprs_code = b.sales_pers_mgr and c.sprs_code = b.sales_pers --and c.route_id = b.work_routE_id and c.locality_code = b.WORK_LOCALITY_CODE and d.stan_type = c.station_type and c.status = 'Y'); else select max(g.stan_type) into ls_stan_type from dr_travel_details e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.work_date = ld_work_date and f.sprs_code = e.sales_pers_mgr --and f.route_id = e.work_route_id and f.locality_code = e.WORK_LOCALITY_CODE and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from dr_travel_details b,sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.work_date = e.work_date and c.sprs_code = b.sales_pers_mgr --and c.route_id = b.work_routE_id and c.locality_code = b.WORK_LOCALITY_CODE and d.stan_type = c.station_type); end if; end if; else select max(g.stan_type) into ls_stan_type from dr_travel_details e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.work_date = ld_work_date and f.sprs_code = e.sales_pers_mgr --and f.route_id = e.work_route_id and f.locality_code = e.WORK_LOCALITY_CODE and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from dr_travel_details b, sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.work_date = e.work_date and c.sprs_code = b.sales_pers_mgr --and c.route_id = b.work_routE_id and c.locality_code = b.WORK_LOCALITY_CODE and d.stan_type = c.station_type); end if; end if; return ls_stan_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EXPENSE_BANNER_TB force AS TABLE OF EXPENSE_BANNER_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SIGN_HISTORY (as_ref_ser VARCHAR2, as_ref_id VARCHAR2) return char is v_descr wf_prc_status.STATUS_REMARKS%type; cursor c1 is select REF_SER,REF_ID,LINE_NO,SIGN_FOR,ROLE_CODE__SIGN,SIGN_DATE, USER_ID__SIGN,SIGN_REMARKS,CERT_NO,SIGN_STATUS,TITLE, EMP_CODE,CREATE_DATE,ROLE_TYPE,ROLE_ENTITY, ENTITY_CODE,PRC_INST__WF,MSG_FRM_FNAME from obj_sign_trans where ref_ser = as_ref_ser and ref_id = as_ref_id ORDER BY LINE_NO ; /*Commnted by Brijesh Soni as Discuss with Mr. Navin paliwal where TRIM(ref_ser) = TRIM(as_ref_ser) and TRIM(ref_id) = TRIM(as_ref_id) ORDER BY LINE_NO ; */ ls_emp_name varchar2(200); ls_emp_code char(10); begin v_descr := ''; ls_emp_name := ' '; if as_ref_ser = 'T-REQ' then select nvl(b.emp_fname,'') ||' ' || nvl(b.emp_mname,'') || ' ' || nvl(b.emp_lname,'') into ls_emp_name from trequest a, employee b where a.emp_code__req = b.emp_code and tran_id = as_ref_id; /*Commnted by Brijesh Soni as Discuss with Mr. Navin paliwal and tran_id = trim(as_ref_id); */ --dbms_output.put_line('Employee Full Name For T-REQ ::::' || ls_emp_name ); elsif as_ref_ser = 'T-RAT' then select nvl(b.emp_fname,'') ||' ' || nvl(b.emp_mname,'') || ' ' || nvl(b.emp_lname,'') into ls_emp_name from tdesk_rate a, employee b where a.emp_code = b.emp_code and tran_id = as_ref_id; /*Commnted by Brijesh Soni as Discuss with Mr. Navin paliwal and tran_id = trim(as_ref_id); */ --dbms_output.put_line('Employee Full Name For T-RAT ::::' || ls_emp_name ); end if; for cdescr in c1 loop exit when c1%notfound; if as_ref_ser = 'T-REQ' then --dbms_output.put_line('Line Number for T-REQ ::::' || cdescr.LINE_NO ); if cdescr.LINE_NO = 1 then v_descr := v_descr || 'TR Request Submitted by ' || ls_emp_name ||' on ' || to_char(cdescr.create_date,'DD-MM-YYYY HH24:MI:SS'); --dbms_output.put_line('T-REQ. v_descr for Line Number 1 ::::' || v_descr ); elsif cdescr.LINE_NO = 2 then v_descr := v_descr || 'Submitted For TravelDesk Approval on ' || to_char(cdescr.create_date,'DD-MM-YYYY HH24:MI:SS'); --dbms_output.put_line('T-REQ. v_descr for Line Number 2 ::::' || v_descr ); elsif cdescr.LINE_NO = 3 then v_descr := v_descr || 'Submitted For TravelDesk Acknowledgement on ' || to_char(cdescr.create_date,'DD-MM-YYYY HH24:MI:SS'); --dbms_output.put_line('T-REQ. v_descr for Line Number 3 ::::' || v_descr ); end if; elsif as_ref_ser = 'T-RAT' then if cdescr.LINE_NO = 1 then v_descr := v_descr || 'TR Rate Approval Submitted by ' || ls_emp_name ||' on ' || to_char(cdescr.create_date,'DD-MM-YYYY HH24:MI:SS'); --dbms_output.put_line('T-RAT. v_descr for Line Number 1 ::::' || v_descr ); elsif cdescr.LINE_NO = 2 then v_descr := v_descr || 'Submitted For TravelDesk Approval on ' || to_char(cdescr.create_date,'DD-MM-YYYY HH24:MI:SS'); --dbms_output.put_line('T-RAT. v_descr for Line Number 2 ::::' || v_descr ); elsif cdescr.LINE_NO = 3 then v_descr := v_descr || 'Submitted For TravelDesk Acknowledgement on ' || to_char(cdescr.create_date,'DD-MM-YYYY HH24:MI:SS'); --dbms_output.put_line('T-RAT. v_descr for Line Number 3 ::::' || v_descr ); end if; end if; -- Required if not signed..emp_code is null but entity code is exists. --dbms_output.put_line('cdescr.emp_code ::::' || cdescr.emp_code ); if cdescr.emp_code is not null then ls_emp_code := cdescr.emp_code; --dbms_output.put_line('ls_emp_code from cdescr.emp_code ::::' || ls_emp_code); else ls_emp_code := cdescr.entity_code; --dbms_output.put_line('ls_emp_code from cdescr.entity_code ::::' || ls_emp_code ); end if; --dbms_output.put_line('Final Employee Code ::::' || ls_emp_code ); select nvl(emp_fname,'' ) ||' ' || nvl(emp_mname,'') || ' ' || nvl(emp_lname,'') into ls_emp_name from employee where emp_code = ls_emp_code; --dbms_output.put_line('Final Employee Name ::::' || ls_emp_name ); If ls_emp_name is null OR length(trim(ls_emp_name)) = 0 then ls_emp_name := ' '; end if; --dbms_output.put_line('Sign Status ::::' || cdescr.sign_status); if cdescr.sign_status ='U' then v_descr := v_descr || ' waiting for approval/acceptance by ' || ls_emp_name ; --dbms_output.put_line('v_descr for Sign Status U ::::' || v_descr ); elsif cdescr.sign_status ='S' then v_descr := v_descr || ' approved by ' || ls_emp_name || ' on ' || to_char(cdescr.sign_date,'DD-MM-YYYY HH24:MI:SS') ||'.' ; --dbms_output.put_line('v_descr for Sign Status S ::::' || v_descr ); end if; v_descr := v_descr || chr(10); --dbms_output.put_line('v_descr := v_descr || chr(10); ::::' || v_descr ); ls_emp_name := ' '; end loop; --dbms_output.put_line('Data contain into v_descr ::::' || v_descr ); If v_descr is null then v_descr := ''; --dbms_output.put_line('If v_descr is null then ::::' || v_descr ); end if; return v_descr; --dbms_output.put_line('Final String returning v_descr ::::' || v_descr ); Exception when OTHERS then return 'Error'; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEM_DESC ( AS_ITEM_CODE char) RETURN VARCHAR IS LS_VAL VARCHAR ( 200 ) ; BEGIN SELECT DESCR INTO LS_VAL FROM ITEM WHERE ITEM_CODE = AS_ITEM_CODE; RETURN LS_VAL ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EXCH_RATE_DIFF_X ON EXCH_RATE_DIFF (TRAN_ID, TRAN_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DIMENSION_QTY (as_dimension in stock.dimension%type, as_unit in item.unit%type,ac_noart in number ) return number is lc_retval number(14,3) := 0; lc_dimension number(14,3) ; li_pos number(14,0) ; ls_dimpart varchar2(30); ls_dimension stock.dimension%type; ls_delimiter char(1); lc_noart number(14,3); lc_length number(14,3) := 1; lc_width number(14,3) := 1; lc_height number(14,3) := 0; lc_counter number(3) := 0; begin ls_delimiter := 'x' ; ls_dimension := as_dimension; lc_noart := ac_noart; if lc_noart is null or lc_noart = 0 then lc_noart := 1 ; end if ; -- default value to return lc_retval := 0 ; if ls_dimension is null or length(trim(ls_dimension)) = 0 then return 0; end if ; ls_dimension := lower(ltrim(rtrim(ls_dimension))); -- remove unwanted characters like mm, cm, in, etc. select Replace(translate(trim(ls_dimension),'ABCDEFGHIJKLMNOPQRSTUVWYZ/abcdefghijklmnopqrstuvwyz-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into ls_dimension from dual; loop li_pos := nvl(instr(ls_dimension, ls_delimiter,1,1),0); if li_pos > 0 then ls_dimpart := substr(ls_dimension,1,li_pos - 1); ls_dimension := substr(ls_dimension,li_pos + 1); else ls_dimpart := ls_dimension ; ls_dimension := '' ; end if; lc_dimension := to_number(ls_dimpart) ; --if lc_dimension <> 0 then lc_counter := lc_counter + 1; --end if; if lc_counter = 1 then lc_length := lc_dimension; end if; if lc_counter = 2 then lc_width := lc_dimension; end if; if lc_counter = 3 then lc_height := lc_dimension; end if; if length(trim(ls_dimension)) = 0 then exit ; end if ; if lc_counter >= 3 then exit; end if; end loop; if as_unit = 'CFT' then lc_retval := (lc_length * lc_width * lc_height * lc_noart) / 144 ; elsif as_unit = 'SQM' then lc_retval := ( lc_length * lc_width) * lc_noart; else lc_retval := 0; end if; return lc_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_QCORDER_CONSISTENCY BEFORE INSERT OR UPDATE OF status ON qc_order referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_qccount number(3) := 0; ll_count number(6) := 0; lc_effqty number(14,3) := 0; BEGIN if :new.status = 'C' then begin select count(1) into ll_qccount from qc_order s, item i where s.item_code = i.item_code and s.qorder_no = :new.qorder_no and i.stk_opt <> '0'; exception when others then ll_qccount := 0; end; begin select count(1),sum(eff_qty) into ll_invcount, lc_effqty from invtrace where ref_ser in ( 'S-ISS','QC-ORD' ) and ref_id = :new.qorder_no; exception when others then ll_invcount := 0; end; if ll_qccount > 0 and (ll_invcount <= 0 or lc_effqty <> 0 ) then raise_application_error( -20601, 'Invtrace not updated for all the details'); end if; if ll_qccount > 0 and :new.QTY_SAMPLE > 0 then begin select count(1) into ll_count from invtrace where ref_ser = 'S-ISS' and ref_id = :new.qorder_no; exception when others then ll_count := 0; end; if ll_count = 0 then raise_application_error( -20601, 'Invtrace not updated for sample quantity [' || to_char(:new.QTY_SAMPLE) ||']'); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_NOOFDAYS_REP ( as_sales_pers in char, as_month_fr in char, as_month_to in char, as_year in char) return number is as_noofdays number(14); begin select count(dt) - count(CASE WHEN trim(day)='SUNDAY' THEN 1 ELSE NULL END) - count(CASE WHEN trim(hol_type)='H'THEN 1 ELSE NULL END) as NoOfDays into as_noofdays from ( select distinct sales_pers,dt,day,month_no AS month,year from sales_pers cross join sfa_time Where sales_pers = as_sales_pers AND DT between trunc(to_date(as_month_fr||as_year,'MONYYYY'),'MON') and last_day(to_date(as_month_to||as_year,'MONYYYY')) ) A inner join employee e on a.sales_pers = e.emp_code left join holiday h on e.hol_tblno = h.hol_tblno and a.dt = h.hol_date Where sales_pers = as_sales_pers AND DT between trunc(to_date(as_month_fr||as_year,'MONYYYY'),'MON') and last_day(to_date(as_month_to||as_year,'MONYYYY')); return as_noofdays; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_SORD_QTYRATE BEFORE insert or update ON sorddet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; BEGIN if round(nvl(:new.quantity,0) * nvl(:new.conv__qty_stduom,1),3) <> round(nvl(:new.quantity__stduom,0),3) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] x conv__qty_stduom [' || to_char(:new.conv__qty_stduom) || '] not matching with quantity__stduom['||to_char(:new.quantity__stduom)|| ']' ); end if; if round(nvl(:new.rate,0) * nvl(:new.CONV__RTUOM_STDUOM,1),6) <> round(nvl(:new.RATE__STDUOM,0),6) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] rate [' || to_char(:new.rate) || '] x CONV__RTUOM_STDUOM [' || to_char(:new.CONV__RTUOM_STDUOM) || '] not matching with RATE__STDUOM['||to_char(:new.RATE__STDUOM)|| ']' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RCPDISHNR_RECEIPT ON RCPDISHNR (TRAN_SER, RECEIPT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_PACK_ORDER_NO ON INV_PACK (ORDER_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ITEM_DESCR (as_itemcode in item.item_code%type) return varchar2 is ls_itemdescr item.descr%type; begin select descr into ls_itemdescr from item where item_code = as_itemcode; return ls_itemdescr ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROF_WSHEET_MSTDET_SLAP_X ON PROF_WSHEET_MSTDET_SLAB (HIER_KEY, LINE_NO, LINE_NO__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SER_REQ_FEEDBK_ITEM_X ON SER_REQ_FEEDBK_ITEM (FEEDBK_ID, LINE_NO, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MSG_SPECS (as_custcode in char, as_itemcode in char) return varchar2 is ls_retval varchar2(500); begin select nvl(msg_specs,' ') into ls_retval from customeritem where cust_code = as_custcode and item_code = as_itemcode; if ls_retval is null then ls_retval := ' '; end if; return nvl(ls_retval,' ') ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SPELL (val number) return char is sp varchar2(100); begin if val > 0 then return (initcap(to_char(to_date(val,'J'),'JSP'))); else return(''); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAV_COUP_BAL_X ON TRAV_COUP_BAL (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_HIERARCY_NIGEL (as_emp_code varchar,as_report_to varchar) return char is V_emp_code varchar(15); begin SELECT emp_code into V_emp_code FROM employee WHERE EMP_CODE='62057'; return V_emp_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PICK_MAX_ITEM_RATE (as_item_code in item.item_code%type) return number is mrate number(14,3); begin begin select max(rate) into mrate from pricelist where item_code = as_item_code and eff_from <= to_date(sysdate) and valid_upto >= to_date(sysdate); exception when others then mrate := 0; end; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MRP_PRICELIST return varchar2 is ls_pricelist varchar2(10); begin begin select var_value into ls_pricelist from mfgparm where prd_code = '999999' and var_name = 'MRP_PRICELIST' ; exception when no_data_found then ls_pricelist := ' ' ; end; return ls_pricelist; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_CCTR_GRADE_QV (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, lavailable in char, lcctr_code in char, lgetQV in char, as_grade in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select sum(qty) into ld_eff_qty from ( select decode(lgetQV,'Q',nvl(( (nvl(a.eff_qty,0)) ),0), nvl( ((nvl(a.eff_qty,0) * nvl(a.rate,0) ) ),0) ) qty from invtrace a, invstat c, stock d , location e where e.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.grade = d.grade and a.loc_code = e.loc_code and a.ref_ser not in ('QC-ORD','I-PKI','I-PKR') and d.grade = as_grade and a.item_code = litem_code and a.site_code = lsite_code and d.cctr_code__inv = lcctr_code and a.tran_date <= ad_from_date and instr(lavailable,c.available) > 0 ); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER INVOICE_AFTER_INS_UPD AFTER UPDATE of confirmed ON INVOICE FOR EACH ROW DECLARE CONFVAL CHAR(1); REFCOUNT NUMBER(10,2) DEFAULT 0; BEGIN SELECT COUNT(REF_ID) INTO REFCOUNT FROM DWH_TRAN_LOAD WHERE REF_ID=:NEW.INVOICE_ID AND REF_SER='S-INV' ;--AND REF_DATE=:NEW.TRAN_DATE AND UPDATE_STAT='P' ; CONFVAL:=:NEW.CONFIRMED; IF(CONFVAL = 'Y') THEN -- Insert record into DWH_TRAN_LOAD table INSERT INTO DWH_TRAN_LOAD ( REF_ID, REF_SER, REF_DATE, UPDATE_STAT ) VALUES ( :NEW.INVOICE_ID, 'S-INV', :NEW.TRAN_DATE, 'P' ); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_CLOSEREF BEFORE insert or UPDATE of status ON porddet FOR EACH ROW declare ls_invacct finparm.var_value%type; ls_refser char(6); BEGIN if :new.status = 'C' and :old.status <> 'C' and (:new.REF_ID__CLOSE is null or :new.CLOSE_PO is null) then raise_application_error( -20601, 'order detail status is updated as C (Closed) but reference id closing is null'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MAX_DATE_RATE (ls_price_list in char, ls_item_code in char) return number is lc_rate number(14,3); ls_lot_from char(15); begin select lot_no__from into ls_lot_from from pricelist where price_list = ls_price_list and item_code = ls_item_code and eff_from = (select max(eff_from) from pricelist where price_list = ls_price_list and item_code = ls_item_code ) and valid_upto >= sysdate; select rate into lc_rate from pricelist where price_list = ls_price_list and item_code = ls_item_code and lot_no__from <= ls_lot_from and lot_no__to >= ls_lot_from and list_type = 'B'; return lc_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_EXCISE_TAX_CLASS (as_tran_id IN VARCHAR2, as_tYPE IN VARCHAR2) RETURN VARCHAR2 IS AS_VALUE VARCHAR2(100); ls_tax_class VARCHAR2(100); BEGIN IF as_type = 'D' THEN select tax_class into ls_tax_class from sorddet where sale_order = as_tran_id and line_no = (select min(line_no) from sorddet where sale_order = as_tran_id); ELSIF as_type = 'T' THEN select tax_class into ls_tax_class from distord_issdet where tran_id = as_tran_id and line_no = (select min(line_no) from distord_issdet where tran_id = as_tran_id); END IF ; select sh_descr into AS_VALUE from taxclass where tax_class = ls_tax_class; return trim(AS_VALUE) ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_INV_LOCK ON INV_LOCK (LOCK_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROCESS_TEMPLATE_X ON PROCESS_TEMPLATE (PROC_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INDENT_SITE_ITEM_STATUS ON INDENT (SITE_CODE, ITEM_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RECEIPT_QTY (lpurc_order in char,ldate_to in date, lsite_code in char,litem_code in char) return number is lc_qty number(14,3); begin SELECT SUM(nvl(PORCPDET.QUANTITY,0)) into lc_qty FROM PORCPDET ,PORCP WHERE PORCPDET.PURC_ORDER = PORCP.PURC_ORDER and PORCPDET.PURC_ORDER = lpurc_order AND PORCPDET.ITEM_CODE = litem_code AND PORCP.TRAN_DATE <= ldate_to and PORCP.SITE_CODE = lsite_code AND PORCP.CONFIRMED = 'Y' AND PORCP.STATUS <> 'X' ; Return nvl(lc_qty,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKOPTION ( p_geo_fence_enable IN VARCHAR2, -- (1.GEO_FENCE_ENABLE) p_geo_fence_option IN CHAR -- (1.GEO_FENCE_OPTION) ) RETURN NUMBER IS -- Object Name: UGM_manage_users_geofence -- Event Type: field_validation -- Form Number: 1 -- Field Name: GEO_FENCE_OPTION -- Business Logic: Return 0 if GEO_FENCE_ENABLE = '2' and GEO_FENCE_OPTION is NULL or empty -- Function Name: CHECKOPTION v_result NUMBER := 1; -- Default to valid BEGIN -- Check if GEO_FENCE_ENABLE is '2' IF NVL(TRIM(p_geo_fence_enable), '') = '2' THEN -- If GEO_FENCE_OPTION is NULL or empty, set result to 0 IF NVL(TRIM(p_geo_fence_option), '') IS NULL THEN v_result := 0; END IF; END IF; RETURN v_result; -- Return the validation result EXCEPTION WHEN OTHERS THEN -- Handle any unexpected errors RETURN 0; END CHECKOPTION; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALE_TERM_TABLE_X ON SALE_TERM_TABLE (TERM_TABLE, TERM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_QV (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char, as_qtyvalue in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then select sum(qty) into ld_eff_qty from (SELECT decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 union all select nvl( decode(as_qtyvalue,'Q', (sum(eff_qty) * -1),sum(eff_qty * nvl(rate,0)) * -1 ) ,0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then select sum(qty) into ld_eff_qty from (select decode(as_qtyvalue,'Q',sum(a.quantity),sum(a.quantity * nvl(a.rate,0))) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 union all select nvl( decode(as_qtyvalue,'Q',sum(eff_qty) * -1,sum(eff_qty * nvl(rate,0)) * -1) ,0) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_REFERNCE_DET (as_sundrytype in char,as_sundrycode in char,as_refser in char,as_refid in varchar2) RETURN VARCHAR2 IS as_name varchar2(300); ls_sundry_name varchar(500); ls_sundry char(12); ls_sundrytype char(1); ls_sundrycode char(14); ls_name VARCHAR2(300); begin ------------ get type and code-------------- if as_sundrytype='O' then ls_sundry := fn_rget_sundrytype_new(as_sundrytype,as_sundrycode,as_refid,as_refser); ls_sundrytype := substr(ls_sundry,1,1); ls_sundrycode := substr(ls_sundry,2,length(ls_sundry)); else ls_sundrytype := as_sundrytype; ls_sundrycode := as_sundrycode; end if; -----------get party name from type and code if ls_sundrytype = 'B' then select bank_name into ls_sundry_name from bank where bank_code = ls_sundrycode; elsif ls_sundrytype = 'C' then select cust_name into ls_sundry_name from customer where cust_code = ls_sundrycode; elsif ls_sundrytype = 'E' then select nvl(emp_fname,'')||' '||nvl(emp_lname,'') into ls_sundry_name from employee where emp_code = ls_sundrycode; elsif ls_sundrytype = 'L' then select party_name into ls_sundry_name from loanparty where party_code = ls_sundrycode; elsif ls_sundrytype = 'P' then select sp_name into ls_sundry_name from sales_pers where sales_pers = ls_sundrycode; elsif ls_sundrytype = 'R' then select nvl(trim(rtrim(first_name)),' ')||' '||nvl(trim(rtrim(middle_name)),' ') ||' '||nvl(trim(rtrim(last_name)),' ') into ls_sundry_name from strg_customer where sc_code = ls_sundrycode; elsif ls_sundrytype = 'S' then select supp_name into ls_sundry_name from supplier where supp_code = ls_sundrycode; elsif ls_sundrytype = 'T' then select tran_name into ls_sundry_name from transporter where tran_code = ls_sundrycode; elsif ls_sundrytype = 'X' then select tauth_name into ls_sundry_name from tax_authority where tauth_code = ls_sundrycode; end if; --------------append with series if as_refser LIKE 'P-IB%' then select LISTAGG(TRIM(pay_ibca_det.ref_ser||' - '|| pay_ibca_det.ref_no||' - '||pay_ibca_det.sundry_code ||' - '||'bill'||' - '||misc_payables.bill_no ),', ') WITHIN GROUP (ORDER BY pay_ibca_det.TRAN_ID) into ls_name from pay_ibca_det left outer join misc_payables on pay_ibca_det.ref_ser=misc_payables.tran_ser AND pay_ibca_det.ref_no=misc_payables.ref_no where pay_ibca_det.tran_id = substr(as_refid,1,10) and rownum<=5; end if; if as_refser LIKE 'R-IB%' then select LISTAGG(TRIM(ref_ser||' - '|| ref_no||' - '||cust_code),', ') WITHIN GROUP (ORDER BY rcp_ibca_det.TRAN_ID) into ls_name from rcp_ibca_det where rcp_ibca_det.tran_id = substr(as_refid,1,10) and rownum<=5; end if; if as_refser = 'D-ISS ' then select distord_iss.dist_order ||' - '|| distord_iss.site_code__dlv ||' - '|| site.descr into ls_name from distord_iss,site where distord_iss.site_code__dlv = site.site_code and distord_iss.tran_id = substr(as_refid,1,10); end if; if as_refser ='D-RCP ' then select distord_rcp.dist_order ||' - '|| distord_rcp.site_code__ship ||' - '|| site.descr into ls_name from distord_rcp,site where distord_rcp.site_code__ship = site.site_code and distord_rcp.tran_id = substr(as_refid,1,10); end if; if as_refser = 'ADJISS' then select adj_issrcp.order_id || ' - ' || nvl((select descr from gencodes where fld_name='REAS_CODE' and mod_name='W_ADJ_ISS' and fld_value=adj_issrcp.reas_code),'') into ls_name from adj_issrcp where adj_issrcp.tran_id = substr(as_refid,1,10); end if; if as_refser ='E-PAY ' then select nvl(bank.sh_name,'')|| ' - ' || nvl(trim(payment_exp.ref_no),'')|| ' - ' || nvl(to_char(payment_exp.ref_date),'') into ls_name from payment_exp, bank where payment_exp.tran_id = substr(as_refid,1,10) and payment_exp.bank_code = BANK.BANK_CODE ; end if; if as_refser ='JOUR ' then select nvl(journal.ref_ser,'') || ' - ' || nvl(trim(journal.ref_no),'') || ' - ' || nvl(journal.reversible,'') || ' - ' || nvl(to_char(case when journal.reversible='Y' then journal.rev_date end),'') as rev_date into ls_name from journal where tran_id = substr(as_refid,1,10); end if; if as_refser ='P-RCP ' then select 'PO No. : '|| nvl(porcp.purc_order,'') || ' - ' || nvl(porcp.supp_code,'') || ' - ' || nvl(supplier.supp_name,'') into ls_name from porcp,supplier where supplier.supp_code = porcp.supp_code and porcp.tran_id = substr(as_refid,1,10); end if; if as_refser ='P-RET ' then select 'PO No. : '|| nvl(porcp.purc_order,'') || ' GRN No. : ' || nvl(porcp.tran_id,'') || ' - ' || nvl(porcp.supp_code,'') || ' - ' || nvl(supplier.supp_name,'') into ls_name from porcp,supplier where supplier.supp_code = porcp.supp_code and porcp.tran_id = substr(as_refid,1,10); end if; if as_refser ='QC-ORD' then SELECT 'GRN No. : '|| nvl(qc_order.porcp_no ,'') || ' PO No. : ' || nvl(porcp.purc_order ,'') ||' - '|| nvl(qc_order.supp_code,'') ||' - '|| nvl(supplier.supp_name,'') into ls_name from qc_order left outer join porcp on porcp.tran_id = qc_order.porcp_no left outer join supplier on supplier.supp_code = qc_order.supp_code where porcp.tran_ser='P-RCP' and qc_order.qorder_no = substr(as_refid,1,10); end if; if as_refser ='S-DSP ' then select nvl(despatch.sord_no,'')|| ' - ' || nvl(sorder.cust_pord,'')|| ' - ' || nvl(to_char(sorder.pord_date ),'')|| ' - ' || customer.cust_name into ls_name from despatch inner join customer on customer.cust_code = despatch.cust_code left outer join sorder on despatch.sord_no = sorder.sale_order where despatch.desp_id = substr(as_refid,1,10); end if; if as_refser ='S-RET ' then select nvl(sreturn.invoice_id,'') || ' - ' || nvl(sreturn.cust_code,'') || ' - ' || customer.cust_name into ls_name from sreturn,customer where customer.cust_code = sreturn.cust_code and sreturn.tran_id = substr(as_refid,1,10); end if; if as_refser = 'W-IRTN' then select workorder_iss.tran_id|| ' - ' || item.descr|| ' - ' || workorder.lot_no into ls_name from workorder_iss inner join workorder on workorder_iss.work_order = workorder.work_order left outer join item on workorder.item_code = item.item_code where workorder_iss.tran_id = substr(as_refid,1,10); end if; if as_refser = 'W-ISS ' then select workorder_iss.work_order || ' - ' ||workorder.item_code || ' - ' ||item.descr || ' - ' ||trim(workorder.lot_no) || ' - ' ||workorder_iss.operation into ls_name from workorder_iss inner join workorder on workorder_iss.work_order = workorder.work_order left outer join item on workorder.item_code = item.item_code where workorder_iss.tran_id = substr(as_refid,1,10); end if; if as_refser = 'W-RCP ' then select workorder_receipt.tran_id|| ' - ' || workorder.item_code|| ' - ' || item.descr|| ' - ' || workorder.lot_no into ls_name from workorder_receipt inner join workorder on workorder_receipt.work_order = workorder.work_order left outer join item on workorder.item_code = item.item_code where workorder_receipt.tran_id = substr(as_refid,1,10); end if; if as_refser='F-XFR ' then select bank_frm.sh_name || ' - ' || bank_to.sh_name || ' - ' || xfr_mode || ' - ' || nvl(trim(ref_no),'') || ' - ' || nvl(to_char(ref_date),'') into ls_name from fundtransfer, bank bank_frm ,bank bank_to where fundtransfer.tran_id = substr(as_refid,1,10) and fundtransfer.bank_code__from = bank_frm.bank_code and fundtransfer.bank_code__to = bank_to.bank_code ; end if; if as_refser='R-DIS ' then select rcpdishnr.receipt_no|| ' - ' || (receipt.cust_bank_ref)|| ' - ' || nvl(trim(rcpdishnr.ref_no),'')|| ' - ' || rcpdishnr.ref_date || ' - ' || rcpdishnr.cust_code || ' - ' || customer.cust_name into ls_name from rcpdishnr inner join customer on customer.cust_code = rcpdishnr.cust_code left outer join receipt on receipt.tran_id = rcpdishnr.receipt_no where rcpdishnr.tran_id = substr(as_refid,1,10); end if; if as_refser = 'RCP ' then select bank.sh_name || ' - ' || nvl(receipt.cust_bank_ref,'')|| ' - ' || customer.cust_name || ' - ' || (case when receipt.rcp_mode='Q' then 'Cheque' when receipt.rcp_mode='D' then 'Draft' when receipt.rcp_mode='C' then 'Cash' when receipt.rcp_mode='P' then 'Pay Order' when receipt.rcp_mode='E' then 'Electronic' when receipt.rcp_mode='R' then 'Credit Card' when receipt.rcp_mode='Y' then 'Payment Advice' end) || ' - ' || trim(receipt.ref_no) || ' - ' || nvl(to_char(receipt.ref_date) ,'') || ' Agst : ' || listagg(trim(rcpdet.ref_no),', ') within group (order by rcpdet.tran_id) into ls_name from receipt,rcpdet,customer, bank where receipt.tran_id = rcpdet.tran_id and customer.cust_code = receipt.cust_code and receipt.tran_id = substr(as_refid,1,10) and receipt.bank_code = BANK.BANK_CODE and rownum<=5 group by bank.sh_name, receipt.cust_bank_ref, receipt.rcp_mode, receipt.ref_no, to_char(receipt.ref_date), customer.cust_name; end if; if as_refser = 'S-INV ' then select nvl(invoice.sale_order,'') || ' - ' || invoice.cust_code || ' - ' || customer.cust_name || ' - ' || nvl(sorder.cust_pord,'')|| ' - ' || nvl(to_char(sorder.pord_date ),'') into ls_name from invoice inner join customer on customer.cust_code = invoice.cust_code left outer join sorder on invoice.sale_order = sorder.sale_order where invoice.invoice_id = substr(as_refid,1,10); end if; if as_refser = 'VOUCH ' then select voucher.purc_order || ' - ' || nvl(voucher.bill_no,'')|| ' - ' || nvl(to_char(voucher.bill_date),'') || ' - ' || voucher.supp_code || ' - ' || supplier.supp_name into ls_name from voucher,supplier where supplier.supp_code = voucher.supp_code and voucher.tran_id = substr(as_refid,1,10); end if; if as_refser = 'CRNRCP' then select nvl(drcr_rcp.sreturn_no,'') || ' - ' || nvl(sreturn.cust_ref,drcr_rcp.cust_ref_no) || ' - ' || nvl(sreturn.claim_date,drcr_rcp.cust_ref_date) || ' - ' || sreturn.cust_code || ' - ' || customer.cust_name || ' - ' || nvl((select descr from gencodes where fld_name='REAS_CODE' and mod_name='W_SALESRETURN' and fld_value=sreturn.reas_code),'') into ls_name from drcr_rcp left outer join sreturn on sreturn.tran_id = drcr_rcp.sreturn_no inner join customer on customer.cust_code = sreturn.cust_code where drcr_rcp.tran_id = substr(as_refid,1,10); end if; if as_refser = 'DRNRCP' then select nvl(drcr_rcp.cust_ref_no,'') || ' - ' || nvl(to_char(drcr_rcp.cust_ref_date),'') || ' - ' || NVL((SELECT DESCR FROM GENCODES WHERE FLD_NAME='REAS_CODE' AND MOD_NAME='W_DRCRRCP_DR' AND FLD_VALUE = DRCR_RDET.REAS_CODE AND ROWNUM=1),'') INTO LS_NAME FROM DRCR_RCP,DRCR_RDET WHERE DRCR_RCP.TRAN_ID = DRCR_RDET.TRAN_ID AND DRCR_RCP.TRAN_ID = SUBSTR(as_refid,1,10) AND DRCR_RDET.reas_code is not null and rownum = 1 ; ---Added by Aditya 05-08-2024 end if; if as_refser = 'P-VOUC' then select payr_voucher.emp_code || ' - ' || employee.emp_fname || ' - ' ||nvl(employee.emp_mname,'') || ' - ' || nvl(employee.emp_lname,'') into ls_name from payr_voucher,employee where employee.emp_code = payr_voucher.emp_code and payr_voucher.tran_id = substr(as_refid,1,10); end if; if as_refser = 'M-PAY ' then select ls_sundrycode ||'-'|| ls_sundry_name || ' - ' || nvl(trim(misc_payment.ref_no),'') || ' - ' || 'Agst : ' || listagg(trim(misc_paydet.vouch_no),', ') within group (order by misc_paydet.tran_id) into ls_name from misc_payment inner join misc_paydet on misc_payment.tran_id = misc_paydet.tran_id where misc_payment.tran_id = substr(as_refid,1,10) and rownum <=5 group by misc_payment.ref_no; end if; if as_refser = 'M-RCP ' then select ls_sundrycode ||'-'|| ls_sundry_name || ' - ' || bank.sh_name || ' - ' || nvl(misc_receipt.party_bank_ref,'') || ' - ' || (case when misc_receipt.rcp_mode='Q' then 'Cheque' when misc_receipt.rcp_mode='D' then 'Draft' when misc_receipt.rcp_mode='C' then 'Cash' when misc_receipt.rcp_mode='P' then 'Pay Order' when misc_receipt.rcp_mode='E' then 'Electronic' when misc_receipt.rcp_mode='R' then 'Credit Card' when misc_receipt.rcp_mode='Y' then 'Payment Advice' end) || ' - ' || nvl(trim(misc_receipt.ref_no),'')|| ' - ' || nvl(to_char(misc_receipt.ref_date),'') into ls_name from misc_receipt , bank where misc_receipt.tran_id = substr(as_refid,1,10) and misc_receipt.bank_code = BANK.BANK_CODE; end if; if as_refser = 'M-VOUC' then select ls_sundrycode ||'-'|| ls_sundry_name || ' - ' || nvl(bill_no,'')|| ' - ' ||bill_date|| ' - ' ||nvl(supp_bill_amt,0) into ls_name from misc_voucher where misc_voucher.tran_id = substr(as_refid,1,10); end if; if as_refser = 'MDRCRC' then select ls_sundrycode ||'-'|| ls_sundry_name || ' - ' || nvl(misc_drcr_rcp.sreturn_no,'')|| ' - ' || nvl(sreturn.cust_ref,misc_drcr_rcp.cust_ref_no) || ' - ' || nvl(sreturn.claim_date,misc_drcr_rcp.cust_ref_date) into ls_name from misc_drcr_rcp left outer join sreturn on sreturn.tran_id=misc_drcr_rcp.sreturn_no where misc_drcr_rcp.tran_id = substr(as_refid,1,10); end if; if as_refser = 'MDRCRD' then select ls_sundrycode ||'-'|| ls_sundry_name || ' - ' || nvl(cust_ref_no,'')|| ' - ' ||cust_ref_date INTO ls_name from misc_drcr_rcp where misc_drcr_rcp.tran_id = substr(as_refid,1,10); end if; if as_refser = 'MPCANC' then select ls_sundrycode ||'-'|| ls_sundry_name || ' - ' || payment_no|| ' - ' ||bank_code|| ' - ' || nvl(trim(ref_no),'')|| ' - ' || nvl(to_char(ref_date),'') into ls_name from misc_payment_canc where misc_payment_canc.tran_id = substr(as_refid,1,10); end if; as_name := substr(ls_name,1,100); return as_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PALLE_NO_X ON PALLET_NO (PALLET_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BATCH_SIZE (as_site varchar2, as_bom varchar2 ) return number is as_batchqty number(12,3) ; begin select sum(batch_qty) into as_batchqty from bom where bom_code in (select bom_code from siteitem where site_code = as_site AND SUPP_SOUR ='M' and bom_code is not null and item_code in (select item_code from bomdet where bomdet.bom_code = as_bom and bomdet.bom_code is not null) ) ; return as_batchqty; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_DRUG_LIC_DATE (as_var_name char , as_fin_ent char, as_site_code char) return date is mreg_date date; mvar_value char (25); merrcode char (100); begin select var_value into mvar_value from disparm where prd_code = '999999' and var_name = as_var_name; select reg_date into mreg_date from siteregno where fin_entity = as_fin_ent and site_code = as_site_code and ref_code = mvar_value; return mreg_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EDI_OPTION (ls_winname in char) return char is ls_edi_option char(1); begin select edi_option into ls_edi_option from transetup where tran_window = ls_winname; return (ls_edi_option ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EFF_COST_TRAN (MTRANID IN CHAR, MITEMCODE IN CHAR) /* By Ramesh for MRH Monitoring */ RETURN NUMBER IS MEFFCOST NUMBER(10,2); EFF_COST NUMBER(14,3) := 0; CTR NUMBER := 0; BEGIN SELECT NVL(ROUND(SUM((QUANTITY*RATE)-DISCOUNT)/SUM(QUANTITY),3),0) INTO MEFFCOST FROM INVOICE_TRACE WHERE INVOICE_ID = MTRANID AND ITEM_CODE = MITEMCODE; RETURN MEFFCOST; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAY_IBCA_TRAN_ID__ISS ON PAY_IBCA (TRAN_SER, TRAN_ID__ISS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_DEPENDENT_TASKS (VI_REF_SER IN CHAR ,VI_REF_Id IN VARCHAR) RETURN VARCHAR2 IS DEPENDENT_TASKS VARCHAR2(1500); dependentReplTasks varchar2(1500); dependentPickTasks varchar2(1500); flagRepl BOOLEAN := false; flagPick BOOLEAN := false; cursor C1 is SELECT distinct(nvl(repl_ord_det.repl_order,' ')) as DEPENDENT_REPL_TASKS1 from repl_ord_det where repl_ord_det.pick_order = VI_REF_Id; cursor C2 is SELECT distinct(nvl(pick_ord_det.pick_order,' ')) as DEPENDENT_PICK_TASKS1 from pick_ord_det where pick_ord_det.repl_order = VI_REF_Id; BEGIN IF(VI_REF_SER = 'P-PICK' OR VI_REF_SER = 'C-PICK' OR VI_REF_SER = 'A-PICK' OR VI_REF_SER = 'M-PICK') THEN DEPENDENT_TASKS :=' '; RETURN DEPENDENT_TASKS; ELSIF(VI_REF_SER = 'R-TASK' OR VI_REF_SER = 'RP-PND' OR VI_REF_SER = 'R-CPA' OR VI_REF_SER = 'R-PND' OR VI_REF_SER = 'S-DOC' OR VI_REF_SER = 'RP-ACT' OR VI_REF_SER = 'RR-DSA' OR VI_REF_SER = 'RD-DSA' OR VI_REF_SER = 'R-DSO' OR VI_REF_SER = 'RS-DSO' OR VI_REF_SER = 'RN-DSA') THEN --FOR depend REPL FOR depTaskRepl in C1 LOOP IF(flagRepl) Then dependentReplTasks :=dependentReplTasks || ',' || depTaskRepl.DEPENDENT_REPL_TASKS1; ELSE dependentReplTasks := depTaskRepl.DEPENDENT_REPL_TASKS1; flagRepl:=true; End IF; END LOOP; --FOR depend PICK FOR depTaskPick in C2 LOOP IF(flagPick) Then dependentPickTasks :=dependentPickTasks || ',' || depTaskPick.DEPENDENT_PICK_TASKS1; ELSE dependentPickTasks := depTaskPick.DEPENDENT_PICK_TASKS1; flagPick:=true; End IF; END LOOP; --CONCATENATE LOGIC IF(flagPick) THEN IF(flagRepl) THEN DEPENDENT_TASKS :=dependentReplTasks || ',' || dependentPickTasks; ELSE DEPENDENT_TASKS := dependentPickTasks; End IF; ELSE IF(flagRepl) THEN DEPENDENT_TASKS := dependentReplTasks; End IF; End IF; RETURN DEPENDENT_TASKS; ELSE DEPENDENT_TASKS := ' '; RETURN DEPENDENT_TASKS; End IF; EXCEPTION WHEN NO_DATA_FOUND THEN DEPENDENT_TASKS :=' '; RETURN DEPENDENT_TASKS; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RCP_IBCA_DATE_SITE_CODE_FROM ON RCP_IBCA (TRAN_DATE, SITE_CODE__FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GRP_SGRP_DESCR (ls_code in char, ls_option in char) return char is ls_descr char(120); begin if ls_option = 'G' then select nvl(descr,' ') into ls_descr from gencodes where fld_name = 'GRP_CODE' and ltrim(rtrim(fld_value)) = ltrim(rtrim(ls_code)) and rownum = 1; else select nvl(descr, ' ') into ls_descr from gencodes where fld_name = 'SGRP_CODE' and ltrim(rtrim(fld_value)) = ltrim(rtrim(ls_code)) and rownum = 1; end if; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSUND_SHNAME_GL ( as_sundrytype IN CHAR, as_sundrycode IN CHAR, as_refser IN CHAR, as_refid IN CHAR, cheque_or_name IN CHAR) RETURN VARCHAR IS ls_name VARCHAR2(5000); ls_sundry VARCHAR2(5000); ls_sundrytype VARCHAR2(5000); ls_sundrycode VARCHAR2(5000); BEGIN IF trim(as_sundrytype) = 'O' THEN ls_sundry := fn_rget_sundrytype(as_sundrytype,as_sundrycode,as_refid,as_refser) ; ls_sundrytype := SUBSTR(ls_sundry,1,1); ls_sundrycode := trim(SUBSTR(ls_sundry,2,LENGTH(ls_sundry))); ELSE ls_sundrytype := as_sundrytype; ls_sundrycode := as_sundrycode; END IF; IF trim(ls_sundrytype) = 'O' THEN ls_name := ' '; END IF; IF trim(ls_sundrytype) = 'T' THEN BEGIN IF cheque_or_name = 'C' THEN SELECT chq_name INTO ls_name FROM transporter WHERE tran_code = ls_sundrycode; ELSE SELECT DECODE( sh_name, NULL, SUBSTR(tran_name,1,50), ' ', SUBSTR(tran_name,1,50), sh_name) INTO ls_name FROM transporter WHERE tran_code = ls_sundrycode; END IF; END; END IF; IF trim(ls_sundrytype) = 'B' THEN BEGIN SELECT DECODE( sh_name, NULL, SUBSTR(bank_name,1,50), ' ', SUBSTR(bank_name,1,50), sh_name ) INTO ls_name FROM bank WHERE bank_code = ls_sundrycode; END; END IF; IF trim(ls_sundrytype) = 'X' THEN BEGIN SELECT DECODE( sh_name, NULL, SUBSTR(tauth_name,1,50), ' ', SUBSTR(tauth_name,1,50), sh_name ) INTO ls_name FROM tax_authority WHERE tauth_code = ls_sundrycode; END; END IF; IF trim(ls_sundrytype) = 'E' THEN BEGIN SELECT DECODE( short_name, NULL, SUBSTR( NVL(emp_fname,'') ||NVL(emp_lname,''), 1, 50 ), ' ', SUBSTR( NVL(emp_fname,'') ||NVL(emp_lname,''), 1, 50 ), short_name ) INTO ls_name FROM employee WHERE emp_code = ls_sundrycode; END; END IF; IF trim(ls_sundrytype) = 'P' THEN BEGIN IF cheque_or_name = 'C' THEN SELECT chq_name INTO ls_name FROM sales_pers WHERE sales_pers = ls_sundrycode; ELSE SELECT DECODE( sh_name, NULL, SUBSTR(sp_name,1,50), ' ', SUBSTR(sp_name,1,50), sh_name ) INTO ls_name FROM sales_pers WHERE sales_pers = ls_sundrycode; END IF; END; END IF; IF trim(ls_sundrytype) = 'S' THEN BEGIN IF cheque_or_name = 'C' THEN SELECT chq_name INTO ls_name FROM supplier WHERE supp_code = ls_sundrycode; ELSE SELECT DECODE( sh_name, NULL, SUBSTR(supp_name,1,50), ' ', SUBSTR(supp_name,1,50), sh_name ) INTO ls_name FROM supplier WHERE supp_code = ls_sundrycode; END IF; END; END IF; IF trim(ls_sundrytype) = 'C' THEN BEGIN IF cheque_or_name = 'C' THEN SELECT chq_name INTO ls_name FROM customer WHERE cust_code = ls_sundrycode; ELSE SELECT DECODE( sh_name, NULL, SUBSTR( cust_name, 1, 50 ), ' ', SUBSTR( cust_name, 1, 50 ), sh_name ) INTO ls_name FROM customer WHERE cust_code = ls_sundrycode; END IF; END; END IF; IF trim(ls_sundrytype) = 'L' THEN BEGIN IF cheque_or_name = 'C' THEN SELECT chq_name INTO ls_name FROM loanparty WHERE party_code = ls_sundrycode; ELSE SELECT DECODE( sh_name, NULL, SUBSTR(party_name,1,50), ' ', SUBSTR(party_name,1,50), sh_name ) INTO ls_name FROM loanparty WHERE party_code = ls_sundrycode; END IF; END; END IF; IF trim(ls_sundrytype) = 'R' THEN BEGIN IF cheque_or_name = 'C' THEN SELECT chq_name INTO ls_name FROM customer WHERE cust_code = (SELECT cust_code FROM strg_customer WHERE sc_code = ls_sundrycode ); ELSE SELECT SUBSTR( NVL(first_name,''), 1, 50 ) INTO ls_name FROM strg_customer WHERE sc_code = ls_sundrycode; END IF; END; END IF; RETURN ls_name; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_REFNO ON MISC_PAYABLES (TRAN_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SERIAL_NO_GEN (as_item_Code in char,as_lot_no in char,as_lot_sl in char) return number is ls_result number(1); ls_count number(1); ls_item_code char(10); ls_lot_no CHAR(15); ls_lot_sl CHAR(15); ls_site_code CHAR(5); ls_loc_code CHAR(8); ls_quantity number(14,3); ls_INV_SRNO_REQD CHAR(1); begin ls_count:=0; ls_result:=1; begin select nvl(INV_SRNO_REQD,'N') into ls_INV_SRNO_REQD from item where trim(item_code)=trim(as_item_code); exception when others then ls_INV_SRNO_REQD := 'N'; end; if trim(ls_INV_SRNO_REQD)='Y' then begin select count(1) into ls_count from srl_contents where item_code=trim(as_item_code) and lot_no=trim(as_lot_no) ; exception when others then ls_count := 0; end; if ls_count=0 then ls_result:=0; else ls_result:=1; end if; end if; return ls_result; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_NAME (as_emp in char ) return char is ls_name char(32) ; begin ls_name := null; if length(trim(as_emp)) <> 0 then select emp_fname ||' ' ||emp_lname into ls_name from employee where emp_code = as_emp; end if; return ls_name; exception when NO_DATA_FOUND then null; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TOUR_STATUSDESR (Vi_Tran_Id_1 In VARCHAR2) Return Varchar2 Is History_Descr Varchar2(200); Vi_Use_Flag Char(1); Vi_Tran_Id varchar2(15); Vi_Status char(1); Vi_Wrkflw_Status char(2); vi_auth_sign char(1); Vi_EMP_CODE VARCHAR2(10); sign_date VARCHAR2(10); ls_emp_fname VARCHAR2(10); ls_emp_mname VARCHAR2(10); ls_emp_lname VARCHAR2(10); historyFormat VARCHAR2(200); empCode VARCHAR2(10); fullName VARCHAR2(50); signStatus CHAR(1); reportTo VARCHAR2(10); reportToAdmin VARCHAR2(10); reportToFullName VARCHAR2(200); reportToAdminFullName VARCHAR2(200); counter number; tourFormCnt number; Vi_tour_id_in_char char(10); BEGIN Vi_Tran_Id := trim(Vi_Tran_Id_1) ; Vi_tour_id_in_char:=trim(Vi_Tran_Id_1); Select status , wrkflw_status, auth_sign, EMP_CODE__REC, EMP_CODE__APPR Into vi_status , Vi_Wrkflw_Status , Vi_Auth_Sign, reportTo, reportToAdmin From tour Where tour_Id = Vi_tour_id_in_char; tourFormCnt := 0; select count(1) into tourFormCnt from tour_form where tour_id = Vi_tour_id_in_char; if tourFormCnt = 0 then if vi_status = 'O' or vi_status = 'U' then History_Descr := 'Pending for System Process' ; elsif Vi_Status = 'C' THEN History_Descr := 'Cancelled'; elsif Vi_Status = 'A' THEN History_Descr := 'Approved'; else History_Descr := 'Pending for System Process' ; end if; else if Vi_Status = 'O' THEN History_Descr := 'Not Submitted'; elsIF Vi_Status = 'C' THEN counter := 0; --if Vi_Wrkflw_Status = 'XX' then -- Modified by Piyush on 20/04/2015 if Vi_Wrkflw_Status = 'XX' or Vi_Wrkflw_Status = 'ZZ' then History_Descr := 'Cancelled'; else select count(1) as counter into counter From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id and sign_status='R'; IF counter > 0 or Vi_Wrkflw_Status in ('AR' , 'RR') THEN History_Descr := 'Rejected'; ELSE History_Descr := 'Cancelled'; END IF; END IF; elsif Vi_Status = 'A' then History_Descr := 'Approved'; elsif vi_auth_sign = 'R' then Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_RECOMEN' ; if(counter>0) then Select sign_status Into signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_RECOMEN'; if(signStatus='U') then History_Descr := 'Pending from Recommender' ; elsif (signStatus='R') then History_Descr := 'Rejected' ; elsif (reportto <> reporttoadmin) then Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_APPROV' ; if(counter>0) then Select sign_status Into signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_APPROV' ; if(signStatus='U') then History_Descr := 'Pending from Approver' ; elsif (signStatus='R') then History_Descr := 'Rejected' ; else History_Descr := 'Pending for System Process' ; end if; elsif Vi_Wrkflw_Status = 'AA' then History_Descr := 'Pending for System Process' ; else History_Descr := 'Pending from Approver' ; end if; else History_Descr := 'Pending for System Process' ; end if; else History_Descr := 'Pending from Recommender' ; end if; elsif vi_auth_sign = 'A' then Select count(sign_status) as counter into counter From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_APPROV' ; if(counter>0) then Select sign_status Into signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_APPROV' order by line_no ASC; if(signStatus='U') then History_Descr := 'Pending from Approver' ; elsif (signStatus='R') then History_Descr := 'Rejected' ; else History_Descr := 'Pending for System Process' ; end if; else History_Descr := 'Pending from Approver' ; end if; end if; end if; if History_Descr is null or length(trim(History_Descr)) = 0 then History_Descr := 'Pending for System Process' ; end if; return History_Descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRD_SCHEMETRACE_X ON PRD_SCHEME_TRACE (SITE_CODE, CUST_CODE, SCHEME_CODE, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX P_SAL_TFRDTLS ON SAL_TFR_DTLS (TRANSFER_ID, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRIG_PAYMENT_EXP_UPD_SDRY_CD before insert or update on payment_exp REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW begin IF(:NEW.SUNDRY_TYPE = 'O') then IF (:NEW.SUNDRY_CODE IS NULL) THEN :new.sundry_code := ' '; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ISSITEVALIDFORUSER ( AS_USER_ID IN CHAR , AS_SITE_CODE IN CHAR ) RETURN CHAR IS LS_RETVAL CHAR(1) ; USRLEV NUMBER(1); CNT NUMBER(6); BEGIN LS_RETVAL := 'N'; SELECT NVL(USR_LEV , 2) INTO USRLEV FROM USERS WHERE CODE = AS_USER_ID; IF USRLEV < 2 THEN LS_RETVAL := 'Y'; ELSE SELECT COUNT(1) INTO CNT FROM USER_SITE WHERE SITE_CODE = AS_SITE_CODE AND USER_ID = AS_USER_ID; IF CNT > 0 THEN LS_RETVAL := 'Y'; ELSE LS_RETVAL := 'N'; END IF; END IF; RETURN NVL(LS_RETVAL,'N'); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMP_RESIG_INIT_X ON EMP_RESIG_INIT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SYSDATE return date is ld_today DATE ; begin return sysdate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DROPGROUP (VAL_INV_STAT IN CHAR, VAL_DROP_GROUP IN CHAR ) RETURN NUMBER IS LS_NUM NUMBER ; LS_CNT NUMBER; BEGIN BEGIN IF( VAL_INV_STAT = 'DSO') THEN SELECT COUNT(*) INTO LS_CNT FROM LOCATION WHERE LOC_GROUP = VAL_DROP_GROUP AND INV_STAT = 'PND'; IF (LS_CNT > 0 ) THEN LS_NUM := 1 ; ELSE LS_NUM := 0; END IF ; ELSE LS_NUM := 2; END IF ; EXCEPTION WHEN NO_DATA_FOUND THEN LS_NUM := 3 ; END; RETURN LS_NUM ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DESP_DATE ( as_desp_id char) return date is ldt_desp_date date; begin begin select desp_date into ldt_desp_date from despatch where desp_id = as_desp_id; exception when no_data_found then ldt_desp_date := null; end; return ldt_desp_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION F_GET_CHRGBK_QTY (CCODE IN char,lotno IN CHAR ,itemcode IN CHAR) RETURN NUMBER AS ln_qty NUMBER(14,3); BEGIN BEGIN SELECT NVL(SUM(b.quantity),0) INTO ln_qty FROM CHARGE_BACK A, CHARGE_BACK_DET B WHERE a.cust_code = CCODE AND a.tran_id = b.tran_id AND b.lot_no = lotno AND b.item_code = itemcode AND a.confirmed = 'Y'; EXCEPTION WHEN OTHERS THEN ln_qty := 0; END; RETURN ln_qty; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STRG_LISTED ( ls_tran_id char) return varchar2 is ls_strg_listed varchar2(2000); li_cnt number(7); CURSOR l_listed is select trim(sc.first_name) || ' ' || trim(sc.middle_name) || ' ' || trim(sc.last_name) || ' (' || trim(sc.sc_code) || ')' as listed_customer from strg_customer sc left outer join strg_event_plan_guests sg on sc.sc_code=sg.sundry_code where sg.tran_id=ls_tran_id; l_cur_rec l_listed%ROWTYPE; begin li_cnt :=0; OPEN l_listed; LOOP li_cnt := li_cnt + 1; FETCH l_listed INTO l_cur_rec; EXIT WHEN l_listed%NOTFOUND; if(li_cnt = 1) then ls_strg_listed := l_cur_rec.listed_customer; else ls_strg_listed := ls_strg_listed || ',' || l_cur_rec.listed_customer ; end if; END LOOP; return ls_strg_listed; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALES_DEMAND_SITE_ITEM ON SALES_DEMAND (SITE_CODE, ITEM_CODE, DUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE INSTRUMENTTYPE AS OBJECT ( pophelp_descr VARCHAR2(15) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_MENUPATH ( as_menu_path VARCHAR2) RETURN VARCHAR2 IS ls_menu_descr VARCHAR2(120) := ''; BEGIN if(as_menu_path is not null) then begin SELECT nvl(descr,0) into ls_menu_descr FROM itm2menu WHERE menu_path = as_menu_path; exception when others then ls_menu_descr := ''; end; end if; RETURN ls_menu_descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TRNSR_EXCEINV_GRAMT (as_tran_id distord_issdet.tran_id%type,as_type char) return number is lc_gross_amt number(14,3); ls_type distord_iss.order_type%type; lc_exch_rate distord_iss.exch_rate%type; begin if as_type = 'I' then select order_type,exch_rate into ls_type,lc_exch_rate from distord_iss where tran_id = as_tran_id; if substr(ls_type,1,1) = 'E' then select sum(trunc((sum(quantity) * to_number(lc_exch_rate) * rate__clg)+ ( sum (tax_amt) * to_number(lc_exch_rate)) ,2) ) into lc_gross_amt from distord_issdet where tran_id = as_tran_id group by rate__clg; else select trunc((sum(distord_issdet.net_amt) * to_number(lc_exch_rate)),2) into lc_gross_amt from distord_issdet where tran_id = as_tran_id; end if; end if; if lc_gross_amt is null then lc_gross_amt := 0; end if ; return lc_gross_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LAST_APRDT (as_login in varchar, as_sales_ww in varchar, as_date in date) return varchar is as_value varchar(1000); first_date date; prev_date date; CURSOR c1 iS select distinct( event_date ) from strg_meet where trim(sales_pers) = as_login and event_date <= as_date and trim(sprs_code__ww) = as_sales_ww order by event_date desc; begin FOR I IN C1 loop first_date := i.event_date; if prev_Date is null then as_value := first_date; elsif prev_date - first_date = 1 then as_value := as_value || ',' || first_date ; else exit; end if; prev_Date := i.event_date; end loop; return as_value ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUPP_ITEMWISE_LOTWISE ( p_lot_no IN qc_Order.lot_no%TYPE, p_item_code IN qc_Order.item_code%TYPE ) RETURN VARCHAR2 IS v_supp_name supplier.supp_name%TYPE; BEGIN SELECT supp_name INTO v_supp_name FROM supplier WHERE supp_code = CASE WHEN (SELECT DISTINCT q.supp_code FROM qc_Order q LEFT JOIN supplier s ON q.supp_code = s.supp_code WHERE q.lot_no = p_lot_no AND q.item_code = p_item_code AND q.supp_code IS NOT NULL) IS NULL THEN (SELECT DISTINCT SUPP_CODE__MFG FROM adj_issrcpdet adj WHERE adj.item_code = p_item_code AND adj.lot_no = p_lot_no AND SUPP_CODE__MFG IS NOT NULL) ELSE (SELECT DISTINCT q.supp_code FROM qc_Order q LEFT JOIN supplier s ON q.supp_code = s.supp_code WHERE q.lot_no = p_lot_no AND q.item_code = p_item_code AND q.supp_code IS NOT NULL) END; RETURN v_supp_name; END fn_get_supp_itemwise_lotwise; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_TRANS_DR_FIN (ldate_fr in date,ldate_to in date,lsundry_code in char,lsundry_type in char, l_fin_entity in char,lacct_code in char) return number is lc_dr_sum number(14,3); begin Select nvl(Sum(dr_amt * exch_rate),0) into lc_dr_sum from gltrace where fin_entity = l_fin_entity and tran_date >= ldate_fr and tran_date <= ldate_to and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUN_GET_MIN_MAX_CALL (mtype in char, memp_code in char, mwork_date date )return varchar2 is mlast_call varchar2(10) := null; BEGIN IF MTYPE = 'M' then SELECT MIN((CASE WHEN SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,7,2)='PM' AND SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,1,2) !='12' THEN SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,7,2)||' '|| STR_TO_NUM(SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,1,2)+12)||SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,3,3) ELSE SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,7,2)||' '||SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,1,5) END)) into mlast_call FROM DR_DOCTOR_VISIT WHERE DR_DOCTOR_VISIT.SALES_PERS = memp_code AND DR_DOCTOR_VISIT.WORK_DATE = mwork_date AND DR_DOCTOR_VISIT.SC_TYPE ='C'; elsif mtype ='X' then SELECT MAX((CASE WHEN SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,7,2)='PM' AND SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,1,2) !='12' THEN SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,7,2)||' '|| STR_TO_NUM(SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,1,2)+12)||SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,3,3) ELSE SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,7,2)||' '||SUBSTR(DR_DOCTOR_VISIT.DOCTOR_VISIT_TIME,1,5) END)) into mlast_call FROM DR_DOCTOR_VISIT WHERE DR_DOCTOR_VISIT.SALES_PERS = memp_code AND DR_DOCTOR_VISIT.WORK_DATE = mwork_date AND DR_DOCTOR_VISIT.SC_TYPE ='C'; end if; return mlast_call; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_DETAILS_CES (ls_tran_code in char,ls_tran_id in char, ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; ---cess amt if ls_type = 'C' then select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim( taxtran.tax_code)) > 0 ; end if; --tax amt if ls_type = 'T' then select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- tax % if ls_type = 'P' then select MIN(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 ; end if; -- taxable amt if ls_type = 'A' then select MIN(taxable_amt) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,rtrim(tax_code)) > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then lc_exch_rate := ddf_get_exch_rate(ls_tran_code,ls_tran_id); if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_LANDING_RATE (as_itemcode in char,as_prd_code in char) Return Number Is landing_rate Number(14,3); Begin Begin Select Coalesce(Landing_Rate,0) Into landing_rate From Landing_Rate_mst Where Item_Code = as_itemcode And as_prd_code Between To_Char(Eff_From,'YYYYMM') And To_Char(Valid_Upto,'YYYYMM'); Exception When No_Data_Found Then landing_rate :=0; End; Return landing_rate; End; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SER_REQ_FEEDBKDTL_AR_ID ON SER_REQ_FEEDBKDTL (ACTION_ID, REQ_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRACE_SUNDRY_DATE ON GLTRACE (SUNDRY_TYPE, SUNDRY_CODE, SITE_CODE, TRAN_DATE, ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETORDER_SETLINENO before insert on strg_meet_order for each row declare max_line_no number(10); begin if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_order where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_order where dcr_id = :new.dcr_id; :NEW.LINE_NO := NVL(MAX_LINE_NO , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_MDRCR_SO BEFORE INSERT ON misc_drcr_rcp FOR EACH ROW declare --PRAGMA AUTONOMOUS_TRANSACTION; ls_status char(1); BEGIN if trim(:new.item_ser) = 'FLAT' and :new.sale_order is not null and length(trim(:new.sale_order)) > 0 then select status into ls_status from sorder where sale_order = :new.sale_order; if ls_status = 'C' or ls_status = 'X' then raise_application_error( -20601, 'Sales order [' || trim(:new.sale_order) || '] status is closed/cancelled demad cannot be generated'); end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TRANSIT_QTY (sitedlv in char,issdate in date,issueid in char,distord in char,distord_lin in number,itm in char,lotno in char) return number is rcpqty number; rcpid varchar2(10); begin select tran_id into rcpid from distord_rcp where site_code = sitedlv and tran_date >= issdate and substr(remarks,1,10) = issueid and confirmed = 'Y'; select sum(quantity) into rcpqty from distord_rcpdet where tran_id = rcpid and dist_order = distord and line_no_dist_order = distord_lin and item_code = itm and lot_no = lotno; return rcpqty; exception when no_data_found then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INSURANCE_POLICY ON INSURANCE (SITE_CODE__INS, POLICY_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HUN_GYED (AS_EMP_CODE char,AS_PRD_CODE char,AS_ADCODE_REG char,AS_ADCODE_NONREG char,AS_LVE_CODE char, AS_ADCODE_BASIC char) return number is a_sex employee.sex%type; a_reg_income char(1) := 'N'; a_calc_prdfr char(6); a_calc_prdto char(6); a_count number(1); a_present number(3) := 0; a_absent number(3) := 0; a_days_year number(3); a_amount number(12,3) := 0; a_income_reg payarr_det.amount%type; a_income_nonreg payarr_det.amount%type; a_leave_days empleave_summary.no_days%type; a_min_wages ad_slabs.amount%type; a_basic_amt employee_ad.amount%type; a_fr_date date; a_to_date date; a_rel_datefr date; a_date_birth empfamily.date_birth%type; begin select sex into a_sex from employee where emp_code = AS_EMP_CODE; if (a_sex <> 'F') then return a_amount; end if; select min(date_birth) into a_date_birth from empfamily a,period b where a.emp_code = AS_EMP_CODE and a.relation in ('DAUGHTER','SON') and b.code = AS_PRD_CODE and (b.fr_date between (a.date_birth+168) and (add_months(a.date_birth,24)-1) or b.to_date between (a.date_birth+168) and (add_months(a.date_birth,24)-1)); if (a_date_birth is null) then return a_amount; end if; select to_date('01-jan-'||(to_char(a_date_birth,'YYYY')-1)),(to_char(a_date_birth,'YYYY')-1) || '01', (to_char(a_date_birth,'YYYY')-1) || '12' into a_rel_datefr,a_calc_prdfr,a_calc_prdto from dual; for i in 1..((a_date_birth+168)-a_rel_datefr) loop select count(*) into a_count from attd_reg where emp_code = AS_EMP_CODE and attd_date = (a_rel_datefr+i-1) and (work_days <> 0 or hol_woff_days <> 0); if (a_count = 0) then a_absent := a_absent + 1; if (a_absent = 30) then a_present := 0; end if; elsif (a_count = 1) then a_present := a_present + 1; a_absent := 0; if (a_present = 180) then a_reg_income := 'Y'; exit; end if; end if; end loop; select nvl(sum(to_date-fr_date+1),0) into a_days_year from period where code between a_calc_prdfr and a_calc_prdto; select nvl(sum(amount),0) into a_income_reg from payarr_det where prd_code between a_calc_prdfr and a_calc_prdto and emp_code = AS_EMP_CODE and ad_code = AS_ADCODE_REG; select nvl(sum(amount),0) into a_income_nonreg from payarr_det where prd_code between a_calc_prdfr and a_calc_prdto and emp_code = AS_EMP_CODE and ad_code = AS_ADCODE_NONREG; select nvl(sum(no_days),0) into a_leave_days from empleave_summary where emp_code = AS_EMP_CODE and lve_code = AS_LVE_CODE and prd_code between a_calc_prdfr and a_calc_prdto and use_flag = 'C'; select fr_date,to_date into a_fr_date,a_to_date from period where code = AS_PRD_CODE; if ((a_date_birth+168) > a_fr_date) then a_fr_date := a_date_birth+168; end if; if ((add_months(a_date_birth,24)-1) < a_to_date) then a_to_date := add_months(a_date_birth,24)-1; end if; if (a_reg_income = 'Y') then a_amount := (((a_income_reg+a_income_nonreg) / (a_days_year - a_leave_days)) * 0.70) * (a_to_date-a_fr_date+1); else for ii in 1..(a_to_date-a_fr_date+1) loop select sum(a.amount/(b.to_date-b.fr_date+1)) into a_min_wages from ad_slabs a,period b where a.ad_code = AS_ADCODE_NONREG and (a_fr_date+ii-1) between a.eff_date and a.exp_date and b.code = AS_PRD_CODE; select sum(a.amount/(b.to_date-b.fr_date+1)) into a_basic_amt from employee_ad a,period b where a.emp_code = AS_EMP_CODE and a.ad_code = AS_ADCODE_BASIC and (a_fr_date+ii-1) between a.eff_date and a.exp_date and a.confirmed = 'Y' and b.code = AS_PRD_CODE; a_min_wages := a_min_wages * 2; if (a_basic_amt < a_min_wages) then a_amount := a_amount + (a_basic_amt * 0.70); else a_amount := a_amount + (a_min_wages * 0.70); end if; end loop; end if; return round(a_amount,2); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORK_ISSDET_ITEM_LOTNO_LOTSL ON WORKORDER_ISSDET (ITEM_CODE, LOT_NO, LOT_SL, EXP_LEV, LOC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RETEST_DATE (as_site_code stock.site_code%type, as_item_code stock.item_code%type, as_loc_code stock.loc_code%type, as_lot_no stock.lot_no%type,as_lot_sl stock.lot_sl%type ) return date is ldt_ret_date stock.retest_date%type; begin select retest_date into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.loc_code = as_loc_code and stock.lot_no = as_lot_no and stock.lot_sl = as_lot_sl; if sqlcode = 100 and ((as_lot_sl) is null or length(trim(as_lot_sl)) = 0 ) or (as_loc_code is null or length(trim(as_loc_code)) = 0) then if as_lot_sl is null or length(trim(as_lot_sl)) = 0 then select min(retest_date) into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.loc_code = as_loc_code and stock.lot_no = as_lot_no; elsif as_loc_code is null or length(trim(as_loc_code)) = 0 then select min(retest_date) into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.lot_no = as_lot_no and stock.lot_sl = as_lot_sl; elsif as_loc_code is null or length(trim(as_loc_code)) = 0 and as_lot_sl is null or length(trim(as_lot_sl)) = 0 then select min(retest_date) into ldt_ret_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.lot_no = as_lot_no; end if; end if; return ldt_ret_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ADD_INFO_X ON ADD_INFO (REF_SER, REF_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETBRAND_SETPKVAL before insert on strg_brand_pitch for each row declare max_line_no number(10); begin if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id into :new.dcr_id from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_brand_pitch where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_brand_pitch where dcr_id = :new.dcr_id; :NEW.LINE_NO := NVL(MAX_LINE_NO , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PERIOD_APPL_PRD_TBLNO ON PERIOD_APPL (PRD_TBLNO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HUN_GYES (AS_EMP_CODE char,AS_PRD_CODE char,AS_AD_CODE char) return number is cursor c1 is select date_birth,nvl(physical_status,'0') as physical_status from empfamily a,period b where a.emp_code = AS_EMP_CODE and a.relation in ('DAUGHTER','SON') and b.code = AS_PRD_CODE and (b.fr_date between add_months(a.date_birth,24) and (add_months(a.date_birth,(case when nvl(physical_status,'0') = '1' then 120 else 36 end))-1) or b.to_date between add_months(a.date_birth,24) and (add_months(a.date_birth,(case when nvl(physical_status,'0') = '1' then 120 else 36 end))-1)); a_sex employee.sex%type; a_amount number(12,3) := 0; a_min_wages ad_slabs.amount%type; a_fr_date date; a_to_date date; begin select sex into a_sex from employee where emp_code = AS_EMP_CODE; if (a_sex <> 'F') then return a_amount; end if; for i in c1 loop select fr_date,to_date into a_fr_date,a_to_date from period where code = AS_PRD_CODE; if (add_months(i.date_birth,24) > a_fr_date) then a_fr_date := add_months(i.date_birth,24); end if; if ((add_months(i.date_birth,(case when i.physical_status = '1' then 120 else 36 end))-1) < a_to_date) then a_to_date := add_months(i.date_birth,(case when i.physical_status = '1' then 120 else 36 end))-1; end if; select sum((a.amount*(a_to_date-a_fr_date+1))/(b.to_date-b.fr_date+1)) into a_min_wages from ad_slabs a,period b where a.ad_code = AS_AD_CODE and b.code = AS_PRD_CODE and b.fr_date between a.eff_date and a.exp_date; a_amount := a_amount + a_min_wages; end loop; return round(a_amount,2); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_SUND_BAL_ACCTWISE (ldate_fr in date, ldate_to in date, lsite_code in char, lacct_code in char , lsundry_type in char , lsundry_code in char) return number is lc_bal number(14,3); lc_sbal number(14,3); ls_acct_prd char(6); ls_prd_code char(6); begin select acct_prd , code into ls_acct_prd , ls_prd_code from period where ldate_fr between fr_date and to_date; select nvl(sum((dr_amt__base) - (cr_amt__base)),0) into lc_sbal from sundrybal where acct_prd = ls_acct_prd and prd_code < ls_prd_code and site_code = lsite_code and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code and nvl(cctr_code,'0') >= ' ' and nvl(cctr_code,'0') <= 'Z' ; Select nvl(sum((dr_amt * exch_rate) - (cr_amt * exch_rate)) , 0) into lc_bal from gltrace where site_code = lsite_code and tran_date >= ldate_fr and tran_date < ldate_to and sundry_type = lsundry_type and sundry_code= lsundry_code and acct_code = lacct_code; lc_bal := lc_sbal + lc_bal; Return lc_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUM_TAX_AMT (ls_tran_code in char,ls_tran_id in char,ls_var_name in char) return number is AS_TAX_SUM number(14,3); BEGIN SELECT NVL(sum(nvl(TAXTRAN.TAX_AMT,0)),0) INTO AS_TAX_SUM FROM TAX, TAXTRAN WHERE TAX.TAX_CODE = TAXTRAN.TAX_CODE and taxtran.tran_id = ls_tran_id AND taxtran.tran_code = ls_tran_code and (TAX.PRINT_TAX) ='Y' AND taxtran.tax_amt <> 0 AND INSTR((SELECT ',' || TRIM(VAR_VALUE) || ',' FROM DISPARM WHERE TRIM(VAR_NAME) = ls_var_name AND PRD_CODE = '999999'),',' || TRIM(TAXTRAN.TAX_CODE) || ',') > 0; RETURN AS_TAX_SUM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE CHC_CHEM_TLSD_DM AS FUNCTION getChemTlsdInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_TLSD_TB PIPELINED; END CHC_CHEM_TLSD_DM; CREATE OR REPLACE PACKAGE BODY CHC_CHEM_TLSD_DM AS FUNCTION getChemTlsdInfo (empCode in char, eventDate in Date) RETURN CHC_CHEM_TLSD_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE,code INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE,AS_PRD_CODE FROM PERIOD WHERE eventdate BETWEEN FR_DATE AND TO_DATE; SELECT LISTAGG((A.EMP_CODE ), ',') WITHIN GROUP (order by A.EMP_CODE) INTO MGR_EMPS FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE; for x in ( SELECT SM.STRG_CODE SC_CODE, I.DESCR as ITEM_DESCR, SMO.QUANTITY, (SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS CHEM_NAME, SSC.DESCR CLASS,(SELECT descr FROM SPRS_ROUTE ROUTE WHERE ROUTE.SPRS_CODE = SS.SALES_PERS AND ROUTE.ROUTE_ID = SS.ROUTE_ID) ROUTE_TYPE, AS_PRD_CODE AS PRD_CODE,SM.SALES_PERS as MGR_SUB, EMP.EMP_CODE, (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) AS EMP_NAME, ITEMSER.DESCR AS DIVISION, EMP.DESIGNATION as DESIGN, STATION.DESCR AS HEAD_QUAT, (SC.ADDR1 || ' ' || SC.ADDR2 || ' ' || SC.ADDR3) AS CHEM_ADDR FROM FIELDACTIVITY F, STRG_MEET_ORDER SMO LEFT OUTER JOIN STRG_MEET SM ON SMO.DCR_ID=SM.DCR_ID AND SMO.QUANTITY > 0 and sm.strg_code = smo.strg_code LEFT OUTER JOIN ITEM I ON I.ITEM_CODE = SMO.ITEM_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = SM.STRG_CODE LEFT OUTER JOIN LOCALITY LOC ON SC.LOCALITY_CODE = LOC.LOCALITY_CODE LEFT OUTER JOIN STRG_SERIES SS ON SS.SC_CODE = SM.STRG_CODE AND SS.SALES_PERS = SM.SALES_PERS LEFT OUTER JOIN SALES_PERS SP ON SM.SALES_PERS = SP.SALES_PERS LEFT OUTER JOIN ITEMSER ITEMSER ON SP.ITEM_SER = ITEMSER.ITEM_SER LEFT OUTER JOIN STRG_SER_CLASS SSC ON SSC.ITEM_SER = SP.ITEM_SER AND SSC.CLASS_CODE = SS.CLASS_CODE LEFT OUTER JOIN EMPLOYEE EMP ON EMP.EMP_CODE = SM.SALES_PERS LEFT OUTER JOIN STATION STATION ON EMP.STAN_CODE__HQ = STATION.STAN_CODE LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE = SPL.SPL_CODE WHERE SM.SALES_PERS in (SELECT RPAD(COLUMN_VALUE,10,' ') FROM TABLE( CSV_TO_ROW( (MGR_EMPS) ))) AND SM.EVENT_DATE = eventDate AND SM.EVENT_TYPE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' ) LOOP PIPE ROW (CHC_CHEM_TLSD_MST( x.SC_CODE,x.CHEM_NAME,x.CLASS,x.ROUTE_TYPE,x.PRD_CODE, x.MGR_SUB, x.DIVISION, x.EMP_CODE, x.EMP_NAME, x.HEAD_QUAT, x.DESIGN, x.CHEM_ADDR,x.QUANTITY,x.ITEM_DESCR)); END LOOP; RETURN; END; END CHC_CHEM_TLSD_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001102913 ON APPR_KRA_CAL (APPR_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DAY_OP_BAL_GL_TRAN (m_frst_date char,m_date_from char,m_acct_code char,m_site_code char ) return number is ld_day_op_bal number(14,3); begin Select nvl(Sum(dr_amt - cr_amt),0) into ld_day_op_bal from gltran where site_code=m_site_code and tran_date >=m_frst_date and tran_date < m_date_from and acct_code=m_acct_code ; Return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MATQTYRATE_SUM (AS_TRANID DISTORD_ISSDET.tran_id%TYPE, AS_LOTNO DISTORD_ISSDET.LOT_NO%TYPE, AS_ITEMCD DISTORD_ISSDET.ITEM_CODE%TYPE, as_flag char,as_tran_flag char) RETURN NUMBER IS QTY NUMBER(14,3); AMT NUMBER(14,3); BEGIN if as_tran_flag ='D-ISS' then SELECT SUM(QUANTITY) ,(sum(DISTORD_ISSDET.quantity) * MAX(DISTORD_ISSDET.rate)) INTO QTY,AMT FROM DISTORD_ISSDET WHERE DISTORD_ISSDET.tran_id =AS_TRANID AND ITEM_CODE =AS_ITEMCD AND LOT_NO =AS_LOTNO; elsif as_tran_flag ='S-DSP' THEN SELECT SUM(QUANTITY) ,(sum(despatchdet.quantity) * MAX(despatchdet.rate__CLG)) INTO QTY,AMT FROM despatchdet WHERE despatchdet.DESP_ID=AS_TRANID AND ITEM_CODE =AS_ITEMCD AND LOT_NO =AS_LOTNO; END IF; if as_flag='A' then return amt; else return qty; end if; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PLA_X ON PLA (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_DTL (lsundry_type in char,lsundry_code in char,lsreq_val in char) return char is lsreturn varchar(200); ls_name varchar(200); ls_city varchar(200); ls_state varchar(200); ls_country_descr varchar(200); ls_pin varchar(200); ls_REG_NO varchar(200); begin begin if lsundry_type ='O' then lsreturn := ' '; elsif lsundry_type ='S' then select supp.supp_name, supp.city, state.descr, country.descr, supp.pin, nvl(fdf_reg_no('S', supp.supp_code, 'L' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from supplier supp LEFT OUTER JOIN state state ON state.state_code = supp.state_code LEFT OUTER JOIN country country ON country.count_code = supp.count_code WHERE supp.supp_code = lsundry_code; elsif lsundry_type ='E' then select emp.emp_fname||''||emp.emp_mname||''||emp.emp_lname, emp.cur_city, state.descr, country.descr, emp.cur_pin, nvl(fdf_reg_no('E', emp.emp_code, 'P' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from employee emp LEFT OUTER JOIN state state ON state.state_code = emp.cur_state LEFT OUTER JOIN country country ON country.count_code = state.count_code WHERE emp.emp_code = lsundry_code ; elsif lsundry_type ='C' then select cust.cust_name, cust.city, state.descr, country.descr, cust.pin, nvl(fdf_reg_no('C', cust.cust_code, 'L' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from customer cust LEFT OUTER JOIN state state ON state.state_code = cust.state_code LEFT OUTER JOIN country country ON country.count_code = cust.count_code WHERE cust.cust_code = lsundry_code ; elsif lsundry_type ='P' then select salp.sp_name, salp.city, state.descr, country.descr, salp.pin, nvl(fdf_reg_no('P', salp.sales_pers, 'P' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from sales_pers salp LEFT OUTER JOIN state state ON state.state_code = salp.state_code LEFT OUTER JOIN country country ON country.count_code = salp.count_code WHERE salp.sales_pers = lsundry_code ; elsif lsundry_type ='L' then select lparty.party_name, lparty.city, state.descr,country.descr, lparty.pin, nvl(fdf_reg_no('L', lparty.party_code, 'P' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from loanparty lparty LEFT OUTER JOIN state state ON state.state_code = lparty.state_code LEFT OUTER JOIN country country ON country.count_code = lparty.count_code WHERE lparty.party_code = lsundry_code ; elsif lsundry_type ='T' then select transp.tran_name, transp.city, state.descr,country.descr, transp.pin, nvl(fdf_reg_no('T', transp.tran_code, 'P' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from transporter transp LEFT OUTER JOIN state state ON state.state_code = transp.state_code LEFT OUTER JOIN country country ON country.count_code = transp.count_code WHERE transp.tran_code = lsundry_code ; elsif lsundry_type ='X' then select tax_authority.tauth_name, tax_authority.city, state.descr,country.descr, tax_authority.pin, nvl(fdf_reg_no('X', tax_authority.tauth_code, 'P' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from tax_authority tax_authority LEFT OUTER JOIN state state ON state.state_code = tax_authority.state_code LEFT OUTER JOIN country country ON country.count_code = tax_authority.count_code WHERE tax_authority.TAUTH_CODE = lsundry_code ; elsif lsundry_type ='R' then select strgcust.first_name||''||strgcust.middle_name||''||strgcust.last_name, strgcust.city, state.descr,country.descr, strgcust.pin, nvl(fdf_reg_no('R', strgcust.sc_code, 'P' ),'NA') as tax_reg into ls_name,ls_city,ls_state,ls_country_descr,ls_pin,ls_REG_NO from strg_customer strgcust LEFT OUTER JOIN state state ON state.state_code = strgcust.state_code LEFT OUTER JOIN country country ON country.count_code = strgcust.count_code WHERE strgcust.sc_code = lsundry_code ; end if; if lsreq_val ='NAME' then lsreturn := ls_name; elsif lsreq_val ='CITY' then lsreturn := ls_city; elsif lsreq_val ='STATE' then lsreturn := ls_state; elsif lsreq_val ='COUNTRY' then lsreturn := ls_country_descr; elsif lsreq_val ='PIN' then lsreturn := ls_pin; elsif lsreq_val ='REGNO' then lsreturn := ls_REG_NO ; else lsreturn := ''; end if; exception when no_data_found then lsreturn := ''; end; return lsreturn; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_FREE_QTY ( as_invoice_id CHAR , as_item_code CHAR ,as_lot_no CHAR) return number is ld_quantity_stduom number(12,3) ; begin select nvl(sum(quantity__stduom),0) into ld_quantity_stduom from invoice_trace where invoice_id = as_invoice_id and rate__stduom = 0 and item_code = as_item_code and lot_no= as_lot_no ; if ld_quantity_stduom <> 0 then return ld_quantity_stduom ; else ld_quantity_stduom := 0 ; return ld_quantity_stduom ; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_UNIT_TIME_DESCR (AS_TIME_REQD IN NUMBER,AS_UNIT_TIME IN CHAR) RETURN VARCHAR AS UNIT_DESCR VARCHAR2(10); BEGIN BEGIN ---------ADDED BY NISAR AHMAD ON 05/08/09----------- IF AS_TIME_REQD = 1 THEN SELECT CASE WHEN UPPER(AS_UNIT_TIME)='M' THEN 'Month' WHEN UPPER(AS_UNIT_TIME)='D' THEN 'Day' WHEN UPPER(AS_UNIT_TIME)='Y' THEN 'Year' END INTO UNIT_DESCR FROM DUAL; ELSE SELECT CASE WHEN UPPER(AS_UNIT_TIME)='M' THEN 'Months' WHEN UPPER(AS_UNIT_TIME)='D' THEN 'Days' WHEN UPPER(AS_UNIT_TIME)='Y' THEN 'Years' END INTO UNIT_DESCR FROM DUAL; END IF; END; RETURN UNIT_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AVG_CONSUMP ( as_site_code site.site_code%type, as_item_code item.item_code%type, mstkdtto invtrace.tran_date%type, as_loc_code_from location.loc_code%type, as_loc_code_to location.loc_code%type) return number is ad_fr_date date; an_eff_qty number; an_months number; avg_sum number; begin select fr_date into ad_fr_date from acctprd where mstkdtto between fr_date and to_date; select sum(decode(sign(eff_qty),-1,eff_qty * -1,0)) into an_eff_qty from invtrace where invtrace.site_code = as_site_code and invtrace.item_code = as_item_code and invtrace.loc_code between as_loc_code_from and as_loc_code_to and invtrace.ref_ser in ('C-ISS','W-ISS','S-DSP') and tran_date between ad_fr_date and mstkdtto; select months_between(mstkdtto, ad_fr_date) into an_months from dual; avg_sum := an_eff_qty/an_months; return avg_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESPATCHAMT ( as_desp_id in char, as_line_no in char, as_item_code in char, as_lot_sl in char) return number is lc_amt number(14,3); lc_rate number(14,3); begin select nvl(MIN(rate__stduom), 0) into lc_rate from despatchdet where desp_id = as_desp_id ; if lc_rate = 0 then select nvl(sum(quantity__stduom * rate__stduom),0) into lc_amt from despatchdet where desp_id = as_desp_id and item_code = as_item_code and lot_sl = as_lot_sl ; else select nvl(quantity__stduom * rate__stduom,0) into lc_amt from despatchdet where desp_id = as_desp_id and item_code = as_item_code and line_no = as_line_no ; end if; return lc_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITM_ACCESS_LOG_X ON ITM_ACCESS_LOG (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WF_PRC_STATUS_CHG_I ON WF_PRC_STATUS_CHG (PROCESS_ID, INSTANCE_ID, ACTIVITY_ID, SEQ_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE EFF_DOC_MET_DM AS FUNCTION getDocMetInfo(empCode in char, prdCode in char) RETURN EFF_DOC_MET_TB PIPELINED; END EFF_DOC_MET_DM; CREATE OR REPLACE PACKAGE BODY EFF_DOC_MET_DM AS FUNCTION getDocMetInfo (empCode in char, prdCode in char) RETURN EFF_DOC_MET_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE CODE = prdCode; SELECT LISTAGG((A.EMP_CODE ), ',') WITHIN GROUP (order by A.EMP_CODE) INTO MGR_EMPS FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE; WITH MGR_DATA AS ( SELECT A.EMP_CODE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ) SELECT COUNT(1) INTO UNCONFIRM_CNT FROM SPRS_ACT_TRAN SAT, MGR_DATA MGR_DATA WHERE SAT.EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND SAT.CONFIRMED = 'Y' AND SAT.SALES_PERS = MGR_DATA.EMP_CODE; if (UNCONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; SELECT CODE INTO AS_PRD_CODE FROM PERIOD WHERE FR_DATE = AS_FR_DATE AND TO_DATE = AS_TO_DATE; for x in ( SELECT STRG_DR.STRG_CODE SC_CODE, STRG_DR.DR_NAME, STRG_DR.SPECIALITY, STRG_DR.PLANNED_VISIT, STRG_DR.CLASS, STRG_DR.CATEGORY, STRG_DR.LOCALITY, STRG_DR.ROUTE_TYPE, LISTAGG(TRIM('' || TO_CHAR(STRG_DR.EVENT_DATE,'DD') || ''), ',') WITHIN GROUP (ORDER BY STRG_DR.STRG_CODE) AS MET_DATES, AS_PRD_CODE AS PRD_CODE, STRG_DR.SALES_PERS AS MGR_SUB, STRG_DR.DIVISION, STRG_DR.EMP_CODE, STRG_DR.EMP_NAME, STRG_DR.DESIGN, STRG_DR.HEAD_QUAT FROM ( SELECT SM.STRG_CODE, EVENT_DATE, (SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS DR_NAME, SPL.DESCR AS SPECIALITY, SS.NO_VISIT AS PLANNED_VISIT, SS.CATEGORY, LOC.DESCR AS LOCALITY, SSC.DESCR CLASS, (SELECT ROUTE_TYPE FROM SPRS_ROUTE ROUTE WHERE ROUTE.SPRS_CODE = SS.SALES_PERS AND ROUTE.ROUTE_ID = SS.ROUTE_ID) ROUTE_TYPE, SM.SALES_PERS, EMP.EMP_CODE, (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) AS EMP_NAME, ITEMSER.DESCR AS DIVISION, EMP.DESIGNATION as DESIGN, STATION.DESCR AS HEAD_QUAT FROM FIELDACTIVITY F, STRG_MEET SM LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = SM.STRG_CODE LEFT OUTER JOIN LOCALITY LOC ON SC.LOCALITY_CODE = LOC.LOCALITY_CODE LEFT OUTER JOIN STRG_SERIES SS ON SS.SC_CODE = SM.STRG_CODE AND SS.SALES_PERS = SM.SALES_PERS LEFT OUTER JOIN SALES_PERS SP ON SM.SALES_PERS = SP.SALES_PERS LEFT OUTER JOIN ITEMSER ITEMSER ON SP.ITEM_SER = ITEMSER.ITEM_SER LEFT OUTER JOIN STRG_SER_CLASS SSC ON SSC.ITEM_SER = SP.ITEM_SER AND SSC.CLASS_CODE = SS.CLASS_CODE LEFT OUTER JOIN EMPLOYEE EMP ON EMP.EMP_CODE = SM.SALES_PERS LEFT OUTER JOIN STATION STATION ON EMP.STAN_CODE__HQ = STATION.STAN_CODE LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE = SPL.SPL_CODE WHERE SM.SALES_PERS in (SELECT RPAD(COLUMN_VALUE,10,' ') FROM TABLE( CSV_TO_ROW( (MGR_EMPS) ))) AND SM.EVENT_DATE BETWEEN (SELECT FR_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SM.EVENT_TYPE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' ) STRG_DR GROUP BY STRG_DR.STRG_CODE,STRG_DR.DR_NAME, STRG_DR.SPECIALITY, STRG_DR.PLANNED_VISIT, STRG_DR.CATEGORY, STRG_DR.LOCALITY, STRG_DR.CLASS,STRG_DR.ROUTE_TYPE,STRG_DR.SALES_PERS, STRG_DR.EMP_CODE, STRG_DR.EMP_NAME,STRG_DR.DIVISION,STRG_DR.DESIGN,STRG_DR.HEAD_QUAT ORDER BY STRG_DR.PLANNED_VISIT ) LOOP PIPE ROW (EFF_DOC_MET_MST( x.SC_CODE,x.DR_NAME,x.SPECIALITY,x.PLANNED_VISIT,x.CLASS,x.CATEGORY,x.LOCALITY,x.ROUTE_TYPE,x.MET_DATES, x.PRD_CODE, x.MGR_SUB, x.DIVISION, x.EMP_CODE, x.EMP_NAME, x.HEAD_QUAT, x.DESIGN)); END LOOP; RETURN; END; END EFF_DOC_MET_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_OPENING_BALANCE (as_empcode char,ad_date_fr date,ad_date_to date,ad_exp_date date,as_lvecode char) return number is lc_baldays number(6,1) ; lc_nodays number(6,1) := 0; lc_nodays1 number(6,1) := 0; lc_nodays2 number(6,1) := 0; ld_eff_date date; begin begin select min(eff_date) into ld_eff_date from leavebal where emp_code = as_empcode and lve_code = as_lvecode and eff_date <= ad_date_fr and exp_date >= ad_date_to; if (ld_eff_date is not null) then ld_eff_date := to_date('01-'||to_char(ld_eff_date,'MON')||'-'||to_char(ld_eff_date,'YYYY')); end if; SELECT nvl(sum(nvl(no_days,0)),0) into lc_nodays FROM empleave_summary,period WHERE empleave_summary.EMP_CODE = as_empcode AND empleave_summary.lve_code = as_lvecode and period.code = empleave_summary.prd_code and period.fr_date >= ld_eff_date and period.fr_date < ad_date_fr; END ; begin declare cursor c_lvetrace is SELECT lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc FROM emplve_trace WHERE EMP_CODE = as_empcode AND lve_code = as_lvecode and lve_date_fr < ld_eff_date and eff_date >= ld_eff_date and nvl(use_flag,' ') <> 'F' group by lve_date_fr,lve_date_to; begin lc_nodays1 := 0; for i in c_lvetrace loop if i.lve_date_to >= ld_eff_date then if (i.lve_date_to - ld_eff_date + 1) < i.lve_aloc then lc_nodays1 := lc_nodays1 + i.lve_aloc - (i.lve_date_to - ld_eff_date + 1); end if; else lc_nodays1 := lc_nodays1 + i.lve_aloc ; end if; end loop; END ; declare cursor c_lvetrace is SELECT lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc FROM emplve_trace WHERE EMP_CODE = as_empcode AND lve_code = as_lvecode and lve_date_to >= ld_eff_date and eff_date < ld_eff_date and nvl(use_flag,' ') <> 'F' group by lve_date_fr,lve_date_to; begin lc_nodays2 := 0; for i in c_lvetrace loop if (i.lve_date_fr < ld_eff_date) then if ((ld_eff_date - i.lve_date_fr) < i.lve_aloc) then lc_nodays2 := lc_nodays2 + i.lve_aloc - (ld_eff_date - i.lve_date_fr); end if; else lc_nodays2 := lc_nodays2 + i.lve_aloc ; end if; end loop; END ; select nvl(sum(NVL(avail_days,0) + nvl(conv_days,0)),0) into lc_baldays from leavebal where emp_code = as_empcode and lve_code = as_lvecode and eff_date <= ad_date_fr and exp_date >= ad_date_to; END ; return (lc_baldays + lc_nodays2 - lc_nodays1 - lc_nodays); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_PL ( as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char) return number is mrate number(14,3); ls_type pricelist.list_type%type; begin select list_type into ls_type from pricelist where price_list = as_price_list and rownum = 1; if ls_type = 'L' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif ls_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INVOICE_VALUE_NEPAL (minvoice_id invoice.invoice_id%type , mtaxcd char) return number is lc_tot number(20,2); begin if mtaxcd = 'T' then select nvl(sum(QUANTITY__STDUOM*RATE__STDUOM),0) into lc_tot from invoice_trace where invoice_id = minvoice_id and substr(tax_env,1,2) = substr(tax_env,3,2); elsif mtaxcd = 'E' then select nvl(sum(QUANTITY__STDUOM*RATE__STDUOM),0) into lc_tot from invoice_trace where invoice_id = minvoice_id and tax_amt = 0 and rate > 0; elsif mtaxcd = 'RP' then select nvl(sum(a.QUANTITY__STDUOM*a.RATE__CLG),0) into lc_tot from pricelist b, invoice_trace a where a.invoice_id = minvoice_id and substr(a.tax_env,1,2) = substr(a.tax_env,3,2) and a.tax_amt <> 0 and b.price_list = 'MRP' and (b.chg_ref_no = 'RP' OR b.chg_ref_no is null) and b.item_code = a.item_code and a.lot_no between b.lot_no__from and b.lot_no__to; elsif mtaxcd = 'MRP' then select nvl(sum(a.QUANTITY__STDUOM*a.RATE__CLG),0) into lc_tot from pricelist b, invoice_trace a where a.invoice_id = minvoice_id and substr(a.tax_env,1,2) = substr(a.tax_env,3,2) and a.tax_amt <> 0 and b.price_list = 'MRP' and b.chg_ref_no = 'MRP' and b.item_code = a.item_code and a.lot_no between b.lot_no__from and b.lot_no__to; else select nvl(sum(QUANTITY__STDUOM*RATE__CLG),0) into lc_tot from invoice_trace where invoice_id = minvoice_id and substr(tax_env,1,2) = substr(tax_env,3,2) and tax_amt <> 0; end if; if sqlcode < 0 then return -1; end if; return lc_tot; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WFAPRV_USERCODE (AS_OBJ_NAME IN CHAR, AS_REF_SER IN CHAR, AS_REF_ID IN CHAR) return VARCHAR2 is SIGN_EMP_CODE char(10) := ''; BEGIN BEGIN --THIS FUNCTION HAS BEEN CREATED BY BIPIN ON 15/10/2010 If AS_REF_SER = 'C-VOU' Then -- THIS SQL WILL RETURN EMP CODE APRV FROM CASH_VOUCHER SELECT emp_code__aprv INTO SIGN_EMP_CODE FROM cash_voucher WHERE TRAN_ID = AS_REF_ID; ELSIF AS_REF_SER = 'A-VOU' Then -- THIS SQL WILL RETURN EMP CODE APRV FROM CASH_VOUCHER SELECT emp_code__aprv INTO SIGN_EMP_CODE FROM cash_voucher WHERE TRAN_ID = AS_REF_ID; ELSIF AS_REF_SER = 'S-VOU' Then -- THIS SQL WILL RETURN EMP CODE APRV FROM CASH_VOUCHER SELECT emp_code__aprv INTO SIGN_EMP_CODE FROM cash_voucher WHERE TRAN_ID = AS_REF_ID; ElsIf AS_REF_SER = 'M-VOUC' Then -- THIS SQL WILL RETURN ENTITY CODE FROM OBJ_SIGN_TRANS SELECT entity_code INTO SIGN_EMP_CODE FROM obj_sign_trans WHERE REF_SER = AS_REF_SER AND REF_ID = AS_REF_ID AND line_no IN (SELECT max(line_no) FROM obj_sign_trans WHERE ref_ser = AS_REF_SER AND ref_id = AS_REF_ID); End If; END; RETURN SIGN_EMP_CODE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_INVHOLDREL_LOTNO (as_tran_id IN INV_HOLD_REL_DET.TRAN_ID%TYPE) return VARCHAR2 is v_out VARCHAR2(4000) := ' '; begin v_out:=' '; BEGIN for r_lotno in ( SELECT distinct(INV_HOLD_DET.LOT_NO) as lot_no FROM INV_HOLD_REL_DET,INV_HOLD_DET WHERE ( INV_HOLD_REL_DET.TRAN_ID__HOLD = INV_HOLD_DET.TRAN_ID ) AND ( INV_HOLD_REL_DET.LINE_NO__HOLD = INV_HOLD_DET.LINE_NO ) AND INV_HOLD_REL_DET.TRAN_ID = as_tran_id) loop IF length(trim(v_out)) > 0 THEN v_out := v_out || ',' || TRIM(r_lotno.lot_no); ELSE v_out := TRIM(r_lotno.lot_no); END IF; end loop; EXCEPTION WHEN OTHERS THEN v_out := 'Error';-- END; RETURN v_out; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE VISITEDWITHMGRDARPOPHELP AS FUNCTION getWorkWithMGRData (empCode in char,resign_emp varchar) RETURN visteMGRDARMasterTABLE PIPELINED; END visitedWithMGRDARPophelp; CREATE OR REPLACE PACKAGE BODY VISITEDWITHMGRDARPOPHELP AS FUNCTION getWorkWithMGRData (empCode in char,resign_emp varchar) RETURN visteMGRDARMasterTABLE PIPELINED IS ls_item_ser VARCHAR2(5); begin select TRIM(item_ser) into ls_item_ser from sales_pers where sales_pers=empCode; if resign_emp = 'Y' then FOR x IN ( SELECT DISTINCT EMP_CODE AS SALES_PERS ,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS SP_NAME,CASE WHEN G.LEVEL_NO = 1 THEN 'TLM' WHEN G.LEVEL_NO = 2 THEN 'SLM' WHEN G.LEVEL_NO = 3 THEN 'FLM' WHEN G.LEVEL_NO = 4 THEN 'SO' ELSE 'NSM' END AS DESIGNATION,G.SH_DESCR as SH_DESCR ,STAN.DESCR AS STAN_DESCR,ST.DESCR AS STATE_DESCR,g.LEVEL_NO,emp.EMP_SITE,emp.RELIEVE_DATE FROM EMPLOYEE EMP, GRADE G,STATION STAN,STATE ST WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE AND emp.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE union SELECT A.EMP_CODE AS SALES_PERS, LTRIM(RTRIM(A.EMP_FNAME))||' '||LTRIM(RTRIM(A.EMP_MNAME))||' '||LTRIM(RTRIM(A.EMP_LNAME)) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS SP_NAME, CASE WHEN B.LEVEL_NO = 1 THEN 'TLM' WHEN B.LEVEL_NO = 2 THEN 'SLM' WHEN B.LEVEL_NO = 3 THEN 'FLM' WHEN B.LEVEL_NO = 4 THEN 'SO' ELSE ' ' END AS DESIGNATION, B.SH_DESCR AS SH_DESCR,STAN.DESCR AS STAN_DESCR,ST.DESCR AS STATE_DESCR,B.LEVEL_NO,A.EMP_SITE,A.RELIEVE_DATE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ORDER BY STATE_DESCR,STAN_DESCR,DESIGNATION ) LOOP PIPE ROW (visteMGRDARMaster(x.SALES_PERS,x.SP_NAME,x.DESIGNATION,x.SH_DESCR,x.STAN_DESCR,x.STATE_DESCR,x.LEVEL_NO,X.EMP_SITE,x.RELIEVE_DATE)); END LOOP; RETURN; else FOR x IN ( SELECT DISTINCT EMP_CODE AS SALES_PERS ,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS SP_NAME,CASE WHEN G.LEVEL_NO = 1 THEN 'TLM' WHEN G.LEVEL_NO = 2 THEN 'SLM' WHEN G.LEVEL_NO = 3 THEN 'FLM' WHEN G.LEVEL_NO = 4 THEN 'SO' ELSE 'NSM' END AS DESIGNATION,G.SH_DESCR as SH_DESCR ,STAN.DESCR AS STAN_DESCR,ST.DESCR AS STATE_DESCR,g.LEVEL_NO,emp.EMP_SITE,emp.RELIEVE_DATE FROM EMPLOYEE EMP, GRADE G,STATION STAN,STATE ST WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE AND emp.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE union SELECT A.EMP_CODE AS SALES_PERS, LTRIM(RTRIM(A.EMP_FNAME))||' '||LTRIM(RTRIM(A.EMP_MNAME))||' '||LTRIM(RTRIM(A.EMP_LNAME)) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS SP_NAME, CASE WHEN B.LEVEL_NO = 1 THEN 'TLM' WHEN B.LEVEL_NO = 2 THEN 'SLM' WHEN B.LEVEL_NO = 3 THEN 'FLM' WHEN B.LEVEL_NO = 4 THEN 'SO' ELSE ' ' END AS DESIGNATION, B.SH_DESCR AS SH_DESCR,STAN.DESCR AS STAN_DESCR,ST.DESCR AS STATE_DESCR,B.LEVEL_NO,A.EMP_SITE,A.RELIEVE_DATE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ORDER BY STATE_DESCR,STAN_DESCR,DESIGNATION ) LOOP PIPE ROW (visteMGRDARMaster(x.SALES_PERS,x.SP_NAME,x.DESIGNATION,x.SH_DESCR,x.STAN_DESCR,x.STATE_DESCR,x.LEVEL_NO,X.EMP_SITE,x.RELIEVE_DATE)); END LOOP; RETURN; end if; end; END visitedWithMGRDARPophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_WORKER_CODE (AS_COLUMN_NAME VARCHAR2,AS_TRAN_ID char) return VARCHAR2 is LOCATION_CODE_FROM VARCHAR2(8); begin if (AS_COLUMN_NAME='LOC_CODE_TO') then select distinct l.loc_code into LOCATION_CODE_FROM from stock_transfer_det std,location l where std.tran_id=AS_TRAN_ID and std.loc_code__to=l.loc_code; end if; IF LOCATION_CODE_FROM IS NULL THEN LOCATION_CODE_FROM :=''; END IF; return LOCATION_CODE_FROM; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_MSLKT (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char) return number is mrate number(14,3); ls_type char(1); begin begin select list_type into ls_type from pricelist where price_list = as_price_list and rownum = 1; exception when others then ls_type := 'L'; end; if ls_type = 'L' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif ls_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = 'MSLKT' and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no; -- and eff_from <= ad_tran_date -- and valid_upto >= ad_tran_date; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_BUCODE_DESCR (as_bu_code char) return varchar2 is ls_descr varchar2(120); begin begin select descr into ls_descr from BUSINESS_UNITS where bu_code = as_bu_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_DAYS (day_avail char) RETURN VARCHAR2 IS day_name varchar2(10); BEGIN IF day_avail='0' THEN RETURN 'Sunday'; ELSIF day_avail='1' THEN RETURN 'Monday'; ELSIF day_avail='2' THEN RETURN 'Tuesday'; ELSIF day_avail='3' THEN RETURN 'Wednesday'; ELSIF day_avail='4' THEN RETURN 'Thrusday'; ELSIF day_avail='5' THEN RETURN 'Friday'; ELSIF day_avail='6' THEN RETURN 'Saturday'; ELSE RETURN ' '; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_STATUS (AS_EMP_CODE char,AS_DATE date,AS_TYPE char) return char is a_cadre employee.cadre%type; a_grade employee.grade%type; a_emp_site employee.emp_site%type; a_pay_site employee.pay_site%type; a_wrk_site employee.work_site%type; a_dept_code employee.dept_code%type; a_work_shift employee.work_shift%type; a_stan_code_hq employee.stan_code__hq%type; a_status varchar2(5); a_eff_date date; a_conf_date date; a_chg_date date; a_count number(5); begin if (AS_TYPE in ('C','G')) then -- Cadre and Grade declare cursor c1 is select date__effchg eff_date,conf_date,chg_date,cadre_o cadre,grade_o grade from emp_statuschg where emp_code = AS_EMP_CODE and date__effchg > AS_DATE and confirm = 'Y' union all select eff_date,conf_date,chg_date,cadre_code_fr cadre,grade_code_fr grade from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y'; begin for i in c1 loop if (a_eff_date is null) then a_cadre := i.cadre; a_grade := i.grade; a_eff_date := i.eff_date; a_conf_date := i.conf_date; a_chg_date := i.chg_date; else if (i.eff_date < a_eff_date) then a_cadre := i.cadre; a_grade := i.grade; a_eff_date := i.eff_date; a_conf_date := i.conf_date; a_chg_date := i.chg_date; elsif (i.eff_date = a_eff_date) then if (i.conf_date < a_conf_date) then a_cadre := i.cadre; a_grade := i.grade; a_conf_date := i.conf_date; a_chg_date := i.chg_date; elsif (i.conf_date = a_conf_date) then if (i.chg_date < a_chg_date) then a_cadre := i.cadre; a_grade := i.grade; a_chg_date := i.chg_date; end if; end if; end if; end if; end loop; if (trim(a_cadre) is null) then select cadre into a_cadre from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_grade) is null) then select grade into a_grade from employee where emp_code = AS_EMP_CODE; end if; if (AS_TYPE = 'C') then a_status := a_cadre; elsif (AS_TYPE = 'G') then a_status := a_grade; end if; end; elsif (AS_TYPE in ('S','P','W','D')) then -- Employment Site, Pay Site, Work Site and Department Code declare cursor c2 is select eff_date,conf_date,chg_date,site_code__emp_fr emp_site,site_code__pay_fr pay_site,site_code__wrk_fr wrk_site, dept_code__fr dept_code from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' order by emp_code,eff_date; begin for i in c2 loop if (i.eff_date != a_eff_date and a_eff_date is not null) then exit; end if; if (a_conf_date is null) then a_emp_site := i.emp_site; a_pay_site := i.pay_site; a_wrk_site := i.wrk_site; a_dept_code := i.dept_code; a_conf_date := i.conf_date; a_chg_date := i.chg_date; else if (i.conf_date < a_conf_date) then a_emp_site := i.emp_site; a_pay_site := i.pay_site; a_wrk_site := i.wrk_site; a_dept_code := i.dept_code; a_conf_date := i.conf_date; a_chg_date := i.chg_date; elsif (i.conf_date = a_conf_date) then if (i.chg_date < a_chg_date) then a_emp_site := i.emp_site; a_pay_site := i.pay_site; a_wrk_site := i.wrk_site; a_dept_code := i.dept_code; a_chg_date := i.chg_date; end if; end if; end if; a_eff_date := i.eff_date; end loop; if (trim(a_emp_site) is null) then select emp_site into a_emp_site from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_pay_site) is null) then select pay_site into a_pay_site from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_wrk_site) is null) then select work_site into a_wrk_site from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_dept_code) is null) then select dept_code into a_dept_code from employee where emp_code = AS_EMP_CODE; end if; if (AS_TYPE = 'S') then a_status := a_emp_site; elsif (AS_TYPE = 'P') then a_status := a_pay_site; elsif (AS_TYPE = 'W') then a_status := a_wrk_site; elsif (AS_TYPE = 'D') then a_status := a_dept_code; end if; end; elsif (AS_TYPE = 'H') then -- Work Shift select count(*) into a_count from work_shift where emp_code = AS_EMP_CODE and AS_DATE between from_dt and to_dt; if (a_count != 0) then select shift into a_work_shift from work_shift where emp_code = AS_EMP_CODE and AS_DATE between from_dt and to_dt; end if; if (a_work_shift is null) then declare cursor c3 is select work_shift from ( select tran_date eff_date,work_shift_o work_shift,conf_date,chg_date from employee_det_change where emp_code = AS_EMP_CODE and tran_date > AS_DATE and status = 'C' union all select eff_date,work_shift__fr work_shift,conf_date,chg_date from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' ) order by eff_date,conf_date,chg_date; begin for i in c3 loop a_work_shift := i.work_shift; exit; end loop; end; end if; if (a_work_shift is null) then select work_shift into a_work_shift from employee where emp_code = AS_EMP_CODE; end if; a_status := a_work_shift; elsif (AS_TYPE = 'Q') then -- Station Code HQ declare cursor c4 is select stan_code_hq from ( select tran_date eff_date,stan_code__hq_o stan_code_hq,conf_date,chg_date from employee_det_change where emp_code = AS_EMP_CODE and tran_date > AS_DATE and status = 'C' union all select eff_date,stan_code__hq_fr stan_code_hq,conf_date,chg_date from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' ) order by eff_date,conf_date,chg_date; begin for i in c4 loop a_stan_code_hq := i.stan_code_hq; exit; end loop; end; if (a_stan_code_hq is null) then select stan_code__hq into a_stan_code_hq from employee where emp_code = AS_EMP_CODE; end if; a_status := a_stan_code_hq; end if; return a_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STATION_NAME (mstan_code in char) return varchar2 is mstan_descr station.descr%type; begin select descr into mstan_descr from station where stan_code = mstan_code; return mstan_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_EXCISE_TAX (as_tran_code IN VARCHAR2, as_tran_id IN VARCHAR2, as_tax_code IN VARCHAR2, as_acct_code IN VARCHAR2) RETURN VARCHAR2 IS AS_VALUE VARCHAR2(50); ls_var_value VARCHAR2(100); ls_errcode VARCHAR2(100); BEGIN select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = as_acct_code; select distinct tax_form into AS_VALUE from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code AND ACCT_CODE = ls_var_value; return AS_VALUE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DISC_PERC (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, as_qty in number) return number is mrate number(14,3); begin select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'M' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and as_qty between min_qty and max_qty; return nvl(mrate,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SOIT_SITECUSTDUE ON SORDITEM (SITE_CODE, CUST_CODE__DLV, DUE_DATE, SALE_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SM_SALES_SITE_SITE_IS ON SM_SALES_SITE (SITE_CODE, ITEM_CODE, ITEM_SER, PRD_CODE, LEVEL_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FINCHG (ac_amount in number,al_no_days in number,as_crterm in char,ad_tran in date) return number is lc_intamt number(20,2); lc_finchg number(20,2); ls_type char; begin select fin_chg, fchg_type into lc_finchg, ls_type from crtermfc where cr_term = as_crterm and al_no_days >= min_day and al_no_days <= max_day and ac_amount >= min_cramt and ac_amount <= max_cramt and ad_tran >= eff_date and ad_tran <= valid_upto ; if SQLCODE <> 0 then lc_intamt := 0; else if ls_type = 'P' then lc_intamt := ((ac_amount * lc_finchg / 100 ) /365) * al_no_days; elsif ls_type = 'F' then lc_intamt := lc_finchg; else return -1; end if; end if; Return lc_intamt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RESTR_PRC_SITE_X ON RESTR_PRC_SITE (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_NEW_OTH (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_disparm_code in char, ls_disparm_code_1 in char, ls_disparm_code_2 in char) return number is lc_tax_amt number(14,3); LS_VAR_VALUE VARCHAR(2000); LS_VAR_VALUE1 VARCHAR(2000); LS_VAR_VALUE2 VARCHAR(2000); begin begin select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = ls_disparm_code; select (rtrim(var_value)) into ls_var_value1 from disparm where prd_code = '999999' AND VAR_NAME = ls_disparm_code_1; select (rtrim(var_value)) into ls_var_value2 from disparm where prd_code = '999999' AND VAR_NAME = ls_disparm_code_2; SELECT SUM(TAX_AMT) into lc_tax_amt FROM taxtran ti, tax tx WHERE tx.tax_code = ti.tax_code AND ti.tran_code = ls_tran_code AND TI.TRAN_ID = ls_tran_id AND TX.TAX_TYPE NOT IN ('H','I','J') AND TI.LINE_NO = ls_line_no AND ( tx.TAX_CODE NOT IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) and tx.TAX_CODE NOT IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE1)) ) and tx.TAX_CODE NOT IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE2)) ) ); EXCEPTION WHEN NO_DATA_FOUND THEN lc_tax_amt := 0 ; END ; RETURN LC_TAX_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MANUFACT (ls_refser varchar2,as_flg varchar2, ls_ref_id varchar2) return varchar2 is ls_descr varchar2(240); ls_trandt date ; ls_name varchar2(240); ls_addr1 varchar2(40); ls_addr2 varchar2(40); ls_city varchar2(20); ls_pin varchar2(10); ls_stan varchar2(10); ls_eccno varchar2(30); mfin_ent varchar2(10); mquantity DECIMAL(14,3); mdescr varchar2(40); mecc_param varchar2(20); mref_ser varchar2(10); mecc_no NUMBER; mtran_date DATE; msite_code varchar2(10); MSUPP_CODE varchar2(10); mitem_code varchar2(10); mexcise_ref varchar2(10); mrate NUMBER(14,3); mgp_no NUMBER; begin if trim(ls_refser) = 'P-RCP' then SELECT nvl(SUPP_NAME,''), nvl(ADDR1,''), nvl(ADDR2,''), nvl(CITY,''), nvl(PIN,'') ,nvl(STATE_CODE,''),nvl(ECC_NO,'') into ls_name, ls_addr1, ls_addr2, ls_city, ls_pin ,ls_stan,ls_eccno from supplier , porcp where supplier.supp_code = porcp.supp_code and trim(porcp.tran_id) = trim(ls_ref_id ) ; elsif trim(ls_refser) = 'D-RCP' then SELECT nvl(site.descr,''), nvl(ADD1,''), nvl(ADD2,''), nvl(CITY,''), nvl(PIN ,'') into ls_name, ls_addr1, ls_addr2, ls_city, ls_pin from site , distord_rcp where site.site_code = distord_rcp.site_code and trim(distord_rcp.tran_id) = trim(ls_ref_id ) ; end if ; IF as_flg = 'NAME' then ls_descr := trim(ls_name); ElsIf as_flg = 'ADDR1' then ls_descr:= trim(ls_addr1); ElsIf as_flg = 'ADDR2' then ls_descr := trim(ls_addr2); ElsIf as_flg = 'CITY' then ls_descr :=trim(ls_city); ElsIf as_flg = 'PIN' then ls_descr := trim(ls_pin); elsif as_flg = 'STATCD' then ls_descr := trim(ls_stan); elsif as_flg = 'QUANTITY' then ls_descr := trim(TO_CHAR(mquantity)); elsif as_flg = 'RATE' then ls_descr :=trim(TO_CHAR(mrate)); elsif as_flg = 'REF' then ls_descr :=trim( mref_ser); elsif as_flg = 'GP_EX_NO' then If mref_ser = 'P-RCP' then ls_descr := trim(mexcise_ref); Else ls_descr := mgp_no; End If; END IF; if trim(ls_descr) is null then ls_descr := 'NA'; end if; return ls_descr ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE VISITRELMASTER AS OBJECT ( Report_to char(10), Designation VARCHAR2(25) , Visited_with VARCHAR2(80), GRADE_TYPE CHAR(1), RESIGN_EMP CHAR(1), STATUS VARCHAR2(10) , VISITED_WITH_DISPLAY VARCHAR2(80), LEVEL_NO NUMBER(3), DESIGN_CODE CHAR(5) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ADVANCE (as_sundry_type char,as_sundry_code char) return char is ls_advance char(50); ldt_advamt misc_payables.tot_amt%type; begin select sum(tot_amt - adj_amt) into ldt_advamt from misc_payables where sundry_type = as_sundry_type and sundry_code = as_sundry_code and tran_ser = 'M-ADV' and tot_amt - adj_amt < 0; if ldt_advamt < 0 then ldt_advamt := abs(ldt_advamt); ls_advance := 'Advance unadjusted >> ' || ldt_advamt; else ls_advance := ''; end if; return ls_advance; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALCBACKTAX_DC (ls_tran_id in char, ls_item_code in char, ls_tran_code in char) return number is ld_tax_amt number(14,3); begin SELECT NVL(SUM(taxtran.tax_amt * -1),0) into ld_tax_amt FROM tax, taxtran ,sreturndet, sreturn WHERE ( tax.tax_code = taxtran.tax_code ) AND ( taxtran.tran_id = sreturn.tran_id__crn ) AND ( sreturndet.tran_id = sreturn.tran_id ) AND ( to_number(taxtran.line_no) = sreturndet.line_no ) and ( ( taxtran.tran_code = ls_tran_code ) AND ( taxtran.tran_id = ls_tran_id ) AND ( sreturndet.item_code = ls_item_code ) and ( taxtran.tax_amt > 0 ) AND ( tax.print_tax = 'Y' ) and ( tax.effect <> 'N' )) ; return ld_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_VENDOR_REQ_STATUS ( as_supp_code__mnfr CHAR, as_site_code CHAR, AS_item_code CHAR, as_tran_date date) RETURN NUMBER IS FLAG NUMBER(1); AS_STATUS itemmnfr.status%type; BEGIN SELECT STATUS INTO AS_STATUS FROM(SELECT B.STATUS AS STATUS FROM SUPP_APPRV_ITEM B, SUPP_APPRV A WHERE B.SITE_CODE = as_site_code and A.SUPP_CODE__MNFR=B.supp_code__mnfr AND B.ITEM_CODE = as_item_code AND B.SUPP_CODE__MNFR = as_supp_code__mnfr AND B.STATUS <> 'I' and A.APPRV_SCOPE = 'I' and as_tran_date between B.EFF_FROM and B.VALID_UPTO UNION SELECT B.STATUS AS STATUS FROM SUPP_APPRV a, SUPP_APPRV_SITE b WHERE a.SUPP_CODE__MNFR = b.supp_code__mnfr AND b.SUPP_CODE__MNFR = as_supp_code__mnfr AND b.SITE_CODE = as_site_code AND b.STATUS <> 'I' AND A.APPRV_SCOPE = 'S' and as_tran_date between b.EFF_FROM and b.VALID_UPTO UNION SELECT B.STATUS AS STATUS FROM SUPP_APPRV a, ITEMMNFR b WHERE a.SUPP_CODE__MNFR = b.supp_code__mnfr AND b.SUPP_CODE__MNFR = as_supp_code__mnfr AND b.ITEM_CODE = as_item_code AND b.STATUS <> 'I' and a.APPRV_SCOPE = 'T' AND as_tran_date between b.EFF_FROM and b.VALID_UPTO UNION SELECT B.STATUS AS STATUS FROM SUPP_APPRV a, SUPP_APPRV_SITE b WHERE a.SUPP_CODE__MNFR = b.supp_code__mnfr AND b.SUPP_CODE__MNFR = as_supp_code__mnfr AND b.STATUS <> 'I' and a.APPRV_SCOPE = 'V' and as_tran_date between b.EFF_FROM and b.VALID_UPTO) A; IF AS_STATUS = 'Q' THEN FLAG := 0; RETURN (FLAG); ELSE FLAG := 1; RETURN (FLAG); END IF; exception WHEN NO_DATA_FOUND THEN FLAG :=1; return FLAG; when others then FLAG :=1; return FLAG; END FN_CHK_VENDOR_REQ_STATUS; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001089432 ON MAILING_LIST (MAIL_LIST_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001089431 ON MKTG_CAMPAIGN (CAMPAIGN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ASSET_DEPR_WB_X ON ASSET_DEPR_WB (ASSET_CODE, ACCT_PRD, ITEM_SER, GRP_CODE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_FEEDBK_CONSISTENCY BEFORE insert or UPDATE ON ser_req_feedbk referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_feedbkcount number(3) := 0; ll_count number(6) := 0; ll_mismatchcount number(3) := 0; ls_msg varchar2(4000); lc_allocqty invalloc_trace.alloc_qty%type := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_feedbkcount from ser_req_feedbk_item d, item i where d.item_code = i.item_code and d.feedbk_id = :new.feedbk_id and i.stk_opt <> '0'; exception when others then ll_feedbkcount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'S-FBK' and ref_id = :new.feedbk_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_feedbkcount then raise_application_error( -20601, 'Invtrace not updated for all the details trace count [' || to_char(ll_invcount) || '] detail count [' || to_char(ll_feedbkcount) ||']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LOANS_EMP_LOAN_NO ON LOANS (EMP_CODE, LOAN_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUN_GET_MRP_RED_VOUCH (MPRCPID IN CHAR, MLINENO IN CHAR, MITM IN CHAR) RETURN NUMBER IS MAMT NUMBER; ID VARCHAR2(10); MLOT CHAR(15); BEGIN SELECT LOT_NO INTO MLOT FROM PORCPDET WHERE TRAN_ID = MPRCPID AND trim(LINE_NO) = trim(MLINENO); SELECT NVL(CHG_REF_NO,'RP') INTO ID FROM PRICELIST WHERE PRICE_LIST = 'MRP' AND ITEM_CODE = MITM AND MLOT BETWEEN LOT_NO__FROM AND LOT_NO__TO; IF ID = 'MRP' THEN MAMT := 1; ELSE MAMT := 0; END IF; RETURN MAMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIVABLES_CUSTOMER ON RECEIVABLES (CUST_CODE, ITEM_SER, TOT_AMT, ADJ_AMT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083530 ON RESOURCE_BASIS (RES_BAS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UC_BUILDINGPROJ ON PROJ_BUILDING (PHASE_CODE, PROJ_CODE, CLSTR_CODE, BLDG_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_MISC_DRCR_RCP ON MISC_DRCR_RCP (DISHNR_TRAN_REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EXP_APRVLEV (as_emp_code char , as_aprv_lev number) return NUMBER is lc_ret_aprvlev number(1); ls_emp_code char(10); ls_report_to char(10); ls_with_held char(1); ld_relieve date; lc_no number(3); begin lc_ret_aprvlev := 0; select report_to into ls_emp_code from employee where emp_code = as_emp_code; if ls_emp_code is null or length(trim(ls_emp_code)) = 0 then return ''; end if; loop select report_to , case when with_held is null then 'N' else with_held end, relieve_date into ls_report_to,ls_with_held,ld_relieve from employee where emp_code =ls_emp_code; if ls_with_held = 'Y' or ld_relieve is not null then if ls_report_to is null or length(trim(ls_report_to)) = 0 then exit; end if; ls_emp_code := ls_report_to; else lc_ret_aprvlev := lc_ret_aprvlev + 1; if lc_ret_aprvlev < as_aprv_lev then if ls_report_to is null or length(trim(ls_report_to)) = 0 then exit; end if; ls_emp_code := ls_report_to; else exit; end if; end if; end loop; return lc_ret_aprvlev; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BANKTRAN_LOG_TRAN_SER_NO ON BANKTRAN_LOG (TRAN_SER, TRAN_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CALLRATE (as_item_code char) return char is ls_callrate_code varchar2(3); ls_itemser item.item_ser%type; begin select item_ser into ls_itemser from item where item_code = as_item_code; if (ls_itemser = 'BD' ) or (ls_itemser = 'BDI' )then ls_callrate_code := '055'; else ls_callrate_code := '070'; end if; return ls_callrate_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_STMD AFTER UPDATE OF CONFIRMED ON stn_amd REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ls_tranid e_invoice.tran_id%type; ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN begin select tran_id into ls_tranid from e_invoice where ref_ser = 'D-ISS' and ref_id = :new.ref_id; exception when others then ls_tranid := null; end; if ls_tranid is not null then begin update e_invoice set Trans_Mode = (select case when :new.trans_mode = 'R' then '1' when :new.trans_mode = 'L' then '2' when :new.trans_mode = 'A' then '3' when :new.trans_mode = 'S' then '4' else '1' end from dual), -- Road-1, Rail-2, Air-3, Ship-4 TRAN_gstn = (select case when t.tax_reg_2 = 'UNREGISTER' then ' ' else t.tax_reg_2 end from transporter t where t.tran_code = :new.tran_code), lr_date = :new.lr_date, lr_no = :new.lr_no, lorry_no = :new.lorry_no, Vehicle_Type = 'R', tran_name = (select t.tran_name from transporter t where t.tran_code = :new.tran_code) where tran_id = ls_tranid; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to update data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_QC_SAMPLE_CHK BEFORE UPDATE OF confirmed ON qc_sample referencing old as old new as new FOR EACH ROW DECLARE ll_invcount number(3) := 0; ll_qcsamplecount number(3) := 0; lc_allocqty number(14,3) := 0; lc_allocqtydet number(14,3) := 0; ll_balcount number(3) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_qcsamplecount from qc_sample_stk where tran_id = :new.tran_id; exception when others then ll_qcsamplecount := 0; end; begin select count(1) into ll_balcount from qc_sample_stk where tran_id = :new.tran_id and nvl(bal_qty,0) <> 0; exception when others then ll_balcount := 0; end; ll_qcsamplecount := ll_qcsamplecount + ll_balcount; begin select count(1) into ll_invcount from invtrace where ref_ser = 'W-QCS' and ref_id = :new.tran_id; exception when others then ll_invcount := 0; end; if ll_qcsamplecount <> ll_invcount then raise_application_error( -20601, 'Invtrace not updated for all the details inv count [' || to_char(ll_invcount) || '] detail count [' || to_char(ll_qcsamplecount) || ']' ); end if; ---- 18-sep-15 to check header and detail lot_no and lot_sl if length(trim(:new.lot_no)) > 0 and length(trim(:new.lot_sl)) > 0 then ll_qcsamplecount := 0; select count(1) into ll_qcsamplecount from qc_sample_stk where tran_id = :new.tran_id and (lot_no <> :new.lot_no or lot_sl <> :new.lot_sl); if ll_qcsamplecount > 0 then raise_application_error( -20601, 'Stock issued in detail is different then header stock information for [' || to_char(ll_qcsamplecount) || '] detail lines' ); end if; end if; --- added to allocation check and update the consistancy_chk flag [start]--------------- begin select sum(alloc_qty) into lc_allocqty from invalloc_trace where ref_ser = 'W-QCS' and ref_id = :new.tran_id; exception when others then lc_allocqty:=0; end; lc_allocqtydet:=0; /* begin select sum(alloc_qty) into lc_allocqtydet from invalloc_det where ref_ser = 'W-QCS' and ref_id = :new.tran_id; exception when others then lc_allocqtydet:=0; end; */ if lc_allocqty <> 0 or lc_allocqtydet <> 0 then raise_application_error( -20601, 'Allocation quantity is non-zero, invalloc_trace or invalloc_det not updated for all the details lc_allocqty [' || to_char(lc_allocqty) ||'] lc_allocqtydet [' || to_char(lc_allocqtydet) || ']'); else :new.consistancy_chk := 'Y'; end if; --- added to allocation check and update the consistancy_chk flag [end]--------------- end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_PO_DISCOUNT_VAL (as_po porder.purc_order%type) -- Rahul K Khanolkar -- 24-jul-02 -- -- Return total discount value for that PO. return number is ldec_val number(14,3); begin select discount into ldec_val from porddet where purc_order = as_po and rownum = 1; return ldec_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STK_LOCATION ( ls_site_code in char, ls_item_code in char, ls_loc_code in char, ad_from_date in date, ls_available in char) return number is ld_eff_qty number(14,3); begin select nvl(sum(qty),0) into ld_eff_qty from (SELECT nvl(sum(a.quantity),0) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and a.site_code = ls_site_code and a.item_code = ls_item_code and a.loc_code = ls_loc_code and b.available = ls_available and b.stat_type <> 'S' UNION ALL select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.item_code = ls_item_code and a.site_code = ls_site_code and a.loc_code = ls_loc_code and a.eff_date > ad_from_date and c.stat_type <> 'S' and c.available = ls_available); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GRADE_SH_DESCR ( emp_code__org char) return varchar2 is sh_descr VARCHAR2(20); begin SELECT GRD.SH_DESCR INTO SH_DESCR FROM EMPLOYEE EMP LEFT OUTER JOIN GRADE GRD ON EMP.GRADE = GRD.GRADE_CODE WHERE EMP.EMP_CODE=emp_code__org; return sh_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPICK_MRP_PTR ( as_item_code IN CHAR, as_tran_date IN DATE, as_lot_no IN CHAR, as_var_name IN CHAR ) RETURN NUMBER IS mrate NUMBER(14,3); ls_val VARCHAR(200); BEGIN SELECT var_value INTO ls_val FROM disparm WHERE var_name = as_var_name; BEGIN SELECT NVL(x.rate,0) INTO mrate FROM ( SELECT p1.rate FROM pricelist p1 WHERE p1.item_code = as_item_code AND as_tran_date BETWEEN p1.eff_from AND p1.valid_upto AND p1.lot_no__from <= as_lot_no AND p1.lot_no__to >= as_lot_no AND p1.slab_no = ( SELECT MAX(p2.slab_no) FROM pricelist p2 WHERE p2.price_list = p1.price_list AND p2.item_code = p1.item_code AND as_tran_date BETWEEN p2.eff_from AND p2.valid_upto AND (p1.lot_no__from BETWEEN p2.lot_no__from AND p2.lot_no__to) AND p2.price_list IN ( SELECT var_value FROM disparm WHERE var_name = as_var_name ) ) ORDER BY p1.slab_no DESC ) x WHERE ROWNUM = 1; EXCEPTION WHEN NO_DATA_FOUND THEN mrate := 0; END; RETURN NVL(mrate,0); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_QUALIFICATION_DESCR (AS_QUAL_CODE In CHAR) RETURN VARCHAR2 IS QUAL_DESCR VARCHAR2(200); BEGIN QUAL_DESCR := ''; begin --SELECT DESCR INTO QUAL_DESCR FROM GENCODES WHERE QLF_CODE = AS_QUAL_CODE; SELECT DESCR INTO QUAL_DESCR FROM GENCODES WHERE FLD_NAME='COURSE_TYPE' AND MOD_NAME IN ('W_EMP_COMPLETE','X') AND CASE WHEN ACTIVE IS NULL THEN 'Y' ELSE ACTIVE END = 'Y' AND FLD_VALUE = AS_QUAL_CODE; EXCEPTION WHEN NO_DATA_FOUND THEN QUAL_DESCR := ''; END; return qual_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGETPACK_CODE (as_item_code in varchar2,as_unit in varchar2,as_lot_no in varchar2,as_quantity in number) return number is newqty number(14,2); ls_unit_pack varchar2(100) ; mround varchar2(100) ; mconv number(15,3) ; mrndto number(15,3) ; mcnt number(15,3) ; Begin select unit__pack into ls_unit_pack from item_lot_packsize where item_code = as_item_code and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no; if ls_unit_pack = as_unit then return as_quantity; end if; Select Count(*) into mcnt from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = as_item_code; if mcnt = 0 then Select Count(*) into mcnt from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = 'X'; Select Fact, Round, round_to into mconv,mround,mrndto from UomConv where unit__fr =ls_unit_pack and unit__to = as_unit and item_code = 'X'; else Select Fact, Round, round_to into mconv,mround,mrndto from UomConv where unit__fr = ls_unit_pack and unit__to = as_unit and item_code = as_item_code; end if; newqty := as_quantity / mconv; if Upper(mround) = 'X' then newqty := newqty - mod(newqty, mrndto) + mrndto; elsif Upper(mround) = 'P' then newqty := newqty - mod(newqty, mrndto); elsif Upper(mround) = 'R' then if mod(newqty, mrndto) < mrndto/2 then newqty := newqty - mod(newqty, mrndto); else newqty := newqty - mod(newqty, mrndto) + mrndto; end if; end if; if newqty is null or newqty <= 0 then newqty := 0; end if; return newqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CNF_COMM_HDR_X ON CNF_COMM_HDR (SITE_CODE, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PAYMENT_DET (as_vouch_id char , as_transer char) return varchar2 is ls_str varchar2(1000); ls_tranid char(10); ls_transer char(6); ls_paymode char(1); ls_empcode char(10); ls_bank varchar2(40); ls_acct varchar2(15); ls_refno char(20); ls_bank_code char(10); ls_drawn_at varchar2(60); ls_instr_no char(20); ld_paydate date; ld_refdate date; ld_instr_date date; ld_duedate date; cursor c_cursor is select misc_payment.tran_id, misc_payment.tran_date, misc_payment.pay_mode, misc_payment.sundry_code,misc_payment.ref_date, misc_payment.ref_no, misc_payment.bank_code, nvl(misc_paydet.instr_no,' '), nvl(misc_paydet.instr_date,misc_payment.tran_date), nvl(misc_paydet.drawn_at,' ') from misc_paydet , misc_payment where misc_paydet.tran_id = misc_payment.tran_id and tran_ser = as_transer and vouch_no = as_vouch_id; begin open c_cursor; fetch c_cursor into ls_tranid, ld_paydate, ls_paymode, ls_empcode,ld_refdate, ls_refno, ls_bank_code, ls_instr_no,ld_instr_date, ls_drawn_at; if c_cursor%NOTFOUND then select nvl(employee.bank_acct,' '), nvl(bank.bank_name,' '), misc_voucher.due_date into ls_acct , ls_bank , ld_duedate from employee , bank , misc_voucher where misc_voucher.sundry_code = employee.emp_code and nvl(employee.bank_code,' ') = bank.bank_code and misc_voucher.tran_id = as_vouch_id; ls_str := 'Amountkashi will be transfered' || 'to your saving' || ' bank account no ' || ls_acct || ' of ' || ls_bank || ' around ' || to_char(to_date(ld_duedate),'dd/mm/yy') || '~r~n'; close c_cursor; return ls_str ; end if; loop EXIT WHEN c_cursor%NOTFOUND ; ls_str := 'Payment No - ' || ls_tranid || ' Payment Dt - ' || to_char(to_date(ld_paydate),'dd/mm/yy') || '~r~n'; if ls_paymode = 'C' then ls_str := ls_str || 'CASH PAID' || '~r~n'; elsif ls_paymode = 'T' then select nvl(employee.bank_acct,' '), nvl(bank.bank_name,' ') into ls_acct , ls_bank from employee , bank, misc_voucher where employee.emp_code = misc_voucher.sundry_code and nvl(employee.bank_code,' ') = bank.bank_code and misc_voucher.tran_id = as_vouch_id; ls_str := ls_str || 'Amountkashi has been ' || 'transferred to your' || ' saving bank account no ' || ls_acct || ' of ' || ls_bank || ' around. ' || to_char(to_date(ld_refdate),'dd/mm/yy') || '~r~n'; elsif ls_paymode = 'Q' then Select bank_name into ls_bank from bank where bank_code = ls_bank_code; ls_str := ls_str || 'Chq No - ' || ls_refno || ' Dt. ' || to_char(to_date(ld_refdate),'dd/mm/yy') || ' Drawn on ' || ls_bank || '~r~n'; else ls_str := ls_str || 'DD No - ' || ls_instr_no || ' Dt - ' || to_char(to_date(ld_instr_date),'dd/mm/yy') || ' Drawn on ' || ls_drawn_at || '~r~n'; end if; fetch c_cursor into ls_tranid, ld_paydate, ls_paymode, ls_empcode, ld_refdate, ls_refno, ls_bank_code, ls_instr_no, ld_instr_date, ls_drawn_at; end loop ; close c_cursor; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DISC_DET_TRANFLOW (as_disc_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.max_quantity ,b.rate,b.offer_rate,b.mrp_rate from item a ,disc_apr_strg_det b where a.item_code = b.item_code and b.tran_id=as_disc_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3,v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Maximum Quantity'||''||''||'Rate'||''||''||'Offer Rate'||''||''||'MRP Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHANGE_HOLIDAY (AS_HOL_TBLNO CHAR ,AS_HOL_DATE DATE,AS_EMP_CODE char) return date is a_hol_date date; begin SELECT distinct h.hol_date into a_hol_date FROM holiday H WHERE H.HOL_DATE NOT IN( SELECT HOL_DATE_FOR FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND H.HOL_TBLNO=HOL_TBLNO AND HOL_DATE_FOR =AS_HOL_DATE) AND HOL_DATE =AS_HOL_DATE AND HOL_TBLNO=AS_HOL_TBLNO; return a_hol_date; exception when no_data_found then begin SELECT DISTINCT HOL_DATE_TO into a_hol_date FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND HOL_TBLNO = AS_HOL_TBLNO AND HOL_DATE_FOR =AS_HOL_DATE; return a_hol_date; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCISE_EXT (as_tran_id porcp.tran_id%type,as_line_no porcpdet.line_no%type,as_tran_code taxtran.tran_code%type,as_tax_code taxtran.tax_code%type) return number is ldec_excise number(2,2); begin select tax_perc into ldec_excise from taxtran where tran_id = trim(as_tran_id) and ltrim(rtrim(line_no)) = trim(as_line_no) and tran_code = trim(as_tran_code) and ltrim(rtrim(tax_code)) like trim(as_tax_code) ; return ldec_excise; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WRK_DT (as_login in varchar, as_sales_ww in varchar, as_date in date) return varchar is as_value varchar(1000); first_date date; prev_date date; CURSOR c1 iS select distinct event_date from strg_meet where trim(sales_pers) = as_login and event_date <= as_date and trim(sprs_code__ww) = as_sales_ww and event_type = 'JW' order by event_date desc; begin FOR I IN C1 loop first_date := i.event_date; if prev_Date is null then as_value := to_char(first_date,'dd/MM/yy'); elsif prev_date - first_date = 1 then as_value := as_value || ',' || to_char(first_date,'dd/MM/yy') ; else exit; end if; prev_Date := i.event_date; end loop; return as_value ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_DETAIL_KUSUM_DO (ls_tran_code in char,ls_tran_id in char, ls_line_no in char,ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; as_line_no char(3); lc_exch_rate number(17,6); begin ---as_line_no := substr('' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where trim(tran_code) = trim(ls_tran_code) and trim(tran_id) = trim(ls_tran_id) and trim(line_no) = trim(as_line_no) and instr(','||TRIM(ls_var_value)||',',','||trim(tax_code)||',') > 0 ; end if; -- tax % if ls_type = 'P' then select MIN(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(','||TRIM(ls_var_value)||',',','||trim(tax_code)||',') > 0 ; end if; -- taxable amt if ls_type = 'A' then select MIN(taxable_amt) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(','||TRIM(ls_var_value)||',',','||trim(tax_code)||',') > 0 and rownum = 1 ; end if; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; if ls_type = 'A' or ls_type = 'T' then lc_exch_rate := ddf_get_exch_rate(ls_tran_code,ls_tran_id); if lc_exch_rate is null then lc_exch_rate := 1; end if; lc_tax_amt := lc_tax_amt * lc_exch_rate; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_SCHEMEDET_OPER BEFORE insert ON bomdet FOR EACH ROW declare ls_type char(3) ; BEGIN if :NEW.operation is null then --begin -- select type into ls_type from bom where bom_code = :new.bom_code; --exception when others then -- ls_type := 'I'; --end; --if trim(ls_type) = 'S' then :NEW.operation := 0; --end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PORDER_TEMP_X ON PORDER_TEMP (PURC_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_REFSER_REFNO_ADJ ON RECEIVABLES_ADJ (REF_SER_ADJ, REF_NO_ADJ, REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDDET_PO_ITEM_STATUS ON PORDDET (PURC_ORDER, ITEM_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WIP_SCANNING_DET_X ON WIP_SCANNING_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_IND_QTYCONV BEFORE insert or update ON indent_det referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; BEGIN if nvl(:new.CONV__QTY_STDUOM,0) < 0 or nvl(:new.QUANTITY__STDUOM,0) < 0 then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] conv__qty_stduom [' || to_char(:new.CONV__QTY_STDUOM) || '] or quantity__stduom['||to_char(:new.QUANTITY__STDUOM)|| '] is wrong cannot be negative' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKPINCODE ( p_pincode IN VARCHAR2 --(1.PINCODE) ) RETURN NUMBER IS -- Object Name: applicant_mgmt_applicant_info -- Event Type: field_validation -- Form Number: 1 -- Field Name: PINCODE -- Business Logic: length must be 6 -- Function Name: checkPincode v_is_valid NUMBER := 0; -- Variable to store validation result BEGIN -- Check if the length of the pincode is exactly 6 IF LENGTH(p_pincode) = 6 THEN v_is_valid := 1; -- Set valid flag to 1 if length is 6 END IF; RETURN v_is_valid; -- Return the validation result END CHECKPINCODE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DRCR_DET (as_site varchar2,as_sreturn_no varchar2,as_drcr_type char) return varchar2 as as_drcr_det varchar2(200); as_tran_id varchar2(60); as_tran_dt date ; ctr number(2); cursor c1 is select DISTINCT tran_id ,tran_date from MISC_DRCR_RCP where sreturn_no =as_sreturn_no and site_code = as_site; cursor c2 is select DISTINCT tran_id ,tran_date from drcr_rcp where sreturn_no = as_sreturn_no and site_code = as_site; begin if (rtrim(as_drcr_type) = 'C' ) then open c1 ; ctr := 1; loop fetch c1 into as_tran_id ,as_tran_dt ; exit when c1%notfound ; if ctr = 1 then as_drcr_det := as_tran_id ||'|'||to_char(as_tran_dt ); else as_drcr_det :=as_drcr_det || ' '|| as_tran_id ||'|'||to_char(as_tran_dt ); end if ; ctr :=0 ; end loop; if as_drcr_det is null or c1%notfound then open c2 ; close c1; ctr :=1 ; loop fetch c2 into as_tran_id ,as_tran_dt ; exit when c2%notfound ; if ctr =1 then as_drcr_det := as_tran_id ||'|'||to_char(as_tran_dt ); else as_drcr_det := as_drcr_det||' '|| as_tran_id ||'|'||to_char(as_tran_dt ); end if ; ctr :=0 ; end loop; close c2; end if; end if ; IF as_drcr_det IS NULL then as_drcr_det := 'NOT PREPARED'; END IF ; return as_drcr_det; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C00708650 ON TASK_MST (TASK_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C001102883 ON EMP_EXIT_CLEARANCE_CHECKLIST (CLEARANCE_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_FORM16A_STYPE ( as_sundrytype in char , as_sundrycode in char ) return char is ls_type char(1) ; ls_sundrytype char(1); begin ls_sundrytype := rtrim(as_sundrytype); if ls_sundrytype = 'S' then select supp_type into ls_type from supplier where supp_code = as_sundrycode ; elsif ls_sundrytype = 'P' then select sp_type into ls_type from sales_pers where sales_pers = as_sundrycode; elsif ls_sundrytype = 'T' then select transporter_type into ls_type from transporter where tran_code = as_sundrycode; else ls_type :=' '; end if; return ls_type ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CCTR_ITEMSER ( as_cctr in char, as_tran_id_rcp in char, as_transer in char) return varchar2 is ls_itemser varchar2(5) ; begin if rtrim(as_cctr) = 'M01' then ls_itemser :='FB '; elsif rtrim(as_cctr) = 'M02' then ls_itemser := 'FI '; elsif rtrim(as_cctr) = 'M03' then ls_itemser := 'FS '; elsif rtrim(as_cctr) = 'M04' then ls_itemser := 'FA '; elsif rtrim(as_cctr) = 'M05' then ls_itemser := 'FE '; else select item_ser into ls_itemser from receivables where ref_no = as_tran_id_rcp and tran_ser = as_transer; end if ; return ls_itemser; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX FUNDTRANSFER_TRAN_DT_SITE ON FUNDTRANSFER (TRAN_DATE, SITE_CODE__FROM, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_LOCATION4 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_location varchar2(25); begin SELECT DESCR into as_location FROM ( SELECT STATION.DESCR FROM STATION, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE SITE.STAN_CODE=STATION.STAN_CODE AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_4.POOL_CODE) = TRIM(as_pool_code) UNION select STATION.DESCR FROM STATION, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_4.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE SITE.STAN_CODE=STATION.STAN_CODE AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER ); return as_location; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMPINDUCTION_X ON EMPINDUCTION (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_LOCATION3 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_location varchar2(25); begin SELECT DESCR into as_location FROM ( SELECT STATION.DESCR FROM STATION, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE SITE.STAN_CODE=STATION.STAN_CODE AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_3.POOL_CODE) = TRIM(as_pool_code) UNION select STATION.DESCR FROM STATION, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_3.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE SITE.STAN_CODE=STATION.STAN_CODE AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER ); return as_location; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RECPAY_TRF_STATUS BEFORE INSERT ON REC_PAY_TRF_DET referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.CUR_STATUS is null or :new.CUR_STATUS = 'null' then :new.CUR_STATUS := ' '; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_MERC_VAL (AS_DATE DATE,AS_NUMBER NUMBER, AS_DCR_ID CHAR) RETURN NUMBER IS AS_MERC_VALUE NUMBER(18,0) ; BEGIN SELECT NO_OF_OUTLET INTO AS_MERC_VALUE FROM ( SELECT TRAN_ID, ROW_NUMBER() OVER (ORDER BY TRAN_ID) AS RN, NO_OF_OUTLET FROM STRG_MEET WHERE STRG_TYPE='M' AND EVENT_DATE = AS_DATE AND DCR_ID = AS_DCR_ID ) WHERE RN = AS_NUMBER; RETURN AS_MERC_VALUE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INVDEMSUP_REFSER BEFORE INSERT or UPDATE OF ref_ser ON INV_DEM_SUPP referencing old as old new as new FOR EACH ROW DECLARE BEGIN if :new.ref_ser is null then :new.ref_ser := 'W-BIL'; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_ATRIAL_OBJ_REFID ON AUDIT_TRAIL (OBJ_NAME, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITDECL_FMT_X ON ITDECL_FMT (AD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BANK_STATEMENT_BANK_CODE ON BANK_STATEMENT (BANK_CODE, TRAN_TYPE, EFF_DATE, STATUS, AMOUNT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_UPD_ALLOC (as_sitecode in site.site_code%type) is ll_updcount number(6) := 0; ll_mismatchcount number(6) := 0; lc_allocqty number(14,3); begin begin for cur_stkalloc in ( select f.site_code, f.item_code, f.lot_no, f.loc_code, f.lot_sl, e.quantity as stock_qty, e.alloc_qty as stock_alloc_qty, (e.quantity-e.alloc_qty) as available_stock, sum(f.iss_qty) iss_qty from ( select b.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, a.quantity as iss_qty from inv_pack_iss a, inv_pack b where a.tran_id = b.tran_id and b.site_code = as_sitecode and b.confirmed = 'N' union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, (a.quantity+nvl(a.potency_adj,0)) as iss_qty from workorder_issdet a, workorder_iss d where a.tran_id = d.tran_id and d.site_code = as_sitecode and d.confirmed = 'N' and a.quantity +nvl(a.potency_adj,0) > 0 union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, (a.quantity+nvl(a.potency_adj,0)) as iss_qty from inv_alloc_det a, inv_allocate d where a.tran_id = d.tran_id and d.site_code = as_sitecode and (a.deallocated <> 'Y' or a.deallocated is null) and (a.issue_qty is null or a.issue_qty = 0 ) and not exists (select h.work_order from workorder_iss h, workorder_issdet i where i.tran_id = h.tran_id and h.work_order = d.work_order and h.tran_date >= '01-apr-00' and site_code = as_sitecode and nvl(h.status,'O') <> 'X' and a.site_code = h.site_code and a.exp_lev = i.exp_lev and a.item_code = i.item_code and a.loc_code = i.loc_code and a.lot_no = i.lot_no and a.lot_sl = i.lot_sl ) union all select d.site_code__ord, a.item_code, a.lot_no, a.loc_code, a.lot_sl, a.quantity as iss_qty from consume_iss_det a, consume_iss d where d.cons_order >' ' and d.cons_issue = a.cons_issue and d.confirmed = 'N' and d.tran_type = 'I' and d.site_code__ord = as_sitecode union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, a.quantity as iss_qty from despatchdet a, despatch d where d.desp_id = a.desp_id and d.desp_date >= '01-jan-2000' and d.site_code = as_sitecode and d.confirmed = 'N' union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, a.quantity as iss_qty from distord_issdet a, distord_iss d where d.tran_id = a.tran_id and d.confirmed = 'N' and d.site_code = as_sitecode union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, a.quantity as iss_qty from adj_issrcpdet a, adj_issrcp d where d.tran_id = a.tran_id and d.site_code = as_sitecode and d.confirmed = 'N' and d.ref_ser = 'adjiss' union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, (a.quantity+nvl(a.potency_adj,0)) as iss_qty from worder_issdet_rnd a, worder_iss_rnd d where a.tran_id = d.tran_id and d.confirmed <> 'Y' and a.quantity > 0 and d.site_code = as_sitecode union all select d.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, a.quantity as iss_qty from receipt_backflush_det a, receipt_backflush d where d.tran_id = a.tran_id and d.site_code = as_sitecode and d.confirmed = 'N' union all select d.site_code, a.item_code, a.lot_no__fr as lot_no, a.loc_code__fr as loc_code, a.lot_sl__fr as lot_sl, a.quantity as iss_qty from stock_transfer_det a, stock_transfer d where d.tran_id = a.tran_id and d.site_code = as_sitecode and d.confirmed = 'N' union all select d.site_code, d.item_code, a.lot_no, a.loc_code, a.lot_sl, a.qty_sample as iss_qty from qc_sample_stk a, qc_sample d where d.tran_id = a.tran_id and d.site_code = as_sitecode and d.confirmed = 'N' union all select a.site_code, b.item_code, b.lot_no, b.loc_code, b.lot_sl, b.quantity as iss_qty from porcp a, porcpdet b where a.tran_id = b.tran_id and a.site_code = as_sitecode and a.confirmed = 'N' and a.tran_ser ='P-RET' union all select a.site_code, a.item_code, a.lot_no, a.loc_code, a.lot_sl, 0 as iss_qty from stock a where a.site_code = as_sitecode and nvl(a.alloc_qty,0) > 0 ) f, stock e where f.item_code = e.item_code and f.site_code = e.site_code and f.loc_code = e.loc_code and f.lot_no = e.lot_no and f.lot_sl = e.lot_sl and e.inv_stat in ('SALE','NOSL') group by f.site_code, f.item_code, f.lot_no, f.loc_code, f.lot_sl, e.quantity, e.alloc_qty having sum(f.iss_qty) < e.alloc_qty order by f.site_code,f.item_code, f.lot_no, f.loc_code, f.lot_sl ) loop begin ll_mismatchcount := ll_mismatchcount + 1; if cur_stkalloc.iss_qty < cur_stkalloc.stock_alloc_qty then update stock set alloc_qty = cur_stkalloc.iss_qty where item_code = cur_stkalloc.item_code and site_code = cur_stkalloc.site_code and loc_code = cur_stkalloc.loc_code and lot_no = cur_stkalloc.lot_no and lot_sl = cur_stkalloc.lot_sl ; ll_updcount := ll_updcount + 1; end if; exception when others then rollback; end; end loop; end; dbms_output.put_line('Total mismatch [' || to_char(ll_mismatchcount) || '] updated [' || to_char(ll_updcount) ||']'); commit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPARTYNAME (as_ref_ser in char, as_ref_id in char , as_tranid in char, as_codeorname in char) return varchar2 as as_party varchar2(250); ls_sundrycode char(10); ls_sundryname varchar2(250); begin if as_ref_ser = 'S-DSP' then select cust_code__dlv into ls_sundrycode from despatch where desp_id = as_ref_id; select cust_name || city into ls_sundryname from customer where cust_code = ls_sundrycode; elsif as_ref_ser = 'D-ISS' then select site_code__dlv into ls_sundrycode from distord_iss where tran_id = as_ref_id; select sh_descr into ls_sundryname from site where site_code = ls_sundrycode; elsif as_ref_ser = 'D-RCP' then select site_code__ship into ls_sundrycode from distord_rcp where tran_id = as_ref_id; select sh_descr into ls_sundryname from site where site_code = ls_sundrycode; elsif as_ref_ser = 'C-ISS' then select emp_code into ls_sundrycode from consume_iss where cons_issue = as_ref_id; select emp_fname || ' '||nvl(emp_mname,'')|| ' '||nvl(emp_lname,'') ||' '||nvl(cur_city ,'') into ls_sundryname from employee where emp_code = ls_sundrycode ; elsif as_ref_ser = 'S-RET' then select cust_code into ls_sundrycode from sreturn where tran_id = as_ref_id; select cust_name || city into ls_sundryname from customer where cust_code = ls_sundrycode; elsif as_ref_ser = 'P-RCP' then select supp_code into ls_sundrycode from porcp where tran_id = as_ref_id; select sh_name || city into ls_sundryname from supplier where supp_code = ls_sundrycode; elsif as_ref_ser = 'P-RET' then select supp_code into ls_sundrycode from porcp where tran_id = as_ref_id; select sh_name || city into ls_sundryname from supplier where supp_code = ls_sundrycode; else select reas_code into ls_sundrycode from invtrace where tran_id = as_tranid; select descr into ls_sundryname from gencodes where fld_value = ls_sundrycode; end if; if as_codeorname = 'C' then as_party := ls_sundrycode; else as_party := ls_sundryname; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GL_TRANS_CREDIT (ldate_fr in date,ldate_to in date, lsite_code in char,lacct_code in char) return number is lc_cr_sum number(14,3); begin Select nvl(Sum(cr_amt),0) into lc_cr_sum from gltran where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_IS_UPDATE_BATCH_STAT (LS_BATCH_ID IN CHAR, LS_TRAN_SL IN CHAR) RETURN VARCHAR2 IS LS_RET_STR VARCHAR2(5); BEGIN LS_RET_STR := 'Y'; RETURN LS_RET_STR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAY_OP_BAL ( ad_from_date in period.fr_date%type, ad_to_date in period.fr_date%type, as_bank_code bank.bank_code%type, as_site_code site.site_code%type ) return number as ld_p_amt banktran_log.amount%type; ld_r_amt banktran_log.amount%type; ld_day_op_bal banktran_log.amount%type; begin Select sum((case when amount is null then 0 else amount end) ) into ld_p_amt from banktran_log where tran_date >= ad_from_date and tran_date < ad_to_date and bank_code = as_bank_code and site_code = as_site_code and tran_type = 'P'; If ld_p_amt Is Null Then ld_p_amt :=0; End If; Select sum((case when amount is null then 0 else amount end) ) into ld_r_amt from banktran_log where tran_date >= ad_from_date and tran_date < ad_to_date and bank_code = as_bank_code and site_code = as_site_code and tran_type = 'R'; If ld_r_amt Is Null Then ld_r_amt := 0; End If; ld_day_op_bal := ld_r_amt - ld_p_amt ; return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BATCHLOADDET_TABSEQ_X ON BATCHLOADDET_TABSEQ (OBJ_NAME, TRAN_SL, OBJ_SL, FLD_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DEPT_DESCR ( as_dept_code char) return varchar2 is ls_descr varchar2(40); begin begin select descr into ls_descr from department where dept_code = as_dept_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TRAN_DATE_SITE ON WORKORDER_RECEIPT (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 10485760 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_CHEMCALL_COUNT (ls_emp IN VARCHAR2,ls_month IN char, ls_year IN char ) return number is chem_call_count number(3); BEGIN begin SELECT NVL(Count(Tran_Id),0) into chem_call_count from strg_meet Inner Join Fieldactivity On Fieldactivity.Activity_Code = strg_meet.Event_Type and Fieldactivity.Activity_Type = 'FW' where strg_meet.strg_type = 'C' and (sales_pers) = ls_emp and to_char(event_date,'mm') = ls_month and to_char(event_date,'YYYY') = ls_year; exception when no_data_found then chem_call_count:=0; end; RETURN chem_call_count ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PROPORTION_QTY (as_bomcode in bom.bom_code%type,as_itemcode in item.item_code%type,as_itemref in bomdet.item_ref%type ,as_altitem in item.item_code%type,ad_balanceqty_alt in number, as_type in char) return number is lc_qtyper_bom number(14,3); lc_qtyper_alt number(14,3); lc_proportionate_qty number(14,3); begin if as_itemcode = as_altitem then return ad_balanceqty_alt; end if; begin select qty_per into lc_qtyper_bom from bomdet where bom_code = as_bomcode and item_code = as_itemcode and item_ref = as_itemref; if lc_qtyper_bom is null then lc_qtyper_bom := 0; end if; exception when others then lc_qtyper_bom := 0; end; begin select quantity into lc_qtyper_alt from bom_alt where bom_code = as_bomcode and item_code = as_itemcode and item_ref = as_itemref and item_code__alt = as_altitem; if lc_qtyper_alt is null then lc_qtyper_alt := 0; end if; exception when others then lc_qtyper_alt := 0; end; if as_type = 'Q' then if abs(lc_qtyper_alt) > 0 and abs(ad_balanceqty_alt) > 0 Then lc_proportionate_qty := lc_qtyper_bom / lc_qtyper_alt * ad_balanceqty_alt; else lc_proportionate_qty := ad_balanceqty_alt; end if; else if abs(lc_qtyper_alt) > 0 and abs(ad_balanceqty_alt) > 0 Then lc_proportionate_qty := lc_qtyper_alt / lc_qtyper_bom * ad_balanceqty_alt; else lc_proportionate_qty := ad_balanceqty_alt; end if; end if; if lc_proportionate_qty is null then lc_proportionate_qty := 0; end if; return lc_proportionate_qty; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_MISSING_REPORT (MEMP_CODE IN CHAR, MFROM_DATE IN DATE, MTO_DATE IN DATE) RETURN VARCHAR2 IS MMISSING_REPORT VARCHAR2(2000) := ''; MWORK_DATE DATE := NULL; MFR_DATE DATE := NULL; MDATE_UPTO DATE := NULL; MLEAVE NUMBER(2) := NULL; MHOL_TBLNO EMPLOYEE.HOL_TBLNO%TYPE := NULL; MHOLIDAY NUMBER(1) := 0; BEGIN MFR_DATE := MFROM_DATE; SELECT NVL(RELIEVE_DATE, MTO_DATE) INTO MDATE_UPTO FROM EMPLOYEE WHERE EMP_CODE = MEMP_CODE; IF MDATE_UPTO >= MTO_DATE THEN MDATE_UPTO := MTO_DATE; END IF; IF MDATE_UPTO >= TRUNC(SYSDATE) THEN MDATE_UPTO := TRUNC(SYSDATE); END IF; WHILE MFR_DATE <= MDATE_UPTO LOOP BEGIN MLEAVE := ''; SELECT COUNT(A.ACTIVITY_CODE) INTO MLEAVE FROM DR_TRAVEL_DETAILS A,FIELDACTIVITY B,DR_MAIN C WHERE A.SALES_PERS = MEMP_CODE AND A.WORK_DATE = MFR_DATE AND B.ACTIVITY_CODE = A.ACTIVITY_CODE AND B.ACTIVITY_TYPE <> 'LEAVE' AND C.SALES_PERS = A.SALES_PERS AND C.WORK_DATE = A.WORK_DATE AND C.CONFIRMATION_FLAG = 'Y'; IF MLEAVE = 0 THEN MHOL_TBLNO := NULL; SELECT DDF_GET_HOLTBLNO(MEMP_CODE, MFR_DATE) INTO MHOL_TBLNO FROM DUAL; MHOLIDAY := 0; SELECT NVL(COUNT(1),0) INTO MHOLIDAY FROM HOLIDAY WHERE HOL_TBLNO = MHOL_TBLNO AND HOL_DATE = MFR_DATE; IF MHOLIDAY = 0 THEN SELECT WORK_DATE INTO MWORK_DATE FROM DR_MAIN WHERE SALES_PERS = MEMP_CODE AND WORK_DATE = MFR_DATE AND CONFIRMATION_FLAG = 'Y'; END IF; END IF; MFR_DATE := MFR_DATE + 1; EXCEPTION WHEN OTHERS THEN IF MMISSING_REPORT = '' THEN MMISSING_REPORT := SUBSTR(MFR_DATE, 1, 2)||', '; MFR_DATE := MFR_DATE + 1; ELSE MMISSING_REPORT := MMISSING_REPORT||SUBSTR(MFR_DATE, 1, 2)||', '; MFR_DATE := MFR_DATE + 1; END IF; END; END LOOP; RETURN MMISSING_REPORT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_STAN_CODE (lsundry_type in char,lsundry_code in char) return char is ls_stan_code transporter.stan_code%type; ls_emp_code sales_pers.emp_code%type; begin if lsundry_type ='O' then ls_stan_code := ' '; elsif lsundry_type ='T' then select stan_code into ls_stan_code from transporter where tran_code = lsundry_code; elsif lsundry_type = 'B' then ls_stan_code := ' '; elsif lsundry_type = 'X' then select stan_code into ls_stan_code from tax_authority where tauth_code = lsundry_code; elsif lsundry_type = 'E' then select stan_code__hq into ls_stan_code from employee where emp_code = lsundry_code; elsif lsundry_type = 'P' then select emp_code into ls_emp_code from sales_pers where sales_pers = lsundry_code; if ls_emp_code is not null and length(trim(ls_stan_code)) > 0 then select stan_code into ls_stan_code from employee where emp_code = ls_emp_code; else ls_stan_code := ' '; end if; elsif lsundry_type ='S' then select stan_code into ls_stan_code from supplier where supp_code = lsundry_code; elsif lsundry_type ='C' then select stan_code into ls_stan_code from customer where cust_code = lsundry_code; elsif lsundry_type = 'L' then select stan_code into ls_stan_code from loanparty where party_code = lsundry_code; elsif lsundry_type = 'R' then select stan_code into ls_stan_code from strg_customer where sc_code = lsundry_code; elsif lsundry_type = 'D' then select stan_code into ls_stan_code from strg_customer where sc_code = lsundry_code; end if; return ls_stan_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VALIDATE_EMP_IT_PROOF_1617 (as_tran_id EMP_ITDECL_HDR.TRAN_ID%TYPE, as_ad_code EMP_ITDECL_DET.AD_CODE%TYPE) return varchar2 is ls_return varchar2(4000); lc_cnt number(5); lc_cnt1 number(5); lc_qtr number(1); MV_IS_ERROR CHAR(1); LS_DECL_TYPE CHAR(1); MV_AD_CODE EMP_ITDECL_PROOF.AD_CODE%TYPE; MV_UDF_STR_1 EMP_ITDECL_PROOF.UDF_STR_1%TYPE; MV_UDF_STR_2 EMP_ITDECL_PROOF.UDF_STR_2%TYPE; MV_UDF_STR_3 EMP_ITDECL_PROOF.UDF_STR_3%TYPE; MV_UDF_STR_4 EMP_ITDECL_PROOF.UDF_STR_4%TYPE; MV_UDF_STR_5 EMP_ITDECL_PROOF.UDF_STR_5%TYPE; MV_UDF_STR_6 EMP_ITDECL_PROOF.UDF_STR_6%TYPE; MV_UDF_DATE_1 EMP_ITDECL_PROOF.UDF_DATE_1%TYPE; MV_UDF_DATE_2 EMP_ITDECL_PROOF.UDF_DATE_2%TYPE; MV_UDF_DATE_3 EMP_ITDECL_PROOF.UDF_DATE_3%TYPE; MV_UDF_NUM_VAL1 EMP_ITDECL_PROOF.UDF_NUM_VAL1%TYPE; MV_UDF_NUM_VAL2 EMP_ITDECL_PROOF.UDF_NUM_VAL2%TYPE; MV_UDF_NUM_VAL3 EMP_ITDECL_PROOF.UDF_NUM_VAL3%TYPE; MV_PROOF_AMOUNT EMP_ITDECL_PROOF.PROOF_AMOUNT%TYPE; CURSOR C_AD_PROOF IS SELECT AD_CODE, UDF_STR_1, UDF_STR_2, UDF_STR_3, UDF_STR_4, UDF_STR_5, UDF_STR_6, udf_date_1, udf_date_2, udf_date_3, udf_num_val1, udf_num_val2, udf_num_val3, udf_num_val4, udf_num_val5, CITY, STATE_CODE, PIN, COUNT_CODE, NVL(PROOF_AMOUNT , 0) AS PROOF_AMOUNT from emp_itdecl_proof where tran_id = as_tran_id and ad_code = as_ad_code; begin mv_ad_code := as_ad_code; MV_PROOF_AMOUNT := 0; lc_cnt := 0; lc_cnt1 := 0; lc_qtr := 0; MV_IS_ERROR := 'N'; if trim(mv_ad_code) IN ('FDSB','IT02D','IT02H','IT02I','IT02J','IT02K','IT02L','IT03D','IT03F','IT07','IT07A','IT07F','IT07G','IT10','IT10C','IT11','IT11B','IT13','IT15','IT18','IT19','IT27A','IT27B','IT27C','IT27D','IT27F','IT27I','IT27K','IT27M','IT2AA') then lc_cnt1 := lc_cnt1 +1; END IF; SELECT DECL_TYPE,QTR_NO INTO LS_DECL_TYPE , LC_QTR FROM EMP_ITDECL_HDR WHERE TRAN_ID = AS_TRAN_ID; IF LS_DECL_TYPE = 'P' THEN for i in c_ad_proof LOOP if trim(mv_ad_code) = 'FDSB' then IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR --i.udf_date_1 is null or I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR --i.udf_str_2 is null or length(trim(i.udf_str_2)) = 0 or I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02D' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR i.udf_str_2 is null or length(trim(i.udf_str_2)) = 0 or I.CITY IS NULL OR LENGTH(TRIM(I.CITY)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR (NVL(I.UDF_NUM_VAL1,0) > 8000 AND (I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0)) OR --Modified by Ahmed I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02H' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR --I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; elsif trim(mv_ad_code) = 'IT02I' then IF I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02J' THEN IF --I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02K' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT02L' THEN IF --I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR -- I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT03D' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT03F' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07' THEN IF I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07A' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_5 IS NULL OR LENGTH(TRIM(I.UDF_STR_5)) = 0 OR I.UDF_STR_6 IS NULL OR LENGTH(TRIM(I.UDF_STR_6)) = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR i.udf_date_1 is null or I.CITY IS NULL OR LENGTH(TRIM(I.CITY)) = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07F' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_5 IS NULL OR LENGTH(TRIM(I.UDF_STR_5)) = 0 OR I.UDF_STR_6 IS NULL OR LENGTH(TRIM(I.UDF_STR_6)) = 0 OR i.city is null or length(trim(i.city)) = 0 or i.udf_num_val1 is null or i.udf_num_val1 = 0 or I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.UDF_num_val3 IS NULL OR I.UDF_num_val4 IS NULL OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT07G' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or i.udf_num_val1 is null or I.UDF_num_val2 IS NULL OR I.UDF_num_val5 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT10' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT10C' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT11' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT11B' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT13' THEN IF I.UDF_num_val1 IS NULL OR I.UDF_DATE_1 IS NULL OR I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT15' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT18' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT19' THEN IF I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27A' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR --I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27B' THEN IF --I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR -- I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR -- I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR I.UDF_STR_4 IS NULL OR LENGTH(TRIM(I.UDF_STR_4)) = 0 OR I.UDF_num_val1 IS NULL OR -- I.UDF_DATE_2 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27C' THEN IF --I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR -- I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR -- I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27D' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR -- I.UDF_DATE_1 IS NULL OR I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27F' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR -- I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27I' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or I.UDF_STR_2 IS NULL OR LENGTH(TRIM(I.UDF_STR_2)) = 0 OR I.UDF_STR_5 IS NULL OR LENGTH(TRIM(I.UDF_STR_5)) = 0 OR i.city is null or length(trim(i.city)) = 0 or I.UDF_num_val1 IS NULL OR I.UDF_num_val1 = 0 OR I.UDF_num_val2 IS NULL OR I.UDF_num_val2 = 0 OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27K' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR -- I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR -- I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT27M' THEN IF I.UDF_STR_1 IS NULL OR LENGTH(TRIM(I.UDF_STR_1)) = 0 OR -- I.UDF_STR_3 IS NULL OR LENGTH(TRIM(I.UDF_STR_3)) = 0 OR -- I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN mv_is_error := 'Y'; END IF; ELSIF trim(mv_ad_code) = 'IT2AA' THEN if i.udf_str_1 is null or length(trim(i.udf_str_1)) = 0 or -- I.UDF_DATE_1 IS NULL OR I.PROOF_AMOUNT IS NULL OR I.PROOF_AMOUNT = 0 THEN MV_IS_ERROR := 'Y'; END IF; END IF; if mv_is_error = 'Y' then LS_RETURN := 'Error : Message : INVALID PROOF DETAIL Description : INVALID PROOF DETAIL FOR ' || MV_AD_CODE || ' - VALUE NOT ENTERED FOR ALL OR SOME OF MANDATORY FIELDS'; EXIT; END IF; mv_proof_amount := mv_proof_amount + i.proof_amount; end loop; if (mv_is_error is null or mv_is_error <> 'Y') and lc_cnt1 > 0 then lc_cnt := 0; select count(1) into lc_cnt from emp_itdecl_det where tran_id = as_tran_id and ad_code = as_ad_code and CASE WHEN AMOUNT_PROOF < 0 THEN CEIL(AMOUNT_PROOF) ELSE FLOOR(AMOUNT_PROOF) END <> CASE WHEN mv_proof_amount < 0 THEN CEIL(mv_proof_amount) ELSE FLOOR(mv_proof_amount) END; if lc_cnt > 0 then ls_return := 'Error : Message : INVALID PROOF AMOUNT Description : INVALID PROOF AMOUNT FOR ' || mv_ad_code || ' - VALUE NOT MATCHES WITH PROOF DETAIL'; END IF; end if; end if; return ls_return; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_PO_STS_DLV_SUPP ON PORDER (CONFIRMED, STATUS, SITE_CODE__DLV, SUPP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RET_DISC_VAL (as_purcorder in char) return varchar is ls_stringval varchar2(500); ls_line_no porddet.line_no%type ; lc_amt number(14,3) ; lc_discount porddet.discount%type ; ll_line_ord_cnt number(6,0); ll_disc_cnt number(6,0); ls_retval varchar2(500); begin ls_retval := ' ' ; select count(*) into ll_line_ord_cnt from porddet where purc_order = as_purcorder; if ll_line_ord_cnt > 0 then select min(line_no) into ls_line_no from porddet where purc_order = as_purcorder; select nvl(discount,0) into lc_discount from porddet where purc_order = as_purcorder and line_no = ls_line_no; if (lc_discount is not null) and (lc_discount > 0) then select count(*) into ll_disc_cnt from porddet where purc_order = as_purcorder and discount = lc_discount ; if ll_line_ord_cnt = ll_disc_cnt then ls_retval := 'Discount '|| '( @' || to_char(lc_discount,'990.00') || ' % )' ; else ls_retval := ' '; end if; end if; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDER_SUPP_SITE_ITEM_STATUS ON PORDER (SUPP_CODE, SITE_CODE__ORD, ITEM_SER, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INDENT_PURC_ORDER (as_indno in char) return char is ls_purcorder char(10); cursor c1 is select porddet.purc_order from porddet, porder where porddet.purc_order = porder.purc_order and porddet.ind_no = as_indno order by porder.ord_date desc, porddet.purc_order desc; begin ls_purcorder := ' '; for cdescr in c1 loop begin exit when c1%notfound; ls_purcorder := cdescr.purc_order; exit; end; end loop; return ls_purcorder ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MIN_LOTNO (as_lot_no_from stock.lot_no%type , as_lot_no_to stock.lot_no%type ,as_item_code stock.item_code%type) return char is ls_data varchar2(1000); ls_lot_no stock.lot_no%type; ls_date varchar2(10); begin select nvl(min(trim(stock.lot_no)),' ') into ls_lot_no from stock where stock.lot_no >= as_lot_no_from and stock.lot_no <= as_lot_no_to and stock.item_code = as_item_code ; if length(trim(ls_lot_no)) > 0 then select to_char(MIN(mfg_date),'mm/yyyy') into ls_date from stock where stock.lot_no = ls_lot_no and stock.item_code = as_item_code ; end if; ls_data := trim(ls_lot_no) || chr(10) || ls_date; return ls_data; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DRCR_RACCT_X ON DRCR_RACCT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CREATE_SELECT (ls_tname varchar2) return varchar2 is ls_select varchar2(4000) ; begin declare cursor c2 is select column_name from cols where table_name = upper(ls_tname) and data_type in ('CHAR', 'DATE', 'NUMBER' ,'VARCHAR2') order by column_id; ls_name varchar2(100); colname varchar2(100); ls_select varchar2(4000); ctr number(10); begin open c2; ctr := 1; ls_select := 'select ' ; loop fetch c2 into colname; if ctr > 0 then colname := colname || ','; end if ; exit when c2%NOTFOUND; ls_select := ls_select||' '|| colname ; ctr := ctr + 1; end loop ; close c2; ls_select := lower(substr(ls_select,1,length(rtrim(ls_select)) - 1 )) ||' from '|| upper(ls_tname) ; return ls_select ; end ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_GIM (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BANK_NAME1 ( as_ref_ser char, as_ref_id char) return varchar2 is ls_bank_code char(10); ls_bank_name varchar2(70); begin begin select bank_code into ls_bank_code from banktran_log where tran_no = as_ref_id and tran_ser = as_ref_ser and rownum = 1; exception when no_data_found then ls_bank_name := null; end; select bank_name into ls_bank_name from bank where bank_code = ls_bank_code; return ls_bank_code ||' '||ls_bank_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RUNMATH_SUNDBAL (as_site_code in char, as_cust_code in char, as_date in date) return number is ldec_amt number (14,3); begin SELECT sum(case when sundrybal.adv_amt is null then 0 else sundrybal.adv_amt end) into ldec_amt FROM sundrybal, acctprd WHERE ( acctprd.code = sundrybal.acct_prd ) and ( ( sundrybal.site_code = as_site_code ) AND ( sundrybal.sundry_code = as_cust_code ) AND ( acctprd.fr_date <= as_date ) AND ( acctprd.to_date >= as_date ) AND ( sundrybal.prd_code = 'zzzzzz' ) ); return ldec_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_FAS AFTER UPDATE OF CONFIRMED ON asset_sales_hdr REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ----PRAGMA AUTONOMOUS_TRANSACTION;set echo on; BEGIN --IF :old.confirmed = 'N' and :new.confirmed = 'Y' THEN IF ((:old.confirmed = 'N' and :new.confirmed = 'Y') or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y') ) THEN begin delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser = 'FASALE' and ref_id = :new.tran_id); delete from e_invoice where ref_ser = 'FASALE' and ref_id = :new.tran_id; select count(1) into ll_count from e_invoice where ref_ser = 'FASALE' and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, TRAN_gstn, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, SUPPLY_TYPE, gst_port, refund_claim, gst_currency, count_code, export_duty, tran_name ) SELECT ls_seq as tran_id, :new.TRAN_DATE as tran_date, :new.TRAN_TYPE as tran_type, buyer.einv_reqd as einv_opt, 'FASALE' as ref_ser, :new.tran_id ref_id , :new.tran_date as ref_date, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) as gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE.STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, (select ar.site_code from asset_sales_det d,asset_register ar where ar.asset_code = d.asset_code and d.tran_id = :new.tran_id and rownum = 1) as SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= ship.site_code AND ref_code='GSTIN_NO' ) gstn_ship, ship.descr trade_name_ship, ship.descr legal_name_ship, ship.ADD1 add1_ship, ship.ADD2 add2_ship, ship.CITY city_ship, ship.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE.STATE_CODE = ship.STATE_CODE) state_ship, ship.TELE1 tele_ship, ship.EMAIL_ADDR email_id_ship, :new.cust_code cust_code, case when buyer.TAX_REG_2='UNREGISTER' then 'URP' else buyer.TAX_REG_2 end gstn_buy, buyer.CUST_NAME trade_name_buy, buyer.CUST_NAME legal_name_buy, case when fn_supplytype('FASALE', trim(:new.tran_id), trim(buyer_state.count_code), trim(seller_state.count_code), :new.site_code) = 'B2B' then (SELECT GST_CODE FROM STATE WHERE STATE_CODE = ship.STATE_CODE) else '96' end as pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.CITY city_buy, buyer.state_code state_code__buy, buyer.drug_lic_no drug_lic_no_buy, buyer.PIN pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE.STATE_CODE = buyer.STATE_CODE) state_buy, buyer.TELE1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.CUST_CODE CUST_CODE__BIL, :new.CUST_CODE CUST_CODE__DLV, dlv.CUST_NAME name_dlv, dlv.ADDR1 add1_dlv, dlv.ADDR2 add2_dlv, dlv.PIN pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE.STATE_CODE = dlv.STATE_CODE) state_dlv, dlv.state_code state_code__dlv, dlv.drug_lic_no drug_lic_no_dlv, round(((select sum(sale_amt) from asset_sales_det where tran_id = :new.tran_id) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) as INV_AMT, round(((select sum(sale_amt) from asset_sales_det where tran_id = :new.tran_id) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','K')) and tax_perc <> 0 and tax_amt <> 0),0)+nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('D')) and tax_perc < 0 and tax_amt < 0),0) + (select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') )) * :new.exch_rate,2) AS NET_AMT, round((select sum(sale_amt) from asset_sales_det where tran_id = :new.tran_id) ,2) AS ASSESABLE_VALUE, --round(:new.DISC_AMT,2), 0, null ORDER_NO, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, ----additional round bracket added before the *.:new.exch_rate round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='K') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, ----additional round bracket added before the *.:new.exch_rate --0 as OTHER_AMT, 'N' proc_stat, sysdate proc_date, 'P' resp_stat, --0 distance, (select nvl(distance,0) from site_customer where site_code = seller.site_code and cust_code = :new.cust_code) as distance, '1' as Trans_Mode, -- Road-1, Rail-2, Air-3, Ship-4 ' ' Tran_gstn, --:new.lr_date, --:new.lr_no, null, null, --:new.lorry_no, null, 'R' Vehicle_Type, null DOC_NO, null DOC_DATE, fn_supplytype('FASALE', trim(:new.tran_id), trim(buyer_state.count_code), trim(seller_state.count_code), :new.site_code) as SUPPLY_TYPE, --nvl(station.gst_port,' ') gst_port, ' ' as gst_port, fn_refundclaim('FASALE', trim(:new.tran_id)) refund_claim, 'INR' gst_currency, country.iso3166 as count_code, nvl(((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type ='L') and tax_perc <> 0 and tax_amt <> 0)) * :new.exch_rate,0) as export_duty, ----additional round bracket added before the *.:new.exch_rate ' ' Tran_name FROM --INVOICE INV, --SORDER SO, CUSTOMER BUYER, CUSTOMER DLV, site seller, site ship, state seller_state, state buyer_state, currency, country --, --station, --despatch WHERE --SO.sale_order = :new.sale_order -- inv.sale_order --and buyer.cust_code = :new.CUST_CODE --cust_code --inv.CUST_CODE and DLV.cust_code = :new.CUST_CODE and seller.site_code = (select ar.site_code from asset_sales_det d,asset_register ar where ar.asset_code = d.asset_code and d.tran_id = :new.tran_id and rownum = 1) and ship.site_code = (select ar.site_code from asset_sales_det d,asset_register ar where ar.asset_code = d.asset_code and d.tran_id = :new.tran_id and rownum = 1) and seller_state.state_code = seller.state_code and buyer_state.state_code = buyer.state_code and currency.curr_code = buyer.curr_code and country.count_code = buyer_state.count_code; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, a.ITEM_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, ' ' AS LINE_TYPE, round(it.sale_amt,2) as INV_AMT, it.SALE_AMT as ASS_AMT, 0 AS DISCOUNT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as IGST_AMT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CGST_AMT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as SGST_AMT, round((nvl((select tax_amt from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as CESS_AMT, round((nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = 'FASALE' and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in('C') ) and tax_code not in ('FRS01','SDISP','SDISF','SOTH','SFRGT','SINSR') and tax_perc <> 0 and tax_amt <> 0),0)) * :new.exch_rate,2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=item.unit ) AS UNIT, 1 AS QUANTITY, it.sale_amt AS RATE, item.hsn_no AS HSN_CODE, 'NOT-APPLICABLE' as LOT_NO, null as EXP_DATE, null as MFG_DATE, round(it.tot_amt,2) as TOT_ITEM_VAL, fn_gst_rate_amt('FASALE',it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt('FASALE',it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt('FASALE',it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt('FASALE',it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate('FASALE',it.tran_id, it.line_no) as GST_RATE, --(select case when item.stk_opt = '0' then 'Y' else 'N' end from item where item.item_code = it.item_code) --(select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code and item.item_ser = itemser.item_ser) 'N' FROM asset_sales_det it, asset_register a, item WHERE a.asset_code= it.asset_code and item.item_code = a.item_code AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; -- raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; -- end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ISMYSENIOR (entity_codeSr in char , entity_codeJr in char) return number is a_retval number(1) := 0; BEGIN SELECT COUNT( REPORT_TO ) INTO a_retval FROM ( select REPORT_TO from employee start with emp_code = entity_codeJr connect by prior report_to = emp_code ) WHERE REPORT_TO = entity_codeSr; return a_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_FNAME (as_emp in char , as_req in char) return varchar2 is ls_name varchar2(60); begin ls_name := null; if length(trim(as_emp)) <> 0 then select e.emp_fname || ' ' || e.emp_lname into ls_name from employee e WHERE e.emp_code = as_emp ; end if; if ls_name is null then ls_name := ' '; end if; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BATCHLD_STAT_TRAN_ID_SER ON BATCHLOAD_STATUS (TRAN_ID__SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAX_DETAIL_REP (ls_tran_code in char,ls_tran_id in char, ls_disparm_code in char) return number is lc_tax_amt number(14,3); ls_var_value char(30); begin if length(ltrim(rtrim(ls_tran_id))) = 0 or ls_tran_id is null then return 0; end if; select rtrim(var_value) into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; select nvl(sum(nvl(tax_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and instr(ls_var_value,rtrim(tax_code)) > 0 ; if lc_tax_amt is null then lc_tax_amt := 0 ; end if; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_OUVERDUE_CHECK ( as_cust_code in char ) return number is lc_outstamt number(14,3) ; as_credit number(14,3) ; as_outstand number(14,3) ; begin SELECT nvl(Sum(R.Tot_Amt - R.Adj_Amt),0) into as_outstand FROM Receivables R, Customer C WHERE R.cust_code = C.cust_code AND R.due_date < To_Date(sysdate) and R.cust_code=as_cust_code; lc_outstamt:= as_outstand; if lc_outstamt<0 then return 0; else return lc_outstamt ; end if ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEM_PARANT_CODE ON ITEM (ITEM_PARNT, ITEM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUNDRY ( ls_ref_ser in char, ls_tran_id in char, ls_type in char ) return varchar2 is ls_val customer.cust_name%type; ls_code invoice.cust_code%type; ls_name customer.cust_name%type; ls_sql varchar2(2000); begin if ls_ref_ser = 'S-INV' then select A.cust_code , B.cust_name into ls_code , ls_name from invoice A , customer B where A.cust_code = B.cust_code and Trim(A.invoice_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'VOUCH' then Select A.supp_code , B.supp_name into ls_code , ls_name From Voucher A , Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNPAY' Or ls_ref_ser = 'DRNPAY' Then Select A.supp_code , B.supp_name Into ls_code , ls_name From DRCR_Pay A , Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNRCP' Or ls_ref_ser = 'DRNRCP' Then Select A.cust_code , B.cust_name Into ls_code , ls_name From DRCR_Rcp A , Customer B Where A.cust_code = B.cust_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'D-RCP' Then ls_sql := 'Select Nvl(Case A.sundry_type when ''C'' then (Select B.cust_name From Customer B '|| 'Where B.cust_code = A.sundry_code) when '|| '''S'' then (Select B.supp_name From Supplier B '|| 'Where B.supp_code = A.sundry_code)END,'|| ' (Select B.descr From Site B where B.site_code = A.site_code__dlv)),'|| ' Nvl(case A.sundry_type when ''C'' then (Select B.cust_code From Customer B '|| ' Where B.cust_code = A.sundry_code) when'|| '''S'' then (Select B.supp_code From Supplier B '|| ' Where B.supp_code = A.sundry_code)END,'|| ' (Select B.site_code From Site B where B.site_code = A.site_code__dlv))'|| ' From DistOrder A ' || ' Where (A.dist_order) = Trim(''' || ls_tran_id || ''')' ; Execute immediate ls_sql into ls_name , ls_code; ElsIf ls_ref_ser = 'D-ISS' Then ls_sql := 'Select Nvl(Case A.sundry_type when ''C'' then (Select B.cust_name From Customer B '|| 'Where B.cust_code = A.sundry_code) when '|| '''S'' then (Select B.supp_name From Supplier B '|| 'Where B.supp_code = A.sundry_code)END, '|| ' (Select B.descr From Site B where B.site_code = A.site_code__ship)),'|| ' Nvl(case A.sundry_type when ''C'' then (Select B.cust_code From Customer B '|| ' Where B.cust_code = A.sundry_code) when'|| '''S'' then (Select B.supp_code From Supplier B '|| ' Where B.supp_code = A.sundry_code)END,'|| ' (Select B.site_code From Site B where B.site_code = A.site_code__ship))'|| ' From DistOrder A ' || ' Where (A.dist_order) = Trim(''' || ls_tran_id || ''')' ; Execute immediate ls_sql into ls_name , ls_code; End If; ls_name := nvl(ls_name,' '); ls_code := nvl(ls_code,' '); If ls_type = 'C' Then ls_val := ls_code; Else ls_val := ls_name; End If; Return ls_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PRICE_LIST__PAYDIS (as_sales_pers IN CHAR ,as_strg_code IN CHAR ) return char is PRICE_LIST__PAYDIS CHAR(5); cnt number(3); begin if(PRICE_LIST__PAYDIS is null OR PRICE_LIST__PAYDIS = '') then select PRICE_LIST__PAYDIS into PRICE_LIST__PAYDIS from strg_customer where sc_code=as_strg_code; end if; SELECT count(*) into cnt FROM strg_customer SC, STATION S WHERE SC.STAN_CODE=S.STAN_CODE AND SC_CODE = as_strg_code ; if(cnt > 0) then if(PRICE_LIST__PAYDIS is null OR PRICE_LIST__PAYDIS = '') then SELECT S.PRICE_LIST__PAYDIS into PRICE_LIST__PAYDIS FROM strg_customer SC, STATION S WHERE SC.STAN_CODE=S.STAN_CODE AND SC_CODE = as_strg_code ; cnt :=0; end if; end if; SELECT count(*) into cnt FROM strg_customer SC, LOCALITY L WHERE SC.LOCALITY_CODE=L.LOCALITY_CODE AND SC_CODE = as_strg_code ; if(cnt > 0) then if(PRICE_LIST__PAYDIS is null OR PRICE_LIST__PAYDIS = '') then SELECT L.PRICE_LIST__PAYDIS into PRICE_LIST__PAYDIS FROM strg_customer SC, LOCALITY L WHERE SC.LOCALITY_CODE=L.LOCALITY_CODE AND SC_CODE = as_strg_code ; cnt :=0; end if; end if; if(PRICE_LIST__PAYDIS is null OR PRICE_LIST__PAYDIS = '') then select st.PRICE_LIST__PAYDIS into PRICE_LIST__PAYDIS from state st left outer join sales_pers sp on sp.state_code = st.state_code where sp.sales_pers=as_sales_pers; end if; return PRICE_LIST__PAYDIS; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PORDER_RECOAMT (as_porder in char , as_lineno in int, as_type char ,as_band in char) return number is lc_amt number(14,3) ; lc_taxdiff number(14,3) ; begin lc_taxdiff := 0 ; if as_type = 'S' and as_band = 'D' then select nvl(quantity*rate__std,0) into lc_amt from sorddet where sale_order = as_porder and line_no = as_lineno ; elsif as_type = 'S' and as_band = 'H' then select nvl(quantity*rate__std,0) into lc_amt from sorddet where sale_order = as_porder; elsif as_type = 'S' and as_band ='D' then select nvl(net_amt,0) into lc_amt from sorddet where sale_order = as_porder and line_no = as_lineno ; select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and a.line_no = as_lineno and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_amt + lc_taxdiff ; elsif as_type = 'R' and as_band = 'D' then -- reco amt select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and a.line_no = as_lineno and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_taxdiff ; elsif as_type = 'R' and as_band = 'H' then -- reco amt select sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'P-ORD' and a.tran_id = as_porder and b.effect <> 'N' and a.reco_amount > 0 ; lc_amt := lc_taxdiff ; elsif as_type = 'P' and as_band = 'H' then -- std cost select sum(nvl(quantity,0) * nvl(std_rate ,0)) into lc_amt from porddet where purc_order = as_porder; end if ; lc_amt := NVL(lc_amt,0) ; return lc_amt ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TAXAUTH_APPL_FOR_SITE (as_tauthcode in TAX_AUTHORITY.TAUTH_CODE%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_TAXAUTH'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from SITE_TAX_AUTHORITY where site_code = as_sitecode and TAUTH_CODE = as_tauthcode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PALLETMERGE_X ON PALLETMERGE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VAL_ITPROOF_CHGSTATUS (AS_TRAN_ID CHAR, AS_LOGIN_EMP_CODE CHAR) RETURN VARCHAR2 IS LS_RETURN VARCHAR2(4000); LS_CONFIRMED EMP_ITDECL_HDR.CONFIRMED%TYPE; LS_STATUS EMP_ITDECL_HDR.STATUS%TYPE; BEGIN ls_return := ''; SELECT CONFIRMED,STATUS INTO LS_CONFIRMED, LS_STATUS FROM EMP_ITDECL_HDR WHERE TRAN_ID = AS_TRAN_ID; IF LS_CONFIRMED IS NOT NULL AND LS_CONFIRMED = 'Y' THEN RETURN ''; END IF; IF LS_STATUS IS NOT NULL AND LS_STATUS = 'D' THEN SELECT FN_VAL_EMP_IT_PROOF(AS_TRAN_ID, 'Y', 'CONFIRM', '') INTO LS_RETURN FROM DUAL; LS_RETURN := NVL(LS_RETURN, ''); END IF; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_COMPANY_NAME_DTL (lbill_type in char,lporder_no in char,lvoucher_no in char) return char is ls_compny_name varchar(100); ls_var_value varchar(200); begin begin if lbill_type = '' then ls_compny_name := ''; elsif lbill_type ='1' then SELECT site.descr into ls_compny_name FROM porder porder LEFT OUTER JOIN site site ON site.site_code = porder.site_code__bill WHERE purc_order = lporder_no; elsif lbill_type ='2' then SELECT var_value into ls_var_value FROM finparm WHERE prd_code = '999999' AND var_name = 'MISC_TRAN_SER'; BEGIN SELECT site.descr into ls_compny_name FROM misc_payables LEFT OUTER JOIN site ON site.site_code = misc_payables.site_code WHERE ref_no = lvoucher_no AND INSTR(','|| ls_var_value || ',',','|| TRIM(TRAN_Ser) || ',' ) > 0 AND misc_payables.tot_amt <> misc_payables.adj_amt GROUP BY site.descr; EXCEPTION WHEN NO_DATA_FOUND THEN begin SELECT a.descr into ls_compny_name FROM (SELECT site.descr FROM misc_voucher LEFT OUTER JOIN site ON site.site_code = misc_voucher.site_code WHERE misc_voucher.tran_id = lvoucher_no AND confirmed = 'N' UNION ALL SELECT site.descr FROM payr_voucher LEFT OUTER JOIN site ON site.site_code = payr_voucher.site_code WHERE payr_voucher.tran_id = lvoucher_no AND confirmed = 'N' UNION ALL SELECT site.descr FROM drcr_inv LEFT OUTER JOIN site ON site.site_code = drcr_inv.site_code WHERE drcr_inv.tran_id = lvoucher_no AND confirmed = 'N') A; end; END; end if; exception when no_data_found then ls_compny_name := ''; end; return ls_compny_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ACCOUNTS_CCTR_ACCT_CODE ON ACCOUNTS_CCTR (ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE EMPPOS AS OBJECT (CODE CHAR(10)) -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EMPLOYEE_NAME ( as_emp_code char , as_nmtype char default '5') return varchar2 is ls_name varchar2(45); ls_fname varchar2(15); ls_mname varchar2(15); ls_lname varchar2(15); ls_shname varchar2(40); begin begin select nvl(emp_fname,'') , nvl(emp_mname,'') , nvl(emp_lname,'') , nvl(short_name,'') into ls_fname , ls_mname , ls_lname , ls_shname from employee where emp_code = as_emp_code; exception when no_data_found then ls_name := ''; ls_fname := ''; ls_mname := ''; ls_lname := ''; ls_shname := ''; end; if as_nmtype = '1' then ls_name := ls_fname; else if as_nmtype = '2' then ls_name := ls_mname; else if as_nmtype = '3' then ls_name := ls_lname; else if as_nmtype = '4' then ls_name := ls_fname||' '||ls_lname; else if as_nmtype = '5' then ls_name := ls_fname||' '||ls_mname||' ' ||ls_lname; else if as_nmtype = '6' then ls_name := ls_shname; end if; end if; end if; end if; end if; end if; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_RG1 (lsite_code in char,litem_code in char,llot_no in char,ad_from_date in date,ltype in char,lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 and ((c.loc_group like 'BSR%' ) or (c.loc_group like 'SAMP%') OR (c.loc_group like 'EXP%')) union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0 and ((b.loc_group like 'BSR%' ) or (b.loc_group like 'SAMP%') OR (b.loc_group like 'EXP%') )) ; end if; if ltype = 'B' then select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 and ((c.loc_group like 'BSR%' ) or (c.loc_group like 'SAMP%') OR (c.loc_group like 'EXP%') ) union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0 and ( (b.loc_group like 'BSR%' ) or (b.loc_group like 'SAMP%') OR (b.loc_group like'EXP%'))) ; end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCK_RETEST (as_site stock.site_code%type, as_item stock.item_code%type, as_loc stock.loc_code%type, as_lot stock.lot_no%type, as_lotsl stock.lot_sl%type) return date is ld_date date; ld_temp date; begin ld_temp := '01-jan-1947'; select retest_date into ld_date from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and lot_sl = as_lotsl; if sysdate + 14 >= ld_date then return ld_date; else return ld_temp; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PACK_INSTR (as_item_code stock.item_code%type, as_site_code stock.site_code%type, as_loc_code stock.loc_code%type, as_lot_no stock.lot_no%type, as_lot_sl stock.lot_sl%type, as_exp_lev workorder_issdet.exp_lev%type, as_tran_type workorder_iss.tran_type%type, as_workorder workorder.work_order%type) return char is ls_pack_instr stock.pack_instr%type; ls_loc_code stock.loc_code%type; begin if as_tran_type = 'R' then select loc_code into ls_loc_code from workorder_iss a, workorder_issdet b where a.tran_id = b.tran_id and a.site_code = as_site_code and a.work_order = as_workorder and b.exp_lev = as_exp_lev and b.item_code = as_item_code and b.lot_no = as_lot_no and b.lot_sl = as_lot_sl and rownum = 1; else ls_loc_code := as_loc_code; end if; select pack_instr into ls_pack_instr from stock where item_code = as_item_code and site_code = as_site_code and loc_code = ls_loc_code and lot_no = as_lot_no and lot_sl = as_lot_sl and inv_stat = 'SALE'; return (ls_pack_instr); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX POWER_ATT_DET_X ON POWER_ATT_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SB_DATE ON SUPPLIER_BILL (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IRC_SITE_FROM_TO ON IBCA_RCP_CTRL (SITE_CODE__FROM, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GST_UNREGISTERED_CHECK (as_sundry_type in char,as_sundry_code in char, as_taxenv in char) return number is v_return number; v_gstno VARCHAR2(30); begin if as_sundry_type='S' then select tax_reg_2 into v_gstno from supplier where supp_code=as_sundry_code; end if; if as_sundry_type='T' then select tax_reg_2 into v_gstno from transporter where tran_code=as_sundry_code; end if; if as_sundry_type in ('S','T') then if as_taxenv in ('ELWC02','ELWC01','EIWC01','PIWC01','PIWC02','PLWC02','PLWC01') and (v_gstno='UNREGISTER' or v_gstno is null) then v_return :=1; else v_return :=0; end if; else v_return:=0; end if; return v_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_ISS_TRAN_SITE_CODE ON DISTORD_ISS (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RTAXTRANCESSAMT (as_tran_id in char) return number is lc_amount number(14,3); LS_VARVAL VARCHAR(500); LL_EXCHRATE NUMBER(14,3); begin SELECT VAR_VALUE INTO LS_VARVAL FROM DISPARM WHERE VAR_NAME ='EDU_CESS_TAXCODE'; select nvl(sum(nvl(reco_amount,0)),0) into lc_amount from taxtran where ( taxtran.tran_code IN ('P-RCP','P-RET' ) and ( tran_id = as_tran_id ) and ( taxtran.tax_code in LS_VARVAL)) ; SELECT EXCH_RATE INTO LL_EXCHRATE FROM PORCP WHERE TRAN_ID= AS_TRAN_ID; return lc_amount * LL_EXCHRATE ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_TAXTRAN_FORM ON TAXTRAN (TRAN_CODE, TAX_FORM, TRAN_ID, FORM_NO, LINE_NO, LINE_NO__TAX, TAX_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE LOCALITYCODEPOPHELP AS FUNCTION getlocalityPophelpData (empCode in char) RETURN localityCodeMasterTABLE PIPELINED; END localityCodePophelp; CREATE OR REPLACE PACKAGE BODY LOCALITYCODEPOPHELP AS FUNCTION getlocalityPophelpData (empCode in char) RETURN localityCodeMasterTABLE PIPELINED IS ls_cnt number(35); BEGIN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; if(ls_cnt > 0) then for x in( SELECT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.ADDR1 ||' ' || CUST.ADDR2 || ' ' || CUST.ADDR3 ELSE SC.ADDR1 ||' ' || SC.ADDR2 || ' ' || SC.ADDR3 END) AS STOCKIST_ADDRESS, SC.GST_NO AS STOCKIST_GST_NO , ST.DESCR AS STOCKIST_STATE , SR.INVOICE_SR_NO AS INVOICE_SR_NO, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM , (CASE WHEN GET_SER_CLASS_COUNT(Sp.Sales_Pers)=1 THEN SP.ITEM_SER ELSE ' ' END) AS ITEM_SER,SR.ROUTE_ID AS ROUTE_ID ,SR.STATION_TYPE AS STATION_TYPE, S.DESCR AS STATION_DESCR,SR.ROUTE_TYPE, SR.PLAN_DAYS FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE, EMPLOYEE EMP,SALES_PERS SP,STATION S WHERE SR.SPRS_CODE IN ( SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SR.STATUS ='Y' AND S.STAN_CODE=SR.STAN_CODE AND EMP.EMP_CODE = SR.SPRS_CODE and emp.emp_code = Sp.Sales_Pers and sr.sprs_code=sp.sales_pers AND EMP.RELIEVE_DATE IS NULL ) LOOP PIPE ROW (localityCodeMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.STOCKIST_ADDRESS,x.STOCKIST_GST_NO,x.STOCKIST_STATE,x.INVOICE_SR_NO,x.VISITED_WITH_TEAM,x.ITEM_SER,x.ROUTE_ID,x.STATION_TYPE,x.STATION_DESCR,x.ROUTE_TYPE,x.PLAN_DAYS)); END LOOP; RETURN; end if; if(ls_cnt <= 0) then for x in( SELECT SR.LOCALITY_CODE AS LOCALITY_CODE,(CASE WHEN SR.ROUTE_DESCR IS NOT NULL THEN SR.ROUTE_DESCR ELSE SR.DESCR END) AS DESCR,L.DEF_DISTRIBUTOR AS STOCKIST_CODE, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.CUST_NAME ELSE SC.FIRST_NAME || ' ' || SC.LAST_NAME END) AS STOCKIST_NAME, (CASE WHEN GET_SFAPARM_DATA('GET_STOCKIST_DETAILS',empCode) = 'SPRS_STOCKIST' THEN CUST.ADDR1 ||' ' || CUST.ADDR2 || ' ' || CUST.ADDR3 ELSE SC.ADDR1 ||' ' || SC.ADDR2 || ' ' || SC.ADDR3 END) AS STOCKIST_ADDRESS, SC.GST_NO AS STOCKIST_GST_NO , ST.DESCR AS STOCKIST_STATE , SR.INVOICE_SR_NO AS INVOICE_SR_NO, TRIM(SR.SPRS_CODE) AS VISITED_WITH_TEAM , (CASE WHEN GET_SER_CLASS_COUNT(Sp.Sales_Pers)=1 THEN SP.ITEM_SER ELSE ' ' END) AS ITEM_SER,SR.ROUTE_ID AS ROUTE_ID ,SR.STATION_TYPE AS STATION_TYPE, S.DESCR AS STATION_DESCR,SR.ROUTE_TYPE, SR.PLAN_DAYS FROM SPRS_ROUTE SR LEFT OUTER JOIN LOCALITY L ON L.LOCALITY_CODE=SR.LOCALITY_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN CUSTOMER CUST ON CUST.CUST_CODE = L.DEF_DISTRIBUTOR LEFT OUTER JOIN STATE ST ON ST.STATE_CODE = SC.STATE_CODE, EMPLOYEE EMP,SALES_PERS SP,STATION S WHERE SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND SR.STATUS ='Y' AND S.STAN_CODE=SR.STAN_CODE AND EMP.EMP_CODE = SR.SPRS_CODE and emp.emp_code = Sp.Sales_Pers and sr.sprs_code=sp.sales_pers) LOOP PIPE ROW (localityCodeMaster(x.LOCALITY_CODE,x.DESCR,x.STOCKIST_CODE,x.STOCKIST_NAME,x.STOCKIST_ADDRESS,x.STOCKIST_GST_NO,x.STOCKIST_STATE,x.INVOICE_SR_NO,x.VISITED_WITH_TEAM,x.ITEM_SER,x.ROUTE_ID,x.STATION_TYPE,x.STATION_DESCR,x.ROUTE_TYPE,x.PLAN_DAYS)); END LOOP; RETURN; END IF; END; END localityCodePophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DRCR_INV_CHK BEFORE INSERT OR UPDATE OF confirmed ON drcr_inv referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; ls_drcrflag drcr_inv.DRCR_FLAG%type; ls_refser gltrace.ref_ser%type; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin --select amount, DRCR_FLAG into lc_hdramt,ls_drcrflag from drcr_inv --where tran_id = :new.tran_id; lc_hdramt := :new.amount ; ls_drcrflag := :new.DRCR_FLAG; exception when others then lc_hdramt := 0; end; if ls_drcrflag = 'D' then ls_refser := 'DRNINV'; else ls_refser := 'CRNINV'; end if; begin select count(1) into ll_glcount from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if lc_hdramt <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but net amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_CORD_QTY BEFORE insert or update ON consume_ord_det referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; BEGIN if :new.quantity < :new.ISSUE_QTY then raise_application_error( -20601, 'Issue quantity more than order quantity for line # [' ||:new.line_no ||'] Qantity [' || to_char(:new.quantity) || '] Issue Quantity [' || to_char(:new.ISSUE_QTY) || ']' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_FTRF_DATE ON FUNDTRANSFER (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INT_RATE (ac_amount in number,al_no_days in number,as_crterm char,ad_date in date) return varchar is lc_int_rate varchar(100) ; lc_finchg varchar(100) ; ls_type varchar(100); ls_return varchar(100) ; begin ls_return := ddf_crtermfc(ac_amount, al_no_days, as_crterm, ad_date); if ls_return = '-1' then return -1 ; end if ; ls_type := ddf_get_token(ls_return,',') ; lc_finchg :=(ls_return) ; if ls_type = 'P' then lc_int_rate := lc_finchg ; else return -1 ; end if ; Return lc_int_rate ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE EXPENSE_BANNER_PKG AS FUNCTION getExpenseBanner(empCode in char, prdCode in char) RETURN EXPENSE_BANNER_TB PIPELINED; END EXPENSE_BANNER_PKG; CREATE OR REPLACE PACKAGE BODY EXPENSE_BANNER_PKG AS FUNCTION getExpenseBanner(empCode in char, prdCode in char) RETURN EXPENSE_BANNER_TB PIPELINED AS BEGIN for x in ( SELECT TO_CHAR(MONTH) PRD_MONTH, TO_CHAR(PRD_DATE) PRD_DATE, TO_CHAR(TRAN_ID) TRAN_ID,TO_CHAR(EXP_STATUS) STATUS, TO_CHAR(STATUS_DATE) STATUS_DATE, TO_CHAR( APRV_NAME) APRV_NAME, TO_CHAR(HO_NAME) HO_NAME, TO_CHAR(NVL(CLAIM_AMT,0)) AS CLAIM_AMT, TO_CHAR(NVL(ADD_AMT,0)) ADD_AMT,TO_CHAR(NVL(DED_AMT,0))AS DED_AMT,TO_CHAR(NVL(PASS_AMT,0))AS PASSED_AMT, TO_CHAR(NVL(ADV_ADJUST,0)) AS ADV_ADJUSTED,TO_CHAR(NVL(AMT_PAID,0)) AS AMT_PAID, TO_CHAR(PAYMENT_DAYS) PAYMENT_DAYS, TO_CHAR(PAYMENT_DATE) PAYMENT_DATE, TO_CHAR(HARD_COPY_RECD_DATE) HARD_COPY_RECD_DATE, TO_CHAR(EXP_RECD_DATE) EXP_RECD_DATE, TO_CHAR(TRANSFER_DATE) TRANSFER_DATE, TO_CHAR(APRV_DATE) APRV_DATE, TO_CHAR(APRV_STATUS) APRV_STATUS, TO_CHAR(HO_DATE) HO_APRV_DATE, TO_CHAR(HO_STATUS) HO_STATUS, TO_CHAR(HD_STATUS) HD_STATUS, TO_CHAR(EXP_RECD_DATE) DUE_DATE,TO_CHAR(HO_CODE) HO_CODE,TO_CHAR(APRV_CODE) APRV_CODE FROM ( WITH VMONDT AS(select c.emp_code, b.code, b.fr_date, b.to_date, a.start_date, a.end_date from (select to_char(start_date,'YYYYMM') AS f_mon, to_char(end_date,'yyyymm') as t_mon, start_date, end_date from(Select trunc((sysdate-184),'month') AS START_DATE, (trunc(sysdate) - (to_number(to_char(sysdate,'DD')) - 1)-1) AS END_date from dual)) a, period b , employee c where c.emp_code = empCode and b.code between a.f_mon and a.t_mon and b.code >= to_char(trunc(c.date_join),'YYYYMM')) , VDT AS (SELECT START_DATE, END_DATE FROM VMONDT GROUP BY START_DATE, END_DATE), EPS as ( SELECT D.MONTH,X.EMP_CODE__APPR,D.FR_DATE,X.CONFIRMED,D.TOUR_DT,X.STATUS,X.WRKFLW_STATUS,X.EMP_CODE,D.TRAN_ID,X.VERIFY_DATE, ( CASE WHEN D.STATUS ='X' AND D.TID = D.TOUR_ID THEN 'System' WHEN D.STATUS ='X' AND NVL(D.TID,'0') <> NVL(D.TOUR_ID,'0') AND D.TRAN_ID IS NOT NULL THEN 'Manual - System' WHEN D.STATUS ='X' AND D.TRAN_ID IS NULL THEN 'Error' WHEN D.STATUS ='Z' AND D.TRAN_ID IS NOT NULL THEN 'Manual' WHEN D.STATUS ='SO' AND D.TRAN_ID IS NULL THEN 'Pending Emp' WHEN D.STATUS ='SO' AND D.TRAN_ID IS NOT NULL THEN 'Manual - SO' WHEN D.STATUS ='MGR' AND D.TRAN_ID IS NULL THEN 'Pending App' WHEN D.STATUS ='CHCMGR' AND D.TRAN_ID IS NULL THEN 'Pending App' WHEN D.STATUS ='MGR' AND D.TRAN_ID IS NOT NULL THEN 'Manual - MGR' WHEN D.STATUS ='Z' AND D.TRAN_ID IS NULL THEN 'Pending' WHEN D.STATUS ='CHC' AND D.TRAN_ID IS NULL THEN 'Pending Sales Admin' WHEN D.STATUS ='CHC' AND D.TRAN_ID IS NOT NULL THEN 'Manual - Pending Sales Admin' ELSE 'ErrorZZ' END) AS EXP_STATUS, ( CASE WHEN D.STATUS ='CHC' AND D.TRAN_ID IS NULL THEN 'Y' ELSE 'N' END) AS TYPE, X.TOUR_ID, X.BILL_DATE AS TOUR_DATE, X.DOC_RECEIVE_DATE, X.DUE_DATE, X.NET_AMT AS TOT_CLAIM FROM (SELECT DDF_SMKT_GEN_DET(A.EMP_CODE,NULL,NULL,NULL,'SH_ITEMSER') AS DIV, A.EMP_CODE, (A.EMP_FNAME ||' ' ||A.EMP_MNAME ||' ' ||A.EMP_LNAME) AS EMP_NAME, DDF_SMKT_GEN_DET(A.EMP_CODE,NULL,NULL,NULL,'HQ_STN_DESC') AS HQ , DDF_SMKT_GEN_DET(A.EMP_CODE,NULL,NULL,NULL,'DESG') AS DESG , E.CODE AS MONTH, E.TO_DATE, E.FR_DATE, A.DATE_JOIN AS DOJ, (SELECT X.TOUR_ID FROM MISC_VOUCHER X WHERE X.SUNDRY_TYPE = 'E' AND X.SUNDRY_CODE= A.EMP_CODE AND X.BILL_NO = E.CODE AND X.VOUCH_TYPE = 'F' ) AS TID, (SELECT X.TRAN_ID FROM MISC_VOUCHER X WHERE X.SUNDRY_TYPE = 'E' AND X.SUNDRY_CODE= A.EMP_CODE AND X.BILL_NO = E.CODE AND X.VOUCH_TYPE = 'F' ) AS TRAN_ID, (SELECT X.TOUR_ID FROM TOUR X WHERE X.EMP_CODE= A.EMP_CODE AND TRUNC(X.DATE_FROM,'MONTH') = E.FR_DATE AND X.CONFIRMED <> 'X' and rownum= 1 ) as TOUR_ID, (SELECT X.TOUR_DATE FROM TOUR X WHERE X.EMP_CODE= A.EMP_CODE AND TRUNC(X.DATE_FROM,'MONTH') = E.FR_DATE AND X.CONFIRMED<> 'X' AND ROWNUM= 1 ) AS TOUR_DT, NVL( ( SELECT ( CASE WHEN X.CONFIRMED = 'Y' AND X.STATUS = 'S' AND NVL(X.WRKFLW_STATUS,'Z') = 'PD' THEN 'CHC' WHEN X.CONFIRMED = 'N' AND X.STATUS ='U' THEN 'SO' WHEN X.CONFIRMED = 'Y' AND X.STATUS='U' AND NVL(X.WRKFLW_STATUS,'Z') <> 'PA' THEN 'MGR' WHEN X.CONFIRMED = 'Y' AND X.STATUS ='U' AND NVL(X.WRKFLW_STATUS,'Z') = 'PA' THEN 'CHCMGR' WHEN X.CONFIRMED = 'N' AND X.STATUS ='R' THEN 'SO' WHEN X.CONFIRMED = 'Y' AND X.STATUS ='R' THEN 'MGR' WHEN X.CONFIRMED IN('Y','A') AND X.STATUS IN('A','S') THEN 'X' ELSE 'Error' END) AS CC FROM TOUR X WHERE X.EMP_CODE= A.EMP_CODE AND TRUNC(X.DATE_FROM,'MONTH') = E.FR_DATE AND X.CONFIRMED<> 'X' AND ROWNUM= 1 ),'Z') AS STATUS FROM EMPLOYEE A , VMONDT E WHERE A.EMP_CODE = empCode AND A.EMP_CODE= E.EMP_CODE ) D , TOUR X WHERE D.TOUR_ID = X.TOUR_ID(+) ), VCH AS(SELECT MISC_VOUCHER.CONF_DATE, MISC_VOUCHER.EMP_CODE__APRV,MISC_VOUCHER.BILL_NO AS MONTH , MISC_VOUCHER.BILL_DATE AS EXP_RECD_DATE , MISC_VOUCHER.EFF_DATE AS HARD_COPY_RECD_DATE , MISC_VOUCHER.CONFIRMED , MISC_VOUCHER.TRAN_ID AS TRAN_ID , MISC_VOUCHER.DUE_DATE AS TRANSFER_DATE , MISC_VOUCHER.PAY_MODE AS PAY__MODE , sum(MISC_VOUCHDET.UDF__NUM2) AS DED_AMT , sum(MISC_VOUCHDET.UDF__NUM1) AS ADD_AMT , sum(MISC_VOUCHDET.AMOUNT) AS PASSED_AMT , MAX(MISC_VOUCHER.ADV_AMT*-1) as ADV_ADJUSTED FROM EMPLOYEE, MISC_VOUCHER, MISC_VOUCHDET , VDT,VMONDT WHERE MISC_VOUCHER.TRAN_ID = MISC_VOUCHDET.TRAN_ID AND MISC_VOUCHER.VOUCH_TYPE = 'F' AND MISC_VOUCHER.SUNDRY_CODE = EMPLOYEE.EMP_CODE AND MISC_VOUCHER.TRAN_DATE >= VDT.START_DATE AND MISC_VOUCHER.BILL_NO = VMONDT.CODE AND EMPLOYEE.EMP_CODE = empCode GROUP BY DDF_SMKT_GEN_DET(EMPLOYEE.EMP_CODE,NULL,NULL,NULL,'SH_ITEMSER'), EMPLOYEE.EMP_CODE, (EMPLOYEE.EMP_FNAME||' '||EMPLOYEE.EMP_MNAME||' '||EMPLOYEE.EMP_LNAME), DDF_SMKT_GEN_DET(EMPLOYEE.EMP_CODE,NULL,NULL,NULL,'HQ_STN_DESC'), DDF_SMKT_GEN_DET(EMPLOYEE.EMP_CODE,NULL,NULL,NULL,'DESG'), EMPLOYEE.DATE_JOIN, MISC_VOUCHER.BILL_NO, MISC_VOUCHER.BILL_DATE, MISC_VOUCHER.EFF_DATE, MISC_VOUCHER.CONFIRMED, MISC_VOUCHER.TRAN_ID, MISC_VOUCHER.DUE_DATE, MISC_VOUCHER.PAY_MODE, MISC_VOUCHER.EMP_CODE__APRV,MISC_VOUCHER.CONF_DATE), PMT AS (SELECT VOUCHER_NO, MAX(TRAN_ID) AS TRAN_ID, MAX(TRAN_DATE) AS TRAN_DATE, MAX(CONFIRMED) AS CONFIRMED, MAX(PAY_MODE) AS PAY_MODE, MAX(BANK_CODE) AS BANK_CODE, MAX(BANK_NAME) AS BANK_NAME, MAX(INSTR_NO) AS INSTR_NO, MAX(INSTR_DATE) AS INSTR_DATE, SUM(PAY_AMT) AS PAY_AMT, SUM(ADV_ADJ_AMT) AS ADV_ADJ_AMT FROM(SELECT c.tran_id as VOUCHER_NO, (CASE WHEN A.NET_AMT <> 0 THEN A.TRAN_ID ELSE '' END) AS TRAN_ID, (CASE WHEN A.NET_AMT <> 0 THEN A.TRAN_DATE ELSE NULL END) AS TRAN_DATE, 'Y' AS CONFIRMED, (CASE WHEN A.NET_AMT <> 0 THEN A.PAY_MODE ELSE '' END) AS PAY_MODE, B.PAY_AMT, (CASE WHEN A.NET_AMT <> 0 THEN A.BANK_CODE ELSE '' END) AS BANK_CODE, B.SUNDRY_CODE, (CASE WHEN A.NET_AMT <> 0 THEN BANK.BANK_NAME ELSE '' END) AS BANK_NAME , (CASE WHEN A.NET_AMT <> 0 THEN b.INSTR_NO ELSE '' END) AS INSTR_NO, (CASE WHEN A.NET_AMT <> 0 THEN b.INSTR_DATE ELSE NULL END) AS INSTR_DATE, (CASE WHEN A.NET_AMT = 0 THEN (SELECT SUM(J.PAY_AMT) from MISC_PAYDET J WHERE J.TRAN_ID = B.TRAN_ID AND J.TRAN_SER = 'M-ADV' AND J.SUNDRY_CODE = B.SUNDRY_CODE) ELSE 0 END) AS ADV_ADJ_AMT FROM misc_payment a, misc_paydet B, VCH c, BANK WHERE b.tran_ser = 'M-VOUC' AND b.vouch_no = c.tran_id AND b.tran_id = a.tran_id AND A.CONFIRMED = 'Y' AND A.BANK_CODE = BANK.BANK_CODE AND 1 = NVL ((SELECT MAX(0) as CC FROM MISC_PAYMENT_CANC D , MISC_PAYMENT_CANCDET E WHERE D.PAYMENT_NO = A.TRAN_ID AND D.SITE_CODE = A.SITE_CODE AND D.CONFIRMED = 'Y' AND E.TRAN_ID = D.TRAN_ID AND E.VOUCH_NO = B.VOUCH_NO),1)) X GROUP BY voucher_no) select C.CODE as month , TO_CHAR(TO_DATE(C.FR_DATE),'Mon YYYY') as PRD_DATE, (CASE WHEN (SS.EXP_STATUS = 'System' OR SS.EXP_STATUS = 'Pending Sales Admin') THEN 'Expense Submitted' ELSE SS.EXP_STATUS ||(CASE WHEN A.CONFIRMED = 'Y' THEN ' - Confirmed' WHEN A.CONFIRMED = 'N' THEN ' - UnConfirmed' ELSE '' END) END )AS EXP_STATUS, SS.TOUR_DT AS STATUS_DATE, INITCAP(EMP_HO.EMP_FNAME ||' ' ||EMP_HO.EMP_LNAME )|| ' - ' || EMP_HO.DESIGN_CODE AS HO_NAME, initcap(EMP_APRV.EMP_FNAME ||' ' ||EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE as APRV_NAME, (a.PASSED_AMT+DED_AMT-ADD_AMT) as CLAIM_AMT, NVL(A.ADD_AMT,0) AS ADD_AMT, NVL(A.DED_AMT,0) AS DED_AMT, NVL(A.PASSED_AMT,0) AS PASS_AMT, (A.ADV_ADJUSTED+NVL(B.ADV_ADJ_AMT,0)) AS ADV_ADJUST,(a.PASSED_AMT - (a.ADV_ADJUSTED+NVL(B.ADV_ADJ_AMT,0))) as AMT_PAID, (CASE WHEN B.TRAN_DATE IS NOT NULL AND A.EXP_RECD_DATE IS NOT NULL THEN (B.TRAN_DATE-A.HARD_COPY_RECD_DATE) ELSE 0 END) AS PAYMENT_DAYS, B.TRAN_DATE as PAYMENT_DATE, a.HARD_COPY_RECD_DATE, a.EXP_RECD_DATE, a.TRANSFER_DATE, a.TRAN_ID, (case when a.TRAN_ID is null then a.HARD_COPY_RECD_DATE when a.TRAN_ID is not null and a.CONFIRMED = 'Y' then a.CONF_DATE WHEN a.TRAN_ID is not null and (a.CONFIRMED = 'N' OR a.CONFIRMED is NULL ) THEN SS.VERIFY_DATE ELSE null END )AS HO_DATE,--a.HO_DATE, (CASE WHEN SS.DOC_RECEIVE_DATE IS NOT NULL THEN 'Hard Copy Received' ELSE null END )AS HD_STATUS, EMP_APRV.EMP_CODE APRV_CODE, EMP_HO.EMP_CODE HO_CODE, (CASE WHEN SS.CONFIRMED = 'Y' AND SS.STATUS='U' AND (NVL(SS.WRKFLW_STATUS,'Z') <> 'PA' OR NVL(SS.WRKFLW_STATUS,'Z') = 'PA') THEN 'Pending with Reporting ' || (SELECT (INITCAP(EMP_FNAME ||' ' ||EMP_LNAME) || ' - ' || DESIGN_CODE) from employee where emp_code = (select report_to from employee where emp_code = SS.emp_code) ) WHEN SS.CONFIRMED = 'Y' AND SS.STATUS ='R' THEN 'Pending with Reporting ' || INITCAP(EMP_APRV.EMP_FNAME ||' ' ||EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE WHEN SS.CONFIRMED = 'A' THEN 'Approved by Reporting ' || initcap(EMP_APRV.EMP_FNAME ||' ' || EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE ELSE null END )AS APRV_STATUS, (CASE WHEN a.TRAN_ID IS NULL THEN 'Pending SalesAdmin ' WHEN A.TRAN_ID IS NOT NULL AND A.CONFIRMED = 'Y' THEN 'System - Confirmed ' || INITCAP(EMP_HO.EMP_FNAME ||' ' ||EMP_HO.EMP_LNAME) || ' - ' || EMP_HO.DESIGN_CODE WHEN a.TRAN_ID is not null and a.CONFIRMED = 'N' THEN 'System - UnConfirmed ' || initcap(EMP_APRV.EMP_FNAME ||' ' ||EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE ELSE null END )AS HO_STATUS, (CASE WHEN A.TRAN_ID IS NULL THEN SS.TOUR_DT ELSE a.EXP_RECD_DATE END )AS APRV_DATE from EPS SS, VCH a, PMT B,VMONDT C, employee EMP_HO, employee EMP_APRV where SS.month = C.CODE and EMP_APRV.EMP_CODE = SS.EMP_CODE__APPR and EMP_HO.EMP_CODE = a.EMP_CODE__APRV and a.TRAN_ID = B.VOUCHER_NO(+) and a.month = C.CODE(+) union all select a.month as month ,TO_CHAR(TO_DATE(a.FR_DATE),'Mon YYYY') as PRD_DATE, (case when (a.EXP_STATUS = 'System' or a.EXP_STATUS = 'Pending Sales Admin' or a.EXP_STATUS = 'Pending App') then 'Expense Submitted' else a.EXP_STATUS ||(case when a.CONFIRMED = 'Y' then ' - Confirmed' when a.CONFIRMED = 'N' then '' else '' end) end )as EXP_STATUS, a.TOUR_DT as STATUS_DATE,null as HO_NAME, (case when a.CONFIRMED = 'Y' and a.STATUS='U' and (NVL(a.WRKFLW_STATUS,'Z') <> 'PA' or NVL(a.WRKFLW_STATUS,'Z') = 'PA') then (select (INITCAP(EMP_FNAME ||' ' ||EMP_LNAME) || ' - ' || DESIGN_CODE) from EMPLOYEE where EMP_CODE = (select REPORT_TO from EMPLOYEE where EMP_CODE = a.EMP_CODE) ) WHEN A.CONFIRMED = 'Y' AND A.STATUS ='R' THEN INITCAP(EMP_APRV.EMP_FNAME ||' ' ||EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE WHEN (A.CONFIRMED = 'Y' OR A.CONFIRMED = 'A') THEN INITCAP(EMP_APRV.EMP_FNAME ||' ' || EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE ELSE null END ) as APRV_NAME, (CASE WHEN A.TYPE = 'Y' THEN A.TOT_CLAIM ELSE 0 END) AS CLAIM_AMT, null as ADD_AMT, null as DED_AMT, null as PASS_AMT, null as ADV_ADJUST, null as AMT_PAID, null as PAYMENT_DAYS , NULL AS PAYMENT_DATE, (CASE WHEN A.TYPE = 'Y' THEN A.DOC_RECEIVE_DATE ELSE NULL END) AS HARD_COPY_RECD_DATE, (CASE WHEN A.TYPE = 'Y' THEN A.TOUR_DATE ELSE NULL END) AS EXP_RECD_DATE, (CASE WHEN A.TYPE = 'Y' THEN A.DUE_DATE ELSE NULL END) AS TRANSFER_DATE, (case when a.type = 'Y' then null else null end) as TRAN_ID,(case when a.TRAN_ID is null then A.DUE_DATE else null end)as HO_DATE, (CASE WHEN A.DOC_RECEIVE_DATE IS NOT NULL THEN 'Hard Copy Received' ELSE null END )AS HD_STATUS , (CASE WHEN A.CONFIRMED = 'Y' AND A.STATUS='U' AND (NVL(A.WRKFLW_STATUS,'Z') <> 'PA' OR NVL(A.WRKFLW_STATUS,'Z') = 'PA') THEN (select report_to from employee where emp_code = a.emp_code) WHEN A.CONFIRMED = 'Y' AND A.STATUS ='R' THEN A.EMP_CODE__APPR WHEN (A.CONFIRMED = 'Y' OR A.CONFIRMED = 'A') THEN A.EMP_CODE__APPR ELSE NULL END ) APRV_CODE, NULL HO_CODE, (CASE WHEN A.CONFIRMED = 'Y' AND A.STATUS='U' AND (NVL(A.WRKFLW_STATUS,'Z') <> 'PA' OR NVL(A.WRKFLW_STATUS,'Z') = 'PA') THEN 'Pending with Reporting ' || (SELECT (INITCAP(EMP_FNAME ||' ' ||EMP_LNAME) || ' - ' || DESIGN_CODE) from employee where emp_code = (select report_to from employee where emp_code = a.emp_code) ) WHEN A.CONFIRMED = 'Y' AND A.STATUS ='R' THEN 'Pending with Reporting ' || INITCAP(EMP_APRV.EMP_FNAME ||' ' ||EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE WHEN (A.CONFIRMED = 'Y' OR A.CONFIRMED = 'A') THEN 'Approved by Reporting ' || INITCAP(EMP_APRV.EMP_FNAME ||' ' || EMP_APRV.EMP_LNAME) || ' - ' || EMP_APRV.DESIGN_CODE else null end )as APRV_STATUS, (case when (a.TRAN_ID is null and ( a.EXP_STATUS = 'Pending' or a.EXP_STATUS = 'Pending Emp' or a.EXP_STATUS = 'Pending App') ) then null else 'Pending SalesAdmin' end) AS HO_STATUS, (CASE WHEN (A.CONFIRMED = 'Y' OR A.CONFIRMED = 'A') THEN A.TOUR_DT ELSE NULL END) AS APRV_DATE from EPS a, EMPLOYEE EMP_APRV where a.month not in ( select X.month from VCH X) and EMP_APRV.EMP_CODE(+) = a.EMP_CODE__APPR ) order by PRD_MONTH desc ) LOOP PIPE ROW (EXPENSE_BANNER_MST(x.PRD_MONTH,x.PRD_DATE,x.TRAN_ID,x.STATUS, x.STATUS_DATE,x.APRV_NAME,x.HO_NAME,x.CLAIM_AMT,x.ADD_AMT,x.DED_AMT,x.PASSED_AMT, x.ADV_ADJUSTED,x.AMT_PAID,x.PAYMENT_DAYS,x.PAYMENT_DATE,x.HARD_COPY_RECD_DATE,x.EXP_RECD_DATE,x.TRANSFER_DATE,x.APRV_DATE,x.APRV_STATUS,x.HO_APRV_DATE,x.HO_STATUS, x.HD_STATUS, x.DUE_DATE, x.HO_CODE,x.APRV_CODE)); END LOOP; RETURN; END; END EXPENSE_BANNER_PKG; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ASSET_SALES_CODE ON ASSET_SALES (ASSET_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEMSER_DESCR (as_item_ser char) return varchar2 is ls_val varchar2(40); begin select descr into ls_val from itemser where item_ser = as_item_ser; return ls_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGETTOTALVISITS (as_sals_pers char) RETURN NUMBER IS as_count_sccode number(5); BEGIN BEGIN SELECT (COUNT(DISTINCT SC_CODE)) * 2 INTO as_count_sccode FROM STRG_SERIES WHERE SALES_PERS = as_sals_pers AND ITEM_SER = 'OTC' AND CUST_TYPE = 'C' AND STATUS = 'Y'; EXCEPTION WHEN NO_DATA_FOUND THEN as_count_sccode:=0; END; RETURN as_count_sccode; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVOICE_EFF_DT_SITE_CONF ON INVOICE (EFF_DATE, SITE_CODE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INVALLOC_REF_SER_ID_LINE ON INVALLOC_TRACE (REF_SER, REF_ID, REF_LINE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPRS_STOCKIST_X ON SPRS_STOCKIST (SPRS_CODE, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXCISE_DUTY (as_tran_code taxtran.tran_code%type,as_tran_id taxtran.tran_id%type) return number is lc_duty number; begin SELECT nvl(sum(taxtran.tax_amt * ddf_get_exch_rate( as_tran_id,as_tran_code) ),0) INTO lc_duty FROM taxtran, tax WHERE ( taxtran.tax_code = tax.tax_code ) and ( ( tran_code = as_tran_code ) AND ( tran_id = as_tran_id ) AND ( taxtran.tax_perc <> 0 ) ) and ( taxtran.tax_amt <> 0 ) and ( taxtran.effect <> 'N') ; dbms_output.put_line('Amount Checking'||lc_duty); return lc_duty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LVECF (as_empcode char,ad_date_fr date,ad_date_to date,ad_exp_date date,as_lvecode char) return number is lc_baldays number(6,1); lc_nodays number(6,1) := 0; ld_eff_date date; lc_nodays1 number(6,1) := 0; lc_nodays2 number(6,1) := 0; begin begin select min(eff_date) into ld_eff_date from leavebal where emp_code = as_empcode and lve_code = as_lvecode and eff_date <= ad_date_fr and exp_date >= ad_date_to; ld_eff_date := to_date('01-'||to_char(ld_eff_date,'MON')||'-'||to_char(ld_eff_date,'YYYY')); SELECT nvl(sum(nvl(no_days,0)),0) into lc_nodays FROM empleave_summary,period WHERE empleave_summary.EMP_CODE = as_empcode AND empleave_summary.lve_code = as_lvecode and period.code = empleave_summary.prd_code and period.fr_date >= ld_eff_date and period.fr_date < ad_date_fr; EXCEPTION WHEN NO_DATA_FOUND THEN lc_nodays := 0 ; END ; declare cursor c_lvetrace is SELECT lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc FROM emplve_trace WHERE EMP_CODE = as_empcode AND lve_code = as_lvecode and lve_date_fr < ld_eff_date and eff_date >= ld_eff_date and nvl(use_flag,' ') <> 'F' group by lve_date_fr,lve_date_to; begin lc_nodays1 := 0; for i in c_lvetrace loop if i.lve_date_to >= ld_eff_date then if (i.lve_date_to - ld_eff_date + 1) < i.lve_aloc then lc_nodays1 := lc_nodays1 + i.lve_aloc - (i.lve_date_to - ld_eff_date + 1); end if; else lc_nodays1 := lc_nodays1 + i.lve_aloc ; end if; end loop; END ; declare cursor c_lvetrace is SELECT lve_date_fr,lve_date_to,nvl(sum(nvl(lves_alloc,0)),0) as lve_aloc FROM emplve_trace WHERE EMP_CODE = as_empcode AND lve_code = as_lvecode and lve_date_to >= ld_eff_date and eff_date < ld_eff_date and nvl(use_flag,' ') <> 'F' group by lve_date_fr,lve_date_to; begin lc_nodays2 := 0; for i in c_lvetrace loop if i.lve_date_fr < ld_eff_date then if (ld_eff_date - i.lve_date_fr) < i.lve_aloc then lc_nodays2 := lc_nodays2 + i.lve_aloc - (ld_eff_date - i.lve_date_fr); end if; else lc_nodays2 := lc_nodays2 + i.lve_aloc ; end if; end loop; END ; begin select nvl(sum(NVL(avail_days,0) + nvl(conv_days,0)),0) into lc_baldays from leavebal where emp_code = as_empcode and lve_code = as_lvecode and eff_date < ad_date_fr and exp_date >= ad_date_to; EXCEPTION WHEN NO_DATA_FOUND THEN lc_baldays := 0; END; return (lc_baldays + lc_nodays2 - lc_nodays1 - lc_nodays); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MULTI_BARCODE (p_ref_id supplier_bill.voucher_no%TYPE) RETURN VARCHAR2 IS CURSOR c1 IS SELECT REF_ID FROM UNALLOCATED_ATTACH WHERE REF_SER='S-BILL' AND REF_ID__NEW IN (SELECT TRAN_ID FROM SUPPLIER_BILL WHERE NVL(STATUS,'N')='N' AND VOUCHER_NO = p_ref_id ); v_count NUMBER(10) DEFAULT 0; v_out_str VARCHAR2(4000) DEFAULT NULL; v_comm_text comments.comm_text%TYPE; BEGIN begin OPEN c1; LOOP FETCH C1 INTO v_comm_text; v_count := v_count + 1 ; EXIT WHEN c1%NOTFOUND; IF v_count = 1 THEN v_out_str := v_comm_text; ELSE v_out_str := v_out_str||chr(10)||v_comm_text; END IF; END LOOP; CLOSE c1; EXCEPTION WHEN NO_DATA_FOUND THEN v_out_str := NULL; END; RETURN v_out_str; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_BTL_DT_BK_ST ON BANKTRAN_LOG (TRAN_DATE, BANK_CODE, SITE_CODE, TRAN_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHECK_SORDITEM BEFORE UPDATE ON SORDITEM FOR EACH ROW DECLARE ls_stk_opt char(1); lc_overshipperc number(14,3) := 0; lc_extraallowed number(14,3) := 0; ls_pendingorder char(1); BEGIN SELECT nvl(stk_opt,'2') INTO ls_stk_opt FROM item WHERE item_code = :NEW.item_code; if ls_stk_opt <> '0' then begin Select over_ship_perc into lc_overshipperc From sorddet Where sale_order = :new.sale_order And line_no = :new.LINE_NO ; exception when others then lc_overshipperc := 0; end; if lc_overshipperc is null then lc_overshipperc := 0; end if; if lc_overshipperc <> 0 then lc_extraallowed := CEIL(:new.quantity * lc_overshipperc / 100) ; end if; if lc_extraallowed is null then lc_extraallowed := 0; end if; if round(:NEW.QTY_ALLOC,3) > round(((:OLD.QUANTITY + lc_extraallowed) * nvl(:OLD.CONV__QTY_STDQTY,1) ),3) then raise_application_error( -20601, 'Allocation quantity more than quantity So [' || :new.sale_order || '] line [' || :new.line_no ||'] exp_lev [' || trim(:new.exp_lev) ||']'); end if; if :NEW.QTY_ALLOC < 0 then raise_application_error( -20601, 'Allocation quantity cannot be negative [' || :new.sale_order || '] line [' || :new.line_no ||'] exp_lev [' || trim(:new.exp_lev) ||']'); END IF; end if; begin select pending_order into ls_pendingorder from sorder where sale_order = :new.sale_order ; exception when others then ls_pendingorder := ' '; end; if ls_pendingorder = 'Y' then if nvl(:new.quantity,0) - nvl(:new.qty_desp,0) <= 0 and :new.status <> 'C' then raise_application_error( -20601, 'Fully shipped line [' || :new.line_no || '] exp_lev [' || :new.exp_lev ||'] quantity [' || to_char(:new.quantity) ||'] despatched [' || to_char(:new.qty_desp) ||'] status [' || :new.status ||']'); end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_SUNDRY_TAX_DT ( ls_ref_ser in char, ls_tran_id in char) return DATE is lD_tran_date DATE; begin if ls_ref_ser = 'S-INV' then select A.Tran_Date into lD_tran_date from invoice A, customer B where A.cust_code = B.cust_code and Trim(A.invoice_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'VOUCH' then Select A.Tran_Date into lD_tran_date From Voucher A ,Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNPAY' Or ls_ref_ser = 'DRNPAY' Then Select A.Tran_Date Into ld_tran_date From DRCR_Pay A ,Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNRCP' Or ls_ref_ser = 'DRNRCP' Then Select A.Tran_Date Into ld_tran_date From DRCR_Rcp A , Customer B Where A.cust_code = B.cust_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'P-RCP' Or ls_ref_ser = 'P-RET' Then Select A.Tran_Date Into ld_tran_date From PORCP A, Supplier B Where A.supp_code = B.supp_code AND (A.tran_id) = (ls_tran_id) ; ElsIf ls_ref_ser = 'P-ORD' Then Select A.ORD_Date Into ld_tran_date From PORDER A, Supplier B Where A.supp_code = B.supp_code AND (A.PURC_ORDER) = (ls_tran_id) ; ElsIf ls_ref_ser = 'S-DSP' Then Select A.DESP_Date Into ld_tran_date From DESPATCH A, CUSTOMER B Where A.CUST_code = B.CUST_code AND (A.DESP_ID) = (ls_tran_id) ; ElsIf ls_ref_ser = 'C-ISS' Then Select A.ISSUE_Date Into ld_tran_date From CONSUME_ISS A, EMPLOYEE B Where A.EMP_CODE = B.EMP_code AND (A.CONS_ISSUE) = (ls_tran_id) ; ElsIf ls_ref_ser = 'S-ORD' Then Select A.ORDER_Date Into ld_tran_date From SORDER A , Customer B Where A.cust_code = B.cust_code And Trim(A.SALE_ORDER) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'S-RET' Then Select A.TRAN_Date Into ld_tran_date From SRETURN A , Customer B Where A.cust_code = B.cust_code And Trim(A.TRAN_ID) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'D-RCP' Then select a.tran_date into ld_tran_date from distord_rcp a,site b where a.site_code__ship =b.site_code and a.tran_id =ls_tran_id; elsif ls_ref_ser = 'D-ISS' then select a.tran_date into ld_tran_date from distord_iss a,site b where a.site_code__dlv =b.site_code and a.tran_id =ls_tran_id; End If; Return ld_tran_date ; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE BRANCODEPOPHELP AS FUNCTION getBrandPophelpData (empCode in char) RETURN branCodeMasterTABLE PIPELINED; END branCodePophelp; CREATE OR REPLACE PACKAGE BODY BRANCODEPOPHELP AS FUNCTION getBrandPophelpData (empCode in char) RETURN branCodeMasterTABLE PIPELINED IS ls_cnt number(35); BEGIN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; if(ls_cnt > 0) then for x in(SELECT BRAND.BRAND_CODE, BRAND.DESCRIPTION AS BRAND_DESCR, TRIM(SALES_PERS.SALES_PERS) AS visited_with_team FROM BRAND BRAND, SALES_PERS SALES_PERS, EMPLOYEE EMP WHERE SALES_PERS.ITEM_SER = BRAND.ITEM_SER AND SALES_PERS.SALES_PERS IN ( SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND EMP.EMP_CODE = SALES_PERS.SALES_PERS AND EMP.RELIEVE_DATE IS NULL) LOOP PIPE ROW (branCodeMaster(x.BRAND_CODE,x.BRAND_DESCR,x.visited_with_team)); END LOOP; RETURN; end if; if(ls_cnt <= 0) then for x in(SELECT BRAND.BRAND_CODE, BRAND.DESCRIPTION AS BRAND_DESCR, TRIM(SALES_PERS.SALES_PERS) AS visited_with_team FROM BRAND BRAND, SALES_PERS SALES_PERS , EMPLOYEE EMP WHERE SALES_PERS.ITEM_SER = BRAND.ITEM_SER AND SALES_PERS.SALES_PERS IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND EMP.EMP_CODE = SALES_PERS.SALES_PERS) LOOP PIPE ROW (branCodeMaster(x.BRAND_CODE,x.BRAND_DESCR,x.visited_with_team)); END LOOP; RETURN; end if; END; END branCodePophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION TRIM ( as_str char) return VARchar2 is ls_ret varchar2(2000); begin ls_ret := ltrim(rtrim(as_str)); return ls_ret; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GLTRAN_FINENT ( m_frst_date IN DATE, m_date_from IN DATE, m_acct_code IN CHAR, m_siteCode IN VARCHAR2 ) RETURN NUMBER IS ld_day_op_bal NUMBER(14,3); BEGIN SELECT SUM((dr_amt) - (cr_amt)) INTO ld_day_op_bal FROM gltran WHERE site_code IN (SELECT COLUMN_VALUE FROM TABLE(fn_get_site_input(m_siteCode))) AND tran_date >= m_frst_date AND tran_date < m_date_from AND acct_code = m_acct_code; IF ld_day_op_bal IS NULL THEN ld_day_op_bal := 0; END IF; RETURN ld_day_op_bal; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RPT_PRINT_CTRL_X ON RPT_PRINT_CTRL (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_REMARK ( AS_TRAN_ID VARCHAR , AS_TRAN_SER VARCHAR ) RETURN VARCHAR is LS_REMARKS VARCHAR(100); BEGIN LS_REMARKS := ' '; begin IF AS_TRAN_SER = 'S-INV' THEN SELECT REMARKS INTO LS_REMARKS FROM INVOICE WHERE INVOICE_ID = AS_TRAN_ID ; END IF; IF AS_TRAN_SER = 'MDRCRD' THEN SELECT REMARKS INTO LS_REMARKS FROM MISC_DRCR_RCP WHERE TRAN_SER = AS_TRAN_SER AND TRAN_ID = AS_TRAN_ID ; END IF; IF AS_TRAN_SER = 'MDRCRC' THEN SELECT REMARKS INTO LS_REMARKS FROM MISC_DRCR_RCP WHERE TRAN_SER = AS_TRAN_SER AND TRAN_ID = AS_TRAN_ID ; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN LS_REMARKS := ' '; END; RETURN LS_REMARKS; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CADRE_AD_DATEWISE ON CADRE_AD (PAY_TABLE, CADRE_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SURVEYOR_SURV_NAME ON SURVEYOR (SURV_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AMT_TO_WORDS_CURR_CD (P_AMT IN NUMBER,mCurr_cd char ) RETURN VARCHAR2 IS M_MAIN_AMT_TEXT VARCHAR2(2000) ; M_TOP_AMT_TEXT VARCHAR2(2000) ; M_BOTTOM_AMT_TEXT VARCHAR2(2000) ; M_DECIMAL_TEXT VARCHAR2(2000) ; M_TOP NUMBER(20,5) ; M_MAIN_AMT NUMBER(20,5) ; M_TOP_AMT NUMBER(20,5) ; M_BOTTOM_AMT NUMBER(20,5) ; M_DECIMAL NUMBER(20,5) ; M_AMT NUMBER(20,5); M_TEXT VARCHAR2(2000) ; M_Test NUMBER(20,5); mdec_unit currency.dec_unit%type; mCurr_descr currency.descr%type; Curr_cd char(5) := trim(mCurr_cd); Curr_cdnew varchar2(40); BEGIN M_MAIN_AMT := NULL ; M_TOP_AMT_TEXT := NULL ; M_BOTTOM_AMT_TEXT := NULL ; M_DECIMAL_TEXT := NULL ; select trim(descr) into mCurr_descr from currency where curr_code = Curr_cd ; -- To get paise part M_DECIMAL := P_AMT - TRUNC(P_AMT) ; IF M_DECIMAL >0 THEN M_DECIMAL := M_DECIMAL ; END IF; M_AMT := TRUNC(P_AMT) ; M_TOP := TRUNC(M_AMT / 100000) ; M_MAIN_AMT := TRUNC(M_TOP / 100); M_TOP_AMT := M_TOP - M_MAIN_AMT * 100 ; M_BOTTOM_AMT := M_AMT - (M_TOP * 100000) ; IF M_MAIN_AMT > 0 THEN M_MAIN_AMT_TEXT := TO_CHAR(TO_DATE(M_MAIN_AMT,'J'),'JSP') ; IF M_MAIN_AMT = 1 THEN M_MAIN_AMT_TEXT := M_MAIN_AMT_TEXT || ' CRORE ' ; ELSE M_MAIN_AMT_TEXT := M_MAIN_AMT_TEXT || ' CRORES ' ; END IF ; END IF ; IF M_TOP_AMT > 0 THEN M_TOP_AMT_TEXT := TO_CHAR(TO_DATE(M_TOP_AMT,'J'),'JSP') ; IF M_TOP_AMT = 1 THEN M_TOP_AMT_TEXT := M_TOP_AMT_TEXT || ' LAKH ' ; ELSE M_TOP_AMT_TEXT := M_TOP_AMT_TEXT || ' LACS ' ; END IF; END IF ; IF M_BOTTOM_AMT > 0 THEN M_BOTTOM_AMT_TEXT := TO_CHAR(TO_DATE(M_BOTTOM_AMT,'J'),'JSP') ; END IF ; IF M_DECIMAL > 0 THEN select trim(dec_unit), trim(descr) into mdec_unit , mCurr_descr from currency where curr_code = Curr_cd ; if sqlcode = 0 then Curr_cdnew := trim(mCurr_descr) || ' '; end if; if mdec_unit is null or length(mdec_unit) = 0 then mdec_unit := ' Cents '; end if; IF NVL(M_BOTTOM_AMT,0) + NVL(M_TOP_AMT,0) > 0 THEN M_Test :=(round(M_DECIMAL,2)-(floor(round(M_DECIMAL,2))))*100; If M_Test = 0 Then M_DECIMAL_TEXT := ''; else M_DECIMAL_TEXT := ' AND ' || TO_CHAR(TO_DATE(M_Test,'J'),'Jsp') ||' ' || mdec_unit ; end If; ELSE M_DECIMAL_TEXT := TO_CHAR(TO_DATE((round(M_DECIMAL,2)-(floor(round(M_DECIMAL,2))))*100,'J'),'Jsp') ||' ' || mdec_unit ; END IF ; END IF ; IF(M_MAIN_AMT=0 AND M_BOTTOM_AMT=0 AND M_TOP_AMT=0) THEN M_TEXT := mCurr_descr||' '||'ZERO ONLY'; ELSE M_TEXT := LOWER(M_MAIN_AMT_TEXT || M_TOP_AMT_TEXT || M_BOTTOM_AMT_TEXT || ' '|| M_DECIMAL_TEXT || ' ONLY') ; M_TEXT := UPPER(SUBSTR(M_TEXT,1,1))|| SUBSTR(M_TEXT,2); M_TEXT := mCurr_descr||' '|| M_TEXT; END IF; RETURN(M_TEXT); END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROF_ACCOUNTS_X ON PROF_ACCOUNTS (ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SALE_RET_QTY ( tranId IN varchar, lineNo IN number ) return number is sale_ret_qty number(14,3); begin select sum(case when B.ret_rep_flag = 'R' then -b.quantity else b.quantity end) into sale_ret_qty from sreturn a, sreturndet b, charge_back cb, charge_back_det cd where a.tran_id = b.tran_id and cb.tran_id = cd.tran_id and cb.tran_id = tranId and a.cust_code = ( select cust_code from charge_back where tran_id = tranId ) and a.site_code = ( select site_code from charge_back where tran_id = tranId ) and a.tran_date <= ( select tran_date from charge_back where tran_id = tranId ) and b.item_code = ( select item_code from charge_back_det where tran_id = tranId and line_no = lineNo ) and b.lot_no = ( select lot_no from charge_back_det where tran_id = tranId and line_no = lineNo ) and a.confirmed = 'Y'; return(sale_ret_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ADV_RCP_TAX_DET_X ON ADV_RCP_TAX_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFF_DOCMET_DT_WISE_TB force AS TABLE OF EFF_DOCMET_DT_WISE_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORD_RECEIPT_TYPE_CONF ON WORKORDER_RECEIPT (WORK_ORDER, TRAN_TYPE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DISTRCP_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON distord_rcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_drcpcount number(3) := 0; ll_count number(6) := 0; lc_stkrate number(15,4) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_drcpcount from distord_rcpdet d, item i where d.item_code = i.item_code and d.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_drcpcount := 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'D-RCP' and ref_id = :new.tran_id and eff_qty > 0 ; exception when others then ll_invcount := 0; end; if ll_invcount <> ll_drcpcount then raise_application_error( -20601, 'Invtrace not updated for all the details'); end if; -- for each detail item cost_rate to be compared with stock.rate begin for cur_distrcpdet in ( SELECT :new.site_code as site_code,d.item_code,d.loc_code,d.lot_no,d.lot_sl,d.cost_rate FROM DISTORD_rcpDET D WHERE d.TRAN_ID = :new.tran_id ) loop ll_count := 1; begin select rate into lc_stkrate from stock where item_code = cur_distrcpdet.item_code and site_code = cur_distrcpdet.site_code and loc_code = cur_distrcpdet.loc_code and lot_no = cur_distrcpdet.lot_no and lot_sl = cur_distrcpdet.lot_sl; exception when others then lc_stkrate := 0; ll_count := 0; end; if lc_stkrate <> cur_distrcpdet.cost_rate and ll_count = 1 then raise_application_error( -20601, 'Received stock rate [' || to_char(lc_stkrate) ||'] is not matching with the cost rate of detail [' || to_char(cur_distrcpdet.cost_rate) ||']'); end if; end loop; -- exception when others then -- null; end; -------------- flag to be updated end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STOCKVALUE_X ON STOCKVALUE (SITE_CODE, ITEM_CODE, VALUE_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHQCANC_CURRENCY ( ls_ref_ser char, ls_ref_no char) return char is ls_curr_code char(5); begin if ls_ref_ser = 'E-PAY' then select curr_code into ls_curr_code from payment_exp where tran_id = ls_ref_no; elsif ls_ref_ser = 'M-PAY' then select curr_code into ls_curr_code from misc_payment where tran_id = ls_ref_no; end if; if ls_curr_code is null then ls_curr_code := ''; end if; return ls_curr_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SER_CONTRACT_DET_X ON SER_CONTRACT_DET (SER_CONTRACT, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGSURVRES_PKVAL before insert on strg_surv_res for each row declare max_line_no number(10); begin if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id into :new.dcr_id from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_surv_res where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_surv_res where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DISPLAY_TRANSPORTER (ls_invoice in char) return char is ls_transporter char(40); ls_tran_code char(10); ls_desp_id char(10); li_cnt number(2,0); begin select count(*) into li_cnt from invoice_amendment where invoice_id = ls_invoice; if li_cnt >= 1 then select nvl(tran_code,' ') into ls_tran_code from invoice_amendment where invoice_id = ls_invoice; if ls_tran_code = '' or ls_tran_code is null then select desp_id into ls_desp_id from invoice where invoice_id = ls_invoice; select tran_code into ls_tran_code from despatch where desp_id = ls_desp_id; else select tran_name into ls_transporter from transporter where tran_code = ls_tran_code; end if; elsif li_cnt = 0 then select desp_id into ls_desp_id from invoice where invoice_id = ls_invoice; select tran_code into ls_tran_code from despatch where desp_id = ls_desp_id; select tran_name into ls_transporter from transporter where tran_code = ls_tran_code; end if; return (ls_transporter); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEM_CODE_PLAN ON ITEM (ITEM_CODE__PLAN) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DESC_GNCODS (ls_fldname in varchar2,ls_winname in varchar2,ls_val in varchar2) return char is ls_descr varchar2(120); begin select descr into ls_descr from gencodes where fld_value = ls_val and TRIM(fld_name)=TRIM(ls_fldname) and mod_name=ls_winname; return trim(ls_descr); exception when no_data_found then begin select descr into ls_descr from gencodes where fld_value = ls_val and TRIM(fld_name)=TRIM(ls_fldname) and mod_name='X'; return trim(ls_descr); exception when no_data_found then return ' '; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MCCODE_DESCR ( as_mc_code char) return varchar2 is ls_descr varchar2(60); begin begin select descr into ls_descr from machines where mc_code = as_mc_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IMPACT_HDR_PM_ID ON IMPACT_HDR (PM_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_QV_ITEM ( as_sitecode in char, as_itemcode in char, adt_fromdate in date, as_available in char, as_loccode_from in char, as_loccode_to in char, as_qtyvalue in char ) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = as_itemcode and a.site_code = as_sitecode and a.loc_code between as_loccode_from and as_loccode_to and instr(as_available,b.available) > 0; if adt_fromdate < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT decode(as_qtyvalue,'Q', sum( a.quantity), sum((a.quantity) * nvl(a.rate,0))) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = as_itemcode and a.site_code = as_sitecode and a.loc_code between as_loccode_from and as_loccode_to and instr(as_available,b.available) > 0 union all select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * nvl(d.rate,0) ) * -1),0) ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = as_itemcode and a.site_code = as_sitecode and a.loc_code between as_loccode_from and as_loccode_to and a.tran_date > adt_fromdate and instr(as_available,c.available) > 0); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_TLSD_MST force AS OBJECT ( SC_CODE VARCHAR2(30), CHEM_NAME VARCHAR2(150), CLASS_DESCR VARCHAR2(60), ROUTE_TYPE VARCHAR2(60), PRD_CODE VARCHAR2(30), MGR_SUB CHAR(10), DIVISION VARCHAR2(30), EMP_CODE VARCHAR2(30), EMP_NAME VARCHAR2(50), HEAD_QUAT VARCHAR2(50), DESIGN VARCHAR2(30), CHEM_ADDR VARCHAR2(500), QUANTITY NUMBER(5), ITEM_DESCR VARCHAR2(120) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMP_IT_DECL_PRD_EMP_AD ON EMP_IT_DECLARATION (ACCT_PRD, EMP_CODE, AD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUN_INV_EXMPT_SALES (minv_id invoice_trace.invoice_id%type) return number is mtot_amt number := 0; begin select sum((nvl((quantity*rate),0)- (nvl((quantity*rate)*(discount/100),0) ))) into mtot_amt from invoice_trace where invoice_id = minv_id AND TAX_AMT=0 AND RATE >0; if mtot_amt > 0 then return mtot_amt ; else return 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ALLWDEDN_DESCR ON ALLWDEDN_BKP (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_REAS_CODE_DESCR (ls_code in char) return char is ls_descr char(120); begin select nvl(descr,' ') into ls_descr from gencodes where fld_name = 'REAS_CODE' and fld_value = ls_code and rownum = 1; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPRS_PLAN_FROZEN_X ON SPRS_PLAN_FROZEN (PLAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_STRG_CUSTOMER_DET (ls_sundry_type in char,ls_sundry_code in char,as_col_flag in char) return char is ls_locality_code char(10); ls_stan_code char(5); ls_spl_code char(10); ls_name char (20); lc_cnt_spl_cd number; begin select locality_code,stan_code,spl_code,cnt_spl_cd into ls_locality_code ,ls_stan_code , ls_spl_code, lc_cnt_spl_cd from (select a.locality_code,a.stan_code,b.spl_code, count(b.spl_code) cnt_spl_cd from strg_customer a , strg_series b where a.sc_code = b.sc_code(+) and a.sc_code = ls_sundry_code group by a.locality_code,a.stan_code,b.spl_code ) , (select max(cnt_spl_cd) as mx_cnt from (select a.locality_code,a.stan_code,b.spl_code, count(b.spl_code) cnt_spl_cd from strg_customer a , strg_series b where a.sc_code = b.sc_code(+) and a.sc_code = ls_sundry_code group by a.locality_code,a.stan_code,b.spl_code )) max_cnt_spl_cd where cnt_spl_cd = max_cnt_spl_cd.mx_cnt; if ls_sundry_type = 'R' then if as_col_flag = 'L' then return ls_locality_code ; elsif as_col_flag = 'T' then return ls_stan_code ; else return ls_spl_code ; end if; else return ''; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_INTEREST_PERC ( p_var_name IN VARCHAR2 DEFAULT NULL ) RETURN VARCHAR2 IS v_var_value VARCHAR2(100); v_return_json VARCHAR2(4000); BEGIN v_var_value := NULL; BEGIN SELECT VAR_VALUE INTO v_var_value FROM FINPARM WHERE VAR_NAME = 'INTEREST_CALC_PERC'; EXCEPTION WHEN NO_DATA_FOUND THEN v_var_value := NULL; WHEN OTHERS THEN v_var_value := NULL; END; IF p_var_name IS NOT NULL THEN NULL; END IF; v_return_json := '{' || 'data:{' || 'INTEREST_PERCENTAGE:' || NVL(v_var_value, 'Not Found') || '' || -- Use 'Not Found' if no value found '}}'; RETURN v_return_json; EXCEPTION WHEN OTHERS THEN v_return_json := '{data:{}}'; RETURN v_return_json; END GET_INTEREST_PERC; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_PATCH_ASISBASIS (mdrug_per_patch in number, mnon_volatile_mass_form in number, mexpr_process_size in number, mtot_non_volatile_mass_form in number, massay_asisbasis in number) return number is mpotency number(14,6) := 0; begin -- if any independent value in the denominator is ZERO, Potency Adjusted will be set as ZERO if (mtot_non_volatile_mass_form = 0 or massay_asisbasis = 0) then mpotency := 0; else mpotency := round( (mdrug_per_patch * (mnon_volatile_mass_form /100) * mexpr_process_size * 100) / (mtot_non_volatile_mass_form * 100 * massay_asisbasis), 6); end if; return mpotency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGRT_BJQID (AS_CODE IN VARCHAR2, AS_ALLOWED_QID IN NUMBER, AS_SITE IN VARCHAR2) RETURN NUMBER IS AS_VALUE NUMBER(3); AS_COUNT NUMBER(7); AS_TEMPQID NUMBER(3); MQ_ID NUMBER(3); STAT_COUNT NUMBER(3); CTR NUMBER := 1; BEGIN SELECT COUNT(*) INTO AS_COUNT FROM BACKGROUND_JOB; IF AS_COUNT = 0 THEN AS_VALUE :=1; ELSE SELECT COUNT(*) INTO AS_COUNT FROM BACKGROUND_JOB WHERE TRIM(USER_ID) = TRIM(AS_CODE) AND TRIM(LOGIN_SITE) = TRIM(AS_SITE) AND JOB_STAT = 'P'; IF AS_COUNT > 0 THEN SELECT QUEUE_ID INTO AS_VALUE FROM BACKGROUND_JOB WHERE TRIM(USER_ID) = TRIM(AS_CODE) AND TRIM(LOGIN_SITE) = TRIM(AS_SITE) AND JOB_STAT = 'P' AND ROWNUM =1; ELSE SELECT NVL( MAX(QUEUE_ID), 0) INTO AS_TEMPQID FROM BACKGROUND_JOB WHERE JOB_STAT = 'P'; IF AS_TEMPQID < AS_ALLOWED_QID THEN AS_VALUE := AS_TEMPQID + 1; ELSE LOOP IF CTR <= AS_ALLOWED_QID THEN SELECT COUNT(1) INTO AS_TEMPQID FROM BACKGROUND_JOB WHERE JOB_STAT = 'P' AND QUEUE_ID = CTR ; IF AS_TEMPQID = 0 THEN AS_VALUE := CTR; EXIT ; END IF; ELSIF CTR > AS_ALLOWED_QID THEN SELECT QUEUE_ID INTO MQ_ID FROM ( SELECT QUEUE_ID, COUNT(1) AS STAT_COUNT FROM BACKGROUND_JOB WHERE JOB_STAT='P' GROUP BY QUEUE_ID ORDER BY STAT_COUNT) WHERE ROWNUM = 1; AS_VALUE := MQ_ID ; EXIT ; END IF; CTR := CTR + 1; END LOOP; END IF; END IF; END IF; RETURN AS_VALUE ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETITEMS_UPDATE before update on strg_meet_items for each row declare max_line_no number(10); begin if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then begin select tran_id into :new.tran_id from strg_meet where dcr_id = :new.dcr_id and strg_code = :new.strg_code and rownum=1; end; end if; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; end; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RMONTH (ls_date date) return varchar2 is ls_char varchar2(10); ls_dt varchar2(10); begin select to_char(ls_date,'mm') into ls_char from dual; if ls_char between 1 and 9 then select substr(to_char(ls_date,'mm'),2,1) into ls_dt from dual; else select to_char(ls_date,'mm') into ls_dt from dual; end if; return ls_dt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORKORDER_SITE_ITEM ON WORKORDER (SITE_CODE, ITEM_CODE, DUE_DATE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DD_OR_CHQNO (mprd_code char ,memp char , ls_voucherno char) return char is ls_return char(20) ; begin declare ls_tranid char(10) ; ls_instr_no char(20); ls_ref_no char(20); ls_paymode char(1); BEGIN begin select distinct instr_no , tran_id into ls_instr_no , ls_tranid from misc_paydet where vouch_no = ls_voucherno and tran_ser = 'P-VOUC' and rownum = 1 order by tran_id desc ; EXCEPTION WHEN NO_DATA_FOUND then ls_instr_no := ' '; ls_tranid := ' ' ; end ; begin select nvl(pay_mode ,'0') into ls_paymode from misc_payment where tran_id = ls_tranid ; EXCEPTION WHEN NO_DATA_FOUND THEN select nvl(pay_mode,' ') into ls_paymode from employee where emp_code = memp ; END ; if ls_paymode = '0' or length(ltrim(rtrim(ls_paymode))) = 0 then select nvl(pay_mode,' ') into ls_paymode from employee where emp_code = memp ; end if ; if ls_paymode = 'D' then ls_return := ls_instr_no ; end if; if ls_paymode = 'Q' then select ref_no into ls_ref_no from misc_payment where tran_id = ls_tranid; ls_return := ls_ref_no; end if; if ls_paymode = 'T' then select bank_acct into ls_return from employee where emp_code = memp; end if ; return ls_return ; end ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPPRD ON EMPLEAVE (EMP_CODE, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ITEM_POPHELP_PKG IS TYPE item_row IS RECORD(item_code varchar2(100),descr VARCHAR2(1000)); TYPE item_rows IS TABLE OF item_row; function get_itemDetails(limitrows IN PLS_INTEGER ) return item_rows pipelined ; END; CREATE OR REPLACE PACKAGE BODY ITEM_POPHELP_PKG IS function get_itemDetails(limitrows IN PLS_INTEGER) return item_rows pipelined AS starttime number := sys.dbms_utility.get_time; endtime number; m number; item_rec item_rows; type cur_lvl_idx_tab is ref cursor; v_cur_lvl_idx_tab cur_lvl_idx_tab; BEGIN open v_cur_lvl_idx_tab for SELECT item_code,REGEXP_REPLACE(descr,'[^[:alnum:]'' '']', NULL)as descr from item; loop fetch v_cur_lvl_idx_tab BULK COLLECT INTO item_rec limit limitrows; EXIT WHEN item_rec.COUNT = 0; for i in item_rec.first .. item_rec.last loop exit when item_rec.count=0; pipe row(item_rec(i)); end loop; end loop; CLOSE v_cur_lvl_idx_tab; endtime := sys.dbms_utility.get_time; -- DBMS_OUTPUT.Put_line('end: ' || endtime); m := mod ( ((endtime-starttime)+power(2,32)), power(2,32) ); dbms_output.put_line('Start: '||to_char(starttime)); dbms_output.put_line('End: '||to_char(endtime)); dbms_output.put_line('Mod: '||to_char(m)); -- return v_cur_lvl_idx_tab; END get_itemDetails; END item_pophelp_pkg ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_MET_TB force AS TABLE OF CHC_CHEM_MET_MST; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PCONSTDUNIT (as_pcon pcontract_hdr.contract_no%type, as_line pcontract_det.line_no%type) return varchar2 is ls_stdunit varchar2(10); begin select unit into ls_stdunit from pcontract_det where contract_no = as_pcon and rtrim(ltrim(line_no)) = rtrim(ltrim(as_line)) ; return ls_stdunit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BOM_COSTING_RATE (as_item_code in varchar2, as_rate_option in char, as_excise_option in char ) RETURN number is ls_option char(1); lc_qty number(14,3); lc_rate number(14,3); lc_gross_rate number(14,3); lc_tot_qty number(14,3); lc_tot_val number(14,3); lc_ret_rate number(14,3); lc_tot_gr_rate number(14,3); ldt_rcp_date date; cursor c1 is select nvl(quantity,0), nvl(rate,0), nvl(gross_rate ,0) from stock where rtrim(item_code) = rtrim(as_item_code) and quantity > 0 and rtrim(loc_code) NOT IN('INTR', 'EXSH') ; cursor c2 is select last_rcp_date, nvl(quantity,0), nvl(rate,0), nvl(gross_rate ,0) from stock where rtrim(item_code) = rtrim(as_item_code) and rtrim(loc_code) NOT IN('INTR', 'EXSH') and last_rcp_date is not null order by last_rcp_date desc; /* --cursor c3 is --select porcp.tran_date, nvl(porcpdet.rate,0) --from porcp , porcpdet --where porcp.tran_id = porcpdet.tran_id --and rtrim(porcpdet.item_code) = rtrim(as_item_code) --and porcp.tran_date is not null --order by porcp.tran_date desc ; */ begin ls_option := as_rate_option; if ls_option = 'S' then begin open c1; lc_tot_qty := 0; lc_tot_val := 0; loop fetch c1 into lc_qty, lc_rate, lc_gross_rate ; exit when c1%NOTFOUND; lc_tot_qty := lc_tot_qty + lc_qty; if as_excise_option = 'I' then lc_tot_val := lc_tot_val + (lc_qty * lc_gross_rate); else lc_tot_val := lc_tot_val + (lc_qty * lc_rate); end if ; end loop; close c1; If lc_tot_val = 0 OR lc_tot_val is null then ls_option := 'R'; else lc_ret_rate := lc_tot_val / lc_tot_qty; end if; EXCEPTION when NO_DATA_FOUND then begin lc_ret_rate := 0; ls_option := 'R'; end; when OTHERS then begin lc_ret_rate := 0; ls_option := 'R'; end; end; end if; -- last receipt rate if ls_option = 'R' then begin Open c2; Fetch c2 into ldt_rcp_date, lc_qty, lc_rate, lc_gross_rate ; if as_excise_option = 'I' then lc_ret_rate := lc_gross_rate; else lc_ret_rate := lc_rate; end if; close c2; EXCEPTION when NO_DATA_FOUND then begin lc_ret_rate := 0; end; when OTHERS then begin lc_ret_rate := 0; end; end; -- if last receipt rate is not available in stock -- Commented as per tarunbhai if rate is not available, make rate 0 /* if lc_ret_rate = 0 OR lc_ret_rate is null then begin Open c3; loop Fetch c3 into ldt_rcp_date, lc_rate; exit when c3%NOTFOUND; if lc_rate > 0 then lc_ret_rate := lc_rate; exit; end if; end loop; close c3; if lc_ret_rate is null then lc_ret_rate := 0; end if; EXCEPTION when NO_DATA_FOUND then begin lc_ret_rate := 0; end; when OTHERS then begin lc_ret_rate := 0; end; end; end if; */ end if; lc_ret_rate := nvl(lc_ret_rate,0); return lc_ret_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYMENT_EXP_TRAN_DATE ON PAYMENT_EXP (TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BI_BUSI_AREAS_X ON BI_BUSI_AREAS (BA_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SPRS_TRAVEL_IDX ON SPRS_TRAVEL (SALES_PERS, TRAVEL_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX QC_METHOD_X ON QC_METHOD (QC_METHOD) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYMENT_STAT ( ls_tranid in char ,ls_type char ) return char is ls_stat char(10); begin if ls_type = 'M' then select (case when misc_payables.tot_amt - misc_payables.adj_amt = 0 and misc_payables.hold_amt = 0 then 'Y' else (case when misc_payables.tot_amt - misc_payables.adj_amt > 0 and misc_payables.adj_amt <> 0 and misc_payables.hold_amt = 0 then 'P' else (case when misc_payables.hold_amt<> 0 then 'W' else ( case when misc_payables.hold_amt = 0 and misc_payables.adj_amt = 0 then ' ' end ) end ) end ) end ) into ls_stat from misc_payables where misc_payables.tran_ser ='M-VOUC' and misc_payables.ref_no = ls_tranid ; elsif ls_type = 'V' then select (case when misc_payables.tot_amt - misc_payables.adj_amt = 0 and misc_payables.hold_amt = 0 then 'Y' else (case when misc_payables.tot_amt - misc_payables.adj_amt > 0 and misc_payables.adj_amt <> 0 and misc_payables.hold_amt = 0 then 'P' else (case when misc_payables.hold_amt<> 0 then 'W' else ( case when misc_payables.hold_amt = 0 and misc_payables.adj_amt = 0 then ' ' end ) end ) end ) end ) into ls_stat from misc_payables where misc_payables.tran_ser ='VOUCH' and misc_payables.ref_no = ls_tranid ; end if ; return ls_stat ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINSTR (AS_VAR1 IN VARCHAR2, AS_VAR2 IN VARCHAR2) RETURN INTEGER AS BEGIN RETURN INSTR(AS_VAR1,AS_VAR2); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STKRATE (as_itemcode char, as_sitecode char, as_lotno char) return number is ll_rate number(15,4); ll_count number(10); ls_item_parent char(10); begin ll_rate := 0; select count(1) into ll_count from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1) ; if ll_count > 0 then select nvl(stock.rate,0) into ll_rate from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1) ; else select count(1) into ll_count from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1) ; if ll_count > 0 then select nvl(stock.rate,0) into ll_rate from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = as_itemcode and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1) ; else select item.item_parnt into ls_item_parent from item where item.item_code = as_itemcode; select count(1) into ll_count from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and stock.crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1); if ll_count > 0 then select nvl(stock.rate,0) into ll_rate from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and stock.crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.lot_no = as_lotno and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1); else select count(1) into ll_count from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 ) ; if ll_count > 0 then select nvl(stock.rate,0) into ll_rate from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1 and crea_date = (select max(crea_date) from stock,location,invstat where stock.item_code = ls_item_parent and stock.site_code = as_sitecode and stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat and invstat.stat_type <> 'S' and rownum = 1) ; end if; end if; end if; end if; return ll_rate ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE CHC_CHEM_TOT_OUTLETS_DM AS FUNCTION getChemTotOutletsInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_TOT_OUTLETS_TB PIPELINED; END CHC_CHEM_TOT_OUTLETS_DM; CREATE OR REPLACE PACKAGE BODY CHC_CHEM_TOT_OUTLETS_DM AS FUNCTION getChemTotOutletsInfo (empCode in char, eventDate in Date) RETURN CHC_CHEM_TOT_OUTLETS_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; WEEK_DAY VARCHAR2(20); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE, code INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE, AS_PRD_CODE FROM PERIOD WHERE eventdate BETWEEN FR_DATE AND TO_DATE; for x in ( select ACT_DATA.SC_CODE, ACT_DATA.CHEM_NAME, ACT_DATA.CLASS, ACT_DATA.ROUTE_TYPE , AS_PRD_CODE as PRD_CODE, ACT_DATA.MGR_SUB, ACT_DATA.chem_Addr from ( WITH DATA AS ( select CASE to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) WHEN 1 THEN to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'st ' || (select initcap(to_char(eventDate, 'DAY')) from dual) WHEN 2 THEN to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'nd ' || (select initcap(to_char(eventDate, 'DAY')) from dual) WHEN 3 THEN to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'rd ' || (select initcap(to_char(eventDate, 'DAY')) from dual) ELSE to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'th ' || (select initcap(to_char(eventDate, 'DAY')) from dual) END as WD from dual ) select SC.SC_CODE,(SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS CHEM_NAME,SR.descr ROUTE_TYPE,SSC.DESCR CLASS,SS.sales_pers MGR_SUB, (SC.ADDR1 || ' ' || SC.ADDR2 || ' ' || SC.ADDR3) AS CHEM_ADDR , sysdate as curdate from strg_series SS LEFT OUTER JOIN SALES_PERS SP ON SS.SALES_PERS = SP.SALES_PERS LEFT OUTER JOIN ITEMSER ITEMSER ON SP.ITEM_SER = ITEMSER.ITEM_SER LEFT OUTER JOIN STRG_SER_CLASS SSC ON SSC.ITEM_SER = SP.ITEM_SER AND SSC.CLASS_CODE = SS.CLASS_CODE, STRG_CUSTOMER SC, sprs_route SR, DATA where SS.route_id = sr.route_id and SS.sales_pers in ( SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) and SS.SC_CODE = sc.sc_code and SR.plan_days like ( '%' || trim(DATA.WD) || '%' ))ACT_DATA ) LOOP PIPE ROW (CHC_CHEM_TOT_OUTLETS_MST( x.SC_CODE,x.CHEM_NAME,x.CLASS,x.ROUTE_TYPE,x.PRD_CODE, x.MGR_SUB,x.CHEM_ADDR)); END LOOP; RETURN; END; END CHC_CHEM_TOT_OUTLETS_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_QV_PARENT_CCTR (as_sitecode in char, adt_fromdate in date, as_available in char, as_cctrcode in char, as_qtyvalue in char, as_serfr itemser.item_ser%type, as_serto itemser.item_ser%type ) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b, costctr cctr_a, costctr cctr_b where a.inv_stat = b.inv_stat and cctr_a.cctr_code = a.cctr_code__inv and cctr_b.cctr_code = cctr_a.cctr_code__par and a.site_code = as_sitecode and cctr_b.cctr_code = as_cctrcode and instr(as_available,b.available) > 0; -- if adt_fromdate < ldt_crea_date then -- return 0; -- end if; select sum(qty) into ld_eff_qty from ( select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) ),0), nvl(sum ((nvl(a.eff_qty,0) * nvl(a.rate,0) ) ),0) ) qty from invtrace a, location b, invstat c, costctr cctr_a, costctr cctr_b , stock d, item e where a.loc_code = b.loc_code and a.item_code = e.item_code and b.inv_stat = c.inv_stat and a.item_code = d.item_code and a.site_code = d.site_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.grade = d.grade and a.site_code = as_sitecode and d.cctr_code__inv = cctr_a.cctr_code and cctr_a.cctr_code__par = cctr_b.cctr_code and e.item_type = 'NON-FG' and cctr_b.cctr_code = as_cctrcode and a.tran_date <= adt_fromdate and (e.item_ser between as_serfr and as_serto) and instr(as_available,c.available) > 0 --SELECT decode(as_qtyvalue,'Q', sum( a.quantity), -- sum((a.quantity) * -- nvl(a.rate,0))) qty -- from stock a, -- invstat b, -- costctr cctr_a, -- costctr cctr_b -- where a.inv_stat = b.inv_stat and -- a.site_code = as_sitecode and -- a.cctr_code__inv = cctr_a.cctr_code and -- cctr_a.cctr_code__par = cctr_b.cctr_code and -- cctr_b.cctr_code = as_cctrcode and -- instr(as_available,b.available) > 0 -- union all -- select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), -- nvl(sum ((nvl(a.eff_qty,0) * nvl(a.rate,0) ) * -1),0) ) qty -- from invtrace a, -- location b, -- invstat c, -- costctr cctr_a, -- costctr cctr_b -- where a.loc_code = b.loc_code and -- b.inv_stat = c.inv_stat and -- a.site_code = as_sitecode and -- decode(sign(a.eff_qty),1,a.cctr_code__dr,a.cctr_code__cr) = cctr_a.cctr_code and -- cctr_a.cctr_code__par = cctr_b.cctr_code and -- cctr_b.cctr_code = as_cctrcode and -- a.tran_date > adt_fromdate and -- instr(as_available,c.available) > 0 ); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ATTD_REG_EMP_ATTD_DATE ON ATTD_REGULARIZE (EMP_CODE, ATTD_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSSOBDIV (as_item_ser_prom in char,as_cust_code in sorder.cust_code%type) return number is FLAG NUMBER(1); ls_count number(10,0); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_UVSSOBDIV'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then select count(1) into ls_count from customer_series where item_ser= as_item_ser_prom and cust_code=as_cust_code and black_listed='Y'; if ls_count <> 0 then return 1; else RETURN 0; end if; else return 0; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_PRICE_LIST (As_Item_Code Char,As_Unit Char,As_Lot_No Char, As_Site_Code Char,As_Trandate Date,As_Cust_Code Char) RETURN NUMBER IS AS_PRICE_LIST NUMBER(12,3); BEGIN SELECT PRICELIST.RATE INTO AS_PRICE_LIST FROM PRICELIST WHERE PRICELIST.ITEM_CODE= as_item_code AND PRICELIST.UNIT= as_unit And (As_Lot_No Between Pricelist.Lot_No__From And Pricelist.Lot_No__To) And Pricelist.Price_List = (Select Substr (Price_List,1,2)||'PTR' From Site_Customer Where Site_Code = As_Site_Code And Cust_Code = As_Cust_Code) --AND PRICELIST.PRICE_LIST=TRIM(AS_STATE_CODE)||'PTR' AND AS_TRANDATE BETWEEN PRICELIST.EFF_FROM AND PRICELIST.VALID_UPTO; Return As_Price_List; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ACESSTAX_PAYMENT (vouchno char,net_amt number,pay_amt number,exch_rate__vouch number, DIFF_AMT__EXCH NUMBER , taxgroup char) return number is srtax number; mexch_rate number; begin srtax := 0; SELECT (ROUND((((SUM(TAXTRAN.TAX_AMT) * (PAY_AMT))/ NET_AMT) * exch_rate__vouch),3)) / (ROUND(((((SUM(PAY_AMT * exch_rate__vouch) / COUNT(TAXTRAN.TAX_CODE)) + (CASE WHEN DIFF_AMT__EXCH <=0 THEN DIFF_AMT__EXCH * -1 ELSE DIFF_AMT__EXCH * -1 END)) / pay_amt)),3)) into srtax --NVL((SUM(TAXTRAN.TAX_AMT) * PAY_AMT )/ NET_AMT,0) * exch_rate__vouch / --(((SUM(PAY_AMT * exch_rate__vouch) + (CASE WHEN DIFF_AMT__EXCH <=0 THEN DIFF_AMT__EXCH * -1 ELSE DIFF_AMT__EXCH END))) / pay_amt) into srtax FROM TAXTRAN , TAX WHERE TAXTRAN.TAX_CODE = TAX.TAX_CODE AND TAXTRAN.TRAN_CODE IN ('M-VOUC','VOUCH','CRNINV','DRNPAY','CRNPAY') AND TAXTRAN.TRAN_ID=VOUCHNO AND TAX.TAX_GROUP IN (taxgroup) AND (TAXTRAN.ACCT_CODE IS NOT NULL OR TAXTRAN.ACCT_CODE__RECO IS NOT NULL) AND TAXTRAN.TAX_AMT <> 0; return srtax; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_RECOREC1 (as_workorder in char, as_trantype in char,as_itemcode in char) return varchar2 is ll_reccount number(6,0) := 0; by_count number(6,0) := 0; wk_count number(6,0) := 0; ls_retval number := 0; begin if as_trantype = 'F' then begin select count(order_type) into ll_reccount from workorder where work_order=as_workorder and (item_code like 'R%' or item_code like 'BD%') and order_type='F'; if ll_reccount >0 then select sum(count(item_code__byprod)) into by_count from byproduct where (item_code__byprod like 'R%' or item_code__byprod like 'BD%') and item_code=as_itemcode and active='A' group by operation; else ls_retval:= 0; end if; if by_count >0 then select sum(count(distinct item_code)) into wk_count from workorder_receipt where tran_type='B' and work_order=as_workorder and confirmed='Y' group by operation; if wk_count = by_count then ls_retval:= 0; else ls_retval:= 1; end if; end if; end ; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CP_SUPP_CHK (as_site_code in varchar2, as_cust_code in varchar2, as_item_ser in varchar2, as_item_code in varchar2) RETURN NUMBER IS mcount number(1) := 0; ls_site_code__ch varchar2(5); ls_supp_code_ch varchar2(10); BEGIN begin select site_code__ch into ls_site_code__ch from site_customer where site_code = as_site_code and cust_code = as_cust_code and channel_partner = 'Y'; exception when others then ls_site_code__ch := ''; end; if length(trim(ls_site_code__ch)) = 0 or ls_site_code__ch is null then begin select site_code into ls_site_code__ch from customer where trim(cust_code) = trim(as_cust_code) and channel_partner = 'Y'; exception when others then ls_site_code__ch := ''; end; end if; if length(trim(ls_site_code__ch)) = 0 or ls_site_code__ch is null then -- not channel partner return pass validation return 0; end if; begin select supp_code into ls_supp_code_ch from site_supplier where site_code = ls_site_code__ch and site_code__ch = as_site_code and channel_partner = 'Y'; exception when others then ls_supp_code_ch := ''; end; if length(trim(ls_supp_code_ch)) = 0 or ls_supp_code_ch is null then begin select supp_code into ls_supp_code_ch from supplier where site_code = as_site_code and channel_partner = 'Y'; exception when others then ls_supp_code_ch := ''; end; end if; if length(trim(ls_supp_code_ch)) = 0 or ls_supp_code_ch is null then -- return error as corresponding channel partner supplier not found return 1; end if; return 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RECV_CHK BEFORE UPDATE OF adj_amt ON receivables referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; BEGIN --if abs(:new.adj_amt) > abs(:old.tot_amt) then --- 21-jan-2021 manoharan commented and following condition added if abs(:new.adj_amt) > abs(:old.tot_amt) and (:new.adj_amt < 0 and :old.tot_amt > 0 and trim(:new.tran_ser) <> 'S-INV') then raise_application_error( -20601, 'Adjustment amount cannot be more then total amount [' || to_char(:old.tot_amt) || '] adjustment [' || to_char(:new.adj_amt) || ']' ); end if; if :new.adj_amt > 0 and :old.tot_amt < 0 then raise_application_error( -20601, 'Adjustment amount positive total amount [' || to_char(:old.tot_amt) || '] is negative, adjustment [' || to_char(:new.adj_amt) || ']' ); end if; if :new.adj_amt < 0 and :old.tot_amt > 0 and trim(:new.tran_ser) <> 'S-INV' then raise_application_error( -20601, 'Adjustment amount negative total amount [' || to_char(:old.tot_amt) || '] is positive, adjustment [' || to_char( :new.adj_amt) || ']' ); end if; if abs(:new.adj_amt) > abs(:old.tot_amt) and trim(:new.tran_ser) <> 'S-INV' then raise_application_error( -20601, 'Adjustment amount greater total amount [' || to_char(:old.tot_amt) || '] is positive, adjustment [' || to_char( :new.adj_amt) || ']' ); end if; if :new.adj_amt > :old.tot_amt and :new.adj_amt > 0 and :old.tot_amt > 0 then raise_application_error( -20601, 'Adjustment amount greater total amount [' || to_char(:old.tot_amt) || '] is positive, adjustment [' || to_char( :new.adj_amt) || ']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MATCH_TAX (as_purcorder in char) return char is ls_matched char(1); ll_detailcount number(14,0); ll_count number(14,0); lc_perc taxtran.tax_perc%type; ls_taxcode taxtran.tax_code%type ; ls_taxclass taxtran.tax_class%type ; ls_taxbase taxtran.tax_base%type ; ls_taxenv taxtran.tax_env%type ; ls_retval char(1) ; cursor cur_tax is select tax_code,tax_class,tax_base,tax_env,nvl(tax_perc,0), count(*) from taxtran where tran_code = 'P-ORD' and tran_id = as_purcorder and nvl(tax_amt,0) <> 0 group by tax_code,tax_class,tax_base,tax_env,tax_perc ; begin ls_retval := 'N' ; select count(*) into ll_detailcount from porddet where purc_order = as_purcorder ; if ll_detailcount > 1 then ls_retval := 'Y'; open cur_tax ; LOOP fetch cur_tax into ls_taxcode, ls_taxclass, ls_taxbase, ls_taxenv, lc_perc, ll_count ; EXIT WHEN (cur_tax%NOTFOUND); if ll_count <> ll_detailcount then ls_retval := 'N' ; exit ; end if; END LOOP; close cur_tax ; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DEPT_DESCR ( as_dept_code char) return varchar2 is ls_descr varchar2(40); begin begin select descr into ls_descr from department where dept_code = as_dept_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_YTD_SALES_PMPM (as_sales_pers CHAR,as_stan_code CHAR,AS_OPT VARCHAR) RETURN NUMBER IS FINAL_VAL NUMBER (14,3); SALES_VAL NUMBER(14,3); AVG_SALES_VAL NUMBER(14,3); NO_OF_SE NUMBER(14,3); NO_OF_MTH NUMBER(14,3); AS_FR_DATE DATE; BEGIN SELECT FR_DATE, FLOOR(MONTHS_BETWEEN(SYSDATE, FR_DATE)) INTO AS_FR_DATE, NO_OF_MTH FROM ACCTPRD WHERE TO_DATE(SYSDATE) BETWEEN FR_DATE AND TO_DATE; if (AS_OPT='Y') then SELECT MAX(NO_OF_SE), SUM(SALES_VAL) INTO NO_OF_SE, SALES_VAL FROM DWH_INV_SRET_SUM WHERE TRAN_DATE BETWEEN AS_FR_DATE AND SYSDATE AND TERRITORY_CODE IN (select POOL_CODE from ORG_STRUCTURE where EMP_CODE in (select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code) AND VERSION_ID = (SELECT MAX(Q.VERSION_ID) FROM VERSION Q WHERE TRUNC(SYSDATE) BETWEEN Q.EFF_FROM AND SYSDATE)) AND EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code); ELSE SELECT MAX(NO_OF_SE), SUM(SALES_VAL) INTO NO_OF_SE, SALES_VAL FROM DWH_INV_SRET_SUM WHERE TRAN_DATE BETWEEN AS_FR_DATE AND SYSDATE AND TERRITORY_CODE IN (select POOL_CODE from ORG_STRUCTURE where EMP_CODE in (select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ) AND VERSION_ID = (SELECT MAX(Q.VERSION_ID) FROM VERSION Q WHERE TRUNC(SYSDATE) BETWEEN Q.EFF_FROM AND SYSDATE)) AND EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ); END IF; AVG_SALES_VAL := NVL(SALES_VAL, 0); IF NO_OF_MTH > 0 THEN AVG_SALES_VAL := SALES_VAL / NO_OF_MTH; END IF; IF NO_OF_SE > 0 THEN AVG_SALES_VAL := AVG_SALES_VAL / NO_OF_SE; END IF; FINAL_VAL := AVG_SALES_VAL; RETURN FINAL_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SITECODE_ITEMSER_PRDCODE ON SALESFORECAST_HDR (SITE_CODE, ITEM_SER, PRD_CODE__FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_AMOUNT ( as_acctprd in CHAR , as_empcode in CHAR , as_prdcode in CHAR ,as_var_name in CHAR , as_type in varchar2) return number as ad_code_s varchar2(300); ad_gross number(14,2); ad_val number(14,2); ls_pos number(2); str1 CHAR(5); begin ad_code_s := trim(FN_RGETENV(as_prdcode, as_var_name)); if ad_code_s is null or length(trim(ad_code_s ))=0 then return 0; end if; if instr(ad_code_s,',')=0 then STR1 := TRIM(ad_code_s); if as_type = 'A' then select SUM(nvl(amount,0)) AS AMOUNT into ad_gross from it_calcdet where acct_prd = as_acctprd and emp_code = as_empcode and ad_code= STR1; elsif as_type = 'P' then select SUM(nvl(amount,0)) AS AMOUNT into ad_gross from itproj_calcdet where acct_prd = as_acctprd and emp_code = as_empcode and ad_code = STR1; end if; else begin loop exit when instr(ad_code_s,',')=0; ls_pos := instr(ad_code_s,','); str1 := TRIM(ddf_get_token(ad_code_s,',')); if as_type = 'A' then select SUM(nvl(amount,0)) AS AMOUNT into ad_val from it_calcdet where acct_prd = as_acctprd and emp_code = as_empcode and ad_code = str1; elsif as_type = 'P' then select SUM(nvl(amount,0)) AS AMOUNT into ad_val from itproj_calcdet where acct_prd = as_acctprd and emp_code = as_empcode and ad_code = str1; end if; ad_code_s := substr(ad_code_s,ls_pos+1,length(ad_code_s)); ad_gross := nvl(ad_gross,0) + nvl(ad_val,0); end loop; end; STR1 := TRIM(ad_code_s); if as_type = 'A' then select SUM(nvl(amount,0)) AS AMOUNT into ad_val from it_calcdet where acct_prd = as_acctprd and emp_code = as_empcode and ad_code= STR1; elsif as_type = 'P' then select SUM(nvl(amount,0)) AS AMOUNT into ad_val from itproj_calcdet where acct_prd = as_acctprd and emp_code = as_empcode and ad_code = STR1; end if; ad_gross := nvl(ad_gross,0) + nvl(ad_val,0); end if; return nvl(ad_gross,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PORCP_TDS_AT_VOUCHER (prcpno char, lineno char, ptrancode char , taxcode char)return number is taxperc number; begin taxperc := 0; select nvl(tax_perc,0) into taxperc from taxtran where tran_code = ptrancode and tran_id = prcpno and line_no = lineno and tax_code = taxcode; return taxperc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EESI (EMP_CD char,BASE_PRD char,CURR_PRD char,AC_ES03A NUMBER,AC_ES03 NUMBER,aS_arrac_prd char,ac_curramt number, LC_ESIBASELIMIT_PREV NUMBER,LC_ESIBASELIMIT NUMBER,as_proctype char) return number IS lc_amt number(14,3); LC_PREVAMT NUMBER(14,3) := 0; LC_ES03A NUMBER(14,3) := 0; LC_ES03 NUMBER(14,3) := 0; LC_BASE NUMBER(14,3) := 0; LC_CURRAMT NUMBER(14,3) := 0; BEGIN if as_proctype <> 'AR' then IF NVL(AC_ES03A,0) = 0 OR NVL(AC_ES03A,0) > NVL(AC_ES03,0) THEN LC_BASE := NVL(AC_ES03,0); ELSE LC_BASE := NVL(AC_ES03A,0); END IF; IF LC_BASE <= LC_ESIBASELIMIT THEN RETURN ROUND(NVL(AC_CURRAMT,0),2); ELSE RETURN 0; END IF; end if; LC_CURRAMT := ROUND(NVL(AC_CURRAMT,0),2); SELECT sum(AMOUNT) into lc_PREVamt FROM ( select NVL(a.amount,0) AS AMOUNT from payrolldet a, payroll b where b.emp_code = a.emp_code and b.prd_code = a.prd_code and b.emp_code = EMP_CD and b.prd_code = CURR_PRD and a.ad_code ='EESI' and nvl(a.amount,0) <> 0 and b.voucher_no is not null UNION ALL select NVL(a.diff_amt,0) AS AMOUNT from arreardet a, arrears b where b.emp_code = a.emp_code and b.prd_code = a.prd_code and b.prd_code__acc = a.prd_code__acc and b.emp_code = EMP_CD and b.prd_code = CURR_PRD and a.ad_code ='EESI' and nvl(a.DIFF_AMT,0) <> 0 and b.voucher_no is not null); IF LC_PREVAMT IS NULL THEN LC_PREVAMT := 0.00; END IF; IF NVL(AC_ES03A,0) = 0 OR NVL(AC_ES03A,0) > NVL(AC_ES03,0) THEN LC_BASE := NVL(AC_ES03,0); ELSE LC_BASE := NVL(AC_ES03A,0); END IF; IF LC_BASE > LC_ESIBASELIMIT_PREV THEN LC_CURRAMT := 0; END IF; IF LC_CURRAMT < LC_PREVAMT THEN RETURN LC_PREVAMT; END IF; SELECT NVL(AMOUNT,0) INTO LC_ES03A FROM PAYROLL_PROJDET WHERE EMP_CODE = EMP_CD AND PRD_CODE = AS_ARRAC_PRD AND AD_CODE = 'ES03A'; IF LC_ES03A IS NULL THEN LC_ES03A := 0.00; END IF; SELECT NVL(AMOUNT,0) INTO LC_ES03 FROM PAYROLL_PROJDET WHERE EMP_CODE = EMP_CD AND PRD_CODE = AS_ARRAC_PRD AND AD_CODE = 'ES03'; IF LC_ES03 IS NULL THEN LC_ES03 := 0.00; END IF; IF LC_ES03A = 0 OR LC_ES03A > LC_ES03 THEN LC_BASE := LC_ES03; ELSE LC_BASE := LC_ES03A; END IF; IF LC_BASE > LC_ESIBASELIMIT THEN RETURN LC_PREVAMT; ELSE -- RETURN (LC_CURRAMT) + ((round(lc_curramt-lc_prevamt))+lc_prevamt-lc_curramt); RETURN LC_CURRAMT; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STATU_LIST_DET_X ON STATU_LIST_DET (STATU_TABLE, SECTION_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRY_CITY ( as_sundry_code in char, as_sundry_type in char) return varchar2 is ls_city varchar2(20); begin if as_sundry_type = 'O' then ls_city :=' '; elsif as_sundry_type = 'T' then select city into ls_city from transporter where tran_code = as_sundry_code; elsif as_sundry_type = 'B' then select city into ls_city from bank where bank_code = as_sundry_code; elsif as_sundry_type = 'X' then select city into ls_city from tax_authority where tauth_code = as_sundry_code; elsif as_sundry_type = 'E' then select cur_city into ls_city from employee where emp_code = as_sundry_code; elsif as_sundry_type = 'C' then select city into ls_city from customer where cust_code = as_sundry_code; elsif as_sundry_type = 'S' then select city into ls_city from supplier where supp_code = as_sundry_code; elsif as_sundry_type = 'L' then select city into ls_city from loanparty where party_code = as_sundry_code; elsif as_sundry_type = 'D' then select city into ls_city from strg_customer where sc_code = as_sundry_code; elsif as_sundry_type = 'P' then select city into ls_city from sales_pers where sales_pers = as_sundry_code; end if; if ls_city is null then ls_city := ' '; end if; return ls_city; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_PROCCD (as_route procroute.route_code%type, as_opr procroute.operation%type) return char is ls_pc procroute.proc_code%type ; begin select proc_code into ls_pc from procroute where route_code = as_route and operation = as_opr and rownum = 1; return ls_pc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINVUPD_INSERT BEFORE INSERT ON e_invoice_update FOR EACH ROW BEGIN SELECT lpad(to_char(EINV_UPD_SEQ.nextval),20,'0') INTO :new.tran_id FROM dual; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STOPBATCHLOAD before insert or update on batchload for each row begin if trim(:new.chg_user) in ('ESCTEST10','BIPIN') then raise_application_error(-20025,'Not allowed'); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_ITEM_USAGE (as_item_code char) return number is ls_retval char; ls_item_usage item.item_usage%type; begin select item_usage into ls_item_usage from item where item_code = as_item_code; if ls_item_usage in ('OG','OL','OS') then ls_retval := '1'; else ls_retval := '0'; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_TOTALBTCHSIZE (as_work_order in workorder.work_order%type) return number is ln_batch_size number(14,3); begin select sum(workorder_enhanc.batch_size_add) into ln_batch_size from workorder_enhanc where workorder_enhanc.work_order = as_work_order and workorder_enhanc.enhanc_type = 'A' and workorder_enhanc.confirmed = 'Y' ; return ln_batch_size; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUN_GET_OCTROI (MTRANID IN CHAR, MITM IN CHAR, MSORD IN CHAR, MLOTNO IN CHAR) RETURN NUMBER IS MTAX NUMBER; MITMCAT TAX_ITEM_STAN.ITEM_CATEGORY%TYPE; MSTAN STATION.STAN_CODE%TYPE; MCUST CUSTOMER.CUST_CODE%TYPE; MCH SITE_CUSTOMER.CHANNEL_PARTNER%TYPE; MSITE SITE.SITE_CODE%TYPE; mctype customer.cust_type%type; mctr number; mmrp_tag pricelist.CHG_REF_NO%type; MFULL_SR SRETURN.FULL_RET%TYPE; MINVREF SRETURN.INVOICE_ID%TYPE; BEGIN IF SUBSTR(MTRANID,4,2) = 'SR' THEN SELECT INVOICE_ID,FULL_RET INTO MINVREF,MFULL_SR FROM SRETURN WHERE TRAN_ID = MTRANID; IF TRIM(MFULL_SR) = 'Y' AND MINVREF IS NOT NULL THEN SELECT COUNT(*) INTO MCTR FROM PRICELIST WHERE PRICE_LIST = 'MRP' AND ITEM_CODE = MITM AND NVL(trim(MLOTNO),'A') BETWEEN trim(LOT_NO__FROM) AND trim(LOT_NO__TO); IF MCTR > 0 THEN SELECT CHG_REF_NO INTO MMRP_TAG FROM PRICELIST WHERE PRICE_LIST = 'MRP' AND ITEM_CODE = MITM AND trim(MLOTNO) BETWEEN trim(LOT_NO__FROM) AND trim(LOT_NO__TO); IF MMRP_TAG = 'MRP' THEN SELECT CUST_CODE,SITE_CODE INTO MCUST,MSITE FROM SRETURN WHERE TRAN_ID = MTRANID; SELECT NVL(CHANNEL_PARTNER,'N') INTO MCH FROM SITE_CUSTOMER WHERE SITE_CODE = MSITE AND CUST_CODE = MCUST; IF MCH = 'Y' THEN MTAX := 0; ELSE SELECT NVL(CHANNEL_PARTNER,'N'),cust_type INTO MCH,mctype FROM CUSTOMER WHERE CUST_CODE = MCUST; IF (MCH = 'Y' or mctype = 'O') THEN MTAX := 0; ELSE SELECT STAN_CODE INTO MSTAN FROM CUSTOMER WHERE CUST_CODE = MCUST; SELECT PHY_ATTRIB_15 INTO MITMCAT FROM ITEM WHERE ITEM_CODE = MITM; SELECT count(*) into mctr FROM TAX_ITEM_STAN WHERE STAN_CODE = MSTAN AND ITEM_CATEGORY = MITMCAT AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO; if mctr > 0 then SELECT TAX_PERC INTO MTAX FROM TAX_ITEM_STAN WHERE STAN_CODE = MSTAN AND ITEM_CATEGORY = MITMCAT AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO; else mtax := 0; end if; END IF; END IF; ELSE mtax := 0; END IF; ELSE mtax := 0; END IF; ELSE mtax := 0; END IF; ELSE SELECT COUNT(*) INTO MCTR FROM PRICELIST WHERE PRICE_LIST = 'MRP' AND ITEM_CODE = MITM AND NVL(trim(MLOTNO),'A') BETWEEN trim(LOT_NO__FROM) AND trim(LOT_NO__TO); IF MCTR > 0 THEN SELECT CHG_REF_NO INTO MMRP_TAG FROM PRICELIST WHERE PRICE_LIST = 'MRP' AND ITEM_CODE = MITM AND trim(MLOTNO) BETWEEN trim(LOT_NO__FROM) AND trim(LOT_NO__TO); IF MMRP_TAG = 'MRP' THEN SELECT CUST_CODE,SITE_CODE__SHIP INTO MCUST,MSITE FROM SORDER WHERE SALE_ORDER = MSORD; SELECT NVL(CHANNEL_PARTNER,'N') INTO MCH FROM SITE_CUSTOMER WHERE SITE_CODE = MSITE AND CUST_CODE = MCUST; IF MCH = 'Y' THEN MTAX := 0; ELSE SELECT NVL(CHANNEL_PARTNER,'N'),cust_type INTO MCH,mctype FROM CUSTOMER WHERE CUST_CODE = MCUST; IF (MCH = 'Y' or mctype = 'O') THEN MTAX := 0; ELSE SELECT STAN_CODE INTO MSTAN FROM CUSTOMER WHERE CUST_CODE = MCUST; SELECT PHY_ATTRIB_15 INTO MITMCAT FROM ITEM WHERE ITEM_CODE = MITM; SELECT count(*) into mctr FROM TAX_ITEM_STAN WHERE STAN_CODE = MSTAN AND ITEM_CATEGORY = MITMCAT AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO; if mctr > 0 then SELECT TAX_PERC INTO MTAX FROM TAX_ITEM_STAN WHERE STAN_CODE = MSTAN AND ITEM_CATEGORY = MITMCAT AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO; else mtax := 0; end if; END IF; END IF; ELSE mtax := 0; END IF; ELSE mtax := 0; END IF; END IF; RETURN MTAX; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX LOCALITY_PIN_IDX ON LOCALITY (PIN) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DADRA_QMS_DATA_X ON DADRA_QMS_DATA (SR_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_CHANPART ON CUSTOMER (CUST_CODE, CHANNEL_PARTNER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IPC_SITE_FROM_TO ON IBCA_PAY_CTRL (SITE_CODE__FROM, SITE_CODE__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_HOLTBLNO (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select eff_date,conf_date,chg_date,hol_tblno__fr from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' order by emp_code,eff_date; a_hol_tblno employee.hol_tblno%type; a_eff_date date; a_conf_date date; a_chg_date date; begin for i in c1 loop if (i.eff_date != a_eff_date and a_eff_date is not null) then exit; end if; if (a_conf_date is null) then a_hol_tblno := i.hol_tblno__fr; a_conf_date := i.conf_date; a_chg_date := i.chg_date; else if (i.conf_date < a_conf_date) then a_hol_tblno := i.hol_tblno__fr; a_conf_date := i.conf_date; a_chg_date := i.chg_date; elsif (i.conf_date = a_conf_date) then if (i.chg_date < a_chg_date) then a_hol_tblno := i.hol_tblno__fr; a_chg_date := i.chg_date; end if; end if; end if; a_eff_date := i.eff_date; end loop; if (trim(a_hol_tblno) is null) then select hol_tblno into a_hol_tblno from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_hol_tblno) is null) then select hol_tblno into a_hol_tblno from site where site_code = ddf_hr_status(AS_EMP_CODE,AS_DATE,'W'); end if; return a_hol_tblno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_FM16A_BNK_DET ( as_ref_ser char , as_vouch_no char) return varchar2 is ls_details varchar2(60); ls_sh_bank bank.sh_name%type; ls_bank_city bank.city%type; ls_bank_code bank.bank_code%type; ls_handover_to misc_payment.handover_to%type; begin select rtrim(handover_to), rtrim(bank_code) into ls_handover_to , ls_bank_code from misc_payment a where a.tran_id = (select max(a.tran_id) from misc_payment a, misc_paydet b where a.tran_id = b.tran_id and b.tran_ser = as_ref_ser and b.vouch_no = as_vouch_no and a.conf_date = (select max(a.conf_date) from misc_payment a, misc_paydet b where a.tran_id = b.tran_id and b.tran_ser = as_ref_ser and b.vouch_no = as_vouch_no)) and length( rtrim( handover_to ) ) > 0 ; if ls_handover_to is null then select rtrim(nvl(sh_name,' ')) , rtrim(nvl(city,' ')) into ls_sh_bank , ls_bank_city from bank where bank_code = ls_bank_code; ls_details := ls_sh_bank||', '||ls_bank_city; else ls_details := ls_handover_to; end if; return ls_details; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CALC_EXEMPT_HRA (AS_EMP_CODE EMPLOYEE.EMP_CODE%TYPE, AS_ACCT_PRD ACCTPRD.CODE%TYPE, BASIC_SAL PAYROLLDET.AMOUNT%TYPE, HRA PAYROLLDET.AMOUNT%TYPE, RENT_PAID PAYROLLDET.AMOUNT%TYPE, IT_REGIME NUMBER) RETURN DECIMAL IS EXCEMPTED_HRA DECIMAL(14,3); HRA_OF_BASIC_SAL PAYROLLDET.AMOUNT%TYPE; ACCESS_RENT PAYROLLDET.AMOUNT%TYPE; BEGIN EXCEMPTED_HRA := 0.00; IF (BASIC_SAL IS NOT NULL AND BASIC_SAL > 0 AND HRA IS NOT NULL AND HRA > 0 AND RENT_PAID IS NOT NULL AND RENT_PAID > 0) THEN BEGIN IF IT_REGIME IS NULL OR IT_REGIME <= 1 THEN HRA_OF_BASIC_SAL := ROUND(BASIC_SAL * 50 / 100 , 0); ACCESS_RENT := RENT_PAID - ROUND(BASIC_SAL * 10 / 100 , 0); IF ACCESS_RENT < 0 THEN ACCESS_RENT := 0; END IF; EXCEMPTED_HRA := LEAST(HRA,HRA_OF_BASIC_SAL,ACCESS_RENT); END IF; END; END IF; RETURN EXCEMPTED_HRA; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SOD_COMPARESTRINGS (string1 user_rights.rights%type, string2 sod_rule_dtl.right_char_conflict%type) return varchar2 is i number := 0; l_count number := 0; str1 varchar2(20); str2 varchar2(20); str3 varchar2(20); pstr varchar2(20); begin str1 := ddf_get_sod_sort_string(replace(string1,',','')); str2 := ddf_get_sod_sort_string(replace(string2,',','')); if substr(str1,1,1) = '*' then pstr := 'conflict'; else --while (i < length(str1)) for i in 1..length(str1) loop --i := i+1; dbms_output.put_line('i:'||i); l_count := instr(str2,substr(str1,i,1),1); dbms_output.put_line('l_count:'||l_count); if l_count > 0 then pstr := 'conflict'; else pstr := null; end if; exit when l_count > 0; end loop; end if; return pstr; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_SRETURN_ICDATE (as_tran_type sreturn.tran_type%type,as_tran_date sreturn.tran_date%type,as_invoice_id sreturn.invoice_id%type) return number is ls_count number(10,0); ls_var_value varchar2(600); begin begin ls_count :=0; SELECT count(1) into ls_count FROM DISPARM WHERE var_name='LY_SRETURN_ICDATE' and var_value='Y'; exception when no_data_found then ls_count :=0; end; IF ls_count >0 THEN if trim(as_tran_type)='IC' THEN IF as_tran_date = ddf_get_invoice_date(as_invoice_id) THEN RETURN 1; ELSE RETURN 0; END IF; ELSE RETURN 1; END IF; else return 1; END IF; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_WF_ROLE_USERS_CTX ON WF_ROLE_USERS_CTX (ROLE_CODE, ROLE_CONTEXT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RTY_ASSV_DUTY ( as_item_code char, as_tran_date_from Date, as_tran_date_to Date, as_site_code char, as_flag char) return number is ls_sum_quantity number; ls_sum_assval number; ls_sum_duty number; begin if(as_flag = 'Q') then begin select nvl(sum(nvl(quantity,0)),0) into ls_sum_quantity from invtrace where ( ref_ser = 'D-ISS' ) and ( item_code = as_item_code ) and ( tran_date >= as_tran_date_from and tran_date <= as_tran_date_to) and (site_code = as_site_code) and (lot_no in (select lot_no from invtrace where ref_ser = 'W-RCP' and item_code = as_item_code and site_code =as_site_code and tran_date >= as_tran_date_from and tran_date <= as_tran_date_to) ) group by item_code; exception when no_data_found then ls_sum_quantity := 0; end; return ls_sum_quantity; elsif(as_flag = 'A' ) then begin select nvl(sum(nvl(taxtran.taxable_amt,0)),0) into ls_sum_assval from invtrace,taxtran where ( invtrace.ref_ser = 'D-ISS' ) and (taxtran.tran_code = 'D-ISS') and (taxtran.tran_id = invtrace.ref_id) and (invtrace.item_code = as_item_code ) and (invtrace.site_code = as_site_code) and (invtrace.tran_date >= as_tran_date_from and invtrace.tran_date <= as_tran_date_to) and (invtrace.lot_no in (select lot_no from invtrace where ref_ser = 'W-RCP' and item_code = as_item_code and site_code =as_site_code and tran_date >= as_tran_date_from and tran_date <= as_tran_date_to) ) group by invtrace.item_code; end; ls_sum_quantity := ls_sum_assval; return ls_sum_quantity ; elsif(as_flag = 'D') then begin select nvl(sum(nvl(taxtran.tax_amt,0)),0) into ls_sum_duty from invtrace,taxtran,finparm where (finparm.var_name = 'PLA_TAX_CODE') and ( invtrace.ref_ser = 'D-ISS' ) and (taxtran.tran_code = 'D-ISS') and (taxtran.tran_id = invtrace.ref_id) and (invtrace.item_code = as_item_code ) and (site_code = as_site_code) and (invtrace.tran_date >= as_tran_date_from and invtrace.tran_date <= as_tran_date_to) and (invtrace.lot_no in (select lot_no from invtrace where ref_ser = 'W-RCP' and item_code = as_item_code and site_code =as_site_code and tran_date >= as_tran_date_from and tran_date <= as_tran_date_to) ) group by invtrace.item_code; end; ls_sum_quantity := ls_sum_duty; return ls_sum_quantity; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMPNONFIELD_STATUS (AS_CODE char) return varchar2 is a_return varchar2(200); ENTITY OBJ_SIGN_TRANS.context_1%type; line_number OBJ_SIGN_TRANS.line_no%type; sign_status OBJ_SIGN_TRANS.sign_status%type; a_count number(1); a_line_no number(1); begin select max(line_no)into line_number from OBJ_SIGN_TRANS where ref_id = AS_CODE; a_line_no:=line_number; select context_1,sign_status into ENTITY,sign_status from OBJ_SIGN_TRANS where ref_id = AS_CODE and line_no=line_number; if (sign_status = 'S') then a_return:='Transaction completed'; return a_return; else a_return:=CONCAT('Pending at ',ENTITY); return a_return; end if; return a_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_EXCESS_CLAIM (AS_TRAN_ID IN CHAR) RETURN VARCHAR2 IS LS_ERROR_STR VARCHAR2(1000); ACCT_PRD ACCTPRD.CODE%TYPE; AC_FRDT ACCTPRD.FR_DATE%TYPE; AC_TODT ACCTPRD.TO_DATE%TYPE; LC_CLAIM_LIMIT EMPL_CLAIM_CATG.CLAIM_LIMIT%TYPE; LC_CLAIM_AMT EMP_REIMB_CLAIMDET.CLAIM_AMT%TYPE; LS_CATG_VERIFIED VARCHAR2(4000); LS_STR VARCHAR2(4000); LI_CNT NUMBER(4); LS_MSG_NO MESSAGES.MSG_NO%TYPE; LS_MSG_TYPE MESSAGES.MSG_TYPE%TYPE; LS_MSG_STR MESSAGES.MSG_STR%TYPE; LS_MSG_DESCR MESSAGES.MSG_DESCR%TYPE; LS_MSG_OPT MESSAGES.MSG_OPT%TYPE; LS_CR CHAR(1); LS_LF CHAR(1); CURSOR C1 IS SELECT A.EMP_CODE AS EMP_CODE, B.LINE_NO AS LINE_NO, B.CATEGORY_CODE AS CATEGORY_CODE, B.ANAL_CODE AS ANAL_CODE , B.FROM_DATE AS FROM_DATE , B.TO_DATE AS TO_DATE , B.CLAIM_AMT AS CLAIM_AMT , B.CLAIM_LIMIT AS CLAIM_LIMIT FROM EMP_REIMB_CLAIMDET B, EMP_REIMB_CLAIM A WHERE A.TRAN_ID = B.TRAN_ID AND A.TRAN_ID = AS_TRAN_ID AND B.LIMIT_TYPE = 'A'; BEGIN LS_ERROR_STR := ''; LS_CATG_VERIFIED := ' '; LS_ERROR_STR := ''; LS_CR := CHR(13); LS_LF := CHR(10); FOR I IN C1 LOOP LC_CLAIM_AMT := 0; LC_CLAIM_LIMIT := 0; SELECT CODE, FR_DATE, TO_DATE INTO ACCT_PRD, AC_FRDT, AC_TODT FROM ACCTPRD WHERE I.TO_DATE >= FR_DATE AND I.TO_DATE <= TO_DATE; LS_STR := '[' || I.CATEGORY_CODE || I.ANAL_CODE || ACCT_PRD || ']'; IF INSTR(LS_CATG_VERIFIED , LS_STR) <= 0 THEN LS_CATG_VERIFIED := LS_CATG_VERIFIED || LS_STR; SELECT CLAIM_LIMIT INTO LC_CLAIM_LIMIT FROM EMPL_CLAIM_CATG WHERE EMP_CODE = I.EMP_CODE AND CATEGORY_CODE = I.CATEGORY_CODE AND ANAL_CODE = I.ANAL_CODE AND I.TO_DATE >= EFF_FROM AND I.TO_DATE <= VALID_UPTO; SELECT SUM(B.CLAIM_AMT) INTO LC_CLAIM_AMT FROM EMP_REIMB_CLAIMDET B, EMP_REIMB_CLAIM A WHERE A.TRAN_ID = B.TRAN_ID AND A.EMP_CODE = I.EMP_CODE AND B.CATEGORY_CODE = I.CATEGORY_CODE AND B.ANAL_CODE = I.ANAL_CODE AND B.FROM_DATE >= AC_FRDT AND B.FROM_DATE <= AC_TODT; IF LC_CLAIM_AMT > LC_CLAIM_LIMIT THEN LS_MSG_NO := 'VTERCFN001'; LI_CNT := 0; SELECT COUNT(1) INTO LI_CNT FROM MESSAGES WHERE MSG_NO=LS_MSG_NO; IF LI_CNT > 0 THEN SELECT NVL(MSG_TYPE , 'E') AS MSG_TYPE, NVL(MSG_STR,'Claim Limit Exceeded') AS MSG_STR, NVL(MSG_DESCR , 'Claim limit exceeded') AS MSG_DESCR, NVL(MSG_OPT , 'Y') AS MSG_OPT INTO LS_MSG_TYPE, LS_MSG_STR, LS_MSG_DESCR, LS_MSG_OPT FROM MESSAGES WHERE MSG_NO=LS_MSG_NO; ELSE LS_MSG_TYPE := 'E'; LS_MSG_STR := 'Claim Limit Exceeded'; LS_MSG_DESCR := 'Claim limit exceeded'; LS_MSG_OPT := 'Y'; END IF; LS_MSG_DESCR := LS_MSG_DESCR || ' [Catrory code = ' || I.CATEGORY_CODE || ' , '; LS_MSG_DESCR := LS_MSG_DESCR || ' Analysis Code = ' || I.ANAL_CODE || ' , '; LS_MSG_DESCR := LS_MSG_DESCR || ' Financial Yrar = ' || ACCT_PRD || ']'; LS_ERROR_STR := '' || LS_CR || LS_LF || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || '' ; LS_ERROR_STR := LS_ERROR_STR || ''|| LS_MSG_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || ''|| LS_MSG_DESCR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || ''|| LS_MSG_TYPE || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; LS_ERROR_STR := LS_ERROR_STR || '' || LS_CR || LS_LF || ''; EXIT; END IF; END IF; END LOOP; RETURN LS_ERROR_STR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDYOP_GLALLAC_N ( m_frst_date IN DATE, m_date_from IN DATE, m_sundry_type IN CHAR, m_sundry_code IN CHAR, m_fin_entity IN CHAR) RETURN NUMBER IS ld_day_op_bal NUMBER(14,3); BEGIN SELECT SUM((dr_amt * exch_rate) - (cr_amt * exch_rate)) INTO ld_day_op_bal FROM gltrace WHERE fin_entity = m_fin_entity AND tran_date >= m_frst_date AND tran_date < m_date_from AND sundry_type = m_sundry_type AND sundry_code = m_sundry_code; IF ld_day_op_bal IS NULL THEN ld_day_op_bal := 0; END IF; RETURN ld_day_op_bal; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION SUN_DDF_GET_MAX_TRANDT (MSITE IN CHAR, MLOT IN CHAR, MTYPE IN CHAR,R_SER IN VARCHAR) RETURN DATE IS MTRAN_DATE DATE; begin IF MTYPE = 'R' THEN SELECT MAX(TRAN_DATE) INTO MTRAN_DATE FROM INVTRACE WHERE SITE_CODE = MSITE AND REF_SER IN ('P-RCP','D-RCP','W-RCP') AND LOT_NO = MLOT AND inv_stat NOT IN ('INTR','DISCR'); END IF; IF MTYPE = 'I' THEN SELECT MAX(TRAN_DATE) INTO MTRAN_DATE FROM INVTRACE WHERE SITE_CODE = MSITE AND LOT_NO = MLOT AND inv_stat NOT IN ('INTR','DISCR') AND instr(R_SER ,trim(REF_SER) )>0; END IF; RETURN MTRAN_DATE; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SERIES_X ON STRG_SERIES (SC_CODE, ITEM_SER, SALES_PERS, ROUTE_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SRETURNDET_INVOICE_ID ON SRETURNDET (INVOICE_ID, LINE_NO__INV, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX GLTRACE_X ON GLTRACE (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 327680 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ISSLOTNOS ( as_workorder in char) return varchar2 is ls_retval varchar2(2000) := ' '; cursor c1 is select distinct a.lot_no from workorder_issdet a, workorder_iss b where a.tran_id = b.tran_id and b.tran_type <> 'R' and b.work_order = as_workorder ; begin for i in c1 loop ls_retval := ls_retval || ' ' || rtrim(i.lot_no) ; end loop; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_PYR_DAYQTY (adt_date in date,as_geoloc in site.geo_loc%type,as_unitto uom.unit%type ) return number is lc_pyrdayqty number(14,3) := 0; begin begin select sum(fn_qty_form(p.item_code,p.unit,as_unitto, p.quantity)) into lc_pyrdayqty from dwh_production_day_events p, item i, item_type t, site s where p.site_code = s.site_code and p.item_code = i.item_code and t.item_type = i.item_type and s.geo_loc = as_geoloc and p.tran_date = adt_date and p.ref_type like 'P%' and p.ref_ser = 'W-RCP' and t.unit__form = as_unitto; exception when others then lc_pyrdayqty := 0; end; return lc_pyrdayqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX RESTR_TMPL_DET_X ON RESTR_TMPL_DET (TEMPLATE_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LEADER (as_tranid expr_hdr.expr_no%type, as_flag project_team.role_code%type) return varchar2 is AS_LEADER varchar2(30); begin if as_flag = 'P' then SELECT MIN(CASE WHEN project_team.role_code = 'PROJL' THEN employee.emp_fname||' ' ||employee.emp_lname END) leader INTO AS_LEADER from expr_hdr,PROJECT,employee, project_team where expr_hdr.proj_code = project.proj_code(+) and project.proj_code = project_team.proj_code and employee.emp_code = project_team.emp_code and expr_hdr.expr_no = as_tranid ; ELSE SELECT MIN(CASE WHEN project_team.role_code = 'GRPL' THEN employee.emp_fname||' ' ||employee.emp_lname END) leader INTO AS_LEADER from expr_hdr,PROJECT,employee, project_team where expr_hdr.proj_code = project.proj_code(+) and project.proj_code = project_team.proj_code and employee.emp_code = project_team.emp_code and expr_hdr.expr_no = as_tranid ; END IF ; RETURN AS_LEADER; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_VALIDATE_EMP_MARITAL_DET (AS_TRAN_ID CHAR,AS_EDIT_FLAG CHAR,AS_XTRAPARAM CHAR,AS_OBJNAME CHAR,AS_REF_SER CHAR) RETURN VARCHAR2 IS A_RETURN MESSAGES.MSG_NO%TYPE; A_COUNT NUMBER; B_COUNT NUMBER; A_PEN_PERC EMP_MSTATUSCHG_FAMILY.PEN_PERC%TYPE; A_PF_PERC EMP_MSTATUSCHG_FAMILY.PF_PERC%TYPE; A_GRAT_PERC EMP_MSTATUSCHG_FAMILY.GRAT_PERC%TYPE; BEGIN SELECT SUM(NVL(PEN_PERC,0)),SUM(NVL(PF_PERC,0)),SUM(NVL(GRAT_PERC,0)),COUNT(*) INTO A_PEN_PERC,A_PF_PERC,A_GRAT_PERC,A_COUNT FROM EMP_MSTATUSCHG_FAMILY WHERE TRAN_ID = AS_TRAN_ID; IF A_COUNT > 0 THEN IF(A_PEN_PERC != 100) THEN A_RETURN := 'UVPNPERC'; RETURN A_RETURN; END IF; IF(A_PF_PERC != 100) THEN A_RETURN := 'UVPFPERC'; RETURN A_RETURN; END IF; IF(A_GRAT_PERC != 100) THEN A_RETURN := 'UVGRPERC'; RETURN A_RETURN; END IF; END IF; SELECT COUNT(*) INTO A_COUNT FROM EMP_MSTATUSCHG_FAMILY WHERE TRAN_ID = AS_TRAN_ID AND RELATION IN('HUSBAND','WIFE'); IF A_COUNT = 0 THEN A_RETURN := 'UVSPOMIS'; RETURN A_RETURN; END IF; SELECT COUNT(*) INTO A_COUNT FROM EMP_MSTATUSCHG_FAMILY WHERE TRAN_ID = AS_TRAN_ID AND LINE_NO__REF IS NOT NULL; SELECT COUNT(*) INTO B_COUNT FROM EMPFAMILY A,EMP_MARITALCHG B WHERE A.EMP_CODE = B.EMP_CODE AND B.TRANS_MODE = 'O' AND B.TRAN_ID = AS_TRAN_ID; IF(A_COUNT != B_COUNT) THEN A_RETURN := 'UVMISMATCH'; RETURN A_RETURN; END IF; SELECT COUNT(1) INTO A_COUNT FROM EMP_MSTATUSCHG_FAMILY WHERE TRAN_ID = AS_TRAN_ID AND ((NVL(PF_NOMINEE,'') = 'N' AND NVL(PF_PERC,'') != 0) OR (NVL(GRAT_NOMINEE,'') = 'N' AND NVL(GRAT_PERC,'') != 0) OR (NVL(PEN_NOMINEE,'') = 'N' AND NVL(PEN_PERC,'') != 0)); IF (A_COUNT != 0) THEN A_RETURN := 'UVNOMBLANK'; RETURN A_RETURN; END IF; SELECT COUNT(1) INTO A_COUNT FROM EMP_MSTATUSCHG_FAMILY WHERE TRAN_ID = AS_TRAN_ID AND ((NVL(PF_NOMINEE,'') = 'Y' AND NVL(PF_PERC,'') = 0) OR (NVL(GRAT_NOMINEE,'') = 'Y' AND NVL(GRAT_PERC,'') = 0) OR (NVL(PEN_NOMINEE,'') = 'Y' AND NVL(PEN_PERC,'') = 0)); IF (A_COUNT != 0) THEN A_RETURN := 'UVNOMERR'; RETURN A_RETURN; END IF; RETURN A_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCP_RET_REF ON PORCP (TRAN_SER, TRAN_ID__REF, RET_OPT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_NAME_ADDR (as_type varchar2, as_code varchar2) return varchar2 is as_party varchar(250); begin if as_type = 'S' then select supp_name||'. ('||nvl(addr1,' ')||', '||nvl(addr2,' ')||', '||nvl(addr3,' ')||', '||nvl(city,' ')||', '||nvl(count_code,' ')||')' into as_party from supplier where supp_code = as_code ; elsif as_type = 'C' then select cust_name|| '. ('||nvl(addr1,' ')||', '||nvl(addr2,' ')||','||nvl(addr3,' ')||', '||nvl(city,' ')||', '||nvl(count_code,' ')||')' into as_party from customer where cust_code = as_code; elsif as_type = 'O' then select descr||'. ('||nvl(add1,' ')||', '||nvl(add2,' ')||', '||nvl(add3,' ')||', '||nvl(city,' ')||')' into as_party from site where site_code = as_code; end if; return as_party; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FAMILY_ALLOWANCE (AS_EMP_CODE char,AS_PRD_CODE char) return number is cursor c1 is select b.m_status,a.physical_status,d.type,trunc(months_between(trunc(c.to_date),a.date_birth)/12) Age from empfamily a,employee b,period c,qualification d where a.emp_code = b.emp_code and a.qlf_code = d.qlf_Code and a.emp_code = AS_EMP_CODE and c.code = AS_PRD_CODE and trunc(months_between(trunc(c.to_date),a.date_birth)/12) <= 25 and a.relation in ('SON','DAUGHTER') order by a.emp_code,a.seq_no; a_no_child number(2) := 0; a_amount number(13,2) := 0; a_amount1 number(13,2) := 0; a_status char(3); a_date date; begin select to_date into a_date from period where code = AS_PRD_CODE; select count(1) into a_no_child from empfamily where emp_code = AS_EMP_CODE and relation in ('SON','DAUGHTER') and trunc(months_between(trunc(a_date),date_birth)/12) <= 25; for i in c1 loop a_amount1 := 0; a_status := case i.m_status when 'M' then '1' else '2' end || lpad(a_no_child,2,'0'); if (i.physical_status = '0') and (i.type = '10TH') and (i.age <= 16) then select nvl(amount,0) into a_amount1 from ad_slabs where ad_code = 'H1FA0' and a_status between min_base_amt and max_base_amt and a_date between eff_date and exp_date; end if; if (i.physical_status = '0') and (i.type in ('vocational high sch','vocational school')) and (i.age <= 23) then select nvl(amount,0) into a_amount1 from ad_slabs where ad_code = 'H1FA0' and a_status between min_base_amt and max_base_amt and a_date between eff_date and exp_date; end if; if (i.physical_status = '0') and (i.type in ('college','postgraduate','technical','university')) then null; end if; if (i.physical_status = '1') and (i.age <= 18) then select nvl(amount,0) into a_amount1 from ad_slabs where ad_code = 'H1FA1' and case i.m_status when 'M' then '1' else '2' end between min_base_amt and max_base_amt and a_date between eff_date and exp_date; end if; a_amount := a_amount + a_amount1; end loop; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TKT_NO_Z ON SERVICE_COMPLAINT (TICKET_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_COUNT_DESCR (AS_COUNT_CODE In CHAR) RETURN VARCHAR2 IS COUNT_DESCR VARCHAR2(200); BEGIN COUNT_DESCR := ''; BEGIN SELECT DESCR INTO COUNT_DESCR FROM COUNTRY WHERE COUNT_CODE = AS_COUNT_CODE; EXCEPTION WHEN NO_DATA_FOUND THEN COUNT_DESCR := ''; END; RETURN COUNT_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_WAITING_APPROVAL ( as_ls_ref_id varchar2) return varchar2 is ls_emp_aprv_name varchar2(200); begin select e.emp_fname ||' '|| e.emp_lname into ls_emp_aprv_name from obj_sign_trans os left outer join employee e on os.entity_code=e.emp_code where os.SIGN_STATUS ='U' AND OS.REF_ID = as_ls_ref_id; return ls_emp_aprv_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BI_BA_HIER_X ON BI_BA_HIER (BA_HIER_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_WAVE_PERFORMED_BY (VI_REF_SER IN CHAR ,VI_REF_Id IN VARCHAR) RETURN VARCHAR2 IS PERFORMED_BY VARCHAR2(500); userby varchar2(500); flag BOOLEAN := false; cursor C1 is SELECT nvl(pick_iss_hdr.chg_user,' ') as PERFORMED_BY1 from pick_iss_hdr where pick_iss_hdr.pick_order = VI_REF_Id; cursor C2 is SELECT nvl(repl_iss_hdr.chg_user,' ') as PERFORMED_BY1 from repl_iss_hdr where repl_iss_hdr.repl_order = VI_REF_Id; BEGIN IF(VI_REF_SER = 'P-PICK' OR VI_REF_SER = 'C-PICK' OR VI_REF_SER = 'A-PICK' OR VI_REF_SER = 'M-PICK') THEN FOR userchage in C1 LOOP IF(flag) Then userby :=userby || ',' || userchage.PERFORMED_BY1; ELSE userby := userchage.PERFORMED_BY1; flag:=true; End IF; END LOOP; PERFORMED_BY :=userby; RETURN PERFORMED_BY; ELSIF(VI_REF_SER = 'R-TASK' OR VI_REF_SER = 'RP-PND' OR VI_REF_SER = 'R-CPA' OR VI_REF_SER = 'R-PND' OR VI_REF_SER = 'S-DOC' OR VI_REF_SER = 'RP-ACT' OR VI_REF_SER = 'RR-DSA' OR VI_REF_SER = 'RD-DSA' OR VI_REF_SER = 'R-DSO' OR VI_REF_SER = 'RS-DSO' OR VI_REF_SER = 'RN-DSA') THEN FOR userchage in C2 LOOP IF(flag) Then userby :=userby || ',' || userchage.PERFORMED_BY1; ELSE userby := userchage.PERFORMED_BY1; flag:=true; End IF; END LOOP; PERFORMED_BY :=userby; RETURN PERFORMED_BY; ELSE PERFORMED_BY :=' '; RETURN PERFORMED_BY; End IF; EXCEPTION WHEN NO_DATA_FOUND THEN PERFORMED_BY :=' '; RETURN PERFORMED_BY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUNDRYSTATION_DESCR (lsundry_type in char,lsundry_code in char) return char is ls_stat_descr char(40); begin if lsundry_type = 'O' then ls_stat_descr := ' '; elsif lsundry_type = 'T' then select b.descr into ls_stat_descr from transporter a,station b where a.tran_code = lsundry_code and a.stan_code = b.stan_code ; elsif lsundry_type = 'B' then ls_stat_descr := ' '; -- select bank_name elsif lsundry_type = 'X' then select b.descr into ls_stat_descr from tax_authority a,station b where a.tauth_code = lsundry_code and a.stan_code = b.stan_code ; elsif lsundry_type = 'E' then select b.descr into ls_stat_descr from employee a,station b where a.emp_code = lsundry_code and a.stan_code = b.stan_code ; elsif lsundry_type = 'P' then select emp_code into ls_stat_descr from sales_pers where sales_pers = lsundry_code; if ls_stat_descr = null then select b.descr into ls_stat_descr from employee a,station b where a.emp_code = lsundry_code and a.stan_code = b.stan_code ; else select b.descr into ls_stat_descr from sales_pers a,station b where a.sales_pers = lsundry_code and a.stan_code = b.stan_code ; end if; elsif lsundry_type ='S' then select b.descr into ls_stat_descr from supplier a,station b where a.supp_code = lsundry_code and a.stan_code = b.stan_code ; elsif lsundry_type ='C' then select b.descr into ls_stat_descr from customer a,station b where a.cust_code = lsundry_code and a.stan_code = b.stan_code ; elsif lsundry_type = 'L' then select b.descr into ls_stat_descr from loanparty a,station b where a.party_code = lsundry_code and a.stan_code = b.stan_code ; end if; return ls_stat_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PAYUNADJADV_AMT_REP ( as_refser IN Char , as_refno IN Char , ad_asondate IN Date , ac_outstamt IN Number) Return Number IS ac_outst_amt Number(14,3); lc_outstamt number(14,3) ; lc_adjamt number(14,3) ; Begin lc_outstamt := ac_outstamt ; -- tot_amt - adj_amt Select Nvl(Sum(A.pay_amt),0) Into lc_adjamt From Misc_Paydet A, Misc_Payment B Where A.tran_id = B.tran_id And A.tran_ser = as_refser And A.vouch_no = as_refno And B.tran_date > ad_asondate And B.confirmed = 'Y' ; lc_outstamt := lc_outstamt + lc_adjamt ; Select Nvl(Sum(B.adj_amt),0) Into lc_adjamt From Misc_Voucher A , Misc_VouchAdv B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.adj_amt),0) Into lc_adjamt From Voucher A , VouchAdv B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.tot_amt),0) Into lc_adjamt From Pay_Ibca A , Pay_Ibca_Det B Where A.tran_id = B.tran_id And B.ref_ser = as_refser And B.ref_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt + lc_adjamt; Select Nvl(Sum(B.pay_amt),0) Into lc_adjamt From Misc_Payment_Canc A , Misc_Payment_Cancdet B , Misc_Payment C Where A.tran_id = B.tran_id And A.payment_no = C.tran_id And B.tran_ser = as_refser And B.vouch_no = as_refno And A.confirmed = 'Y' And A.tran_date > ad_asondate; lc_outstamt := lc_outstamt - lc_adjamt; Return lc_outstamt; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RNDPOTENCY ( as_expr_no IN CHAR , al_opr_no IN NUMBER ) return varchar2 is ls_adj_potency varchar2(1000); ls_descr varchar2(120) ; ll_potency_adj number ; cursor cur_args is SELECT nvl(bom_calc_mth.descr,'') , nvl(expr_bill.potency_adj,0) FROM bom_calc_mth, expr_bill WHERE ( expr_bill.mathod_code_bom = bom_calc_mth.method_code ) and ( ( EXPR_BILL.EXPR_NO = as_expr_no ) AND ( EXPR_BILL.OPERATION <= al_opr_no ) ) ORDER BY expr_bill.line_no ASC ; begin open cur_args; loop fetch cur_args into ls_descr,ll_potency_adj; exit when cur_args%NOTFOUND; if ll_potency_adj < 1 and ll_potency_adj > 0 then ls_adj_potency := ls_adj_potency || ls_descr || ' = 0' || to_char(ll_potency_adj) || chr(10) ; else ls_adj_potency := ls_adj_potency || ls_descr || ' = ' || to_char(ll_potency_adj) || chr(10) ; end if; end loop; close cur_args; return ls_adj_potency ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SORDET_ITEMS (ls_sales_order in char) return char is ls_descr varchar2(10000); cursor c1 is select distinct descr from sorddet, item where sorddet.item_code = item.item_code and sorddet.sale_order = ls_sales_order; begin ls_descr := ' '; for cdescr in c1 loop begin exit when c1%notfound; ls_descr := ls_descr || ', ' || cdescr.descr; end; end loop; ls_descr := ltrim(substr(ls_descr,3)); return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BATCHES_HOLD (L_SITE_CODE IN SITE.SITE_CODE%TYPE,L_SUPP_CODE IN SUPPLIER.SUPP_CODE%TYPE,L_ITEM_CODE IN ITEM.ITEM_CODE%TYPE) RETURN NUMBER IS HOLD_BATCH_CNT NUMBER; /*function created by Anand Desai on 28/12/2012 for List of Consignments Report in Vendor Qualification Management inorder to get the No. of Batches on Hold*/ BEGIN select SUM(LOC_GRP) INTO HOLD_BATCH_CNT FROM ( select count(a.loc_group) LOC_GRP from porcp b,porcpdet c,location a where b.tran_id = c.tran_id and c.loc_code = a.loc_code and a.loc_group ='HOLD' and c.site_code__mfg = L_SITE_CODE and c.supp_code__mnfr = L_SUPP_CODE and c.item_code = L_ITEM_CODE UNION ALL select count(a.loc_group) LOC_GRP from distord_rcp d, distord_rcpdet e,location a where d.tran_id = e.tran_id and e.loc_code = a.loc_code and a.loc_group ='HOLD' and e.site_code__mfg = L_SITE_CODE and e.supp_code__mfg = L_SUPP_CODE and e.item_code = L_ITEM_CODE ); RETURN(HOLD_BATCH_CNT); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_ADV_PENDING (ls_sundry_code in char,ls_sundry_type in char) RETURN char is ls_adv_exist char(1); cnt number(3); fin_cnt number(3); BEGIN ls_adv_exist:='0'; cnt:=0; fin_cnt:=0; if length(trim(ls_sundry_code)) <> 0 then select count(*) into fin_cnt from finparm where prd_code='999999' and var_name='ADV_PENDING_ACCT_CD'; if (fin_cnt > 0) then select count(*) into cnt from misc_payables where sundry_type=ls_sundry_type and sundry_code=ls_sundry_code and tot_amt <> adj_amt and acct_code in(select var_value from finparm where prd_code='999999' and var_name='ADV_PENDING_ACCT_CD'); if (cnt > 1) then ls_adv_exist:='1'; else ls_adv_exist:='0'; end if; else ls_adv_exist:='1'; end if; end if; RETURN ls_adv_exist; exception when NO_DATA_FOUND then null; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRODUCT_DIM_X ON PRODUCT_DIM (PRODUCT_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ORDERMASTERTABLE AS TABLE OF orderMaster -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_CUST_NAME ( p_cust_code IN VARCHAR2 ) RETURN VARCHAR2 IS v_result VARCHAR2(4000); v_customer_name VARCHAR2(100); BEGIN IF p_cust_code IS NULL THEN v_result := '{data:{}}'; RETURN v_result; END IF; BEGIN SELECT cust_name INTO v_customer_name FROM customer WHERE cust_code = p_cust_code; EXCEPTION WHEN NO_DATA_FOUND THEN v_customer_name := NULL; WHEN OTHERS THEN v_customer_name := NULL; END; v_result := '{data:{' || 'cust_name:' || COALESCE(v_customer_name, '') || '}}'; RETURN v_result; EXCEPTION WHEN OTHERS THEN v_result := '{data:{}}'; RETURN v_result; END GET_CUST_NAME; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ARREARDET_REF_TYPE_NO ON ARREARDET (REF_TYPE, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEMSER_PREFIX ( ITEM_SER ITEMSER.ITEM_SER%TYPE ) RETURN CHAR IS LS_PREFIX ITEMSER.ITEM_SER%TYPE; LI_CNT NUMBER(5); BEGIN LS_PREFIX := TRIM(ITEM_SER); LI_CNT := 0; SELECT COUNT(1) INTO LI_CNT FROM GENCODES WHERE FLD_NAME = 'ITEM_SER' AND MOD_NAME = 'W_PAYR_VOUCHER_INC' AND FLD_VALUE = ITEM_SER; IF LI_CNT > 0 THEN SELECT TRIM(UDF_STR1) INTO LS_PREFIX FROM GENCODES WHERE FLD_NAME = 'ITEM_SER' AND MOD_NAME = 'W_PAYR_VOUCHER_INC' AND FLD_VALUE = ITEM_SER; END IF; IF LS_PREFIX IS NULL OR LENGTH(TRIM(LS_PREFIX)) = 0 OR TRIM(LS_PREFIX) IS NULL THEN LS_PREFIX := TRIM(ITEM_SER); END IF; RETURN LS_PREFIX; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUST_SALESPERS (as_cust_code char,as_itemser char) return char is ls_sales_pers char(40); begin ls_sales_pers := null; select sales_pers into ls_sales_pers from customer_series where cust_code = as_cust_code and item_ser = as_itemser; return (nvl(ls_sales_pers,'')); exception when no_data_found then select sales_pers into ls_sales_pers from customer where cust_code = as_cust_code; return (nvl(ls_sales_pers,'')); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SALES_PERS_TERRITORY (as_sales_pers in varchar,as_item_ser in varchar) return char is ls_level_code varchar2(5); ls_table_no__hier varchar2(5); begin select table_no__hier into ls_table_no__hier from itemser where item_ser = as_item_ser; select level_code into ls_level_code from hierarchy_det where table_no = ls_table_no__hier and sales_pers = as_sales_pers and eff_from <= sysdate and valid_upto >= sysdate and sales_percent >0; ls_level_code := nvl(ls_level_code,' '); return ls_level_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETVALIDREC (AS_EMP_CODE varchar2,AS_EMP_TYPE varchar2,AS_TICKET_NO varchar2,AS_ITEM_SER varchar2,AS_REQ_TYPE varchar2,AS_SITE_CODE varchar2,AS_DEPT_CODE varchar2) return number is a_fbempcode employee.emp_code%type; a_escempcode1 employee.emp_code%type; a_escempcode2 employee.emp_code%type; a_retval number(1) := 0; a_count number(1); begin if (AS_EMP_TYPE = 'P') then select count(*) into a_count from ser_complaint where ticket_no = AS_TICKET_NO and (emp_code = AS_EMP_CODE or (nvl(instr(cc_to_emp,AS_EMP_CODE),0) >= 1) or (nvl(instr(bcc_to_emp,AS_EMP_CODE),0) >= 1) or (SELECT REPORT_TO FROM EMPLOYEE WHERE EMP_CODE=(select emp_code_fb from ser_complaint where ticket_no = AS_TICKET_NO))=AS_EMP_CODE ); if (a_count = 1) then a_retval := 1; end if; select count(*) into a_count from ser_complaint_fb a,employee b where a.ticket_no = AS_TICKET_NO and ( b.emp_code = AS_EMP_CODE or (SELECT REPORT_TO FROM EMPLOYEE WHERE EMP_CODE=(select emp_code_fb from ser_complaint_fb where ticket_no = AS_TICKET_NO))=AS_EMP_CODE) and nvl(instr(a.cc_to,b.email_id_off),0) >= 1; if (a_count = 1) then a_retval := 1; end if; elsif (AS_EMP_TYPE = 'E') then select count(*) into a_count from ser_complaint where ticket_no = AS_TICKET_NO and ( emp_code = AS_EMP_CODE or emp_code_fb = AS_EMP_CODE or emp_code_fb_1 = AS_EMP_CODE or emp_code_fb_2 = AS_EMP_CODE or (nvl(instr(cc_to_emp,AS_EMP_CODE),0) >= 1) or (nvl(instr(bcc_to_emp,AS_EMP_CODE),0) >= 1) or (SELECT REPORT_TO FROM EMPLOYEE WHERE EMP_CODE=(select emp_code_fb from ser_complaint where ticket_no = AS_TICKET_NO))=AS_EMP_CODE ); if (a_count = 1) then a_retval := 1; end if; select count(*) into a_count from ser_complaint_fb a,employee b where a.ticket_no = AS_TICKET_NO and ( b.emp_code = AS_EMP_CODE or (SELECT REPORT_TO FROM EMPLOYEE WHERE EMP_CODE=(select emp_code_fb from ser_complaint_fb where ticket_no = AS_TICKET_NO))=AS_EMP_CODE) and nvl(instr(a.cc_to,b.email_id_off),0) >= 1; if (a_count = 1) then a_retval := 1; end if; if (GET_SUBMISSION_DATA(AS_EMP_CODE ,AS_SITE_CODE ,AS_ITEM_SER ,AS_REQ_TYPE,AS_DEPT_CODE) = 1) then a_retval := 1; end if; end if; return a_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_YTD_SALES_GROWTH (as_sales_pers CHAR,as_stan_code CHAR,AS_OPT varchar) RETURN NUMBER IS CURRENT_VAL NUMBER (14,3); CURRENT_VAL_CNT NUMBER (14,3); PREV_VAL NUMBER (14,3); PREV_VAL_CNT NUMBER (14,3); FINAL_VAL NUMBER (14,3); AS_FR_DATE DATE; AS_TO_DATE DATE; AS_FR_DATE_PRV DATE; AS_TO_DATE_PRV DATE; BEGIN FINAL_VAL := 0; SELECT FR_DATE, TO_DATE(SYSDATE) INTO AS_FR_DATE, AS_TO_DATE FROM ACCTPRD WHERE TO_DATE(SYSDATE) BETWEEN FR_DATE AND TO_DATE; SELECT FR_DATE, TO_DATE(ADD_MONTHS(TO_DATE(SYSDATE), -12)) INTO AS_FR_DATE_PRV, AS_TO_DATE_PRV FROM ACCTPRD WHERE TO_DATE(ADD_MONTHS(TO_DATE(SYSDATE), -12)) BETWEEN FR_DATE AND TO_DATE; --Sales Growth will be calculated for this month w.r.t. Last Years this if (AS_OPT='Y') then SELECT SUM(SALES_VAL), COUNT(SALES_VAL) INTO CURRENT_VAL, CURRENT_VAL_CNT FROM DWH_INV_SRET_SUM WHERE EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code) AND TO_DATE(TRAN_DATE) BETWEEN AS_FR_DATE AND AS_TO_DATE ; SELECT SUM(SALES_VAL), COUNT(SALES_VAL) INTO PREV_VAL, PREV_VAL_CNT FROM DWH_INV_SRET_SUM WHERE EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO and E.STAN_CODE__HQ=as_stan_code) AND TO_DATE(TRAN_DATE) BETWEEN AS_FR_DATE_PRV AND AS_TO_DATE_PRV ; else SELECT SUM(SALES_VAL), COUNT(SALES_VAL) INTO CURRENT_VAL, CURRENT_VAL_CNT FROM DWH_INV_SRET_SUM WHERE EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ) AND TO_DATE(TRAN_DATE) BETWEEN AS_FR_DATE AND AS_TO_DATE ; SELECT SUM(SALES_VAL), COUNT(SALES_VAL) INTO PREV_VAL, PREV_VAL_CNT FROM DWH_INV_SRET_SUM WHERE EMP_CODE IN(select E.EMP_CODE from EMPLOYEE E where E.RELIEVE_DATE is null start with E.EMP_CODE = as_sales_pers connect by prior E.EMP_CODE = E.REPORT_TO ) AND TO_DATE(TRAN_DATE) BETWEEN AS_FR_DATE_PRV AND AS_TO_DATE_PRV ; end if; IF CURRENT_VAL_CNT = 0 THEN CURRENT_VAL := 0; END IF; IF PREV_VAL_CNT = 0 THEN PREV_VAL := 0; END IF; IF CURRENT_VAL > 0 AND PREV_VAL > 0 THEN FINAL_VAL := ( ( CURRENT_VAL - PREV_VAL ) / CURRENT_VAL ) * 100; END IF; RETURN FINAL_VAL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_STOCK_TRAN_DATE_SITE ON CUST_STOCK (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LEAVE_HISTORY ( Vi_Status In Char, Vi_Auth_Sign In Char, Vi_Wrkflw_Status In Char, Vi_Tran_Id_1 In VARCHAR2, vi_for_history in char, vi_for_emp in char) Return Varchar2 Is History_Descr Varchar2(1000); Vi_Use_Flag Char(1); vi_leave_type VARCHAR2(10); Vi_Tran_Id VARCHAR2(50); Vi_EMP_CODE VARCHAR2(10); sign_date VARCHAR2(10); emp_fname VARCHAR2(15); emp_mname VARCHAR2(15); emp_lname VARCHAR2(15); historyFormat VARCHAR2(1000); hist_descr1 VARCHAR2(1000); empCode VARCHAR2(10); roleEmp VARCHAR2(10); roleEmpName VARCHAR2(50); fullName VARCHAR2(50); signStatus CHAR(1); ls_entry_by CHAR(1); reportTo VARCHAR2(10); reportToAdmin VARCHAR2(10); reportToFullName VARCHAR2(200); reportToAdminFullName VARCHAR2(200); hrEmpCode varchar2(10); roleCode varchar2(10); sign_counter number; unsign_counter number; rej_counter number; li_cnt number; lc_no_days number(14,3); refser CHAR(6); signremarks varchar2(200); BEGIN Begin Vi_Tran_Id:=trim(Vi_Tran_Id_1); Vi_Use_Flag := 'C'; vi_leave_type := ' '; Vi_EMP_CODE := ''; sign_date := ''; emp_fname := ''; emp_mname := ''; emp_lname := ''; historyFormat := ''; empCode := ''; fullName := ''; roleEmp := ''; roleEmpName := ''; signStatus := ''; reportTo := ''; reportToAdmin := ''; reportToFullName := ''; reportToAdminFullName := ''; hrEmpCode := ''; sign_counter := 0; unsign_counter := 0; rej_counter := 0; li_cnt := 0; refser := ''; hist_descr1 := ''; ls_entry_by := ''; signremarks := ''; lc_no_days := 0; History_Descr := ''; Select Use_Flag,Lve_CODE, emp_code, emp_code__aprv, AUTH_EMP, AUTH_EMP_ALTERNATE, entry_by , no_days Into Vi_Use_Flag,Vi_Leave_Type, Vi_EMP_CODE, hrEmpCode, reportTo, reportToAdmin, ls_entry_by , lc_no_days From Empleave Where Trim(Tran_Id) = Trim(Vi_Tran_Id); select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code = reportTo; reportToFullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code = reportToAdmin; reportToAdminFullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; if (Vi_Status = 'C' And Vi_Wrkflw_Status = 'X' ) then if (Vi_For_History = 'R') then return 'Cancelled by Employee'; else return ''; end if; -- elsif (Vi_Status = 'C') then -- Remarked and modified bellow by Piyush on 29/10/2014 for taking care when action taken from Metis ERP elsif (Vi_Status = 'C' and Vi_Wrkflw_Status <> 'Z') then li_cnt := 0; select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id and sign_status = 'R'; if li_cnt = 0 then if (Vi_For_History = 'R') then return 'Rejected'; else return ''; end if; end if; -- elsif (Vi_Status = 'A') then -- Remarked and modified bellow by Piyush on 29/10/2014 for taking care when action taken from Metis ERP elsif (Vi_Status = 'A' and Vi_Wrkflw_Status <> 'Z') then li_cnt := 0; select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id and sign_status = 'S'; if li_cnt = 0 then if (Vi_For_History = 'R') then return 'Approved'; else return ''; end if; end if; end if ; if (Vi_For_History = 'R') then if (Vi_Auth_Sign = 'R') then roleCode := 'RECOMEN'; roleEmp := reportTo; roleEmpName := reportToFullName; end if; elsif (Vi_For_History = 'A') then if (Vi_Auth_Sign = 'R' or Vi_Auth_Sign = 'A') then roleCode := 'APPROV'; roleEmp := reportToAdmin; roleEmpName := reportToAdminFullName; end if; end if; if (Vi_For_History = 'R' or Vi_For_History = 'A') then select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = roleCode; -- 20/11/2014.Start if (li_cnt > 0 and Vi_Wrkflw_Status = 'Z') then Select trim(Sign_Remarks), emp_code, sign_date, sign_status Into signremarks, empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = roleCode; if (empCode is null or length(trim(empCode)) = 0) then li_cnt := 0; -- Modified by Piyush on 17/04/2015.Start --signremarks := ''; return 'Awaiting approval from ' || roleEmpName ; -- Modified by Piyush on 17/04/2015.End end if; end if; -- 20/11/2014.End if (li_cnt > 0) then Select trim(Sign_Remarks), emp_code, sign_date, sign_status Into signremarks, empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = roleCode; if (empCode is null or length(trim(empCode)) = 0) then empCode := roleEmp; fullName := roleEmpName; else select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code=empCode ; fullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; end if; if(signStatus = 'R') then historyFormat := 'Rejected by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || signremarks; History_Descr := historyFormat ; elsif (signStatus = 'S') then historyFormat := 'Approved by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || signremarks; History_Descr := historyFormat ; elsif (signStatus = 'U') then if (vi_status not in ('A' , 'C')) then historyFormat := 'Awaiting approval from ' || fullName ; History_Descr := historyFormat ; end if; end if; else -- if (vi_status not in ('A' , 'C')) then -- 20/11/2014 if ((vi_status not in ('A' , 'C')) OR Vi_Wrkflw_Status = 'Z') then -- 20/11/2014 empCode := roleEmp; fullName := roleEmpName; if (Vi_For_History = 'R') then if (Vi_Auth_Sign = 'R') then History_Descr := 'Awaiting approval from ' || fullName ; end if; elsif (Vi_Auth_Sign = 'A') then History_Descr := 'Awaiting approval from ' || fullName ; elsif (Vi_Auth_Sign = 'R') then li_cnt := 0; select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'RECOMEN'; if (li_cnt > 0) then Select Sign_Remarks, emp_code, sign_date, sign_status, ref_ser Into signremarks, empCode, sign_date, signStatus, refser From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'RECOMEN'; if (((signStatus = 'R' and refser = 'E-LVF') or (signStatus = 'S')) and reportTo <> reportToAdmin and empCode is not null and length(trim(empCode)) > 0) then History_Descr := 'Awaiting approval from ' || fullName ; end if; end if; end if; end if; end if; return History_Descr; end if; if (Vi_For_History = 'H') Then -- Modified by Piyush on 17/04/2015.Start --Select sum(case when sign_status = 'S' then 1 else 0 end) as sign_counter, --sum(case when sign_status = 'R' then 1 else 0 end) as rej_counter, --sum(case when sign_status = 'U' then 1 else 0 end) as unsign_counter Select sum(case when sign_status = 'S' and emp_code is not null then 1 else 0 end) as sign_counter, sum(case when sign_status = 'R' then 1 else 0 end) as rej_counter, sum(case when sign_status = 'U' or emp_code is null then 1 else 0 end) as unsign_counter -- Modified by Piyush on 17/04/2015.End into sign_counter, rej_counter, unsign_counter From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id --AND Role_Code__Sign IN ('HRP','HRPF', 'HRP2') AND USER_ID__SIGN IS NOT NULL ; -- Modified on 15/05/2015 AND Role_Code__Sign IN ('HRP','HRPF', 'HRP2') ; if sign_counter is null then sign_counter := 0; end if; if rej_counter is null then rej_counter := 0; end if; if unsign_counter is null then unsign_counter := 0; end if; if (sign_counter > 0 ) then --if (vi_status <> 'C') then Select trim(Sign_Remarks), emp_code, sign_date, sign_status Into signremarks, empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id AND Role_Code__Sign IN ('HRP','HRPF', 'HRP2') AND USER_ID__SIGN IS NOT NULL and sign_status = 'S' and rownum < 2; select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code = empCode ; fullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; historyFormat := 'Approved by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || signremarks; History_Descr := historyFormat ; --end if; elsif (rej_counter > 0 ) then --if (vi_status <> 'A') then Select trim(Sign_Remarks), emp_code, sign_date, sign_status Into signremarks, empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id AND Role_Code__Sign IN ('HRP','HRPF', 'HRP2') AND USER_ID__SIGN IS NOT NULL and sign_status = 'R' and rownum < 2; select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code=empCode ; fullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; historyFormat := 'Rejected by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || signremarks; History_Descr := historyFormat ; --end if; elsif (unsign_counter > 0 ) then -- if (vi_status not in ('A','C')) then -- 06/01/2015 - PIYUSH if (vi_status not in ('A','C') OR Vi_Wrkflw_Status = 'Z') then -- 06/01/2015 - PIYUSH -- Modified by Piyush on 17/04/2015.Start --Select Sign_Remarks, emp_code, sign_date, sign_status Into signremarks, Select Sign_Remarks, entity_code, sign_date, sign_status Into signremarks, -- Modified by Piyush on 17/04/2015.End empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id --AND Role_Code__Sign IN ('HRP','HRPF', 'HRP2') AND USER_ID__SIGN IS NOT NULL -- Modified on 15/05/2015 AND Role_Code__Sign IN ('HRP','HRPF', 'HRP2') and sign_status = 'U' and rownum < 2; select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code=empCode ; fullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; historyFormat := 'Awaiting approval from HR'; History_Descr := historyFormat ; end if; -- elsif (vi_status not in ('A','C')) then -- 06/01/2015 - PIYUSH elsif (vi_status not in ('A','C') OR Vi_Wrkflw_Status = 'Z') then -- 06/01/2015 - PIYUSH if (Vi_Auth_Sign = 'H') then History_Descr := 'Awaiting approval from HR'; else -- Modified by Piyush on 17/04/2015.Start --if (Vi_Leave_Type = 'ML') -- or (ls_entry_by = 'F' and Vi_Leave_Type = 'SL' and lc_no_days >= 3) -- or (ls_entry_by = 'N' and Vi_Leave_Type = 'COFF') then -- if (Vi_Auth_Sign = 'A' or reportTo <> reportToAdmin) then -- rolecode := 'APPROV'; -- else -- rolecode := 'RECOMEN'; -- end if; li_cnt := 0; select count(*) into li_cnt from ( select substr(par_value,(instr(par_value,',',1,level) + 1),(instr(par_value,',',1,level + 1) - instr(par_value,',',1,level) - 1)) details from ( select ',' || hrapr || ',' par_value from ( select ddf_hr_site_env_value(Vi_EMP_CODE,trunc(sysdate),'LEAVE_HR_APR') hrapr from dual ) where hrapr != '[NOTAPPLICABLE]' ) connect by level <= length(par_value) - length(replace(par_value,',','')) - 1 ) where regexp_substr(details,'[^:]+',1,1) = Vi_Leave_Type and lc_no_days >= regexp_substr(details,'[^:]+',1,2) and regexp_substr(details,'[^:]+',1,3) = Vi_Use_Flag; if li_cnt > 0 then if (Vi_Auth_Sign = 'A' or reportTo <> reportToAdmin) then rolecode := 'APPROV'; else rolecode := 'RECOMEN'; end if; select count(1) into li_cnt from obj_sign_trans where Ref_Ser in ( 'E-LVF', 'E-LVN') And Ref_Id = Vi_Tran_Id AND Role_Code__Sign = rolecode and sign_status = 'S'; if li_cnt > 0 then History_Descr := 'Awaiting approval from HR'; end if; end if; -- Modified by Piyush on 17/04/2015.End end if; end if; -- Modified by Piyush on 29/10/2014 for taking care when action taken from Metis ERP.Start if (vi_status = 'A' and Vi_Wrkflw_Status = 'Z') then -- History_Descr := 'Approved in ERP - ' || History_Descr; -- 20/11/2014 -- History_Descr := 'Approved in ERP' || case when History_Descr is null or length(trim(History_Descr)) = 0 then '' else ' - ' || History_Descr end ; -- 20/11/2014 History_Descr := case when History_Descr is null or length(trim(History_Descr)) = 0 then '' else History_Descr || '.' end || 'Approved in ERP'; -- 06/01/2015 elsif (vi_status = 'C' and Vi_Wrkflw_Status = 'Z') then -- History_Descr := 'Cancelled in ERP - ' || History_Descr; -- 20/11/2014 -- History_Descr := 'Cancelled in ERP' || case when History_Descr is null or length(trim(History_Descr)) = 0 then '' else ' - ' || History_Descr end ; -- 20/11/2014 History_Descr := case when History_Descr is null or length(trim(History_Descr)) = 0 then '' else History_Descr || '.' end || 'Cancelled in ERP'; -- 06/01/2015 end if; -- Modified by Piyush on 29/10/2014 for taking care when action taken from Metis ERP.End end if; EXCEPTION When No_Data_Found Then HISTORY_DESCR :=' '; END; Return History_Descr; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GIM_EXCISE_LINENO (as_gimno porcp.tran_id%type, as_lineno porcpdet.line_no%type) return number is ldec_excise number(14,3) ; begin select sum(tax_amt) into ldec_excise from taxtran where (tran_code = 'P-RCP' or tran_code = 'P-RET') and tax_code in('EXC','XCI','XCF','EXCF','CVD','CVDFX','ECESS','ECES1') and tran_id=as_gimno and line_no=as_lineno; return(ldec_excise); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PERIOD_DIM_X ON PERIOD_DIM (PERIOD_KEY, SITE_KEY, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER SPRSCOACHING_PKVAL before INSERT ON sprs_coaching FOR EACH row DECLARE max_line_no NUMBER(10); BEGIN IF (:new.dcr_id IS NULL OR LENGTH(trim(:new.dcr_id)) = 0 ) THEN BEGIN SELECT dcr_id INTO :new.dcr_id FROM strg_meet WHERE tran_id = :new.tran_id AND rownum =1; max_line_no := 0; SELECT MAX(line_no) INTO max_line_no FROM sprs_coaching WHERE dcr_id = :new.dcr_id; :new.line_no := NVL(max_line_no , 0) + 1; END; END IF; max_line_no := 0; SELECT MAX(line_no) INTO max_line_no FROM sprs_coaching WHERE dcr_id = :new.dcr_id; :new.line_no := NVL(max_line_no , 0) + 1; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_PROCESSCODE (as_route procroute.route_code%type, as_opr procroute.operation%type) return char is ls_pc procroute.proc_code%type ; begin select proc_code into ls_pc from procroute where route_code = as_route and operation = as_opr and rownum = 1; return ls_pc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ARREARS_PRD_ACC_EMP ON ARREARS (PRD_CODE__ACC, EMP_CODE, SITE_CODE__PAY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_WO_CALCULATE_REF_QTY (as_workorder workorder.work_order%type, as_wo_en_tranid workorder_enhanc.tran_id%type) return number is ll_refqty number(14,3); ll_qty1 number(14,3); ll_qty2 number(14,3); begin select nvl(quantity,0) into ll_qty1 from workorder where work_order = as_workorder; select nvl(sum(nvl(recalbom_batch_size,0)),0) into ll_qty2 from workorder_enhanc where work_order = as_workorder; ll_refqty := ll_qty1 + ll_qty2; return ll_refqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ROPBAL_BANK_TRS ( as_sitecode in site.site_code%type, as_sundrytype in sundrybal.sundry_type%type, as_sundrycode in sundrybal.sundry_code%type, ad_bal_upto_date in date ) return number as ls_yr period.acct_prd%type; ls_prdcode period.code%type; ld_frst_date period.fr_date%type; ld_dramt sundrybal.dr_amt__base%type; ld_cramt sundrybal.cr_amt__base%type; ld_opbal sundrybal.dr_amt__base%type; begin Select acct_prd, code , fr_date into ls_yr , ls_prdcode, ld_frst_date from period where fr_date <= ad_bal_upto_date and to_date >= ad_bal_upto_date ; select (case when sum(dr_amt__base) is null then 0 else sum(dr_amt__base) end), (case when sum(cr_amt__base) is null then 0 else sum(cr_amt__base) end) into ld_dramt, ld_cramt from sundrybal where acct_prd = ls_yr and prd_code < ls_prdcode and site_code = as_sitecode and sundry_type = as_sundrytype and sundry_code = as_sundrycode ; ld_opbal := fn_rday_op_bal(ld_frst_date,ad_bal_upto_date,as_sundrycode,as_sitecode) ; return ld_opbal + ld_dramt - ld_cramt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_GET_EMP_NAME ( as_user_code in char) return varchar2 is ls_emp_fname varchar2(40); login_emp_code varchar2(40); begin select users.emp_code into login_emp_code from users where code= as_user_code ; select trim(emp_fname)||' '||trim(emp_lname) into ls_emp_fname from employee where emp_code = login_emp_code; return ls_emp_fname; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ASSET_SHIFTDET_X ON ASSET_SHIFTDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_AGING_DAYS ( as_due_date Date) RETURN NUMBER as ld_tot_days NUMBER:=0; BEGIN select (sysdate - as_due_date) into ld_tot_days from dual; RETURN ld_tot_days; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PPV_AMT (as_voucher_id in char , as_vouch_line in char ) return number is lc_taxdiff number(14,3) ; begin select sum(nvl(a.tax_amt,0)) - sum(nvl(a.reco_amount,0)) into lc_taxdiff from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code= 'VOUCH' and a.tran_id = as_voucher_id and a.line_no = as_vouch_line and b.effect <> 'N' and a.acct_code is null ; if lc_taxdiff is null then lc_taxdiff := 0 ; end if ; return lc_taxdiff ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETCOUNT_DR (as_campgn_id in VARCHAR2,as_sales_pers in CHAR ,as_brand_code in VARCHAR2,as_tran_type in char) return number is LS_COUNT number; BEGIN select COUNT ( DISTINCT (STRG_CODE) ) INTO LS_COUNT from sprs_campgn inner join sprs_campgn_strg on sprs_campgn.tran_id = sprs_campgn_strg.tran_id AND sprs_campgn.campgn_id = as_campgn_id and sprs_campgn_strg.brand_code IN ( select regexp_substr(as_brand_code,'[^,]+', 1, level) from dual connect by regexp_substr(as_brand_code, '[^,]+', 1, level) >0 ) and sprs_campgn.tran_type = as_tran_type AND sprs_campgn.SALES_PERS = as_sales_pers; RETURN LS_COUNT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ITEMCODEPOPHELP AS FUNCTION getItemMasterData (empCode in char) RETURN ItemCodeMasterTABLE PIPELINED; END ItemCodePophelp; CREATE OR REPLACE PACKAGE BODY ITEMCODEPOPHELP AS FUNCTION getItemMasterData (empCode in char) RETURN ItemCodeMasterTABLE PIPELINED IS ls_cnt number(35); BEGIN SELECT COUNT(*) INTO ls_cnt FROM ITEM ITEM,SPRS_ITEM SI WHERE ITEM.ITEM_CODE=SI.ITEM_CODE AND ITEM.ACTIVE='Y' AND SI.STATUS='Y' AND ITEM.ITEM_SER= (select item_ser from sales_pers where sales_pers=empCode) ORDER BY ITEM.SH_DESCR; if(ls_cnt > 0) then for x in(SELECT ITEM.ITEM_CODE AS ITEM_CODE,ITEM.DESCR AS DESCR FROM ITEM ITEM,SPRS_ITEM SI WHERE ITEM.ITEM_CODE=SI.ITEM_CODE AND ITEM.ACTIVE='Y' AND SI.STATUS='Y' AND ITEM.ITEM_SER= (SELECT ITEM_SER FROM SALES_PERS WHERE SALES_PERS=empCode) ORDER BY ITEM.SH_DESCR) LOOP PIPE ROW (ItemCodeMaster(x.ITEM_CODE,x.DESCR)); END LOOP; RETURN; end if; if(ls_cnt <= 0) then for x in(SELECT ITEM.ITEM_CODE AS ITEM_CODE ,ITEM.DESCR AS DESCR FROM ITEM ITEM WHERE ITEM.ACTIVE='Y' AND ITEM.ITEM_SER= (SELECT ITEM_SER FROM SALES_PERS WHERE SALES_PERS=empCode) ORDER BY ITEM.SH_DESCR) LOOP PIPE ROW (ItemCodeMaster(x.ITEM_CODE,x.DESCR)); END LOOP; RETURN; end if; END; END ItemCodePophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_STK_XFR_LOC BEFORE INSERT OR UPDATE ON stock_transfer_det FOR EACH ROW DECLARE lc_count number := 0; BEGIN begin select count(1) into lc_count from location where loc_code = :new.LOC_CODE__FR; exception when others then lc_count := 0; end; if lc_count = 0 then raise_application_error( -20601, 'Error Invalid from location [' || trim(:new.LOC_CODE__FR) ||']' ); end if; begin select count(1) into lc_count from location where loc_code = :new.LOC_CODE__TO; exception when others then lc_count := 0; end; if lc_count = 0 then raise_application_error( -20601, 'Error Invalid to location [' || trim(:new.LOC_CODE__TO) ||']' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PLANOFACTION_REF_ID ON PLANOFACTION (REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TRADING_REGNO (as_var_name varchar2,as_item_code varchar2 ) return varchar2 is as_reg_no varchar2(200); as_site_code varchar2(50); begin select site_code into as_site_code from item where item_code = as_item_code ; select reg_no into as_reg_no from siteregno WHERE site_code = as_site_code and ref_code = as_var_name; return trim(as_reg_no) ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_INVOICE_TRANSPORTER (as_type in char,as_invoice_id in char) return varchar is ls_return varchar2(200); ld_date date; ln_rows number (3,0); lt_rows number (3,0); begin select count(*) into ln_rows from invoice_amendment where invoice_id = as_invoice_id ; select count(*) into lt_rows from invoice_amendment, transporter where invoice_amendment.tran_code = transporter.tran_code and invoice_amendment.invoice_id = as_invoice_id ; if as_type = 'TRAN_CODE' then if ln_rows >= 1 then select tran_code into ls_return from invoice_amendment where invoice_id = as_invoice_id ; else select tran_code into ls_return from invoice where invoice_id = as_invoice_id ; end if; end if; if as_type = 'TRAN_NAME' then if lt_rows >= 1 then select transporter.tran_name into ls_return from invoice_amendment, transporter where invoice_amendment.tran_code = transporter.tran_code and invoice_amendment.invoice_id = as_invoice_id ; else select transporter.tran_name into ls_return from invoice,transporter where invoice.tran_code = transporter.tran_code and invoice.invoice_id = as_invoice_id ; end if; end if; if as_type = 'SH_NAME' then if lt_rows >= 1 then select transporter.sh_name into ls_return from invoice_amendment, transporter where invoice_amendment.tran_code = transporter.tran_code and invoice_amendment.invoice_id = as_invoice_id ; else select transporter.sh_name into ls_return from invoice,transporter where invoice.tran_code = transporter.tran_code and invoice.invoice_id = as_invoice_id ; end if; end if; if as_type = 'NO_ART' then if ln_rows >= 1 then select no_art into ls_return from invoice_amendment where invoice_id = as_invoice_id ; else select no_art into ls_return from invoice where invoice_id = as_invoice_id ; end if; end if; if as_type = 'LR_NO' then if ln_rows >= 1 then select lr_no into ls_return from invoice_amendment where invoice_id = as_invoice_id ; else select lr_no into ls_return from invoice where invoice_id = as_invoice_id ; end if; end if; if as_type = 'LR_DATE' then if ln_rows >= 1 then select to_char(lr_date) into ls_return from invoice_amendment where invoice_id = as_invoice_id ; else select to_char(lr_date) into ls_return from invoice where invoice_id = as_invoice_id ; end if; end if; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MISC_PAYABLES_ADJ_X ON MISC_PAYABLES_ADJ (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE VISITEDWITHDARPOPHELP AS FUNCTION getvisitedWithDARData (empCode in char) RETURN visteDARMasterTABLE PIPELINED; END visitedWithDARPophelp; CREATE OR REPLACE PACKAGE BODY VISITEDWITHDARPOPHELP AS FUNCTION getvisitedWithDARData (empCode in char) RETURN visteDARMasterTABLE PIPELINED IS ls_cnt number(10); ls_item_ser VARCHAR2(5); begin select TRIM(item_ser) into ls_item_ser from sales_pers where sales_pers=empCode; SELECT COUNT(*) into ls_cnt FROM ORG_STRUCTURE O, VERSION V START WITH O.POS_CODE=(SELECT O.POS_CODE__REPTO FROM ORG_STRUCTURE O, VERSION V WHERE EMP_CODE = empCode AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y') CONNECT BY PRIOR POS_CODE__REPTO = POS_CODE AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y'; if ls_cnt> 0 then FOR x IN ( SELECT DISTINCT EMP_CODE AS REPORT_TO,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION ,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS VISITED_WITH,G.LEVEL_NO AS LEVEL_NO FROM EMPLOYEE EMP, GRADE G WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE union SELECT DISTINCT EMP_CODE AS REPORT_TO,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION ,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS VISITED_WITH,G.LEVEL_NO AS LEVEL_NO FROM EMPLOYEE EMP, GRADE G WHERE EMP_CODE IN (SELECT EMP_CODE AS REPORT_TO FROM ORG_STRUCTURE O, VERSION V START WITH O.POS_CODE=(SELECT O.POS_CODE__REPTO FROM ORG_STRUCTURE O, VERSION V WHERE EMP_CODE = empCode AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y') CONNECT BY PRIOR POS_CODE__REPTO = POS_CODE AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO AND O.ACTIVE = 'Y')AND EMP.GRADE=G.GRADE_CODE AND G.LEVEL_NO<=4 ORDER BY LEVEL_NO DESC ) LOOP PIPE ROW (visteDARMaster(x.REPORT_TO,x.DESIGNATION,x.VISITED_WITH,x.LEVEL_NO)); END LOOP; RETURN; END IF; if ls_cnt <= 0 then FOR x IN ( SELECT DISTINCT EMP_CODE AS REPORT_TO,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION ,DDF_GET_EMPLOYEE_NAME(EMP_CODE) ||' (' || LTRIM(RTRIM(EMP_CODE)) || ') ' AS VISITED_WITH,G.LEVEL_NO AS LEVEL_NO FROM EMPLOYEE EMP, GRADE G WHERE trim(EMP_CODE) IN (select regexp_substr(trim(entity_code),'[^,]+', 1, level) from ORG_ROLE_ASSIGN WHERE ORG_UNIT=ls_item_ser connect by regexp_substr(entity_code, '[^,]+', 1, level) is not null)AND EMP.GRADE=G.GRADE_CODE union SELECT DISTINCT EMP_CODE AS REPORT_TO,GET_EMP_DESIGNATION(EMP_CODE) DESIGNATION , DDF_GET_EMPLOYEE_NAME(EMP_CODE)||' ('|| LTRIM(RTRIM(EMP_CODE))|| ') ' AS VISITED_WITH,G.LEVEL_NO AS LEVEL_NO FROM EMPLOYEE EMP ,GRADE G WHERE EMP.EMP_CODE IN(SELECT EMP_CODE AS REPORT_TO FROM EMPLOYEE O START WITH O.EMP_CODE= (SELECT O.REPORT_TO FROM EMPLOYEE O WHERE EMP_CODE = empCode) CONNECT BY PRIOR REPORT_TO = EMP_CODE) AND EMP.GRADE=G.GRADE_CODE AND G.LEVEL_NO<=4 ORDER BY LEVEL_NO DESC) LOOP PIPE ROW (visteDARMaster(x.REPORT_TO,x.DESIGNATION,x.VISITED_WITH,x.LEVEL_NO)); END LOOP; RETURN; END IF; end; END visitedWithDARPophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TAX_BOND_DT (as_tran_code char,as_tran_id char,as_tax_code char,as_flag char) return varchar2 is ls_tax_form varchar2(100); BEGIN if as_flag='D' then select min(distinct tax_form_date) into ls_tax_form from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code AND (ACCT_CODE = ' ' or acct_code is null); if ls_tax_form ='' then ls_tax_form :=''; else ls_tax_form := to_char(ls_tax_form,'dd/mm/yy'); end if; else select min(distinct tax_form) into ls_tax_form from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code AND (ACCT_CODE = ' ' or acct_code is null); end if; return ls_tax_form; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOT_SL_CONS ( v_as_tranid IN CHAR, v_as_lotsl IN CHAR ) RETURN CHAR AS v_ls_site_code_from CHAR(5); v_ls_site_code_to CHAR(5); v_ls_tran_type CHAR(3); v_ls_lot_sl CHAR(15); BEGIN BEGIN SELECT site_code , site_code__dlv , tran_type INTO v_ls_site_code_from, v_ls_site_code_to, v_ls_tran_type FROM distord_iss WHERE tran_id = v_as_tranid; END; IF LTRIM(RTRIM(v_ls_site_code_from)) = LTRIM(RTRIM(v_ls_site_code_to)) AND ( v_ls_tran_type = 'CT' OR v_ls_tran_type = 'LT' ) THEN v_ls_lot_sl := SUBSTR(LTRIM(RTRIM(v_as_tranid)), LENGTH(LTRIM(RTRIM(v_as_tranid))), -4) ; ELSE v_ls_lot_sl := v_as_lotsl ; END IF; RETURN v_ls_lot_sl; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ATTD_TIME_STR (ls_org_in_time attd_regularize.org_in_time%type, ls_org_out_time attd_regularize.org_out_time%type, ls_emp_code attd_regularize.emp_code%type, ld_attd_date attd_regularize.attd_date%type) return varchar2 as ls_retstring varchar2(1000); ls_in_time attd_regularize.org_in_time%type; ls_out_time attd_regularize.org_out_time%type; begin ls_retstring := ' '; ls_in_time := ls_org_in_time; ls_out_time := ls_org_out_time; if ls_in_time is null or length(trim(ls_in_time)) = 0 then ls_in_time := '00:00'; end if; if ls_out_time is null or length(trim(ls_out_time)) = 0 then ls_out_time := '00:00'; end if; ls_retstring := 'System Time: [In: ' || ls_in_time || '] [Out: ' || ls_out_time || ']'; return ls_retstring; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_COUNT_HOLIDAY (as_site_code in char, as_date_fr in date,as_date_to in date) return date AS lc_date date; lc_count number:= 0; as_date_temp date := to_date(as_date_to); begin -- this function is used to count no. of holidays lies between date from and date to for that perticular site -- begin select count(a.hol_date) INTO lc_count from holiday a,site b where a.hol_tblno = b.hol_tblno and a.hol_date between as_date_fr and as_date_to AND nvl(trim(a.hol_type),'$')!='$' and b.site_code=as_site_code; dbms_output.put_line('lc_count=>'||lc_count); lc_date:=to_date(as_date_to); while lc_count > 0 loop as_date_temp := to_date(as_date_temp); lc_date := checkWorkingDay(as_site_code,to_date(as_date_temp)); dbms_output.put_line('lc_date>'||lc_date); lc_date:=to_date(lc_date); as_date_temp := lc_date; lc_count:=lc_count-1; end loop; return lc_date ; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAV_COUP_REQ_X ON TRAV_COUP_REQ (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CADRE_MTHAD_PAYROLL ON CADRE_MTHAD (PAY_TABLE, CADRE_CODE, MONTH_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_APRV_EMP (as_emp_code char,as_aprv_lev number) return char is ls_ret_emp_code char(10); ls_emp_code char(10); ls_report_to char(10); ls_with_held char(1); ld_relieve date; lc_count number(2); lc_no number(3); begin lc_count := 0; ls_ret_emp_code := ''; select report_to into ls_emp_code from employee where emp_code = as_emp_code; if ls_emp_code is null or length(trim(ls_emp_code)) = 0 then return ''; end if; loop select report_to , case when with_held is null then 'N' else with_held end, relieve_date into ls_report_to,ls_with_held,ld_relieve from employee where emp_code =ls_emp_code; if ls_with_held = 'Y' or ld_relieve is not null then if ls_report_to is null or length(trim(ls_report_to)) = 0 then exit; end if; ls_emp_code := ls_report_to; else lc_count := lc_count + 1; if lc_count < as_aprv_lev then if ls_report_to is null or length(trim(ls_report_to)) = 0 then exit; end if; ls_emp_code := ls_report_to; else ls_ret_emp_code := ls_emp_code; exit; end if; end if; end loop; return ls_ret_emp_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFFECTIVELEVELTABLE force AS TABLE OF EFFECTIVELEVELDMMASTER; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_NAME_ADDRESS (as_type varchar2, as_code varchar2, as_addr varchar2) RETURN varchar2 AS strsql varchar2 (500); ColVal varchar2 (500); BEGIN IF as_type = 'S' THEN strsql:='select '||as_addr||' from supplier Where supp_code= '''||as_code||'''' ; EXECUTE IMMEDIATE strsql into ColVal; elsif as_type = 'C' then strsql:='select '||as_addr||' from customer Where cust_code= '''||as_code||'''' ; EXECUTE IMMEDIATE strsql into ColVal; elsif as_type = 'O' THEN strsql:='select '||as_addr||' from site Where site_code= '''||as_code||'''' ; EXECUTE IMMEDIATE strsql into ColVal; end if; IF length(trim(ColVal)) > 0 THEN ColVal := trim(ColVal); ELSE ColVal := NVL(ColVal,''); END IF; RETURN ColVal ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EXP_WALLET_CURR_X ON EXP_WALLET_CURR (EXP_WALLET, SEQ_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SPON_REQ_CONTR_X ON STRG_SPON_REQ_CONTR (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_TAXOTH_REFGRP ON TAX_OTH_CREDITS (REF_ID, BAL_GROUP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_SUBMIT_TO (Vi_LVE_TYPE In Char, vi_AUTH_SIGN in char,vi_USE_FLAG in char, vi_for_emp in char) Return number Is return_rel number(1); BEGIN Begin If(Vi_For_Emp = 'NFE') Then If((Vi_Lve_Type = 'ML' Or Vi_Lve_Type = 'COFF' ) And Vi_Auth_Sign = 'H') Then Return_Rel := 1; Elsif(Vi_Lve_Type = 'PL' And Vi_Use_Flag = 'E' And Vi_Auth_Sign = 'H') Then Return_Rel := 1; Elsif((Vi_Lve_Type = 'CL' OR Vi_Lve_Type = 'SL' OR Vi_Lve_Type = 'LWP') And Vi_Use_Flag = 'C' And Vi_Auth_Sign = 'H') Then Return_Rel := 0; END IF; Elsif(Vi_For_Emp = 'FE') Then If((Vi_Lve_Type = 'ML' Or Vi_Lve_Type = 'SL' ) And Vi_Auth_Sign = 'H') Then Return_Rel := 1; Elsif(Vi_Lve_Type = 'PL' And Vi_Use_Flag = 'E' And Vi_Auth_Sign = 'H') Then Return_Rel := 1; Elsif((Vi_Lve_Type = 'CL' OR Vi_Lve_Type = 'COFF' OR Vi_Lve_Type = 'LWP') And Vi_Use_Flag = 'C' And Vi_Auth_Sign = 'H') Then Return_Rel := 0; END IF; end if; EXCEPTION When No_Data_Found Then return_rel := 0; END; Return return_rel; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MONTHDAYS (as_date date) return number is Yr Number(4); Mth Number(2); Cnt Number(2); begin select to_number(to_char(to_date(as_date),'MM')), to_number(to_char(to_date(as_date),'YYYY')) into Mth,Yr from dual; select count(dt) into Cnt from sfa_time where Year=Yr and Month_no=Mth; return nvl(Cnt,0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_REMARKS (as_type in char,as_invoiceid in char,as_item in char,ad_rate in number) return varchar is ls_str varchar2(200); ls_lotno varchar2(200); ls_remark varchar2(200); ls_artno varchar2(200); cursor cinv is SELECT despatchdet.lot_no,despatchdet.pack_instr,despatchdet.no_art FROM invoice_trace,despatchdet WHERE ( invoice_trace.desp_id = despatchdet.desp_id ) and ( invoice_trace.desp_line_no = despatchdet.line_no ) and ( ( invoice_trace.invoice_id = as_invoiceid ) AND ( invoice_trace.item_code = as_item ) AND ( invoice_trace.rate = ad_rate ) ) ; begin ls_lotno := ''; ls_remark := ''; ls_artno := ''; ls_str := ''; for r in cinv loop if length(ls_lotno) > 0 then ls_lotno := ls_lotno || ', ' || ltrim(rtrim(r.lot_no)) ; else ls_lotno := ltrim(rtrim(r.lot_no)) ; end if; if length(ls_remark) > 0 then ls_remark := ls_remark || ', ' || ltrim(rtrim(r.pack_instr)) ; else ls_remark := ltrim(rtrim(r.pack_instr)) ; end if; if length(ls_artno) > 0 then ls_artno := ls_artno || ', ' || ltrim(rtrim(r.no_art)) ; else ls_artno := ltrim(rtrim(r.no_art)) ; end if; end loop; if as_type = 'LOT' then ls_str := ls_lotno; end if; if as_type = 'REMARK' then ls_str := ls_remark; end if; if as_type = 'ARTNO' then ls_str := ls_artno; end if; return ls_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_TRAN_DATE_SITE ON MISC_PAYABLES (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MISCPAY_CONFIRMED (as_tran_id in char) return char is ls_confirmed char(1); begin if as_tran_id is null then ls_confirmed := 'N'; return ls_confirmed; end if; select confirmed into ls_confirmed from misc_payment where ( tran_id = as_tran_id ); if as_tran_id is null then ls_confirmed := 'N'; end if; return ls_confirmed; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STOCK_LOC_SITE ON STOCK (LOC_CODE, SITE_CODE, INV_STAT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_PO_DISCOUNT_AMT (as_po porder.purc_order%type) -- Rahul K Khanolkar 24-jul-02 -- Return total discount amt for that PO. return number is --ldec_amt number(14,7); /*Commented by Brijesh Soni on 14-10-10 as Instruction given by Mr. Navin Paliwal*/ ldec_amt number(14,3); begin select sum(((quantity*rate)*discount)/100) into ldec_amt from porddet where purc_order =as_po; return ldec_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FIN_DESCR (as_fin_entity finent.fin_entity%type,flag in char ) return varchar2 is ls_fin_entity varchar2(100) ; begin if flag = 'A' then SELECT descr into ls_fin_entity FROM finent WHERE finent.fin_entity =as_fin_entity ; ELSIF flag = 'B' then SELECT sh_descr into ls_fin_entity FROM finent WHERE finent.fin_entity =as_fin_entity ; ELSIF flag = 'C' then SELECT curr_code into ls_fin_entity FROM finent WHERE finent.fin_entity =as_fin_entity ; END IF; IF ls_fin_entity IS NULL THEN ls_fin_entity :=''; END IF; RETURN ls_fin_entity; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_DET (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_disparm_code in char, ls_type in char) return number is lc_tax_amt number(14,3); ls_var_value disparm.var_value%type; as_line_no char(3); lc_exch_rate number(17,6); begin begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 3 then as_line_no := rtrim(ltrim(ls_line_no)); end if; select (','||rtrim(var_value)||',') into ls_var_value from disparm where prd_code = '999999' and var_name = ls_disparm_code; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt__TCurr,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; end if; -- tax % if ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 AND TAX_AMT <>0 ; end if; -- taxable amt if ls_type = 'A' then select nvl(sum(CASE WHEN tax_type = 'H' THEN nvl(taxable_amt, 0) WHEN tax_type = 'I' THEN nvl(taxable_amt, 0) WHEN tax_type = 'J' THEN nvl(taxable_amt, 0) ELSE 0 END), 0) into lc_tax_amt from taxtran,tax WHERE tax.tax_code = taxtran.tax_code and tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no And tax_perc <> 0 AND (TAX.TAX_TYPE) IN ('H','I','J') ; end if; exception when no_data_found then lc_tax_amt := 0 ; end ; return lc_tax_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SM_SALES_SITE_SITE_LEVEL ON SM_SALES_SITE (TABLE_NO, SITE_CODE, LEVEL_CODE, LEVEL_CODE__PARENT, ITEM_CODE, ITEM_SER, PRD_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PACKING_DESCR ON PACKING (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE STOCKISTCODERETAILPOPHELP AS FUNCTION getStockistRetailPophelpData (empCode in char) RETURN stockistCodeRetailMasterTABLE PIPELINED; END stockistCodeRetailPophelp; CREATE OR REPLACE PACKAGE BODY STOCKISTCODERETAILPOPHELP AS FUNCTION getStockistRetailPophelpData (empCode in char) RETURN stockistCodeRetailMasterTABLE PIPELINED IS ls_cnt number(35); ls_trans_db varchar2(30); ls_parm_value varchar2(30); BEGIN select trans_db into ls_trans_db from users where emp_code = empCode; SELECT GET_SFAPARM_DATA('GET_RETAIL_STOCKIST',empCode) INTO ls_parm_value FROM DUAL; if (ls_parm_value = 'SPRS_STOCKIST') THEN if (ls_trans_db = 'EV') THEN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; ELSE SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; END IF; if(ls_cnt > 0) then if (ls_trans_db = 'EV') THEN for x in( SELECT CUST.CUST_CODE AS STOCKIST_CODE, CUST.CUST_NAME AS STOCKIST_NAME FROM SPRS_ROUTE SR, CUSTOMER CUST LEFT OUTER JOIN STRG_CUST_TYPE SCT ON CUST.CUST_TYPE = SCT.TYPE, SPRS_STOCKIST SS WHERE SS.CUST_CODE = CUST.CUST_CODE AND SR.LOCALITY_CODE = CUST.LOCALITY_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SS.SPRS_CODE = SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.STATUS = 'Y' AND CUST.BLACK_LISTED <> 'Y' ORDER BY STOCKIST_NAME ) LOOP PIPE ROW (STOCKISTCODERETAILMASTER(X.STOCKIST_CODE, X.STOCKIST_NAME)); END LOOP; RETURN; ELSE for x in( SELECT CUST.CUST_CODE AS STOCKIST_CODE, CUST.CUST_NAME AS STOCKIST_NAME FROM SPRS_ROUTE SR, CUSTOMER CUST LEFT OUTER JOIN STRG_CUST_TYPE SCT ON CUST.CUST_TYPE = SCT.TYPE, SPRS_STOCKIST SS WHERE SS.CUST_CODE = CUST.CUST_CODE AND SR.LOCALITY_CODE = CUST.LOCALITY_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SS.SPRS_CODE = SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID = V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.STATUS = 'Y' AND CUST.BLACK_LISTED <> 'Y' ORDER BY STOCKIST_NAME ) LOOP PIPE ROW (STOCKISTCODERETAILMASTER(X.STOCKIST_CODE, X.STOCKIST_NAME)); END LOOP; RETURN; END IF; end if; if(ls_cnt <= 0) then if (ls_trans_db = 'EV') THEN for x in( SELECT CUST.CUST_CODE AS STOCKIST_CODE, CUST.CUST_NAME AS STOCKIST_NAME FROM SPRS_ROUTE SR, CUSTOMER CUST LEFT OUTER JOIN STRG_CUST_TYPE SCT ON CUST.CUST_TYPE = SCT.TYPE, SPRS_STOCKIST SS WHERE SS.CUST_CODE = CUST.CUST_CODE AND SR.LOCALITY_CODE = CUST.LOCALITY_CODE AND SS.SPRS_CODE = SR.SPRS_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.STATUS = 'Y' AND CUST.BLACK_LISTED <> 'Y' ORDER BY STOCKIST_NAME) LOOP PIPE ROW (stockistCodeRetailMaster(x.stockist_code,x.STOCKIST_NAME)); END LOOP; RETURN; ELSE for x in( SELECT CUST.CUST_CODE AS STOCKIST_CODE, CUST.CUST_NAME AS STOCKIST_NAME FROM SPRS_ROUTE SR, CUSTOMER CUST LEFT OUTER JOIN STRG_CUST_TYPE SCT ON CUST.CUST_TYPE = SCT.TYPE, SPRS_STOCKIST SS WHERE SS.CUST_CODE = CUST.CUST_CODE AND SR.LOCALITY_CODE = CUST.LOCALITY_CODE AND SS.SPRS_CODE = SR.SPRS_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.STATUS = 'Y' AND CUST.BLACK_LISTED <> 'Y' ORDER BY STOCKIST_NAME) LOOP PIPE ROW (stockistCodeRetailMaster(x.stockist_code,x.STOCKIST_NAME)); END LOOP; RETURN; END IF; end if; ELSE if (ls_trans_db = 'EV') THEN SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; ELSE SELECT COUNT(*) into ls_cnt FROM EMPLOYEE WHERE EMP_CODE IN(SELECT EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID= V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO) and RELIEVE_DATE IS NULL; END IF; if(ls_cnt > 0) then if (ls_trans_db = 'EV') THEN for x in(SELECT SC.SC_CODE AS STOCKIST_CODE, UPPER(SC.FIRST_NAME)||' '||UPPER(SC.LAST_NAME) AS STOCKIST_NAME FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE, STRG_SERIES SS WHERE SS.SC_CODE = SC.SC_CODE AND SR.LOCALITY_CODE = SC.LOCALITY_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SS.SALES_PERS = SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID = V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.SC_CODE IN (SELECT SC_CODE FROM STRG_STATUS_HIST WHERE STATUS = 'Y' AND SALES_PERS = SS.SALES_PERS AND SC_CODE = SC.SC_CODE AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO) AND SS.STATUS = 'Y' AND SCT.DCR_GROUP = 'S' ORDER BY STOCKIST_NAME) LOOP PIPE ROW (STOCKISTCODERETAILMASTER(X.STOCKIST_CODE, X.STOCKIST_NAME)); END LOOP; RETURN; ELSE for x in(SELECT SC.SC_CODE AS STOCKIST_CODE, UPPER(SC.FIRST_NAME)||' '||UPPER(SC.LAST_NAME) AS STOCKIST_NAME FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE, STRG_SERIES SS WHERE SS.SC_CODE = SC.SC_CODE AND SR.LOCALITY_CODE = SC.LOCALITY_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SS.SALES_PERS = SR.SPRS_CODE AND SR.SPRS_CODE IN (SELECT DISTINCT O.EMP_CODE FROM ORG_STRUCTURE O,VERSION V START WITH O.EMP_CODE = empCode CONNECT BY PRIOR O.POS_CODE = O.POS_CODE__REPTO AND POS_CODE__REPTO IS NOT NULL AND O.ACTIVE = 'Y' AND O.VERSION_ID = V.VERSION_ID AND SYSDATE BETWEEN V.EFF_FROM AND V.VALID_UPTO ) AND SS.SC_CODE IN (SELECT SC_CODE FROM STRG_STATUS_HIST WHERE STATUS = 'Y' AND SALES_PERS = SS.SALES_PERS AND SC_CODE=SC.SC_CODE AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO) AND SS.STATUS = 'Y' AND SCT.DCR_GROUP = 'S' ORDER BY STOCKIST_NAME) LOOP PIPE ROW (STOCKISTCODERETAILMASTER(X.STOCKIST_CODE, X.STOCKIST_NAME)); END LOOP; RETURN; END IF; end if; if(ls_cnt <= 0) then if (ls_trans_db = 'EV') THEN for x in(SELECT SC.SC_CODE AS STOCKIST_CODE, UPPER(SC.FIRST_NAME)||' '||UPPER(SC.LAST_NAME) AS STOCKIST_NAME FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE, STRG_SERIES SS WHERE SS.SC_CODE = SC.SC_CODE AND SR.LOCALITY_CODE = SC.LOCALITY_CODE AND SS.SALES_PERS = SR.SPRS_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.SC_CODE IN (SELECT SC_CODE FROM STRG_STATUS_HIST WHERE STATUS = 'Y' AND SALES_PERS = SS.SALES_PERS AND SC_CODE=SC.SC_CODE AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO) AND SS.STATUS = 'Y' AND SCT.DCR_GROUP = 'S' ORDER BY STOCKIST_NAME) LOOP PIPE ROW (stockistCodeRetailMaster(x.stockist_code,x.STOCKIST_NAME)); END LOOP; RETURN; ELSE for x in(SELECT SC.SC_CODE AS STOCKIST_CODE, UPPER(SC.FIRST_NAME)||' '||UPPER(SC.LAST_NAME) AS STOCKIST_NAME FROM SPRS_ROUTE SR, STRG_CUSTOMER SC LEFT OUTER JOIN STRG_CUST_TYPE SCT ON SC.CUST_TYPE = SCT.TYPE, STRG_SERIES SS WHERE SS.SC_CODE = SC.SC_CODE AND SR.LOCALITY_CODE = SC.LOCALITY_CODE AND SS.SALES_PERS = SR.SPRS_CODE AND SR.ROUTE_ID = SS.ROUTE_ID AND SR.SPRS_CODE IN (SELECT DISTINCT EMP_CODE FROM EMPLOYEE START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO ) AND SS.SC_CODE IN (SELECT SC_CODE FROM STRG_STATUS_HIST WHERE STATUS = 'Y' AND SALES_PERS = SS.SALES_PERS AND SC_CODE = SC.SC_CODE AND SYSDATE BETWEEN EFF_FROM AND VALID_UPTO) AND SS.STATUS = 'Y' AND SCT.DCR_GROUP = 'S' ORDER BY STOCKIST_NAME) LOOP PIPE ROW (stockistCodeRetailMaster(x.stockist_code,x.STOCKIST_NAME)); END LOOP; RETURN; END IF; end if; END IF; END; END stockistCodeRetailPophelp; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_QTY (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, ac_qty in number) return number is mrate number(14,3); begin if as_type = 'L' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum =1; elsif as_type = 'D' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; elsif as_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; elsif as_type = 'I' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'I' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty and rownum = 1; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CLOSE_STOCK (as_prdcode char, as_custcode char, as_itemcode char,flag Char) return number is ls_stock number(10); ls_item_descr char(50); begin if flag = 'C' then select sum(cl_stock) into ls_stock from cust_stock, cust_stock_det,item where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock_det.item_code = item.item_code and cust_stock.prd_code = as_prdcode and cust_stock.cust_code = as_custcode and cust_stock_det.item_code = as_itemcode ; else select SUM(sales) into ls_stock from cust_stock,cust_stock_det,item where cust_stock.tran_id = cust_stock_det.tran_id and cust_stock_det.item_code = item.item_code and cust_stock.prd_code = as_prdcode and cust_stock.cust_code = as_custcode and cust_stock_det.item_code = as_itemcode; end if ; return ls_stock; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYDET_TRAN_VOUCH ON MISC_PAYDET (TRAN_SER, VOUCH_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOT_LOC (lsite_code in char, litem_code in char, llot_no in char, lloc_code in char, llot_sl in char, ad_from_date in date, ltype in char, lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.loc_code = lloc_code and a.lot_no = llot_no and a.lot_sl = llot_sl and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = lloc_code and a.lot_sl = llot_sl and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.eff_date > ad_from_date and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_WORK_STAN_TYPE (ls_sales_pers sprs_travel.sales_pers%type, ld_travel_date sprs_travel.travel_date%type) return varchar2 is ls_stan_type stantype.stan_type%type; begin select distinct(g.stan_type) into ls_stan_type from sprs_travel e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.travel_date = ld_travel_date and f.sprs_code = e.sales_pers and f.locality_code = e.locality_code and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from sprs_travel b, sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.travel_date = e.travel_date and c.sprs_code = b.sales_pers and c.locality_code = b.locality_code and d.stan_type = c.station_type); return ls_stan_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MPREQ_CVRECD_X ON MPREQ_CVRECD (VAC_NO, RECD_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_TERM_PK ON SALES_QUOT_TERM (QUOT_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_VOUCH_NO_DATE_CANC (as_tran_id in char, as_net_amt in number, as_sundry_type in char, as_flag in char) return varchar2 is lc_vouch_no varchar2(20); begin if as_flag='A' then if (as_sundry_type <> 'B') then select to_char(misc_payment_cancdet.vouch_date) into lc_vouch_no from misc_payment_cancdet where misc_payment_cancdet.tran_id = as_tran_id; else select to_char(misc_payment_canc.ref_date) into lc_vouch_no from misc_payment_canc where misc_payment_canc.tran_id = as_tran_id ; end if; else if (as_sundry_type <> 'B') then select misc_payment_cancdet.vouch_no into lc_vouch_no from misc_payment_cancdet where misc_payment_cancdet.tran_id = as_tran_id; else select substr(misc_payment_canc.ref_no,1,10) into lc_vouch_no from misc_payment_canc where misc_payment_canc.tran_id = as_tran_id ; end if; end if; return lc_vouch_no ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION INT_NUM2WORD_2 (val in number,CURR IN VARCHAR) return varchar2 is amt number; strt number; str varchar2(17); ls_dec_unit varchar(10); ls_currency varchar(50); c_str varchar2(400); flag number:=0; begin amt:=floor(val); str:=to_char(amt); ls_dec_unit:=' '; ls_currency :=' ' ; select nvl(dec_unit,'Cents') into ls_dec_unit from currency where TRIM(curr_code)=TRIM(curr); select nvl(descr,'US DOLLAR') into ls_currency from currency where TRIM(curr_code)=TRIM(curr); if val > 0 then if length(str) >= 16 and length(str) <=17 then strt:=(length(str)-15); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Million ' ; amt:=to_number(substr(to_char(amt),(strt+1),15)); flag:=1; end if; str:=to_char(amt); if length(str) >= 10 and length(str) <=15 then strt:=(length(str)-9); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Billion ' ; amt:=to_number(substr(to_char(amt),(strt+1),9)); flag:=1; end if; str:=to_char(amt); if length(str) =9 then strt:=(length(str)-8); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Hundred '; amt:=to_number(substr(to_char(amt),(strt+1),8)); flag:=1; end if; str:=to_char(amt); if length(str) = 8 then strt:=(length(str)-6); str:=substr(str,1,strt); c_str:=c_str || (spell(to_number(str))) || ' Million ' ; amt:=to_number(substr(to_char(amt),(strt+1),6)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 7 ) or flag = 1) then c_str:=c_str || (spell(amt)) ; end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := ls_currency || ' ' || LOWER(c_str) || ' and ' || lower(spell(amt)) || ' ' || ls_dec_unit; else c_str := ls_currency || ' ' || LOWER(c_str) || ' Only'; end if; c_str:=replace(c_Str,'-',' '); return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUSTOMER_TCSPERC_SRETURN (AS_CUST_CODE__BIL CHAR,AS_CUST_CODE CHAR,AS_TAX_DATE DATE,AS_TRAN_DATE DATE, AS_TRAN_TYPE CHAR) RETURN NUMBER IS LS_RETURN NUMBER (14,3) := 0; V_PAN_NO CUSTOMER.PAN_NO%TYPE; V_TAX_CLASS CUSTOMER.TAX_CLASS%TYPE; V_TAX_DATE DATE; V_CUST_CODE CHAR(10); LS_COUNT NUMBER(10); ls_var_value DISPARM.VAR_VALUE%TYPE; BEGIN ---Check if tran type is Full return type. If match with disparm value then TCS value will be returned select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = 'SRET_FULL_TRANTYPE'; SELECT (CASE WHEN trim(AS_TRAN_TYPE) IN (SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value))) THEN 1 ELSE 0 END) INTO LS_COUNT FROM DUAL; IF LS_COUNT =0 and AS_TRAN_TYPE is not null THEN LS_RETURN :=0 ; RETURN LS_RETURN; ELSE --If cust code bill is null the cust_cod will be set IF AS_CUST_CODE__BIL IS NOT NULL THEN V_CUST_CODE := AS_CUST_CODE__BIL; ELSE V_CUST_CODE := AS_CUST_CODE; END IF; --If method is called on despatch then desp date will be not null and date will be set as desp date --If method is called on other than despatch transaction then tax date will be set if tax date is also null then tran date will be set ---- IF AS_DESP_DATE IS NOT NULL THEN -- V_TAX_DATE := AS_DESP_DATE; IF AS_TAX_DATE IS NOT NULL THEN V_TAX_DATE := AS_TAX_DATE; ELSE V_TAX_DATE := AS_TRAN_DATE; END IF; -- Return the Pan no and tax class from customer master SELECT NVL(PAN_NO,'PANNOTAVBL'), NVL(TAX_CLASS,'BLANK') INTO V_PAN_NO, V_TAX_CLASS FROM CUSTOMER WHERE CUST_CODE = V_CUST_CODE; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE BETWEEN TO_DATE('01-SEP-2020','DD-MON-YYYY') AND TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 1 ; END IF; IF V_PAN_NO <> 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE BETWEEN TO_DATE('01-SEP-2020','DD-MON-YYYY') AND TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 0.075 ; END IF; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE > TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 1 ; END IF; IF V_PAN_NO <> 'PANNOTAVBL' AND V_TAX_CLASS = 'TCGST' AND V_TAX_DATE > TO_DATE('31-MAR-2021','DD-MON-YYYY') THEN LS_RETURN := 0.1 ; END IF; IF V_TAX_CLASS <> 'TCGST' THEN LS_RETURN := 0 ; END IF; END IF; RETURN LS_RETURN; EXCEPTION WHEN OTHERS THEN LS_RETURN := 0 ; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORDFBCK_WOPERTYPE ON WORKORDER_FEEDBACK (WORK_ORDER, OPERATION, FEEDBACK_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_NONTAX_AMT (as_trancode char,as_tranid char) return number is ln_val decimal(14,3); begin select sum(taxtran.tax_amt) into ln_val from taxtran, tax where taxtran.tax_code = tax.tax_code and taxtran.tran_code = as_trancode and taxtran.tran_id = as_tranid and tax.print_tax = 'N' and taxtran.effect <> 'N'; if ln_val is null then ln_val := 0; end if; return ln_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_VOUCHER_TRACE_TRAN_DATE ON MISC_VOUCHER_TRACE (TRAN_DATE, TRAN_ID__SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_DRCR_RCP_TRAN_DATE_SITE ON MISC_DRCR_RCP (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CHQCANC_X ON CHQCANC (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX MARKET_DET_X ON MARKET_DET (MARKET_CODE, COUNT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_LIC_VALIDITY (as_custcode IN customer.cust_code%type, as_type in char ) return number as ll_retval number(1); ls_licno customer.DRUG_LIC_NO%type; ls_licno1 customer.DRUG_LIC_NO_1%type; ls_licno2 customer.DRUG_LIC_NO_2%type; ldt_licdt customer.DRUG_LICNO_UPTO%type; ldt_licdt1 customer.DRUG_LICNO1_UPTO%type; ldt_licdt2 customer.DRUG_LICNO2_UPTO%type; ls_checkvalid char(1); BEGIN ll_retval := 1; ls_licno := ' '; ls_licno1 := ' '; ls_licno2 := ' '; begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'CHK_DRUG_LIC_EXP'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then begin SELECT DRUG_LIC_NO, DRUG_LICNO_UPTO ,DRUG_LIC_NO_1,DRUG_LICNO1_UPTO,DRUG_LIC_NO_2,DRUG_LICNO2_UPTO INTO ls_licno,ldt_licdt,ls_licno1,ldt_licdt1,ls_licno2,ldt_licdt2 FROM customer WHERE cust_code=as_custcode; exception when others then ls_licno := ' '; ls_licno1 := ' '; ls_licno2 := ' '; end; IF length(trim(ls_licno)) > 0 and as_type = 'W' THEN if ldt_licdt is null or ldt_licdt < trunc(sysdate) + 10 then ll_retval := 0; end if; else if ldt_licdt is null or ldt_licdt < trunc(sysdate) then ll_retval := 0; end if; END IF; IF length(trim(ls_licno1)) > 0 and as_type = 'W' THEN if ldt_licdt1 is null or ldt_licdt1 < trunc(sysdate) + 10 then ll_retval := 0; end if; else if ldt_licdt1 is null or ldt_licdt1 < trunc(sysdate) then ll_retval := 0; end if; END IF; IF length(trim(ls_licno2)) > 0 and as_type = 'W' THEN if ldt_licdt2 is null or ldt_licdt2 < trunc(sysdate) + 10 then ll_retval := 0; end if; else if ldt_licdt2 is null or ldt_licdt2 < trunc(sysdate) then ll_retval := 0; end if; END IF; end if; RETURN ll_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITEDLV_IENO (as_site_dlv porder.site_code__dlv%type) return varchar2 is ls_var_val_sasp disparm.var_value%type; ls_fin_ent finent.fin_entity%type; begin select b.fin_entity into ls_fin_ent from site a,finent b where a.fin_entity = b.fin_entity and a.site_code = as_site_dlv ; if trim(ls_fin_ent) = 'SP'then select var_value into ls_var_val_sasp from disparm where prd_code= '999999' and var_name = 'PO_IE_NO_SP' ; elsif trim(ls_fin_ent) = 'SA' then select var_value into ls_var_val_sasp from disparm where prd_code= '999999' and var_name = 'PO_IE_NO_SA' ; /* change on 23-03-09 for SC*/ elsif trim(ls_fin_ent) = 'SC' then select var_value into ls_var_val_sasp from disparm where prd_code= '999999' and var_name = 'PO_IE_NO_SC' ; /*Change on 06-10-08 - Brijesh Soni*/ elsif trim(ls_fin_ent) = 'UT' then select var_value into ls_var_val_sasp from disparm where prd_code= '999999' and var_name = 'PO_IE_NO_UT' ; /*Change on 22-06-09 - Vikas*/ elsif trim(ls_fin_ent) = 'SQ' then select var_value into ls_var_val_sasp from disparm where prd_code= '999999' and var_name = 'PO_IE_NO_SQ' ; end if; return ls_var_val_sasp; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SALES_STAGE1_DUP ON SALES_STAGE1 (TRAN_KEY, TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CNT_QTR ( as_qtr char, as_acct_prd char, as_terr_code char) return number is li_payable number; li_ctr number := 0; li_proc_no number; no_records exception; ls_flag char(1); cursor c1 is select distinct prd_qtr from period where acct_prd = as_acct_prd and code < as_qtr; Begin begin for i in c1 loop select nvl(sum(inc_payable),0) into li_payable from incqtr where nvl(terr_code__main,terr_code) = as_terr_code and qtr = i.prd_qtr and confirmed ='Y'; if li_payable is null then raise no_records; end if; if li_payable > 0 then select max(proc_no) into li_proc_no from incqtr where nvl(terr_code__main,terr_code) = as_terr_code and qtr = i.prd_qtr and confirmed = 'Y'; select distinct inc_flag into ls_flag from incqtr where nvl(terr_code__main,terr_code) = as_terr_code and qtr = i.prd_qtr and proc_no = li_proc_no and confirmed ='Y'; if ls_flag = 'M' then ----or ls_flag = 'S' then li_ctr := li_ctr - 1; end if; else li_ctr := li_ctr + 1; end if; end loop; exception when no_data_found then li_ctr := 0; when no_records then li_ctr := 0; end; return li_ctr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_AVG_OUT (ls_site_code in char, ls_cust_code in char,ls_item_ser in char, ld_date_from in date, ld_date_to in date) return number is ln_net_amount number(14,3); begin select round(sum((receipt.tran_date - rcpdet.ref_date) * rcpdet.net_amt) / sum(rcpdet.net_amt),2) into ln_net_amount from receipt ,rcpdet , invoice where receipt.tran_id= rcpdet.tran_id and rcpdet.ref_ser ='S-INV' and rcpdet.ref_no = invoice.invoice_id and receipt.site_code = ls_site_code and invoice.tran_date between ld_date_from and ld_date_to and invoice.cust_code = ls_cust_code and invoice.item_ser = ls_item_ser; return ln_net_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE INSTRUMENTTYPETABLE AS TABLE OF instrumentType; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE ITEMCODEMASTER AS OBJECT ( ITEM_CODE char (10), DESCR VARCHAR2(120) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DBF_CALC_RETIRE_DATE (AS_EMP_CODE VARCHAR2,AS_RETIREMENT_AGE NUMBER,AS_BIRTH_DATE DATE) RETURN DATE IS AS_RETIREMENT_DATE DATE; BEGIN SELECT LAST_DAY(ADD_MONTHS(AS_BIRTH_DATE,AS_RETIREMENT_AGE)) INTO AS_RETIREMENT_DATE FROM DUAL; RETURN AS_RETIREMENT_DATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SUNDRY_SH_NAME ( as_sundrytype in char, as_sundrycode in char) return varchar is ls_name char(250); begin if trim(as_sundrytype) = 'O' then begin ls_name := ' '; end; end if; if trim(as_sundrytype) = 'T' then begin select (case when sh_name is null then substr(tran_name,1,20) else sh_name end) into ls_name from transporter where tran_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'B' then begin select (case when sh_name is null then substr(bank_name,1,20) else sh_name end) into ls_name from bank where bank_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'X' then begin select (case when sh_name is null then substr(tauth_name,1,20) else sh_name end) into ls_name from tax_authority where tauth_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'E' then begin select (case when short_name is null then substr( nvl(emp_fname,'')||nvl(emp_lname,''), 1, 40 ) else short_name end) into ls_name from employee where emp_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'P' then begin select (case when sh_name is null then substr(sp_name,1,20) else sh_name end) into ls_name from sales_pers where sales_pers = as_sundrycode; end; end if; if trim(as_sundrytype) = 'S' then begin select (case when sh_name is null then substr(supp_name,1,20) else sh_name end) into ls_name from supplier where supp_code = as_sundrycode; end; end if; if as_sundrytype = 'C' then begin select case when sh_name is null then substr(cust_name,1,20) else sh_name end into ls_name from customer where cust_code = as_sundrycode; end; end if; if trim(as_sundrytype) = 'L' then begin select (case when sh_name is null then substr(party_name,1,20) else sh_name end) into ls_name from loanparty where party_code = as_sundrycode; end; end if; if trim( as_sundrytype) = 'R' then begin select substr( nvl(rtrim(first_name),' ')||' '||nvl(rtrim(middle_name),' ') ||' '||nvl(rtrim(last_name),' '),1,40) into ls_name from strg_customer where sc_code = as_sundrycode; end; end if; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PORCPTRANSER (as_tranid in char) return char Is ls_transer porcp.tran_ser%type; begin begin select trim(tran_ser) into ls_transer from porcp where tran_id = as_tranid; exception when others then ls_transer := ' '; end; return ls_transer; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX REP_SPECIFIC_AD_X ON REP_SPECIFIC_AD (REPORT_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUSTITEM_REF (as_site char,as_desp_id char) return varchar2 is ls_item_ref varchar2(20); begin select nvl(item_code__ref,'') into ls_item_ref from despatch,customeritem,despatchdet where (despatch.desp_id =despatchdet.desp_id) and (despatch.cust_code =customeritem.cust_code) and (despatchdet.item_code = customeritem.item_code(+) ) and despatch.site_code =as_site and despatch.desp_id =as_desp_id ; return TRIM(ls_item_ref); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEM_TYPE_PARENT ON ITEM (ITEM_CODE, LOC_TYPE__PARENT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX POAMD_HDR_CONFIRMED ON POAMD_HDR (CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_PACK_ORDER_SITE_TYPE_NO ON INV_PACK (SITE_CODE, ORDER_TYPE, ORDER_NO, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_DESP_QTYRATE BEFORE insert or update ON despatchdet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; -- ls_rateunit uom.unit%type; --ls_tranunit uom.unit%type; BEGIN --ls_rateunit := :new.unit__rate; --ls_tranunit := :new.unit; --if trim(ls_tranunit) <> trim(ls_rateunit) then if round(nvl(:new.quantity,0) * nvl(:new.CONV__QTY_STDUOM,0),3) <> round(nvl(:new.QUANTITY__STDUOM,0),3) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] x conv__qty_stduom [' || to_char(:new.conv__qty_stduom) || '] not matching with quantity__stduom['||to_char(:new.quantity__stduom)|| ']' ); end if; /* if nvl(:new.quantity,0) <> nvl(:new.QUANTITY_real,0) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] not matching with quantity_real ['||to_char(:new.QUANTITY_real)|| ']' ); end if; */ --end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRG_EMPDETCHG_EMPNAMES Before Insert Or Update On Employee_Det_Change REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN IF :NEW.EMP_FNAME_LONG_O IS NULL AND :NEW.EMP_FNAME_O IS NOT NULL THEN :NEW.EMP_FNAME_LONG_O := :NEW.EMP_FNAME_O; ELSIF :NEW.EMP_FNAME_LONG_O IS NOT NULL AND :NEW.EMP_FNAME_O IS NULL THEN :NEW.EMP_FNAME_O := :NEW.EMP_FNAME_LONG_O ; END IF; IF :NEW.EMP_MNAME_LONG_O IS NULL AND :NEW.EMP_MNAME_O IS NOT NULL THEN :NEW.EMP_MNAME_LONG_O := :NEW.EMP_MNAME_O; ELSIF :NEW.EMP_MNAME_LONG_O IS NOT NULL AND :NEW.EMP_MNAME_O IS NULL THEN :NEW.EMP_MNAME_O := :NEW.EMP_MNAME_LONG_O ; END IF; IF :NEW.EMP_LNAME_LONG_O IS NULL AND :NEW.EMP_LNAME_O IS NOT NULL THEN :NEW.EMP_LNAME_LONG_O := :NEW.EMP_LNAME_O; ELSIF :NEW.EMP_LNAME_LONG_O IS NOT NULL AND :NEW.EMP_LNAME_O IS NULL THEN :NEW.EMP_LNAME_O := :NEW.EMP_LNAME_LONG_O ; END IF; IF :NEW.EMP_FNAME_LONG IS NULL AND :NEW.EMP_FNAME IS NOT NULL THEN :NEW.EMP_FNAME_LONG := :NEW.EMP_FNAME; ELSIF :NEW.EMP_FNAME_LONG IS NOT NULL AND :NEW.EMP_FNAME IS NULL THEN :NEW.EMP_FNAME := TRIM(SUBSTR(:NEW.EMP_FNAME_LONG,1,15)) ; ELSIF :NEW.EMP_FNAME_LONG <> :OLD.EMP_FNAME_LONG AND :NEW.EMP_FNAME = :OLD.EMP_FNAME THEN :NEW.EMP_FNAME := TRIM(SUBSTR(:NEW.EMP_FNAME_LONG,1,15)) ; ELSIF :NEW.EMP_FNAME_LONG = :OLD.EMP_FNAME_LONG AND :NEW.EMP_FNAME <> :OLD.EMP_FNAME THEN :NEW.EMP_FNAME_LONG := :NEW.EMP_FNAME; END IF; IF :NEW.EMP_MNAME_LONG IS NULL AND :NEW.EMP_MNAME IS NOT NULL THEN :NEW.EMP_MNAME_LONG := :NEW.EMP_MNAME; ELSIF :NEW.EMP_MNAME_LONG IS NOT NULL AND :NEW.EMP_MNAME IS NULL THEN :NEW.EMP_MNAME := TRIM(SUBSTR(:NEW.EMP_MNAME_LONG,1,15)) ; ELSIF :NEW.EMP_MNAME_LONG <> :OLD.EMP_MNAME_LONG AND :NEW.EMP_MNAME = :OLD.EMP_MNAME THEN :NEW.EMP_MNAME := TRIM(SUBSTR(:NEW.EMP_MNAME_LONG,1,15)) ; ELSIF :NEW.EMP_MNAME_LONG = :OLD.EMP_MNAME_LONG AND :NEW.EMP_MNAME <> :OLD.EMP_MNAME THEN :NEW.EMP_MNAME_LONG := :NEW.EMP_MNAME; END IF; IF :NEW.EMP_LNAME_LONG IS NULL AND :NEW.EMP_LNAME IS NOT NULL THEN :NEW.EMP_LNAME_LONG := :NEW.EMP_LNAME; ELSIF :NEW.EMP_LNAME_LONG IS NOT NULL AND :NEW.EMP_LNAME IS NULL THEN :NEW.EMP_LNAME := TRIM(SUBSTR(:NEW.EMP_LNAME_LONG,1,15)) ; ELSIF :NEW.EMP_LNAME_LONG <> :OLD.EMP_LNAME_LONG AND :NEW.EMP_LNAME = :OLD.EMP_LNAME THEN :NEW.EMP_LNAME := TRIM(SUBSTR(:NEW.EMP_LNAME_LONG,1,15)) ; ELSIF :NEW.EMP_LNAME_LONG = :OLD.EMP_LNAME_LONG AND :NEW.EMP_LNAME <> :OLD.EMP_LNAME THEN :NEW.EMP_LNAME_LONG := :NEW.EMP_LNAME; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_LINK_RIGHTS_UPD is begin declare ls_oldright char(10); ls_repright char(1); ls_updstmt varchar2(4000); begin begin for cur_det in ( select distinct profile_id,obj_name,rights from user_rights where profile_id in( select profile_id from profile where profile_id like 'AE%') and obj_name in ( select obj_name from obj_links where link_type = '5' and field_name like 'home%') order by profile_id,obj_name ) loop for cur_right in ( select rights_char from obj_links where obj_name = cur_det.obj_name and link_type = '5' and field_name like 'home%' ) loop if instr(trim(cur_det.rights),cur_right.rights_char) = 0 and cur_det.rights <> '*' then begin update user_rights set rights = trim(rights) || trim(cur_right.rights_char) where profile_id = cur_det.profile_id and obj_name = cur_det.obj_name ; dbms_output.put_line('Profile [' || cur_det.profile_id ||'] obj [' || cur_det.obj_name ||'] right [' || cur_right.rights_char ||']'); exception when others then rollback; end; end if; end loop; end loop; exception when others then rollback; end; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_GENCODE_SH_DESCR ( as_item_code item.item_code%type) return varchar2 is ls_sh_descr gencodes.sh_descr%type; ls_udf_str gencodes.udf_str3%type; ls_det varchar2(75); begin select gencodes.sh_descr, gencodes.udf_str3 into ls_sh_descr,ls_udf_str from item , gencodes where grp_code = trim(fld_value) and FLD_NAME= 'GRP_CODE' and MOD_NAME = 'W_ITEM' and item_code = as_item_code; if ls_udf_str is not null then ls_det := ('('||' '||ls_sh_descr || ' - '||ls_udf_str||' '||')'); else ls_det := ls_sh_descr; end if; return ls_det; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TASK_DESC (as_task_code in char,as_purc_order in char,as_proj_code in char) RETURN char is ls_desc char(60); ls_proj_code char(10); BEGIN IF as_proj_code IS null OR as_proj_code = '' THEN dbms_output.put_line('hiiiiiiiii'||as_task_code); select proj_code into ls_proj_code from porder where purc_order=as_purc_order; select remarks into ls_desc from proj_task where proj_code=ls_proj_code and task_code=as_task_code; ELSE select remarks into ls_desc from proj_task where proj_code=as_proj_code and task_code=as_task_code; dbms_output.put_line('lc_flag'||as_task_code); END IF; RETURN ls_desc; END FN_GET_TASK_DESC; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WORDER_RCP (as_tran_id in char,as_WORK_ORDER in char,as_item_code in char,as_site_code in char) return varchar2 is val number := 0; ls_retval number := 0; begin if as_tran_id is null then select count(1) into val from workorder_receipt where work_order=as_work_order and site_code=as_site_code and item_code=as_item_code and tran_type='F' and confirmed='N' ; if val=1 then ls_retval:= 1; else ls_retval:= 0; end if; return ls_retval; else return ls_retval; end if ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION WORKORDER_TRACK ( as_item_code char,as_Exp_date date) return number is ret_val number(1); val char(1); begin select TRIM(track_shelf_life) into val from item where item_code=as_item_code; if(TRIM(val)='Y' and as_exp_date IS NULL) then ret_val:=0; else ret_val:=1; end if; return ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SPON_REQ_PROD_X ON STRG_SPON_REQ_PROD (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHEQUE_DET ( ls_ref_ser in char , ls_ref_no in char) return varchar2 is ls_det varchar2(29); ls_chq_no varchar2(20); lt_chq_date date; begin if ls_ref_ser = 'RCP' then select ref_no , ref_date into ls_chq_no , lt_chq_date from receipt where tran_id = ls_ref_no ; ls_det := to_char(lt_chq_date , 'dd/mm/yy')||' '||ls_chq_no; return ls_det; elsif ls_ref_ser = 'M-RCP' then select ref_no , ref_date into ls_chq_no , lt_chq_date from misc_receipt where tran_id = ls_ref_no; ls_det := to_char(lt_chq_date , 'dd/mm/yy')||' '||ls_chq_no; return ls_det; else ls_det :=''; return ls_det; end if; exception when no_data_found then ls_det :=''; return ls_det; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LEAVE_SETTINGS (AS_EMP_CODE char,AS_LVE_TBLNO char,AS_LVE_CODE char,AS_CALC_PRDFR char,AS_CALC_PRDTO char,AS_PROC_PRDFR char, AS_PROC_PRDTO char,AS_CALC_DTFR char,AS_CALC_DTTO char) return number is a_calc_prdfr char(6); a_calc_prdto char(6); a_no_months number(2); a_no_months1 number(2); a_days_year number(3); a_days_emp number(3); a_count number(5); a_count1 number(5); a_days number(5,2) := 0; a_accm_days number(13,10) := 0; a_date_fr date; a_date_to date; a_year_dtfr date; a_year_dtto date; a_eff_date date; a_exp_date date; a_date date; a_tag boolean; a_type ad_slabs.type%type; a_amount ad_slabs.amount%type; a_work_days attendance_mon.work_days%type; a_paid_days attendance_mon.paid_days%type; a_year_pd attendance_mon.paid_days%type := 0; a_leave_days empleave_summary.no_days%type; a_birth_date employee.birth_date%type; a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; a_hol_tblno holiday.hol_tblno%type; begin if (AS_LVE_TBLNO = 'LV019' and AS_LVE_CODE = 'PL') then a_calc_prdfr := AS_CALC_PRDFR; a_calc_prdto := AS_CALC_PRDTO; select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (to_char(a_date_join,'YYYYMM') = a_calc_prdfr) then a_calc_prdfr := (substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2); end if; if (to_char(a_relieve_date,'YYYYMM') = a_calc_prdto) then a_calc_prdto := (substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2); end if; select count(*) into a_no_months from period where code between a_calc_prdfr and a_calc_prdto; select nvl(sum(work_days),0) into a_work_days from attendance_mon where prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and emp_code = AS_EMP_CODE; if (a_work_days >= 239.5) then a_days := ((21/12)*a_no_months); end if; elsif (AS_LVE_TBLNO = 'LV005' and AS_LVE_CODE = 'PL') then a_tag := true; a_date_fr := to_date(AS_CALC_DTFR,'yyyy-mm-dd'); a_date_to := to_date(AS_CALC_DTTO,'yyyy-mm-dd'); select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; select a.fr_date,b.to_date,(b.to_date-a.fr_date+1) into a_year_dtfr,a_year_dtto,a_days_year from period a,period b where a.code = ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and b.code = ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)); if (a_date_join between a_year_dtfr and a_year_dtto) then a_year_dtfr := a_date_join; end if; if (a_relieve_date between a_year_dtfr and a_year_dtto) then a_year_dtto := a_relieve_date; a_tag := false; end if; a_days_emp := (a_year_dtto - a_year_dtfr + 1); select nvl(sum(work_days),0) into a_work_days from attendance_mon where prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and emp_code = AS_EMP_CODE; if (a_tag = false) then a_days := 21 * (a_days_emp / a_days_year); a_days := a_days * ((a_date_to - a_date_fr + 1) / a_days_emp); else if (a_work_days >= (240*(a_days_emp / a_days_year))) then a_days := 21 * (a_days_emp / a_days_year); a_days := a_days * ((a_date_to - a_date_fr + 1) / a_days_emp); end if; end if; elsif (AS_LVE_TBLNO = 'LV012' and AS_LVE_CODE = 'PL') then a_calc_prdfr := AS_CALC_PRDFR; a_calc_prdto := AS_CALC_PRDTO; select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (to_char(a_date_join,'YYYYMM') = a_calc_prdfr) then a_calc_prdfr := (substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2); end if; if (to_char(a_relieve_date,'YYYYMM') = a_calc_prdto) then a_calc_prdto := (substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2); end if; select count(*) into a_no_months from period where code between a_calc_prdfr and a_calc_prdto; select a.fr_date,b.to_date,(b.to_date-a.fr_date+1) into a_date_fr,a_date_to,a_days_year from period a,period b where a.code = ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and b.code = ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)); if (a_date_join between a_date_fr and a_date_to) then a_date_fr := a_date_join; end if; if (a_relieve_date between a_date_fr and a_date_to) then a_date_to := a_relieve_date; end if; a_days_emp := (a_date_to - a_date_fr + 1); select nvl(sum(work_days),0) into a_work_days from attendance_mon where prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and emp_code = AS_EMP_CODE; select nvl(sum(no_days),0) into a_leave_days from empleave_summary where emp_code = AS_EMP_CODE and lve_code = 'PL' and prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and use_flag = 'C'; if ((a_work_days+a_leave_days) >= (240*(a_days_emp / a_days_year))) then select amount,type into a_amount,a_type from ad_slabs where ad_code = 'LVELG' and to_date('01/' || substr(AS_PROC_PRDFR,5,2) || '/' || substr(AS_PROC_PRDFR,1,4),'dd/mm/yyyy') between eff_date and exp_date and a_work_days between (min_base_amt*(a_days_emp / a_days_year)) and (max_base_amt*(a_days_emp / a_days_year)); if (a_type = 'P') then a_days := round(a_work_days / a_amount); elsif (a_type = 'F') then a_days := (a_amount*(a_days_emp / a_days_year)); end if; a_days := ((a_days/12)*a_no_months); end if; elsif (AS_LVE_TBLNO = 'LV007' and AS_LVE_CODE = 'PL') then a_calc_prdfr := AS_CALC_PRDFR; a_calc_prdto := AS_CALC_PRDTO; select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (to_char(a_date_join,'YYYYMM') = a_calc_prdfr) then a_calc_prdfr := (substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2); end if; if (to_char(a_relieve_date,'YYYYMM') = a_calc_prdto) then a_calc_prdto := (substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2); end if; select count(*) into a_no_months from period where code between a_calc_prdfr and a_calc_prdto; select a.fr_date,b.to_date,(b.to_date-a.fr_date+1) into a_date_fr,a_date_to,a_days_year from period a,period b where a.code = ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and b.code = ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)); if (a_date_join between a_date_fr and a_date_to) then a_date_fr := a_date_join; end if; if (a_relieve_date between a_date_fr and a_date_to) then a_date_to := a_relieve_date; end if; a_days_emp := (a_date_to - a_date_fr + 1); select nvl(sum(work_days),0) into a_work_days from attendance_mon where prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and emp_code = AS_EMP_CODE; select nvl(sum(no_days),0) into a_leave_days from empleave_summary where emp_code = AS_EMP_CODE and lve_code = 'ESIC' and prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and use_flag = 'C'; if ((a_work_days+a_leave_days) >= (240*(a_days_emp / a_days_year))) then a_days := 21*(a_days_emp / a_days_year); a_days := ((a_days/12)*a_no_months); end if; elsif (AS_LVE_TBLNO = 'LV006' and AS_LVE_CODE = 'PL') then a_calc_prdfr := AS_CALC_PRDFR; a_calc_prdto := AS_CALC_PRDTO; select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (to_char(a_date_join,'YYYYMM') = a_calc_prdfr) then a_calc_prdfr := (substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2); end if; if (to_char(a_relieve_date,'YYYYMM') = a_calc_prdto) then a_calc_prdto := (substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2); end if; select count(*) into a_no_months from period where code between a_calc_prdfr and a_calc_prdto; select a.fr_date,b.to_date,(b.to_date-a.fr_date+1) into a_date_fr,a_date_to,a_days_year from period a,period b where a.code = ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and b.code = ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)); if (a_date_join between a_date_fr and a_date_to) then a_date_fr := a_date_join; end if; if (a_relieve_date between a_date_fr and a_date_to) then a_date_to := a_relieve_date; end if; a_days_emp := (a_date_to - a_date_fr + 1); select nvl(sum(work_days),0) into a_work_days from attendance_mon where prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and emp_code = AS_EMP_CODE; select nvl(sum(no_days),0) into a_leave_days from empleave_summary where emp_code = AS_EMP_CODE and lve_code in ('PL','AL') and prd_code >= ((substr(AS_PROC_PRDFR,1,4) - 1) || substr(AS_PROC_PRDFR,5,2)) and prd_code <= ((substr(AS_PROC_PRDTO,1,4) - 1) || substr(AS_PROC_PRDTO,5,2)) and use_flag = 'C'; if ((a_work_days+a_leave_days) >= (240*(a_days_emp / a_days_year))) then select amount into a_amount from ad_slabs where ad_code = 'LVEL1' and to_date('01/' || substr(AS_PROC_PRDFR,5,2) || '/' || substr(AS_PROC_PRDFR,1,4),'dd/mm/yyyy') between eff_date and exp_date and (a_work_days+a_leave_days) between (min_base_amt*(a_days_emp / a_days_year)) and (max_base_amt*(a_days_emp / a_days_year)); a_days := (a_amount*(a_days_emp / a_days_year)); a_days := ((a_days/12)*a_no_months); end if; elsif (AS_LVE_TBLNO = 'LV025' and AS_LVE_CODE = 'SL') then -- Employee gets 5 SL in a year and he works for maximum one year only. select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; a_days_year := ((add_months(a_date_join,12)-1)-a_date_join+1); if (a_relieve_date is null) then a_relieve_date := add_months(a_date_join,12) - 1; end if; if (a_relieve_date > (add_months(a_date_join,12) - 1)) then a_relieve_date := add_months(a_date_join,12) - 1; end if; select a.fr_date,b.to_date into a_date_fr,a_date_to from period a,period b where a.code = AS_PROC_PRDFR and b.code = AS_PROC_PRDTO; if (a_date_join between a_date_fr and a_date_to) then -- This part calculates partial leave for 1st year if (a_relieve_date > a_date_to) then a_relieve_date := a_date_to; end if; a_days := round(5/a_days_year * (a_relieve_date-a_date_join+1)); select count(*) into a_no_months from period where code between AS_CALC_PRDFR and AS_CALC_PRDTO; select count(*) into a_no_months1 from period where code between to_char(a_date_join,'YYYYMM') and to_char(a_relieve_date,'YYYYMM'); a_days := (a_days / a_no_months1 * a_no_months); elsif (a_relieve_date between a_date_fr and a_date_to) then -- This part calculates partial leave for 2nd year a_days := round(5/a_days_year * (a_relieve_date-a_date_join+1)) - round(5/a_days_year * (a_date_fr-a_date_join)); select count(*) into a_no_months from period where code between AS_CALC_PRDFR and (case when to_char(a_relieve_date,'YYYYMM') < AS_CALC_PRDTO then to_char(a_relieve_date,'YYYYMM') else AS_CALC_PRDTO end); select count(*) into a_no_months1 from period where code between to_char(a_date_fr,'YYYYMM') and to_char(a_relieve_date,'YYYYMM'); a_days := (a_days / a_no_months1 * a_no_months); end if; elsif ((AS_LVE_TBLNO = 'LV001' or AS_LVE_TBLNO = 'LV021' or AS_LVE_TBLNO = 'LV022') and AS_LVE_CODE = 'PL') then a_date_fr := to_date(AS_CALC_DTFR,'yyyy-mm-dd'); a_date_to := to_date(AS_CALC_DTTO,'yyyy-mm-dd'); a_year_dtfr := to_date('01-'||substr(AS_PROC_PRDFR,5,2)||'-'||(substr(AS_PROC_PRDFR,1,4)-1),'dd-mm-yyyy'); select (fr_date-1) into a_year_dtto from period where code = AS_PROC_PRDFR; -- This part calculates no of days in a year excluding weekly off/holiday a_days_year := 0; for i in 1..(a_year_dtto-a_year_dtfr+1) loop a_date := a_year_dtfr+i-1; a_tag := true; a_hol_tblno := ddf_get_holtblno(AS_EMP_CODE,a_date); select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = a_date; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = a_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 = 0) then a_tag := false; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = a_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 <> 0) then a_tag := false; end if; if (a_tag = true) then a_days_year := a_days_year + 1; end if; end loop; -- This part calculates no of days in the process period exlcuding weekly off/holiday. Also paid days excluding -- weekly off/holiday a_days_emp := 0; for i in 1..(a_date_to-a_date_fr+1) loop a_date := a_date_fr+i-1; a_tag := true; a_hol_tblno := ddf_get_holtblno(AS_EMP_CODE,a_date); select count(*) into a_count from holiday where hol_tblno = a_hol_tblno and hol_date = a_date; if (a_count <> 0) then select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_for = a_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 = 0) then a_tag := false; end if; end if; select count(*) into a_count1 from change_holiday where emp_code = AS_EMP_CODE and hol_date_to = a_date and hol_type in ('H','W') and confirmed = 'Y'; if (a_count1 <> 0) then a_tag := false; end if; if (a_tag = true) then a_days_emp := a_days_emp + 1; select nvl(sum(paid_days),0) into a_paid_days from attd_reg where emp_code = AS_EMP_CODE and attd_date = a_date; a_year_pd := a_year_pd + a_paid_days; end if; -- This part deducts maternity leave from paid days. declare cursor c1 is select lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and a_date between lve_date_fr and lve_date_to and lve_code = 'ML' and status = 'A' and use_flag = 'C' order by lve_date_fr,lve_date_to; begin for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> a_date and i.lve_date_to <> a_date) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = a_date and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = a_date and i.leave_ends = 'E') then a_year_pd := a_year_pd - 1; else a_year_pd := a_year_pd - 0.5; end if; end loop; end; end loop; a_days := round(((21 * a_days_emp / a_days_year) * a_year_pd / a_days_emp),2); elsif (AS_LVE_TBLNO = 'LV018' and AS_LVE_CODE = 'FSZ') then a_date_fr := to_date(AS_CALC_DTFR,'yyyy-mm-dd'); a_date_to := to_date(AS_CALC_DTTO,'yyyy-mm-dd'); a_days_emp := (a_date_to - a_date_fr + 1); a_date := trunc(sysdate); select b.fr_date,a.to_date,(a.to_date-b.fr_date+1) into a_year_dtfr,a_year_dtto,a_days_year from period a,period b where a.code = AS_PROC_PRDTO and b.code = AS_PROC_PRDFR; if (a_date > a_year_dtto) then a_date := a_year_dtto; end if; select relieve_date,birth_date into a_relieve_date,a_birth_date from employee where emp_code = AS_EMP_CODE; if (a_date > a_relieve_date) then a_date := a_relieve_date; end if; -- a_count := trunc(months_between(a_date,a_birth_date)/12); AS per Hungrian they are calculating age based on year and not exact date. a_count := (to_char(a_date,'YYYY')-to_char(a_birth_date,'YYYY')); select nvl(sum(amount),0) into a_amount from ad_slabs where ad_code = 'LVELH' and a_date between eff_date and exp_date and a_count between min_base_amt and max_base_amt; a_days := a_amount; -- Below query changed by Edit on 11-Nov-2010 select count(ef.emp_code) into a_count from empfamily ef,employee_ad ea where ef.emp_code = AS_EMP_CODE and ef.relation in ('DAUGHTER','SON') and trunc(months_between(a_year_dtto,ef.date_birth)/12) <= 16 and ea.ad_code = 'LVEH1' and a_year_dtfr between ea.eff_date and ea.exp_date and ea.emp_code = AS_EMP_CODE; select nvl(sum(amount),0) into a_amount from ad_slabs where ad_code = 'LVEH1' and a_year_dtfr between eff_date and exp_date and a_count between min_base_amt and max_base_amt; a_days := a_days + a_amount; -- Below part changed by Edit on 11-Nov-2010, earlier there was daywise checking in employee_ad. select count(*) into a_count from employee_ad where emp_code = AS_EMP_CODE and ad_code = 'LVEH2' and a_date_fr between eff_date and exp_date; if (a_count <> 0) then select nvl(sum(amount),0) into a_amount from ad_slabs where ad_code = 'LVEH2' and a_date_fr between eff_date and exp_date; a_days := a_days + a_amount; end if; -- Below part changed by Istvan on 22-Feb-2011 -- a_days := trunc((a_days * (a_days_emp / a_days_year))); a_days := round((a_days * (a_days_emp / a_days_year))); elsif (AS_LVE_TBLNO = 'LV030' and AS_LVE_CODE = 'PL') then a_date_fr := to_date(AS_CALC_DTFR,'yyyy-mm-dd'); a_date_to := to_date(AS_CALC_DTTO,'yyyy-mm-dd'); a_year_dtfr := to_date('01-'||substr(AS_PROC_PRDFR,5,2)||'-'||(substr(AS_PROC_PRDFR,1,4)-1),'dd-mm-yyyy'); select (fr_date-1) into a_year_dtto from period where code = AS_PROC_PRDFR; -- This part calculates no of days in a year. a_days_year := (a_year_dtto-a_year_dtfr+1); -- This part calculates no of days in the process period. a_days_emp := a_date_to-a_date_fr+1; a_days := round((21 * a_days_emp / a_days_year),2); end if; if (a_days = 0) then a_days := -0.01; end if; return round(a_days,2); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PRICELIST_SYMBOL (as_pricelist char,as_lotno char,as_itemcode char) return varchar2 is ls_sym varchar2(20); ls_var varchar2(20); ls_chgref varchar2(50); begin select chg_ref_no into ls_chgref from pricelist where price_list =as_pricelist and pricelist.item_code = as_itemcode and (as_lotno between pricelist.lot_no__from and pricelist.lot_no__to) ; select var_value into ls_var from disparm where var_name = 'PRICELIST_STATUS'; if ls_chgref = 'MRP' and ls_var = 'Y' then ls_sym :='#'; else ls_sym := ' '; end if; return ls_sym; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ISRUSSIA_VAL (AS_USER_ID CHAR) return varchar2 IS AS_PARAM_VAL varchar2(1):='N'; AS_SITE_CODE__DEF CHAR(5); AS_ITEM_SER CHAR(5); BEGIN BEGIN SELECT SITE_CODE__DEF INTO AS_SITE_CODE__DEF FROM USERS WHERE CODE = AS_USER_ID; SELECT SALES_PERS.ITEM_SER INTO AS_ITEM_SER FROM ITEMSER,SALES_PERS WHERE ( ITEMSER.ITEM_SER = SALES_PERS.ITEM_SER(+) ) AND SALES_PERS.SALES_PERS = AS_USER_ID; SELECT PARM_VALUE into AS_PARAM_VAL FROM SFAPARM WHERE ORG_UNIT =AS_SITE_CODE__DEF || '_' || AS_ITEM_SER AND ACTIVE='Y' AND PARM_NAME='IS_RUSSIA' ; EXCEPTION WHEN NO_DATA_FOUND THEN AS_PARAM_VAL:='N'; END; return AS_PARAM_VAL; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ACCOUNTS_CCTR_CCTR_ACCT ON ACCOUNTS_CCTR (CCTR_CODE, ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WORKORDER_ISS_TRAN_ID (as_SiteCd workorder_iss.site_code%type, as_work_order_fr workorder_iss.work_order%type, as_work_order_to workorder_iss.work_order%type, as_tran_id_fr workorder_iss.tran_id%type, as_tran_id_to workorder_iss.tran_id%type, mdate_from workorder_iss.tran_date%type, mdate_to workorder_iss.tran_date%type ) return varchar2 is ls_tran_id_all nvarchar2(4000); cursor cur_tran_id is select trim(c.tran_id) tran_id from workorder a, workorder_iss c WHERE a.work_order = c.work_order and a.site_code = as_SiteCd and c.tran_type = 'I'--:mtran_type and a.status = 'R' and c.confirmed <> 'Y' and a.work_order >= as_work_order_fr and a.work_order <= as_work_order_to and c.tran_id >= as_tran_id_fr and c.tran_id <= as_tran_id_to and c.tran_date between mdate_from and mdate_to; i cur_tran_id%rowtype; begin open cur_tran_id; fetch cur_tran_id into i ; while(cur_tran_id%found) loop ls_tran_id_all:=ls_tran_id_all || ' '|| i.tran_id|| ','; fetch cur_tran_id into i ; end loop; ls_tran_id_all:=substr(ls_tran_id_all,1,length(ls_tran_id_all)-1); close cur_tran_id; return ls_tran_id_all; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CENVAT_ITEM (lporcp_id in char,ltype in char) return varchar is ls_val varchar(150); ld_itemdet_qty number(14,3); ls_item varchar(150); ls_tax_chap varchar(10); ls_line char(3); ls_tran_type char(3); begin select max(quantity), line_no into ld_itemdet_qty, ls_line from porcpdet where porcpdet.tran_id = lporcp_id and rownum = 1 group by line_no ; select item.descr, item.tax_chap__rep into ls_item, ls_tax_chap from porcpdet, item where porcpdet.tran_id = lporcp_id and porcpdet.item_code = item.item_code and line_no = ls_line and quantity = ld_itemdet_qty ; if UPPER(ltype) = 'Q' then ls_val := to_char(ld_itemdet_qty) ; elsif UPPER(ltype) = 'D' then ls_val := ls_item ; elsif UPPER(ltype) = 'T' then ls_val := ls_tax_chap ; elsif UPPER(ltype) = 'N' then select tran_type into ls_tran_type from porcp where tran_id = lporcp_id ; if ltrim(rtrim(ls_tran_type)) = 'I' then ls_val := 'BOE' ; else ls_val := 'INV' ; end if ; end if ; return ls_val ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX POAMD_HDR_PURC_ORD_CONF ON POAMD_HDR (PURC_ORDER, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 36700160 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETBANKTRANDATE ( lssitecode in CHAR, lstranser in CHAR, lstranno in CHAR ) return date is ldt_trandate date; begin select tran_date into ldt_trandate from banktran_log where site_code = lssitecode and (tran_ser = lstranser or tran_ser is null) and tran_no = lstranno ; return ldt_trandate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MAX_RCP_INV (ls_refser in char , ls_refno in char ) return char is ls_rcpno char(10) ; begin select max(rcpdet.tran_id) into ls_rcpno from receipt, rcpdet where receipt.tran_id = rcpdet.tran_id and rcpdet.ref_ser = ls_refser and rcpdet.ref_no = ls_refno and confirmed = 'Y' ; return ls_rcpno ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INCQTR1_X ON INCQTR1 (LEVEL_CODE, LEVEL_CODE__PARENT, QTR, PROC_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_MDRCRC AFTER UPDATE OF CONFIRMED ON MISC_DRCR_RCP REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ls_transer char(6); lc_taxamt number(14,3) := 0; ll_reasoncnt number := 0; ls_reasoncode char(1); ll_sreturncnt number := 0; ls_einv_gen_flag char(1); ls_var_value varchar2(30); ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN --IF :old.confirmed = 'N' and :new.confirmed = 'Y' and :new.drcr_flag = 'D' THEN -- IF ((:old.confirmed = 'N' and :new.confirmed = 'Y' and :new.drcr_flag = 'D' ) or (:old.reproc_count <> :new.reproc_count and :new.confirmed = 'Y' and :new.drcr_flag = 'D' ) ) begin select sum(tax_amt) into lc_taxamt from misc_drcr_rdet where tran_id = :new.tran_id; exception when others then lc_taxamt := 0; end; -- begin -- SELECT COUNT(SR.STATUS) into ll_reasoncnt FROM SRETURN_REASON SR, SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE; -- if(ll_reasoncnt > 0) -- then -- SELECT SR.STATUS into ls_reasoncode FROM SRETURN_REASON SR,SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE AND ROWNUM = 1; -- else -- ls_reasoncode := 'X'; -- end if; -- end; begin if :new.sreturn_no is not null and length(trim(:new.sreturn_no)) > 0 then SELECT COUNT(RET.TRAN_TYPE) into ll_sreturncnt FROM SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no; SELECT count(*) into ls_var_value FROM disparm where var_name = 'EXCLUDE_EINV_SR_TRAN_TYPE' and length(trim(var_value)) > 0; if(ll_sreturncnt > 0 and ls_var_value > 0 ) then select case when ( select count(*) from sreturn where tran_id = :new.sreturn_no and tran_type in ( WITH input_data AS (SELECT var_value FROM disparm where var_name = 'EXCLUDE_EINV_SR_TRAN_TYPE') SELECT REGEXP_SUBSTR(var_value, '[^,]+', 1, level) AS value FROM input_data CONNECT BY REGEXP_SUBSTR(var_value, '[^,]+', 1, level) IS NOT NULL AND PRIOR var_value = var_value AND PRIOR SYS_GUID() IS NOT NULL)) > 0 then 'N' else 'Y' end into ls_einv_gen_flag from dual; else -- ls_einv_gen_flag := 'Y'; begin SELECT COUNT(SR.STATUS) into ll_reasoncnt FROM SRETURN_REASON SR, SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE; if(ll_reasoncnt > 0) then SELECT (case when SR.STATUS not in ('D','E') then 'Y' else 'N' end) into ls_einv_gen_flag FROM SRETURN_REASON SR,SRETURN RET WHERE RET.TRAN_ID = :new.sreturn_no AND RET.REAS_CODE = SR.REASON_CODE AND ROWNUM = 1; else ls_einv_gen_flag := 'Y'; end if; end; end if; else ls_einv_gen_flag := 'Y'; end if; end; --IF ((:old.confirmed = 'N' and :new.confirmed = 'Y' ) or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y' ) ) --IF lc_taxamt <> 0 and ls_reasoncode <> 'D' and ls_reasoncode <> 'E' and ((:old.confirmed = 'N' and :new.confirmed = 'Y' ) or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y' ) ) IF lc_taxamt <> 0 and ls_einv_gen_flag <> 'N' and ((:old.confirmed = 'N' and :new.confirmed = 'Y' ) or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y' ) ) THEN begin if :new.drcr_flag = 'D' then ls_transer := 'MDRCRD'; else ls_transer := 'MDRCRC'; end if; delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser = ls_transer and ref_id = :new.tran_id); delete from e_invoice where ref_ser = ls_transer and ref_id = :new.tran_id; select count(1) into ll_count from e_invoice where ref_ser = ls_transer and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, Tran_code, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, round_adj, site_code ) SELECT ls_seq as tran_id, :new.TRAN_DATE AS TRAN_DATE, :new.tran_type as tran_type, buyer.einv_reqd as einv_opt, ls_transer as REF_SER, :new.tran_id as REF_ID, :new.TRAN_DATE as REF_DATE, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, :new.site_code SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_ship, seller.descr trade_name_ship, seller.descr legal_name_ship, seller.ADD1 add1_ship, seller.ADD2 add2_ship, seller.CITY city_ship, seller.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_ship, seller.TELE1 tele_ship, seller.EMAIL_ADDR email_id_ship, :new.SUNDRY_CODE CUST_CODE, (SELECT tax_reg_2 FROM customer WHERE cust_code=buyer.cust_code ) gstn_buy, buyer.cust_name trade_name_buy, buyer.cust_name legal_name_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.city city_buy, buyer.state_code state_code__buy, buyer.drug_lic_no drug_lic_no_buy, buyer.pin pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.tele1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.sundry_code CUST_CODE__BIL, :new.sundry_code CUST_CODE__DLV, buyer.cust_name name_dlv, buyer.ADDR1 add1_dlv, buyer.ADDR2 add2_dlv, buyer.pin pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_dlv, buyer.state_code state_code__dlv, buyer.drug_lic_no drug_lic_no_dlv, round((SELECT SUM(amount) FROM MISC_DRCR_RDET WHERE TRAN_ID=:new.TRAN_ID and NVL(tax_amt,0) <> 0 ) ,2) INV_AMT, --round((SELECT SUM(amount) FROM MISC_DRCR_RDET WHERE TRAN_ID=:new.TRAN_ID AND TAX_AMT IS NOT NULL ) --+ nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=:new.tran_id --and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C')) and tax_perc > 0 and tax_amt > 0),0),2) as NET_AMT, --round((SELECT SUM(amount) FROM MISC_DRCR_RDET WHERE TRAN_ID=:new.TRAN_ID ) ,2) as NET_AMT, round((SELECT SUM(NET_AMT) FROM MISC_DRCR_RDET WHERE TRAN_ID=:new.TRAN_ID and NVL(tax_amt,0) <> 0 ) ,2) as NET_AMT, round((SELECT SUM (CASE WHEN NET_AMT IS NULL THEN 0 ELSE NET_AMT END) - SUM(CASE WHEN TAX_AMT IS NULL THEN 0 ELSE TAX_AMT END) FROM MISC_DRCR_RDET WHERE TRAN_ID=:new.TRAN_ID ),2) AS ASSESABLE_VALUE, 0 AS DISC_AMT, '' as ORDER_NO, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = ls_transer and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='I') AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS IGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = ls_transer and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='H') AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS CGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = ls_transer and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='G') AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS SGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code =ls_transer and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='J')AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS CESS_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = ls_transer and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE in('K','C')) AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS OTHER_AMT, 'N' proc_stat, sysdate proc_date, 'P' resp_stat, --0 distance, (select nvl(distance,0) from site_customer where site_code = :new.site_code and cust_code = :new.sundry_code) as distance, null Trans_Mode, null Tran_code, null lr_date, null lr_no, null lorry_no, '' Vehicle_Type, null DOC_NO, null DOC_DATE, round(:new.round_adj,2) round_adj, :new.site_code site_code FROM --MISC_DRCR_RCP INV, customer buyer, site seller WHERE seller.site_code = :new.site_code and buyer.cust_code = :new.sundry_code; --and inv.DRCR_FLAG = 'C' --and INV.tran_ID= :new.tran_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, --and i.lot_no = it.lot_no --and i.item_code = it.item_code MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.ITEM_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, '' AS LINE_TYPE, round(it.AMOUNT,2) as INV_AMT, --round(it.AMOUNT,2) as ASS_AMT, round((it.AMOUNT) +(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) as ASS_AMT, round(0 + (nvl((select sum(-1 * tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) AS DISCOUNT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0),2) as IGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0),2) as CGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0),2) as SGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0),2) as CESS_AMT, round(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in('K','C')) and tax_perc > 0 and tax_amt > 0),0),2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=it.unit ) AS UNIT, it.quantity AS QUANTITY, it.RATE AS RATE, item.hsn_no AS HSN_CODE, --it.LOT_NO as LOT_NO, 'NOT-APPLICABLE' as LOT_NO, null as EXP_DATE, null as MFG_DATE, round(it.amount + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=:new.tran_id and taxtran.line_no = lpad(to_char(it.line_no),3,' ') and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C')) and tax_perc > 0 and tax_amt > 0),0),2) as TOT_ITEM_VAL, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate(ls_transer,it.tran_id, it.line_no) as GST_RATE, (select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code and item.item_ser = itemser.item_ser and rownum =1 ) as service_yn FROM MISC_DRCR_RDET it, item --,item_lot_info i WHERE item.item_code= it.item_code --and i.lot_no = it.lot_no --and i.item_code = it.item_code AND it.tran_id = :new.tran_id union all SELECT ls_seq as tran_id, it.line_no AS LINE_NO, i.sac_no as ITEM_CODE , i.DESCR as ITEM_DESC, '' AS LINE_TYPE, round(it.AMOUNT,2) as INV_AMT, --round(it.AMOUNT,2) as ASS_AMT, round((it.AMOUNT) +(nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) as ASS_AMT, round(0 + (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) AS DISCOUNT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0),2) as IGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0),2) as CGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0),2) as SGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0),2) as CESS_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in('K','C')) and tax_perc > 0 and tax_amt > 0),0),2) as OTHER_AMT, 'OTH' AS UNIT, 1 AS QUANTITY, it.amount AS RATE, i.sac_no AS HSN_CODE, 'NOT-APPLICABLE' as LOT_NO, null as EXP_DATE, null as MFG_DATE, round(it.amount + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = ls_transer and taxtran.tran_id=:new.tran_id and taxtran.line_no = lpad(to_char(it.line_no),3,' ') and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C')) and tax_perc > 0 and tax_amt > 0),0),2) as TOT_ITEM_VAL, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt(ls_transer,it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate(ls_transer,it.tran_id, it.line_no) as GST_RATE, 'Y' service_yn FROM MISC_DRCR_RDET it, accounts i WHERE i.acct_code= it.acct_code and i.sac_no is not null and it.item_code is null and nvl(it.net_amt, 0) <> 0 AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin update e_invoice set INV_AMT = (select sum(inv_amt) from e_invoice_det where tran_id = ls_seq), ASSESABLE_VALUE = (select sum(ass_amt) from e_invoice_det where tran_id = ls_seq) where tran_id = ls_seq; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able update e_invoice table with total of details errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPRS_RETAILER_X ON SPRS_RETAILER (SALES_PERS, RETAILER_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_ALLOCATE_SITE_ITEM_STATUS ON INV_ALLOCATE (SITE_CODE, ITEM_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DOC_TYPE (ls_ref_ser char,ls_ref_id char,ls_tran_id char) RETURN char is doc_type char(20); as_tax_amt number(14,3); --as_tran_type char(5); as_order_type consume_ord.order_type%type; as_disp_tran_type char(10); val number; li_row_count NUMBER; begin li_row_count:=0; as_tax_amt:=0; if rtrim(ls_ref_ser) = 'S-INV' then select tax_amt into as_tax_amt from invoice where invoice_id=ls_ref_id; if as_tax_amt>0 then select var_value into doc_type from disparm where var_name='EWAY_TI_DOC' and prd_code='999999'; else select var_value into doc_type from disparm where var_name='EWAY_BOS_DOC' and prd_code='999999'; end if; end if; --for dis-issue if rtrim(ls_ref_ser) = 'D-ISS' then select tax_amt into as_tax_amt from distord_iss where tran_id=ls_tran_id; --return as_tax_amt || '>>' || ls_ref_id; select var_value into as_disp_tran_type from disparm where var_name='PROMO_ORDER_TYPE' and prd_code='999999'; select count(1) into li_row_count from distorder where dist_order=ls_ref_id; IF li_row_count > 0 THEN select tran_type into as_order_type from distorder where dist_order=ls_ref_id; END IF; if as_tax_amt>0 then --return as_tax_amt; select var_value into doc_type from disparm where var_name='EWAY_TI_DOC' and prd_code='999999'; end if; if as_tax_amt=0 then select instr(','||trim(as_disp_tran_type)||',',','||trim(as_order_type)||',') into val from dual; if (val > 0) then select var_value into doc_type from disparm where var_name='EWAY_BOS_DOC' and prd_code='999999'; --end if; else --if instr(','||as_disp_tran_type||',',','||as_order_type||',') <= 0 then select var_value into doc_type from disparm where var_name='EWAY_DC_DOC' and prd_code='999999'; end if; end if; end if; --for cons-iss if rtrim(ls_ref_ser) = 'C-ISS' then select tax_amt into as_tax_amt from consume_iss where cons_order=ls_ref_id and cons_issue=ls_tran_id; select trim(var_value) into as_disp_tran_type from disparm where var_name='PROMO_ORDER_TYPE_ISS' and prd_code='999999'; select count(1) into li_row_count from consume_ord where cons_order=ls_ref_id; if li_row_count > 0 then select trim(order_type) into as_order_type from consume_ord where cons_order=ls_ref_id; end if; if as_tax_amt>0 then select var_value into doc_type from disparm where var_name='EWAY_TI_DOC' and prd_code='999999'; end if; if as_tax_amt=0 then select instr(','||trim(as_disp_tran_type)||',',','||trim(as_order_type)||',') into val from dual; --return val ||'>>' ||trim(as_order_type) || '>>' ||trim(as_disp_tran_type); if (val > 0) then select var_value into doc_type from disparm where var_name='EWAY_BOS_DOC' and prd_code='999999'; --end if; ELSE --if (instr(','||as_disp_tran_type||',',','||as_order_type||',') <= 0) then select var_value into doc_type from disparm where var_name='EWAY_DC_DOC' and prd_code='999999'; end if; end if; end if; --for per-ret if rtrim(ls_ref_ser) = 'P-RET' then select tax into as_tax_amt from porcp where tran_id=ls_ref_id; select var_value into as_disp_tran_type from disparm where var_name='PROMO_ORDER_TYPE_RET' and prd_code='999999'; select count(1) into li_row_count from porcp where tran_id=ls_ref_id; if li_row_count>0 then select tran_type into as_order_type from porcp where tran_id=ls_ref_id and TRAN_SER='P-RET'; end if; if as_tax_amt>0 then select var_value into doc_type from disparm where var_name='EWAY_TI_DOC' and prd_code='999999'; end if; if as_tax_amt=0 then select instr(','||trim(as_disp_tran_type)||',',','||trim(as_order_type)||',') into val from dual; if (val > 0) then select var_value into doc_type from disparm where var_name='EWAY_BOS_DOC' and prd_code='999999'; else -- if instr(','||as_disp_tran_type||',',','||as_order_type||',') <= 0 then select var_value into doc_type from disparm where var_name='EWAY_DC_DOC' and prd_code='999999'; end if; end if; end if; return doc_type; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_ZONE_DESCR (marea_code in char) return char is mregion_code char(5); mzone_code char(5); mzone_descr varchar2(40); begin select level_code__parent into mregion_code from hierarchy where level_code = marea_code; select level_code__parent into mzone_code from hierarchy where level_code = mregion_code; select level_descr into mzone_descr from hierarchy where level_code = mzone_code; return mzone_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DPLIST_ITEM_LOT ON DUMMY_PLIST (PRICE_LIST, ITEM_CODE, LIST_TYPE, EFF_FROM, VALID_UPTO, LOT_NO__FROM, LOT_NO__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MISC_VOUCH_DET (as_tranid in char) return number is ll_pamt number(15,3); begin select sum(misc_paydet.pay_amt) into ll_pamt from misc_paydet,misc_payment where misc_paydet.tran_id = misc_payment.tran_id and misc_payment.CONFIRMED = 'Y' and misc_paydet.vouch_no = as_tranid; return ll_pamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PBSYSCATPBT_IDX ON PBCATTBL (PBT_TNAM, PBT_OWNR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIPT_SITE_BK_EDT_BTNO ON RECEIPT (SITE_CODE, BANK_CODE, EFF_DATE, ENTRY_BATCH_NO, TRAN_ID, RCP_MODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION INVTRC_EFF_QTY_LOTS (MSITE IN CHAR, MTRAN_DATE IN DATE, MLOT_NO IN CHAR, MLOT_SL IN CHAR) RETURN NUMBER IS MEFF_QTY NUMBER := 0; BEGIN SELECT NVL(SUM(EFF_QTY), 0) INTO MEFF_QTY FROM INVTRACE WHERE SITE_CODE = MSITE AND TRAN_DATE > MTRAN_DATE AND LOT_NO = MLOT_NO AND LOT_SL = MLOT_SL and ref_ser not in('I-PKI','I-PKR','R-BFS','QC-ORD','XFRX'); RETURN MEFF_QTY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_MAX_SLAB_RATE (as_price_list in char, ad_tran_date in date, as_item_code in char) return number is mrate number(14,3); mSlabNo number(14,3); ls_type char(1); begin select max(slab_no) into mSlabNo from pricelist where price_list = as_price_list and item_code = as_item_code and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; select NVL(max(rate),0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and slab_no= mSlabNo; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_SITE_DEPT__HOD ON SITE_DEPT__HOD (ROLE_CODE, SITE_CODE, DEPT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX QUAL_COMPLAINT_COMP_DATE ON QUAL_COMPLAINT (COMP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_VALUE (as_ref_ser in char, as_ref_id in char) return number as lc_value number(14,2); begin if as_ref_ser = 'P-RCP' then select nvl(amount,0) * nvl(exch_rate,1) into lc_value from porcp where tran_id = as_ref_id; elsif as_ref_ser = 'D-RCP' then select nvl(net_amt,0) * nvl(exch_rate,1) into lc_value from distord_rcp where tran_id = as_ref_id; elsif as_ref_ser = 'S-RET' then select sum(net_amt) into lc_value from sreturndet where tran_id = as_ref_id and ret_rep_flag = 'R'; end if; return(lc_value); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CUST_RCP_OUTST (as_cust_cd in char,as_site_fr in char,as_site_to in char,as_date_fr in date,as_date_to in char ,as_flag in char) return number is ret_val number(14,3); begin if(as_flag='R') then select sum(rcp) into ret_val from ( SELECT SUM(NVL(DDF_RECV_CUSTADV(as_cust_cd,as_date_fr,as_date_TO,SITE_CODE,'R'),0)) * -1 rcp FROM SITE WHERE SITE_CODE >= as_site_fr AND SITE_CODE <= as_site_to UNION ALL select sum(nvl(rcpdet.rcp_amt,0)) rcp from receipt,rcpdet where (RECEIPT.TRAN_ID = RCPDET.TRAN_ID) and (receipt.cust_code = as_cust_cd ) and (receipt.site_code >= as_site_fr) and (receipt.site_code <= as_site_to) and (receipt.tran_date >= as_date_fr) and (receipt.tran_date <= as_date_to) and (receipt.confirmed = 'Y' ) union all select sum(nvl(RCPADV.ADJ_AMT,0)) rcp from RCPADV,receipt where (rcpadv.TRAN_ID = RECEIPT.TRAN_ID) and (receipt.cust_code = as_cust_cd ) and (receipt.site_code >= as_site_fr) and (receipt.site_code <= as_site_to) and (receipt.tran_date >= as_date_fr) and (receipt.tran_date <= as_date_to) and (receipt.confirmed = 'Y' ) ); elsif(as_flag='D') then select sum(rcpdish) into ret_val from ( SELECT SUM(NVL(DDF_RECV_CUSTADV(as_cust_cd,as_date_fr,as_date_TO,SITE_CODE,'D'),0)) * -1 rcpdish FROM SITE WHERE SITE_CODE >= as_site_fr AND SITE_CODE <= as_site_to UNION ALL SELECT SUM(NVL(PAYDET_EXP.AMOUNT,0)) rcpdish FROM PAYMENT_EXP, PAYDET_EXP WHERE (PAYMENT_EXP.TRAN_ID = PAYDET_EXP.TRAN_ID ) AND (PAYMENT_EXP.sundry_code = as_cust_cd) and (PAYMENT_EXP.sundry_TYPE = 'C' ) and (PAYMENT_EXP.tran_date >= as_date_fr) and (PAYMENT_EXP.tran_date <= as_date_to) and (PAYMENT_EXP.site_code >= as_site_fr) and (PAYMENT_EXP.site_code <= as_site_to) and (PAYMENT_EXP.confirmed = 'Y') UNION ALL select sum(nvl(RCPDISHNR_DET.RCP_AMT,0)) rcpdish from rcpdishnr,RCPDISHNR_DET where (RCPDISHNR.TRAN_ID = RCPDISHNR_DET.TRAN_ID) and (rcpdishnr.cust_code = as_cust_cd) and (rcpdishnr.tran_date >= as_date_fr) and (rcpdishnr.tran_date <= as_date_to) and (rcpdishnr.site_code >= as_site_fr) and (rcpdishnr.site_code <= as_site_to) and rcpdishnr.confirmed = 'Y' ); else select sum(nvl(fdf_recv_report_fld1( receivables.tran_ser, receivables.ref_no, as_date_FR , receivables.tot_amt - receivables.adj_amt, receivables.site_code ),0)) into ret_val from receivables where (receivables.tran_date <= as_date_FR ) and (receivables.site_code >= as_site_fr ) and (receivables.site_code <= as_site_to ) and (receivables.cust_code = as_cust_cd); end if; return ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LVESTSDESCR (VI_STATUS IN CHAR, VI_WRKFLW_STATUS IN CHAR , VI_TRANID IN VARCHAR ) RETURN VARCHAR2 IS L_STATUS VARCHAR2(30); li_cnt number; li_cnt1 number; li_cnt2 number; li_hr_cnt number; VI_TRANID1 varchar2(50); vi_sign_status char(1); ls_auth_sign char(1); ls_entry_by char(1); ls_auth_emp char(10); ls_auth_emp_alternate char(10); ls_lve_code char(5); lc_no_days number(14,3); ls_emp_code char(10); ls_use_flag char(1); BEGIN VI_TRANID1 := trim(VI_TRANID); ls_auth_sign := ''; ls_entry_by := ''; li_cnt := 0; li_cnt1 := 0; li_cnt2 := 0; ls_auth_emp := ''; ls_auth_emp_alternate := ''; ls_lve_code := ''; lc_no_days := 0; li_hr_cnt := 0; if ( Vi_Status = 'A' ) then return 'Approved'; elsif ( Vi_Status = 'C' ) then -- if VI_WRKFLW_STATUS = 'X' then -- Remarked and modified bellow by Piyush on 29/10/2014 for taking care when action taken from Metis ERP if (VI_WRKFLW_STATUS = 'X' or VI_WRKFLW_STATUS = 'Z') then return 'Cancelled'; else return 'Rejected'; end if; else select nvl(auth_sign , ' '), nvl(entry_by,' '), auth_emp, auth_emp_alternate, lve_code , no_days , emp_code , use_flag into ls_auth_sign, ls_entry_by, ls_auth_emp, ls_auth_emp_alternate, ls_lve_code, lc_no_days , ls_emp_code , ls_use_flag from empleave where tran_id = VI_TRANID; if ls_auth_sign = 'R' then select count(1) into li_cnt from obj_sign_trans where ref_ser in ('E-LVF','E-LVN','E-LVE') and ref_id = VI_TRANID1 And Role_Code__Sign = 'RECOMEN' ; if li_cnt > 0 then select sign_status into vi_sign_status from obj_sign_trans Where Ref_Ser In ('E-LVF','E-LVN','E-LVE') And Ref_Id = Vi_Tranid1 And Role_Code__Sign = 'RECOMEN' and rownum = 1 order by line_no desc; if vi_sign_status = 'U' then return 'Pending from Recommender'; elsif vi_sign_status = 'R' then if ls_entry_by <> 'F' then return 'Rejected'; end if; end if; else return 'Pending from Recommender'; end if; end if; li_cnt := 0; li_cnt1 := 0; li_cnt2 := 0; if ls_auth_sign = 'A' or (ls_auth_sign = 'R' and ls_auth_emp <> ls_auth_emp_alternate) then select count(1) into li_cnt from obj_sign_trans Where Ref_Ser In ('E-LVF','E-LVN','E-LVE') And Ref_Id = Vi_Tranid1 And Role_Code__Sign = 'APPROV' ; if li_cnt > 0 then select sign_status into vi_sign_status from obj_sign_trans Where Ref_Ser In ('E-LVF','E-LVN','E-LVE') And Ref_Id = Vi_Tranid1 And Role_Code__Sign = 'APPROV' and rownum = 1 order by line_no desc ; if vi_sign_status = 'U' then return 'Pending from Approver'; elsif vi_sign_status = 'R' then return 'Rejected'; end if; else return 'Pending from Approver'; end if; end if; ls_lve_code := trim(ls_lve_code); li_cnt := 0; li_cnt1 := 0; li_cnt2 := 0; -- Modified by Piyush on 08/05/2015 [To identify HR approval].Start li_hr_cnt := 0; select count(*) into li_hr_cnt from ( select substr(par_value,(instr(par_value,',',1,level) + 1),(instr(par_value,',',1,level + 1) - instr(par_value,',',1,level) - 1)) details from ( select ',' || hrapr || ',' par_value from ( select ddf_hr_site_env_value(ls_emp_code,trunc(sysdate),'LEAVE_HR_APR') hrapr from dual ) where hrapr != '[NOTAPPLICABLE]' ) connect by level <= length(par_value) - length(replace(par_value,',','')) - 1 ) where regexp_substr(details,'[^:]+',1,1) = ls_lve_code and lc_no_days >= regexp_substr(details,'[^:]+',1,2) and regexp_substr(details,'[^:]+',1,3) = ls_use_flag; if li_hr_cnt is null or li_hr_cnt = 0 then select count(1) into li_hr_cnt from obj_sign_trans where ref_ser in ('E-LVF','E-LVN','E-LVE') and ref_id = VI_TRANID1 And Role_Code__Sign in('HRP','HRPF','HRP2') ; if li_hr_cnt is null then li_hr_cnt := 0; end if; end if; -- Modified by Piyush on 08/05/2015 [To identify HR approval].End -- Modified by Piyush on 05/02/2015.Start -- if ls_auth_sign = 'H' -- or (ls_lve_code = 'ML') -- or (ls_entry_by = 'F' and ls_lve_code = 'SL' and lc_no_days >= 3) -- or (ls_entry_by = 'N' and ls_lve_code = 'COFF') then -- if ls_auth_sign = 'H' then -- Modified by Piyush on 08/05/2015 if ls_auth_sign = 'H' or li_hr_cnt > 0 then -- Modified by Piyush on 08/05/2015 -- Modified by Piyush on 05/02/2015.End select sum(case when sign_status = 'S' then 1 else 0 end) as li_cnt, sum(case when sign_status = 'R' then 1 else 0 end) as li_cnt1, sum(case when sign_status = 'U' then 1 else 0 end) as li_cnt2 into li_cnt, li_cnt1, li_cnt2 from obj_sign_trans where ref_ser in ('E-LVF','E-LVN','E-LVE') and ref_id = VI_TRANID1 And Role_Code__Sign in('HRP','HRPF','HRP2') ; if li_cnt is null then li_cnt := 0; end if; if li_cnt1 is null then li_cnt1 := 0; end if; if li_cnt2 is null then li_cnt2 := 0; end if; if li_cnt + li_cnt1 + li_cnt2 = 0 then -- Modified by Piyush on 05/02/2015.Start -- return 'Pending from HR'; if li_hr_cnt > 0 then return 'Pending from HR'; end if; -- Modified by Piyush on 05/02/2015.End elsif li_cnt = 0 then if li_cnt1 > 0 then return 'Rejected'; elsif li_cnt2 > 0 then return 'Pending from HR'; end if; end if; end if; end if; return 'Pending for System Process'; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_QC_COMPL_DATE_UPDT BEFORE UPDATE OF test_stat ON qc_order referencing old as old new as new FOR EACH ROW BEGIN if :new.test_stat <> 'T' then :new.qc_compl_date:= trunc(sysdate); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_PRODUCT_UNIQUE ON STRG_PRODUCT (SALES_PERS, SC_CODE, BRAND_CODE, ITEM_SER, VALID_FROM, VALID_TO, PITCH_PRIORITY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MVOUC_CHK AFTER UPDATE OF CONFIRMED ON misc_voucher REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN IF :old.confirmed = 'N' and :new.confirmed = 'Y' and trim(:new.vouch_type) = 'A' THEN begin select count(1) into ll_count from misc_payables where tran_ser in('M-ADV', 'M-VOUC') and ref_no = :new.tran_id; exception when others then ll_count := 0; end; if ll_count < 2 then raise_application_error( -20601, 'Misc payables not inserted for both M-ADV and M-VOUC count[' || to_char(ll_count) ||']'); end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_ABSENT_DAYS_COUNT (AS_EMP_CODE char,AS_DATE date) return number is a_count1 number(1); a_count number(5) := 0; a_status varchar2(5); a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; begin select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (a_relieve_date is not null and a_relieve_date < AS_DATE) then return a_count; end if; if (a_date_join is null or a_date_join > AS_DATE) then return a_count; end if; a_status := ddf_hr_preproc_attd_status(AS_EMP_CODE,AS_DATE); if (a_status = 'A') then select count(*) into a_count1 from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; if (a_count1 <> 0) then a_status := 'P'; end if; end if; while (a_status = 'A') loop a_count := a_count + 1; a_status := ddf_hr_preproc_attd_status(AS_EMP_CODE,(AS_DATE-a_count)); if (a_status = 'A') then select count(*) into a_count1 from attendance_day where attd_date = (AS_DATE-a_count) and emp_code = AS_EMP_CODE; if (a_count1 <> 0) then a_status := 'P'; end if; end if; if ((AS_DATE - a_count) < a_date_join) then exit; end if; end loop; return a_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_PACK_OTYP_ODNO_CONF ON INV_PACK (ORDER_TYPE, ORDER_NO, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX HIERARCHY_EFF_VALID ON HIERARCHY (STAN_CODE, TABLE_NO, EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PAYSLIP_PAYROLL ( ls_period char,ls_emp char ,ls_ad_code char) return number is lc_amt number (14,2) ; begin SELECT nvl(payarr_det.amount,0) into lc_amt FROM payarr_det WHERE ( payarr_det.prd_code = ls_period) AND ( payarr_det.emp_code = ls_emp ) AND ( payarr_det.ad_code = ls_ad_code) ; return lc_amt ; exception when NO_DATA_FOUND then return 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DEPB_RATE_X ON DEPB_RATE (ITEM_CODE__DEPB, EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_STOCK_CHK_MFGEXPDT BEFORE INSERT OR UPDATE ON STOCK REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE TRACKSHELFLIFE ITEM.TRACK_SHELF_LIFE%TYPE; RETESTPERIOD ITEM.RETEST_PERIOD%TYPE; ls_autoreqc ITEM.auto_reqc%TYPE; ll_count number(3) := 0; INVSTAT_AVAILABLE CHAR(1) := 'N'; INVSTAT_USABLE CHAR(1) := 'N'; BEGIN begin SELECT NVL(A.AVAILABLE , 'N'), NVL(A.USABLE , 'N') INTO INVSTAT_AVAILABLE, INVSTAT_USABLE FROM INVSTAT A, LOCATION B WHERE B.LOC_CODE = :NEW.LOC_CODE AND A.INV_STAT = B.INV_STAT; exception when others then null; end; begin select count(1) into ll_count from siteitem where site_code = :new.site_code and item_code = :new.item_code; exception when others then null; end; if ll_count = 0 then begin select nvl(auto_reqc,'N') into ls_autoreqc from item where item_code = :new.item_code; exception when others then null; end; else begin select nvl(auto_reqc,'N') into ls_autoreqc from siteitem where site_code = :new.site_code and item_code = :new.item_code; exception when others then null; end; end if; IF :NEW.MFG_DATE IS NULL OR :NEW.EXP_DATE IS NULL OR :NEW.RETEST_DATE IS NULL THEN begin SELECT NVL(TRACK_SHELF_LIFE,'N'), NVL(RETEST_PERIOD,0) INTO TRACKSHELFLIFE,RETESTPERIOD FROM ITEM WHERE ITEM_CODE = :NEW.ITEM_CODE; exception when others then null; end; if :NEW.RETEST_DATE is null then if :old.RETEST_DATE is not null then :NEW.RETEST_DATE := :old.RETEST_DATE; ELSE begin select retest_date into :NEW.RETEST_DATE from item_lot_info where item_code = :new.item_code and lot_no = :new.lot_no; exception when others then null; end; end if; end if; IF TRACKSHELFLIFE = 'Y' THEN IF (:NEW.MFG_DATE IS NULL OR :NEW.EXP_DATE IS NULL) THEN RAISE_APPLICATION_ERROR( -20651, 'Track Shelf Life is Y for Item [' || :NEW.ITEM_CODE || '] hence manufacturing date and expiry date can not be null'); --ELSIF RETESTPERIOD > 0 AND :NEW.RETEST_DATE IS NULL THEN elsif ls_autoreqc = 'Y' AND :NEW.RETEST_DATE IS NULL AND INVSTAT_AVAILABLE = 'Y' THEN RAISE_APPLICATION_ERROR( -20651, 'Track Shelf Life is Y and auto retest is specified as yes for Item [' || :NEW.ITEM_CODE || '] hence retest date can not be null'); END IF; END IF; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WF_OBJECT_ACTION_X ON WF_OBJECT_ACTION (REF_SER, REF_ID, WIN_NAME, ACTION_CODE__LAST, ACTION_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXCLASS (as_tranid distord_iss.tran_id%type) return varchar2 is ls_string varchar2(100); ls_formf varchar2(100); begin select trim(max(DISTORD_ISSDET.TAX_CLASS)) into ls_formf from DISTORD_ISS,DISTORD_ISSDET where DISTORD_ISS.TRAN_ID = as_tranid and DISTORD_ISSDET.tran_id = DISTORD_ISS.tran_id AND DISTORD_ISSDET.tax_class = 'FORMF' ; if ls_formf is not null then ls_string := 'Transfer against FORM F' ; else ls_string := ' ' ; end if; return ls_string ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AR_STATUSDESR_FORCAL (Vi_Tran_Id_1 In VARCHAR2) Return Varchar2 Is History_Descr Varchar2(200); Vi_Tran_Id varchar2(15); vi_status char(1); vi_reason_code VARCHAR2(10); vi_in_time VARCHAR2(10); vi_out_time VARCHAR2(10); BEGIN Vi_Tran_Id := trim(Vi_Tran_Id_1) ; Select status , reason_code , in_time , out_time Into vi_status , vi_reason_code , vi_in_time ,vi_out_time From attd_regularize Where Tran_Id = Vi_Tran_Id; IF vi_status = 'A' THEN History_Descr := 'AR-' || vi_reason_code || '-Approved'; ELSE History_Descr := 'AR-' || vi_reason_code || '-Requested'; END IF; return History_Descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LAPSE_LVEBAL ( ls_emp_code char, ls_lve_code char, ld_laps_on_date date, ld_ench_date date, ls_empsite char , ls_worksite char, ls_paysite char, ls_grade char, ls_cadre char, ls_lve_tblno char ) Return Number Is Lc_Bal_Days Number(14,1); Lc_Bal_Days1 Number(14,1); lc_used_days1 Number(14,1); begin lc_bal_days1 := 0.00; lc_used_days1 := 0.00; SELECT Sum(LEAVEBAL.BAL_DAYS) as bal_days into lc_bal_days1 FROM leavebal where leavebal.lve_code = ls_lve_code AND leavebal.emp_code = ls_emp_code AND leavebal.eff_date <= Ld_Laps_On_Date and Leavebal.Exp_Date >= Ld_Laps_On_Date and leavebal.bal_days > 0; Select Sum(a.Lves_Alloc) Into Lc_Used_Days1 From Emplve_Trace a Where a.Emp_Code = Ls_Emp_Code And a.Lve_Code = Ls_Lve_Code and a.lve_date_fr > ld_laps_on_date and a.eff_date <= Ld_Laps_On_Date and (select b.exp_date from leavebal b where b.emp_code = a.emp_code and b.lve_code = a.lve_code and b.eff_date = a.eff_date and b.upto_date = a.upto_date) >= Ld_Laps_On_Date; If Lc_Bal_Days1 Is Null Then Lc_Bal_Days1 := 0; end if; If Lc_Used_Days1 Is Null Then Lc_Used_Days1 := 0; End If; lc_bal_days := lc_bal_days1 + lc_used_days1; return lc_bal_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PRCP_DET_TRANFLOW (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.QUANTITY ,b.rate ,b.purc_order from item a ,porcpdet b where a.item_code = b.item_code and b.tran_id=as_tran_id; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||'
'||'PO:- '||v_str_tmp3||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_SCHEME (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char, as_site_code in char) return number is mrate number(14,3); begin if as_type = 'L' then select rate into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif as_type = 'B' then begin mrate := 0; select nvl(eff_cost,0) into mrate from scheme_history where site_code = as_site_code and item_code = as_item_code and lot_no = as_lot_no; EXCEPTION WHEN NO_DATA_FOUND THEN mrate := 0; if mrate = 0 then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; end; elsif as_type = 'D' then begin select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; EXCEPTION WHEN NO_DATA_FOUND THEN mrate := 0; select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CENVAT_EXT_TRAN_DATE_TYPE ON CENVAT_EXT (TRAN_DATE, TRAN_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_REFSEQUSR BEFORE INSERT ON refseq referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.chg_user is null then :new.chg_user := 'SYSTEM'; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION AS_LINE_INV_KUS (AS_INVOICE_ID CHAR,AS_ITEM_CODE CHAR,AS_LOT_NO CHAR) RETURN NUMBER IS AS_LINE_NO NUMBER(3); BEGIN SELECT MIN(LINE_NO) INTO AS_LINE_NO FROM INVOICE_TRACE A WHERE A.INVOICE_ID=AS_INVOICE_ID AND A.ITEM_CODE=AS_ITEM_CODE and A.LOT_NO=AS_LOT_NO; RETURN AS_LINE_NO; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EDI_OPTION (ls_winname in char) return char is ls_edi_option char(1); begin select edi_option into ls_edi_option from transetup where trim(tran_window) = trim(ls_winname); return ls_edi_option ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUSTOMER_TDSPERC (AS_CUST_CODE__BIL CHAR,AS_CUST_CODE CHAR,AS_TAX_DATE DATE, AS_DESP_DATE DATE,AS_TRAN_DATE DATE, AS_TRAN_TYPE CHAR) RETURN NUMBER IS LS_RETURN NUMBER (14,3) := 0; V_PAN_NO CUSTOMER.PAN_NO%TYPE; V_TAX_CLASS CUSTOMER.TAX_CLASS%TYPE; V_TAX_DATE DATE; V_CUST_CODE CHAR(10); LS_COUNT NUMBER(10); ls_var_value DISPARM.VAR_VALUE%TYPE; BEGIN ---Check if tran type is Full return type. If match with disparm value then TCS value will be returned select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = 'SRET_FULL_TRANTYPE'; SELECT (CASE WHEN trim(AS_TRAN_TYPE) IN (SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(ls_var_value))) THEN 1 ELSE 0 END) INTO LS_COUNT FROM DUAL; IF LS_COUNT =0 and AS_TRAN_TYPE is not null THEN LS_RETURN :=0 ; RETURN LS_RETURN; ELSE --If cust code bill is null the cust_cod will be set IF AS_CUST_CODE__BIL IS NOT NULL THEN V_CUST_CODE := AS_CUST_CODE__BIL; ELSE V_CUST_CODE := AS_CUST_CODE; END IF; --If method is called on despatch then desp date will be not null and date will be set as desp date --If method is called on other than despatch transaction then tax date will be set if tax date is also null then tran date will be set IF AS_DESP_DATE IS NOT NULL THEN V_TAX_DATE := AS_DESP_DATE; ELSIF AS_TAX_DATE IS NOT NULL THEN V_TAX_DATE := AS_TAX_DATE; ELSE V_TAX_DATE := AS_TRAN_DATE; END IF; -- Return the Pan no and tax class from customer master SELECT NVL(PAN_NO,'PANNOTAVBL'), NVL(TAX_CLASS,'BLANK') INTO V_PAN_NO, V_TAX_CLASS FROM CUSTOMER WHERE CUST_CODE = V_CUST_CODE; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'T1SSM' AND V_TAX_DATE >= TO_DATE('01-JUL-2021','DD-MON-YYYY') THEN LS_RETURN := 0.1 ; END IF; IF V_PAN_NO = 'PANNOTAVBL' AND V_TAX_CLASS = 'T1SSM' AND V_TAX_DATE < TO_DATE('01-JUL-2021','DD-MON-YYYY') THEN LS_RETURN := 0 ; END IF; IF V_TAX_CLASS <> 'T1SSM' THEN LS_RETURN := 0 ; END IF; END IF; RETURN LS_RETURN; EXCEPTION WHEN OTHERS THEN LS_RETURN := 0 ; RETURN LS_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOCATION_DESCRIPTION (AS_COLUMN_NAME VARCHAR2,AS_TRAN_ID char) return VARCHAR2 is LOCATION_DESCR VARCHAR2(40); begin if (AS_COLUMN_NAME='LOC_CODE__FR') then select distinct l.descr into LOCATION_DESCR from stock_transfer_det std,location l where std.tran_id=AS_TRAN_ID and std.loc_code__fr=l.loc_code; end if; if (AS_COLUMN_NAME='LOC_CODE__TO') then select distinct l.descr into LOCATION_DESCR from stock_transfer_det std,location l where std.tran_id=AS_TRAN_ID and std.loc_code__to=l.loc_code; end if; IF LOCATION_DESCR IS NULL THEN LOCATION_DESCR :=''; END IF; return LOCATION_DESCR; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE GETDETAIL AS FUNCTION getDetailFun (asSyndryType in char) RETURN sundryMasterTable PIPELINED; END; CREATE OR REPLACE PACKAGE BODY GETDETAIL AS FUNCTION getDetailFun (asSyndryType in char) RETURN sundryMasterTable PIPELINED IS BEGIN IF asSyndryType = 'E' THEN FOR x IN (SELECT EMPLOYEE.EMP_CODE, EMPLOYEE.EMP_FNAME||' '||EMPLOYEE. EMP_MNAME||' '||EMPLOYEE.EMP_LNAME AS EMP_NAME,TRIM(STATION.DESCR) as CITY, TRIM(DEPARTMENT.DESCR) AS DIVISION, TRIM(STATE.DESCR) AS STATE FROM EMPLOYEE, SITE, STATION, DEPARTMENT, STATE WHERE EMPLOYEE.WORK_SITE = SITE.SITE_CODE (+) AND EMPLOYEE.STAN_CODE__HQ = STATION.STAN_CODE (+) AND STATION.STATE_CODE = STATE.STATE_CODE (+) AND EMPLOYEE.DEPT_CODE = DEPARTMENT.DEPT_CODE (+)) --AND (EMPLOYEE.WORK_SITE = asLoginSite) ) LOOP PIPE ROW (sundryMaster(x.EMP_CODE,x.EMP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'S' THEN FOR x IN (SELECT SUPPLIER.SUPP_CODE, SUPPLIER.SUPP_NAME, TRIM(NVL(SUPPLIER .CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SUPPLIER, STATE WHERE nvl(SUPPLIER.BLACK_LIST,'N') != 'Y' AND SUPPLIER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SUPP_CODE,x.SUPP_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'C' THEN FOR x IN (SELECT CUSTOMER.CUST_CODE, CUSTOMER.CUST_NAME, CUSTOMER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM CUSTOMER, STATE WHERE CUSTOMER.STATE_CODE = STATE.STATE_CODE (+) AND CUSTOMER.CUST_CODE IN (SELECT CUSTOMER.CUST_CODE__BIL FROM CUSTOMER)) LOOP PIPE ROW (sundryMaster(x.CUST_CODE,x.CUST_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'T' THEN FOR x IN (SELECT TRANSPORTER.TRAN_CODE, TRANSPORTER.TRAN_NAME, TRANSPORTER .CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TRANSPORTER, STATE WHERE TRANSPORTER.STATE_CODE = STATE.STATE_CODE (+) AND TRANSPORTER_TYPE= 'T') LOOP PIPE ROW (sundryMaster(x.TRAN_CODE,x.TRAN_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'P' THEN FOR x IN (SELECT SALES_PERS.SALES_PERS, SALES_PERS.SP_NAME, SALES_PERS. CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SALES_PERS, STATE WHERE SALES_PERS.ACTIVE_YN <> 'N' AND SALES_PERS.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SALES_PERS,x.SP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'X' THEN FOR x IN (SELECT TAX_AUTHORITY.TAUTH_CODE, TAX_AUTHORITY.TAUTH_NAME, TAX_AUTHORITY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TAX_AUTHORITY, STATE WHERE TAX_AUTHORITY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.TAUTH_CODE,x.TAUTH_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'L' THEN FOR x IN (SELECT LOANPARTY.PARTY_cODE, LOANPARTY.PARTY_NAME, LOANPARTY. CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM LOANPARTY, STATE WHERE LOANPARTY.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.PARTY_CODE,x.PARTY_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType = 'R' THEN FOR x IN (SELECT STRG_CUSTOMER.SC_cODE, STRG_CUSTOMER.FIRST_NAME||' '|| STRG_CUSTOMER.MIDDLE_NAME||' '||STRG_CUSTOMER.LAST_NAME AS SC_NAME, CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM STRG_CUSTOMER, STATE WHERE STRG_CUSTOMER.STATUS ='A' AND STRG_CUSTOMER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.SC_CODE,x.SC_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'B' THEN FOR x IN (SELECT BANK.BANK_CODE, BANK.BANK_NAME, BANK.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM BANK, STATE WHERE BANK.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.BANK_CODE,x.BANK_NAME,x.CITY,X.DIVISION,X.STATE )); END LOOP; RETURN; END IF; IF asSyndryType is NULL THEN FOR x IN (SELECT CONTACT.Contact_code, CONTACT.name, CONTACT.CITY,NULL DIVISION, TRIM(STATE.DESCR) AS STATE,contact.count_code FROM CONTACT, STATE WHERE contact.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster(x.Contact_code,x.name,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; END getDetail; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_ASISBASIS (Label_claim number,actual_assay number) return number is potency_adj number(14,6); potency number(14,6); begin potency := (Label_claim*100/actual_assay); potency_adj := (potency - Label_claim); return( potency_adj ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_INVAMD_STATUS ON INVOICE_AMENDMENT (INVOICE_ID, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDS_CHNO (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_str varchar2(200) ; ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ctr number(3); cursor c1 is select nvl(HANDOVER_CHNO,''), nvl(BANK_CODE__TAX,''),nvl(TOKEN_NO,'') from misc_payment where tran_id in ( select tran_id from misc_paydet where tran_ser = 'M-VOUC' and vouch_no = ls_vouch_no ) ; begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_ch_no_det,ls_bank_cd_det,ls_token_no_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; ls_str := rtrim(ls_str)|| ls_ch_no_det ; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_QV_ITEM_ONLY (as_sitecode in char, as_itemcode in char, adt_fromdate in date, as_available in char, as_qtyvalue in char ) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = as_itemcode and a.site_code = as_sitecode and instr(as_available,b.available) > 0; if adt_fromdate < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (SELECT decode(as_qtyvalue,'Q', sum( a.quantity), sum((a.quantity) * nvl(a.rate,0))) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = as_itemcode and a.site_code = as_sitecode and instr(as_available,b.available) > 0 union all select decode(as_qtyvalue,'Q',nvl((sum (nvl(a.eff_qty,0)) * -1),0), nvl(sum ((nvl(a.eff_qty,0) * nvl(d.rate,0) ) * -1),0) ) qty from invtrace a, location b, invstat c, stock d where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = d.site_code and a.item_code = d.item_code and a.loc_code = d.loc_code and a.lot_no = d.lot_no and a.lot_sl = d.lot_sl and a.item_code = as_itemcode and a.site_code = as_sitecode and a.tran_date > adt_fromdate and instr(as_available,c.available) > 0); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRY_NAME ( ls_sundry_code in char, ls_sundry_type in char ) return varchar2 is ls_val varchar2(100); ls_name varchar2(60); begin if ls_sundry_type = 'C' then select cust_name into ls_name from customer where cust_code = ls_sundry_code; ElsIf ls_sundry_type = 'S' then Select supp_name into ls_name From supplier Where supp_code = ls_sundry_code; ElsIf ls_sundry_type = 'L' Then Select party_name Into ls_name From loanparty Where party_code = ls_sundry_code; ElsIf ls_sundry_type = 'X' Then Select tauth_name Into ls_name From tax_authority Where tauth_code = ls_sundry_code; ElsIf ls_sundry_type = 'P' Then Select sp_name Into ls_name From sales_pers Where sales_pers = ls_sundry_code; ElsIf ls_sundry_type = 'T' Then Select tran_name Into ls_name From transporter Where tran_code = ls_sundry_code; ElsIf ls_sundry_type = 'E' then Select trim(emp_fname) || ' '|| trim(emp_lname) into ls_name From employee Where emp_code = ls_sundry_code; ElsIf ls_sundry_type = 'O' then ls_name := 'NOT APPLICABLE'; End If; ls_name := nvl(ls_name, ' '); ls_val := ls_name ; Return ls_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_PORD_QTYRATE BEFORE insert or update ON porddet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; BEGIN if round(nvl(:new.quantity,0) * nvl(:new.conv__qty_stduom,0),3) <> round(nvl(:new.quantity__stduom,0),3) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] x conv__qty_stduom [' || to_char(:new.conv__qty_stduom) || '] not matching with quantity__stduom['||to_char(:new.quantity__stduom)|| ']' ); end if; if round(nvl(:new.rate,0) * nvl(:new.CONV__RTUOM_STDUOM,1),4) <> round(nvl(:new.RATE__STDUOM,0),4) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] rate [' || to_char(:new.rate) || '] x CONV__RTUOM_STDUOM [' || to_char(:new.CONV__RTUOM_STDUOM) || '] not matching with RATE__STDUOM['||to_char(:new.RATE__STDUOM)|| ']' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_POS_NETAMT BEFORE INSERT OR UPDATE OF confirmed ON pos referencing old as old new as new FOR EACH ROW DECLARE ll_porcpcount number(3) := 0; lc_netAmt number(14,3) := 0; ls_msg varchar2(2000); ls_dis_link CHAR (1); BEGIN if :new.confirmed = 'Y' and :new.source_ref_id is not null then begin select count(1) into ll_porcpcount from porcp where trim(tran_id) = :new.source_ref_id; -- exception when others then -- ll_invcount := 0; end; -- raise_application_error( -20601, 'Net amount mismatch ll_porcpcount' || ll_porcpcount || ']'); if ll_porcpcount > 0 then -- raise_application_error( -20601, 'Net amount mismatch1 ll_porcpcount' || ll_porcpcount || ']'); begin select amount into lc_netAmt from porcp where trim(tran_id) = :new.source_ref_id; -- raise_application_error( -20601, 'Net amount mismatch1 lc_netAmt' || lc_netAmt || ']'); if(ABS(lc_netAmt - :new.net_amt) > 1) then raise_application_error( -20601, 'POS net amount '|| :new.net_amt ||' is not matched with the PO receipt amount '|| lc_netAmt ||' and Difference of the amount should not be greater than 1]'); end if; end; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGETENV ( prdcode IN VARCHAR, varname IN VARCHAR) RETURN VARCHAR2 IS varvalue VARCHAR2(2500); BEGIN SELECT var_value INTO varvalue FROM payrparm WHERE prd_code = prdcode AND TRIM(var_name) = TRIM(varname); RETURN varvalue; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RRECV_REP_FLD_NO_RADV ( as_refser in char, as_refno in char, ad_asondate in date, ac_outstamt in number) return number is ac_outst_amt number(14,3) ; lc_outstamt number(14,3) ; lc_count number(1) ; lc_adjamt number(14,3) ; begin lc_outstamt := ac_outstamt ; select nvl(sum(rcpdet.rcp_amt),0) into lc_adjamt from receipt, rcpdet where receipt.tran_id = rcpdet.tran_id and receipt.tran_date > ad_asondate and receipt.confirmed = 'Y' and rcpdet.ref_ser = as_refser and rcpdet.ref_no = as_refno ; lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(a.adj_amt),0) into lc_adjamt from receivables_adj a where a.ref_ser = as_refser and a.ref_no = as_refno and (a.ref_ser_adj, a.ref_no_adj) in (select c.tran_ser,c.ref_no from receivables c where c.tran_ser = a.ref_ser_adj and c.ref_no = a.ref_no_adj and c.ref_date > ad_asondate); lc_outstamt := lc_outstamt + lc_adjamt ; select nvl(sum(b.rcp_amt),0) into lc_adjamt from rcpdishnr_det b where b.tran_id in (select a.tran_id from rcpdishnr a where a.tran_date > ad_asondate and a.confirmed = 'Y' and a.tran_ser = 'R') and b.ref_ser = as_refser and b.ref_no = as_refno; lc_outstamt := lc_outstamt - lc_adjamt ; select nvl(sum(a.adj_amt),0) into lc_adjamt from receivables_adj a where a.ref_ser_adj = as_refser and a.ref_no_adj = as_refno and (a.ref_ser, a.ref_no) in (select c.tran_ser,c.ref_no from receivables c where c.tran_ser = a.ref_ser and c.ref_no = a.ref_no and c.ref_date > ad_asondate); lc_outstamt := lc_outstamt - lc_adjamt ; return lc_outstamt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EINV_PRET AFTER UPDATE OF CONFIRMED ON PORCP REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ls_seq varchar2(20); ll_errcode number; ls_errmsg VARCHAR2(255); ll_count number := 0; ls_RCM char(1); ls_gstin supplier.tax_reg_2%type; ----PRAGMA AUTONOMOUS_TRANSACTION; BEGIN ls_RCM :='N'; IF :old.confirmed = 'N' and :new.confirmed = 'Y' and :new.tran_ser = 'P-RCP' THEN begin select trim(nvl(tax_reg_2,'X')) into ls_gstin from supplier where supp_code = :new.supp_code; exception when others then ls_gstin := 'X'; end; if ls_gstin = 'UNREGISTER' then ls_RCM :='Y'; end if; end if; --IF :old.confirmed = 'N' and :new.confirmed = 'Y' and (:new.tran_ser = 'P-RET' or ls_RCM = 'Y') THEN IF (((:old.confirmed = 'N' and :new.confirmed = 'Y' ) or (nvl(:old.reproc_count,0) <> :new.reproc_count and :new.confirmed = 'Y') )and (:new.tran_ser = 'P-RET' or ls_RCM = 'Y')) THEN begin delete from e_invoice_det where tran_id = (select tran_id from e_invoice where ref_ser = 'P-RET' and ref_id = :new.tran_id); delete from e_invoice where ref_ser = 'P-RET' and ref_id = :new.tran_id; select count(1) into ll_count from e_invoice where ref_ser in( 'P-RET','P-RCP') and ref_id = :new.tran_id; exception when others then ll_count := 0; end; if ll_count = 0 then begin select lpad(to_char(EINV_SEQ.nextval),20,'0') into ls_seq from dual; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to generate next sequence (EINV_SEQ) for e-invoice err_code [' || ll_errcode || '] - [' || ls_errmsg || ']' ); end; begin insert into e_invoice ( TRAN_ID, TRAN_DATE, tran_type, einv_opt, REF_SER, REF_ID, REF_DATE, gstn_sell, trade_name_sell, legal_name_sell, add1_sell, add2_sell, city_sell, pin_sell, state_sell, tele_sell, email_id_sell, SITE_CODE__SHIP, gstn_ship, trade_name_ship, legal_name_ship, add1_ship, add2_ship, city_ship, pin_ship, state_ship, tele_ship, email_id_ship, CUST_CODE, gstn_buy, trade_name_buy, legal_name_buy, pos_buy, add1_buy, add2_buy, city_buy, state_code__buy, drug_lic_no_buy, pin_buy, state_buy, tele_buy, email_id_buy, CUST_CODE__BIL, CUST_CODE__DLV, name_dlv, add1_dlv, add2_dlv, pin_dlv, state_dlv, state_code__dlv, drug_lic_no_dlv, INV_AMT, NET_AMT, ASSESABLE_VALUE, DISC_AMT, ORDER_NO, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, proc_stat, proc_date, resp_stat, distance, Trans_Mode, Tran_gstn, lr_date, lr_no, lorry_no, Vehicle_Type, DOC_NO, DOC_DATE, tran_name ) SELECT ls_seq as tran_id, :new.TRAN_DATE as TRAN_DATE, :new.tran_type as tran_type, buyer.einv_reqd as einv_opt, :new.TRAN_SER as REF_SER, :new.tran_id as REF_ID, :new.TRAN_DATE as REF_DATE, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_sell, seller.descr trade_name_sell, seller.descr legal_name_sell, seller.ADD1 add1_sell, seller.ADD2 add2_sell, seller.CITY city_sell, seller.PIN pin_sell, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_sell, seller.TELE1 tele_sell, seller.EMAIL_ADDR email_id_sell, :new.site_code SITE_CODE__SHIP, (SELECT REG_NO FROM SITEREGNO WHERE SITEREGNO.SITE_CODE= seller.site_code AND ref_code='GSTIN_NO' ) gstn_ship, seller.descr trade_name_ship, seller.descr legal_name_ship, seller.ADD1 add1_ship, seller.ADD2 add2_ship, seller.CITY city_ship, seller.PIN pin_ship, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) state_ship, seller.TELE1 tele_ship, seller.EMAIL_ADDR email_id_ship, :new.SUPP_CODE CUST_CODE, (SELECT tax_reg_2 FROM supplier WHERE supp_code=buyer.supp_code ) gstn_buy, buyer.sh_name trade_name_buy, buyer.sh_name legal_name_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = seller.STATE_CODE) pos_buy, buyer.ADDR1 add1_buy, buyer.ADDR2 add2_buy, buyer.city city_buy, buyer.state_code state_code__buy, '' drug_lic_no_buy, buyer.pin pin_buy, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_buy, buyer.tele1 tele_buy, buyer.EMAIL_ADDR email_id_buy, :new.supp_code CUST_CODE__BIL, :new.supp_code CUST_CODE__DLV, buyer.sh_name name_dlv, buyer.ADDR1 add1_dlv, buyer.ADDR2 add2_dlv, buyer.pin pin_dlv, (SELECT GST_CODE FROM STATE WHERE STATE_CODE = buyer.STATE_CODE) state_dlv, buyer.state_code state_code__dlv, '' drug_lic_no_dlv, round((select sum(d.quantity * d.rate) from porcpdet d where d.tran_id = :new.tran_id ),2) INV_AMT, --:new.AMOUNT as NET_AMT, round((select sum(d.quantity * d.rate) from porcpdet d where d.tran_id = :new.tran_id ) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C')) and tax_perc > 0 and tax_amt > 0),0),2) as NET_AMT, round(:new.AMOUNT - :new.TAX,2) AS ASSESABLE_VALUE, --round(nvl((select sum(d.quantity * d.rate * discount / 100) from porcpdet d where d.tran_id = :new.tran_id ),0),2) DISC_AMT, 0 DISC_AMT, :new.purc_order as ORDER_NO, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = :new.TRAN_SER and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='I') AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS IGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = :new.TRAN_SER and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='H') AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS CGST_AMT, round(NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = :new.TRAN_SER and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='G') AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS SGST_AMT, round( NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = :new.TRAN_SER and TRAN_ID=:new.TRAN_ID AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='J')AND TAX_PERC > 0 AND TAX_AMT > 0),0),2) AS CESS_AMT, --NVL((SELECT SUM(TAX_AMT) FROM TAXTRAN WHERE tran_code = :new.TRAN_SER and TRAN_ID=:new.TRAN_ID --AND TAX_CODE IN (SELECT TAX_CODE FROM TAX WHERE TAX_TYPE ='C') AND TAX_PERC > 0 AND TAX_AMT > 0),0) AS OTHER_AMT, 0 AS OTHER_AMT, 'N' proc_stat, sysdate proc_date, 'P' resp_stat, 0 distance, null Trans_Mode, (select case when t.tax_reg_2 = 'UNREGISTER' then ' ' else t.tax_reg_2 end from transporter t where t.tran_code = :new.tran_code) Tran_gstn, :new.lr_date lr_date, :new.lr_no lr_no, :new.lorry_no lorry_no, '' Vehicle_Type, :new.EXCISE_REF DOC_NO, :new.EXCISE_REF_DATE DOC_DATE, (select t.tran_name from transporter t where t.tran_code = :new.tran_code ) tran_name FROM --PORCP INV, supplier buyer, site seller WHERE seller.site_code = :new.site_code and buyer.supp_code = :new.supp_code; --and :new.tran_ser = 'P-RET' ; --and INV.tran_ID= :new.tran_id ; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; begin insert into e_invoice_det ( TRAN_ID, LINE_NO, ITEM_CODE, item_descr, LINE_TYPE, INV_AMT, ASS_AMT, DISCOUNT, IGST_AMT, CGST_AMT, SGST_AMT, CESS_AMT, OTHER_AMT, UNIT, QUANTITY, RATE, HSN_CODE, LOT_NO, EXP_DATE, MFG_DATE, TOT_ITEM_VAL, IGST_PERC, CGST_PERC, SGST_PERC, CESS_PERC, GST_RATE, service_yn ) SELECT ls_seq as tran_id, it.line_no AS LINE_NO, it.ITEM_CODE as ITEM_CODE , item.DESCR as ITEM_DESC, '' AS LINE_TYPE, round(it.quantity * it.RATE,2) as INV_AMT, round(case when it.DISCOUNT > 0 then round((it.quantity * it.RATE) -((it.quantity * it.RATE)/100 * it.DISCOUNT),3) else round((it.quantity * it.RATE),3) END,2) as ASS_AMT, round(((it.quantity * it.RATE)/100 * it.DISCOUNT) + (nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='D') and tax_amt <> 0),0)),2) AS DISCOUNT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='I') and tax_perc > 0 and tax_amt > 0),0),2) as IGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='H') and tax_perc > 0 and tax_amt > 0),0),2) as CGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=trim(it.line_no) and tax_code in (select tax_code from tax where tax_type ='G') and tax_perc > 0 and tax_amt > 0),0),2) as SGST_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type ='J') and tax_perc > 0 and tax_amt > 0),0),2) as CESS_AMT, round(nvl((select tax_amt from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=it.tran_id and trim(line_no)=it.line_no and tax_code in (select tax_code from tax where tax_type in('K','C')) and tax_perc > 0 and tax_amt > 0),0),2) as OTHER_AMT, (SELECT CASE WHEN udf_str2 IS NULL THEN 'OTH' ELSE udf_str2 END FROM uom WHERE uom.unit=it.unit ) AS UNIT, it.quantity AS QUANTITY, it.RATE AS RATE, item.hsn_no AS HSN_CODE, it.LOT_NO as LOT_NO, it.EXPiry_DATE as EXP_DATE, it.MFG_DATE as MFG_DATE, --it.NET_AMT as TOT_ITEM_VAL, round((it.quantity * it.RATE) + nvl((select sum(tax_amt) from taxtran where taxtran.tran_code = :new.TRAN_SER and taxtran.tran_id=:new.tran_id and taxtran.line_no = it.line_no and tax_code in (select tax_code from tax where tax_type IN ('I','H','G','J','C','D')) and tax_perc > 0 and tax_amt > 0),0),2) as TOT_ITEM_VAL, fn_gst_rate_amt(:new.TRAN_SER,it.tran_id, it.line_no, 'I', 'R') as IGST_PERC, fn_gst_rate_amt(:new.TRAN_SER,it.tran_id, it.line_no, 'H', 'R') as CGST_PERC, fn_gst_rate_amt(:new.TRAN_SER,it.tran_id, it.line_no, 'G', 'R') as SGST_PERC, fn_gst_rate_amt(:new.TRAN_SER,it.tran_id, it.line_no, 'J', 'R') as CESS_PERC, fn_get_gst_rate(:new.TRAN_SER,it.tran_id, it.line_no) as GST_RATE, --(select case when item.stk_opt = '0' then 'Y' else 'N' end from item where item.item_code = it.item_code) (select case when nvl(itemser.ser_type,'0') = '4' then 'Y' else 'N' end from item,itemser where item.item_code = it.item_code and item.item_ser = itemser.item_ser) FROM porcpdet it, item WHERE item.item_code= it.item_code AND it.tran_id = :new.tran_id; exception when others then ll_errcode := to_char(SQLCODE); ls_errmsg := SQLERRM; raise_application_error( -20601, 'Not able to insert data into e_invoice_det table errCode [' || ll_errcode || '] - [' || ls_errmsg ||']'); end; end if; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LICENCE_AUTH_DET_X ON LICENCE_AUTH_DET (LICENCE_GRP, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_LAST_MEET_DAYS (as_sc_code char) return varchar is MaxMeetDt date; Cnt Number(4); ret_data varchar2(45); begin select max(event_date) into MaxMeetDt from strg_meet where strg_code = as_sc_code; select trunc(sysdate) - to_date(MaxMeetDt, 'dd-mm-yy') into Cnt from dual; if(Cnt > 0 ) then ret_data := Cnt || ' days back meet'; elsif(Cnt = 0) then ret_data := 'Today meet'; else ret_data := Cnt || 'Never meet'; end if; return ret_data; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_INIT_DEPT_X ON PROJ_INIT_DEPT (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_LASTPRCPRATE ( as_itemcode item.item_code%type, adt_todate date, as_site_code item.site_code%type ) return decimal is lc_rate decimal(14,3) ; ldt_lastdate date; BEGIN begin select max(c.tran_date) into ldt_lastdate from porcp c, porcpdet d where c.purc_order = d.purc_order and c.tran_id = d.tran_id and d.ITEM_CODE = as_itemcode and c.tran_date <= adt_todate and c.site_code = as_site_code and c.tran_ser = 'P-RCP' and c.confirmed = 'Y'; exception when no_data_found then lc_rate := 0; when others then lc_rate := 0; end; begin if ldt_lastdate is not null then SELECT lc_rate INTO lc_rate FROM ( select b.rate as lc_rate from porcp a,porcpdet b where a.purc_order = b.purc_order and a.tran_id = b.tran_id and b.item_code = as_itemcode -- and rownum = 1 and a.tran_date = ldt_lastdate and a.tran_ser = 'P-RCP' and a.confirmed = 'Y' order by a.tran_date desc, a.tran_id desc ) WHERE ROWNUM = 1; end if; exception when no_data_found then lc_rate := 0; when others then lc_rate := 0; end; RETURN lc_rate; END DDF_GET_LASTPRCPRATE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_FIND_HR_EMPCODE (AS_TRAN_ID CHAR,AS_ROW_NO CHAR) RETURN VARCHAR2 IS LS_HR_EMPCODE VARCHAR2(10); LS_EMP_CODE VARCHAR2 (20); LS_LVE_CODE VARCHAR2 (20); LS_USE_FLAG VARCHAR2 (20); BEGIN select emp_code,lve_code,use_flag INTO LS_EMP_CODE,LS_LVE_CODE,LS_USE_FLAG from empleave where TRIM(tran_id)=TRIM(AS_TRAN_ID); SELECT FN_GET_HR_EMP_CODE(TRIM(LS_EMP_CODE),TRIM(FN_GET_LEAVE_APP_TYPE(TRIM(LS_EMP_CODE),TRIM(LS_LVE_CODE),TRIM(LS_USE_FLAG))),AS_ROW_NO) INTO LS_HR_EMPCODE FROM DUAL; RETURN LS_HR_EMPCODE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HIER_IND_KEY_TEST (as_level_code in char) return char is ls_key char(40); ls_sel char(40); ls_sel1 char(40); --declare begin ls_key := ''; select level_code__parent into ls_sel from hierarchy where level_code = as_level_code and rownum = 1; if ls_sel is null then return ' '; else --dbms_output.put_line(ls_key); ls_key := ls_sel || rtrim(ls_key); select ddf_hier_ind_key(ls_sel) into ls_sel1 from dual; if ls_sel1 = ' ' then return ls_key; else ls_key := rtrim(ls_sel1) || rtrim(ls_key); end if; end if; return ls_key; exception when too_many_rows then dbms_output.put_line(ls_key); return ls_key; when others then dbms_output.put_line(ls_key); return ls_key; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INVTRACE_ACCT BEFORE insert ON invtrace referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_count number(6) := 0; ll_mismatchcount number(3) := 0; ls_msg varchar2(4000); ls_stockac char(10); BEGIN if :new.eff_qty > 0 and trim(:new.loc_code) <> 'GIT' then begin select acct_code__inv into ls_stockac from stock where item_code = :new.item_code and site_code = :new.site_code and loc_code = :new.loc_code and lot_no = :new.lot_no and lot_sl = :new.lot_sl ; exception when others then ls_stockac := ' '; end; if ls_stockac is not null and length(trim(ls_stockac)) > 0 and trim(ls_stockac) <> trim(:new.acct_code__dr) then raise_application_error( -20601, 'Account Code mismatch with existing stock [' || trim(ls_stockac) || '] Current [' || trim(:new.acct_code__dr) ||']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RADD_DAYAS (ARG1 DATE , ARG2 NUMBER) RETURN DATE IS RET_DATE DATE; BEGIN RET_DATE := ARG1 + ARG2; RETURN RET_DATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_TAXTRAN BEFORE INSERT ON TAXTRAN FOR EACH ROW declare --PRAGMA AUTONOMOUS_TRANSACTION; ls_taxtype char(1); lc_quantity number(14,3) := 0; lc_rate number(15,4) := 0; lc_discount number(14,3) := 0; lc_taxableamt number(14,3) := 0; lc_othchrg number(14,3) := 0; ll_count number(3) :=0; BEGIN if trim(:new.CURR_CODE__TAX) = trim(:new.CURR_CODE__TRAN) and abs(:new.tax_amt) <> abs(:new.TAX_AMT__TCURR) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] tax code [' || trim(:new.tax_code) || '] tax amount is not matching with tax amount in tax currency tax amount [' || to_char(:new.tax_amt) || '] in tax currency ['|| to_char(:new.tax_amt__tcurr) || ']'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCKQTY_AVAILABLE (as_site varchar2,as_item varchar2) return number is as_item_stkqty number(12,3); begin select sum(quantity) into as_item_stkqty from stock a , invstat b where (case when a.item_code is not null then 1 else 0 end ) = 1 and (case when a.site_code is not null then 1 else 0 end ) = 1 and (case when a.lot_no is not null then 1 else 0 end ) = 1 and (case when a.loc_code is not null then 1 else 0 end ) = 1 and (case when a.lot_sl is not null then 1 else 0 end ) = 1 and a.quantity > 0 and a.inv_stat = b.inv_stat and a.item_code = as_item and a.site_code = as_site and b.available = 'Y'; return as_item_stkqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE POPHELPPACKAGE AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN sundryMasterTable PIPELINED ; FUNCTION getInstrumentTypePophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2) RETURN instrumentTypeTable PIPELINED ; FUNCTION getInstrumentNoPophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2, asRefSer in varchar2) RETURN instrumentNoTable PIPELINED ; FUNCTION getPickRatePophelp (asTranDate in Date, asItemCode in char, asQuantity in number, asSiteCode in char, asLocCode in char) RETURN pickRateTable PIPELINED ; FUNCTION getCctrCodePophelp (acctCode in char) RETURN cctrMasterTable PIPELINED ; END popHelpPackage; CREATE OR REPLACE PACKAGE BODY POPHELPPACKAGE AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN sundryMasterTable PIPELINED IS BEGIN IF asSyndryType = 'E' THEN FOR x IN (SELECT EMPLOYEE.EMP_CODE, EMPLOYEE.EMP_FNAME||' '||EMPLOYEE.EMP_MNAME||' '||EMPLOYEE.EMP_LNAME AS EMP_NAME,TRIM(STATION.DESCR) as CITY, TRIM(DEPARTMENT.DESCR) AS DIVISION, TRIM(STATE.DESCR) AS STATE FROM EMPLOYEE, SITE, STATION, DEPARTMENT, STATE WHERE EMPLOYEE.WORK_SITE = SITE.SITE_CODE (+) AND EMPLOYEE.STAN_CODE__HQ = STATION.STAN_CODE (+) AND STATION.STATE_CODE = STATE.STATE_CODE (+) AND EMPLOYEE.DEPT_CODE = DEPARTMENT.DEPT_CODE (+) AND (EMPLOYEE.WORK_SITE = asLoginSite) ) LOOP PIPE ROW (sundryMaster(x.EMP_CODE,x.EMP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'S' THEN FOR x IN (SELECT SUPPLIER.SUPP_CODE, SUPPLIER.SUPP_NAME, TRIM(NVL(SUPPLIER.CITY,'NOT ENTERED')) as CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SUPPLIER, STATE WHERE nvl(SUPPLIER.BLACK_LIST,'N') != 'Y' AND SUPPLIER.STATE_CODE = STATE.STATE_CODE (+) and FN_SUPP_APPL_FOR_SITE(SUPPLIER.SUPP_CODE, asLoginSite)='Y') LOOP PIPE ROW (sundryMaster(x.SUPP_CODE,x.SUPP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'C' THEN FOR x IN (SELECT CUSTOMER.CUST_CODE, CUSTOMER.CUST_NAME, CUSTOMER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM CUSTOMER, STATE WHERE CUSTOMER.STATE_CODE = STATE.STATE_CODE (+) and FN_CUST_APPL_FOR_SITE(CUSTOMER.CUST_CODE, asLoginSite)='Y') LOOP PIPE ROW (sundryMaster(x.CUST_CODE,x.CUST_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'T' THEN FOR x IN (SELECT TRANSPORTER.TRAN_CODE, TRANSPORTER.TRAN_NAME, TRANSPORTER.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TRANSPORTER, STATE WHERE TRANSPORTER.STATE_CODE = STATE.STATE_CODE (+) and FN_TRANS_APPL_FOR_SITE(TRANSPORTER.TRAN_CODE, asLoginSite) = 'Y') LOOP PIPE ROW (sundryMaster(x.TRAN_CODE,x.TRAN_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'P' THEN FOR x IN (SELECT SALES_PERS.SALES_PERS, SALES_PERS.SP_NAME, SALES_PERS.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM SALES_PERS, STATE WHERE SALES_PERS.ACTIVE_YN <> 'N' AND SALES_PERS.STATE_CODE = STATE.STATE_CODE (+) and FN_SLPERS_APPL_FOR_SITE(SALES_PERS.SALES_PERS,asLoginSite) = 'Y') LOOP PIPE ROW (sundryMaster(x.SALES_PERS,x.SP_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'X' THEN FOR x IN (SELECT TAX_AUTHORITY.TAUTH_CODE, TAX_AUTHORITY.TAUTH_NAME, TAX_AUTHORITY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM TAX_AUTHORITY, STATE WHERE TAX_AUTHORITY.STATE_CODE = STATE.STATE_CODE (+) and FN_TAXAUTH_APPL_FOR_SITE(TAX_AUTHORITY.TAUTH_CODE,asLoginSite) = 'Y') LOOP PIPE ROW (sundryMaster(x.TAUTH_CODE,x.TAUTH_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'L' THEN FOR x IN (SELECT LOANPARTY.PARTY_cODE, LOANPARTY.PARTY_NAME, LOANPARTY.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM LOANPARTY, STATE WHERE LOANPARTY.STATE_CODE = STATE.STATE_CODE (+) and FN_LPARTY_APPL_FOR_SITE(LOANPARTY.PARTY_CODE,asLoginSite) = 'Y') LOOP PIPE ROW (sundryMaster(x.PARTY_CODE,x.PARTY_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'R' THEN FOR x IN (SELECT STRG_CUSTOMER.SC_cODE, STRG_CUSTOMER.FIRST_NAME||' '||STRG_CUSTOMER.MIDDLE_NAME||' '||STRG_CUSTOMER.LAST_NAME AS SC_NAME, CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM STRG_CUSTOMER, STATE WHERE STRG_CUSTOMER.STATUS ='A' AND STRG_CUSTOMER.STATE_CODE = STATE.STATE_CODE (+) and FN_STRGCUST_APPL_FOR_SITE(STRG_CUSTOMER.SC_cODE,asLoginSite) = 'Y') LOOP PIPE ROW (sundryMaster(x.SC_CODE,x.SC_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'B' THEN FOR x IN (SELECT BANK.BANK_CODE, BANK.BANK_NAME, BANK.CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM BANK, STATE WHERE BANK.STATE_CODE = STATE.STATE_CODE (+) and FN_BANK_APPL_FOR_SITE(BANK.BANK_CODE, asLoginSite) = 'Y') LOOP PIPE ROW (sundryMaster(x.BANK_CODE,x.BANK_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; --Start of getInstrumentTypePophelp function FUNCTION getInstrumentTypePophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2) RETURN instrumentTypeTable PIPELINED IS BEGIN --if asRcpMode = 'E' then --end if; if asRcpMode = 'B' then for x in (select DISTINCT(TRAN_SER) as pophelp_descr from receivables where trim(CUST_CODE) = trim(asCustCode) and trim(SITE_CODE) = trim(asSiteCode) and (TOT_AMT-Adj_Amt) < 0) loop pipe row (instrumentType(x.pophelp_descr)); end loop; return; elsif asRcpMode = 'E' then for x in (SELECT Descr as pophelp_descr FROM GENCODES WHERE FLD_NAME = 'CREDIT_CARD_TYPE') loop pipe row (instrumentType(x.pophelp_descr)); end loop; return; end if; END; --Start of getInstrumentNoPophelp function FUNCTION getInstrumentNoPophelp (asRcpMode in char, asCustCode in varchar2, asSiteCode in varchar2, asRefSer in varchar2) RETURN instrumentNoTable PIPELINED IS BEGIN if asRcpMode = 'B' or asRcpMode = 'G' then for x in (select TRAN_SER, REF_NO, REF_DATE, TOT_AMT - ADJ_AMT as BAL_AMT from receivables where trim(CUST_CODE) = trim(asCustCode) and trim(SITE_CODE) = trim(asSiteCode) and trim(TRAN_SER) = trim(asRefSer) and (TOT_AMT-ADJ_AMT) < 0) loop pipe row (instrumentNo(x.TRAN_SER, x.REF_NO, x.REF_DATE, x.BAL_AMT)); end loop; return; elsif asRcpMode = 'R' then for x in(select tran_type as TRAN_SER, tran_id as REF_NO ,tran_date as REF_DATE, net_amt as BAL_AMT from posreturn where trim(CUST_CODE) = trim(asCustCode) and adjusted is null or adjusted <> 'Y') loop pipe row (instrumentNo(x.TRAN_SER, x.REF_NO, x.REF_DATE, x.BAL_AMT)); end loop; return; end if; END; --start of pickrate function FUNCTION getPickRatePophelp (asTranDate in Date, asItemCode in char, asQuantity in number, asSiteCode in char, asLocCode in char) RETURN pickRateTable PIPELINED IS lotnopick char(15); ls_ptrrate number(14,3); ls_ptsrate number(14,3); ls_mrprate number(14,3); ls_quantity number(16,5); BEGIN --COMMENTED TO AVOID LOC_CODE WHILE SELECTING LOT NO --for x in (select lot_no, lot_sl from stock where item_code = asItemCode and site_code = asSiteCode and loc_code = asLocCode) for x in (select lot_no, lot_sl,loc_code, quantity from stock where item_code = asItemCode and site_code = asSiteCode and (QUANTITY - (ALLOC_QTY + (CASE WHEN HOLD_QTY IS NULL THEN 0 ELSE HOLD_QTY END))) > 0 and (exp_date > sysdate or exp_date is null)) loop lotnopick := x.lot_no; select nvl(FN_PICKRATE((select var_value from disparm where var_name = 'PTR') ,asTranDate,asItemCode,x.lot_no,(Select list_type from pricelist_mst where price_list = (select var_value from disparm where var_name = 'PTR' )), asQuantity, asSiteCode, x.loc_code, x.lot_sl),0), nvl(FN_PICKRATE((select var_value from disparm where var_name = 'PTS') ,asTranDate,asItemCode,x.lot_no,(Select list_type from pricelist_mst where price_list = (select var_value from disparm where var_name = 'PTS' )), asQuantity, asSiteCode, x.loc_code, x.lot_sl),0), nvl(FN_PICKRATE((select var_value from disparm where var_name = 'MRP') ,asTranDate,asItemCode,x.lot_no,(Select list_type from pricelist_mst where price_list = (select var_value from disparm where var_name = 'MRP' )), asQuantity, asSiteCode, x.loc_code, x.lot_sl),0) into ls_ptrrate,ls_ptsrate ,ls_mrprate from dual; ls_quantity := x.quantity; -- pipe row (pickRate(lotnopick,ls_ptrrate,ls_ptsrate,ls_mrprate)); pipe row (pickRate(lotnopick,ls_ptrrate,ls_ptsrate,ls_mrprate,ls_quantity)); end loop; return; END; ---Start cctr code package FUNCTION getCctrCodePophelp (acctCode in char) RETURN cctrMasterTable PIPELINED IS ls_cnt number(35); BEGIN select count(*) into ls_cnt from accounts_cctr a, costctr c where a.cctr_code=c.cctr_code and nvl(c.active, 'Y')='Y' and a.acct_code = acctCode; if(ls_cnt > 0) then FOR x IN (select a.cctr_code , c.descr, c.sh_descr from accounts_cctr a, costctr c where a.cctr_code=c.cctr_code and nvl(c.active, 'Y')='Y' and a.acct_code = acctCode) LOOP PIPE ROW (cctrMaster(x.CCTR_CODE, x.DESCR, x.SH_DESCR)); END LOOP; else FOR x IN (SELECT CCTR_CODE, DESCR, SH_DESCR FROM COSTCTR where nvl(active, 'Y')='Y') LOOP PIPE ROW (cctrMaster(x.CCTR_CODE, x.DESCR, x.SH_DESCR)); END LOOP; end if; RETURN; END; END popHelpPackage; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NO_ART (as_tran_id char,flag char) return number is as_no_art number (14,3); begin if flag='A' then select sum(no_art) into as_no_art from porcpdet where tran_id = as_tran_id; elsif flag='B' then select sum(no_art) into as_no_art from distord_iss where tran_id = as_tran_id; elsif flag='C' then select sum(no_art) into as_no_art from Distord_rcpdet where tran_id = as_tran_id; end if; return as_no_art; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SORDDET_ITEMS (ls_sales_order in char) return char is ls_descr varchar2(10000); cursor c1 is select distinct descr from sorddet, item where sorddet.item_code = item.item_code and sorddet.sale_order = ls_sales_order; begin ls_descr := ' '; for cdescr in c1 loop begin exit when c1%notfound; ls_descr := ls_descr || ', ' || cdescr.descr; end; end loop; ls_descr := ltrim(substr(ls_descr,3)); return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITEM_EXP_MFG_DATE (asworkorder workorder.work_order%type) return varchar2 is ldt_mfgdate date; ldt_expdate date; ldt_reldate date; ldt_duedate date; ld_mfgdate date; ld_expdate date; ls_itemcode varchar2(30); ls_trackshelflife varchar2(30); ls_mfgdateon varchar2(30); ls_returnstring varchar2(30); ls_bom_code varchar2(20); ls_lot varchar2(20); ls_ord_type varchar2(10); ll_shelflife number(5); ll_cnt number(5); ll_rows number(5); lb_got number(1); begin lb_got:=0; -- lot_no__issue is removed from select as it is not used and was giving error in certain workorder-Piyush-21/09/2011 -- select mfg_date__start,item_code, rel_date, due_date, bom_code,lot_no__issue, order_type, exp_date -- into ldt_mfgdate,ls_itemcode, ldt_reldate, ldt_duedate,ls_bom_code, ls_lot, ls_ord_type, ldt_expdate -- from workorder -- where work_order = asworkorder; select mfg_date__start,item_code, rel_date, due_date, bom_code, order_type, exp_date into ldt_mfgdate,ls_itemcode, ldt_reldate, ldt_duedate,ls_bom_code, ls_ord_type, ldt_expdate from workorder where work_order = asworkorder; If not(ldt_mfgdate) is null and not(ldt_expdate) is null and to_char(ldt_mfgdate , 'dd/mm/yyyy') <> '01/01/1900' and to_char(ldt_expdate , 'dd/mm/yyyy') <> '01/01/1900' Then ls_returnstring := to_char(to_date(ldt_mfgdate,'DD-MM-YYYY') || '#' ||to_date(ldt_expdate,'DD-MM-YYYY')); Return ls_returnstring; End If; select track_shelf_life, shelf_life, mfg_date_on into ls_trackshelflife, ll_shelflife, ls_mfgdateon from item where item_code = ls_itemcode; if ls_ord_type = 'P' then SELECT count(STOCK.EXP_DATE) INTO ll_rows FROM WORKORDER_ISS, WORKORDER_ISSDET, WORKORDER, BOM, BOMDET, STOCK WHERE ( WORKORDER_ISS.TRAN_ID = WORKORDER_ISSDET.TRAN_ID ) and ( WORKORDER_ISS.SITE_CODE = STOCK.SITE_CODE ) and ( WORKORDER_ISSDET.ITEM_CODE = STOCK.ITEM_CODE ) and ( WORKORDER_ISSDET.LOC_CODE = STOCK.LOC_CODE ) and ( WORKORDER_ISSDET.LOT_NO = STOCK.LOT_NO ) and ( WORKORDER_ISSDET.LOT_SL = STOCK.LOT_SL ) and ( WORKORDER_ISS.WORK_ORDER = WORKORDER.WORK_ORDER ) and ( BOM.BOM_CODE = WORKORDER.BOM_CODE ) and ( BOM.BOM_CODE = BOMDET.BOM_CODE ) and ( BOMDET.ITEM_CODE = STOCK.ITEM_CODE ) and ( ( bomdet.CONSIDER_LOT_NO__ISSUE = 'Y' ) AND ( stock.exp_date is not null ) AND ( workorder_iss.work_order = asworkorder ) ) ; end if; if ll_rows > 0 then lb_got :=1; SELECT STOCK.MFG_DATE INTO ldt_mfgdate FROM WORKORDER_ISS, WORKORDER_ISSDET, WORKORDER, BOM, BOMDET, STOCK WHERE ( WORKORDER_ISS.TRAN_ID = WORKORDER_ISSDET.TRAN_ID ) and ( WORKORDER_ISS.SITE_CODE = STOCK.SITE_CODE ) and ( WORKORDER_ISSDET.ITEM_CODE = STOCK.ITEM_CODE ) and ( WORKORDER_ISSDET.LOC_CODE = STOCK.LOC_CODE ) and ( WORKORDER_ISSDET.LOT_NO = STOCK.LOT_NO ) and ( WORKORDER_ISSDET.LOT_SL = STOCK.LOT_SL ) and ( WORKORDER_ISS.WORK_ORDER = WORKORDER.WORK_ORDER ) and ( BOM.BOM_CODE = WORKORDER.BOM_CODE ) and ( BOM.BOM_CODE = BOMDET.BOM_CODE ) and ( BOMDET.ITEM_CODE = STOCK.ITEM_CODE ) and ( ( bomdet.CONSIDER_LOT_NO__ISSUE = 'Y' ) AND ( stock.exp_date is not null ) AND ( workorder_iss.work_order = asworkorder ) ) ; SELECT STOCK.EXP_DATE into ldt_expdate FROM WORKORDER_ISS, WORKORDER_ISSDET, WORKORDER, BOM, BOMDET, STOCK WHERE ( WORKORDER_ISS.TRAN_ID = WORKORDER_ISSDET.TRAN_ID ) and ( WORKORDER_ISS.SITE_CODE = STOCK.SITE_CODE ) and ( WORKORDER_ISSDET.ITEM_CODE = STOCK.ITEM_CODE ) and ( WORKORDER_ISSDET.LOC_CODE = STOCK.LOC_CODE ) and ( WORKORDER_ISSDET.LOT_NO = STOCK.LOT_NO ) and ( WORKORDER_ISSDET.LOT_SL = STOCK.LOT_SL ) and ( WORKORDER_ISS.WORK_ORDER = WORKORDER.WORK_ORDER ) and ( BOM.BOM_CODE = WORKORDER.BOM_CODE ) and ( BOM.BOM_CODE = BOMDET.BOM_CODE ) and ( BOMDET.ITEM_CODE = STOCK.ITEM_CODE ) and ( ( bomdet.CONSIDER_LOT_NO__ISSUE = 'Y' ) AND ( stock.exp_date is not null ) AND ( workorder_iss.work_order = asworkorder ) ) ; else lb_got :=0; end if; if lb_got=0 then if (ldt_mfgdate) is null or to_char(ldt_mfgdate,'dd-mm-yyyy') = '01-01-1900' then if ls_mfgdateon = 'C' then ldt_mfgdate := ldt_duedate; else ldt_mfgdate := ldt_reldate; end if; if ls_trackshelflife = 'Y' then if not (ll_shelflife = 1 or ll_shelflife = 0) then ll_shelflife := ll_shelflife-1; ldt_expdate := add_months(ldt_mfgdate, ll_shelflife); ldt_expdate := last_day(ldt_expdate); end if; end if; end if; end if; if (ldt_expdate) is null then ls_returnstring := to_char(to_date(ldt_mfgdate,'DD-MM-YYYY') || '#'||to_date('01-JAN-1900','DD-MM-YYYY')); else ls_returnstring := to_char(to_date(ldt_mfgdate,'DD-MM-YYYY') || '#' ||to_date(ldt_expdate,'DD-MM-YYYY')); end if; return ls_returnstring; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CHANGECONTROL_CC_DATE ON CHANGECONTROL (CC_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 458752 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WORKORDER_DET ( as_lotno despatchdet.lot_no%type, as_itemcd despatchdet.item_code%type, as_flag char) return varchar2 is as_workorder workorder.work_order%type; as_site workorder.site_code%type; begin select work_order,site_code into as_workorder,as_site from workorder where lot_no=as_lotno and item_code =as_itemcd; if as_flag ='W' then return as_workorder; elsif as_flag ='S' then return as_site; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROCESS_CONDN_X ON PROCESS_CONDN (PCON_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TIME_ALLOCATION_EDT ON TIME_ALLOCATION (EMP_CODE, DATE_BEGIN, TIME_BEGIN) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SITE_INPUT ( p_list IN VARCHAR2) RETURN row_of_csv IS l_string CHAR(10000); l_comma_index PLS_INTEGER; l_index PLS_INTEGER := 1; l_tab row_of_csv := row_of_csv(); opt CHAR(10000); var_1 CHAR(4000); var_2 CHAR(4000); var_3 CHAR(4000); var_4 CHAR(4000); var_5 CHAR(4000); BEGIN opt := SUBSTR(p_list,0,1); VAR_1 := SUBSTR(P_LIST,3); IF OPT NOT IN ('1' ,'2' ,'3' ,'4' ,'5') THEN var_2 := p_list; ELSE IF opt = '1' THEN var_2 := var_1; ELSE IF opt = '2' THEN SELECT LISTAGG(SITE_CODE, ',') within GROUP( ORDER BY SITE_CODE) INTO var_2 FROM user_site WHERE user_id = var_1; ELSE IF opt = '3' THEN SELECT LISTAGG(SITE_CODE, ',') within GROUP( ORDER BY SITE_CODE) INTO var_2 FROM SITE WHERE FIN_ENTITY = var_1 ; ELSE IF opt = '4' THEN SELECT LISTAGG(SITE_CODE, ',') within GROUP( ORDER BY SITE_CODE) INTO var_2 FROM SITE WHERE FACILITY_CODE = var_1 ; ELSE IF opt = '5' THEN var_3 := SUBSTR(var_1,0,LENGTH(var_1) - LENGTH(SUBSTR (var_1,INSTR (var_1,',',1)))) ;--user_id var_4 := SUBSTR(SUBSTR(var_1,instr(var_1,',', 1) +1),1,instr( SUBSTR( var_1,instr(var_1,',', 1) +1) ,',', 1)-1) ;--frm_site var_5 := SUBSTR((SUBSTR(var_1,instr(var_1,',', 1) +1)),instr(SUBSTR( var_1,instr(var_1,',', 1) +1),',')+1) ; -- to_site SELECT LISTAGG(SITE_CODE, ',') within GROUP( ORDER BY SITE_CODE) INTO var_2 FROM user_site WHERE user_id = var_3 AND SITE_CODE >= var_4 AND site_code <= var_5; END IF; END IF; END IF; END IF; END IF; END IF ; l_string := var_2 || ','; LOOP l_comma_index := INSTR(l_string, ',', l_index); EXIT WHEN l_comma_index = 0; l_tab.EXTEND; l_tab(l_tab.COUNT) := RPAD(TRIM(SUBSTR(l_string, l_index, l_comma_index - l_index)),5); l_index := l_comma_index + 1; END LOOP; RETURN L_TAB; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MODE ( AS_REF_ID IN CHAR, AS_REFSER IN CHAR, AS_SUNDRY_CODE IN CHAR) RETURN CHAR IS LS_FIELDVALUE CHAR(50); ls_mode CHAR(10); BEGIN IF rtrim(as_refser) = 'M-PAY' THEN SELECT pay_mode INTO ls_mode FROM misc_payment WHERE tran_id=as_ref_id; elsif rtrim(as_refser) = 'E-PAY' THEN SELECT pay_mode INTO ls_mode FROM payment_exp WHERE tran_id = as_ref_id; elsif rtrim(as_refser) = 'RCP' THEN SELECT rcp_mode INTO ls_mode FROM receipt WHERE tran_id =as_ref_id; elsif rtrim(as_refser) = 'M-RCP' THEN SELECT rcp_mode INTO ls_mode FROM misc_receipt WHERE tran_id = as_ref_id; END IF; SELECT ( CASE WHEN ls_mode='C' THEN 'Cash' WHEN ls_mode='Q' THEN 'Cheque' WHEN ls_mode='D' THEN 'Demand Draft' WHEN ls_mode='T' THEN 'Electronic Transfer' WHEN ls_mode='I' THEN 'EDI' WHEN ls_mode='P' THEN 'Pay Order' WHEN ls_mode='R' THEN 'Credit Card' WHEN ls_mode='Y' THEN 'Payment Advice' WHEN ls_mode='G' THEN 'RTGS' WHEN ls_mode='N' THEN 'NEFT' ELSE ' ' END ) INTO ls_fieldvalue FROM dual; RETURN ls_fieldvalue; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CONVERT_EXCH_RATE_FROM_TO (mdate in date, mcurr_code_from in char, mcurr_code_to in char) return number is mfrom_rate number(17,6) := 0; mto_rate number(17,6) := 0; mconv_rate number(17,6) := 0; begin select exch_rate into mfrom_rate from daily_exch_rate_sell_buy where mdate between from_date and to_date and curr_code = mcurr_code_from; select exch_rate into mto_rate from daily_exch_rate_sell_buy where mdate between from_date and to_date and curr_code = mcurr_code_to; mconv_rate := round(mfrom_rate / mto_rate, 3); return mconv_rate; exception when others then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CUSTOS (as_cust_code varchar2, as_site_code varchar2, as_type char) return number is lc_osamt number(14,3); begin if as_type = 'T' then select sum(tot_amt-adj_amt) into lc_osamt from receivables where cust_code = as_cust_code and site_code = as_site_code; elsif as_type = 'O' then select sum(tot_amt-adj_amt) into lc_osamt from receivables where cust_code = as_cust_code and site_code = as_site_code and due_date < fn_sysdate(); end if; If lc_osamt is null then lc_osamt := 0 ; end if; return lc_osamt; Exception when OTHERS then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETMAILSUBJ_SIGNFOR_CVOUCH ( ls_tran_id cash_voucher.tran_id%type, tran_date cash_voucher.tran_date%type, tran_type cash_voucher.tran_type%type, emp_code cash_voucher.emp_code%type, site_code cash_voucher.site_code%type, status cash_voucher.status%type, confirmed cash_voucher.confirmed%type, conf_date cash_voucher.conf_date%type, emp_code__aprv cash_voucher.emp_code__aprv%type, curr_code cash_voucher.curr_code%type, tot_amt cash_voucher.tot_amt%type, Flag Varchar, apprv_flag varchar ) return varchar Is retrun_string varchar(1000); e_r_name varchar(100); tamount NUMBER(14,3); begin select trim(ddf_get_masters_name('EMPLOYEE',emp_code,'F')) into e_r_name from dual; if trim(ls_tran_id) ='' or tot_amt > 0 then tamount := tot_amt ; else select tot_amt into tamount from cash_voucher where tran_id = ls_tran_id; end if; retrun_string := 'Cash expense approval of ' ||''|| e_r_name || ' dated '|| initcap(TO_CHAR(tran_date ,'DD-Mon-YYYY')) || ' for amount '|| trim(curr_code) ||'.'|| tamount ; return trim(retrun_string); end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE EFFORTLEVDMMASTER AS OBJECT ( FLD_NAME VARCHAR2(20), DATA_GRP VARCHAR2(20), EVENT_DATE VARCHAR2(50), X_VALUE VARCHAR2(10), TARGET_VALUE VARCHAR2(20), ACTUAL_VALUE NUMBER(14,3), DESCR VARCHAR2(120), SH_DESCR VARCHAR2(30), THEME_COLOR VARCHAR2(30), ICON VARCHAR2(30), AVG_VALUE NUMBER(14,3), SPECIALITY VARCHAR2(1000), VISIT_CNT VARCHAR2(1000) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_HQ_DESCR (as_cust_code char,as_item_ser char,as_tran_date date) return varchar2 is ls_return char(160); hq varchar2(40); region varchar2(60); district varchar2(60); begin select p.descr into hq from gencodes p, org_structure o, org_structure DSM, org_structure RSM, org_structure_cust c ,version v where o.table_no=c.table_no and o.version_id=c.version_id and o.pos_code=c.POS_code and o.version_id=v.version_id and trim(p.fld_value)=trim(o.pool_code) AND O.POS_CODE__REPTO=DSM.POS_CODE(+) AND DSM.POS_CODE__REPTO=RSM.POS_CODE(+) and c.cust_code=as_cust_code and c.table_no=as_item_ser and as_tran_date between v.eff_from and v.valid_upto and as_tran_date between C.eff_DATE and C.valid_upto AND ROWNUM=1; ls_return:=substr(LPAD(TRIM(hq),40),-40) ; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SDSP_DET_TRANFLOW (as_desp_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; for c_despdet in ( select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.QUANTITY ,b.rate from item a ,despatchdet b where a.item_code = b.item_code and b.desp_id=as_desp_id and rownum <= 20 ) loop v_str := v_str || ''||''||c_despdet.descr||''||''||to_char(c_despdet.QUANTITY)||''||''||to_char(c_despdet.rate)||''||''; end loop; --V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PDCRCP_REFNO BEFORE INSERT or UPDATE OF ref_no ON PDC_RECEIVED referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_DED_OIL (as_taxcode in char, as_tranid in char, as_lineno in char) return number is lded_val number(14,3):=0; ls_qc_order char(10); ls_item_code char(10); ls_spec_ref char(15); ls_purcorder char(10); ls_flg char(1) ; ls_app_ded char(1); ls_unit_std char(3); ll_actual_result number(14,3) :=0 ; ll_rate__stduom__stduom number(14,3) :=0 ; ll_quantity number(14,3) :=0 ; ll_noart number(6,0) :=0; ll_rate__stduom number(14,3) :=0 ; ll_net_wgt number(14,3) :=0 ; cursor c_ded_mtd is select apply_ded from qcitem_spec_det where qcitem_spec_det.item_code = ls_item_code and qcitem_spec_det.spec_ref = ls_spec_ref ; begin begin begin select quantity,purc_order, unit__std, rate__stduom, quantity, rate, net_weight into ll_noart, ls_purcorder, ls_unit_std, ll_rate__stduom__stduom, ll_quantity, ll_rate__stduom, ll_net_wgt from porcpdet where tran_id = as_tranid and line_no = as_lineno ; exception when no_data_found then lded_val :=0; end; begin select udf_str__1 into ls_flg from porder where purc_order = ls_purcorder; exception when no_data_found then lded_val :=0; end; begin select qorder_no,item_code, spec_ref into ls_qc_order ,ls_item_code, ls_spec_ref from qc_order where porcp_no = as_tranid ; select to_number(actual_result) into ll_actual_result from QC_ORD_RES_SPEC where QC_ORD_RES_SPEC.qorder_no = ls_qc_order and QC_ORD_RES_SPEC.spec_code = as_taxcode ; exception when no_data_found then lded_val :=0; end; open c_ded_mtd ; LOOP fetch c_ded_mtd into ls_app_ded; EXIT WHEN (c_ded_mtd%NOTFOUND) ; -- if ls_app_ded = 'N' then -- ls_flg := 'N' ; -- EXIT; -- else -- ls_flg := 'Y' ; -- end if ; END LOOP ; CLOSE c_ded_mtd ; begin select apply_ded into ls_app_ded from qcitem_spec_det where qcitem_spec_det.item_code= ls_item_code and qcitem_spec_det.spec_ref= ls_spec_ref and qcitem_spec_det.spec_code= as_taxcode ; exception when no_data_found then lded_val :=0; end; -- ll_actual_result := ll_actual_result/1000 ; ll_actual_result := ll_actual_result ; if as_taxcode = 'MOIS1' and ll_actual_result >= 0.50 and ll_actual_result <= 1 and ls_app_ded = 'Y' then lded_val := (ll_quantity * ll_rate__stduom__stduom) * (ll_actual_result - 0.5) * 0.01 ; end if; if as_taxcode = 'MOIS2' and ll_actual_result >= 0.25 and ls_app_ded = 'Y' then lded_val := (ll_quantity * ll_rate__stduom) * (ll_actual_result - 0.25) * 0.01 ; end if; if as_taxcode = 'CLRQ1' and ll_actual_result >= 25 and ll_actual_result <= 30 and ls_app_ded = 'Y' then lded_val := (ll_actual_result - 25) * (ll_net_wgt/1000) * 15 ; end if ; if as_taxcode = 'CLRQ2' and ls_app_ded = 'Y' and ls_flg <> 'Y' then if ll_actual_result <= 3.7 then lded_val := 0; elsif ll_actual_result > 3.7 and ll_actual_result <= 4.0 then lded_val := (ll_net_wgt/10) * 1; elsif ll_actual_result > 4.0 and ll_actual_result <= 4.5 then lded_val := (ll_net_wgt/10) * 2; elsif ll_actual_result > 4.5 and ll_actual_result <= 5.0 then lded_val := (ll_net_wgt/10) * 3; elsif ll_actual_result > 5.0 and ll_actual_result <= 5.5 then lded_val := (ll_net_wgt/10) * 4; elsif ll_actual_result > 5.5 and ll_actual_result <= 6.0 then lded_val := (ll_net_wgt/10) * 5; end if ; end if; if as_taxcode = 'CLRQ3' and ls_app_ded = 'Y' then if ll_actual_result >= 30 and ll_actual_result <= 34.999 then lded_val := (ll_actual_result - 30) * (ll_net_wgt/1000) * 10; elsif ll_actual_result >= 35 and ll_actual_result <= 40 then lded_val := (5 * (ll_net_wgt/1000) * 10) + ((ll_actual_result - 35) * (ll_net_wgt/1000) * 20) ; end if ; end if; if as_taxcode = 'FFA1' and ls_app_ded = 'Y' then if ll_actual_result <= 1 then lded_val := 0; elsif ll_actual_result > 1.0 and ll_actual_result <= 1.25 then lded_val := (ll_net_wgt/10) * 1; elsif ll_actual_result > 1.25 and ll_actual_result <= 1.50 then lded_val := (ll_net_wgt/10) * 2; elsif ll_actual_result > 1.50 and ll_actual_result <= 1.75 then lded_val := (ll_net_wgt/10) * 3; elsif ll_actual_result > 1.75 and ll_actual_result <= 2.0 then lded_val := (ll_net_wgt/10) * 4; end if ; end if; if as_taxcode = 'FFA2' and ls_app_ded = 'Y' then if ll_actual_result <= 2 then lded_val := 0; elsif ll_actual_result > 2.0 and ll_actual_result <= 2.25 then lded_val := (ll_net_wgt/10) * 2; elsif ll_actual_result > 2.25 and ll_actual_result <= 2.50 then lded_val := (ll_net_wgt/10) * 4; elsif ll_actual_result > 2.50 and ll_actual_result <= 2.75 then lded_val := (ll_net_wgt/10) * 5; elsif ll_actual_result > 2.75 and ll_actual_result <= 3.0 then lded_val := (ll_net_wgt/10) * 6; elsif ll_actual_result > 3.00 and ll_actual_result <= 3.50 then lded_val := (ll_net_wgt/10) * 7; elsif ll_actual_result > 3.50 and ll_actual_result <= 4.00 then lded_val := (ll_net_wgt/10) * 8; elsif ll_actual_result > 4.00 and ll_actual_result <= 5.00 then lded_val := (ll_net_wgt/10) * 10; end if ; end if; exception when no_data_found then lded_val :=0; when others then lded_val :=0; end; if ls_unit_std = 'MT' then lded_val := round((lded_val/1000),2) ; end if ; return nvl(lded_val,0); exception when no_data_found then lded_val :=0; when others then lded_val :=0; return nvl(lded_val,0); end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TD_UPD_EMPRETDT BEFORE INSERT OR UPDATE ON EMPLOYEE REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN IF INSERTING OR NVL(:NEW.RETIREMENT_DATE,TRUNC(SYSDATE)) <> NVL(:OLD.RETIREMENT_DATE,TRUNC(SYSDATE)) THEN IF :NEW.RETIREMENT_DATE IS NOT NULL AND EXTRACT(YEAR FROM :NEW.RETIREMENT_DATE) < 2000 THEN IF NVL(:NEW.RETIREMENT_AGE , 0) = 0 AND :NEW.BIRTH_DATE IS NOT NULL THEN :NEW.RETIREMENT_DATE := :NEW.BIRTH_DATE; ELSE :NEW.RETIREMENT_DATE := ADD_MONTHS(:NEW.RETIREMENT_DATE , 1200); END IF; END IF; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAX_RET_AMT (as_purcorder in char) return varchar is ls_stringamt varchar2(5000); lc_tax_amt taxtran.tax_amt%type; ls_taxcode taxtran.tax_code%type; ls_lineno porddet.line_no%type; ls_retval varchar2(5000) ; cursor cur_tax is select tax_code from taxtran where tran_code = 'P-ORD' and tran_id = as_purcorder and line_no = (select min(line_no) from porddet where purc_order = as_purcorder ) and tax_code in (select distinct tax_code from taxtran where tran_code = 'P-ORD' and tran_id = as_purcorder and nvl(tax_amt,0) <> 0 ) order by line_no__tax ; begin ls_retval := ' ' ; if ddf_match_tax(as_purcorder) = 'N' then return ls_retval ; end if; open cur_tax ; LOOP fetch cur_tax into ls_taxcode ; EXIT WHEN (cur_tax%NOTFOUND) ; select sum(nvl(taxtran.tax_amt,0)) into lc_tax_amt from taxtran,tax where taxtran.tran_code = 'P-ORD' and taxtran.tran_id = as_purcorder and taxtran.tax_code = ls_taxcode and taxtran.tax_code = tax.tax_code and tax.print_tax = 'Y'; if length(ltrim(rtrim(ls_retval))) > 0 then ls_retval := ltrim(rtrim(ls_retval)) || chr(13) || ltrim(to_char(lc_tax_amt,'999999990.99')) ; else ls_retval := ltrim(to_char(lc_tax_amt,'999999990.99')) ; end if; END LOOP; close cur_tax ; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TMPLT_X ON PROJ_TEMPLATE (PROJ_TMPLT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDER_SALE_ORDER ON PORDER (SALE_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHEQITMSER (as_tranid in char ) RETURN NUMBER IS LL_ROW NUMBER(5); LS_RESULT NUMBER(1); ll_count number(5); ls_itemcode varchar2(10); ls_sitecode varchar2(5); ls_itemser varchar2(10); ll_loopcount number(5); CURSOR C1 IS SELECT DISTINCT(b.ITEM_CODE),a.SITE_CODE ,C.ITEM_SER FROM distord_rcp a ,distord_rcpdet b ,ITEM C where a.tran_id = b.tran_id AND B.ITEM_CODE = C.ITEM_CODE and a.tran_id = as_tranid ; begin LL_ROW :=0; open c1; loop fetch c1 into ls_itemcode,ls_sitecode,ls_itemser ; exit when c1% notfound; if TRIM(ls_itemser) in ('RM1','PM1') then select count(*) into ll_count from siteitem a where a.item_code = ls_itemcode and a.site_code = ls_sitecode and a.item_ser = ls_itemser and a.item_ser in ('RM1','PM1','SP'); LL_ROW := LL_ROW + ll_count; ll_loopcount := c1%rowcount ; else ll_row := 1; return ll_row; end if ; end loop; close c1; IF ll_loopcount = ll_row then ll_row := 1; else ll_row := 0; end if ; RETURN LL_ROW; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_IBCA_DETAILS (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select REF_SER, REF_NO, TOT_AMT from rcp_ibca_det where tran_id = as_tran_id ; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''||' Referance Series '||''||''||'Referance No'||''||''||'Total Amount'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DISC_PRICELIST (as_sales_pers IN CHAR ,as_strg_code IN CHAR ) return char is PRICE_LIST__DISC CHAR(5); cnt number(3); begin select count(*) into cnt from site_customer where cust_code = as_strg_code and site_code = (SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE=as_sales_pers) ; if(cnt > 0) then select PRICE_LIST__DISC into PRICE_LIST__DISC from site_customer where cust_code = as_strg_code and site_code = (SELECT EMP_SITE FROM EMPLOYEE WHERE EMP_CODE=as_sales_pers) ; cnt :=0; end if; select count(*) into cnt from customer where cust_code=as_strg_code; if(cnt > 0) then if(PRICE_LIST__DISC is null OR PRICE_LIST__DISC = '') then select PRICE_LIST__DISC into PRICE_LIST__DISC from customer where cust_code=as_strg_code; end if; end if; if(PRICE_LIST__DISC is null OR PRICE_LIST__DISC = '') then select PRICE_LIST__DISC into PRICE_LIST__DISC from strg_customer where sc_code=as_strg_code; end if; return PRICE_LIST__DISC; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TASK_RES_ALLOC_X1 ON PROJ_TASK_RES_ALLOC (PROJ_CODE, LINE_NO, LINE_NO__TSK) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_CHK_PORCP_SUPP (as_sitecode in char, as_suppcode in char,as_itemcode in char,as_suppcodemnfr in char) is ls_retval number := 0; ls_appr_supp char(1); ll_count number(3) := 0; begin ls_appr_supp :='N'; begin select count(1) into ll_count from siteitem where item_code = as_itemcode and site_code = as_sitecode; exception when others then ll_count := 0; end; dbms_output.put_line ('siteitem count [' || to_char(ll_count) ||']'); if ll_count > 0 then begin select (case when APPR_SUPP is null then ' ' else APPR_SUPP end) into ls_APPR_SUPP from siteitem where item_code = as_itemcode and site_code = as_sitecode; exception when others then ls_appr_supp := ' '; end; end if; if ls_appr_supp is null then ls_appr_supp := ' '; end if; dbms_output.put_line ('siteitem ls_appr_supp [' || ls_appr_supp ||']'); if length(trim(ls_appr_supp)) = 0 then begin select count(1) into ll_count from item where item_code = as_itemcode ; exception when others then ll_count := 0; end; dbms_output.put_line ('item count [' || to_char(ll_count) ||']'); if ll_count > 0 then begin select (case when APPR_SUPP is null then 'N' else APPR_SUPP end) into ls_APPR_SUPP from item where item_code = as_itemcode; exception when others then ls_appr_supp := 'N'; end; end if; else ls_retval := 1; end if; if ls_appr_supp is null or length(trim(ls_appr_supp)) = 0 then ls_appr_supp :='N'; end if; dbms_output.put_line ('item ls_appr_supp [' || ls_appr_supp ||']'); if ls_appr_supp = 'N' then null; end if; if (as_suppcodemnfr is not null and length(trim(as_suppcodemnfr)) > 0) and ls_appr_supp = 'Y' then ls_retval := 1; elsif ls_appr_supp = 'N' then ls_retval := 1; elsif ( as_suppcodemnfr is null or length(trim(as_suppcodemnfr)) = 0) and ls_appr_supp = 'Y' then ls_retval := 0; end if; dbms_output.put_line ('final ls_retval [' || to_char(ls_retval) ||']'); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AVGPOTENCY (as_item_code in char, as_site_code in char ,quantity in number) return char is lc_item_potency number(14,3); avg_potency number(14,3); lc_potency number(14,3) := 0 ; lc_potency_perc number(14,3); cnt number; begin begin begin select case when potency_perc is null then 100 else potency_perc end into lc_potency_perc from item where item_code = as_item_code ; exception when others then lc_potency := quantity; return lc_potency; end; if lc_potency_perc > 0 then begin select COUNT(*) into cnt from qc_order WHERE site_code = as_site_code and item_code = as_item_code and status = 'C' and item_potency > 0 and ROWNUM <= 3 order by status_date desc ; exception when others then lc_potency := quantity; end; if cnt > 0 then begin select sum(item_potency) into lc_item_potency from qc_order WHERE site_code = as_site_code and item_code = as_item_code and status = 'C' and item_potency > 0 and ROWNUM <= 3 order by status_date desc ; exception when others then lc_potency := quantity; end; avg_potency := (lc_item_potency / cnt) ; lc_potency := quantity / avg_potency * 100 ; else lc_potency := quantity; end if; else lc_potency := quantity; end if; exception when others then lc_potency := quantity; end; return lc_potency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION MOB_NO_VAL ( mobile_number VARCHAR2, p_count_code CHAR ) RETURN NUMBER IS tel_prfx VARCHAR2(10); mobile_min_len NUMBER; mobile_max_len NUMBER; BEGIN if mobile_number IS NOT NULL AND length(trim(mobile_number)) > 0 then -- Retrieve country-specific parameters from the country table mobile_min_len := 10; mobile_max_len := 10; IF p_count_code IS NOT NULL AND LENGTH(TRIM(p_count_code)) > 0 THEN BEGIN SELECT tel_prfx, NVL(mobile_min_len,10), NVL(mobile_max_len,10) INTO tel_prfx, mobile_min_len, mobile_max_len FROM country WHERE count_code = p_count_code; EXCEPTION WHEN NO_DATA_FOUND THEN mobile_min_len := 10; mobile_max_len := 10; END; END IF; -- Modified by Piyush on 20/03/23 as per Shiri Madam's instruction /* IF LENGTH(mobile_number) < mobile_min_len-1 THEN RETURN 0; -- Length is not within the valid range END IF; IF LENGTH(mobile_number) = mobile_min_len THEN IF SUBSTR(mobile_number, 1, 1) != 0 THEN RETURN 0; -- Length is not within the valid range END IF; END IF; IF LENGTH(mobile_number) > mobile_max_len THEN RETURN 0; -- Length is not within the valid range END IF; -- If length is equal to max length, prefix should match IF LENGTH(mobile_number) = mobile_max_len THEN IF SUBSTR(mobile_number, 1, LENGTH(trim(tel_prfx))) != trim(tel_prfx) THEN RETURN 0; -- Prefix doesn't match END IF; END IF; */ IF LENGTH(TRIM(mobile_number)) < mobile_min_len OR LENGTH(TRIM(mobile_number)) > mobile_max_len THEN RETURN 0; END IF; END IF; -- If all conditions pass, mobile number is valid RETURN 1; -- Any other exception occurs, return 10 END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GRADEAD_DATEWISE ON GRADE_AD (PAY_TABLE, GRADE_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSCHEDULE_BAL (fin_entity__fr IN VARCHAR2, site_code__fr IN VARCHAR2, site_code__to IN VARCHAR2, as_date_fr IN VARCHAR2, as_date_to IN VARCHAR2, AS_SCHEDULE IN NUMBER, AS_TYPE IN NUMBER) RETURN NUMBER IS AS_VALUE NUMBER(14,2); BEGIN SELECT CASE WHEN AS_TYPE = 1 THEN SUM(A.OP_BAL) ELSE (SUM(A.OP_BAL) + SUM(A.DEBIT_TRANS) - SUM(A.CREDIT_TRANS)) END INTO AS_VALUE FROM( SELECT DISTINCT FINENT.FIN_ENTITY, ACCTSGRP.SGROUP_CODE,ACCTSGRP.DESCR, ACCTSGRP.FORMAT_CODE,ACCTGRP.SCHEDULE_NO, FN_RGL_TRANS_DR(fn_rtimestamp(as_date_fr),fn_rtimestamp(as_date_to),acctbal.site_code,acctbal.acct_code) as debit_trans, FN_RGL_TRANS_CR(fn_rtimestamp(as_date_fr),fn_rtimestamp(as_date_to),acctbal.site_code,acctbal.acct_code) as credit_trans, FN_RGL_TRANDATE(fn_rtimestamp(as_date_fr),acctbal.site_code,acctbal.acct_code) as op_bal FROM ACCOUNTS, ACCTGRP, ACCTSGRP, ACCTBAL, SITE, FINENT WHERE ACCOUNTS.SGROUP_CODE = ACCTSGRP.SGROUP_CODE AND ACCTGRP.GROUP_CODE = ACCTSGRP.GROUP_CODE AND ACCOUNTS.ACCT_CODE = ACCTBAL.ACCT_CODE AND SITE.SITE_CODE = ACCTBAL.SITE_CODE AND FINENT.FIN_ENTITY = SITE.FIN_ENTITY AND NVL(ACCOUNTS.UDF_STR1,'XX') <> 'P' AND ACCTGRP.SCHEDULE_NO = AS_SCHEDULE AND TRIM(FINENT.FIN_ENTITY) =TRIM(fin_entity__fr) AND TRIM(SITE.SITE_CODE) >= TRIM(site_code__fr) AND TRIM(SITE.SITE_CODE) <= TRIM(site_code__to) ) A; RETURN AS_VALUE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETITEMPRINTAREA (as_item_code char) return number is prnt_area number(5) :=0; begin select (nvl(phy_attrib_8,0) * nvl(phy_attrib_9,0)) into prnt_area from item where item_code =as_item_code; return prnt_area; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ORDERLINENOMASTERTABLE AS TABLE OF orderLineNoMaster -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BUDGET_AMT (as_tran_code in char,as_site_cd in char,as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_dept_code in char, as_flag in char) return number is ac_budget_amt number(14,3); ld_tran_date date; ls_var_value char(30); ls_fin_ent char(10); ll_count number(3); begin if as_tran_code = 'M-VOUC' then --select tran_date,substr(site_code,1,2) into ld_tran_date,ls_fin_ent from misc_voucher where tran_id = as_tran_id; ls_fin_ent := substr(as_site_cd,1,2); ld_tran_date := to_date(sysdate); select fin_entity into ls_fin_ent from site where site_code = as_site_cd; else --select tran_date,substr(site_code,1,2) into ld_tran_date,ls_fin_ent from voucher where tran_id = as_tran_id; select fin_entity into ls_fin_ent from site where site_code = as_site_cd; ld_tran_date := to_date(sysdate); end if ; if ld_tran_date is null then ac_budget_amt := -1; return ac_budget_amt; end if; select var_value into ls_var_value from finparm where var_name = 'ACTIVE_BUDGET'; if ls_var_value is null then ac_budget_amt := -1; return ac_budget_amt; end if; select count(*) into ll_count from budgets where budget_id = ls_var_value; if ll_count <> 1 then ac_budget_amt := -1; return ac_budget_amt; end if; begin if ltrim(rtrim(as_flag)) = 'A' then select budget_amt into ac_budget_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent --added by pravin 05-05-2011 and acct_code = as_acct_code and cctr_code = as_cctr_code and anal_code = as_anal_code; if ac_budget_amt is null then ac_budget_amt := 0; return ac_budget_amt; end if; elsif ltrim(rtrim(as_flag)) = 'D' then select budget_amt into ac_budget_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code and dept_code = as_dept_code; if ac_budget_amt is null then ac_budget_amt := 0; return ac_budget_amt; end if; else select SUM(budget_amt) into ac_budget_amt from acctbudget where budget_id = ls_var_value and fin_entity = ls_fin_ent and acct_code = as_acct_code and cctr_code = as_cctr_code; if ac_budget_amt is null then ac_budget_amt := 0; return ac_budget_amt; end if; end if; exception when no_data_found then ac_budget_amt := 0; return ac_budget_amt ; end; return ac_budget_amt; exception when no_data_found then ac_budget_amt := -1; return ac_budget_amt ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_STOCKIST_AMD_X ON SALES_QUOT_STOCKIST_AMD (AMD_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PORCPNET_AMT (as_tranid char) return number is ls_netamt number(14,3); begin select nvl(sum(porcpdet.net_amt),0) into ls_netamt from porcpdet where porcpdet.tran_id =as_tranid; return ls_netamt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_NEWSCHEME_ADCODES (as_emp_code employee.emp_code%type, as_acctprd acctprd.code%type) return varchar2 is ad_codes varchar2(200); begin ad_codes :='IT02D,IT07P,IT16B,PITX'; return ad_codes; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CD_DETAIL (ls_crterm in char, lc_days in number, lc_amt in number, ls_retval in char ) return number is lc_number number(14,3) ; begin SELECT crtermfc.max_cramt into lc_number FROM crtermfc WHERE ( crtermfc.cr_term = ls_crterm ) AND ( crtermfc.min_day <= lc_days ) AND ( crtermfc.max_day >= lc_days ) ; if ls_retval = 'A' then lc_number := (lc_amt * lc_number ) / 100 ; end if ; if lc_number is null then lc_number := 0 ; end if ; return lc_number ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082796 ON INVITATION_CODE_GEN (INVITATION_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RBANKRECO_BOOK ( as_bankcode in char, ad_ason in date ) return number is lc_total number(14,3) ; lc_tot_p1 number(14,3) := 0; lc_tot_r1 number(14,3) := 0; lc_tot_p2 number(14,3) := 0; lc_tot_r2 number(14,3) := 0; begin select NVL(sum( nvl(banktran_log.amount,0)),0) into lc_tot_p1 FROM banktran_log, bank, bankreco_trace, bank_statement WHERE ( banktran_log.tran_id = bankreco_trace.tran_id__log (+)) and ( bankreco_trace.tran_id__stat = bank_statement.tran_id (+)) and ( banktran_log.bank_code = bank.bank_code ) and ( banktran_log.amount <> banktran_log.amt_adj ) and (banktran_log.bank_code = as_bankcode ) AND (banktran_log.tran_date <= ad_ason ) AND (banktran_log.tran_type = 'P' ) AND (banktran_log.status <> 'R' OR (bank_statement.status = 'R' AND bank_statement.eff_date > ad_ason ) AND banktran_log.tran_date < bank_statement.stat_date) ORDER BY banktran_log.tran_type ASC ; select NVL(sum( nvl(banktran_log.amount,0)),0) into lc_tot_r1 FROM banktran_log, bank, bankreco_trace, bank_statement WHERE ( banktran_log.tran_id = bankreco_trace.tran_id__log (+)) and ( bankreco_trace.tran_id__stat = bank_statement.tran_id (+)) and ( banktran_log.bank_code = bank.bank_code ) and ( banktran_log.amount <> banktran_log.amt_adj ) and (banktran_log.bank_code = as_bankcode ) AND (banktran_log.tran_date <= ad_ason ) AND (banktran_log.tran_type = 'R' ) AND (banktran_log.status <> 'R' OR (bank_statement.status = 'R' AND bank_statement.eff_date > ad_ason ) AND banktran_log.tran_date < bank_statement.stat_date) ORDER BY banktran_log.tran_type ASC ; select NVL(sum( nvl(bank_statement.amount,0) ),0) into lc_tot_p2 from bank_statement, bank, bankreco_trace, banktran_log where ( bank_statement.tran_id = bankreco_trace.tran_id__stat (+)) and ( bankreco_trace.tran_id__log = banktran_log.tran_id (+)) and ( bank_statement.bank_code = bank.bank_code ) and ( ( bank_statement.bank_code = as_bankcode ) and ( bank_statement.eff_date <= ad_ason ) and ( bank_statement.tran_type in ('P') ) and ( bank_statement.amount <> 0 ) ) and (bank_statement.status not in ('R','P') or (bank_statement.status = 'R' and bank_statement.eff_date > ad_ason) and bank_statement.stat_date < banktran_log.tran_date) order by bank_statement.tran_type asc ; select NVL(sum( nvl(bank_statement.amount,0) ),0) into lc_tot_r2 from bank_statement, bank, bankreco_trace, banktran_log where ( bank_statement.tran_id = bankreco_trace.tran_id__stat (+)) and ( bankreco_trace.tran_id__log = banktran_log.tran_id (+)) and ( bank_statement.bank_code = bank.bank_code ) and ( ( bank_statement.bank_code = as_bankcode ) and ( bank_statement.eff_date <= ad_ason ) and ( bank_statement.tran_type in ('R') ) and ( bank_statement.amount <> 0 ) ) and (bank_statement.status not in ('R','P') or (bank_statement.status = 'R' and bank_statement.eff_date > ad_ason) and bank_statement.stat_date < banktran_log.tran_date) order by bank_statement.tran_type asc ; lc_total := (lc_tot_p1 - lc_tot_r1 - lc_tot_p2 + lc_tot_r2) ; return lc_total ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0082792 ON EMP_STATUSCHG_FIELD (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MVTAX0 BEFORE insert or update ON misc_voucher referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; ls_projcode char(10); BEGIN begin if :new.tax_amt is null then :new.tax_amt :=0; end if; end; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CHC_CHEM_MET_FOCUS_SKU_MST force AS OBJECT ( SC_CODE VARCHAR2(30), ITEM_CODE VARCHAR2(60), SH_DESCR VARCHAR2(60), CHEM_NAME VARCHAR2(150), MGR_SUB CHAR(10) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_AVAILSTK (as_item_code CHAR, as_site_code CHAR) return number is ll_stkqty number(14,3); ll_sordstk number(14,3); begin SELECT sum(quantity - alloc_qty ) into ll_stkqty from invstat, stock, location where location.inv_stat = invstat.inv_stat and location.loc_code = stock.loc_code and stock.item_code = as_item_code and stock.site_code = as_site_code and invstat.stat_type <> 'S' and stock.quantity <> 0 and invstat.available = 'Y' ; If ll_stkqty is null then ll_stkqty := 0 ; end if; select sum(sorditem.quantity - sorditem.qty_desp) into ll_sordstk from sorditem sorditem ,sorder sorder where sorditem.sale_order = sorder.sale_order and sorditem.item_code = as_item_code and sorditem.site_code = as_site_code and sorder.status ='P'; If ll_sordstk is null then ll_sordstk := 0 ; end if; ll_stkqty := ll_stkqty - ll_sordstk; return ll_stkqty ; Exception when OTHERS then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CANCEL_DOCS_CNT ( as_ref_ser VARCHAR2, as_tran_dt_fr DATE, as_tran_dt_to DATE, as_ref_id_fr VARCHAR2, as_ref_id_to VARCHAR2, as_tran_type VARCHAR2 ) RETURN NUMBER IS ls_can_inv_count NUMBER; ls_dr_cr_flag CHAR; BEGIN -- Determine the DR/CR flag based on the reference series IF as_ref_ser = 'MDRCRC' THEN ls_dr_cr_flag := 'C'; ELSIF as_ref_ser = 'MDRCRD' THEN ls_dr_cr_flag := 'D'; ELSIF as_ref_ser = 'CRNRCP' THEN ls_dr_cr_flag := 'C'; ELSIF as_ref_ser = 'DRNRCP' THEN ls_dr_cr_flag := 'D'; END IF; BEGIN -- Query for 'S-INV' series IF as_ref_ser = 'S-INV' THEN SELECT COUNT(1) INTO ls_can_inv_count FROM drcr_rcp WHERE invoice_id BETWEEN as_ref_id_fr AND as_ref_id_to AND TRAN_DATE BETWEEN as_tran_dt_fr AND as_tran_dt_to AND tran_type = as_tran_type; -- Query for 'CRNRCP' and 'DRNRCP' series ELSIF as_ref_ser IN ('CRNRCP', 'DRNRCP') THEN SELECT COUNT(1) INTO ls_can_inv_count FROM drcr_rcp WHERE tran_id BETWEEN as_ref_id_fr AND as_ref_id_to AND TRAN_DATE BETWEEN as_tran_dt_fr AND as_tran_dt_to AND DRCR_FLAG = ls_dr_cr_flag AND (NVL(TRAN_STATUS, 'N') = 'X' OR TRAN_TYPE = as_tran_type); -- Query for 'MDRCRC' and 'MDRCRD' series ELSIF as_ref_ser IN ('MDRCRC', 'MDRCRD') THEN SELECT COUNT(1) INTO ls_can_inv_count FROM misc_drcr_rcp WHERE tran_id BETWEEN as_ref_id_fr AND as_ref_id_to AND TRAN_DATE BETWEEN as_tran_dt_fr AND as_tran_dt_to AND DRCR_FLAG = ls_dr_cr_flag AND NVL(TRAN_STATUS, 'N') = 'X'; ELSE ls_can_inv_count := 0; -- Default value if no condition matches END IF; EXCEPTION WHEN NO_DATA_FOUND THEN RAISE_APPLICATION_ERROR(-20003, 'No matching records found in transaction table.'); WHEN OTHERS THEN RAISE_APPLICATION_ERROR(-20004, 'Error retrieving data from transaction table: ' || SQLERRM); END; RETURN ls_can_inv_count; EXCEPTION WHEN OTHERS THEN RAISE_APPLICATION_ERROR(-20005, 'An unexpected error occurred: ' || SQLERRM); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MISCDRCR_CHK (as_invoiceId in invoice_trace.invoice_id%type) RETURN number IS TYPE cursor1 IS REF CURSOR; TYPE cursor2 IS REF CURSOR; invtrace_cur cursor1; miscdrcr_cur cursor2; miscdrcr_sql_stmt varchar2(3000); invtrace_sql_stmt varchar2(3000); invtrace_qty number; invtrace_itemcode char(10); invtrace_lot_sl char(15); invtrace_lot_no char(15); invtrace_lineNoTrace char(15); miscdrcr_qty number; miscdrcr_itemcode char(10); miscdrcr_lot_sl char(15); miscdrcr_lot_no char(15); miscdrcr_lineNoTrace char(15); cnumber number; begin invtrace_sql_stmt :='select sum(quantity),item_code,lot_no,lot_sl,inv_line_no from invoice_trace where invoice_id = '''||as_invoiceId||''' group by item_code,lot_no, lot_sl,inv_line_no'; cnumber:=0; --dbms_output.put_line('--- Begin function miscdrcr_check-------'); open invtrace_cur for invtrace_sql_stmt; <> LOOP FETCH invtrace_cur INTO invtrace_qty,invtrace_itemcode,invtrace_lot_no,invtrace_lot_sl,invtrace_lineNoTrace; EXIT WHEN invtrace_cur%NOTFOUND; IF invtrace_cur%FOUND THEN miscdrcr_sql_stmt := 'select sum(nvl(d.quantity,0)) as Quantity,d.item_code,d.lot_sl, d.lot_no,line_no__invtrace from misc_drcr_rcp h,misc_drcr_rdet d where h.tran_id=d.tran_id and h.remarks like ''%POD%'||as_invoiceId||''' and Quantity <> 0 group by d.item_code,d.lot_sl,d.lot_no,line_no__invtrace'; open miscdrcr_cur for miscdrcr_sql_stmt; <> loop FETCH miscdrcr_cur INTO miscdrcr_qty,miscdrcr_itemcode,miscdrcr_lot_sl,miscdrcr_lot_no,miscdrcr_lineNoTrace; EXIT WHEN miscdrcr_cur%NOTFOUND; IF miscdrcr_cur%FOUND THEN if miscdrcr_qty < invtrace_qty AND invtrace_itemcode = miscdrcr_itemcode AND miscdrcr_lot_no = invtrace_lot_no AND miscdrcr_lot_sl = invtrace_lot_sl AND miscdrcr_lineNoTrace = invtrace_lineNoTrace THEN return 1; else goto cont4; END IF; END IF; end loop; close miscdrcr_cur; ELSE goto cont3; END IF; END LOOP; close invtrace_cur; return cnumber; exception when others then return -39; --return cnumber; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_RECOVERY (as_workorder in char, as_trantype in char, as_itemcode in char) return varchar2 is ll_enhcount number(6,0) := 0; ll_bypcount number(6,0) := 0; ll_reccount number(6,0) := 0; ls_retval varchar2(1) := '0'; begin begin -- check whether recovery added select count(1) into ll_enhcount from workorder_enhanc a, workorder_enhanc_det b where a.tran_id = b.tran_id and a.work_order = as_workorder; exception when no_data_found then ll_enhcount := 0; end; --if as_trantype = 'B' and ll_enhcount > 0 then -- by-product receipt not allowed as recovery added -- ls_retval := '1' ; if as_trantype = 'F' and ll_enhcount = 0 then -- final product - no recovery added -- if by-product defined receipt should be taken begin select count(1) into ll_bypcount from byproduct where item_code = as_itemcode ; exception when no_data_found then ll_bypcount := 0; end; if ll_bypcount > 0 then -- by-product defined, receipt should be made begin select count(1) into ll_reccount from workorder_receipt where work_order = as_workorder and tran_type <> 'F' and confirmed = 'Y'; exception when no_data_found then ll_reccount := 0; end; if ll_reccount = 0 then -- final product - no recovery added -- if by-product defined but receipt not taken ls_retval := '1'; end if; end if; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CRTERMFC (ac_amount in number,al_no_days in number,as_crterm in char,ad_tran in date) return varchar is lc_finchg number(20,2); ls_type varchar(100); ls_return varchar(100) ; begin select fin_chg, fchg_type into lc_finchg, ls_type from crtermfc where cr_term = as_crterm and al_no_days >= min_day and al_no_days <= max_day and ac_amount >= min_cramt and ac_amount <= max_cramt and ad_tran >= eff_date and ad_tran <= valid_upto; if SQLCODE <> 0 then lc_finchg := 0; else ls_return := ls_type || ','||lc_finchg ; end if; Return ls_return ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE EFF_DOCMET_DT_WISE_DM AS FUNCTION getDocMetDtWiseInfo(empCode in char, prdCode in char) RETURN EFF_DOCMET_DT_WISE_TB PIPELINED; END EFF_DOCMET_DT_WISE_DM; CREATE OR REPLACE PACKAGE BODY EFF_DOCMET_DT_WISE_DM AS FUNCTION getDocMetDtWiseInfo (empCode in char, prdCode in char) RETURN EFF_DOCMET_DT_WISE_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE CODE = prdCode; WITH MGR_DATA AS ( SELECT A.EMP_CODE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ) SELECT COUNT(1) INTO UNCONFIRM_CNT FROM SPRS_ACT_TRAN SAT, MGR_DATA MGR_DATA WHERE SAT.EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND SAT.CONFIRMED = 'Y' AND SAT.SALES_PERS = MGR_DATA.EMP_CODE; if (UNCONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; SELECT CODE INTO AS_PRD_CODE FROM PERIOD WHERE FR_DATE = AS_FR_DATE AND TO_DATE = AS_TO_DATE; for x in ( WITH MGR_DATA AS ( SELECT A.EMP_CODE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ) SELECT SM.STRG_CODE SC_CODE, (SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS DR_NAME, SPL.DESCR AS SPECIALITY, SS.NO_VISIT AS PLANNED_VISIT, SSC.DESCR CLASS_CODE,SS.CATEGORY, LOC.DESCR AS LOCALITY, (SELECT ROUTE_TYPE FROM SPRS_ROUTE ROUTE WHERE ROUTE.SPRS_CODE = SS.SALES_PERS AND ROUTE.ROUTE_ID = SS.ROUTE_ID) ROUTE_TYPE, EVENT_DATE AS WORK_DATE, AS_PRD_CODE as PRD_CODE, SM.SALES_PERS MGR_SUB, ITEMSER.DESCR as DIVISION, EMP.EMP_CODE, (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) AS EMP_NAME, ST.DESCR as HEAD_QUAT, EMP.DESIGNATION as DESIGN FROM MGR_DATA MGR_DATA, FIELDACTIVITY F, STRG_SER_CLASS SSC, SALES_PERS SP, EMPLOYEE EMP, ITEMSER ITEMSER, STATION ST, STRG_MEET SM LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = SM.STRG_CODE LEFT OUTER JOIN LOCALITY LOC ON SC.LOCALITY_CODE = LOC.LOCALITY_CODE, STRG_SERIES SS LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE = SPL.SPL_CODE WHERE SS.SC_CODE = SM.STRG_CODE AND SS.SALES_PERS = SM.SALES_PERS AND SM.SALES_PERS = MGR_DATA.EMP_CODE AND EMP.EMP_CODE = SM.SALES_PERS AND EMP.STAN_CODE__HQ = ST.STAN_CODE AND SP.ITEM_SER = ITEMSER.ITEM_SER AND SM.SALES_PERS = SP.SALES_PERS AND SSC.ITEM_SER = SP.ITEM_SER AND SSC.class_code = SS.CLASS_CODE AND SM.EVENT_DATE BETWEEN (SELECT FR_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SM.EVENT_TYPE = F.ACTIVITY_CODE AND F.ACTIVITY_TYPE = 'FW' AND SM.STRG_TYPE = 'D' AND SM.CONFIRMED = 'Y' AND SM.STRG_CODE != '0000000000' -- AND SS.STATUS = 'Y' AND 'Y' = ( CASE WHEN SS.STATUS = 'Y' AND SS.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' WHEN SS.STATUS = 'N' AND SS.EFF_DATE <= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) AND SS.CHG_DATE >= (SELECT TO_DATE FROM PERIOD WHERE CODE = AS_PRD_CODE) THEN 'Y' ELSE 'N' END ) order by sm.event_date, ss.no_visit ) LOOP PIPE ROW (EFF_DOCMET_DT_WISE_MST( x.SC_CODE,x.DR_NAME,x.SPECIALITY,x.PLANNED_VISIT,x.CLASS_CODE,x.CATEGORY,x.LOCALITY,x.ROUTE_TYPE,x.WORK_DATE, x.PRD_CODE, x.MGR_SUB, x.DIVISION, x.EMP_CODE, x.EMP_NAME, x.HEAD_QUAT, x.DESIGN)); END LOOP; RETURN; END; END EFF_DOCMET_DT_WISE_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PROJECT_DESCR (as_projcode in char ) return varchar2 is ls_projdescr varchar2(120); begin begin SELECT DESCR into ls_projdescr FROM PROJECT WHERE PROJ_CODE = as_projcode; exception when others then ls_projdescr := ''; end; IF ls_projdescr IS NULL THEN ls_projdescr := ''; END IF; RETURN ls_projdescr; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SMKT_PLANNER_DETAILS (AS_SALES_PERS char,AS_WORK_DATE date,AS_PFA_TABLE char,AS_DETAILS_OF char) return varchar2 is cursor c1 is select distinct (case AS_DETAILS_OF when 'STAN_CODE' then a.work_stan_code when 'STAN_DESCR' then b.descr when 'REMARKS' then a.plan_descr when 'ACT_CODE' then a.plan_activity when 'ACT_DESCR' then c.descr end) as details, (case when AS_DETAILS_OF in ('ACT_CODE','ACT_DESCR') then a.plan_activity end) as plan_activity from sprs_plan a,station b,fieldactivity c where b.stan_code(+) = a.work_stan_code and c.activity_code(+) = a.plan_activity and a.sprs_code__for = AS_SALES_PERS and a.plan_date = AS_WORK_DATE and AS_PFA_TABLE = 'P' and ((AS_DETAILS_OF = 'STAN_CODE' and a.work_stan_code is not null) or (AS_DETAILS_OF = 'STAN_DESCR' and b.descr is not null) or (AS_DETAILS_OF = 'REMARKS' and a.plan_descr is not null) or (AS_DETAILS_OF = 'ACT_CODE' and a.plan_activity is not null) or (AS_DETAILS_OF = 'ACT_DESCR' and c.descr is not null)) union all select distinct (case AS_DETAILS_OF when 'STAN_CODE' then a.work_stan_code when 'STAN_DESCR' then b.descr when 'REMARKS' then a.plan_descr when 'ACT_CODE' then a.plan_activity when 'ACT_DESCR' then c.descr when 'DEV_REMARKS' then 'CHANGE FROM VIEW CONFIRM PLAN' end) as details, (case when AS_DETAILS_OF IN ('ACT_CODE','ACT_DESCR') then a.plan_activity end) as plan_activity from sprs_plan_frozen a,station b,fieldactivity c where b.stan_code(+) = a.work_stan_code and c.activity_code(+) = a.plan_activity and a.sprs_code__for = AS_SALES_PERS and a.plan_date = AS_WORK_DATE and AS_PFA_TABLE = 'F' and ((AS_DETAILS_OF = 'STAN_CODE' and a.work_stan_code is not null) or (AS_DETAILS_OF = 'STAN_DESCR' and b.descr is not null) or (AS_DETAILS_OF = 'REMARKS' and a.plan_descr is not null) or (AS_DETAILS_OF = 'ACT_CODE' and a.plan_activity is not null) or (AS_DETAILS_OF = 'ACT_DESCR' and c.descr is not null) or (AS_DETAILS_OF = 'DEV_REMARKS' and a.plan_status = '2')) union all select distinct (case AS_DETAILS_OF when 'STAN_CODE' then b.work_stan_code when 'STAN_DESCR' then c.descr when 'REMARKS' then a.general_remark when 'ACT_CODE' then b.activity_code when 'ACT_DESCR' then d.descr when 'ROUTE_DESCR' then b.wrk_route_descr end) as details, (case when AS_DETAILS_OF in ('ACT_CODE','ACT_DESCR') then b.activity_code end) as plan_activity from dr_main a,dr_travel_details b,station c,fieldactivity d where b.sales_pers = a.sales_pers and b.work_date = a.work_date and c.stan_code(+) = b.work_stan_code and d.activity_code(+) = b.activity_code and a.sales_pers = AS_SALES_PERS and a.work_date = AS_WORK_DATE and a.confirmation_flag = 'Y' and AS_PFA_TABLE = 'A' and ((AS_DETAILS_OF = 'STAN_CODE' and b.work_stan_code is not null) or (AS_DETAILS_OF = 'STAN_DESCR' and c.descr is not null) or (AS_DETAILS_OF = 'REMARKS' and a.general_remark is not null) or (AS_DETAILS_OF = 'ACT_CODE' and b.activity_code is not null) or (AS_DETAILS_OF = 'ACT_DESCR' and d.descr is not null) or (AS_DETAILS_OF = 'ROUTE_DESCR' and b.wrk_route_descr is not null)) order by 2 desc,1; a_details varchar2(2000); a_count number(5) := 0; begin for i in c1 loop a_count := a_count + 1; if (a_count <> 1) then a_details := a_details || ','; end if; a_details := a_details || trim(i.details); if (AS_DETAILS_OF in ('ACT_CODE','ACT_DESCR')) then exit; end if; end loop; if (AS_DETAILS_OF = 'ACT_DESCR') then if (a_count = 0 and DDF_GET_HOLIDAY_FOR_DATE(AS_SALES_PERS,AS_WORK_DATE) = 'W') then a_details := a_details || 'WEEKLY OFF'; elsif (a_count = 0 and DDF_GET_HOLIDAY_FOR_DATE(AS_SALES_PERS,AS_WORK_DATE) = 'H') then a_details := a_details || 'HOLIDAY'; end if; end if; return a_details; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOTDET_X ON SALES_QUOTDET (QUOT_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RTIMESTAMP ( ls_timestamp varchar2) return date is begin return to_date(ls_timestamp,'yyyy-mm-dd hh24:mi:ss'); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GIM_EXCISE (as_gimno porcp.tran_id%type) return number is ldec_excise number(14,3) ; begin select sum(tax_amt) into ldec_excise from taxtran where tran_code = 'P-RCP' and tax_code='EXC' and tran_id=as_gimno; return(ldec_excise); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SALES_QUOT_ITEMDET_PK ON SALES_QUOT_ITEMDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_SOPRESHMENTCOND (as_despatch_id char) return number is ll_soterm_status number; CurStatus Char(1); cursor C1 is select sord_term_det.curr_status from despatchdet,sord_term_det where despatchdet.sord_no = sord_term_det.sale_order(+) and despatchdet.desp_id=as_despatch_id ; begin OPEN C1; IF C1%ISOPEN THEN LOOP fetch C1 into CurStatus; EXIT WHEN C1%NOTFOUND; if CurStatus='C'then ll_soterm_status:=1; elsif CurStatus='P' then ll_soterm_status:=0; exit; else ll_soterm_status:=1; end if; END LOOP; end if; close C1; return ll_soterm_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TOUR_STATUSDESR_FORCAL (Vi_tour_id_1 In VARCHAR2) Return Varchar2 Is History_Descr Varchar2(200); Vi_tour_id varchar2(15); vi_status char(1); BEGIN Vi_tour_id := trim(Vi_tour_id_1) ; Select status Into vi_status From tour Where tour_id = Vi_tour_id; IF vi_status = 'U' THEN History_Descr := 'Requested '; elsif (vi_status='O') then History_Descr := 'Requested '; elsif (vi_status='S') then History_Descr := 'Requested '; elsif (vi_status='A') then History_Descr := 'Approved '; END IF; return History_Descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PO_PROJ_CODE (as_purc_order in char , as_line_no__ord in char) return char is ls_proj_code char(10) ; BEGIN select proj_code into ls_proj_code from porddet where purc_order = as_purc_order and line_no = as_line_no__ord; IF ls_proj_code IS NULL THEN ls_proj_code :=''; END IF; RETURN ls_proj_code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUST_ITEMDESCR (as_itemcd despatchdet.item_code%type,as_custcd despatch.cust_code%type) return varchar2 is as_descr customeritem.descr%type; begin select descr into as_descr from customeritem where cust_code = as_custcd and item_code = as_itemcd ; return as_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PROCROUTE_DESCR (asroute_code procroute.route_code%type, asproc_code procroute.proc_code%type, asoper_no procroute.operation%type) return varchar2 is ls_datas procroute.descr%type; begin select descr into ls_datas from procroute where route_code = asroute_code and proc_code = asproc_code and operation = asoper_no ; if length(trim(ls_datas)) = 0 then ls_datas := ' '; end if; return ls_datas; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DEPB_APPLICATION_DET_X ON DEPB_APPLICATION_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MASTERS_NAME (AS_MASTER char,AS_CODE char,AS_TYPE char) return varchar2 is a_prefix employee.name_prefix%type; a_fname employee.emp_fname_long%type; a_mname employee.emp_mname_long%type; a_lname employee.emp_lname_long%type; a_return varchar2(200); a_count number(20) := 0; begin if (AS_MASTER = 'EMPLOYEE') then select name_prefix,emp_fname_long,emp_mname_long,emp_lname_long into a_prefix,a_fname,a_mname,a_lname from employee where emp_code = AS_CODE; elsif (AS_MASTER = 'CANDIDATE') then select name_prefix,emp_fname,emp_mname,emp_lname into a_prefix,a_fname,a_mname,a_lname from candidate where candidate_id = AS_CODE; elsif (AS_MASTER = 'STRGCUSTOMER') then select prefix,first_name,middle_name,last_name into a_prefix,a_fname,a_mname,a_lname from strg_customer where sc_code = AS_CODE; end if; if (instr(AS_TYPE,'T') != 0) then a_prefix := trim(a_prefix); a_fname := trim(a_fname); a_mname := trim(a_mname); a_lname := trim(a_lname); end if; if (instr(AS_TYPE,'D') != 0) then a_prefix := a_prefix || '.'; end if; for i in 1..(length(AS_TYPE)) loop a_count := a_count + 1; if (a_count != 1 and substr(AS_TYPE,a_count,1) in ('P','F','M','L','C','-','[',']')) then a_return := a_return || ' '; end if; if (substr(AS_TYPE,a_count,1) = 'P') then a_return := a_return || a_prefix; elsif (substr(AS_TYPE,a_count,1) = 'F') then a_return := a_return || a_fname; elsif (substr(AS_TYPE,a_count,1) = 'M') then a_return := a_return || a_mname; elsif (substr(AS_TYPE,a_count,1) = 'L') then a_return := a_return || a_lname; elsif (substr(AS_TYPE,a_count,1) = 'C') then a_return := a_return || trim(AS_CODE); elsif (substr(AS_TYPE,a_count,1) = '-') then a_return := a_return || '-'; elsif (substr(AS_TYPE,a_count,1) = '[') then a_return := a_return || '['; elsif (substr(AS_TYPE,a_count,1) = ']') then a_return := a_return || ']'; end if; end loop; return a_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCK_ACCT (as_consorder in char,al_lineno_ord number, as_consissue in char, ls_item in char, ls_site in char, ls_loc in char, ls_lot in char, ls_sl in char) return char is ls_acct char(15); ls_trantype consume_iss.tran_type%type ; ls_loccodeiss location.loc_code%type ; begin select tran_type into ls_trantype from consume_iss where cons_issue = as_consissue ; if ls_trantype = 'I' then select acct_code__inv || ' ' || cctr_code__inv into ls_acct from stock where item_code = ls_item and site_code = ls_site and loc_code = ls_loc and lot_no = ls_lot and lot_sl = ls_sl; else select a.loc_code into ls_loccodeiss from consume_iss_det a, consume_iss b where a.cons_issue = b.cons_issue and b.cons_order = as_consorder and a.line_no__ord = al_lineno_ord and b.tran_type = 'I' and b.confirmed = 'Y' and a.lot_no = ls_lot and a.lot_sl = ls_sl and rownum = 1 ; select acct_code__inv || ' ' || cctr_code__inv into ls_acct from stock where item_code = ls_item and site_code = ls_site and loc_code = ls_loccodeiss and lot_no = ls_lot and lot_sl = ls_sl; end if; return (ls_acct); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_STK_AVAILABLE ( as_saleorder in char) Return Number is ld_qty number(14,3); ll_retval number := 0; Begin Begin for cur_sorditem in ( select site_code,item_code, quantity - qty_desp - qty_alloc as quantity from sorditem where sale_order = as_saleorder and line_type = 'I' and quantity - qty_desp - qty_alloc > 0 ) loop begin select sum(s.quantity - s.alloc_qty) into ld_qty from stock s, location l, invstat i where l.loc_code = s.loc_code and i.inv_stat = l.inv_stat and i.available = 'Y' and i.stat_type <> 'S' and s.item_code = cur_sorditem.item_code and s.site_code = cur_sorditem.site_code ; Exception When others then null; END; if ld_qty < cur_sorditem.quantity then ll_retval := ll_retval + 1; end if; end loop; Exception When others then null; END; if ll_retval > 0 then ll_retval := 1; end if; Return ll_retval; End; -------------end--------- -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORKORD_ISS_CONF_SITE ON WORKORDER_ISS (CONF_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 10485760 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CHARGE_BACK_CUST_CONF ON CHARGE_BACK (CUST_CODE, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_HOLTBLNO_EXPENSE (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select eff_date,conf_date,chg_date,hol_tblno__fr from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' order by emp_code,eff_date; a_hol_tblno employee.hol_tblno%type; a_eff_date date; a_conf_date date; a_chg_date date; begin for i in c1 loop if (i.eff_date != a_eff_date and a_eff_date is not null) then exit; end if; if (a_conf_date is null) then a_hol_tblno := i.hol_tblno__fr; a_conf_date := i.conf_date; a_chg_date := i.chg_date; else if (i.conf_date < a_conf_date) then a_hol_tblno := i.hol_tblno__fr; a_conf_date := i.conf_date; a_chg_date := i.chg_date; elsif (i.conf_date = a_conf_date) then if (i.chg_date < a_chg_date) then a_hol_tblno := i.hol_tblno__fr; a_chg_date := i.chg_date; end if; end if; end if; a_eff_date := i.eff_date; end loop; if (trim(a_hol_tblno) is null) then select hol_tblno into a_hol_tblno from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_hol_tblno) is null) then select hol_tblno into a_hol_tblno from site where site_code = ddf_hr_status(AS_EMP_CODE,AS_DATE,'W'); end if; return a_hol_tblno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_RECV_TRACE_REFNO (as_transer in receivables.tran_ser%type, as_refno in receivables.ref_no%type ) is ll_count number(10) := 0; ll_updatecount number := 0; lc_adjamt number := 0; lc_totamt number := 0; ldt_statdate date; ls_amtafter number := 0; ll_cnt number := 0; begin begin select count(1) into ll_cnt from receivables_trace where ref_ser = as_transer and ref_no = as_refno; if ll_cnt = 0 then for cur_recv in ( select tran_ser,ref_no,tran_id,tot_amt, adj_amt, ref_date,due_date,Cr_term,cust_code, site_code,exch_rate,bank_code,curr_code from receivables where tran_ser = as_transer and ref_no = as_refno ) loop lc_totamt := cur_recv.tot_amt; insert into receivables_trace ( tran_id, tran_id__rcv, ref_ser, ref_no, ref_ser__adj, ref_no__adj, adj_amt, amt_before, amt_after, ref_date, Due_date, Cr_term, Cust_code__bill, Cust_code, Site_code, Curr_code, Exch_rate, tran_type, Remarks, Doc_ref, Doc_ref_type, Doc_ref_date, Bank_code, change_type, OS_STAT, status_date, chg_user, chg_date, eff_date ) select lpad(recvtc_seq.nextval,12,'0') tran_id, cur_recv.tran_id tran_id__rcv, cur_recv.tran_ser ref_ser, cur_recv.ref_no ref_no, null ref_ser__adj, null ref_no__adj, 0 adj_amt, 0 amt_before, cur_recv.tot_amt amt_after, cur_recv.ref_date ref_date, cur_recv.due_date Due_date, cur_recv.cr_term Cr_term, cur_recv.cust_code Cust_code__bill, cur_recv.cust_code Cust_code, cur_recv.site_code Site_code, cur_recv.curr_code Curr_code, cur_recv.exch_rate Exch_rate, 'I' tran_type, 'Insert by Proteus' Remarks, to_char(cur_recv.adj_amt) Doc_ref, 'O' Doc_ref_type, sysdate Doc_ref_date, cur_recv.bank_code Bank_code, 'I' change_type, 'U' status, cur_recv.ref_date status_date, 'Proteus' chg_user, sysdate chg_date, eff_date from receivables where tran_ser = cur_recv.tran_ser and ref_no = cur_recv.ref_no; for cur_tran in ( select ref_ser_adj,tran_id,conf_date,eff_date,adj_amt from ( select 'RCP' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'RCP' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'RCP' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.rcp_amt adj_amt from receipt h, rcpdet d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'RCP' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'RCP' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'RCP' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.ADJ_AMT adj_amt from receipt h, rcpadv d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'R-IBCA' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-IBCA' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'R-IBCA' and i.ref_id = h.tran_id and rownum = 1) eff_date,d.TOT_AMT adj_amt from rcp_ibca h, rcp_ibca_det d where d.tran_id = h.tran_id and h.confirmed = 'Y' and trim(h.tran_ser) = 'I' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'R-DIS' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-DIS' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'R-DIS' and i.ref_id = h.tran_id and rownum = 1) eff_date,-1 * d.rcp_amt adj_amt from rcpdishnr h, rcpdishnr_det d where d.tran_id = h.tran_id and h.confirmed = 'Y' and h.tran_ser = 'R' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'R-DIS' ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser = 'R-DIS' and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser = 'R-DIS' and i.ref_id = h.tran_id and rownum = 1) eff_date, -1 * (select adv_amt from receipt where tran_id = cur_recv.ref_no) adj_amt from rcpdishnr h where h.confirmed = 'Y' and h.tran_ser = 'R' and h.receipt_no = cur_recv.ref_no union all select 'R-ADJ' ref_ser_adj, case when trim(cur_recv.tran_ser) = 'S-INV' then d.ref_no else d.ref_no_adj end tran_id,(select i.post_date from gltrace i where (( i.ref_ser = 'S-INV' and i.ref_id = h.invoice_id)) and rownum = 1) conf_date,(select i.eff_date from gltrace i where (( i.ref_ser = 'S-INV' and i.ref_id = h.invoice_id)) and rownum = 1) eff_date, d.adj_amt from invoice h, receivables_adj d where h.confirmed = 'Y' and (d.ref_no = h.invoice_id or d.ref_no_adj = h.invoice_id) and (select count(1) from misc_drcr_rcp m where m.tran_id = d.ref_no_adj and trim(m.tran_type) = 'BW' ) = 0 and ((d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no) or (d.ref_ser_adj = cur_recv.tran_ser and d.ref_no_adj = cur_recv.ref_no)) union all -- balance write off select 'BWOFF' ref_ser_adj, d.ref_no_adj tran_id,(select i.post_date from gltrace i where (( i.ref_ser in ('MDRCRC','MDRCRD') and i.ref_id = h.tran_id)) and rownum = 1) conf_date,(select i.eff_date from gltrace i where (( i.ref_ser in ('MDRCRC','MDRCRD') and i.ref_id = h.tran_id)) and rownum = 1) eff_date, case when cur_recv.tot_amt < 0 and h.amount > 0 or cur_recv.tot_amt > 0 and h.amount < 0 then -1 else 1 end * h.amount from misc_drcr_rcp h, receivables_adj d where h.confirmed = 'Y' and d.ref_no_adj = h.tran_id and trim(h.tran_type) = 'BW' and ((d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no) or (d.ref_ser_adj = cur_recv.tran_ser and d.ref_no_adj = cur_recv.ref_no)) union all select case when h.DRCR_FLAG = 'D' then 'MDRCRD' else 'MDRCRC' end ref_ser_adj, h.tran_id, (select i.post_date from gltrace i where i.ref_ser in( 'MDRCRC','MDRCRD') and i.ref_id = h.tran_id and rownum = 1) conf_date, (select i.eff_date from gltrace i where i.ref_ser in( 'MDRCRC','MDRCRD') and i.ref_id = h.tran_id and rownum = 1) eff_date,d.adj_amt from misc_drcr_rcp h, MISC_DRCR_RCPINV d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select case when h.DRCR_FLAG = 'D' then 'DRNRCP' else 'CRNRCP' end ref_ser_adj, h.tran_id,(select i.post_date from gltrace i where i.ref_ser in( 'CRNRCP','DRCRCP') and i.ref_id = h.tran_id and rownum = 1) conf_date,(select i.eff_date from gltrace i where i.ref_ser in( 'CRNRCP','DRCRCP') and i.ref_id = h.tran_id and rownum = 1) eff_date,d.adj_amt from drcr_rcp h, DRCR_RCPINV d where d.tran_id = h.tran_id and h.confirmed = 'Y' and d.ref_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no union all select 'RCPPAY' ref_ser_adj,h.tran_id,h.tran_date conf_date,h.tran_date eff_date,d.trf_amt adj_amt from rec_pay_trf_det d ,rec_pay_trf h where h.tran_id = d.tran_id and h.trf_type = '1' and h.confirmed = 'Y' and d.tran_ser = cur_recv.tran_ser and d.ref_no = cur_recv.ref_no ) order by conf_date ) loop begin ldt_statdate := cur_tran.conf_date; lc_adjamt := cur_tran.adj_amt; if trim(cur_recv.tran_ser) = 'S-INV' and trim(cur_tran.ref_ser_adj) = 'R-ADJ' then lc_adjamt := -1 * lc_adjamt ; end if; insert into receivables_trace ( tran_id, tran_id__rcv, ref_ser, ref_no, ref_ser__adj, ref_no__adj, adj_amt, amt_before, amt_after, ref_date, Due_date, Cr_term, Cust_code__bill, Cust_code, Site_code, Curr_code, Exch_rate, tran_type, Remarks, Doc_ref, Doc_ref_type, Doc_ref_date, Bank_code, change_type, OS_STAT, status_date, chg_user, chg_date, eff_date ) select lpad(recvtc_seq.nextval,12,'0') tran_id, cur_tran.tran_id tran_id__rcv, cur_recv.tran_ser ref_ser, cur_recv.ref_no ref_no, cur_tran.ref_ser_adj ref_ser__adj, cur_tran.tran_id ref_no__adj, lc_adjamt adj_amt, lc_totamt amt_before, lc_totamt - lc_adjamt amt_after, cur_recv.ref_date ref_date, cur_recv.due_date Due_date, cur_recv.cr_term Cr_term, cur_recv.cust_code Cust_code__bill, cur_recv.cust_code Cust_code, cur_recv.site_code Site_code, cur_recv.curr_code Curr_code, cur_recv.exch_rate Exch_rate, 'U' tran_type, 'Update by Proteus' Remarks, 'UPD' Doc_ref, 'O' Doc_ref_type, sysdate Doc_ref_date, cur_recv.bank_code Bank_code, 'U' change_type, case when lc_totamt - lc_adjamt = 0 then 'A' else 'P' end status, ldt_statdate status_date, 'Proteus' chg_user, sysdate chg_date, cur_tran.eff_date from receivables where tran_ser = cur_recv.tran_ser and ref_no = cur_recv.ref_no; lc_totamt := lc_totamt - lc_adjamt; exception when others then dbms_output.put_line('Exception updating '); end; end loop; end loop; end if; exception when others then dbms_output.put_line('Exception outer'); rollback; end; commit; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ENQ_DET_TRANFLOW (as_enq_no char) return CLOB is v_str CLOB; type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); v_str_tmp4 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.ind_no as indent_no, b.QUANTITY ,to_char(b.req_date,'DD/MM/YY') AS required_by,site_code__dlv from item a ,enq_det b where a.item_code = b.item_code and b.enq_no=as_enq_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3, v_str_tmp4; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''||''||v_str_tmp4||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=' Item Description Indent NoQuantityRequired ByDelivery Site'||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETCCTOEMP (AS_EMP_CODE varchar2,AS_TICKET_NO varchar2,AS_REQ_TYPE varchar2) return number is a_retval number(1) := 0; a_count number(1); begin SELECT COUNT(*) INTO a_count FROM GENCODES WHERE FLD_NAME='REQ_TYPE' AND MOD_NAME='W_SER_COMPLAINT_FB' AND LTRIM(RTRIM(FLD_VALUE))=trim(AS_REQ_TYPE); if (a_count = 1 ) then select count(*) INTO a_count from ser_complaint where ticket_no = AS_TICKET_NO and req_type = AS_REQ_TYPE and ( (nvl(instr(cc_to_emp,AS_EMP_CODE),0) >= 1) ); if (a_count = 1) then a_retval := 1; end if; end if; return a_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_BANK_STMT (m_as_on_date in date, msundry_code in char, msundry_type in char, m_site_code in char) return number is lc_day_op_bal number(14,3); lc_prd_op_bal number(14,3); dr_amt number(14,3); cr_amt number(14,3); ls_prd char(20); ls_acct_prd char(20); ls_fr_date date; begin select code, acct_prd ,fr_date into ls_prd ,ls_acct_prd,ls_fr_date from period where m_as_on_date between fr_date and to_date ; select sum(dr_amt__base - cr_amt__base) into lc_prd_op_bal from sundrybal where acct_prd= ls_acct_prd and prd_code < ls_prd and sundry_type =msundry_type and sundry_code = msundry_code; If lc_prd_op_bal is null Then lc_prd_op_bal := 0; End if; select sum(amount) into cr_amt from banktran_log where tran_type = 'P' and tran_date >= ls_fr_date and tran_date <= m_as_on_date and bank_code = msundry_code; if cr_amt Is Null Then cr_amt := 0 ; End if; select sum(amount) into dr_amt from banktran_log where tran_type = 'R' and tran_date >= ls_fr_date and tran_date <= m_as_on_date and bank_code = msundry_code; if dr_amt Is Null Then dr_amt := 0; End if; lc_day_op_bal := dr_amt - cr_amt; lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_UNADJ_ADV (as_cust_code varchar2, as_site_code varchar2, as_date date) return number is lc_advamt number(14,3); ls_acct_prd char(7); ls_prd_code char(7); begin select acct_prd, code into ls_acct_prd,ls_prd_code from period where as_date between fr_date and to_date ; select sum(adv_amt) into lc_advamt from sundrybal where sundry_code = as_cust_code and site_code = as_site_code and acct_prd = ls_acct_prd and prd_code <= ls_prd_code and sundry_type = 'C' and adv_amt <> 0 ; If lc_advamt is null then lc_advamt := 0 ; end if; return lc_advamt; Exception when OTHERS then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_PRD_DATE ON PERIOD (FR_DATE, TO_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HUN_PREG_BENEFIT (AS_EMP_CODE char,AS_PRD_CODE char,AS_ADCODE_INS char,AS_ADCODE_REG char,AS_ADCODE_NONREG char,AS_LVE_CODE char, AS_ADCODE_BASIC char) return number is a_sex employee.sex%type; a_reg_income char(1) := 'N'; a_ins_prdfr char(6); a_ins_prdto char(6); a_calc_prdfr char(6); a_calc_prdto char(6); a_count number(1); a_ins_days number(3); a_present number(3) := 0; a_absent number(3) := 0; a_days_year number(3); a_amount number(12,3) := 0; a_income_reg payarr_det.amount%type; a_income_nonreg payarr_det.amount%type; a_leave_days empleave_summary.no_days%type; a_min_wages ad_slabs.amount%type; a_basic_amt employee_ad.amount%type; a_fr_date date; a_to_date date; a_rel_datefr date; a_date_birth empfamily.date_birth%type; begin select sex into a_sex from employee where emp_code = AS_EMP_CODE; if (a_sex <> 'F') then return a_amount; end if; select min(date_birth) into a_date_birth from empfamily a,period b where a.emp_code = AS_EMP_CODE and a.relation in ('DAUGHTER','SON') and b.code = AS_PRD_CODE and (b.fr_date between a.date_birth and (a.date_birth+167) or b.to_date between a.date_birth and (a.date_birth+167)); if (a_date_birth is null) then return a_amount; end if; select to_char(add_months(a_date_birth,-24),'YYYYMM'),to_char(add_months(a_date_birth,-1),'YYYYMM'), to_date('01-jan-'||(to_char(a_date_birth,'YYYY')-1)),(to_char(a_date_birth,'YYYY')-1) || '01', (to_char(a_date_birth,'YYYY')-1) || '12' into a_ins_prdfr,a_ins_prdto,a_rel_datefr,a_calc_prdfr,a_calc_prdto from dual; select nvl(sum(b.work_days+b.woff_days),0) into a_ins_days from payrolldet a,payroll b where a.prd_code = b.prd_code and a.emp_code = b.emp_code and a.prd_code between a_ins_prdfr and a_ins_prdto and a.emp_code = AS_EMP_CODE and a.ad_code = AS_ADCODE_INS and a.amount <> 0 and b.voucher_no is not null; if (a_ins_days < 180) then return a_amount; end if; for i in 1..(a_date_birth-a_rel_datefr) loop select count(*) into a_count from attd_reg where emp_code = AS_EMP_CODE and attd_date = (a_rel_datefr+i-1) and (work_days <> 0 or hol_woff_days <> 0); if (a_count = 0) then a_absent := a_absent + 1; if (a_absent = 30) then a_present := 0; end if; elsif (a_count = 1) then a_present := a_present + 1; a_absent := 0; if (a_present = 180) then a_reg_income := 'Y'; exit; end if; end if; end loop; select nvl(sum(to_date-fr_date+1),0) into a_days_year from period where code between a_calc_prdfr and a_calc_prdto; select nvl(sum(amount),0) into a_income_reg from payarr_det where prd_code between a_calc_prdfr and a_calc_prdto and emp_code = AS_EMP_CODE and ad_code = AS_ADCODE_REG; select nvl(sum(amount),0) into a_income_nonreg from payarr_det where prd_code between a_calc_prdfr and a_calc_prdto and emp_code = AS_EMP_CODE and ad_code = AS_ADCODE_NONREG; select nvl(sum(no_days),0) into a_leave_days from empleave_summary where emp_code = AS_EMP_CODE and lve_code = AS_LVE_CODE and prd_code between a_calc_prdfr and a_calc_prdto and use_flag = 'C'; select fr_date,to_date into a_fr_date,a_to_date from period where code = AS_PRD_CODE; if (a_date_birth > a_fr_date) then a_fr_date := a_date_birth; end if; if ((a_date_birth+167) < a_to_date) then a_to_date := (a_date_birth+167); end if; if (a_reg_income = 'Y') then a_amount := (((a_income_reg+a_income_nonreg) / (a_days_year - a_leave_days)) * 0.70) * (a_to_date-a_fr_date+1); else for ii in 1..(a_to_date-a_fr_date+1) loop select sum(a.amount/(b.to_date-b.fr_date+1)) into a_min_wages from ad_slabs a,period b where a.ad_code = AS_ADCODE_REG and (a_fr_date+ii-1) between a.eff_date and a.exp_date and b.code = AS_PRD_CODE; select sum(a.amount/(b.to_date-b.fr_date+1)) into a_basic_amt from employee_ad a,period b where a.emp_code = AS_EMP_CODE and a.ad_code = AS_ADCODE_BASIC and (a_fr_date+ii-1) between a.eff_date and a.exp_date and a.confirmed = 'Y' and b.code = AS_PRD_CODE; a_min_wages := a_min_wages * 2; if (a_basic_amt < a_min_wages) then a_amount := a_amount + (a_basic_amt * 0.70); else a_amount := a_amount + (a_min_wages * 0.70); end if; end loop; end if; return round(a_amount,2); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REASON_DESC (as_reason_code in emp_statuschg.reason_code%type) RETURN VARCHAR2 is as_reason_descr varchar2(100); BEGIN select descr into as_reason_descr from GENCODES where fld_value=as_reason_code and fld_name='REASON_CODE' and mod_name='W_EMP_STATUS'; return as_reason_descr; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STOCK_QTY (ls_site_code in char,ls_item_code in char) return number is ld_qty number(14,3); begin select sum(a.quantity - a.alloc_qty) into ld_qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = ls_site_code and a.item_code = ls_item_code and b.available = 'Y' ; return ld_qty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION STR_TO_NUM (AS_STR VARCHAR2) RETURN NUMBER IS LC_NUMBER NUMBER; BEGIN IF ISNUMBER(AS_STR) = 0 THEN LC_NUMBER := TO_NUMBER(AS_STR); ELSE LC_NUMBER := 0; END IF; RETURN LC_NUMBER; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_WIP_STATUS_ASONDATE (as_workord workorder.work_order%type , asondt workorder.ord_date%type,flag char) return number is ln_amt number; begin if flag = 'W' then --wip select (workorder.current_batch_qty * workorder.yield_perc / 100 ) -(sum(workorder_receipt.quantity)-(select sum(workorder_receipt.quantity) from workorder_receipt where workorder_receipt.work_order = workorder.work_order and workorder_receipt.tran_date > asondt)) WIP into ln_amt from workorder , workorder_receipt where workorder.work_order = workorder_receipt.work_order and workorder.work_order = as_workord group by workorder.work_order ,workorder.current_batch_qty , workorder.yield_perc ; elsif flag = 'A' then --A select (workorder.current_batch_qty * workorder.yield_perc / 100 ) data1 into ln_amt from workorder --, workorder_receipt where --workorder.work_order = workorder_receipt.work_order and workorder.work_order = as_workord group by workorder.work_order ,workorder.current_batch_qty , workorder.yield_perc ; elsif flag = 'B' then --B select (select sum(workorder_receipt.quantity) from workorder_receipt where workorder_receipt.work_order = workorder.work_order and workorder_receipt.tran_date > asondt) data2 into ln_amt from workorder , workorder_receipt where workorder.work_order = workorder_receipt.work_order and workorder.work_order = as_workord group by workorder.work_order ,workorder.current_batch_qty , workorder.yield_perc ; elsif flag = 'C' then --C select workorder.current_batch_qty --sum(workorder_receipt.quantity) - (select sum(workorder_receipt.quantity) from workorder_receipt where workorder_receipt.work_order = workorder.work_order and workorder_receipt.tran_date > asondt) data3 into ln_amt from workorder , workorder_receipt where workorder.work_order = workorder_receipt.work_order and workorder.work_order = as_workord group by workorder.work_order ,workorder.current_batch_qty , workorder.yield_perc ; else ln_amt := null ; end if; if ln_amt = null then ln_amt := 0; end if; return ln_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RINV_CLSTKQVSTK ( lsite_code IN CHAR, litem_code IN CHAR, llot_no IN CHAR, ad_from_date IN DATE, ltype IN CHAR, lavailable IN CHAR, as_qtyvalue IN CHAR, lreporttype_fr IN CHAR, lreporttype_to IN CHAR) RETURN NUMBER IS ld_eff_qty NUMBER(18,3); ldt_crea_date DATE; BEGIN IF ltype = 'I' THEN SELECT SUM(qty) INTO ld_eff_qty FROM (SELECT DECODE(as_qtyvalue,'Q',SUM(a.quantity),SUM(a.quantity * NVL(a.rate,0))) qty FROM stock a, invstat b , location c WHERE a.loc_code = c.loc_code AND b.inv_stat = c.inv_stat AND a.site_code = lsite_code AND a.item_code = litem_code AND b.report_type >= lreporttype_fr AND b.report_type <= lreporttype_to AND b.available LIKE lavailable UNION ALL SELECT NVL( DECODE(as_qtyvalue,'Q', (SUM(eff_qty) * -1),SUM(eff_qty * NVL(rate,0)) * -1 ) ,0) qty FROM invtrace a, location b, invstat c WHERE a.loc_code = b.loc_code AND b.inv_stat = c.inv_stat AND a.tran_date > ad_from_date AND a.item_code = litem_code AND a.site_code = lsite_code AND c.report_type >= lreporttype_fr AND c.report_type <= lreporttype_to AND c.available LIKE lavailable ); END IF; IF ltype = 'B' THEN SELECT SUM(qty) INTO ld_eff_qty FROM (SELECT DECODE(as_qtyvalue,'Q',SUM(a.quantity),SUM(a.quantity * NVL(a.rate,0))) qty FROM stock a, invstat b , location c WHERE a.loc_code = c.loc_code AND b.inv_stat = c.inv_stat AND b.report_type >= lreporttype_fr AND b.report_type <= lreporttype_to AND a.item_code = litem_code AND a.site_code = lsite_code AND a.lot_no = llot_no AND b.available LIKE lavailable UNION ALL SELECT NVL( DECODE(as_qtyvalue,'Q',SUM(eff_qty) * -1,SUM(eff_qty * NVL(rate,0)) * -1) ,0) qty FROM invtrace a, location b, invstat c WHERE a.loc_code = b.loc_code AND b.inv_stat = c.inv_stat AND a.tran_date > ad_from_date AND a.item_code = litem_code AND a.site_code = lsite_code AND a.lot_no = llot_no AND c.report_type >= lreporttype_fr AND c.report_type <= lreporttype_to AND c.available LIKE lavailable ); END IF; IF ld_eff_qty IS NULL THEN ld_eff_qty := 0; END IF; RETURN (ld_eff_qty); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_QC_STATTYPE ON QC_ORDER (STATUS, QC_CREATE_TYPE, LOT_NO, PORCP_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPLOYEE_AD_REF ON EMPLOYEE_AD (REF_TYPE, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_GRADE_APPR_CS ON GRADE_APPR_CS (GRADE_CODE, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_TAXTRAN_TAX ON TAXTRAN (TRAN_CODE, TRAN_ID, LINE_NO, TAX_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 2097152 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_WOR_CFDATE ON WORKORDER_RECEIPT (CONF_DATE, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESC_SPECS_NEW (as_itemcode in char,as_rettype in char) return varchar2 is ls_specs varchar2(200); ls_itemtype item_type.item_type%type; ls_attrib1 item_type.phy_attrib_1%type; ls_attrib2 item_type.phy_attrib_2%type; ls_attrib5 item_type.phy_attrib_5%type; ls_attrib6 item_type.phy_attrib_6%type; ls_attrib7 item_type.phy_attrib_7%type; ls_attrib8 item_type.phy_attrib_8%type; ls_attrib9 item_type.phy_attrib_9%type; ls_attrib10 item_type.phy_attrib_10%type; ls_attrib11 item_type.phy_attrib_11%type; ls_attrib12 item_type.phy_attrib_12%type; ls_spec1 item.phy_attrib_1%type; ls_spec2 item.phy_attrib_2%type; ls_spec5 item.phy_attrib_5%type; ls_spec6 item.phy_attrib_6%type; ls_spec7 item.phy_attrib_7%type; ls_spec8 item.phy_attrib_8%type; ls_spec9 item.phy_attrib_9%type; ls_spec10 item.phy_attrib_10%type; ls_spec11 item.phy_attrib_11%type; ls_spec12 item.phy_attrib_12%type; begin ls_specs := ' '; select a.item_type,a.phy_attrib_1,a.phy_attrib_2, a.phy_attrib_5,a.phy_attrib_6,a.phy_attrib_7,a.phy_attrib_8, a.phy_attrib_9,a.phy_attrib_10,a.phy_attrib_11,a.phy_attrib_12, b.phy_attrib_1,b.phy_attrib_2, b.phy_attrib_5,b.phy_attrib_6,b.phy_attrib_7,b.phy_attrib_8, b.phy_attrib_9,b.phy_attrib_10,b.phy_attrib_11,b.phy_attrib_12 into ls_itemtype,ls_spec1,ls_spec2, ls_spec5,ls_spec6,ls_spec7,ls_spec8, ls_spec9,ls_spec10,ls_spec11,ls_spec12, ls_attrib1,ls_attrib2, ls_attrib5,ls_attrib6,ls_attrib7,ls_attrib8, ls_attrib9,ls_attrib10,ls_attrib11,ls_attrib12 from item a, item_type b where a.item_type = b.item_type and a.item_code = as_itemcode ; if ls_attrib1 is not null and length(ltrim(rtrim(ls_attrib1))) > 0 and ls_spec1 is not null and length(ltrim(rtrim(ls_spec1))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib1) || ' : ' || rtrim(ls_spec1) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib2 is not null and length(ltrim(rtrim(ls_attrib2))) > 0 and ls_spec2 is not null and length(ltrim(rtrim(ls_spec2))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib2) || ' : ' || rtrim(ls_spec2) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib5 is not null and length(ltrim(rtrim(ls_attrib5))) > 0 and ls_spec5 is not null and length(ltrim(rtrim(ls_spec5))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib5) || ' : ' || rtrim(ls_spec5) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib6 is not null and length(ltrim(rtrim(ls_attrib6))) > 0 and ls_spec6 is not null and length(ltrim(rtrim(ls_spec6))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib6) || ' : ' || rtrim(ls_spec6) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib7 is not null and length(ltrim(rtrim(ls_attrib7))) > 0 and ls_spec7 is not null and length(ltrim(rtrim(ls_spec7))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib7) || ' : ' || rtrim(ls_spec7) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib8 is not null and length(ltrim(rtrim(ls_attrib8))) > 0 and ls_spec8 is not null and length(ltrim(rtrim(ls_spec8))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib8) || ' : ' || rtrim(ls_spec8) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib9 is not null and length(ltrim(rtrim(ls_attrib9))) > 0 and ls_spec9 is not null and length(ltrim(rtrim(ls_spec9))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib9) || ' : ' || rtrim(ls_spec9) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib10 is not null and length(ltrim(rtrim(ls_attrib10))) > 0 and ls_spec10 is not null and length(ltrim(rtrim(ls_spec10))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib10) || ' : ' || rtrim(ls_spec10) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib11 is not null and length(ltrim(rtrim(ls_attrib11))) > 0 and ls_spec11 is not null and length(ltrim(rtrim(ls_spec11))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib11) || ' : ' || rtrim(ls_spec11) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib12 is not null and length(ltrim(rtrim(ls_attrib12))) > 0 and ls_spec12 is not null and length(ltrim(rtrim(ls_spec12))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib12) || ' : ' || rtrim(ls_spec12) ; end if ; ls_specs := ltrim(rtrim(ls_specs)) ; return ls_specs; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SB_SUPP ON SUPPLIER_BILL (SUPP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RWSSIMP_DOC (as_sales_pers char, as_from_date date, as_to_date date) return number is ls_return number (14,0); begin begin SELECT COUNT(DISTINCT SM.STRG_CODE) into ls_return FROM STRG_MEET SM JOIN SALES_PERS S ON SM.SALES_PERS = S.SALES_PERS WHERE SM.EVENT_DATE BETWEEN as_from_date AND as_to_date AND sm.sales_pers=as_sales_pers and SM.STRG_TYPE = 'D' AND SM.STRG_CLASS_CODE = 'F' AND S.ITEM_SER ='OTC'; exception when no_Data_found then ls_return:=0; end; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PDC_GIVEN_SUNDRY_STAT ON PDC_GIVEN (SUNDRY_TYPE, SUNDRY_CODE, STATUS, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DESPATCH_INV_CHK BEFORE INSERT OR UPDATE OF confirmed ON DESPATCH referencing old as old new as new FOR EACH ROW DECLARE ll_count number(3) := 0; BEGIN if :new.confirmed = 'Y' then begin select count(1) into ll_count from invoice where desp_id = :new.desp_id; exception when others then ll_count := 0; end; if ll_count = 0 then raise_application_error( -20601, 'Invoice not created for Despatch [' || :new.desp_id || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEM_APPL_FOR_SITE (as_itemcode in item.item_code%type, as_sitecode in site.site_code%type) return char is --RETURN BOOLEAN IS --b_retval BOOLEAN := FALSE; ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_ITEM'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from siteitem where site_code = as_sitecode and item_code = as_itemcode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EXCH_RATE_DIFF_DATE_SER_NO ON EXCH_RATE_DIFF (TRAN_DATE, TRAN_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKSTARTTIME ( p_geo_fence_option IN CHAR, p_geo_fence_starttime IN VARCHAR2, p_geo_fence_enable IN CHAR ) RETURN NUMBER IS v_dummy_time DATE; BEGIN IF NVL(TRIM(p_geo_fence_option), '') = '3' THEN IF p_geo_fence_starttime IS NULL OR TRIM(p_geo_fence_starttime) = '' THEN RETURN 0; END IF; -- Strict format check: must be exactly 2 digits : 2 digits (e.g. 09:00) IF NOT REGEXP_LIKE(TRIM(p_geo_fence_starttime), '^\d{2}:\d{2}$') THEN RETURN 0; END IF; -- Try to parse as HH24:MI BEGIN v_dummy_time := TO_DATE(TRIM(p_geo_fence_starttime), 'HH24:MI'); EXCEPTION WHEN OTHERS THEN RETURN 0; END; END IF; RETURN 1; EXCEPTION WHEN OTHERS THEN RETURN 0; END CHECKSTARTTIME; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISCPAY_REFNO BEFORE INSERT or UPDATE OF ref_no ON MISC_PAYMENT referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_MIN_MAX_DUEDATE (AS_SALE_ORDER IN SORDDET.SALE_ORDER%TYPE, AS_MIN_OR_MAX IN CHAR) RETURN DATE IS LS_DUE_DATE SORDDET.DSP_DATE%TYPE; BEGIN IF AS_MIN_OR_MAX = 'MIN' THEN SELECT MIN(DSP_DATE) INTO LS_DUE_DATE FROM SORDDET WHERE SALE_ORDER = AS_SALE_ORDER; RETURN LS_DUE_DATE; ELSIF AS_MIN_OR_MAX = 'MAX' THEN SELECT MAX(DSP_DATE) INTO LS_DUE_DATE FROM SORDDET WHERE SALE_ORDER = AS_SALE_ORDER; RETURN LS_DUE_DATE; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN return 'Data not found' ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ACTIONSETDET_X ON ACTIONSETDET (ACTION_SET, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TASK_TBL_DET_X ON PROJ_TASK_TABLE_DET (TASK_TABLE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PAN_NO (as_type in char,as_code in char) return varchar2 is ls_pan_no varchar2(100); begin if upper(trim(as_type)) = 'E' then select it_no into ls_pan_no from employee where emp_code=as_code; elsif upper(trim(as_type)) = 'S' then select pan_no into ls_pan_no from supplier where supp_code=as_code ; elsif upper(trim(as_type)) = 'T' then select pan_no into ls_pan_no from transporter where tran_code=as_code; elsif upper(trim(as_type)) = 'P' then select pan_no into ls_pan_no from sales_pers where sales_pers=as_code; elsif upper(trim(as_type)) = 'C' then select tax_reg_st into ls_pan_no from customer where cust_code=as_code; elsif upper(trim(as_type)) = 'L' then select tax_reg_st into ls_pan_no from loanparty where party_code=as_code; elsif upper(trim(as_type)) = 'R' then select pan_no into ls_pan_no from strg_customer where sc_code=as_code; end if ; if ls_pan_no is null then ls_pan_no :=''; end if; return ls_pan_no ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STATUTORY_STAT_UPD_X ON STATUTORY_STAT_UPD (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_STATUS_HIST_1 ON STRG_STATUS_HIST (SALES_PERS, ITEM_SER, CUST_TYPE, SC_CODE, EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LEAVE_STATUSDESR_FORCAL (Vi_tran_id_1 In CHAR) Return Varchar2 Is History_Descr Varchar2(200); Vi_tran_id CHAR(10); vi_status char(1); BEGIN Vi_tran_id := trim(Vi_tran_id_1) ; Select status Into vi_status From EMPLEAVE Where tran_id = Vi_tran_id; IF vi_status = 'R' THEN History_Descr := 'Requested '; elsif (vi_status='A') then History_Descr := 'Approved '; END IF; return History_Descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DIST_SORD_LINE ON DISTORDER_DET (SALE_ORDER, LINE_NO__SORD) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EMP_NAME (as_emp_code char,as_return_type char DEFAULT 'Z') return varchar2 is ls_emp_fname employee.emp_fname%type; ls_emp_mname employee.emp_mname%type; ls_emp_lname employee.emp_lname%type; ls_emp_fname_long employee.emp_fname_long%type; ls_emp_mname_long employee.emp_mname_long%type; ls_emp_lname_long employee.emp_lname_long%type; ls_emp_aprv_name varchar2(120); ls_emp_code__aprv employee.emp_code%type; begin ls_emp_code__aprv := as_emp_code; if (as_return_type = 'Z') then -- For maintain compitability with database function used in SFA application select INITCAP(trim(emp_fname)) ||' '||INITCAP(trim(emp_lname)) into ls_emp_aprv_name from employee where emp_code = ls_emp_code__aprv; RETURN LS_EMP_APRV_NAME; elsif (as_return_type = 'F') then select emp_fname into ls_emp_fname from employee where emp_code = as_emp_code; return ls_emp_fname; elsif as_return_type ='M' then select emp_mname into ls_emp_mname from employee where emp_code = as_emp_code; return ls_emp_mname; elsif as_return_type ='L' then select emp_lname into ls_emp_lname from employee where emp_code = as_emp_code; return ls_emp_lname; elsif as_return_type ='X' then select emp_fname,emp_mname,emp_lname into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; return trim(ls_emp_fname) ||' '|| trim(ls_emp_mname) ||' '|| trim(ls_emp_lname); elsif as_return_type ='FL' then select emp_fname,emp_mname,emp_lname into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; return trim(ls_emp_fname) ||' '|| trim(ls_emp_lname); elsif as_return_type ='FM' then select emp_fname,emp_mname,emp_lname into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; return trim(ls_emp_fname) ||' '|| trim(ls_emp_mname); elsif as_return_type ='FML' then select emp_fname,emp_mname,emp_lname into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; return trim(ls_emp_fname) ||' '|| trim(ls_emp_mname) ||' '|| trim(ls_emp_Lname); elsif (as_return_type = 'F1') then select case when emp_fname_long is null or length(trim(emp_fname_long)) = 0 then emp_fname else emp_fname_long end into ls_emp_fname_long from employee where emp_code = as_emp_code; return ls_emp_fname_long; elsif as_return_type ='M1' then select case when emp_mname_long is null or length(trim(emp_mname_long)) = 0 then emp_mname else emp_mname_long end into ls_emp_mname_long from employee where emp_code = as_emp_code; return ls_emp_mname_long; elsif as_return_type ='L1' then select case when emp_lname_long is null or length(trim(emp_Lname_long)) = 0 then emp_lname else emp_lname_long end into ls_emp_lname_long from employee where emp_code = as_emp_code; return ls_emp_lname_long; elsif as_return_type ='X1' then select case when emp_fname_long is null or length(trim(emp_fname_long)) = 0 then emp_fname else emp_fname_long end, case when emp_mname_long is null or length(trim(emp_mname_long)) = 0 then emp_mname else emp_mname_long end, CASE WHEN EMP_LNAME_LONG IS NULL OR LENGTH(TRIM(EMP_LNAME_LONG)) = 0 THEN EMP_LNAME ELSE EMP_LNAME_LONG END --into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; into ls_emp_fname_long,ls_emp_mname_long,ls_emp_lname_long from employee where emp_code = as_emp_code; return trim(ls_emp_fname_long) ||' '|| trim(ls_emp_mname_long) ||' '|| trim(ls_emp_lname_long); elsif as_return_type ='FL1' then select case when emp_fname_long is null or length(trim(emp_fname_long)) = 0 then emp_fname else emp_fname_long end, case when emp_mname_long is null or length(trim(emp_mname_long)) = 0 then emp_mname else emp_mname_long end, CASE WHEN EMP_LNAME_LONG IS NULL OR LENGTH(TRIM(EMP_LNAME_LONG)) = 0 THEN EMP_LNAME ELSE EMP_LNAME_LONG END --into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; into ls_emp_fname_long,ls_emp_mname_long,ls_emp_lname_long from employee where emp_code = as_emp_code; return trim(ls_emp_fname_long) ||' '|| trim(ls_emp_lname_long); elsif as_return_type ='FM1' then select case when emp_fname_long is null or length(trim(emp_fname_long)) = 0 then emp_fname else emp_fname_long end, case when emp_mname_long is null or length(trim(emp_mname_long)) = 0 then emp_mname else emp_mname_long end, CASE WHEN EMP_LNAME_LONG IS NULL OR LENGTH(TRIM(EMP_LNAME_LONG)) = 0 THEN EMP_LNAME ELSE EMP_LNAME_LONG END --into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; into ls_emp_fname_long,ls_emp_mname_long,ls_emp_lname_long from employee where emp_code = as_emp_code; return trim(ls_emp_fname_long) ||' '|| trim(ls_emp_mname_long); elsif as_return_type ='FML1' then select case when emp_fname_long is null or length(trim(emp_fname_long)) = 0 then emp_fname else emp_fname_long end, case when emp_mname_long is null or length(trim(emp_mname_long)) = 0 then emp_mname else emp_mname_long end, CASE WHEN EMP_LNAME_LONG IS NULL OR LENGTH(TRIM(EMP_LNAME_LONG)) = 0 THEN EMP_LNAME ELSE EMP_LNAME_LONG END --into ls_emp_fname,ls_emp_mname,ls_emp_lname from employee where emp_code = as_emp_code; into ls_emp_fname_long,ls_emp_mname_long,ls_emp_lname_long from employee where emp_code = as_emp_code; return trim(ls_emp_fname_long) ||' '|| trim(ls_emp_mname_long) ||' '|| trim(ls_emp_lname_long); end if; return trim(ls_emp_fname) ||' '|| trim(ls_emp_mname) ||' '|| trim(ls_emp_Lname); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RCON_LINENO_NUM (an_lineno number) return char is ls_retval varchar2(3); begin select LPAD(CAST(an_lineno AS VARCHAR(3)),3) into ls_retval from dual; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_MLT_VEN_EXIST_ALL ( as_supp_code__mnfr VARCHAR2, as_site_code CHAR, AS_item_code CHAR, old_supp_code__mnfr VARCHAR2, val_type VARCHAR2 ) RETURN NUMBER IS FLAG NUMBER(1); supp_chk_cnt NUMBER(10); old_supp_chk_cnt NUMBER(10); BEGIN supp_chk_cnt :=0; old_supp_chk_cnt :=0; select LENGTH(TRIM(as_supp_code__mnfr)) INTO supp_chk_cnt from DUAL; select LENGTH(TRIM(old_supp_code__mnfr)) INTO old_supp_chk_cnt from DUAL; IF val_type ='ADJ-REC' THEN IF supp_chk_cnt > 0 THEN --check for validation --CALL THE FUNCTION FUNCTION -- ADD ref series parameter to following FN_CHK_MULTI_VENDOR_EXIST - on 05-Sept-2014 By Manoj Sarode ----- Start ------------- SELECT FN_CHK_MULTI_VENDOR_EXIST(as_supp_code__mnfr,as_site_code,AS_item_code,val_type) INTO FLAG FROM dual; RETURN FLAG; else Flag := 1; RETURN flag; END IF; END IF; IF val_type ='STK-AMD' THEN IF supp_chk_cnt = 0 AND old_supp_chk_cnt = 0 THEN --IF OLD SUPPLIER BLANK THEN ALLOWED NEW BLANK SUPPLIER FLAG 1 Flag := 1; RETURN flag; ELSE --CHECK FOR VALIDATION -- ADD ref series parameter to following FN_CHK_MULTI_VENDOR_EXIST - on 05-Sept-2014 By Manoj Sarode ----- Start ------------- SELECT FN_CHK_MULTI_VENDOR_EXIST(as_supp_code__mnfr,as_site_code,AS_item_code,val_type) INTO FLAG FROM dual; -- ADD ref series parameter to following FN_CHK_MULTI_VENDOR_EXIST - on 05-Sept-2014 By Manoj Sarode ----- End ------------- RETURN FLAG; END IF; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN Flag := 0; RETURN flag; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BALANCE (ldt_date date,as_site_code char,as_sundry_code char) return number is ld_balance number(14,3); ls_acct_prd char(6); begin select code into ls_acct_prd from acctprd where fr_date <= ldt_date and to_date >= ldt_date; select case when (SUM((case when dr_amt__base is null then 0 else dr_amt__base end ) - (case when cr_amt__base is null then 0 else cr_amt__base end))) is null then 0 else (SUM((case when dr_amt__base is null then 0 else dr_amt__base end ) - (case when cr_amt__base is null then 0 else cr_amt__base end))) end into ld_balance from sundrybal where acct_prd = ls_acct_prd and prd_code <> 'zzzzzz' and site_code = as_site_code and sundry_type = 'B' and sundry_code = as_sundry_code; return ld_balance ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMPLEAVE ( ls_period char,ls_emp char,ls_ad_code char) return number is lc_leaves number (14,2) ; begin select nvl(sum(nvl(no_days,0)),0) into lc_leaves from empleave_summary where (emp_code = ls_emp) and (prd_code = ls_period) and (lve_code = ls_ad_code) and use_flag = 'C'; return lc_leaves; exception WHEN NO_DATA_FOUND THEN return 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAY_OP_BAL__SITE ( ad_from_date in period.fr_date%type, ad_to_date in period.fr_date%type, as_bank_code bank.bank_code%type ) return number as ld_p_amt banktran_log.amount%type; ld_r_amt banktran_log.amount%type; ld_day_op_bal banktran_log.amount%type; begin Select sum((case when amount is null then 0 else amount end) ) into ld_p_amt from banktran_log where tran_date >= ad_from_date and tran_date < ad_to_date and bank_code = as_bank_code and tran_type = 'P'; If ld_p_amt Is Null Then ld_p_amt :=0; End If; Select sum((case when amount is null then 0 else amount end) ) into ld_r_amt from banktran_log where tran_date >= ad_from_date and tran_date < ad_to_date and bank_code = as_bank_code and tran_type = 'R'; If ld_r_amt Is Null Then ld_r_amt := 0; End If; ld_day_op_bal := ld_r_amt - ld_p_amt ; return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX HIERARCHY_DET_SALES_X ON HIERARCHY_DET (TABLE_NO, SALES_PERS, EFF_FROM, VALID_UPTO, SALES_PERCENT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CENVAT_PLA_CLBAL (as_sitecode IN site.site_code%type, adt_todate IN cenvat.tran_date%type, as_type IN cenvat.tran_type%type) return number is lc_clbal cenvat.closing_bal%type ; ls_tranid cenvat.tran_id%type ; ll_lineno cenvat.line_no%type; begin if as_type = 'A' or as_type = 'C' then select max(tran_id) into ls_tranid from cenvat where tran_date <= adt_todate and site_code = as_sitecode and tran_type = as_type ; select max(line_no) into ll_lineno from cenvat where tran_id = ls_tranid ; select nvl(closing_bal,0) into lc_clbal from cenvat where tran_id = ls_tranid and line_no = ll_lineno ; end if; if as_type = 'P' then select max(tran_id) into ls_tranid from pla where tran_date <= adt_todate and site_code = as_sitecode; select max(line_no) into ll_lineno from pla where tran_id = ls_tranid ; select nvl(closing_bal,0) into lc_clbal from pla where tran_id = ls_tranid and line_no = ll_lineno ; end if; return lc_clbal ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPMTHAD_DATEWISE ON EMPLOYEE_MTHAD (EMP_CODE, MONTH_CODE, EFF_DATE, EXP_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SRETCONF (as_cust_code in char, as_itemcode in char, as_sitecode in char) return number is lc_amt number(14,3); ls_itemcode varchar2(10); ls_cust_code varchar2(10); ls_site_code varchar2(5); begin lc_amt := 0; select nvl(sum(nvl(sreturndet.quantity,0)),0), invoice_trace.item_code, invoice.cust_code, invoice.site_code into lc_amt, ls_itemcode, ls_cust_code, ls_site_code from sreturndet, sreturn, invoice, invoice_trace where sreturndet.tran_id = sreturn.tran_id and invoice_trace.invoice_id = invoice.invoice_id and invoice_trace.item_code = sreturndet.item_code and invoice.invoice_id = sreturn.invoice_id and sreturn.cust_code= as_cust_code and sreturndet.item_code = as_itemcode and sreturn.site_code = as_sitecode and sreturn.confirmed = 'Y' group by invoice.cust_code, invoice_trace.item_code, invoice.site_code ; return lc_amt; exception when NO_DATA_FOUND then return 0; WHEN OTHERS THEN return 0; return lc_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE CHC_CHEM_MET_FOCUS_SKU_DM AS FUNCTION getChemMetFocusSkuInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_MET_FOCUS_SKU_TB PIPELINED; END CHC_CHEM_MET_FOCUS_SKU_DM; CREATE OR REPLACE PACKAGE BODY CHC_CHEM_MET_FOCUS_SKU_DM AS FUNCTION getChemMetFocusSkuInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_MET_FOCUS_SKU_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; WEEK_DAY VARCHAR2(20); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE, code INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE, AS_PRD_CODE FROM PERIOD WHERE eventdate BETWEEN FR_DATE AND TO_DATE; for x in ( WITH DATA AS ( select CASE to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) WHEN 1 THEN to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'st ' || (select initcap(to_char(eventDate, 'DAY')) from dual) WHEN 2 THEN to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'nd ' || (select initcap(to_char(eventDate, 'DAY')) from dual) WHEN 3 THEN to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'rd ' || (select initcap(to_char(eventDate, 'DAY')) from dual) ELSE to_number(to_char(to_date(eventDate,'DD/MM/YYYY'),'W')) || 'th ' || (select initcap(to_char(eventDate, 'DAY')) from dual) END as WD from dual ) select SC.SC_CODE ,TRIM ( SP.ITEM_CODE ) as ITEM_CODE, ITM.SH_DESCR,(SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) as CHEM_NAME,TRIM ( SS.SALES_PERS ) as MGR_SUB from STRG_SERIES SS, SPRS_ROUTE SR , STRG_PRODUCT SP, ITEM ITM, STRG_CUSTOMER SC , DATA DATA where SR.ROUTE_ID = SS.ROUTE_ID and SR.SPRS_CODE = SS.SALES_PERS and SS.STATUS = 'Y' and SR.STATUS = 'Y' and SP.SC_CODE = SS.SC_CODE and SP.ITEM_CODE = ITM.ITEM_CODE and SC.SC_CODE = SS.SC_CODE and SS.SALES_PERS in ( select EMP_CODE from EMPLOYEE E1 where RELIEVE_DATE is null start with E1.EMP_CODE = empCode connect by prior E1.EMP_CODE = E1.REPORT_TO) and SR.PLAN_DAYS like ('%' ||trim(DATA.WD) || '%') ) LOOP PIPE ROW (CHC_CHEM_MET_FOCUS_SKU_MST( x.SC_CODE,x.ITEM_CODE, x.SH_DESCR, x.CHEM_NAME, x.MGR_SUB)); END LOOP; RETURN; END; END CHC_CHEM_MET_FOCUS_SKU_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE SUNDRYMASTER_CHGBK AS OBJECT (Sundry_Code VARCHAR2(10), Sundry_Name VARCHAR2(80), City VARCHAR2(40), division varchar2(40), state VARCHAR2(40)); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SALES_AMT (as_transer in char, as_tranid in char, al_lineno in number, as_type in char) return number is -- as_type 'T' - tax amount -- 'D' - discount amount -- 'G' - gross amount -- 'S' - sales amount -- 'N' - net amount lc_retamt number(14,3) := 0; lc_grossamt number(14,3) := 0; lc_taxamt number(14,3) := 0; lc_discamt number(14,3) := 0; ls_lineno char(3); begin ls_lineno := lpad(trim(to_char(al_lineno)),3,' ') ; begin if as_transer = 'S-INV' then -- get gross amt if al_lineno is null then select nvl(sum(nvl(quantity,0) * nvl(rate,0)),0) into lc_grossamt from invoice_trace where invoice_id = as_tranid ; else select nvl(nvl(quantity,0) * nvl(rate,0),0) into lc_grossamt from invoice_trace where invoice_id = as_tranid and desp_line_no = ls_lineno ; end if; elsif as_transer = 'S-RET' then if al_lineno is null then select nvl(sum(nvl(quantity,0) * nvl(rate,0)),0) into lc_grossamt from sreturndet where tran_id = as_tranid ; else select nvl(nvl(quantity,0) * nvl(rate,0),0) into lc_grossamt from sreturndet where tran_id = as_tranid and line_no = al_lineno ; end if; end if; exception when others then lc_grossamt := 0; end; if lc_grossamt is null then lc_grossamt := 0; end if; if as_type = 'D' or as_type = 'N' then begin -- get discount amount if al_lineno is null then select sum(nvl(a.tax_amt,0)) into lc_discamt from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code = as_transer and a.tran_id = as_tranid and nvl(b.tax_type,'@') = 'D' and a.effect <> 'N'; else select sum(nvl(a.tax_amt,0)) into lc_discamt from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code = as_transer and a.tran_id = as_tranid and a.line_no = ls_lineno and nvl(b.tax_type,'@') = 'D' and a.effect <> 'N'; end if; exception when others then lc_discamt := 0; end; end if; if lc_discamt is null then lc_discamt := 0; end if; if as_type = 'T' or as_type = 'S' or as_type = 'N' then begin -- get tax amount if al_lineno is null then select sum(nvl(a.tax_amt,0)) into lc_taxamt from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code = as_transer and a.tran_id = as_tranid and nvl(b.tax_type,'@') <> 'D' and (a.acct_code is null or length(trim(a.acct_code)) = 0 ) and a.effect <> 'N'; else select sum(nvl(a.tax_amt,0)) into lc_taxamt from taxtran a, tax b where a.tax_code = b.tax_code and a.tran_code = as_transer and a.tran_id = as_tranid and a.line_no = ls_lineno and nvl(b.tax_type,'@') <> 'D' and (a.acct_code is null or length(trim(a.acct_code)) = 0 ) and a.effect <> 'N'; end if; exception when others then lc_taxamt := 0; end; end if; if lc_taxamt is null then lc_taxamt := 0; end if; if as_type = 'T' then lc_retamt := lc_taxamt; elsif as_type = 'D' then lc_retamt := lc_discamt; elsif as_type = 'G' then lc_retamt := lc_grossamt; elsif as_type = 'S' then lc_retamt := lc_grossamt + lc_taxamt; elsif as_type = 'N' then lc_retamt := lc_grossamt + lc_taxamt + lc_discamt ; end if; return lc_retamt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_BTL_ST_AC_BK ON BANKTRAN_LOG (SITE_CODE, ACCT_CODE, BANK_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_E_INVOICE_RENO ON E_INVOICE (REF_SER, REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGMEETINVOICE_SETLINENO before insert on strg_meet_invoice for each row declare max_line_no number(10); begin if (:new.tran_id is null or length(trim(:new.tran_id)) = 0 or upper(substr(:new.tran_id,1,1)) = 'W') then begin select tran_id into :new.tran_id from strg_meet where dcr_id = :new.dcr_id and strg_code = :new.strg_code and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_invoice where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_invoice where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; end; end if; max_line_no := 0; select max(line_no) into max_line_no from strg_meet_invoice where dcr_id = :new.dcr_id; :new.line_no := nvl(max_line_no , 0) + 1; if(:new.invoice_id is null or length(trim(:new.invoice_id)) = 0) then :new.quantity := 0; end if; if inserting then :new.invoice_status := 'A'; :new.invoice_date := trunc(sysdate); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STK_MVMT (as_tranid in char, as_refser in char, as_refid in char, as_fieldname in char, as_lineno in char) return char is ls_fieldvalue char(250); ls_tempvar char(10); begin if ltrim(rtrim(as_refser)) = 'ADJ-ISS' or ltrim(rtrim(as_refser)) = 'ADJRCP' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(ref_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from invtrace where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Reason:'||rtrim(nvl(reas_code,''))||' '||rtrim(nvl(remarks,'')) into ls_fieldvalue from invtrace where tran_id = as_tranid; end if; end; end if; if ltrim(rtrim(as_refser)) = 'C-ISS' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(cons_issue)||' Date:'||rtrim(nvl(to_char(issue_date,'dd/mm/yy'),'')) into ls_fieldvalue from consume_iss where cons_issue = as_refid; end if; if as_fieldname = 'FIELD2' then select 'Dept Code:'||rtrim(consume_iss.dept_code)||' '||rtrim(department.descr) into ls_fieldvalue from consume_iss, department where consume_iss.cons_issue = as_refid and consume_iss.dept_code = department.dept_code; end if; end; end if; if ltrim(rtrim(as_refser)) = 'D-ISS' OR ltrim(rtrim(as_refser)) = 'D-RCP' then begin if (ltrim(rtrim(as_refser)) = 'D-ISS') and as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from distord_iss where tran_id = as_tranid; end if; if (ltrim(rtrim(as_refser)) = 'D-RCP') and as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from distord_rcp where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' and ltrim(rtrim(as_refser)) = 'D-ISS' then select 'Site:'||rtrim(distord_iss.site_code__dlv)||' '||rtrim(nvl(site.descr,''))||'-'||rtrim(nvl(site.city,'')) into ls_fieldvalue from distord_iss, site where distord_iss.tran_id = as_refid and distord_iss.site_code__dlv = site.site_code; end if; if as_fieldname = 'FIELD2' and ltrim(rtrim(as_refser)) = 'D-RCP' then select 'Site:'||rtrim(distord_rcp.site_code__ship)||' '||rtrim(site.descr)||'-'||rtrim(site.city) into ls_fieldvalue from distord_rcp, site where distord_rcp.tran_id = as_refid and distord_rcp.site_code__ship = site.site_code; end if; end; end if; if ltrim(rtrim(as_refser)) = 'P-RCP' or ltrim(rtrim(as_refser)) = 'P-RET' then begin if as_fieldname = 'FIELD1' then select supp_code into ls_tempvar from porcp where tran_id = rtrim(as_refid); select 'Supp:'||rtrim(nvl(supp_code,''))||' '||rtrim(nvl(sh_name,''))||' - '||rtrim(nvl(city,'')) into ls_fieldvalue from supplier where supp_code = ls_tempvar; end if; if as_fieldname = 'FIELD2' then select supp_code__mnfr into ls_tempvar from porcpdet where tran_id = as_refid and line_no = as_lineno; select 'Mfg: '||rtrim(nvl(supp_code,''))||' '||rtrim(nvl(sh_name,''))||' - '||rtrim(nvl(city,'')) into ls_fieldvalue from supplier where supp_code = ls_tempvar; end if; if as_fieldname = 'FIELD3' then select 'Doc No.:' || rtrim(nvl(dc_no,''))||' Date:'||rtrim(nvl(to_char(dc_date,'dd/mm/yy'),'')) into ls_fieldvalue from porcp where tran_id = as_refid; end if; if as_fieldname = 'FIELD4' then select 'Batch No.:'||rtrim(nvl(batch_no,''))||' Mfg.:'||rtrim(nvl(to_char(mfg_date,'dd/mm/yy'),''))||' Exp. :'||rtrim(nvl(to_char(expiry_date,'dd/mm/yy'),'')) into ls_fieldvalue from porcpdet where tran_id = as_refid and line_no = as_lineno; end if; end; end if; if rtrim(ltrim(as_refser)) = 'R-BFS' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from receipt_backflush where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Item Code:'||rtrim(receipt_backflush.item_code)||' '||rtrim(item.descr) into ls_fieldvalue from receipt_backflush, item where receipt_backflush.tran_id = as_refid and receipt_backflush.item_code = item.item_code; end if; if as_fieldname = 'FIELD3' then select 'Lot no:'||lot_no into ls_fieldvalue from receipt_backflush where tran_id = as_refid; end if; end; end if; if rtrim(ltrim(as_refser)) = 'S-DSP' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(desp_id)||' Date:'||rtrim(nvl(to_char(desp_date,'dd/mm/yy'),'')) into ls_fieldvalue from despatch where desp_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Customer:'||rtrim(despatch.cust_code__dlv)||' '||rtrim(customer.cust_name)||'-'||rtrim(city) into ls_fieldvalue from despatch, customer where despatch.desp_id = as_refid and despatch.cust_code__dlv = customer.cust_code; end if; end; end if; if rtrim(ltrim(as_refser)) = 'S-RET' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from sreturn where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Customer:'||rtrim(sreturn.cust_code)||' '||rtrim(customer.cust_name)||'-'||rtrim(city) into ls_fieldvalue from sreturn, customer where sreturn.tran_id = as_refid and sreturn.cust_code = customer.cust_code; end if; end; end if; if rtrim(ltrim(as_refser)) = 'W-IRTN' or rtrim(ltrim(as_refser)) = 'W-ISS' then begin if as_fieldname = 'FIELD1' then select work_order, 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_tempvar, ls_fieldvalue from workorder_iss where workorder_iss.tran_id = as_refid; end if; if as_fieldname = 'FIELD2' then select work_order into ls_tempvar from workorder_iss where workorder_iss.tran_id = as_refid; select 'Item:'||rtrim(workorder.item_code)||' '||rtrim(item.descr) into ls_fieldvalue from workorder, item where workorder.tran_id = ls_tempvar and workorder.item_code = item.item_code; end if; if as_fieldname = 'FIELD3' then select work_order into ls_tempvar from workorder_iss where workorder_iss.tran_id = as_refid; select 'Batch No:'||workorder.lot_no into ls_fieldvalue from workorder where workorder.tran_id = ls_tempvar; end if; end; end if; if rtrim(ltrim(as_refser)) = 'W-RCP' then begin if as_fieldname = 'FIELD1' then select work_order, 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_tempvar, ls_fieldvalue from workorder_receipt where workorder_receipt.tran_id = as_refid; end if; if as_fieldname = 'FIELD2' then select work_order into ls_tempvar from workorder_receipt where workorder_receipt.tran_id = as_refid; select 'Item:'||rtrim(workorder.item_code)||' '||rtrim(item.descr) into ls_fieldvalue from workorder, item where workorder.tran_id = ls_tempvar and workorder.item_code = item.item_code; end if; if as_fieldname = 'FIELD3' then select work_order into ls_tempvar from workorder_receipt where workorder_receipt.tran_id = as_refid; select 'Batch No:'||workorder.lot_no into ls_fieldvalue from workorder where workorder.tran_id = ls_tempvar; end if; end; end if; return ls_fieldvalue ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION STRONLYALPHANUM (input_string IN VARCHAR2) RETURN VARCHAR2 IS cleaned_string VARCHAR2(4000); BEGIN -- Use regular expressions to remove spaces and special characters cleaned_string := REGEXP_REPLACE(input_string, '[^a-zA-Z0-9]', ''); RETURN cleaned_string; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083258 ON HTL_PAX_HDR (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHC_TOWNWSE_DESR ( AS_TYPE VARCHAR2 , AS_DCR_ID CHAR , AS_LOCALITY_CODE CHAR ) RETURN VARCHAR2 AS AS_VAR21 VARCHAR2(150); AS_BHR EXCEPTION; BEGIN IF AS_TYPE = 'TOWN' THEN BEGIN SELECT Y.SH_DESCR into AS_VAR21 FROM LOCALITY X ,STATION Y WHERE X.LOCALITY_CODE = AS_LOCALITY_CODE AND X.STAN_CODE = Y.STAN_CODE; return AS_VAR21; END; ELSE IF AS_TYPE = 'STATE_CODE' THEN BEGIN SELECT X.STATE_CODE INTO AS_VAR21 FROM LOCALITY X WHERE X.LOCALITY_CODE = AS_LOCALITY_CODE; return AS_VAR21; END; ELSE IF AS_TYPE = 'NO_OF_DAY_WORKED' THEN BEGIN SELECT LISTAGG(TO_CHAR(EVENT_DATE , 'DD/MM'), ',') within group(order by event_date) into AS_VAR21 FROM FIELDACTIVITY X, SPRS_ACT_TRAN TR WHERE --X.ACTIVITY_CODE = S.EVENT_TYPE AND TR.ACTIVITY_CODE = X.ACTIVITY_CODE AND TR.dcr_id = AS_DCR_ID AND X.STATUS = 'Y' AND X.ACTIVITY_TYPE = 'FW'; return AS_VAR21; END; END IF; END IF; END IF; RAISE AS_BHR; EXCEPTION WHEN AS_BHR THEN RETURN NULL; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PO ( as_itemcode item.item_code%type, adt_todate date, as_site_code item.site_code%type ) RETURN VARCHAR2 IS PO varchar2(20); ldt_lastdate date; BEGIN begin select max(c.ord_date) into ldt_lastdate from porder c,porddet d where c.purc_order = d.purc_order and d.ITEM_CODE = as_itemcode and c.ord_date < adt_todate -- same sql condition is written in item info button of w_indent_req and d.site_code = as_site_code; END ; begin if ldt_lastdate is not null then select b.PURC_ORDER into PO from porder a,porddet b where a.purc_order = b.purc_order and b.item_code = as_itemcode and b.site_code = as_site_code and rownum = 1 and a.ord_date = ldt_lastdate ; end if; END ; RETURN PO; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DIST_EXCISE_LINENO (as_distno distord_rcp.tran_id%type, as_lineno distord_rcpdet.line_no%type) return number is ldec_excise number(14,3) ; ls_var_name char(200); begin select var_value into ls_var_name from disparm where var_name = 'EXC_TAX_CODE' and prd_code = '999999'; select NVL(sum(tax_amt),0) into ldec_excise from taxtran where tran_code = 'D-RCP' and instr(ls_var_name,rtrim(tax_code)) > 0 and tran_id=as_distno and line_no=as_lineno; return(ldec_excise); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GEN_DESC ( as_fld_name in char , as_fld_value in char ) return char is ls_retval varchar(120) ; begin select descr into ls_retval from gencodes where fld_name = as_fld_name and fld_value = as_fld_value and rownum =1 ; return ls_retval ; exception when too_many_rows then return ' ' ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANS_CR1 (ldate_fr in date,ldate_to in date, lsite_code in char,lacct_code in char) return number is lc_cr_sum number(14,3); begin Select nvl(Sum(cr_amt),0) into lc_cr_sum from gltran where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PAYABLES_TRFDET_X ON PAYABLES_TRFDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDS_TOKEN (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_str varchar2(200) ; ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ctr number(3); cursor c1 is select nvl(HANDOVER_CHNO,''), nvl(BANK_CODE__TAX,''),nvl(TOKEN_NO,'') from misc_payment where tran_id in ( select tran_id from misc_paydet where tran_ser = 'M-VOUC' and vouch_no = ls_vouch_no ) ; begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_ch_no_det,ls_bank_cd_det,ls_token_no_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; ls_str := rtrim(ls_str)||ls_token_no_det ; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ASSET_DELETION_X ON ASSET_DELETION (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_MAX_LTRAN_DATE ( p_site_code IN VARCHAR2, p_item_code IN VARCHAR2, p_lot_no IN VARCHAR2, p_loc_code IN VARCHAR2 ) RETURN DATE IS v_max_ltran_date DATE; BEGIN SELECT MAX(LTRAN_DATE) INTO v_max_ltran_date FROM stock WHERE site_code = p_site_code AND item_code = p_item_code AND lot_no = p_lot_no AND loc_code = p_loc_code; RETURN v_max_ltran_date; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; END fn_get_max_ltran_date; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_TAX_NEW_TAX_VAL (ls_tran_code in char, ls_tran_id in char, ls_line_no in char, ls_disparm_code in char, ls_disparm_code_1 in char, ls_disparm_code_2 in char, ls_type in char) return number is lc_tax_amt number(14,3); LS_VAR_VALUE VARCHAR(2000); LS_VAR_VALUE1 VARCHAR(2000); LS_VAR_VALUE2 VARCHAR(2000); as_line_no char(3); lc_exch_rate number(17,6); begin begin ---as_line_no := substr(' ' + ltrim(rtrim(ls_line_no)),length(ltrim(rtrim(ls_line_no))) - 2); if length(ltrim(rtrim(ls_line_no))) = 1 then AS_LINE_NO := ' ' || RTRIM(LTRIM(LS_LINE_NO)); end if; if length(ltrim(rtrim(ls_line_no))) = 2 then as_line_no := ' ' || rtrim(ltrim(ls_line_no)); end if; if length(ltrim(rtrim(ls_line_no))) = 3 then as_line_no := rtrim(ltrim(ls_line_no)); end if; select (rtrim(var_value)) into ls_var_value from disparm where prd_code = '999999' AND VAR_NAME = LS_DISPARM_CODE; --tax amt if ls_type = 'T' then select nvl(sum(nvl(Tax_Amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND LINE_NO = AS_LINE_NO --and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); -- taxable amt ELSIF ls_type = 'B' then select nvl(sum(nvl(Taxable_amt,0)),0) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND LINE_NO = AS_LINE_NO --and instr(ls_var_value,(','||rtrim(tax_code)||',')) > 0 ; AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ); -- tax % ELSIF ls_type = 'P' then select MAX(tax_perc) into lc_tax_amt from taxtran where tran_code = ls_tran_code and tran_id = ls_tran_id AND LINE_NO = AS_LINE_NO --AND INSTR(LS_VAR_VALUE,(','||RTRIM(TAX_CODE)||',')) > 0 AND TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) AND TAX_AMT <>0 ; -- taxable amt ELSIF ls_type = 'A' then select (rtrim(var_value)) INTO LS_VAR_VALUE1 from disparm where prd_code = '999999' and var_name = ls_disparm_code_1; SELECT (RTRIM(VAR_VALUE)) into LS_VAR_VALUE2 FROM DISPARM where prd_code = '999999' and var_name = ls_disparm_code_2; select nvl(sum(CASE WHEN tax_type = 'H' THEN nvl(taxable_amt, 0) WHEN tax_type = 'I' THEN nvl(taxable_amt, 0) WHEN tax_type = 'J' THEN nvl(taxable_amt, 0) ELSE 0 END), 0) into lc_tax_amt from taxtran,tax WHERE tax.tax_code = taxtran.tax_code and tran_code = ls_tran_code and tran_id = ls_tran_id and line_no = as_line_no -- And tax_perc <> 0 AND (TAX.TAX_TYPE) IN ('H','I','J') AND ( TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE1)) ) OR TAX.TAX_CODE IN ( SELECT COLUMN_VALUE FROM TABLE(CSV_TO_ROW(LS_VAR_VALUE2)) ) ); end if; EXCEPTION WHEN NO_DATA_FOUND THEN lc_tax_amt := 0 ; END ; RETURN LC_TAX_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DTF_CHK_SPL_CHAR_VCH before insert or update on voucher referencing old as old new as new FOR EACH ROW declare billno VOUCHER.BILL_NO%type; billno1 VOUCHER.BILL_NO%type; begin billno := trim(:new.bill_no); select Replace(translate(billno,'ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz1234567890-','AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),'A','') into billno1 from dual; if (billno1 is not null ) then RAISE_APPLICATION_ERROR(-20602, 'Special Characters are not allowed in bill number [' || billno1 ||']' ); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_ADJISSRCP_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON adj_issrcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_adjisscount number(3) := 0; ll_count number(6) := 0; lc_allocqty number(14,3) := 0; BEGIN if inserting and :new.confirmed = 'Y' then raise_application_error( -20601, 'Inconsistent confirmation detected, confirmation can not be Yes while adding new record'); end if; if :new.confirmed = 'Y' and :old.ref_ser = 'ADJISS' then begin select count(1) into ll_adjisscount from adj_issrcpdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_adjisscount:= 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'ADJISS' and ref_id = :new.tran_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; ------------- allocation check to be added here end if; if :new.confirmed = 'Y' and :old.ref_ser ='ADJRCP'then begin select count(1) into ll_adjisscount from adj_issrcpdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_adjisscount:= 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'ADJRCP' and ref_id = :new.tran_id and eff_qty > 0 ; exception when others then ll_invcount := 0; end; end if; if ll_invcount <> ll_adjisscount then raise_application_error( -20601, 'Invtrace not updated for all the details issue detail count [' || to_char(ll_adjisscount) || '] invtrace count [' || to_char(ll_invcount) ||']' ); end if; if trim(:old.ref_ser) = 'ADJISS' and :new.confirmed = 'Y' then select sum(ALLOC_QTY) into lc_allocqty from invalloc_trace where ref_ser = :old.ref_ser and ref_id = :new.tran_id; if lc_allocqty <> 0 then raise_application_error( -20601, 'Allocation trace net quantity is non-zero, invalloc_trace not updated for all the details lc_allocqty [' || to_char(lc_allocqty) ||']'); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE ORDERLINENOPOPHELPPACKAGE AS FUNCTION getOrderLineNoPophelp (asOrderType in char, asOrderNo in char) RETURN orderLineNoMasterTable PIPELINED; END; CREATE OR REPLACE PACKAGE BODY ORDERLINENOPOPHELPPACKAGE AS FUNCTION getOrderLineNoPophelp (asOrderType in char, asOrderNo in char) RETURN orderLineNoMasterTable PIPELINED IS BEGIN IF asOrderType = 'S' THEN FOR x IN ( SELECT to_number(trim(o.line_no)) line_no__ord,o.item_code__ord item_code, o.quantity,o.UNIT,m.descr item_descr FROM sorddet o, item m WHERE m.item_code = o.item_code__ord and o.sale_order = asOrderNo and o.status not in ('C','X') ) LOOP PIPE ROW (orderLineNoMaster(x.line_no__ord,x.item_code,x.quantity, x.UNIT,x.item_descr)); END LOOP; RETURN; END IF; IF asOrderType = 'I' THEN FOR x IN ( SELECT to_number(trim(o.line_no)) line_no__ord,o.item_code__ord item_code, o.quantity,o.UNIT,m.descr item_descr FROM sorddet o, item m WHERE m.item_code = o.item_code__ord and o.sale_order = asOrderNo and o.status not in ('C','X') union all SELECT o.line_no line_no__ord,o.item_code item_code, o.qty_confirm quantity,o.UNIT,m.descr item_descr FROM distorder_det o, item m WHERE m.item_code = o.item_code and o.dist_order = asOrderNo and o.status not in ('C','X') ) LOOP PIPE ROW (orderLineNoMaster(x.line_no__ord,x.item_code,x.quantity, x.UNIT,x.item_descr)); END LOOP; RETURN; END IF; IF asOrderType = 'D' THEN FOR x IN ( SELECT o.line_no line_no__ord,o.item_code item_code, o.qty_confirm quantity,o.UNIT,m.descr item_descr FROM distorder_det o, item m WHERE m.item_code = o.item_code and o.dist_order = asOrderNo and o.status not in ('C','X') ) LOOP PIPE ROW (orderLineNoMaster(x.line_no__ord,x.item_code,x.quantity, x.UNIT,x.item_descr)); END LOOP; RETURN; END IF; IF asOrderType = 'P' THEN FOR x IN ( SELECT to_number(trim(o.line_no)) line_no__ord,o.item_code item_code, o.quantity,o.UNIT,m.descr item_descr FROM porcpdet o, item m WHERE m.item_code = o.item_code and o.tran_id = asOrderNo ) LOOP PIPE ROW (orderLineNoMaster(x.line_no__ord,x.item_code,x.quantity, x.UNIT,x.item_descr)); END LOOP; RETURN; END IF; IF asOrderType = 'R' THEN FOR x IN ( SELECT to_number(trim(o.line_no)) line_no__ord,o.item_code item_code, o.quantity,o.UNIT,m.descr item_descr FROM distord_rcpdet o, item m WHERE m.item_code = o.item_code and o.tran_id = asOrderNo ) LOOP PIPE ROW (orderLineNoMaster(x.line_no__ord,x.item_code,x.quantity, x.UNIT,x.item_descr)); END LOOP; RETURN; END IF; IF asOrderType = 'W' THEN FOR x IN ( SELECT to_number(trim(o.line_no)) line_no__ord,o.item_code item_code, o.quantity,o.UNIT,m.descr item_descr FROM distord_rcpdet o, item m WHERE m.item_code = o.item_code and o.tran_id = asOrderNo ) LOOP PIPE ROW (orderLineNoMaster(x.line_no__ord,x.item_code,x.quantity, x.UNIT,x.item_descr)); END LOOP; RETURN; END IF; END; END orderLineNoPopHelpPackage; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ITEM_U_DESCR ON ITEM (UPPER(DESCR)) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETRCPSTATUS (p_tran_id_rcp IN char,p_tran_id_adj IN char) RETURN char IS cnumber number; BEGIN IF p_tran_id_rcp is not null and length(trim(p_tran_id_rcp)) > 0 THEN BEGIN select count(*) into cnumber from rcpdishnr where receipt_no = p_tran_id_rcp; EXCEPTION WHEN OTHERS THEN cnumber := 0; END; END IF; IF cnumber = 0 and p_tran_id_adj is not null and length(trim(p_tran_id_adj)) > 0 THEN BEGIN select count(*) into cnumber from rcpdishnr where receipt_no = p_tran_id_adj; EXCEPTION WHEN OTHERS THEN cnumber := 0; END; END IF; if cnumber = 0 then RETURN ' '; else RETURN '*'; end if ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_REC_ADJ_AMT_DOM ( ref_ser1 IN CHAR, ref_ser2 IN CHAR, as_inv_id IN CHAR ) RETURN NUMBER IS lc_tot_amt NUMBER(14,3); BEGIN SELECT SUM(RECEIVABLES_ADJ.ADJ_AMT) INTO lc_tot_amt FROM RECEIVABLES_ADJ, RECEIVABLES , INVOICE WHERE (RECEIVABLES.REF_NO = RECEIVABLES_ADJ.REF_NO) AND RECEIVABLES.TRAN_SER = RECEIVABLES_ADJ.REF_SER AND (RECEIVABLES_ADJ.REF_SER IN(ref_ser1,ref_ser2)) AND RECEIVABLES_ADJ.REF_NO_ADJ =INVOICE.INVOICE_ID AND (RECEIVABLES .tran_date <= invoice.tran_date) AND (RECEIVABLES_ADJ.REF_NO_ADJ =as_inv_id); RETURN lc_tot_amt; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER CUST_STOCK_AFTER_INS_UPD AFTER UPDATE of confirmed ON CUST_STOCK FOR EACH ROW DECLARE CONFVAL CHAR(1); REFCOUNT NUMBER(10,2) DEFAULT 0; BEGIN SELECT COUNT(REF_ID) INTO REFCOUNT FROM DWH_TRAN_LOAD WHERE REF_ID=:NEW.TRAN_ID AND REF_SER='S-CSTK' ;--AND REF_DATE=:NEW.TRAN_DATE AND UPDATE_STAT='P' ; CONFVAL:=:NEW.CONFIRMED; IF(CONFVAL = 'Y') THEN -- Insert record into DWH_TRAN_LOAD table INSERT INTO DWH_TRAN_LOAD ( REF_ID, REF_SER, REF_DATE, UPDATE_STAT ) VALUES ( :NEW.TRAN_ID, 'S-CSTK', :NEW.TRAN_DATE, 'P' ); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSL_TRANS_CR_FIN (ldate_fr in date,ldate_to in date,lsundry_code in char,lsundry_type in char, l_fin_entity in char,lacct_code in char) return number is lc_cr_sum number(14,3); begin Select nvl(Sum(cr_amt * exch_rate),0) into lc_cr_sum from gltrace where fin_entity = l_fin_entity and tran_date >= ldate_fr and tran_date <= ldate_to and sundry_type = lsundry_type and sundry_code = lsundry_code and acct_code = lacct_code; Return lc_cr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RDAYOP_GLTRAN (m_frst_date in date, m_date_from in date, m_acct_code in char, m_site_code in char) return number is ld_day_op_bal number(14,3); begin Select Sum(dr_amt - cr_amt) into ld_day_op_bal from gltran where site_code = m_site_code and tran_date > m_frst_date and tran_date < m_date_from and acct_code = m_acct_code ; if ld_day_op_bal is null then ld_day_op_bal := 0; end if; Return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXTRAN_RECO_AMT_JSPR (as_tranid char) return number is as_reco_amt number; as_reco_amt_sum number := 0; ls_var nvarchar2(4000); ls_code nvarchar2(4000); ls_string varchar2(4000); lc_exchrate number; li_pos number; ls_token varchar2(4000); LS_STRING_NEW varchar2(500); begin ls_string :=''; select var_value into ls_var from disparm where var_name = 'EXC_TAX_CODE_MODVAT' and prd_code = '999999'; if(instr(ls_var,',') =0) then ls_string := ls_var; else while(instr(ls_var,',') !=0) loop ls_string :=ls_string||''''||substr(ls_var,1,instr(ls_var,',')-1)||''''||','; ls_var := substr(ls_var,instr(ls_var,',')+1,length(trim(ls_var))); dbms_output.put_line(ls_string); end loop; ls_string := ','||substr(ls_string,1,length(trim(ls_string))-1)||','; end if; select nvl(sum(nvl(reco_amount,0)),0) into as_reco_amt from taxtran where ( taxtran.tran_code in ('P-RCP','P-RET') ) and ( taxtran.tran_id = as_tranid) and INSTR((ls_string),trim(taxtran.tax_code)) > 0; as_reco_amt_sum := as_reco_amt_sum + as_reco_amt; select exch_rate into lc_exchrate from porcp where tran_id = as_tranid ; return as_reco_amt_sum*lc_exchrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CONVFACT ( as_ref_code_old in ITEM.ITEM_CODE%TYPE, as_ref_code_new in ITEM.ITEM_CODE%TYPE ) RETURN uomconv.fact%TYPE IS convfact uomconv.fact%TYPE := 1; BEGIN select fact into convfact from uomconv where item_code = as_ref_code_new and unit__fr = (select unit from item where item_code = as_ref_code_old) and unit__to = (select unit from item where item_code = as_ref_code_new); if(convfact is null or convfact = '') then convfact := 1; end if; return convfact; EXCEPTION WHEN NO_DATA_FOUND THEN BEGIN select fact into convfact from uomconv where item_code = 'X' and unit__fr = (select unit from item where item_code = as_ref_code_old) and unit__to = (select unit from item where item_code = as_ref_code_new); if(convfact is null or convfact = '') then convfact := 1; end if; return convfact; EXCEPTION WHEN NO_DATA_FOUND THEN return 1; END; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRAN_ACCT_DATE ON GLTRAN (ACCT_CODE, SITE_CODE, TRAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORK_ORDER_X ON WORKORDER_ISS (WORK_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 10485760 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER WF_PRC_STATUS_CHG_TRIGGER AFTER INSERT ON WF_PRC_STATUS_CHG FOR EACH ROW BEGIN UPDATE WF_PRC_STATUS SET PROCESS_STATUS = :NEW.PROCESS_STATUS WHERE PROCESS_ID = :NEW.PROCESS_ID AND INSTANCE_ID = :NEW.INSTANCE_ID AND ACTIVITY_ID = :NEW.ACTIVITY_ID AND SEQ_ID = :NEW.SEQ_ID AND REF_SER = :NEW.REF_SER AND REF_ID = :NEW.REF_ID AND ENTITY_CODE__PERF = :NEW.ENTITY_CODE__PERF; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_COUNT_DCUST (as_sales_pers char,as_class char,as_date date) return number is ls_count number(9); begin select count(strg_code) into ls_count from strg_meet where trim(sales_pers)=trim(as_sales_pers) and trim(strg_type)= 'D' and trim(strg_class_code)=trim(as_class) and to_date(event_date)=to_date(as_date); return nvl(ls_count,'0'); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MISC_DR_AMT (as_tranid_drn in char,as_invoice_id in char) return number is lc_amount number(20,2); begin if (as_tranid_drn) is not null/* and len(trim(as_tranid_drn)) > 0*/ then select nvl(sum(drcr_amt),0) into lc_amount from drcr_rdet where tran_id = as_tranid_drn and invoice_id = as_invoice_id; end if; return lc_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FIN_SCHEME_X ON FIN_SCHEME (FIN_SCHEME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_REPL_ORD_USER (REPL_ORDER_IN IN CHAR, USER_IN IN CHAR) RETURN NUMBER is FLAG NUMBER; CNT NUMBER; CNT1 NUMBER; CNT2 NUMBER; BEGIN BEGIN SELECT count(*) INTO CNT FROM REPL_ISS_HDR WHERE REPL_ORDER = REPL_ORDER_IN AND CHG_USER = USER_IN; IF( CNT > 0) THEN select count(*) into CNT1 from WAVE_TASK_DET where REF_ID = REPL_ORDER_IN AND STATUS <>'Y'; if( CNT1 > 0) THEN FLAG := 1; ELSE FLAG := 0; END IF ; ELSE SELECT count(*) INTO CNT2 FROM REPL_ISS_HDR WHERE REPL_ORDER = REPL_ORDER_IN AND CONFIRMED ='N'; IF( CNT2 > 0) THEN FLAG := 0; ELSE FLAG := 1; END IF ; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG := 2; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EDI_CONTROL_FILE_X ON EDI_CONTROL_FILE (WIN_NAME, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKENDTIME ( p_geo_fence_option IN CHAR, p_geo_fence_endtime IN VARCHAR2, p_geo_fence_enable IN CHAR ) RETURN NUMBER IS v_dummy_time DATE; BEGIN IF NVL(TRIM(p_geo_fence_option), '') = '3' THEN -- Check if value is provided IF p_geo_fence_endtime IS NULL OR TRIM(p_geo_fence_endtime) = '' THEN RETURN 0; END IF; -- Strict format check: must be exactly HH:MI IF NOT REGEXP_LIKE(TRIM(p_geo_fence_endtime), '^\d{2}:\d{2}$') THEN RETURN 0; END IF; -- Check that the time is valid BEGIN v_dummy_time := TO_DATE(TRIM(p_geo_fence_endtime), 'HH24:MI'); EXCEPTION WHEN OTHERS THEN RETURN 0; -- Invalid time value END; END IF; RETURN 1; EXCEPTION WHEN OTHERS THEN RETURN 0; END CHECKENDTIME; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_INVDET_SO ON INVDET (SORD_NO, SORD_LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_WO_ISS_DEVIATED (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_CT3FORM_HDR ON CT3FORM_HDR (FORM_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX COSTCTR_DESCR ON COSTCTR (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGROSS_AMT (as_tran_id in char, as_type in char) return number as lc_gross_amt number (15,2); ld_tax_total number (15,2); ld_cost_total number (15,2); begin if as_type = 'D' then select sum(quantity__stduom * rate__clg) into lc_gross_amt from despatchdet where desp_id = as_tran_id; elsif as_type = 'I' then select sum(quantity * rate) into lc_gross_amt from distord_issdet where tran_id = as_tran_id; elsif as_type = 'P-RET' then ld_cost_total := 0; select sum(rate * quantity) into ld_cost_total from porcpdet where tran_id = as_tran_id; if ld_cost_total is null then ld_cost_total := 0; end if; --Get Total Tax select sum(tax_amt) into ld_tax_total from taxtran where tran_id = as_tran_id and tran_code= as_type; if ld_tax_total is null then ld_tax_total := 0; end if; lc_gross_amt := ld_cost_total + ld_tax_total; elsif as_type = 'DRNRCP' then lc_gross_amt := 0; select sum(drcr_amt) into lc_gross_amt from drcr_rdet where tran_id = as_tran_id; end if; if lc_gross_amt is null then lc_gross_amt := 0; end if; return lc_gross_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PARTCD_DESCR ( as_part_code char) return varchar2 is ls_descr varchar2(60); begin begin select part_descr into ls_descr from mcparts where part_code = as_part_code; exception when no_data_found then ls_descr := null; end; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_ASSET_TRANSFER_DET ON ASSET_TRANSFER_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_BANK_RECO_BOOK_CURR ( as_bankcode in char, ad_ason in date , as_curr_code in char ) return number is lc_total number(14,3) ; lc_tot_p1 number(14,3); lc_tot_r1 number(14,3); lc_tot_p2 number(14,3); lc_tot_r2 number(14,3); begin select nvl(sum(amount-amt_adj),0) into lc_tot_p1 from banktran_log where bank_code = as_bankcode and status <> 'R' and tran_date <= ad_ason and tran_type='P' and curr_code = as_curr_code; select nvl(sum(amount-amt_adj),0) into lc_tot_r1 from banktran_log where bank_code = as_bankcode and status <> 'R' and tran_date <= ad_ason and tran_type = 'R' and curr_code = as_curr_code; select nvl(sum(amount-amt_adj),0) into lc_tot_p2 from bank_statement where bank_code = as_bankcode and status <> 'R' and eff_date <= ad_ason and tran_type = 'P' and curr_code = as_curr_code; select nvl(sum(amount-amt_adj),0) into lc_tot_r2 from bank_statement where bank_code = as_bankcode and status <> 'R' and eff_date <= ad_ason and tran_type = 'R' and curr_code = as_curr_code; lc_total := (lc_tot_p1 - lc_tot_r1 - lc_tot_p2 + lc_tot_r2) ; return lc_total ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PTAXBASE_AMT (AS_EMP_CODE CHAR, AS_PRD_CODE CHAR , AS_PROC_TYPE CHAR , AC_BASE_AMT NUMBER , AS_BASE_ADCODE CHAR) RETURN NUMBER IS M_RETURN NUMBER(16,4) :=0; BEGIN M_RETURN := CASE WHEN AC_BASE_AMT IS NULL THEN 0 ELSE AC_BASE_AMT END; RETURN M_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SITE_CODE_CUST (MSITE_CODE IN CHAR, MCUST_CODE IN CHAR) RETURN CHAR IS MCTR NUMBER; BEGIN SELECT COUNT(1) INTO MCTR FROM site_customer WHERE site_code = MSITE_CODE AND CUST_CODE = MCUST_CODE and NVL(active_yn,'Y') <> 'N'; IF MCTR = 1 THEN RETURN '1'; ELSE RETURN '0'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WO_OPER_RECALBTCHSIZE (as_work_order in workorder.work_order%type, an_operation in workorder_iss.operation%type) return number is ln_batch_size number(14,3); begin select nvl(sum(nvl(workorder_enhanc.recalbom_batch_size,0)),0) into ln_batch_size from workorder_enhanc where workorder_enhanc.work_order = as_work_order and workorder_enhanc.operation_level = an_operation and workorder_enhanc.enhanc_type = 'A' and workorder_enhanc.confirmed = 'Y' ; return ln_batch_size; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX WF_ROUTE_X ON WF_ROUTE (EVENT_CODE, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NEAR_EXPIRY (AS_ITEM_CODE CHAR,AS_SITE_CODE CHAR) RETURN NUMBER IS AS_STK_QTY NUMBER(30); BEGIN SELECT SUM(STOCK.QUANTITY - STOCK.ALLOC_QTY - nvl(STOCK.HOLD_QTY,0)) STOCK_AVAIL INTO AS_STK_QTY FROM STOCK,LOCATION,INVSTAT WHERE STOCK.LOC_CODE =LOCATION.LOC_CODE AND LOCATION.INV_STAT =INVSTAT.INV_STAT AND LOCATION.INV_STAT ='NEXP' AND STOCK.ITEM_CODE =AS_ITEM_CODE AND STOCK.SITE_CODE =AS_SITE_CODE; RETURN AS_STK_QTY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE POPHELPPACKAGE_CHGBK AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN sundryMasterTable_chgbk PIPELINED; END; CREATE OR REPLACE PACKAGE BODY POPHELPPACKAGE_CHGBK AS FUNCTION getSundryPophelp (asSyndryType in char, asLoginSite in char) RETURN sundryMasterTable_chgbk PIPELINED IS BEGIN IF asSyndryType = 'R' THEN FOR x IN (SELECT CUSTOMER.CUST_CODE, CUSTOMER.CUST_NAME,CUSTOMER.CITY,NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM CUSTOMER, STATE WHERE CUSTOMER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster_chgbk(x.CUST_CODE,x.CUST_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; IF asSyndryType = 'S' THEN FOR x IN (SELECT STRG_CUSTOMER.SC_cODE, STRG_CUSTOMER.FIRST_NAME||' '||STRG_CUSTOMER.MIDDLE_NAME||' '||STRG_CUSTOMER.LAST_NAME AS SC_NAME, CITY, NULL DIVISION, TRIM(STATE.DESCR) AS STATE FROM STRG_CUSTOMER, STATE WHERE STRG_CUSTOMER.STATUS ='A' AND STRG_CUSTOMER.STATE_CODE = STATE.STATE_CODE (+)) LOOP PIPE ROW (sundryMaster_chgbk(x.SC_CODE,x.SC_NAME,x.CITY,X.DIVISION,X.STATE)); END LOOP; RETURN; END IF; END; END popHelpPackage_chgbk; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_GET_GP_NO (ls_ref_ser char, ls_ref_id char) return char is ls_gp_no char(20); ls_refser_ibca char(6); ls_refno_ibca char(10); begin if rtrim(ls_ref_ser) = 'S-INV' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b where b.desp_id = a.desp_id and b.invoice_id = ls_ref_id and rownum = 1; return ls_gp_no; elsif rtrim(ls_ref_ser) = 'CRNRCP' or rtrim(ls_ref_ser) = 'DRNRCP' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b , drcr_rcp c where c.invoice_id = b.invoice_id and b.desp_id = a.desp_id and c.tran_id = ls_ref_id and rownum = 1; return ls_gp_no; elsif rtrim(ls_ref_ser) like 'R-IBC%' then select ref_ser into ls_refser_ibca from rcp_ibca_det where ref_no = ls_ref_id and rownum = 1; if rtrim(ls_refser_ibca) = 'S-INV' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b where b.desp_id = a.desp_id and b.invoice_id = ls_ref_id and rownum = 1; return ls_gp_no; elsif rtrim(ls_refser_ibca) = 'CRNRCP' or rtrim(ls_refser_ibca) = 'DRNRCP' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b , drcr_rcp c where c.invoice_id = b.invoice_id and b.desp_id = a.desp_id and c.tran_id = ls_ref_id and rownum = 1; return ls_gp_no; else ls_gp_no := ' '; return ls_gp_no; end if; else ls_gp_no := ' '; return ls_gp_no; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TAX_BALANCE (as_acct_prd char,as_fin_entity char,as_site_code char,as_bal_group char,as_bal_prd char,as_drcr_flag char) return number is ln_bal number(14,3); begin if as_drcr_flag = 'D' then select sum(dr_amt) into ln_bal from tax_process_bal a,site b where a.site_code = b.site_code and acct_prd = as_acct_prd and b.site_code__exc = as_site_code and bal_group = as_bal_group and bal_prd < as_bal_prd; else select sum(cr_amt) into ln_bal from tax_process_bal a,site b where a.site_code = b.site_code and acct_prd = as_acct_prd and b.site_code__exc = as_site_code and bal_group = as_bal_group and bal_prd < as_bal_prd; end if; return ln_bal; exception when others then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER STRGBRNDSURV_PKVAL before insert on strg_brand_survey for each row begin if (:new.dcr_id is null or length(trim(:new.dcr_id)) = 0 ) then begin select dcr_id , strg_code into :new.dcr_id , :new.strg_code from strg_meet where tran_id = :new.tran_id and rownum=1; end; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_GET_ENV (mprd_code char,mvar_name char) return VARCHAR2 is ret_varvalue VARCHAR2(300); begin select nvl(var_value,'NULLFOUND') into ret_varvalue from payrparm where prd_code = mprd_code and var_name= mvar_name; return( ret_varvalue ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TOUR_HISTORY ( Vi_Status In Char, Vi_Auth_Sign In Char, Vi_Wrkflw_Status In Char, Vi_Tran_Id_1 In VARCHAR2, vi_for_history in char, vi_for_emp in char) Return Varchar2 Is History_Descr Varchar2(1000); Vi_Tran_Id VARCHAR2(50); Vi_tour_id_in_char char(10); Vi_EMP_CODE VARCHAR2(10); sign_date VARCHAR2(11); emp_fname VARCHAR2(15); emp_mname VARCHAR2(15); emp_lname VARCHAR2(15); historyFormat VARCHAR2(1000); hist_descr1 VARCHAR2(1000); empCode VARCHAR2(10); hrEmpCode VARCHAR2(10); roleEmp VARCHAR2(10); roleEmpName VARCHAR2(50); fullName VARCHAR2(50); signStatus CHAR(1); reportTo VARCHAR2(10); reportToAdmin VARCHAR2(10); reportToFullName VARCHAR2(200); reportToAdminFullName VARCHAR2(200); roleCode varchar2(10); sign_counter number; unsign_counter number; rej_counter number; li_cnt number; lc_no_days number(14,3); refser CHAR(6); signremarks varchar2(200); tourFormCnt number; Begin Vi_Tran_Id:=trim(Vi_Tran_Id_1); Vi_tour_id_in_char:=trim(Vi_Tran_Id_1); Vi_EMP_CODE := ''; sign_date := ''; emp_fname := ''; emp_mname := ''; emp_lname := ''; historyFormat := ''; empCode := ''; hrEmpCode := ''; fullName := ''; roleEmp := ''; roleEmpName := ''; signStatus := ''; reportTo := ''; reportToAdmin := ''; reportToFullName := ''; reportToAdminFullName := ''; sign_counter := 0; unsign_counter := 0; rej_counter := 0; li_cnt := 0; refser := ''; hist_descr1 := ''; signremarks := ''; lc_no_days := 0; History_Descr := ''; tourFormCnt := 0; select count(1) into tourFormCnt from tour_form where tour_id = Vi_tour_id_in_char; if tourFormCnt = 0 then if vi_for_history = 'R' then if vi_status = 'O' or vi_status = 'U' then History_Descr := 'Pending for System Process' ; elsif Vi_Status = 'C' THEN History_Descr := 'Cancelled'; elsif Vi_Status = 'A' THEN History_Descr := 'Approved'; else History_Descr := 'Pending for System Process' ; end if; else History_Descr := ''; end if; return History_Descr; end if; Select emp_code, EMP_CODE__APPR, EMP_CODE__REC, EMP_CODE__APPR, no_days Into Vi_EMP_CODE, hrEmpCode, reportTo, reportToAdmin, lc_no_days From tour Where tour_id = Vi_tour_id_in_char; select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code = reportTo; reportToFullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code = reportToAdmin; reportToAdminFullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; if vi_status = 'O' then if (Vi_For_History = 'R') then return 'Not Submitted'; else return ''; end if; elsif (Vi_Status = 'C' And Vi_Wrkflw_Status = 'XX' ) then if (Vi_For_History = 'R') then return 'Cancelled by Employee'; else return ''; end if; -- elsif (Vi_Status = 'C') then -- Modified by Piyush on 20/04/2015 elsif (Vi_Status = 'C' and Vi_Wrkflw_Status <> 'ZZ') then li_cnt := 0; select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id and sign_status = 'R'; if li_cnt = 0 then if (Vi_For_History = 'R') then if Vi_Wrkflw_Status = 'AR' or Vi_Wrkflw_Status = 'RR' then return 'Rejected'; else --Modified by Piyush on 20/04/2015 [To handel cancellation from ERP] return 'Cancelled'; end if; else return ''; end if; end if; --elsif (Vi_Status = 'A') then -- Modified by Piyush on 20/04/2015 elsif (Vi_Status = 'A' and Vi_Wrkflw_Status <> 'ZZ') then li_cnt := 0; select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id and sign_status = 'S'; if li_cnt = 0 then if (Vi_For_History = 'R') then return 'Approved'; else return ''; end if; end if; end if ; if (Vi_For_History = 'R') then if (Vi_Auth_Sign = 'R') then roleCode := 'T_RECOMEN'; roleEmp := reportTo; roleEmpName := reportToFullName; end if; elsif (Vi_For_History = 'A') then if (Vi_Auth_Sign = 'R' or Vi_Auth_Sign = 'A') then roleCode := 'T_APPROV'; roleEmp := reportToAdmin; roleEmpName := reportToAdminFullName; end if; end if; if (Vi_For_History = 'R' or Vi_For_History = 'A') then select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = roleCode; -- 20/04/2015.Start if (li_cnt > 0 and Vi_Wrkflw_Status = 'ZZ') then Select trim(Sign_Remarks), emp_code, sign_date, sign_status Into signremarks, empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = roleCode; if (empCode is null or length(trim(empCode)) = 0) then li_cnt := 0; if vi_For_History = 'R' then return 'Awaiting approval from ' || roleEmpName ; else History_Descr := 'Awaiting approval from ' || roleEmpName ; end if; end if; end if; -- 20/04/2015.End if (li_cnt > 0) then Select trim(Sign_Remarks), emp_code, to_char(sign_date , 'dd-Mon-yyyy'), sign_status Into signremarks, empCode, sign_date, signStatus From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = roleCode; if (empCode is null or length(trim(empCode)) = 0) then empCode := roleEmp; fullName := roleEmpName; else select emp_fname, emp_mname, emp_lname into emp_fname, emp_mname, emp_lname from employee where emp_code=empCode ; fullName := trim(emp_fname) || ' ' || case when emp_mname is null or length(trim(emp_mname)) = 0 then '' else trim(emp_mname) end || ' ' || case when emp_lname is null or length(trim(emp_lname)) = 0 then '' else trim(emp_lname) end; end if; if(signStatus = 'R') then historyFormat := 'Rejected by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || signremarks; History_Descr := historyFormat ; elsif (signStatus = 'S') then historyFormat := 'Approved by ' || fullName || ' on ' || sign_date || ' ' || 'Remarks - ' || signremarks; History_Descr := historyFormat ; elsif (signStatus = 'U') then if (vi_status not in ('A' , 'C')) then historyFormat := 'Awaiting approval from ' || fullName ; History_Descr := historyFormat ; end if; end if; else --if (vi_status not in ('A' , 'C')) then -- Modified by Piyush on 20/04/2015 if (vi_status not in ('A' , 'C') or Vi_Wrkflw_Status = 'ZZ') then empCode := roleEmp; fullName := roleEmpName; if (Vi_For_History = 'R') then if (Vi_Auth_Sign = 'R') then History_Descr := 'Awaiting approval from ' || fullName ; end if; elsif (Vi_Auth_Sign = 'A') then History_Descr := 'Awaiting approval from ' || fullName ; elsif (Vi_Auth_Sign = 'R') then li_cnt := 0; select count(1) into li_cnt From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_RECOMEN'; if (li_cnt > 0) then Select Sign_Remarks, emp_code, to_char(sign_date , 'dd-Mon-yyyy'), sign_status, ref_ser Into signremarks, empCode, sign_date, signStatus, refser From Obj_Sign_Trans Where Ref_Ser in ( 'E-TURP' , 'E-TOUR') And Ref_Id = Vi_Tran_Id And Role_Code__Sign = 'T_RECOMEN'; if (signStatus = 'S' and reportTo <> reportToAdmin and empCode is not null and length(trim(empCode)) > 0) then History_Descr := 'Awaiting approval from ' || fullName ; end if; end if; end if; end if; end if; -- Modified by Piyush on 20/04/2015[To show additional content in approver history in case of cancelled/approved from ERP].Start if (Vi_For_History = 'A' and Vi_Wrkflw_Status = 'ZZ' and vi_status in ('A' , 'C')) then History_Descr := case when History_Descr is null then '' else trim(History_Descr) || '.' end; if vi_status = 'A' then historyFormat := 'Approved in ERP'; else historyFormat := 'Cancelled in ERP'; end if; History_Descr := History_Descr || historyFormat; end if; -- Modified by Piyush on 20/04/2015[To show additional content in approver history in case of cancelled/approved from ERP].End end if; return History_Descr; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NOF_PUNCH_TOUR (AS_EMP_CODE CHAR,AS_PRD_CODE CHAR) return number is a_from_dt Date; a_diff_dt number(2); a_count number(2); a_tot_days number(2) := 0; begin select fr_date,(to_date-fr_date+1) into a_from_dt,a_diff_dt from period where code = AS_PRD_CODE; for i in 1..a_diff_dt loop select nvl(count(*),0) into a_count from attendance_day where emp_code = AS_EMP_CODE and attd_date = a_from_dt and (ddf_time_in_mm(out_time) - ddf_time_in_mm(in_time)) >= 240 and length(trim(out_time)) = 5; if (a_count <> 0) then a_tot_days := a_tot_days + 1; else select nvl(count(*),0) into a_count from tour where emp_code = AS_EMP_CODE and a_from_dt between date_from and date_to and status = 'A'; if (a_count <> 0) then a_tot_days := a_tot_days + 1; end if; end if; a_from_dt := a_from_dt + 1; end loop; return a_tot_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_SITEITEM1 (as_itemcode in char, as_tranid in char) return varchar2 is ls_itemser itemser.item_ser%type; ls_sitecode site.site_code%type; ll_count number(6,0) := 0; ls_retval varchar2(1) := '0'; begin begin select item_ser into ls_itemser from item where item_code = as_itemcode; exception when no_data_found then ls_itemser := '@@'; end; if instr('RM1 PM1 BD LPM LRM BDI',ltrim(rtrim(ls_itemser))) = 0 then return ls_retval ; end if; begin select site_code into ls_sitecode from distord_rcp where tran_id = as_tranid ; exception when no_data_found then ls_sitecode := '@@'; end; begin select count(1) into ll_count from siteitem where site_code = ls_sitecode and item_code = as_itemcode and qc_reqd='Y'; exception when no_data_found then ll_count := 0; end; if ll_count <> 1 then return '1'; end if; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SOITEM_STAT ON SORDITEM (ITEM_CODE, SITE_CODE, STATUS, STATUS_DATE, DUE_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STRG_INSTITUTE (minst_code char) return char is minst_descr varchar2(40); begin select institute into minst_descr from institute where inst_code = minst_code; return minst_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_SR_QTYRATE BEFORE insert or update ON SRETURNdet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; BEGIN if :new.CONV__RTUOM_STDUOM is null or :new.CONV__RTUOM_STDUOM = 0 then :new.CONV__RTUOM_STDUOM := 1; end if; if round(nvl(:new.quantity,0) * nvl(:new.conv__qty_stduom,0),3) <> round(nvl(:new.quantity__stduom,0),3) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] quantity [' || to_char(:new.quantity) || '] x conv__qty_stduom [' || to_char(:new.conv__qty_stduom) || '] not matching with quantity__stduom['||to_char(:new.quantity__stduom)|| ']' ); end if; if nvl(:new.rate,0) <> 0 and nvl(:new.RATE__STDUOM,0) =0 then :new.RATE__STDUOM := :new.rate ; end if; if round(nvl(:new.rate,0) * nvl(:new.CONV__RTUOM_STDUOM,1),4) <> round(nvl(:new.RATE__STDUOM,0),4) then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] rate [' || to_char(:new.rate) || '] x CONV__RTUOM_STDUOM [' || to_char(:new.CONV__RTUOM_STDUOM) || '] not matching with RATE__STDUOM['||to_char(:new.RATE__STDUOM)|| ']' ); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOT_SL_SRETURN ( as_tran_id_preturn in porcp.tran_id%type, as_item_code item.item_code%type, as_lot_sl stock.lot_sl%type ) return char is ls_site_code site.site_code%type; ls_supp_sour item.supp_sour%type; ls_lot_sl stock.lot_sl%type; ls_supp_code supplier.supp_code%type; ls_site_code_ch site.site_code%type; begin begin select supp_code,site_code into ls_supp_code , ls_site_code from porcp where tran_id = as_tran_id_preturn; exception when others then return 'ERRORDS000'; end; ls_site_code_ch := fn_get_channel_site(ls_supp_code,'S',ls_site_code); begin select supp_sour into ls_supp_sour from siteitem where site_code = ls_site_code_ch and item_code = as_item_code; exception when others then return 'ERRORDS000'; end; if trim(ls_supp_sour) = 'D' then ls_lot_sl := '1S'; else ls_lot_sl := as_lot_sl; end if; return ls_lot_sl; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_MAX_RATE (as_price_list in char, ad_tran_date in date, as_item_code in char) return number is mrate number(14,3); ls_type char(1); begin select max(rate) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083280 ON COSTALLOC_BAS_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_BUDGET_AMOUNT_PO (PURCORDER IN CHAR) RETURN NUMBER IS CHECKAMT NUMBER := 0; ACCTPRD CHAR(10); LSCOUNT NUMBER:= 0; ACCTCODE NUMBER:= 0; CCTRCODE NUMBER:= 0; SUM_DR_AMT NUMBER(14,3); SUM_PO_AMT NUMBER(14,3); BUDGETAMT NUMBER(14,3); finEntity char(10); siteCode char(5); siteCodeBudget char(5); siteBudgetId CHAR(10); budgetTrack CHAR(1); pordDate DATE; BEGIN BEGIN SELECT ACCT_PRD INTO ACCTPRD FROM PERIOD WHERE TRUNC(SYSDATE) BETWEEN FR_DATE AND TO_DATE; EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT:= 0; END; BEGIN SELECT site_code__dlv, ord_date INTO siteCode, pordDate FROM porder WHERE purc_order = PURCORDER; EXCEPTION WHEN NO_DATA_FOUND THEN siteCode:= ' '; END; BEGIN SELECT site_code__budget, budget_id INTO siteCodeBudget, siteBudgetId FROM site WHERE site_code = siteCode; EXCEPTION WHEN NO_DATA_FOUND THEN siteCodeBudget:= ' '; siteBudgetId:=' '; END; IF siteCodeBudget IS NOT NULL OR LENGTH(TRIM(siteCodeBudget)) > 0 THEN siteCode := siteCodeBudget; END IF; /*commented as fin_entity is not considered in finCommon.updateBudget BEGIN SELECT fin_entity INTO finEntity FROM site WHERE site_code = siteCode; EXCEPTION WHEN NO_DATA_FOUND THEN finEntity:= ' '; END; */ FOR X IN (SELECT ACCT_CODE__DR, CCTR_CODE__DR FROM PORDDET WHERE PURC_ORDER = PURCORDER) LOOP BEGIN SELECT budget_track INTO budgetTrack FROM accounts WHERE acct_code = X.ACCT_CODE__DR; EXCEPTION WHEN NO_DATA_FOUND THEN budgetTrack := null; END; if budgetTrack is null or length(trim(budgetTrack)) = 0 or budgetTrack = 'null' or budgetTrack = 'N' Then CHECKAMT := 0; ELSE BEGIN SELECT COUNT(*) INTO LSCOUNT FROM ACCTBUDGET WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE = X.CCTR_CODE__DR AND site_code = siteCode and budget_id = siteBudgetId and from_date <= pordDate and to_date >= pordDate; EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT:= 0; END; --if count is greater then only check IF LSCOUNT > 0 THEN --get budgetamount from acctbudget table BEGIN SELECT nvl(sum(BUDGET_AMT),0) INTO BUDGETAMT FROM ACCTBUDGET WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE= X.CCTR_CODE__DR AND site_code = siteCode AND budget_id = siteBudgetId AND from_date <= pordDate AND to_date >= pordDate; EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT:= 0; END; --get sum of dr_amt from acctbal table BEGIN SELECT nvl(SUM(dr_amt__base),0) INTO SUM_DR_AMT FROM acctbal WHERE ACCT_PRD = ACCTPRD AND ACCT_CODE = X.ACCT_CODE__DR AND CCTR_CODE= X.CCTR_CODE__DR AND prd_code IN (SELECT p.code FROM budgets b, period p WHERE pordDate BETWEEN b.from_date AND b.to_date AND b.site_code = siteCode AND b.budget_id = siteBudgetId AND b.acct_prd = ACCTPRD AND p.acct_prd = b.acct_prd AND p.fr_date >= b.from_date AND p.to_date <= b.to_date) ; EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT:= 0; END; --get sum of total amount from porddet table BEGIN SELECT nvl(SUM(TOT_AMT),0) INTO SUM_PO_AMT FROM PORDDET WHERE ACCT_CODE__DR = X.ACCT_CODE__DR AND CCTR_CODE__DR = X.CCTR_CODE__DR AND PURC_ORDER = PURCORDER; EXCEPTION WHEN NO_DATA_FOUND THEN CHECKAMT:= 0; END; --check sum of acctbal debit amount + sum of Po total amount if greater then budget amount IF (SUM_DR_AMT + SUM_PO_AMT) > BUDGETAMT then CHECKAMT:= 1; END IF; ELSE CHECKAMT:= 0; END IF;--end if budgets END IF;--end if for budget track END LOOP;--end loop RETURN CHECKAMT; END FN_CHK_BUDGET_AMOUNT_PO; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE PROC_MRPTABLEDATA (assitecode char,asduedatefr date, asduedateto date, asitemcdfr char,asitemcdto char) is begin --start main declare cursor currepot is select DISTINCT mps_order.item_code a ,mps_order.bom_code b from mps_order, siteitem, bomdet where siteitem.item_code = mps_order.item_code and siteitem.site_code = assitecode and siteitem.SUPP_SOUR ='M' and siteitem.bom_code is not null and siteitem.bom_code = bomdet.bom_code and bomdet.bom_code is not null and mps_order.due_date >= asduedatefr and mps_order.due_date <= asduedateto and mps_order.item_code>= asitemcdfr and mps_order.item_code <= asitemcdto; toddt date; itemcode char(10); bomcode char(10); newItemCode char(10); newBomCode char(10); newSiteCode char(10); AllBomItem nvarchar2(4000); Comaitems nvarchar2(4000); ll_itemCnt number(1); ll_mrpreporttemptabdata number; ll_itemImeCnt number(1); cursor siteitemdata is select item_code , bom_code , site_code from siteitem where bom_code is not null and site_code = assitecode and supp_sour = 'M' and item_code in (SELECT item_code FROM MRPbomItems); begin --Cursour Begin select sysdate into toddt from dual; select count(*) into ll_mrpreporttemptabdata from MRPTableData where site_code = assitecode; dbms_output.put_line('total data are delete from MRPTableData table::::::::::::::::: ' || ll_mrpreporttemptabdata ||'.'); if ll_mrpreporttemptabdata > 0 then delete from MRPbomItems ; dbms_output.put_line('MRPbomItems Deleted'); delete from MRPTableData where site_code = assitecode; dbms_output.put_line('MRPTableData Deleted'); end if ; open currepot; loop fetch currepot into itemcode,bomcode; exit when currepot%notfound; --checking data begin dbms_output.put_line('Calling Procedure with BomCode is ' || bomcode); proc_BOMITEM(bomcode,assitecode) ; begin open siteitemdata; loop fetch siteitemdata into newItemCode , newBomCode , newSiteCode; dbms_output.put_line('siteitemdata rowcount '||siteitemdata%ROWCOUNT); exit when siteitemdata%notfound; --checking data begin dbms_output.put_line('ST# '||trim(newSiteCode) ||' IT# '||trim(newItemCode)||' BC# '||trim(newBomcode)||' ITMpS# '||trim(itemcode)||' # '||to_char(toddt) || ' Y'); select count(item_code) into ll_itemCnt from MRPTableData where site_code = newSiteCode and item_code = newItemcode and bom_code =newBomcode and item_code__mps = itemcode; --Commented by Brijesh Soni For Change the Logic of Table if ll_itemCnt = 0 then /*Added by Brijesh Soni on 25.06.08 @ 15.45 For consider Intermediate Item For Y only */ select count(item_code) into ll_itemImeCnt from MRPTableData where site_code = newSiteCode and item_code = newItemcode and bom_code =newBomcode and consider_imd_items = 'Y'; --Commented by Brijesh Soni For Change the Logic of Table dbms_output.put_line('Checking For Intermidiate Item Code Count.' || ll_itemImeCnt); if ll_itemImeCnt = 0 then insert into MRPTableData(site_code,item_code,bom_code,rundate,item_code__mps,consider_items,consider_imd_items) values (newSiteCode,newItemcode,newBomcode,toddt,itemcode,'Y','Y'); dbms_output.put_line('Inserted consider_items :::: Y #### ~~~~~~~ Inserted consider Intermediate Item :::: Y ####.'); else insert into MRPTableData(site_code,item_code,bom_code,rundate,item_code__mps,consider_items,consider_imd_items) values (newSiteCode,newItemcode,newBomcode,toddt,itemcode,'Y','N'); dbms_output.put_line('Inserted consider items :::: Y #### ~~~~~~~ Inserted consider Intermediate Item :::: N ####.'); end if; /*Added by Brijesh Soni on 25.06.08 @ 15.45 For consider Intermediate Item For Y only*/ else dbms_output.put_line('Duplicate value from proc_MRPTableData for Y'); dbms_output.put_line('#############################################'); select count(item_code) into ll_itemCnt from MRPTableData where site_code = newSiteCode and item_code = newItemcode and bom_code =newBomcode and item_code__mps = itemcode; --Commented by Brijesh Soni For Change the Logic of Table if ll_itemCnt = 0 then insert into MRPTableData(site_code,item_code,bom_code,rundate,item_code__mps,consider_items,consider_imd_items) values(newSiteCode,newItemcode,newBomcode,toddt,itemcode,'N','N'); dbms_output.put_line('Inserted For N ####.'); else dbms_output.put_line('Inserted For N ####.'); end if; end if; end; end loop; close siteitemdata; dbms_output.put_line('siteitemdata Closed'); delete from MRPbomItems ; dbms_output.put_line('MRPbomItems Deleted'); end; end; end loop; --end loop close currepot; -- close select count(*) into ll_mrpreporttemptabdata from MRPTableData where site_code = assitecode; dbms_output.put_line('before commit the count of data are in MRPTableData table ::::::::::::::::: ' || ll_mrpreporttemptabdata ||'.'); commit; dbms_output.put_line('commited.'); exception when others then dbms_output.put_line('rollbacked.'); rollback; end; end; --eof main -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDITEM_ITEM_SITE ON SORDITEM (ITEM_CODE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDER_ORDER_DATE ON SORDER (ORDER_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LTA_SETTINGS (AS_EMP_CODE char,AS_PRD_CODE char,AS_CODE char) return number is a_days_year number(3); a_days_emp number(3); a_absent_days number(6,2); a_date_fr date; a_date_to date; a_amount perk_process.amount%type := 0; a_date_join employee.date_join%type; a_relieve_date employee.relieve_date%type; begin if (AS_CODE = 'ANKLWRK') then select b.fr_date,c.to_date,(c.to_date-b.fr_date+1) into a_date_fr,a_date_to,a_days_year from period a,period b,period c where a.code = AS_PRD_CODE and b.code = to_char(add_months(a.fr_date,-12),'YYYYMM') and c.code = to_char(a.fr_date - 1,'YYYYMM'); select date_join,relieve_date into a_date_join,a_relieve_date from employee where emp_code = AS_EMP_CODE; if (a_date_join > a_date_to) or (a_relieve_date < a_date_fr) then return a_amount; end if; if (a_date_join between a_date_fr and a_date_to) then a_date_fr := a_date_join; end if; if (a_relieve_date between a_date_fr and a_date_to) then a_date_to := a_relieve_date; end if; a_days_emp := (a_date_to - a_date_fr + 1); select nvl(sum(lop_days),0) into a_absent_days from attd_reg where emp_code = AS_EMP_CODE and attd_date between a_date_fr and a_date_to; select (amount*(a_days_emp / a_days_year)) into a_amount from ad_slabs where ad_code = 'LTA5' and to_date('01/' || substr(AS_PRD_CODE,5,2) || '/' || substr(AS_PRD_CODE,1,4),'dd/mm/yyyy') between eff_date and exp_date and a_absent_days between (min_base_amt*(a_days_emp / a_days_year)) and (max_base_amt*(a_days_emp / a_days_year)); a_amount := round(a_amount); end if; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TRAN_CURR_EXCH (as_ref_ser in char, as_ref_id in char) return varchar2 is ls_det varchar2(60); ls_curr varchar2(5); lc_exch number(17,6); begin select curr_code, exch_rate into ls_curr, lc_exch from gltrace where ref_ser = as_ref_ser and ref_id = as_ref_id and rownum = 1 order by tran_id; ls_det := 'Curr Code : '||ls_curr||' Exch rate: '||trim(to_char(lc_exch,'9999999999.999999')); return ls_det; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ADF_GETSHIFT_FR_WORK_SHIFT (as_empcode employee.emp_code%type, ad_date date) -- Rahul K Khanolkar -- 24-jul-02 -- -- Get shift from work_shift for emp_code and date between to and from date -- -- Returns shift if record found. -- Returns 'XXXXX' if record not found. return char is ls_shift varchar2(20); begin select shift into ls_shift from work_shift where to_date(ad_date,'dd-mon-yyyy') between from_dt and to_dt and emp_code=as_empcode and rownum=1; return ls_shift; exception when NO_DATA_FOUND then return 'XXXXX'; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE LOTSLPOPHELPPACKAGE AS FUNCTION getlotSlPophelpData (asOrderType in char, asOrderNo in char) RETURN LOTSLMASTERTABLE PIPELINED; END lotSlPophelpPackage; CREATE OR REPLACE PACKAGE BODY LOTSLPOPHELPPACKAGE AS FUNCTION getlotSlPophelpData (asOrderType in char, asOrderNo in char) RETURN LOTSLMASTERTABLE PIPELINED AS BEGIN IF asOrderType = 'P' THEN FOR x IN ( SELECT det.lot_sl,det.item_code item_code,item.descr item_descr,det.loc_code,det.lot_no,det.quantity FROM porcpdet det, item item , porcp rcp WHERE item.item_code = det.item_code and det.tran_id = rcp.tran_id and det.tran_id = asOrderNo and rcp.confirmed = 'Y' ) LOOP PIPE ROW (LOTSLMASTER(x.lot_sl,x.item_code,x.item_descr,x.loc_code,x.lot_no,x.quantity)); END LOOP; RETURN; END IF; IF asOrderType = 'R' THEN FOR x IN ( SELECT det.lot_sl,det.item_code,item.descr item_descr ,det.loc_code,det.lot_no,det.quantity from distord_iss iss,distord_issdet det,item item,distord_rcp drcp where iss.dist_order = drcp.dist_order and iss.tran_id = det.tran_id and det.item_code = item.item_code and drcp.tran_id = asOrderNo and drcp.confirmed = 'Y' ) LOOP PIPE ROW (LOTSLMASTER(x.lot_sl,x.item_code,x.item_descr,x.loc_code,x.lot_no,x.quantity)); END LOOP; RETURN; END IF; IF asOrderType = 'W' THEN FOR x IN ( SELECT det.lot_sl,det.item_code,item.descr item_descr ,det.loc_code,det.lot_no,det.quantity from workorder_iss iss,workorder_issdet det,item item,workorder_receipt wrcp where iss.work_order = wrcp.work_order and iss.tran_id = det.tran_id and det.item_code = item.item_code and wrcp.tran_id = asOrderNo and wrcp.confirmed = 'Y' ) LOOP PIPE ROW (LOTSLMASTER(x.lot_sl,x.item_code,x.item_descr,x.loc_code,x.lot_no,x.quantity)); END LOOP; RETURN; END IF; END; END LOTSLPOPHELPPACKAGE; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STOCK_RATE (as_site stock.site_code%type, as_item stock.item_code%type, as_loc stock.loc_code%type, as_lot stock.lot_no%type) return number is ll_rate number(14,7); begin select nvl(rate,0) into ll_rate from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and rownum = 1; return ll_rate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDS_BSRNO (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_str varchar2(200) ; ls_ch_no_det varchar2(50); ls_bank_cd_det varchar2(50); ls_token_no_det varchar2(50); ctr number(3); cursor c1 is select nvl(HANDOVER_CHNO,''), nvl(BANK_CODE__TAX,''),nvl(TOKEN_NO,'') from misc_payment where tran_id in ( select tran_id from misc_paydet where tran_ser = 'M-VOUC' and vouch_no = ls_vouch_no ) ; begin open c1; ctr := 0; ls_str := ' ' ; loop fetch c1 into ls_ch_no_det,ls_bank_cd_det,ls_token_no_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_ch_no_det)) > 0 then ls_ch_no_det := ','||ls_ch_no_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_bank_cd_det)) > 0 then ls_bank_cd_det := ','||ls_bank_cd_det ; end if ; end if ; if ctr > 0 then if length(rtrim(ls_token_no_det)) > 0 then ls_token_no_det := ','||ls_token_no_det ; end if ; end if ; ls_str := rtrim(ls_str)||ls_bank_cd_det; ctr := ctr + 1; end loop ; close c1; return ls_str ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_CUST_LOCALITY ON STRG_CUSTOMER (LOCALITY_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CUST_IN_ROUTE (AS_SLAES_PERS in char , AS_EVENT_DATE in date, AS_MTD in varchar2) RETURN VARCHAR2 IS AS_DR_COUNT NUMBER(3); ROUTES VARCHAR(1000); WEEK_DAY VARCHAR(500); PLAN_MEET NUMBER(6); ACTUAL_MEET NUMBER(6); CALL_BAL NUMBER(6); BEGIN IF AS_MTD = 'Y' then SELECT count(distinct(pe.strg_code)) into PLAN_MEET FROM TABLE(strgCodePophelp.getstrgCodePophelpData(AS_SLAES_PERS)) pe; ELSE SELECT count(distinct(pe.strg_code)) into PLAN_MEET FROM TABLE(strgCodePophelp.getstrgCodePophelpData(AS_SLAES_PERS)) pe where pe.route_id in ( SELECT DISTINCT(route_id) FROM STRG_MEET WHERE TO_DATE(EVENT_DATE) = TO_DATE(AS_EVENT_DATE) and sales_pers = AS_SLAES_PERS ); END IF; RETURN NVL(PLAN_MEET,0); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BANKTRAN_LOG_X ON BANKTRAN_LOG (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE OBJ_EMP_WISE_HIERARCHY_NEW AS OBJECT ( DIV VARCHAR2(20), TLM_HQ VARCHAR2(40) , SLM_HQ VARCHAR2(40) , FLM_HQ VARCHAR2(40) , SO_HQ VARCHAR2(40) , SO_DESG_CODE VARCHAR2(25), EMP_CODE CHAR(10), DATE_JOIN DATE , WITH_HELD VARCHAR2(10) , RELIEVE_DATE DATE, ISR_NAME VARCHAR2(90), TLM_CODE CHAR(10), SLM_CODE CHAR(10), FLM_CODE CHAR(10) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX STRG_CUSTOMER_STAN_SC_CODE ON STRG_CUSTOMER (STAN_CODE, SC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SCHEME_HISTORY_X ON SCHEME_HISTORY (SITE_CODE, ITEM_CODE, LOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_CONTENT_TYPE ( content_type VARCHAR2 ) RETURN VARCHAR2 IS con_type VARCHAR2(100); BEGIN CASE content_type WHEN 'I' THEN con_type := 'Image'; WHEN 'P' THEN con_type := 'PDF'; WHEN 'Z' THEN con_type := 'ZIP'; ELSE con_type := 'VIDEO'; END CASE; RETURN TRIM(con_type); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WORK_ORDER_TRAN_DATE_SITE ON WORKORDER_ISS (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 10485760 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PORDD_PROJCODE BEFORE insert or update ON porddet referencing old as old new as new FOR EACH ROW declare ll_count number(3) := 0; ls_projcode char(10); BEGIN begin if :new.proj_code is null or length(trim(:new.proj_code)) = 0 then select proj_code into :new.proj_code from porder where purc_order = :new.purc_order; end if; end; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_FUNDTRANSFR_DET ON FUNDTRANSFER_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GENCODE_DESC ( as_fld_name in char , as_mod_name in char , as_fld_value in char , as_descr char ) return char is ls_retval varchar(120) ; begin select decode(as_descr, 'D', descr, sh_descr) into ls_retval from gencodes where fld_name = as_fld_name and fld_value = as_fld_value and ( mod_name = as_mod_name or mod_name ='X' ) ; return ls_retval ; exception when too_many_rows then return ' ' ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STK_WEIGHING_DET_X ON STK_WEIGHING_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEM_DESCR_PRETURN (as_tran_id char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.quantity ,b.lot_no from item a ,porcpdet b,porcp c where c.tran_id=b.tran_id and b.tran_id = as_tran_id and a.item_code = b.item_code and c.tran_ser='P-RET'; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''||' Item Description '||''||''||'Quantity'||''||''||'Return lot'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_SITE_DESCR ( p_site_code IN VARCHAR2 -- (1.SITE_CODE) ) RETURN VARCHAR2 IS v_site_desc VARCHAR2(100); v_return_json VARCHAR2(4000); BEGIN IF p_site_code IS NULL THEN v_return_json := '{data:{}}'; RETURN v_return_json; END IF; -- Fetch site description BEGIN SELECT descr INTO v_site_desc FROM site WHERE site_code = p_site_code AND ROWNUM = 1; EXCEPTION WHEN NO_DATA_FOUND THEN v_site_desc := NULL; WHEN OTHERS THEN -- Log error if needed v_site_desc := NULL; END; v_return_json := '{' || 'data:{' || 'SITE_DESCR:' || NVL(v_site_desc, '') || '' || '}}'; RETURN v_return_json; EXCEPTION WHEN OTHERS THEN v_return_json := '{data:{}}'; RETURN v_return_json; END GET_SITE_DESCR; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX UK_MINRATE_HIST ON MIN_RATE_HISTORY (DOC_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SUNDRY_CITY (LSUNDRY_TYPE IN CHAR, LSUNDRY_CODE IN CHAR) RETURN CHAR IS LS_CITY CHAR(60); BEGIN IF LSUNDRY_TYPE ='O' THEN LS_CITY :=' ' ; ELSIF LSUNDRY_TYPE='T' THEN select city into LS_CITY from transporter where tran_code =LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='B' THEN select city into LS_CITY from bank where bank_code= LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='X' THEN select city into LS_CITY from tax_authority where tauth_code= LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='E' THEN select cur_city into LS_CITY from employee where emp_code=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='P' THEN select city into LS_CITY from sales_pers where sales_pers=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE= 'S' THEN select city into LS_CITY from supplier where supp_code=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE ='C' THEN select city into LS_CITY from customer where cust_code=LSUNDRY_CODE; ELSIF LSUNDRY_TYPE='L' THEN select city into LS_CITY from loanparty where party_code=LSUNDRY_CODE; END IF; if LS_CITY is null then LS_CITY:= ' '; end if; RETURN trim(LS_CITY); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IDX_REF_ID ON GST_DATA_HDR (REF_ID, REF_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PAYDET_COMM (as_refid varchar2 , as_type varchar2) return varchar2 is ls_return varchar2(1000) ; ls_tran_id varchar2(100) ; ls_cancid varchar2(100) ; ldt_date date ; ld_amt decimal(14,3); ls_tran_id1 varchar2(50); ldt_date1 varchar2(200); ld_amt1 varchar2(200); cursor cur1 is select a.tran_id,b.tran_date,a.pay_amt from misc_paydet a,misc_payment b where a.tran_id =b.tran_id and a.tran_ser in ('M-VOUC','VOUCH','P-VOUC','DRNPAY','CRNPAY','CRNINV','P-IBCA','P-IBC1','P-IBC2', 'P-IBC3','P-IBC4','P-IBC5','P-IBC6','P-IBC7','P-IBC8','P-IBC9','RCVCN','RCVCN1', 'RCVCN2','RCVCN3','RCVCN4','RCVCN5') and substr(a.vouch_no,1,10) in ( as_refid ) ---- and instr(as_refid,substr(a.vouch_no,1,10) )>0 and b.confirmed = 'Y' and a.tran_id not in (select c.payment_no from misc_payment_canc c where c.confirmed='Y' and c.payment_no =a.tran_id ); begin open cur1 ; loop fetch cur1 into ls_tran_id,ldt_date,ld_amt ; exit when cur1%notfound; ls_tran_id1 := ls_tran_id1|| ls_tran_id||' |' ; ldt_date1 := ldt_date1||to_char(ldt_date)||' |'; ld_amt1 := ld_amt1||to_char(ld_amt)||' |'; end loop ; close cur1; if as_type ='T' then ls_return := ls_tran_id1 ; elsif as_type='D' then ls_return := to_char(ldt_Date1) ; elsif as_type='A' then ls_return := to_char(ld_amt1) ; end if ; IF ls_return IS NULL THEN ls_return := ' '; END IF ; return ls_return ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REF_SER_WISE_DATA ( ls_ref_ser char, ls_tran_id char, column_name char) RETURN VARCHAR is ls_column_value VARCHAR(100); begin if ls_ref_ser = 'E-PAY' then if column_name = 'SUNDRY_CODE' then select sundry_code into ls_column_value from payment_exp where tran_id = ls_tran_id; elsif column_name = 'SUNDRY_TYPE' then select sundry_type into ls_column_value from payment_exp where tran_id = ls_tran_id; end if; elsif ls_ref_ser = 'M-PAY' then if column_name = 'SUNDRY_CODE' then select sundry_code into ls_column_value from misc_payment where tran_id = ls_tran_id; elsif column_name = 'SUNDRY_TYPE' then select sundry_type into ls_column_value from misc_payment where tran_id = ls_tran_id; end if; end if; if ls_column_value is null then ls_column_value := ''; end if; return ls_column_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PDCPAY_REFNO BEFORE INSERT or UPDATE OF ref_no ON PDC_GIVEN referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECRSL_OFFER_ID ON RECRSL (OFFER_LETTER_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE LOTSLMASTERTABLE AS TABLE OF LOTSLMASTER; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_WORDER (ITEMCODE IN CHAR,LOCCODE IN CHAR) RETURN CHAR IS MTAXCHAP CHAR(10); MFLAG CHAR(1); MLOCCODE CHAR(10); BEGIN SELECT TAX_CHAP INTO MTAXCHAP FROM ITEM WHERE ITEM_CODE =ITEMCODE; IF MTAXCHAP = 'EXEX' THEN SELECT LOC_GROUP INTO MLOCCODE from location WHERE LOC_CODE=LOCCODE ; IF RTRIM(MLOCCODE) NOT IN ('EXEX') THEN RETURN '1'; ELSE RETURN '0'; END IF; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUPPITEM (as_purcorder in char, as_lineno in char, as_type in char) return varchar2 is ls_suppcode supplier.supp_code%type; ls_itemcode item.item_code%type; ls_retval varchar2(250); ll_count number := 0; begin begin select supp_code into ls_suppcode from porder where purc_order = as_purcorder; select item_code into ls_itemcode from porddet where purc_order = as_purcorder and line_no = as_lineno; select count(1) into ll_count from supplieritem where supp_code = ls_suppcode and item_code = ls_itemcode ; exception when no_data_found then ll_count := 0; when others then ll_count := 0; end; if ll_count > 0 then select case when as_type = 'C' then supplieritem.item_code__ref else case when supplieritem.descr is null then ltrim(rtrim(item.descr)) else supplieritem.descr end end into ls_retval from supplieritem,item where supplieritem.item_code=item.item_code and supplieritem.supp_code = ls_suppcode and supplieritem.item_code = ls_itemcode ; else select case when as_type = 'C' then item.item_code else ltrim(rtrim(item.descr)) end as description into ls_retval from item where item_code = ls_itemcode; end if; dbms_output.put_line(ls_retval); return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_WORKCNTR (as_workorder in char) return char is ls_retval char(10); begin select work_ctr into ls_retval from worder_route where work_order = as_workorder and rownum = 1; return ls_retval ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE OBJ_DUPLICATE is object (line_no number(3,0),no_art NUMBER(5,0),rowno number(5,0)); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_PROV_IT_COMP (AS_EMP_CODE char,AS_ACCT_PRD char,AS_TYPE char) return char is a_amount payarr_det.amount%type; a_ret_value varchar2(30); begin if (AS_TYPE = 'TD_AMT') then select sum(b.amount) into a_amount from period a,payarr_det b where a.acct_prd = AS_ACCT_PRD and b.prd_code = a.code and b.emp_code = AS_EMP_CODE and b.ad_code = 'ITX'; if (a_amount is null) then a_amount := 0; end if; a_ret_value := to_char(a_amount); elsif (AS_TYPE = 'TD_TOPRD') then select to_char(max(a.to_date),'FMMONTH ''FMYY') into a_ret_value from period a,payroll b where a.acct_prd = AS_ACCT_PRD and b.prd_code = a.code and b.emp_code = AS_EMP_CODE and b.voucher_no is not null and b.voucher_no != 'PAYROLL'; if (a_ret_value is null) then select to_char(fr_date,'FMMONTH ''FMYY') into a_ret_value from acctprd where code = AS_ACCT_PRD; end if; elsif (AS_TYPE = 'TTBD_FRPRD') then select to_char(min(a.fr_date),'FMMONTH ''FMYY') into a_ret_value from period a where (a.acct_prd = AS_ACCT_PRD and a.code > (select max(b.code) from period b,payroll c where b.acct_prd = AS_ACCT_PRD and c.prd_code = b.code and c.emp_code = AS_EMP_CODE and c.voucher_no is not null and c.voucher_no != 'PAYROLL')) or (a.code = (select min(d.code) from period d where d.acct_prd = AS_ACCT_PRD and not exists ( select b.code from period b,payroll c where b.acct_prd = d.acct_prd and c.prd_code = b.code and c.emp_code = AS_EMP_CODE and c.voucher_no is not null and c.voucher_no != 'PAYROLL'))); if (a_ret_value is null) then select to_char(to_date,'FMMONTH ''FMYY') into a_ret_value from acctprd where code = AS_ACCT_PRD; end if; end if; return a_ret_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE COLON_RESULT_TAB AS TABLE OF VARCHAR2(4000); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_RD_DATE_INWORD (as_permit distord_iss.rd_permit_no%type,flag char) RETURN VARCHAR2 IS ls_lr_day VARCHAR2(30); num_to_word VARCHAR2(50); BEGIN if flag ='D' then select TO_CHAR(MAX(lr_date),'DD') into ls_lr_day from distord_iss where rd_permit_no =as_permit ; select to_char(to_date(ls_lr_day,'J'),'JSP') into num_to_word from dual; elsif flag ='M' then select TO_CHAR(MAX(lr_date),'MON') into num_to_word from distord_iss where rd_permit_no =as_permit ; elsif flag ='Y' then select TO_CHAR(MAX(lr_date),'YYYY') into ls_lr_day from distord_iss where rd_permit_no =as_permit ; select to_char(to_date(ls_lr_day,'J'),'JSP') into num_to_word from dual; end if; RETURN num_to_word; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECEIVABLES_ADJ_REF_SER_ADJ ON RECEIVABLES_ADJ (REF_SER_ADJ, REF_NO_ADJ) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PROFILE_ID (usercode users.code%type,usersitecode user_site.site_code%type) return varchar2 is vuser_profile_id varchar2(20); begin select user_site.profile_id into vuser_profile_id from USER_SITE, USERS where users.code = usercode AND user_site.site_code = usersitecode AND users.code =user_site.user_id; if vuser_profile_id is not null then select user_site.profile_id into vuser_profile_id from user_site,users where users.code = usercode AND user_site.site_code = usersitecode AND users.code =user_site.user_id; else select users.profile_id into vuser_profile_id from users where users.code = usercode; end if; return vuser_profile_id; exception when no_data_found then select users.profile_id into vuser_profile_id from users where users.code = usercode AND users.usr_lev in (0,1); return vuser_profile_id; when others then vuser_profile_id := 'NOMARF'; return vuser_profile_id; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_FEED_BK_TIME (req_id1 IN varchar2) return number is act_time number(15,2); begin declare dec_stdtime number(15,6); int_stdtime number(15,6); begin select sum(total_time_spend) into act_time from ser_req_feedbkdtl where req_id=req_id1; dec_stdtime := to_number(substr(to_char(act_time),1,2)); int_stdtime := ((act_time - dec_stdtime)*100); while (int_stdtime > 59) loop dec_stdtime := dec_stdtime + 1; int_stdtime := int_stdtime - 60; end loop; dec_stdtime := dec_stdtime + (int_stdtime / 100); act_time := round(dec_stdtime,2); return (act_time); end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_INIT_X ON PROJ_INIT (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESPWORKORDER_LOTNO ( as_lotno despatchdet.lot_no%type, as_itemcd despatchdet.item_code%type, as_flag char) return varchar2 is as_workorder workorder.work_order%type; as_site workorder.site_code%type; begin select work_order,site_code into as_workorder,as_site from workorder where lot_no=as_lotno and item_code =as_itemcd; if as_flag ='W' then return as_workorder; elsif as_flag ='S' then return as_site; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_FIN_SCHEME_PERC (as_rate in number, as_qty_stduom in number, as_fin_entity in char ) return number is lc_amount number(14,3); lc_sch_amt number(14,3); begin begin select sch_amt into lc_sch_amt from fin_scheme where fin_scheme = as_fin_entity; lc_amount := (as_rate * as_qty_stduom)* lc_sch_amt/100; exception when no_data_found then lc_amount := 0 ; end; return lc_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EMP_ONBOARD_ATTACH_CNT ( AS_TRANID char, AS_FIELD_NAME Char) RETURN NUMBER IS LS_ATTACH_CNT NUMBER(14,3); LS_REF_ID VARCHAR2(100); BEGIN LS_REF_ID := AS_TRANID||'~'||AS_FIELD_NAME; SELECT COUNT(*) INTO LS_ATTACH_CNT FROM DOC_TRANSACTION_LINK WHERE REF_ID = LS_REF_ID AND TRIM(REF_SER) = 'EOB'; RETURN LS_ATTACH_CNT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_DIST_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code into lsite_code from distord_iss where tran_id=as_tran_id ; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_REF_SER_REF_NO ON RECEIVABLES_TRACE (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAVEL_MODE_MASTER_X ON TRAVEL_MODE_MASTER (TRAVEL_MODE_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION VALIDATE_GST (GST_NO in varchar2) RETURN char is ls_gst_valid char(1); inputed varchar2(30) ; output boolean; BEGIN output := false; ls_gst_valid:='0'; if length(trim(GST_NO)) <> 15 then output := false; else output := true; end if; if(TRIM(GST_NO)='UNREGISTERED') then ls_gst_valid:='0'; else if (output) then inputed := upper(GST_NO); output := REGEXP_LIKE(inputed , '([0-9]){2}([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}([0-9]){1}([a-zA-Z1-9]){1}([a-zA-Z0-9]){1}') ; if(output) then ls_gst_valid:='0'; else ls_gst_valid:='1'; end if ; else ls_gst_valid:='1'; end if; --ls_gst_valid:='1'; //commented by pankesh due to worng define variable end if; RETURN LS_GST_VALID; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SPON_REQ_PLAN_X ON STRG_SPON_REQ_PLAN (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_LOAN_INSTAL (AS_LOAN_NO char,AS_PRD_CODE char,AS_LAST_PRDCODE char) return number is cursor c1 is select no_inst,amount,no_inst_ded from loans_schedule where loan_no = AS_LOAN_NO and (no_inst <> no_inst_ded or no_inst is null) order by line_no; a_amount loans_schedule.amount%type := 0; a_start_reco loans.start_reco%type; a_count number(3) := 0; a_count1 number(3) := 0; begin select start_reco into a_start_reco from loans where loan_no = AS_LOAN_NO; if (AS_PRD_CODE < to_char(a_start_reco,'YYYYMM')) then a_amount := 0; return a_amount; end if; if (AS_LAST_PRDCODE <= to_char(a_start_reco,'YYYYMM')) then select count(*) into a_count from period where code >= to_char(a_start_reco,'YYYYMM') AND CODE <= AS_PRD_CODE; else select count(*) into a_count from period where code > AS_LAST_PRDCODE AND CODE <= AS_PRD_CODE; end if; for i in c1 loop a_count1 := a_count1 + (i.no_inst - i.no_inst_ded); if (i.no_inst is null) then a_amount := i.amount; exit; else if (a_count <= a_count1) then a_amount := i.amount; exit; end if; end if; end loop; if (a_amount = 0) then select a.amount into a_amount from loans_schedule a where a.loan_no = AS_LOAN_NO and a.line_no = (select max(b.line_no) from loans_schedule b where b.loan_no = a.loan_no); end if; return a_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_JOURNAL_CHK BEFORE INSERT OR UPDATE OF confirmed ON journal referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_detcount number(3) := 0; lc_hdrdr number(17,3) := 0; lc_hdrcr number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_detcount from jourdet where tran_id = :new.tran_id; exception when others then ll_detcount:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'JOUR' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; begin --select dr_amt, cr_amt into lc_hdrdr, lc_hdrcr from journal --where tran_id = :new.tran_id; select sum(case when drcr_flag = 'D' then amount else 0 end), sum(case when drcr_flag = 'C' then amount else 0 end) into lc_hdrdr, lc_hdrcr from jourdet where tran_id = :new.tran_id; exception when others then lc_hdrdr := 0; lc_hdrcr := 0; end; if ll_glcount = 0 and ll_detcount > 0 and (lc_hdrdr <> 0 or lc_hdrcr <> 0)then raise_application_error( -20601, 'GL not posted but [' || to_char(ll_detcount) || '] detail rows exists' ); end if; -- 2. check header DR, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'JOUR' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdrdr <> lc_gldr or lc_hdrcr <> lc_glcr then raise_application_error( -20601, 'Debit or credit mismatch between Journal header and gltrace JVH DR [' || to_char(lc_hdrdr) || '] GL DR [' || to_char(lc_gldr) || '] JV CR [' || to_char(lc_hdrcr) || ']GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LOAN_INTEREST (as_loan_no CHAR, as_prd_code CHAR) return NUMBER is lc_tot_int NUMBER(14,3); lc_tot_rec NUMBER(14,3); ld_dates DATE; ld_frdate DATE; ld_todate DATE; ld_fr_date DATE; ld_to_date DATE; BEGIN BEGIN select payrolldet.amount into lc_tot_int from payrolldet, payroll where payrolldet.prd_code = as_prd_code and payrolldet.ref_type IN ('N', 'D') and payrolldet.ref_no = as_loan_no and payroll.prd_code =payrolldet.prd_code and payroll.emp_code = payrolldet. emp_code and payroll.voucher_no is not null; EXCEPTION WHEN no_data_found THEN select payrolldet.amount into lc_tot_rec from payrolldet, payroll where payrolldet.prd_code = as_prd_code and payrolldet.ref_type = 'L' and payrolldet.ref_no = as_loan_no and payroll.prd_code = payrolldet.prd_code and payroll.emp_code = payrolldet. emp_code and payroll.voucher_no is not null ; if lc_tot_int is null then lc_tot_int := 0.00 ; end if; if lc_tot_rec <> 0 and (as_prd_code = '200102' or as_prd_code = '200103' or as_prd_code = '200104' ) then select fr_date, to_date into ld_frdate, ld_todate from period where code = as_prd_code; ld_dates := ld_frdate - 1 ; ld_fr_date := ld_dates; ld_to_date := ld_todate; select nvl(interest_amt,0.00) into lc_tot_int from loans_interest where loan_no = as_loan_no and date__from between ld_fr_date and ld_to_date ; if lc_tot_int is null then lc_tot_int := 0.00 ; end if; end if; END; return lc_tot_int; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SMKT_MIN_IN_TIME (V_MINUTE IN NUMBER) RETURN VARCHAR2 AS V_CONVERT VARCHAR2(8); BEGIN IF V_MINUTE IS NOT NULL THEN V_CONVERT := LPAD(TRUNC(V_MINUTE/60),2,0)||':'||LPAD(MOD(V_MINUTE,60),2,0); V_CONVERT := TO_CHAR(TO_TIMESTAMP(V_CONVERT,'HH24:MI'),'HH12:MI AM'); ELSE V_CONVERT := NULL; END IF; RETURN V_CONVERT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ADV_CR_TERM (as_cust_code__bil char) return number is ls_return number(1); as_cust_cr_term char(5); as_adv_cr_term char (5); begin select trim(cr_term) into as_cust_cr_term from customer where cust_code=as_cust_code__bil; select trim(var_value) into as_adv_cr_term from disparm where var_name='ADVANCE_CR_TERM' and prd_code='999999'; if as_cust_cr_term = as_adv_cr_term then ls_return := 1; else ls_return := 0; end if; return ls_return ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX CUST_STOCK_CUSTCODE_TRANID ON CUST_STOCK (CUST_CODE, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 1048576 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOS_CODE5 (as_site_code in char , as_item_ser in char , as_poolcode_5 in char , as_prd_code in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(POS_CODE),0) into no_of_fso FROM ORG_STRUCTURE WHERE ACTIVE = 'Y' AND POOL_CODE IN ( SELECT POOL_CODE FROM ORG_STRUCTURE WHERE POS_CODE IN ( SELECT ORG_CUST.POS_CODE FROM INVOICE, INVOICE_TRACE IT, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, ITEM WHERE INVOICE.INVOICE_ID=IT.INVOICE_ID AND INVOICE.CUST_CODE=ORG_CUST.CUST_CODE AND IT.ITEM_CODE=ITEM.ITEM_CODE AND ORG_CUST.TABLE_NO = ITEM.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND INVOICE.CONFIRMED='Y' AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEM.ITEM_TYPE = 'FGD' AND INVOICE.site_code = as_site_code AND ITEM.ITEM_SER = as_item_ser AND LEVEL_5.POOL_CODE = as_poolcode_5 AND TO_CHAR(INVOICE.TRAN_DATE,'YYYYMM') = as_prd_code UNION SELECT A.POS_CODE FROM ( SELECT ORG_CUST.POS_CODE,LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND LEVEL_5.POOL_CODE = as_poolcode_5 ) A, SALES_BUDGET SB,ITEM,GENCODES WHERE A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND A.ITEM_SER=ITEM.ITEM_SER AND SB.ITEM_CODE=ITEM.ITEM_CODE AND GENCODES.FLD_VALUE = TRIM(ITEM.GRP_CODE) AND GENCODES.FLD_NAME='GRP_CODE' AND GENCODES.MOD_NAME='W_ITEM' AND ITEM.ITEM_TYPE = 'FGD' AND SB.SITE_CODE__SALES = as_site_code AND SB.PRD_CODE = as_prd_code )); return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOS_CODE2 (as_site_code in char , as_item_ser in char , as_poolcode_2 in char , as_prd_code in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(POS_CODE),0) into no_of_fso FROM ORG_STRUCTURE WHERE ACTIVE='Y' AND POOL_CODE IN ( SELECT POOL_CODE FROM ORG_STRUCTURE WHERE POS_CODE IN ( SELECT ORG_CUST.POS_CODE FROM INVOICE, INVOICE_TRACE IT, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, ITEM WHERE INVOICE.INVOICE_ID=IT.INVOICE_ID AND INVOICE.CUST_CODE=ORG_CUST.CUST_CODE AND IT.ITEM_CODE=ITEM.ITEM_CODE AND ORG_CUST.TABLE_NO = ITEM.ITEM_SER AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND INVOICE.CONFIRMED='Y' AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEM.ITEM_TYPE = 'FGD' AND INVOICE.site_code = as_site_code AND ITEM.ITEM_SER = as_item_ser AND LEVEL_2.POOL_CODE = as_poolcode_2 AND TO_CHAR(INVOICE.TRAN_DATE,'YYYYMM') = as_prd_code UNION SELECT A.POS_CODE FROM ( SELECT ORG_CUST.POS_CODE,LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND LEVEL_2.POOL_CODE = as_poolcode_2 ) A, SALES_BUDGET SB,ITEM,GENCODES WHERE A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND A.ITEM_SER=ITEM.ITEM_SER AND SB.ITEM_CODE=ITEM.ITEM_CODE AND GENCODES.FLD_VALUE = TRIM(ITEM.GRP_CODE) AND GENCODES.FLD_NAME='GRP_CODE' AND GENCODES.MOD_NAME='W_ITEM' AND ITEM.ITEM_TYPE = 'FGD' AND SB.SITE_CODE__SALES = as_site_code AND SB.PRD_CODE = as_prd_code )); return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOS_CODE1 (as_site_code in char , as_item_ser in char , as_poolcode_1 in char , as_prd_code in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(POS_CODE),0) into no_of_fso FROM ORG_STRUCTURE WHERE ACTIVE='Y' AND POOL_CODE IN ( SELECT POOL_CODE FROM ORG_STRUCTURE WHERE POS_CODE IN ( SELECT ORG_CUST.POS_CODE FROM INVOICE, INVOICE_TRACE IT, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, ITEM WHERE INVOICE.INVOICE_ID=IT.INVOICE_ID AND INVOICE.CUST_CODE=ORG_CUST.CUST_CODE AND IT.ITEM_CODE=ITEM.ITEM_CODE AND ORG_CUST.TABLE_NO = ITEM.ITEM_SER AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND INVOICE.CONFIRMED='Y' AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEM.ITEM_TYPE = 'FGD' AND INVOICE.site_code = as_site_code AND ITEM.ITEM_SER = as_item_ser AND LEVEL_1.POOL_CODE = as_poolcode_1 AND TO_CHAR(INVOICE.TRAN_DATE,'YYYYMM') = as_prd_code UNION SELECT A.POS_CODE FROM ( SELECT ORG_CUST.POS_CODE,LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND LEVEL_1.POOL_CODE = as_poolcode_1 ) A, SALES_BUDGET SB,ITEM,GENCODES WHERE A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND A.ITEM_SER=ITEM.ITEM_SER AND SB.ITEM_CODE=ITEM.ITEM_CODE AND GENCODES.FLD_VALUE = TRIM(ITEM.GRP_CODE) AND GENCODES.FLD_NAME='GRP_CODE' AND GENCODES.MOD_NAME='W_ITEM' AND ITEM.ITEM_TYPE = 'FGD' AND SB.SITE_CODE__SALES = as_site_code AND SB.PRD_CODE = as_prd_code )); return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOS_CODE4 (as_site_code in char , as_item_ser in char , as_poolcode_4 in char , as_prd_code in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(POS_CODE),0) into no_of_fso FROM ORG_STRUCTURE WHERE ACTIVE = 'Y' AND POOL_CODE IN ( SELECT POOL_CODE FROM ORG_STRUCTURE WHERE POS_CODE IN ( SELECT ORG_CUST.POS_CODE FROM INVOICE, INVOICE_TRACE IT, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, ITEM WHERE INVOICE.INVOICE_ID=IT.INVOICE_ID AND INVOICE.CUST_CODE=ORG_CUST.CUST_CODE AND IT.ITEM_CODE=ITEM.ITEM_CODE AND ORG_CUST.TABLE_NO = ITEM.ITEM_SER AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND INVOICE.CONFIRMED='Y' AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEM.ITEM_TYPE = 'FGD' AND INVOICE.site_code = as_site_code AND ITEM.ITEM_SER = as_item_ser AND LEVEL_4.POOL_CODE = as_poolcode_4 AND TO_CHAR(INVOICE.TRAN_DATE,'YYYYMM') = as_prd_code UNION SELECT A.POS_CODE FROM ( SELECT ORG_CUST.POS_CODE,LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND LEVEL_4.POOL_CODE = as_poolcode_4 ) A, SALES_BUDGET SB,ITEM,GENCODES WHERE A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND A.ITEM_SER=ITEM.ITEM_SER AND SB.ITEM_CODE=ITEM.ITEM_CODE AND GENCODES.FLD_VALUE = TRIM(ITEM.GRP_CODE) AND GENCODES.FLD_NAME='GRP_CODE' AND GENCODES.MOD_NAME='W_ITEM' AND ITEM.ITEM_TYPE = 'FGD' AND SB.SITE_CODE__SALES = as_site_code AND SB.PRD_CODE = as_prd_code )); return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPOS_CODE3 (as_site_code in char , as_item_ser in char , as_poolcode_3 in char , as_prd_code in char) return number is no_of_fso number(5); begin SELECT NVL(COUNT(POS_CODE),0) into no_of_fso FROM ORG_STRUCTURE WHERE ACTIVE = 'Y' AND POOL_CODE IN ( SELECT POOL_CODE FROM ORG_STRUCTURE WHERE POS_CODE IN ( SELECT ORG_CUST.POS_CODE FROM INVOICE, INVOICE_TRACE IT, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, ITEM WHERE INVOICE.INVOICE_ID=IT.INVOICE_ID AND INVOICE.CUST_CODE=ORG_CUST.CUST_CODE AND IT.ITEM_CODE=ITEM.ITEM_CODE AND ORG_CUST.TABLE_NO = ITEM.ITEM_SER AND LEVEL_5.POS_CODE__REPTO= LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND INVOICE.CONFIRMED='Y' AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEM.ITEM_TYPE = 'FGD' AND INVOICE.site_code = as_site_code AND ITEM.ITEM_SER = as_item_ser AND LEVEL_3.POOL_CODE = as_poolcode_3 AND TO_CHAR(INVOICE.TRAN_DATE,'YYYYMM') = as_prd_code UNION SELECT A.POS_CODE FROM ( SELECT ORG_CUST.POS_CODE,LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND ITEMSER.ITEM_SER = as_item_ser AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND LEVEL_3.POOL_CODE = as_poolcode_3 ) A, SALES_BUDGET SB,ITEM,GENCODES WHERE A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER AND A.ITEM_SER=ITEM.ITEM_SER AND SB.ITEM_CODE=ITEM.ITEM_CODE AND GENCODES.FLD_VALUE = TRIM(ITEM.GRP_CODE) AND GENCODES.FLD_NAME='GRP_CODE' AND GENCODES.MOD_NAME='W_ITEM' AND ITEM.ITEM_TYPE = 'FGD' AND SB.SITE_CODE__SALES = as_site_code AND SB.PRD_CODE = as_prd_code )); return no_of_fso; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_OTIME (a_emp_code char,a_prd_code char) return number is cursor c1 is select ot_date,ot_hours from empotime where prd_code = a_prd_code and emp_code = a_emp_code and status = 'A'; b_emp_site employee.emp_site%type; b_grade employee.grade%type; b_count number := 0; b_amount number := 0; b_total number := 0; begin select emp_site,grade into b_emp_site,b_grade from employee where emp_code = a_emp_code; select count(*) into b_count from grade_site_ot where grade_code = b_grade and site_code = b_emp_site; if (b_count = 0) then return b_total; end if; for i in c1 loop select nvl(sum(case when ad_code='BASDR' then (amount * 30) else amount end),0) into b_amount from employee_ad where emp_code = a_emp_code and ad_code in ('BAS','BASDR','DA','BASM') and i.ot_date between eff_date and exp_date; b_total := b_total + (((b_amount / 30) / 8) * i.ot_hours); end loop; b_total := round(b_total,2); return b_total; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX NCL_STRG_QUALIFICATION ON NCL_STRG_QUALIFICATION (SC_CODE, QLF_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CHECKLIST_HISTORY_CHKL_CD ON CHECKLIST_HISTORY (CHKLIST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PROJ_DESCR (as_po_order porder.purc_order%type,flag in char ) return varchar2 is ls_proj_code varchar2(200) ; begin if upper(trim(flag)) = 'A' then SELECT PROJECT.PROJ_CODE into ls_proj_code FROM PORDER,PROJECT WHERE PORDER.PROJ_CODE=PROJECT.PROJ_CODE AND porder.purc_order=as_po_order; ELSIF upper(trim(flag)) = 'B' then SELECT PROJECT.DESCR into ls_proj_code FROM PORDER,PROJECT WHERE PORDER.PROJ_CODE=PROJECT.PROJ_CODE AND porder.purc_order=as_po_order; END IF; IF ls_proj_code IS NULL THEN ls_proj_code :=''; END IF; RETURN ls_proj_code; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BUDGET_ALLOC_TRAN_DATE_SITE ON BUDGET_ALLOC (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX APPRAISAL_SPEC_DESCR ON APPRAISAL_SPEC (SPEC_DETAILS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_MATCH_TAXAMT (AS_REFSER IN CHAR, AS_REFID IN CHAR) RETURN NUMBER IS LL_TENVCOUNT NUMBER(3) := 0; LL_TAXCOUNT NUMBER(3) := 0; LS_SQL VARCHAR2(4000); CUR_OUT SYS_REFCURSOR; LL_RETVAL NUMBER(1) := 0; LL_MISMATCH_CNT NUMBER(6) := 0; LS_LINENO CHAR(3); LS_TAXENV CHAR(10); LC_TAXTRAN_TAXAMT TAXTRAN.TAX_AMT%TYPE; LC_DET_TAXAMT TAXTRAN.TAX_AMT%TYPE; BEGIN IF AS_REFSER = 'D-ISS' THEN LS_SQL := 'SELECT LINE_NO,NVL(TAX_AMT,0),TAX_ENV FROM DISTORD_ISSDET WHERE TRAN_ID = :TRAN_ID'; END IF; LC_DET_TAXAMT := 0; OPEN CUR_OUT FOR LS_SQL USING AS_REFID ; LOOP LC_DET_TAXAMT := 0; FETCH CUR_OUT INTO LS_LINENO, LC_DET_TAXAMT, LS_TAXENV; EXIT WHEN CUR_OUT%NOTFOUND; IF LS_TAXENV IS NOT NULL AND LENGTH(TRIM(LS_TAXENV)) > 0 THEN BEGIN LS_LINENO := SUBSTR(' ' || TRIM(LS_LINENO) , -3); LC_TAXTRAN_TAXAMT := 0; SELECT NVL(SUM(NVL(TAX_AMT , 0)) , 0) INTO LC_TAXTRAN_TAXAMT FROM TAXTRAN WHERE TRAN_CODE = AS_REFSER AND TRAN_ID = AS_REFID AND LINE_NO = LS_LINENO; EXCEPTION WHEN OTHERS THEN LC_TAXTRAN_TAXAMT := 0; END; IF NVL(LC_DET_TAXAMT , 0) <> NVL(LC_TAXTRAN_TAXAMT , 0) THEN LL_MISMATCH_CNT := 1; END IF; END IF; END LOOP; IF LL_MISMATCH_CNT > 0 THEN LL_RETVAL := 1; END IF; RETURN LL_RETVAL ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_TDDS_EXCI (mexpr_no in char, moper_no in number, mline_no in number) return number is mtot_qty number(14,3) := 0; mpotency number(14,6) := 0; begin select sum(expr_quantity + potency_adj) into mtot_qty from expr_bill where expr_no = mexpr_no and operation = moper_no and line_no <> mline_no; select round(nvl((qty_per_proc - mtot_qty), 0), 6) into mpotency from expr_bill where expr_no = mexpr_no and operation = moper_no; return mpotency; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_SECOND_CUST_APRV (as_emp_code char) return char is EMP_CODE_MGR char(10) ; as_grade_cd varchar(5); as_report_to_second char(10); grd_cnt number := 0; begin select count(grade_code) into grd_cnt from grade where grade_code = (select grade from employee where emp_code = (select report_to from employee where emp_code = (select report_to from employee where emp_code = as_emp_code ) ) and level_no in ('1','2','3','4') ); select report_to into as_report_to_second from employee where emp_code = (select report_to from employee where emp_code = as_emp_code) ; if grd_cnt = 0 then EMP_CODE_MGR := '1515'; else EMP_CODE_MGR := as_report_to_second; end if; return EMP_CODE_MGR; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TDS_AMT (as_varname in char,as_Ref_id in char,as_Ref_Ser in Char) return number is ll_TdsAmt Number(17,3); ls_VarValue varchar2(500); ls_string varchar2(500); ls_Token varchar2(6); ls_sql varchar2(1000); li_pos number ; begin begin select var_value into ls_VarValue from finparm where prd_code = '999999' and var_name = as_varname; end; if ls_VarValue is null then ll_TdsAmt := 0; return ll_TdsAmt; end if; if ls_VarValue is not null then begin loop exit when instr(ls_VarValue,',') = 0; li_pos := instr(ls_VarValue,',') ; ls_Token := ddf_get_token(ls_VarValue,',') ; ls_VarValue := substr(ls_VarValue,li_pos+1) ; ls_string := ls_string || '''' || ls_Token || ''','; end loop; End; ls_string := '(' || ls_string || '''' || ls_VarValue || ''') '; ls_sql := 'Select sum(tax_amt) from taxtran '; ls_sql := ls_sql || ' where tran_code = ''' || as_Ref_Ser || '''' ; ls_sql := ls_sql || ' and tran_id = ''' || as_Ref_id || '''' ; -- ls_sql := ls_sql || ' and line_no = ''' || as_line || '''' ; ls_sql := ls_sql || ' and tax_code in ' || ls_string ; execute immediate ls_sql into ll_TdsAmt; end if; return ll_TdsAmt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_ARREARS_DIFF_DAYS (AS_PRD_CODE char,AS_EMP_CODE char,AS_PRD_CODE__ACC char) return number is a_payroll payroll.paid_days%type; a_arrears_a arrears.paid_days%type; a_arrears_b arrears.paid_days%type; begin select nvl(sum(a.paid_days),0) into a_payroll from payroll a where a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and not exists (select b.* from arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc < AS_PRD_CODE__ACC); select nvl(sum(a.paid_days),0) into a_arrears_a from arrears a where a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.prd_code__acc = (select max(b.prd_code__acc) from arrears b where b.prd_code = a.prd_code and b.emp_code = a.emp_code and b.prd_code__acc < AS_PRD_CODE__ACC); select nvl(sum(a.paid_days),0) into a_arrears_b from arrears a where a.prd_code = AS_PRD_CODE and a.emp_code = AS_EMP_CODE and a.prd_code__acc = AS_PRD_CODE__ACC; return (a_arrears_b - (a_payroll + a_arrears_a)); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TASK_FEEDBACK_X ON PROJ_TASK_FEEDBACK (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DDF_HR_FIELD_LEAVE_DAR after insert or update on empleave referencing old as old new as new for each row declare a_count number; a_chg_user empleave.chg_user%type; a_chg_term empleave.chg_term%type; a_stan_code__hq employee.stan_code__hq%type; a_stan_code__from sprs_travel.stan_code__from%type; a_locality_code locality.locality_code%type; a_route_id_from sprs_travel.route_id_from%type; a_route_id sprs_route.route_id%type; a_route_type sprs_route.route_type%type; a_locality_code_from sprs_travel.locality_code_from%type; a_stan_type sprs_route.station_type%type; a_dcr_id sprs_act_tran.dcr_id%type; a_tran_id sprs_act_tran.tran_id%type; a_route_descr_start sprs_act_tran.ROUTE_DESCR__START%type; a_lve_date nsrno.adate%type; CURSOR cur_lve_date IS SELECT a.adate FROM nsrno a WHERE a.adate between :new.lve_date_fr and :new.lve_date_to and a.adate not in ( select b.hol_date from holiday b where b.hol_tblno = ddf_get_holtblno(:new.emp_code,a.adate) and b.hol_date = a.adate and not exists (select c.hol_date_for from change_holiday c where c.emp_code = :new.emp_code and c.hol_date_for = b.hol_date and c.hol_type = b.hol_type and c.confirmed = 'Y') union all select b.hol_date_to from change_holiday b where b.emp_code = :new.emp_code and b.hol_date_to = a.adate and b.confirmed = 'Y') order by a.adate; begin select count(*) into a_count from users a, sales_pers b where a.emp_code = b.sales_pers and a.emp_code = :new.emp_code and a.profile_id in ('FIELD_RT','FIELD_MRT','SFAMR','SFAMGR','MR','FLM','SLM','TLM','MGR','FLDPOS','FORFLM'); if (a_count > 0) then select count(*) into a_count from sprs_act_tran a, fieldactivity b where a.activity_code = b.activity_code and a.event_date between :new.lve_date_fr and :new.lve_date_to and a.sales_pers = :new.emp_code and b.activity_type not in('FW','NFW'); --if a_count != 0 then --raise_application_error (-20001,'Mismatch in Data , other than leave data : ' || :new.emp_code); --end if; select stan_code__hq into a_stan_code__hq from employee where emp_code = :new.emp_code; -- select locality_code into a_locality_code from locality where stan_code =a_stan_code__hq and status = 'A' and rownum =1; -- select stan_code,locality_code,route_id into a_stan_code__from,a_locality_code_from,a_route_id_from from sprs_travel where sales_pers= :new.emp_code and travel_date = :new.lve_date_fr - 1; --select route_id, station_type into a_route_id,a_stan_type from sprs_route where sprs_code = :new.emp_code and stan_code = a_stan_code__hq and locality_code = a_locality_code and status = 'Y'; select a.locality_code,a.route_id,a.station_type,a.descr,a.route_type into a_locality_code, a_route_id, a_stan_type, a_route_descr_start,a_route_type from sprs_route a, station b, locality c where a.stan_code = b.stan_code and b.stan_code = c.stan_code and a.locality_code = c.locality_code and a.sprs_code = :new.emp_code and a.stan_code = a_stan_code__hq and c.status='A' and a.status='Y' and rownum = 1; if inserting then select count(*) into a_count from sprs_act_tran a where a.event_date between :new.lve_date_fr and :new.lve_date_to and a.sales_pers = :new.emp_code; if a_count > 0 then delete from sprs_act_tran a where a.event_date between :new.lve_date_fr and :new.lve_date_to and a.sales_pers = :new.emp_code; end if; for lve_dt in cur_lve_date loop select 'WF' || substr( '0000000000' || fastdcr_seq.nextval , -8 ) into a_dcr_id from dual; a_tran_id := a_dcr_id; insert into sprs_act_tran(TRAN_ID, EVENT_DATE, ACTIVITY_CODE, SALES_PERS, SPRS_CODE__WW, CHG_DATE, CHG_USER, CHG_TERM, DCR_ID, OTH_PARTICIPANT, CONFIRMED, CONF_DATE, REMARK, COPY_PLAN, TOT_CALLS, PRODUCTIVE_CALLS, UDF_STR1, UDF_NUM1, USE_SUB_DATA, ROUTE_DESCR__START, SUBMISSION_DATE, DAR_UNCONF_CNT) values(a_dcr_id,lve_dt.adate,trim(:new.lve_code),:new.emp_code, null,trunc(sysdate),:new.chg_user,:new.chg_term,a_dcr_id,null,'Y',:new.chg_date,:new.remarks,'N',null,null,'EMPLEAVE',null,null,a_route_descr_start,sysdate,null); insert into SPRS_TRAVEL(TRAN_ID, PLAN_ID, SALES_PERS, TRAVEL_DATE, LOCALITY_CODE, STAN_CODE, STAN_CODE__FROM, TRAVEL_MODE, OVER_NIGHT, ACTIVITY_CODE, CHG_DATE, CHG_USER, CHG_TERM, LOCALITY_CODE_FROM, TEMPLATE_FILE, SALES_TEAM, OTH_PARTICIPANT, SPRS_CODE__WW, ORDER_OF_VISIT, DCR_ID, LINE_NO, DR_VISIT, CHEM_VISIT, WSELLER_VISIT, DISTBR_VISIT, MTRADER_VISIT, RETAILER_VISIT, MERCH_VISIT, OTHER_VISIT, STOCKIST_VISIT, ADD_GEOPOS, CHG_GEOPOS, GEOPOS_ACCURACY, STATION_TYPE, ROUTE_ID_FROM, ROUTE_ID, ROUTE_TYPE) values( null,null,:new.emp_code,lve_dt.adate,a_locality_code,a_stan_code__hq,a_stan_code__hq,'1','N',trim(:new.lve_code), sysdate,:new.chg_user,:new.chg_term,a_locality_code,null,null,null,null,'1',a_dcr_id,'1','N','N',null,null,null,null,null,'N','N',null,null,null,a_stan_type,a_route_id,a_route_id,a_route_type); insert into strg_meet(TRAN_ID, PLAN_ID, EVENT_DATE, EVENT_TYPE, STRG_CODE, STRG_NAME, STRG_TYPE, STRG_NO_VISIT, EVENT_TIME_START, EVENT_TIME_END, STRG_CLASS_CODE, SALES_PERS, SALES_TEAM, OTH_PARTICIPANT, REMARKS, CHG_DATE, CHG_USER, CHG_TERM, ORDER_BOOKED, MEET_SUMM, LOCALITY_CODE, TEMPLATE_FILE, SPRS_CODE__WW, LAST_MEET_SUMM, LAST_MEET_DATE, LAST_PROD_BRF, REF_TRAN_ID, CONF_DATE, CONFIRMED, EMP_CODE__APRV, SHORT_ID, SC_CODE__REF, MEET_SUMM_MGR, DCR_ID, WORK_TEAM, WORK_WITH_OTHER, POB_VAL, NO_OF_OUTLET, LINE_NO, ADD_GEOPOS, CHG_GEOPOS, CALL_OUTCOME, ORDER_OF_VISIT, SKU_VALUE, ADDRESS_AS, GENDER, WF_STATUS, ADDR1, ADDR2, ADDR3, MOBILE_NO, EMAIL_ADDR, SPL_CODE, COPY_PLAN, GEO_POS_NAME, ARRIVAL_TIME, GEOPOS_ACCURACY, SYNC_DATE, ENTRY_MODE, PROMOTER_NAME, MAN_POWER, IMAGE_ID, GST_NO, SUBCLASS_CODE, PIN, STATION_TYPE, ROUTE_ID, NEXT_PLAN_DATE, MEMBER_PRESENT, POB_ITEM, CUST_CONF, CUST_CONF_PROOF, STRG_EVENT_INFO, REG_NO, PLAN_CHG_REAS) values( null,null,lve_dt.adate,trim(:new.lve_code), '-NA-',null,null,'0','10:00','10:00',null,:new.emp_code,null,null,null,sysdate,:new.chg_user,:new.chg_term,'0',null,a_locality_code,'MeetingWsfa',null,null,null,null,null,:new.chg_date,'Y',null,null,null,null,a_dcr_id,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null, '1','1',null,null,null,null,null,null,null,null); end loop; end if; if updating then select count(*) into a_count from sprs_act_tran a, fieldactivity b where a.activity_code = b.activity_code and a.event_date between :old.lve_date_fr and :old.lve_date_to and a.sales_pers = :old.emp_code and b.activity_type not in ('FW','NFW'); --if a_count != 0 then -- raise_application_error (-20001,'Mismatch in Data , other than leave data : ' || :new.emp_code); --end if; if (:old.emp_code != :new.emp_code) then raise_application_error (-20001,'Mismatch in employee code : ' || :new.emp_code); end if; if (:old.use_flag != :new.use_flag) then raise_application_error (-20001,'Mismatch in Data , other than leave data : ' || :new.emp_code); end if; if (:old.status != :new.status and :new.status = 'C') then select count(*) into a_count from sprs_act_tran a where a.event_date between :old.lve_date_fr and :old.lve_date_to and a.sales_pers = :old.emp_code; if a_count > 0 then update sprs_act_tran x set x.activity_code = 'LC',x.chg_date=sysdate,x.confirmed = 'N' where x.event_date between :old.lve_date_fr and :old.lve_date_to and x.sales_pers = :old.emp_code; update sprs_travel x set x.activity_code = 'LC',x.chg_date=sysdate where x.travel_date between :old.lve_date_fr and :old.lve_date_to and x.sales_pers = :old.emp_code; update strg_meet x set x.event_type = 'LC',x.chg_date=sysdate,x.confirmed = 'N' where x.event_date between :old.lve_date_fr and :old.lve_date_to and x.sales_pers = :old.emp_code; end if; end if; end if; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ACTIONFEEDBACK_REF_ID ON ACTIONFEEDBACK (REF_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMP_CODE_DATE_FROM_TO ON TOUR (EMP_CODE, DATE_FROM, DATE_TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GETVALIDREC_PMS (AS_LOG_CODE char,AS_REQ_EMP char,AS_TRAN_TYPE char) return number is a_acc_parm1 users.acc_parm1%type; a_log_emp users.emp_code%type; a_item_ser sales_pers.item_ser%type; a_ret_val number(1) := 0; a_count number(1) := 0; begin select acc_parm1,emp_code into a_acc_parm1,a_log_emp from users where code = AS_LOG_CODE; if (a_acc_parm1 = 'HIERARCHY') then select count(distinct emp_code) into a_count from employee where emp_code = a_log_emp start with emp_code = AS_REQ_EMP connect by prior report_to = emp_code; if (a_count = 1) then a_ret_val := 1; end if; elsif (a_acc_parm1 = 'ALL') then a_ret_val := 1; elsif (a_acc_parm1 is not null) then select b.item_ser into a_item_ser from tran_type_master a,department b where b.dept_code = a.dept_code and a.tran_type = AS_TRAN_TYPE and a.mod_name = 'PMS'; if (instr(','||trim(a_acc_parm1)||',',','||trim(a_item_ser)||',') > 0) then a_ret_val := 1; end if; end if; RETURN A_RET_VAL; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_RETURN_PACK_BOX (as_pack char, ac_qty number) return char is ls_ret_str varchar2 (50); ls_val varchar2(25); ll_qty_pack varchar2(50); ls_ret1 varchar2 (50); ls_ret2 varchar2 (50); ls_pack1 varchar2(25); ls_pack2 varchar2(25); ll_ret number(14,3); i number(14,3); begin ls_pack1 := ddf_get_token(as_pack ,'-'); ls_pack2 := as_pack; if not(ls_pack1) is null and length(ls_pack1 ) > 0 then for i in 1..length(ls_pack1) Loop ls_val := substr(ls_pack1,i,1); if is_number(ls_val)<>-1 then ls_ret1 := ls_ret1+ls_val; end if; END LOOP; end if; if not(ls_pack1) is null and length(ls_pack2 ) > 0 then for i in 1..length(ls_pack2) Loop ls_val := substr(ls_pack2,i,1); if is_number(ls_val)<>-1 then ls_ret1 := ls_ret2+ls_val; end if; END LOOP; end if; if trim(ls_ret1) is null then ls_ret1:= '0'; end if; if trim(ls_ret2) is null then ls_ret2 := '0'; end if; ll_ret := (to_number(ls_ret2) - to_number(ls_ret1) )+ 1; if ll_ret <= 0 then ll_ret := 1; end if; ll_qty_pack:= to_char(ac_qty / ll_ret); ls_ret_str := trim(to_char(ll_qty_pack)) || ' x ' || to_char(ll_ret); return ls_ret_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BS_NTYP_TRAN_DATE ( as_ref_ser in char , as_ref_no in char , as_par in char , ad_date in date) return date as date1 date; begin if as_par = 1 then select tran_date into date1 from misc_payables where tran_ser = as_ref_ser and ref_no = as_ref_no; elsif as_par = 2 then select max(tran_date) into date1 from misc_voucher where tran_id in ( select tran_id from misc_vouchadv where ref_ser = as_ref_ser and ref_no = as_ref_no ) and confirmed = 'Y' and tran_date <= ad_date; elsif as_par = 3 then select max(tran_date) into date1 from voucher where tran_id in ( select tran_id from vouchadv where ref_ser = as_ref_ser and ref_no = as_ref_no ) and confirmed = 'Y' and tran_date <= ad_date; elsif as_par = 4 then select tran_date into date1 from receivables where tran_ser = as_ref_ser and ref_no = as_ref_no; elsif as_par = 5 then select max(tran_date) into date1 from receipt where tran_id in ( select tran_id from rcpadv where ref_ser = as_ref_ser and ref_no = as_ref_no ) and confirmed = 'Y' and tran_date <= ad_date; end if; return date1; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TAXTRAN_CODE (as_str in char,as_sep in char) return char is ls_ret varchar2(4000); ll_len number; ll_pos1 number; ll_pos2 number; A number; B number; as_str1 varchar2(100); as_sep1 char(5); begin as_str1:=trim(as_str)||','; as_sep1:=as_sep||'|'; ll_len:=Length(as_sep1); ll_pos1:= Instr(as_str1,as_sep1,1); ll_pos2:= Instr(as_str1,',',ll_pos1); A:=ll_pos1 + ll_len; B:=ll_pos2 - ll_pos1 - ll_len; ls_ret:= substr(as_str1,A,B); Return ls_ret; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ORDER_TYPE (mcons_order char) return char is retord_type char(2); morder_type char(3); begin select trim(order_type) into morder_type from consume_ord where cons_order=mcons_order; if morder_type ='PM' then retord_type:='CP'; end if; if morder_type <> 'PM' or morder_type is null then retord_type:='CI'; end if; return retord_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_RCP_REFNO BEFORE INSERT or UPDATE OF ref_no ON RECEIPT referencing old as old new as new FOR EACH ROW DECLARE BEGIN :new.ref_no := trim(:new.ref_no); if trim(:new.ref_no) = 'KnockingOff' then :new.ref_no := :new.tran_id; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BOQDET_X ON BOQDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CUST_SERIES (as_cust_code varchar2, as_site_code varchar2,as_item_ser varchar2, as_type char) return number is lc_osamt number(14,3); begin if as_type = 'T' then select sum(tot_amt-adj_amt) into lc_osamt from receivables where trim(cust_code) = trim(as_cust_code) and trim(site_code) = trim(as_site_code) and trim(item_ser) = trim(as_item_ser); elsif as_type = 'O' then select sum(tot_amt-adj_amt) into lc_osamt from receivables where trim(cust_code) = trim(as_cust_code) and trim(site_code) = trim(as_site_code) and trim(item_ser) = trim(as_item_ser) and due_date < fn_sysdate(); end if; If lc_osamt is null then lc_osamt := 0 ; end if; return lc_osamt; Exception when OTHERS then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LVE_DAYSHRS (AS_EMP_CODE char,AS_DATE_FR date,AS_DATE_TO date,AS_LVE_CODE char,AS_USE_FLAG char) return number is a_nodays leavebal.avail_days%type; a_date_fr leavebal.eff_date%type; begin select min(eff_date) into a_date_fr from leavebal where emp_code = AS_EMP_CODE and lve_code = AS_LVE_CODE; if (a_date_fr = AS_DATE_FR) then a_date_fr := to_date('01-jan-2000','DD-MON-YYYY'); else a_date_fr := AS_DATE_FR; end if; select nvl(sum(noof_lve),0) into a_nodays from emp_lve_card where emp_code = AS_EMP_CODE and lve_code = AS_LVE_CODE and calander_date between a_date_fr and AS_DATE_TO and instr(AS_USE_FLAG,lve_use_flag) > 0; return a_nodays; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_LNBAL_ASOF (as_loanno char,ac_loanamt number,ad_asof date) return number is lc_bal number(12,2); lc_dedn number; begin lc_dedn := 0; select nvl(sum(nvl(amount,0)),0) into lc_dedn from loan_reg where loan_no = as_loanno and tran_date <= ad_asof; lc_bal := ac_loanamt - lc_dedn; return lc_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_DAY_OP_BAL_GL_TRAN (m_frst_date date,m_date_from date, m_acct_code char,m_site_code char) Return number is ld_day_op_bal number(14,3); begin Select Sum(dr_amt - cr_amt) into ld_day_op_bal from gltran where site_code=m_site_code and tran_date >=m_frst_date and tran_date < m_date_from and acct_code=m_acct_code ; if ld_day_op_bal is null then ld_day_op_bal:=0; end if; return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DSP_DATE ( as_so in sorditem.sale_order%type, as_lineno in sorditem.line_no%type) return date is ld_date sorddet.dsp_date%type; begin begin select dsp_date into ld_date from sorddet where sale_order = as_so and line_no = as_lineno; end; return ld_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ITEM_STD_DISC (as_itemcode char) return number is ls_attrib15 item.phy_attrib_15%type; begin begin select case when phy_attrib_15 is null then '0' else phy_attrib_15 end into ls_attrib15 from item where item_code = as_itemcode; exception when others then ls_attrib15 := '0'; end; return to_number(ls_attrib15); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX IDX_RCPDISH ON RCPDISHNR_DET (REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_TAX_ITEMWISE ( as_invoice_id CHAR , as_line_no number,as_type CHAR) return number is ls_return number(12,3) ; ln_tax_amt number(12,3) ; ln_tax_perc number(12,3) ; begin SELECT nvl(sum( TAXTRAN.TAX_AMT),0)TAX_AMT, nvl(SUM(TAXTRAN.TAX_PERC),0) TAX_PERC INTO ln_tax_amt , ln_tax_perc FROM TAX, TAXTRAN WHERE ( TAX.TAX_CODE = TAXTRAN.TAX_CODE ) and ( taxtran.tran_code = 'S-INV' ) AND ( taxtran.tran_id = as_invoice_id ) and TAXTRAN.LINE_NO = as_line_no AND ( taxtran.tax_amt <> 0 ) AND INSTR((select VAR_VALUE from disparm WHERE VAR_NAME='CNF_INV_TAX_CODE'),trim (TAX.TAX_CODE))>0 ; if as_type = 'PERC' then if ln_tax_perc <> 0 then ls_return := ln_tax_perc ; return ls_return ; ELSE ls_return := 0 ; return ls_return ; end if; elsif as_type = 'AMT' then if ln_tax_amt <> 0 then ls_return := ln_tax_amt ; return ls_return ; ELSE ls_return := 0 ; return ls_return ; end if; else ls_return := 0; return ls_return ; end if ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SORD_CP_MUL_PO_CHK (as_site_code in varchar2, as_cust_code in varchar2, as_item_ser in varchar2, as_item_code in varchar2) RETURN NUMBER IS mcount number(1) := 0; ls_site_code__ch varchar2(5); ls_supp_code_ch varchar2(10); BEGIN begin select site_code__ch into ls_site_code__ch from site_customer where site_code = as_site_code and cust_code = as_cust_code and channel_partner = 'Y'; exception when others then ls_site_code__ch := ''; end; if length(trim(ls_site_code__ch)) = 0 or ls_site_code__ch is null then begin select site_code into ls_site_code__ch from customer where trim(cust_code) = trim(as_cust_code) and channel_partner = 'Y'; exception when others then ls_site_code__ch := ''; end; end if; if length(trim(ls_site_code__ch)) = 0 or ls_site_code__ch is null then -- not channel partner return pass validation return 0; end if; begin select supp_code into ls_supp_code_ch from site_supplier where site_code = ls_site_code__ch and site_code__ch = as_site_code and channel_partner = 'Y'; exception when others then ls_supp_code_ch := ''; end; if length(trim(ls_supp_code_ch)) = 0 or ls_supp_code_ch is null then begin select supp_code into ls_supp_code_ch from supplier where site_code = as_site_code and channel_partner = 'Y'; exception when others then ls_supp_code_ch := ''; end; end if; begin select count(*) into mcount from porder , porddet where porder.purc_order = porddet.purc_order and porder.supp_code = ls_supp_code_ch and porder.site_code__dlv = ls_site_code__ch and trim(porder.item_ser) = trim(as_item_ser) and trim(porddet.item_code) = trim(as_item_code) and porder.status = 'O' and porddet.status = 'O' ;-- order by porder.purc_order; exception when others then mcount := 0; end; RETURN mcount; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_REGISER_USER is ls_gstin varchar2(100):='gstin.123'; ls_name varchar2(100); ls_sitecode varchar2(100); ls_finentity varchar2(100); ls_profileid varchar2(100); ll_counter number(3) := 0; ls_currcode varchar2(100); ls_addr1 varchar2(100); ls_addr2 varchar2(100); ls_city varchar2(100); ls_pin varchar2(100); ls_state varchar2(100); ls_user varchar2(100); ls_term varchar2(100); ls_stancode varchar2(100); ls_userLev varchar2(10); ls_theme varchar2(100); /* -Insert into GSTN_TEMP (CODE,GSTIN,USER_NAME,EMAIL_ID,ORG_NAME,ADDRESS,CITY,GST_CODE,CONTACT_NO,SITE_CODE) values ('VHB33','23ACBPK8187D1Z9','VHB33','indorekhandelwal@gmail.com','VHB33','Indore','Indore','23','8299731511','G0301'); Insert into GSTN_TEMP (CODE,GSTIN,USER_NAME,EMAIL_ID,ORG_NAME,ADDRESS,CITY,GST_CODE,CONTACT_NO,SITE_CODE) values ('VHB34','33AADFN3691F1ZE','VHB34','novamedica@outlook.com','VHB34','Chennai','Chennai','33','9840939377','G0302'); */ output varchar2(4000); begin ls_gstin := 'gstin.123'; ls_name := 'manoharan'; ls_sitecode := 'P0001'; ls_finentity := 'PE12345678'; ls_profileid := 'GST'; ls_currcode := 'INR'; ls_addr1 := 'Address 1'; ls_addr2 := 'Adress 2'; ls_city := 'Mumbai'; ls_pin := '4000001'; ls_stancode :='MH034'; ls_state := 'MH'; ls_user := 'Base'; ls_term := 'Base78'; ls_userLev := '2'; ls_theme :='galaxy'; for cur_list in ( select code,gstin,user_name,email_id,org_name,address,city,gst_code,contact_no,site_code from gstn_temp) loop --create finent --dbms_output.put_line('gbhn hb'); output:='insert into commmst.finent (FIN_ENTITY, DESCR, CURR_CODE, ADDR1, ADDR2, CITY, PIN, STATE_CODE, SH_DESCR,CHG_TERM, CHG_USER, CHG_DATE) values'|| ' (''' || substr(cur_list.gstin,3,10)|| ''',''' || cur_list.org_name || ''',''' || ls_currcode || ''',''' || cur_list.address || ''','''|| ls_addr2 || ''',''' || cur_list.city || ''',''' || ls_pin ||''',''' || ls_state ||''',''' || ls_name || ''','''|| ls_user || ''',''' || ls_term||''',''' || to_char(sysdate,'dd-MON-yy') ||''')'||';'; --insert into abc values (output); -- create site output:='insert into commmst.site (SITE_CODE, DESCR, STATE_CODE, STAN_CODE, CHG_DATE, CHG_USER, CHG_TERM,ADD1,ADD2,PIN,TELE1,FIN_ENTITY) values'|| ' (''' ||cur_list.site_code || ''',''' || cur_list.gstin || ''',''' || ls_state || ''',''' ||ls_stancode || ''',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''' || cur_list.address || ''',''' || cur_list.address || ''',''' || ls_pin ||''',''' || cur_list.contact_no ||''',''' || substr(cur_list.gstin,3,10)|| ''')'||';'; --insert into abc values (output); -- create employee output:='insert into commmst.employee (EMP_CODE, EMP_FNAME, EMP_MNAME, EMP_LNAME, CHG_DATE, CHG_USER, CHG_TERM, DATE_JOIN,DEPT_CODE) values'|| ' (''' ||cur_list.code || ''',''' ||cur_list.org_name || ''',''-'',''' ||cur_list.gstin || ''',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''' || to_char(sysdate,'dd-MON-yy') ||''',''D011'')'||';'; --insert into abc values (output); -- create users. output:='insert into commmst.users (CODE, NAME, PASS_WD, USR_LEV, EMP_CODE, CHG_DATE,CHG_USER,CHG_TERM,MOBILE_NO,NO_SESSION_ALLOW,SITE_CODE__DEF,USER_THEME,PROFILE_ID,ENTITY_CODE,EMAIL_ID , USER_TYPE, PASSWD_FREQ, LOGIN_FIRST, GRACE_LOGIN_CNT, WRONG_LOGIN_CNT) values'|| ' (''' ||cur_list.code || ''',''' ||cur_list.org_name || ''',''' ||trim(cur_list.code) || ''',''' ||ls_userLev || ''',''' ||cur_list.code || ''',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''' || cur_list.contact_no || ''',''9'',''' || cur_list.site_code || ''',''' ||ls_theme || ''',''' || ls_profileid ||''',''' || cur_list.code ||''',''' || cur_list.email_id ||''',''E'',''60'',''0'',''5'',''0'')'||';'; -- insert into abc values (output); -- create user_site output:= 'Insert into commmst.user_site (USER_ID,SITE_CODE,CHG_DATE,CHG_USER,CHG_TERM,PROFILE_ID) values'|| ' (''' ||cur_list.code || ''',''' ||cur_list.site_code || ''',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''' || ls_profileid ||''')'||';'; --insert into abc values (output); ---siteregno output:= 'Insert into gstapp.siteregno (FIN_ENTITY,SITE_CODE,REF_CODE,REG_NO,CHG_DATE,CHG_USER,CHG_TERM,VALID_UPTO,EFF_FROM) values'|| ' (''' || substr(cur_list.gstin,3,10)|| ''',''' ||cur_list.site_code || ''',''GSTIN_NO'',''' ||cur_list.gstin || ''',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''01-JUL-17'',''01-MAR-18'')'||';'; --insert into abc values (output); output:= 'Insert into gstapp.siteregno (FIN_ENTITY,SITE_CODE,REF_CODE,REG_NO,CHG_DATE,CHG_USER,CHG_TERM,VALID_UPTO,EFF_FROM) values'|| ' (''' || substr(cur_list.gstin,3,10)|| ''',''' ||cur_list.site_code || ''',''GST_UNAME'',''' ||cur_list.user_name || ''',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''01-JUL-17'',''01-MAR-18'')'||';'; --insert into abc values (output); output:= 'Insert into gstapp.siteregno (FIN_ENTITY,SITE_CODE,REF_CODE,REG_NO,CHG_DATE,CHG_USER,CHG_TERM,VALID_UPTO,EFF_FROM) values'|| ' (''' || substr(cur_list.gstin,3,10)|| ''',''' ||cur_list.site_code || ''',''GST_GT'','' '',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''01-JUL-17'',''01-MAR-18'')'||';'; --insert into abc values (output); output:= 'Insert into gstapp.siteregno (FIN_ENTITY,SITE_CODE,REF_CODE,REG_NO,CHG_DATE,CHG_USER,CHG_TERM,VALID_UPTO,EFF_FROM) values'|| ' (''' || substr(cur_list.gstin,3,10)|| ''',''' ||cur_list.site_code || ''',''GST_CUR_GT'','' '',''' || to_char(sysdate,'dd-MON-yy') ||''','''|| ls_user || ''',''' || ls_term||''',''01-JUL-17'',''01-MAR-18'')'||';'; --insert into abc values (output); end loop; --end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_ULD_DET (AS_SALES_PERS VARCHAR2, AS_DATE DATE, AS_OPT VARCHAR2, AS_ITEM VARCHAR2) RETURN NUMBER IS LS_QTY NUMBER(9,2); BEGIN IF(AS_OPT='POB') THEN SELECT ORDER_BOOKED INTO LS_QTY FROM STRG_MEET WHERE STRG_CODE IS NULL AND TRIM(SALES_PERS)=TRIM(AS_SALES_PERS) AND EVENT_DATE=AS_DATE AND STRG_TYPE='D'; RETURN NVL(LS_QTY,'0'); ELSIF(AS_OPT='QTY') THEN SELECT QUANTITY INTO LS_QTY FROM STRG_MEET_ITEMS WHERE TRAN_ID IN(SELECT TRAN_ID FROM STRG_MEET WHERE STRG_CODE IS NULL AND STRG_TYPE='D' AND TRIM(SALES_PERS)=TRIM(AS_SALES_PERS) AND EVENT_DATE=AS_DATE) AND TRIM(ITEM_CODE)=TRIM(AS_ITEM); RETURN NVL(LS_QTY,'0'); ELSIF(AS_OPT='COUNT') THEN SELECT COUNT(STRG_NAME) INTO LS_QTY FROM STRG_MEET WHERE STRG_CODE IS NULL AND TRIM(SALES_PERS)=TRIM(AS_SALES_PERS) AND EVENT_DATE=AS_DATE AND STRG_TYPE='D'; RETURN NVL(LS_QTY,'0'); END IF; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN '0'; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_CHK_ALTERNATE_QTY (ls_woBillItemCode in varchar2, ls_woIssDetItemCode in varchar2, ls_woIssWorkOrder in varchar2, ls_itemRef in varchar2, ll_quantity in NUMBER) IS ll_altquantity number(14,3):=0; ll_qtyPerBom number(17,6):=0; ll_propotinateAltQty number(14,3):=0; ll_balanceQty number(14,3):=0; ls_bomCode varchar2(10); BEGIN if (trim(ls_woBillItemCode) <> (ls_woIssDetItemCode)) then begin select bom_code into ls_bomCode from workorder where work_order = ls_woIssWorkOrder; exception when others then ls_bomCode := ''; end; dbms_output.put_line('Bom Code [' || ls_bomCode ||']'); begin select quantity into ll_altquantity from bom_alt where item_code = ls_woBillItemCode and item_code__alt = ls_woIssDetItemCode and bom_code = ls_bomCode; exception when others then ll_altquantity := 0; end; dbms_output.put_line('ll_altquantity [' || to_char(ll_altquantity) ||']'); begin select qty_per into ll_qtyPerBom from bomdet where item_code = ls_woBillItemCode and bom_code = ls_bomCode and trim(item_ref) = trim(ls_itemRef); exception when others then DBMS_OUTPUT.PUT_LINE (SQLERRM); DBMS_OUTPUT.PUT_LINE (SQLCODE); dbms_output.put_line('in exception ll_qtyPerBom [' || to_char(ll_qtyPerBom) ||'] ll_quantity [' || to_char(ll_quantity) || ']') ; ll_qtyPerBom := 0; end; dbms_output.put_line('ls_woBillItemCode [' || ls_woBillItemCode ||'] ls_bomCode [' || ls_bomCode || '] ls_itemRef [' || ls_itemRef ||']'); dbms_output.put_line('ll_qtyPerBom [' || to_char(ll_qtyPerBom) ||'] ll_quantity [' || to_char(ll_quantity) || ']') ; begin ll_propotinateAltQty := (ll_quantity / ll_altquantity) * ll_qtyPerBom; exception when ZERO_DIVIDE then ll_propotinateAltQty := 0; when others then ll_propotinateAltQty := 0; end; dbms_output.put_line('ll_propotinateAltQty [' || to_char(ll_propotinateAltQty) ||']') ; --return ll_propotinateAltQty; else --return ll_quantity; dbms_output.put_line('in else ll_quantity[' || to_char(ll_quantity) ||']') ; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BUDGRP_ALLO_AMD_X ON BUDGRP_ALLO_AMD (AMD_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TAXNONPAYABLE (as_taxcode tax.tax_code%type ) return varchar2 is ls_non_payable tax.non_payable%type; begin select nvl(non_payable,'N') into ls_non_payable from tax where tax_code = as_taxcode; return ls_non_payable; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_COLON_VALUES ( input_str IN VARCHAR2, value_type IN NUMBER ) RETURN colon_result_tab PIPELINED AS v_str_part VARCHAR2(4000); v_key VARCHAR2(100); v_val VARCHAR2(4000); v_from NUMBER; v_to NUMBER; v_item VARCHAR2(4000); v_idx PLS_INTEGER; BEGIN FOR i IN 1 .. REGEXP_COUNT(input_str, '@') LOOP v_key := REGEXP_SUBSTR(input_str, '@([^:]+):([^@]+)', 1, i, NULL, 1); v_val := REGEXP_SUBSTR(input_str, '@([^:]+):([^@]+)', 1, i, NULL, 2); IF value_type = 1 THEN PIPE ROW(v_key); ELSIF value_type = 2 THEN v_idx := 1; LOOP v_item := REGEXP_SUBSTR(v_val, '[^,]+', 1, v_idx); EXIT WHEN v_item IS NULL; PIPE ROW(v_key || ':' || v_item); v_idx := v_idx + 1; END LOOP; ELSIF value_type = 3 THEN IF REGEXP_LIKE(v_val, '^\d+-\d+$') THEN v_from := TO_NUMBER(REGEXP_SUBSTR(v_val, '^\d+')); v_to := TO_NUMBER(REGEXP_SUBSTR(v_val, '\d+$')); FOR j IN v_from .. v_to LOOP PIPE ROW(v_key || ':' || j); END LOOP; ELSE PIPE ROW(v_key || ':' || v_val); END IF; ELSIF value_type = 4 THEN v_item := REGEXP_SUBSTR(v_val, '[^-]+', 1, 2); IF v_item IS NOT NULL THEN PIPE ROW(v_key || ':' || v_item); END IF; END IF; END LOOP; RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE EFFECTIVELEVELDM AS FUNCTION getEffectiveLevelInfo(empCode in char, prdCode in char) RETURN EFFECTIVELEVELTABLE PIPELINED; END EffectiveLevelDm; CREATE OR REPLACE PACKAGE BODY EFFECTIVELEVELDM AS FUNCTION getEffectiveLevelInfo (empCode in char, prdCode in char) RETURN EFFECTIVELEVELTABLE PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); MGR_SUB char(10); BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE CODE = prdCode; WITH E_DATA1 AS ( SELECT A.EMP_CODE FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE WHERE RELIEVE_DATE IS NULL START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ORDER BY A.EMP_FNAME ) SELECT COUNT(1) INTO UNCONFIRM_CNT FROM SPRS_ACT_TRAN SAT, E_DATA1 ED1 WHERE SAT.EVENT_DATE BETWEEN AS_PRD_FR_DATE AND AS_PRD_TO_DATE AND SAT.CONFIRMED = 'Y' AND SAT.SALES_PERS = ED1.EMP_CODE; if (UNCONFIRM_CNT > 0) THEN SELECT AS_PRD_FR_DATE, AS_PRD_TO_DATE INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; ELSE SELECT TRUNC(ADD_MONTHS(AS_PRD_FR_DATE ,-1),'MM'), LAST_DAY(ADD_MONTHS(AS_PRD_FR_DATE ,-1)) INTO AS_FR_DATE, AS_TO_DATE FROM DUAL; END if; SELECT CODE INTO AS_PRD_CODE FROM PERIOD WHERE FR_DATE = AS_FR_DATE AND TO_DATE = AS_TO_DATE; select sales_pers INTO MGR_SUB from sales_pers where sales_pers = empCode; for x in ( -----------------------------------------------------------------SUMMARY----------------------------------------------- SELECT PARAM_NAME,DESCR,SH_DESCR,PARAM_VALUE,ACTUAL_VALUE ,PARAM_COLOR ,PARAM_IMG, PRD_CODE, link_metadata, MGR_SUB, EMP_DETAIL FROM ( SELECT PARAM_NAME,DESCR,SH_DESCR,PARAM_VALUE,ACTUAL_VALUE ,PARAM_COLOR ,PARAM_IMG, PRD_CODE, link_metadata, MGR_SUB, EMP_DETAIL,LEVEL_NO FROM ( WITH E_DATA AS ( SELECT A.EMP_CODE, B.LEVEL_NO FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE WHERE RELIEVE_DATE IS NULL START WITH EMP_CODE = empCode CONNECT BY PRIOR EMP_CODE = REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE ORDER BY A.EMP_FNAME ) SELECT PARAM_NAME,DESCR,SH_DESCR,E_DATA.LEVEL_NO, (select max(event_date) from SPRS_ACT_TRAN where sales_pers = E_DATA.EMP_CODE and confirmed = 'Y') as PARAM_VALUE,PARAM_COLOR,PARAM_IMG, AS_PRD_CODE as PRD_CODE, E_DATA.EMP_CODE as MGR_SUB, (select DDF_GET_EMP_DET(E_DATA.EMP_CODE) from dual) as EMP_DETAIL, CASE WHEN TRIM(PARAM_NAME) = 'A_DAYS_FW' THEN NVL(FN_GET_FLD_WRK_DY(E_DATA.EMP_CODE, AS_PRD_CODE),0) WHEN TRIM(PARAM_NAME) = 'B_TOT_DR_NO' THEN NVL(FN_EFFORT_LEV_CNT(E_DATA.EMP_CODE,'TOT_DR_NO', AS_PRD_CODE),0) WHEN TRIM(PARAM_NAME) = 'C_DR_MEET' THEN NVL(FN_EFFORT_LEV_CNT(E_DATA.EMP_CODE,'DR_MEET', AS_PRD_CODE),0) WHEN TRIM(PARAM_NAME) = 'D_DR_N_MEET' THEN NVL(FN_EFFORT_LEV_CNT(E_DATA.EMP_CODE,'DR_N_MEET', AS_PRD_CODE),0) WHEN TRIM(PARAM_NAME) = 'E_NO_CALLS' THEN NVL(FN_EFFORT_LEV_CNT(E_DATA.EMP_CODE,'NO_CALLS', AS_PRD_CODE),0) WHEN TRIM(PARAM_NAME) = 'F_CALL_AVG' THEN NVL(FN_EFFORT_LEV_CNT(E_DATA.EMP_CODE,'CALL_AVG', AS_PRD_CODE),0) ELSE 0 END AS ACTUAL_VALUE, CASE WHEN TRIM(PARAM_NAME) = 'A_DAYS_FW' THEN '' WHEN TRIM(PARAM_NAME) = 'B_TOT_DR_NO' THEN '' WHEN TRIM(PARAM_NAME) = 'C_DR_MEET' THEN 'effort_doc_met' WHEN TRIM(PARAM_NAME) = 'D_DR_N_MEET' THEN 'effort_doc_not_met' WHEN TRIM(PARAM_NAME) = 'E_NO_CALLS' THEN 'effort_alldoctorcalls' WHEN TRIM(PARAM_NAME) = 'F_CALL_AVG' THEN '' ELSE '' END AS link_metadata FROM KPI_PARAM, E_DATA WHERE MOD_NAME = 'W_EFFORT_LEVEL_DM' ) DM order by DM.param_name ASC, DM.LEVEL_NO DESC, DM.EMP_DETAIL ) ) LOOP PIPE ROW (EFFECTIVELEVELDMMASTER( TRIM(x.PARAM_NAME),x.DESCR,x.SH_DESCR,x.PARAM_VALUE,x.ACTUAL_VALUE,x.PARAM_COLOR,x.PARAM_IMG, x.PRD_CODE, x.link_metadata, x.MGR_SUB, x.EMP_DETAIL)); END LOOP; RETURN; END; END EffectiveLevelDm; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUSTOMER_CUST_NAME ON CUSTOMER (CUST_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CUST_NON_ECO_DET (LS_SC_CODE IN CHAR) RETURN VARCHAR2 IS LS_NON_ECO_DET VARCHAR2(12); LS_REC_CNT NUMBER(5); BEGIN SELECT COUNT(*) INTO LS_REC_CNT FROM STRG_CUST_EXCEPTION WHERE SC_CODE = LS_SC_CODE AND (PRODUCT_CODE IS NULL OR UPPER(PRODUCT_CODE) = 'NULL') AND (ITEM_CODE IS NULL OR UPPER(ITEM_CODE) = 'NULL') AND EXCEP_FLAG = '1'; IF LS_REC_CNT > 0 THEN LS_NON_ECO_DET := 'CUST-NONECO'; ELSE SELECT COUNT(*) INTO LS_REC_CNT FROM STRG_CUST_EXCEPTION WHERE SC_CODE = LS_SC_CODE AND PRODUCT_CODE IS NOT NULL AND (ITEM_CODE IS NULL OR UPPER(ITEM_CODE) = 'NULL') AND EXCEP_FLAG = '1'; IF LS_REC_CNT > 0 THEN LS_NON_ECO_DET := 'PROD-NONECO'; ELSE SELECT COUNT(*) INTO LS_REC_CNT FROM STRG_CUST_EXCEPTION WHERE SC_CODE = LS_SC_CODE AND (PRODUCT_CODE IS NOT NULL OR UPPER(PRODUCT_CODE) != 'NULL') AND (ITEM_CODE IS NOT NULL OR UPPER(ITEM_CODE) != 'NULL') AND EXCEP_FLAG = '1'; IF LS_REC_CNT > 0 THEN LS_NON_ECO_DET := 'ITEM-NONECO'; END IF; END IF; END IF; RETURN LS_NON_ECO_DET; EXCEPTION WHEN TOO_MANY_ROWS THEN RETURN ' '; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_VOUCH_NO (as_tran_id in char, as_net_amt in number ,as_sundry_type in char) return char is lc_vouch_no varchar2(20); begin if (as_sundry_type <> 'B') then select misc_paydet.vouch_no into lc_vouch_no from misc_paydet where misc_paydet.tran_id = as_tran_id and misc_paydet.net_amt = as_net_amt; else select misc_payment.ref_no into lc_vouch_no from misc_payment where misc_payment.tran_id = as_tran_id ; end if; return lc_vouch_no ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RMAX_LOT_RATE ( ls_price_list IN CHAR, ls_item_code IN CHAR) RETURN NUMBER IS lc_rate NUMBER(14,3); ls_lot_from CHAR(15); ls_type CHAR(1); BEGIN SELECT lot_no__from INTO ls_lot_from FROM ( SELECT lot_no__from from pricelist WHERE price_list = ls_price_list AND item_code = ls_item_code AND eff_from <= sysdate AND valid_upto >= sysdate order by slab_no desc,lot_no__from DESC ) WHERE ROWNUM =1; SELECT list_type INTO ls_type FROM pricelist_mst WHERE price_list = ls_price_list ; IF ls_type = 'L' THEN SELECT rate INTO lc_rate FROM ( SELECT rate FROM pricelist WHERE price_list = ls_price_list AND item_code = ls_item_code AND lot_no__from <= ls_lot_from AND lot_no__to >= ls_lot_from AND list_type = 'L' AND eff_from <= SYSDATE AND valid_upto >= SYSDATE ORDER BY SLAB_NO DESC ) WHERE ROWNUM = 1; elsif ls_type = 'B' THEN SELECT rate INTO lc_rate from ( SELECT rate FROM pricelist WHERE price_list = ls_price_list AND item_code = ls_item_code AND lot_no__from <= ls_lot_from AND lot_no__to >= ls_lot_from AND list_type = 'B' AND eff_from <= sysdate AND valid_upto >= sysdate ORDER BY SLAB_NO DESC ) WHERE ROWNUM = 1; END IF ; RETURN lc_rate; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SGET_PLISTGEN_PTR_MRP (mptr_incl_ex in number, mst_rate in number, mst_amt in number, mitem in char, mor_ent_tax in number) return number is mrate number; mitem_type char(1); begin select nvl(phy_attrib_11,'N') into mitem_type from item where item_code = mitem; if mitem_type = 'Y' then mrate := MPTR_INCL_EX + mor_ent_tax + (MPTR_INCL_EX * (MST_RATE/100) ); else mrate := MPTR_INCL_EX + MST_AMT + mor_ent_tax; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETYYOFDATE (DT char, FMT CHAR DEFAULT 'Y2') return VARCHAR2 is YY VARCHAR2(40); dt1 date; begin dt1 := to_date(DT , 'dd/mm/yy'); IF FMT = 'Y2' THEN YY := TO_CHAR(dt1 , 'YY'); ELSE IF FMT = 'Y4' THEN YY := TO_CHAR(dt1, 'YYYY'); ELSE IF FMT = 'FY' THEN SELECT CODE INTO YY FROM ACCTPRD WHERE dt1 BETWEEN FR_DATE AND TO_DATE; END IF; END IF; END IF; return YY; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_TOKEN (as_string in char, as_sep in char) return varchar2 is ls_string varchar2(500) := as_string; ls_retstr varchar2(100); li_pos number; begin li_pos := instr(ls_string,as_sep); if li_pos = 0 then ls_retstr := ls_string; ls_string := ''; else ls_retstr := substr(ls_string,1,li_pos -1); ls_string := substr(ls_string, length(ls_string) - (li_pos + length(as_sep) -1)); end if; return ls_retstr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CHEQUE_NO (as_ref_id in char, as_refser in char, as_sundry_code in char , as_tran_id in char ) return char is ls_fieldvalue char(50); li_cnt number := 0; begin begin ls_fieldvalue := '' ; if rtrim(as_refser) = 'M-PAY' then select rtrim(ref_no) into ls_fieldvalue from misc_payment where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'P-IBCA' then select count(*) into li_cnt from pay_ibca_det where tran_id = as_ref_id and sundry_code = as_sundry_code and abs(tot_amt) = ( select abs( (dr_amt * exch_rate) - ( cr_amt * exch_rate) ) from gltrace where tran_id = as_tran_id ) ; if li_cnt = 1 then select rtrim(ref_no) into ls_fieldvalue from pay_ibca_det where tran_id = as_ref_id and sundry_code = as_sundry_code and abs(tot_amt) = ( select abs( (dr_amt * exch_rate) - ( cr_amt * exch_rate) ) from gltrace where tran_id = as_tran_id ) ; li_cnt := 0; end if; end if; if rtrim(as_refser) = 'RCP' then select ref_no into ls_fieldvalue from receipt where tran_id = as_ref_id; end if; exception when no_data_found then ls_fieldvalue := '' ; end; return LTRIM(RTRIM(ls_fieldvalue)); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GST_RATE (as_trancode in taxtran.tran_code%type,as_tranid in taxtran.tran_id%type, al_lineno number) return number is lc_gstrate number(6,2) := 0; ls_lineno char(3); begin begin -- get IGST rate select lpad(trim(to_char(al_lineno)),3, ' ') into ls_lineno from dual; exception when others then ls_lineno := ' '; end; begin -- get IGST rate select tax_perc into lc_gstrate from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type = 'I' and tm.EFFECT = '+' and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tt.line_no = ls_lineno; exception when others then lc_gstrate := 0; end; if lc_gstrate = 0 then -- if IGST rate is 0 then get sum of SGST and CGST rate begin select sum(tax_perc) into lc_gstrate from taxtran tt, tax tm where tm.tax_code = tt.tax_code and tm.tax_type in ('G','H') and tm.EFFECT = '+' and tt.tran_code = as_trancode and tt.tran_id = as_tranid and tt.line_no = ls_lineno; exception when others then lc_gstrate := 0; end; end if; return lc_gstrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INV_SALES_CR ON INVOICE_SALES_CREDIT (INVOICE_ID, LINE_NO__INV, STAN_CODE__CREDIT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 524288 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SC_CODE_NAME (ls_sc_code in char) return char is ls_sc_code_name VARCHAR2(75); begin select FIRST_NAME||' '||MIDDLE_NAME||' ' || LAST_NAME into ls_sc_code_name from STRG_CUSTOMER where SC_CODE = ls_sc_code; return ls_sc_code_name; exception when too_many_rows then RETURN ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ISSQTY ( as_workorder in char, as_sitecode in char, as_itemcode in char, as_explev in char, as_loccoode in char, as_lotno in char, as_lotsl in char ) Return Number is ld_qty number(14,3); Begin Select sum(case when B.quantity is null then 0 else B.quantity end + case when B.potency_adj is null then 0 else B.potency_adj end ) Into ld_qty From workorder_iss A, workorder_issdet B Where A.tran_id = B.tran_id And A.work_order = as_workorder And A.site_code = as_sitecode And B.item_code = as_itemcode And B.exp_lev = as_explev And B.loc_code = as_loccoode And B.lot_no = as_lotno And B.lot_sl = as_lotsl And NVl(A.confirmed,'N') = 'Y'; Return ld_qty; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION ASOF_DATE_LEAVEBAL ( as_emp_code char , as_leave_code char , ad_date date, ad_date1 date ) return number is lc_bal_days number( 12 , 2 ); begin lc_bal_days := 0; begin select sum(bal_days) into lc_bal_days from leavebal where emp_code = as_emp_code and lve_code = as_leave_code and upto_date <= ad_date and exp_date >= ad_date1; exception when NO_DATA_FOUND then lc_bal_days := 0 ; end; return( lc_bal_days ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISCPAY_CANC_SC_CHK BEFORE INSERT OR UPDATE ON misc_payment_canc referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; lc_sundrycode char(10); BEGIN begin select sundry_code into lc_sundrycode from misc_payment where tran_id = :new.payment_no; exception when others then lc_sundrycode:= ' '; end; if trim(lc_sundrycode) <> trim(:new.sundry_code) then raise_application_error( -20601, 'Sundry code of payment [' || lc_sundrycode || '] is not matching with cancellation [' || :new.sundry_code || ']' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_EMPLOYEE_NAME (memp_code in char) return varchar2 is memp_name varchar2(120) := null; begin select rtrim(emp_fname)||' '||rtrim(emp_mname)||' '||rtrim(emp_lname) into memp_name from employee where emp_code = memp_code; return memp_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DGM_PLAN_GUEST_COUNT (AS_TRAN_ID char,AS_SUNDRY_TYPE char,AS_IEA_TAG char) return number is a_count number(5); a_count1 number(5); begin if (AS_SUNDRY_TYPE in ('E','R','U')) then select count(*) into a_count from strg_event_plan_guests where tran_id = AS_TRAN_ID and sundry_type = AS_SUNDRY_TYPE; elsif (AS_SUNDRY_TYPE = 'G') then select nvl(sum(nos_attended),0) into a_count from strg_event_plan_guests where tran_id = AS_TRAN_ID and sundry_type = AS_SUNDRY_TYPE; elsif (AS_SUNDRY_TYPE = 'F') then select count(*) into a_count from strg_event_plan_guests where tran_id = AS_TRAN_ID and sundry_type = AS_SUNDRY_TYPE and (faculty_type = AS_IEA_TAG or faculty_type = (case AS_IEA_TAG when 'S' then 'O' when 'C' then 'P' end)); elsif (AS_SUNDRY_TYPE = 'A') then select count(*) into a_count from strg_event_plan_guests where tran_id = AS_TRAN_ID and sundry_type in ('E','R','U','F'); select nvl(sum(nos_attended),0) into a_count1 from strg_event_plan_guests where tran_id = AS_TRAN_ID and sundry_type = 'G'; a_count := a_count + a_count1; end if; return a_count; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRAN_ID_T ON RECEIPT_FORM (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX CUST_GRPCUST ON CUSTOMER (GROUP_CODE, CUST_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TAXTRAN_TRAN_ID_TAX ON TAXTRAN (TRAN_ID, LINE_NO, TAX_CODE, TRAN_CODE, LINE_NO__TAX) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ENTITYCODEMASTERTABLE AS TABLE OF ENTITYCODEMASTER ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX VOUCHER_PURC_ORDER ON VOUCHER (PURC_ORDER, CONFIRMED, VOUCH_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_WP_TOTALCASES ( AS_PTCN IN VARCHAR2) RETURN NUMBER IS AS_TOTAL_CASES NUMBER(10); AS_TOTAL_CASES_1 NUMBER(10); AS_TOTAL_CASES_2 NUMBER(10); AS_TOTAL NUMBER(25); BEGIN SELECT COUNT(DISTINCT(b.carton_no)) INTO AS_TOTAL_CASES FROM wave_task_det a, pick_ord_det b, ITEM c WHERE a.ref_id = b.pick_order AND b.item_code = c.item_code AND A.REF_SER ='A-PICK' AND A.PTCN =AS_PTCN; SELECT SUM(b.no_art) INTO AS_TOTAL_CASES_1 FROM wave_task_det a, pick_ord_det b, ITEM_LOT_PACKSIZE c WHERE a.ref_id = b.pick_order AND b.item_code = c.item_code AND A.REF_SER IN('C-PICK','M-PICK','P-PICK') AND A.PTCN = AS_PTCN; SELECT SUM(b.no_art) INTO AS_TOTAL_CASES_2 FROM wave_task_det a, repl_ord_det b, ITEM_LOT_PACKSIZE c WHERE a.ref_id = b.repl_order AND b.item_code = c.item_code AND A.REF_SER IN('S-DOC','RS-DSO') AND A.PTCN = AS_PTCN; AS_TOTAL := nvl(AS_TOTAL_CASES,0) + nvl(AS_TOTAL_CASES_1,0) + nvl(AS_TOTAL_CASES_2,0); RETURN nvl(AS_TOTAL,0); END FN_GET_WP_TOTALCASES; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EMLOAN_SANCTION_X ON EMPLOAN_SANCTION (SANCTION_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPICK_RATE ( as_price_list IN CHAR, ad_tran_date IN DATE, as_item_code IN CHAR, as_lot_no IN CHAR, as_type IN CHAR) RETURN NUMBER IS mrate NUMBER(14,3); ls_type CHAR(1); BEGIN BEGIN SELECT list_type INTO ls_type FROM pricelist_mst WHERE price_list = as_price_list ; EXCEPTION WHEN OTHERS THEN ls_type := 'L'; END; IF ls_type = 'L' THEN SELECT rate INTO mrate FROM pricelist WHERE price_list = as_price_list AND item_code = as_item_code AND list_type = 'L' AND eff_from <= ad_tran_date AND valid_upto >= ad_tran_date AND rownum =1; elsif ls_type = 'B' THEN SELECT NVL(rate,0) INTO mrate FROM pricelist WHERE price_list = as_price_list AND item_code = as_item_code AND list_type = 'B' AND lot_no__from <= as_lot_no AND lot_no__to >= as_lot_no AND eff_from <= ad_tran_date AND valid_upto >= ad_tran_date AND rownum =1; END IF; RETURN mrate; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAY_IBCA_DATE_SITE_CODE_FROM ON PAY_IBCA (TRAN_DATE, SITE_CODE__FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BANK_SIGN_X ON BANK_SIGN (BANK_CODE, EMP_CODE, EFF_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SCONTRACT_ACT ON SCONTRACT (SITE_CODE, CUST_CODE, EFF_FROM, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_D1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_NEXT_PO_AUTH (E_Code Employee.Emp_Code%type, G_Code Employee.grade%type) RETURN Employee.Emp_Code%type IS T_Code Employee.Emp_Code%type := ''; BEGIN select reporting_to(E_Code, G_Code) into T_Code from dual; If T_Code is not Null Then Return T_Code; end if; Return T_Code; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ATTD_REG_ALLOWED_DAYS ( EMP in CHAR,attd_date in date ) Return varchar2 Is stat number; --stat number(5); as_value NUMBER; Begin as_value :=0; stat := 0; SELECT DDF_HR_SITE_ENV_VALUE(EMP,attd_date,'AR_WITHIN_DAYS') into as_value FROM DUAL; IF as_value > 0 THEN IF attd_date <= (sysdate-as_value) --if :new.attd_date not between trunc(sysdate,'MM')-9 AND last_day(sysdate) THEN stat := 1; END IF; END IF; Return stat; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_PLAN_QTY_GEO_LOC (as_geoloc char, as_itemcode char, as_prdcode char ) return number as ret_qty number(14,3); begin select nvl(sum(b.quantity),0) into ret_qty from salesforecast_hdr a, salesforecast_det b where a.tran_id = b.tran_id and exists (select '1' from site where a.site_code = site.site_code and site.geo_loc = as_geoloc ) and b.tran_id >= '0' and b.item_code = as_itemcode and b.prd_code__plan >= as_prdcode and b.prd_code__for = as_prdcode; return ret_qty; end ddf_inv_plan_qty_geo_loc; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITE_SALES_PARENT (ad_frdate in date, ad_todate in date, as_site_code in char, as_item_ser in char, as_item_code in char, as_flag in char) return number is lc_total number(14,2) ; begin if as_flag = 'N' then SELECT SUM(NVL(INVTRACE.EFF_QTY * -1,0)) INTO lc_total FROM INVTRACE, ITEM WHERE (INVTRACE.ITEM_CODE=ITEM.ITEM_CODE) and (INVTRACE.REF_SER IN ('S-DSP','S-RET')) AND (INVTRACE.EFF_DATE=ad_todate) AND (INVTRACE.SITE_CODE=as_site_code) and (ITEM.ITEM_SER=as_item_ser); elsif as_flag = 'Y' then SELECT sum(NVL(INVTRACE.EFF_QTY * -1,0)) INTO lc_total FROM INVTRACE, ITEM WHERE (INVTRACE.ITEM_CODE=ITEM.ITEM_CODE) and (item.item_parnt = as_item_code ) and (INVTRACE.REF_SER IN ('S-DSP','S-RET')) AND (INVTRACE.EFF_DATE >= ad_frdate) AND (INVTRACE.EFF_DATE <= ad_todate) AND (INVTRACE.SITE_CODE=as_site_code) and (ITEM.ITEM_SER=as_item_ser); end if; return lc_total ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORDER_AMD_NO ON PORDER (AMD_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PAYROLL_A ON PAYROLL (SITE_CODE__PAY, PRD_CODE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROJ_TEAM_CODE_X ON PROJ_TEAM (TEAM_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CREATUSER AFTER INSERT OR UPDATE ON USERS REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW declare ll_count number(3) := 0; BEGIN select count(1) into ll_count from autvis.users where code = :new.CODE; begin if ll_count = 0 then insert into AUTVIS.USERS ( CODE, NAME , PASS_WD , USR_LEV, DELAY_PRD, EMP_CODE , INI_PATH, STATUS , PROFILE_ID, EDI_ADDR , PROFILE_ID__HR_MANUAL, CHG_DATE, CHG_USER, CHG_TERM, USER_IID, MOBILE_NO, USER_TYPE, ENTITY_CODE, PASSWD_FREQ, LAST_PWD_CHGDATE, ASCERTAIN_ATTENDANCE, ACCT_LOCK, LOGIN_FIRST, GRACE_LOGIN_CNT, WRONG_LOGIN_CNT, VALID_UPTO, ACCESS_TYPE, RES_TYPE , SITE_CODE__DEF, RCP_CACHE_STATUS, PROFILE_ID__RES, PROFILE_ID__DISP, LOGGER_TYPE, RIA_CACHE_STATUS, ACC_PARM1, USER_LANG , USER_COUNTRY, PASS_WD_SHA , DEACTIVATE_DATE, EMAIL_ID, DEVICE_ID, ADDNL_SECURITY, TRANS_DB, USER_THEME, NO_SESSION_ALLOW, USER_ID, GEO_FENCE, USAGE_INTENSITY, ADDLN_SECURITY, UX_INTERFACE, DESIGNATION , ENTERPRISE, LOCATION, REPORT_TO, SEND_MAIL, GENDER, BIRTH_DATE, GOOGLE_REFRESH_TOKEN, USER_LIC_TYPE, ACTIVATION_CODE) values ( :new.CODE, :new.NAME , :new.PASS_WD , :new.USR_LEV, :new.DELAY_PRD, :new.EMP_CODE , :new.INI_PATH, :new.STATUS , :new.PROFILE_ID, :new.EDI_ADDR , :new.PROFILE_ID__HR_MANUAL, :new.CHG_DATE, :new.CHG_USER, :new.CHG_TERM, :new.USER_IID, :new.MOBILE_NO, :new.USER_TYPE, :new.ENTITY_CODE, :new.PASSWD_FREQ, :new.LAST_PWD_CHGDATE, :new.ASCERTAIN_ATTENDANCE, :new.ACCT_LOCK, :new.LOGIN_FIRST, :new.GRACE_LOGIN_CNT, :new.WRONG_LOGIN_CNT, :new.VALID_UPTO, :new.ACCESS_TYPE, :new.RES_TYPE , :new.SITE_CODE__DEF, :new.RCP_CACHE_STATUS, :new.PROFILE_ID__RES, :new.PROFILE_ID__DISP, :new.LOGGER_TYPE, :new.RIA_CACHE_STATUS, :new.ACC_PARM1, :new.USER_LANG , :new.USER_COUNTRY, :new.PASS_WD_SHA , :new.DEACTIVATE_DATE, :new.EMAIL_ID, :new.DEVICE_ID, :new.ADDNL_SECURITY, :new.TRANS_DB, :new.USER_THEME, :new.NO_SESSION_ALLOW, :new.USER_ID, :new.GEO_FENCE, :new.USAGE_INTENSITY, :new.ADDLN_SECURITY, :new.UX_INTERFACE, :new.DESIGNATION , :new.ENTERPRISE, :new.LOCATION, :new.REPORT_TO, :new.SEND_MAIL, :new.GENDER, :new.BIRTH_DATE, :new.GOOGLE_REFRESH_TOKEN, :new.USER_LIC_TYPE, :new.ACTIVATION_CODE); else update autvis.users set NAME = :new.NAME, USR_LEV = :new.USR_LEV , DELAY_PRD = :new.DELAY_PRD , EMP_CODE = :new.EMP_CODE , INI_PATH = :new.INI_PATH , STATUS = :new.STATUS , PROFILE_ID = :new.PROFILE_ID , EDI_ADDR = :new.EDI_ADDR , PROFILE_ID__HR_MANUAL = :new.PROFILE_ID__HR_MANUAL , USER_IID = :new.USER_IID , MOBILE_NO = :new.MOBILE_NO , USER_TYPE = :new.USER_TYPE , ENTITY_CODE = :new.ENTITY_CODE , PASSWD_FREQ = :new.PASSWD_FREQ , ASCERTAIN_ATTENDANCE = :new.ASCERTAIN_ATTENDANCE , ACCT_LOCK = :new.ACCT_LOCK , LOGIN_FIRST = :new.LOGIN_FIRST , GRACE_LOGIN_CNT = :new.GRACE_LOGIN_CNT , WRONG_LOGIN_CNT = :new.WRONG_LOGIN_CNT , VALID_UPTO = :new.VALID_UPTO , ACCESS_TYPE = :new.ACCESS_TYPE , RES_TYPE = :new.RES_TYPE , SITE_CODE__DEF = :new.SITE_CODE__DEF , PROFILE_ID__RES = :new.PROFILE_ID__RES, PROFILE_ID__DISP = :new.PROFILE_ID__DISP , LOGGER_TYPE = :new.LOGGER_TYPE , RIA_CACHE_STATUS = :new.RIA_CACHE_STATUS , ACC_PARM1 = :new.ACC_PARM1 , USER_LANG = :new.USER_LANG , USER_COUNTRY = :new.USER_COUNTRY , DEACTIVATE_DATE = :new.DEACTIVATE_DATE , EMAIL_ID = :new.EMAIL_ID , DEVICE_ID = :new.DEVICE_ID , ADDNL_SECURITY = :new.ADDNL_SECURITY , TRANS_DB = :new.TRANS_DB , USER_THEME = :new.USER_THEME , NO_SESSION_ALLOW = :new.NO_SESSION_ALLOW , USER_ID = :new.USER_ID , GEO_FENCE = :new.GEO_FENCE , USAGE_INTENSITY = :new.USAGE_INTENSITY , ADDLN_SECURITY = :new.ADDLN_SECURITY , UX_INTERFACE = :new.UX_INTERFACE , DESIGNATION = :new.DESIGNATION , ENTERPRISE = :new.ENTERPRISE where code = :new.CODE; end if; exception when others then null; end; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ITREFUND_AMT (p_empcode char,p_prdcd char,p_adcode1 char,p_adcode2 char,p_start_date date,p_end_date date) return Number is ll_amount number; Begin BEGIN Select sum(nvl(a.amount,0)) into ll_amount from payr_vouchdet a,payr_voucher b where b.tran_date between p_start_date and p_end_date and b.emp_code=p_empcode and b.confirmed = 'Y' and b.tran_id = a.tran_id and a.amount > 0 and ( a.ad_code = p_adcode1 or a.ad_code = p_adcode2) ; Exception When NO_DATA_FOUND then return 0; END; return ll_amount; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_POTAXENV (Ls_Supp_Code In Char, Ls_Site_Code In Char, ls_tax_env in char) return number Is Ln_Supp_State CHAR(5); ln_site_state CHAR(5); Begin Select Trim(State_Code) Into Ln_Supp_State From Supplier Where Supp_Code=Ls_Supp_Code; Select Trim(State_Code) Into Ln_Site_State From Site Where Site_Code=Ls_Site_Code; If Ln_Supp_State <> ln_site_state and ls_tax_env in ('PINC01','PIWC01','PRCMI01','PIMP01','SRI01','MIWC01','EIWC01','PICQ01') then Return 0; ElsIf Ln_Supp_State = ln_site_state and Ls_Tax_Env In ('PLNC01','PLWC01','PRCML01','SRL01','MLWC01','ELWC01','PLCQ01') Then Return 0; else Return 1; End If; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ORGINFO_ON_EMAIL (as_email strg_org.email_addr%type) return char IS ls_sorg_code strg_org.sorg_code%type; domain strg_org.email_addr%type; begin domain := SUBSTR(SUBSTR(as_email, INSTR(as_email, '@')), 1); if (domain = '@gmail.com' OR domain ='@yahoo.com' OR domain='@hotmail.com') then ls_sorg_code :=''; else select sorg_code into ls_sorg_code from strg_contact where sorg_code is not null and email_addr like '%'||domain||'%' and rownum=1; end if; return ls_sorg_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_MAX_TIME (AS_SC_CODE CHAR, AS_SALES_PERS CHAR, AS_DATE DATE, AS_CUST_TYPE VARCHAR2) RETURN VARCHAR2 IS LS_TIME VARCHAR2(15); LS_DATE DATE; LS_TRAN_ID VARCHAR2(20); BEGIN IF(AS_SC_CODE IS NOT NULL) THEN SELECT MAX(EVENT_DATE) INTO LS_DATE FROM STRG_MEET WHERE TRIM(STRG_CODE)=TRIM(AS_SC_CODE) AND TRIM(SALES_PERS)=TRIM(AS_SALES_PERS) AND TRIM(STRG_TYPE)=TRIM(AS_CUST_TYPE) AND TO_DATE(EVENT_DATE)<= TO_DATE(AS_DATE); RETURN TO_CHAR(TO_DATE(LS_DATE),'dd/MM/yy'); ELSIF (AS_SC_CODE IS NULL) THEN RETURN 'Not Met'; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN 'No Data Found'; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_DAR_REMARKS (ad_date dr_main.work_date%type, emp_code dr_main.sales_pers%type ) return char is ls_remarks dr_main.general_remark%type ; begin select general_remark into ls_remarks from dr_main where work_date = ad_date and sales_pers = emp_code ; return ls_remarks; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_GENCODE_DES (ls_fld_name in char, ls_mod_name in char, ls_fld_value in char) return char is ls_retval varchar2(120); begin select descr into ls_retval from gencodes where fld_name = ls_fld_name and mod_name = ls_mod_name and fld_value = ls_fld_value; return ls_retval; exception when too_many_rows then return ' '; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGROSS_RATE (as_site in varchar2,as_item in varchar2, as_loc in varchar2, as_lot in varchar2, as_option in varchar2) RETURN number is LL_RATE number (14,3); BEGIN IF AS_OPTION = 'G' THEN select nvl(gross_rate,0) into LL_RATE from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and rownum = 1 ; ELSE select nvl(rate,0) into LL_RATE from stock where site_code = as_site and item_code = as_item and loc_code = as_loc and lot_no = as_lot and rownum = 1 ; END IF; return LL_RATE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_TRAN_NAME_DESPATCH (AS_REPL_ORDER WAVE_TASK_DET.REF_ID%TYPE) RETURN varchar2 IS AS_TRAN_NAME TRANSPORTER.TRAN_NAME%TYPE; AS_PTCN WAVE_TASK_DET.PTCN%TYPE; AS_REF_ID WAVE_TASK_DET.REF_ID%TYPE; AS_TRAN_CODE TRANSPORTER.TRAN_CODE%TYPE; BEGIN SELECT PTCN INTO AS_PTCN FROM WAVE_TASK_DET WHERE REF_ID = AS_REPL_ORDER; SELECT REF_ID INTO AS_REF_ID FROM WAVE_TASK_DET WHERE PTCN = AS_PTCN AND REF_SER = 'S-DSP '; SELECT TRAN_CODE INTO AS_TRAN_CODE FROM DESPATCH WHERE DESP_ID = AS_REF_ID; SELECT TRAN_NAME INTO AS_TRAN_NAME FROM TRANSPORTER WHERE TRAN_CODE = AS_TRAN_CODE; RETURN AS_TRAN_NAME ; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN '' ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CONS_AMT ( as_tran_code in char, as_site_code in char, as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_dept_code in char, as_flag in char) return number is ac_con_amt number(14,3); ld_tran_date date; ls_var_value char(30); ls_fin_ent char(10); ll_count number(3); ls_SITE_CODE__BUDGET char(5); ls_anal_code char(5); ls_dept_code char(5); ls_cctr_code char(5); begin select SITE_CODE__BUDGET into ls_SITE_CODE__BUDGET from site where site_code = as_site_code; if length(trim(ls_SITE_CODE__BUDGET)) = 0 then ac_con_amt := -1; return ac_con_amt; end if; if ls_SITE_CODE__BUDGET is null then ac_con_amt := -1; return ac_con_amt; end if; select trunc(sysdate) into ld_tran_date from dual; --select budget_id into ls_var_value from site where site_code = ls_SITE_CODE__BUDGET; if as_anal_code iS NULL then ls_anal_code := ' '; else ls_anal_code := as_anal_code; end IF; IF as_dept_code IS NULL THEN ls_dept_code := ' '; else ls_dept_code := as_dept_code; END IF; IF as_cctr_code IS NULL THEN ls_cctr_code := ' '; else ls_cctr_code := as_cctr_code; END IF; begin if ltrim(rtrim(as_flag)) = 'A' then select con_amt into ac_con_amt from acctbudget where from_date <= ld_tran_date and to_date >= ld_tran_date --budget_id = ls_var_value --and trim(fin_entity) = substr(as_site_code,1,2) and acct_code = as_acct_code and cctr_code = ls_cctr_code and anal_code = ls_anal_code; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; elsif ltrim(rtrim(as_flag)) = 'D' then select con_amt into ac_con_amt from acctbudget where from_date <= ld_tran_date and to_date >= ld_tran_date --budget_id = ls_var_value --and TRIM(fin_entity) = substr(as_site_code,1,2) and acct_code = as_acct_code and cctr_code = ls_cctr_code and dept_code = ls_dept_code; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; else select SUM(con_amt) into ac_con_amt from acctbudget where from_date <= ld_tran_date and to_date >= ld_tran_date --budget_id = ls_var_value --and TRIM(fin_entity) = substr(as_site_code,1,2) and acct_code = as_acct_code and cctr_code = ls_cctr_code ; if ac_con_amt is null then ac_con_amt := 0; return ac_con_amt; end if; end if; EXCEPTION WHEN others then ac_con_amt := 0; return ac_con_amt; end; return ac_con_amt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX GLTRAN_PRD_CODE ON GLTRAN (PRD_CODE, SITE_CODE, ACCT_CODE, CCTR_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_ASSETPRINTINGCOST (as_item_code char) return number is prnt_area number(5) :=0; prnt_cost number(5) :=0; prnt_rate number(5) :=0; begin select (nvl(phy_attrib_8,0) * nvl(phy_attrib_9,0)) into prnt_area from item where item_code =as_item_code; select (nvl(phy_attrib_8,0) * nvl(phy_attrib_9,0)) into prnt_area from item where item_code =as_item_code; select nvl(b.rate,0) into prnt_rate from taxset a, taxrate b where a.tax_set = b.tax_set and a.tax_code='PRNT1'; prnt_cost:= prnt_area*prnt_rate; return prnt_cost; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VOUCH_REF_ID_123 (lsref_ser char,lsref_id char) return varchar2 is ls_no varchar2(5000); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_ATTD_MONTH_PRD (ld_attd_date date, ls_emp_code char) return number is li_return_value number(1); ls_attd_result attendance_day.result%type; ls_prd_code period.code%type; ld_period_to_date date; li_addon_days attendance_mon.addon_days%type; ld_processed_date date; li_row_count number(9); begin li_return_value := 0; li_addon_days := 0; select result into ls_attd_result from attendance_day where emp_code = ls_emp_code and attd_date = ld_attd_date; if(ls_attd_result is not null and length(trim(ls_attd_result)) > 0) then select count(1) into li_row_count from period, attendance_mon where period.fr_date <= ld_attd_date and period.to_date >= ld_attd_date and attendance_mon.emp_code = ls_emp_code and attendance_mon.prd_code = period.code; if(li_row_count > 0) then select period.code, period.to_date, case when attendance_mon.addon_days is null then 0 else attendance_mon.addon_days end into ls_prd_code, ld_period_to_date, li_addon_days from period, attendance_mon where period.fr_date <= ld_attd_date and period.to_date >= ld_attd_date and attendance_mon.emp_code = ls_emp_code and attendance_mon.prd_code = period.code; ld_processed_date := ld_period_to_date - li_addon_days; if(ld_processed_date >= ld_attd_date) then li_return_value := 1; else li_return_value := 0; end if; else li_return_value := 0; end if; else li_return_value := 0; end if; return li_return_value; exception when NO_DATA_FOUND then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECKWORKINGDAY (as_site_code in char, as_date in date) return date AS lc_date date; lc_count number:= 0; as_date_temp date := to_date(as_date)+1; begin begin dbms_output.put_line('---------------checkWorkingDay FUNCTION CALLED-----------------'); select count(a.hol_date) INTO lc_count from holiday a,site b where a.hol_tblno = b.hol_tblno and a.hol_date = as_date_temp AND nvl(trim(a.hol_type),'$')!='$' and b.site_code=as_site_code; dbms_output.put_line('-lc_count-'||lc_count); if lc_count > 0 then lc_date:=checkWorkingDay(as_site_code,to_date(as_date_temp)); else lc_date:= as_date_temp; end if; return lc_date; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CONS_AMT_EXP ( as_tran_code in char, as_site_cd in char, as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_flag in char) return number is ac_con_amt number(14,3); ld_tran_date date; ls_var_value char(30); ls_fin_ent char(10); ll_count number(3); ls_sitecode char(5); begin if as_tran_code = 'E-PAY' then -- select tran_date ,substr(site_code,1,2),site_code into ld_tran_date, ls_fin_ent, ls_sitecode from payment_exp where tran_id = as_tran_id; ld_tran_date := to_date(sysdate); ls_sitecode := as_site_cd; select fin_entity into ls_fin_ent from site where site_code = as_site_cd; end if ; if ld_tran_date is null then ac_con_amt := -1 ; return ac_con_amt; end if; select var_value into ls_var_value from finparm where var_name = 'ACTIVE_BUDGET'; if ls_var_value is null then ac_con_amt := -1; return ac_con_amt; end if; begin if ltrim(rtrim(as_flag)) = 'A' then select SUM(case when a.con_amt is null then 0 else a.con_amt end) into ac_con_amt from acctbudget a, budgets b where a.budget_id = b.budget_id and a.from_date <= ld_tran_date and a.to_date >= ld_tran_date and a.site_code = ls_sitecode and a.acct_code = as_acct_code and a.cctr_code = as_cctr_code and a.anal_code = as_anal_code and b.def_budget = 'Y' ; elsif ltrim(rtrim(as_flag)) = 'D' then select (case when a.con_amt is null then 0 else a.con_amt end) into ac_con_amt from acctbudget a, budgets b where a.budget_id = b.budget_id and a.from_date <= ld_tran_date and a.to_date >= ld_tran_date and a.site_code = ls_sitecode and a.acct_code = as_acct_code and a.cctr_code = as_cctr_code and b.def_budget = 'Y'; else select sum(case when a.con_amt is null then 0 else a.con_amt end) into ac_con_amt from acctbudget a, budgets b where a.budget_id = b.budget_id and a.from_date <= ld_tran_date and a.to_date >= ld_tran_date and a.site_code = ls_sitecode and a.acct_code = as_acct_code and a.cctr_code = as_cctr_code and b.def_budget = 'Y' ; end if; EXCEPTION WHEN NO_DATA_FOUND then ac_con_amt := 0; return ac_con_amt; end; return ac_con_amt; exception when no_data_found then ac_con_amt := -1; return ac_con_amt ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_DBOARD (as_prdcode in char,lsite_code in char, lacct_code in char, as_loginsite in char) return NUMBER is lc_day_op_bal NUMBER(14,3) := 0; lc_prd_op_bal NUMBER(14,3) := 0; ls_prd char(6); ls_acctprd char(6); ls_fent char(10); mfr_date date; ldate_fr date; begin begin select acct_prd, code, fr_date into ls_acctprd, ls_prd, mfr_date from period where code = as_prdcode ;--- ldate_fr between fr_date and to_date; exception when others then null; end; ldate_fr := mfr_date; if lsite_code is null or length(trim(lsite_code)) > 0 then begin select fin_entity into ls_fent from site where site_code = lsite_code; exception when others then null; end; else begin select fin_entity into ls_fent from site where site_code = as_loginsite; exception when others then null; end; end if; begin if lsite_code is null or length(trim(lsite_code)) > 0 then select NVL(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and acct_code = lacct_code; else select NVL(sum(dr_amt__base - cr_amt__base),0) into lc_prd_op_bal from acctbal where acct_prd = ls_acctprd and prd_code < ls_prd and fin_entity = ls_fent and site_code = lsite_code and acct_code = lacct_code; end if; exception when others then lc_prd_op_bal := 0; end; -- lc_prd_op_bal:= nvl(lc_prd_op_bal,0); begin if lsite_code is null or length(trim(lsite_code)) > 0 then Select NVL(Sum(dr_amt - cr_amt),0) into lc_day_op_bal from gltran where tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code and FIN_ENTITY = ls_fent and ACCT_PRD = ls_acctprd; else Select NVL(Sum(dr_amt - cr_amt),0) into lc_day_op_bal from gltran where site_code= lsite_code and tran_date >= mfr_date and tran_date < ldate_fr and acct_code = lacct_code and FIN_ENTITY = ls_fent and ACCT_PRD = ls_acctprd; end if; exception when others then lc_day_op_bal := 0; end; --lc_day_op_bal := nvl(lc_day_op_bal,0); lc_day_op_bal := lc_prd_op_bal + lc_day_op_bal; Return lc_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SORDER_SCHEME_UNIQ ON SORDER_SCHEME (TRAN_ID, SCHEME_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_QCSITITMLOTSTAT ON QC_ORDER (SITE_CODE, ITEM_CODE, LOT_NO, STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_ALLOC_WORK_ORD_CONF ON INV_ALLOCATE (WORK_ORDER, CONFIRMED) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CHK_STK ( AS_SITE_CODE CHAR, AS_LOT_NO CHAR, AS_LOT_SL CHAR, AS_LOC_CODE CHAR , AS_ITEM_CODE CHAR, AS_ISS_TYPE CHAR) RETURN NUMBER IS LC_COUNT NUMBER ( 14,3); BEGIN IF AS_ISS_TYPE = 'A' THEN -- CHECK SELECT COUNT(1) INTO LC_COUNT FROM STOCK WHERE SITE_CODE = AS_SITE_CODE AND ITEM_CODE = AS_ITEM_CODE AND LOC_CODE = AS_LOC_CODE AND LOT_NO = AS_LOT_NO AND LOT_SL = AS_LOT_SL ; ELSE LC_COUNT := 1 ; END IF ; RETURN LC_COUNT ; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHECK_VALID_LOC (SITE_CODE_IN IN CHAR, LOC_CODE_IN IN CHAR ) RETURN number is FLAG number ; CNT NUMBER; facilityCodeSite char(10) ; facilityCodeLoc char(10) ; BEGIN BEGIN SELECT FACILITY_CODE INTO facilityCodeSite FROM SITE WHERE SITE_CODE = SITE_CODE_IN; SELECT FACILITY_CODE INTO facilityCodeLoc FROM LOCATION WHERE LOC_CODE = LOC_CODE_IN; if facilityCodeSite is null then facilityCodeSite := ' '; end if; IF (nvl(facilityCodeSite,'N') <> 'N' AND nvl(facilityCodeLoc,'N') <> 'N') THEN IF( facilityCodeSite = facilityCodeLoc) THEN FLAG := 1; ELSE FLAG := 0 ; END IF; ELSE FLAG :=3; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG :=2; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_DESP_PACK_DET_X ON DESP_PACK_DET (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_TOT_GROSS_AMT (GRN_NO IN CHAR,TRAN_TYPE IN CHAR,EXCH_RATE IN NUMBER) return NUMBER IS lc_amt_bal NUMBER(14,3); BEGIN select SUM(PORCPDET.QUANTITY * PORCPDET.RATE * EXCH_RATE ) into lc_amt_bal FROM PORCPDET WHERE TRAN_ID=GRN_NO; return lc_amt_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_IS_VALID_PICK_ORDER (PICK_ORDER IN CHAR) RETURN CHAR is FLAG CHAR; HOLD_STATUS CHAR; CANCEL_STATUS CHAR; BEGIN BEGIN SELECT W.HOLD_STATUS ,W.CANCEL INTO HOLD_STATUS , CANCEL_STATUS FROM WAVE_TASK W,WAVE_TASK_DET D WHERE W.WAVE_ID = D.WAVE_ID AND D.REF_ID = PICK_ORDER; IF( HOLD_STATUS = 'Y') THEN FLAG := 'N'; RETURN FLAG; ELSE FLAG := 'Y'; END IF; IF( CANCEL_STATUS = 'Y') THEN FLAG := 'N'; RETURN FLAG; ELSE FLAG := 'Y'; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN FLAG := 'F'; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHECK_SORD_AMT BEFORE insert or UPDATE OF confirmed ON sordamd FOR EACH ROW declare lc_totordvalue number(14,3) := 0; lc_tottax number(14,3) := 0; lc_totnet number(14,3) := 0; lc_totordamt number(14,3) := 0; lc_totordvalueH number(14,3) := 0; lc_tottaxH number(14,3) := 0; lc_totnetH number(14,3) := 0; lc_totordamtH number(14,3) := 0; BEGIN if :NEW.confirmed = 'Y' and :old.confirmed = 'N' then begin select tot_ord_value,tax_amt,tot_amt, ord_amt into lc_totordvalueH, lc_tottaxH,lc_totnetH, lc_totordamtH from sorder where sale_order = :new.sale_order; exception when others then lc_totordvalueH := 0; lc_tottaxH := 0; lc_totnetH := 0; lc_totordamtH := 0; end; begin select sum(ord_value),sum(tax_amt), sum((quantity__stduom * rate__stduom)-((quantity__stduom * rate__stduom * discount)/100)+tax_Amt) into lc_totordvalue, lc_tottax,lc_totnet from sorddet where sale_order = :new.sale_order; exception when others then lc_totordvalue := 0; lc_tottax := 0; lc_totnet := 0; end; lc_totordamt := lc_totnet - lc_tottax; if abs(lc_totordamt - lc_totordamtH) > 1 or abs(lc_totordvalue - lc_totordvalueH) > 1 or abs(lc_tottax - lc_tottaxH) > 1 or abs(lc_totnet - lc_totnetH) > 1 then raise_application_error( -20601, 'Sum of sales order detail amount not matching with header Heade order value [' || to_char(lc_totordvalue) || '] line total value [' || to_char(lc_totordvalue) ||'] Header tax [' || to_char(lc_tottaxH) ||'] line total tax [' || to_char(lc_tottax) ||'] Total amount header [' || to_char(lc_totnetH) ||'] line total [' || to_char(lc_totnet) ||']'); end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER SPRSACTTRAN_SETPKVAL before insert or update on sprs_act_tran for each row begin if :new.dcr_id is null or length(trim(:new.dcr_id)) = 0 then select substr( '0000000000' || sprsactttran_seq.nextval , -10 ) into :new.dcr_id from dual; end if; if :new.tran_id is null or length(trim(:new.tran_id)) = 0 then :new.tran_id := :new.dcr_id; end if; :new.tran_id := :new.tran_id; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_STATE4 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_state varchar2(25); begin SELECT DESCR into as_state FROM ( SELECT STATE.DESCR FROM STATE, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE SITE.STATE_CODE=STATE.STATE_CODE AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_4.POOL_CODE) = TRIM(as_pool_code) UNION select STATE.DESCR FROM STATE, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_4.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE SITE.STATE_CODE=STATE.STATE_CODE AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER ); return as_state; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE ORDERLINENOMASTER AS OBJECT ( line_no__ord NUMBER(3), item_code char(10), quantity number(14,3), UNIT char(3), item_descr VARCHAR2(120) ) -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPICK_RATE_PL ( as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char) return number is mrate number(14,3); ls_type pricelist.list_type%type; begin select list_type into ls_type from pricelist where price_list = as_price_list and rownum = 1; if ls_type = 'L' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'L' and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; elsif ls_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date; end if; return mrate; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_STATE3 (as_item_ser in char, as_pool_code in varchar2) return varchar2 is as_state varchar2(25); begin SELECT DESCR into as_state FROM ( SELECT STATE.DESCR FROM STATE, SITE, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST, INVOICE, ITEMSER WHERE SITE.STATE_CODE=STATE.STATE_CODE AND LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND INVOICE.CUST_CODE = ORG_CUST.CUST_CODE AND INVOICE.ITEM_SER = LEVEL_5.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO AND INVOICE.SITE_CODE = SITE.SITE_CODE AND INVOICE.TRAN_DATE BETWEEN ORG_CUST.EFF_DATE AND ORG_CUST.VALID_UPTO AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_3.POOL_CODE) = TRIM(as_pool_code) UNION select STATE.DESCR FROM STATE, SITE, ( SELECT LEVEL_5.POOL_CODE POOLCODE_5,ITEMSER.ITEM_SER ITEM_SER FROM ITEMSER, ORG_STRUCTURE LEVEL_1, ORG_STRUCTURE LEVEL_2, ORG_STRUCTURE LEVEL_3, ORG_STRUCTURE LEVEL_4, ORG_STRUCTURE LEVEL_5, ORG_STRUCTURE_CUST ORG_CUST WHERE LEVEL_5.POS_CODE__REPTO = LEVEL_4.POS_CODE AND LEVEL_4.POS_CODE__REPTO = LEVEL_3.POS_CODE AND LEVEL_3.POS_CODE__REPTO = LEVEL_2.POS_CODE AND LEVEL_2.POS_CODE__REPTO = LEVEL_1.POS_CODE AND LEVEL_5.POS_CODE = ORG_CUST.POS_CODE AND LEVEL_5.VERSION_ID = ORG_CUST.VERSION_id AND LEVEL_5.TABLE_NO = ORG_CUST.TABLE_NO and ORG_CUST.TABLE_NO = ITEMSER.ITEM_SER AND LEVEL_5.LEVEL_NO = 5 AND LEVEL_5.ACTIVE = 'Y' AND ITEMSER.ITEM_SER = as_item_ser AND TRIM(LEVEL_3.POOL_CODE) = TRIM(as_pool_code) ) A, SALES_BUDGET SB WHERE SITE.STATE_CODE=STATE.STATE_CODE AND SB.SITE_CODE__SALES = SITE.SITE_CODE AND A.POOLCODE_5=SB.LEVEL_CODE AND A.ITEM_SER=SB.ITEM_SER ); return as_state; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PEROD_TBL_FR_DATE ON PERIOD_TBL (FR_DATE, TO_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION HRAPPL_STATION_DESCR ( ls_site_code CHAR, ls_stan_code CHAR) RETURN VARCHAR2 IS ls_descr VARCHAR2(40); BEGIN SELECT descr INTO ls_descr FROM station WHERE stan_code = ls_stan_code AND active ='Y'; RETURN (NVL(ls_descr,'')); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CENVAT_DET ( ls_tran_id in varchar2,ls_exch number , ls_flag in char ) return varchar2 is ls_ret varchar2(15) ; ls_amt decimal(12,2) ; ls_amt1 decimal(12,2); ls_sr_no varchar2(15) ; ls_tran_date varchar2(15) ; begin SELECT SRNO,CENV_DATE,SUM(CENV_AMT),SUM(CENV_CESS_AMT) into ls_sr_no,ls_tran_date,ls_amt ,ls_amt1 FROM (select tax_processed.sr_no SRNO , to_char(tax_processed.tran_date,'dd/mm/yy') CENV_DATE, case when (tax_processed.bal_group) LIKE 'CEN%' then sum(nvl(tax_processed.adj_amt,0)* ls_exch ) end CENV_AMT, case when (tax_processed.bal_group) LIKE 'CES%' then sum(nvl(tax_processed.adj_amt,0)* ls_exch ) end CENV_CESS_AMT from tax_processed where tax_processed.ref_id IN ( ls_tran_id) group by tax_processed.sr_no, tax_processed.bal_group, to_char(tax_processed.tran_date,'dd/mm/yy')) GROUP BY SRNO,CENV_DATE ; if ls_flag = 'SR' then ls_ret := ls_sr_no; elsif ls_flag = 'DT' then ls_ret := ls_tran_date ; elsif ls_flag = 'AM' then ls_ret := to_char(ls_amt ); elsif ls_flag = 'AM1' then ls_ret := to_char(ls_amt1); end if ; return ls_ret; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DRUG_LIC ( as_var_name char ,as_fin_ent char, as_site_code char) return char is ls_reg_no char (500); mvar_value char (25); as_var_name1 char (25); as_fin_ent1 char (25); as_site_code1 char (25); begin if as_var_name is null or length(as_var_name) = 0 then as_var_name1 := '' ; else as_var_name1 := as_var_name; end if; if as_fin_ent is null or length(as_fin_ent) = 0 then as_fin_ent1 := '' ; else as_fin_ent1 := as_fin_ent ; end if; if as_site_code is null or length(as_site_code) = 0 then as_site_code1 := '' ; else as_site_code1 := as_site_code; end if; select var_value into mvar_value from disparm where prd_code = '999999' and var_name = as_var_name; select reg_no || ' ' || to_char(reg_date,'dd/mm/yy') into ls_reg_no from siteregno where fin_entity = as_fin_ent and site_code = as_site_code and ref_code = mvar_value; if ls_reg_no is not null then return ls_reg_no; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MDRCRRCP_IBCA BEFORE INSERT OR UPDATE OF confirmed ON misc_drcr_rcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_ibcacount number(3) := 0; ls_sitecodercp char(5); ls_ibcagen varchar2(600); ll_mcount number := 0; ll_recvamt number := 0; BEGIN if :new.confirmed = 'Y' and :new.amount <> 0 then begin select trim(var_value) into ls_ibcagen from finparm where prd_code = '999999' and var_name = 'INV_IBCA_GEN'; exception when others then ls_ibcagen := 'Y'; end; if ls_ibcagen is null then ls_ibcagen := 'Y'; end if; if ls_ibcagen = 'Y' then begin select tot_amt - adj_amt into ll_recvamt from receivables where tran_ser in ('MDRCRD','MDRCRC') and ref_no = :new.tran_id; exception when others then ll_recvamt := 0; end; if(ll_recvamt <> 0) then begin select count(1) into ll_mcount from site_customer where site_code = :new.site_code and cust_code = :new.sundry_code; exception when others then ll_mcount := 0; end; if ll_mcount > 0 then begin select site_code__rcp into ls_sitecodercp from site_customer where site_code = :new.site_code and cust_code = :new.sundry_code; exception when others then null; end; else begin select c.site_code__rcp into ls_sitecodercp from customer c where c.cust_code = :new.sundry_code; exception when others then ls_sitecodercp := :new.site_code; end; end if; if ls_sitecodercp is null or length(trim(ls_sitecodercp)) = 0 then ls_sitecodercp := :new.site_code; end if; if trim(:new.site_code) <> trim(ls_sitecodercp) then begin select count(1) into ll_ibcacount from receivables where tran_ser = 'R-IBCA' and ref_no = :new.tran_id and site_code = ls_sitecodercp ; exception when others then ll_ibcacount := 0; end; if ll_ibcacount = 0 then raise_application_error( -20601, 'IBCA not created receipt site [' || ls_sitecodercp || '] voucher site [' || :new.site_code || ']' ); end if; end if; end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GL_DRAMT (as_ref_id in varchar ,as_ref_ser in varchar ) return number is lc_dr_sum number(14,3); begin Select nvl(sum(gltrace.dr_amt * gltrace.exch_rate),0) into lc_dr_sum from gltrace where ref_id =as_ref_id and ref_ser=as_ref_ser; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SM_SALES_CUST_ITEM_SER ON SM_SALES_CUST (PRD_CODE, ITEM_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_LOTSL1 (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, as_lot_sl in char, lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select min(a.crea_date) into ldt_crea_date from stock a, invstat b where a.inv_stat = b.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.lot_sl = as_lot_sl and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b where a.inv_stat = b.inv_stat and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and a.lot_sl = as_lot_sl and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and a.site_code = lsite_code and a.item_code = litem_code and a.tran_date > ad_from_date and a.lot_no = llot_no and a.lot_sl = as_lot_sl and instr(lavailable,c.available) > 0); return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_EMPSERAMD_RETDT BEFORE INSERT OR UPDATE ON EMP_SERVICEPRD_AMD REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW DECLARE LD_BIRTH_DATE EMPLOYEE.BIRTH_DATE%TYPE; BEGIN SELECT BIRTH_DATE INTO LD_BIRTH_DATE FROM EMPLOYEE WHERE EMP_CODE = :NEW.EMP_CODE; IF INSERTING OR NVL(:NEW.RETIREMENT_DATE_O,TRUNC(SYSDATE)) <> NVL(:OLD.RETIREMENT_DATE_O,TRUNC(SYSDATE)) THEN IF :NEW.RETIREMENT_DATE_O IS NOT NULL AND EXTRACT(YEAR FROM :NEW.RETIREMENT_DATE_O) < 2000 THEN IF NVL(:NEW.RETIREMENT_AGE_O , 0) = 0 AND LD_BIRTH_DATE IS NOT NULL THEN :NEW.RETIREMENT_DATE_O := LD_BIRTH_DATE; ELSE :NEW.RETIREMENT_DATE_O := ADD_MONTHS(:NEW.RETIREMENT_DATE_O , 1200); END IF; END IF; END IF; IF INSERTING OR NVL(:NEW.RETIREMENT_DATE_N,TRUNC(SYSDATE)) <> NVL(:OLD.RETIREMENT_DATE_N,TRUNC(SYSDATE)) THEN IF :NEW.RETIREMENT_DATE_N IS NOT NULL AND EXTRACT(YEAR FROM :NEW.RETIREMENT_DATE_N) < 2000 THEN IF NVL(:NEW.RETIREMENT_AGE_N , 0) = 0 AND LD_BIRTH_DATE IS NOT NULL THEN :NEW.RETIREMENT_DATE_N := LD_BIRTH_DATE; ELSE :NEW.RETIREMENT_DATE_N := ADD_MONTHS(:NEW.RETIREMENT_DATE_N , 1200); END IF; END IF; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITE_ADDRESS (msite_Code char) return varchar is ls_address varchar(150); begin select case when add1 is null then '' else add1 end || chr(10) || case when add2 is null then '' else add2 end ||chr(10) || case when city is null then '' else city end || case when pin is null then '' else ' - ' || pin end || chr(10) || case when state_code is null then '' else state_code end into ls_address from site where site_code = msite_code; return ls_address; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER PORCP_AFTER_UPD_CONF AFTER UPDATE of confirmed ON PORCP FOR EACH ROW DECLARE CONFVAL CHAR(1); REFCOUNT NUMBER(10,2) DEFAULT 0; BEGIN SELECT COUNT(REF_ID) INTO REFCOUNT FROM DWH_TRAN_LOAD WHERE REF_ID=:NEW.TRAN_ID AND REF_SER=:new.TRAN_SER ; CONFVAL:=:NEW.CONFIRMED; IF(CONFVAL = 'Y' AND REFCOUNT = 0) THEN -- Insert record into DWH_TRAN_LOAD table INSERT INTO DWH_TRAN_LOAD ( REF_ID, REF_SER, REF_DATE, UPDATE_STAT ) VALUES ( :new.TRAN_ID, :new.TRAN_SER, :new.TRAN_DATE, 'P' ); END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PRICELIST__XX ON PRICELIST (PRICE_LIST, ITEM_CODE, UNIT, LIST_TYPE, EFF_FROM, VALID_UPTO, LOT_NO__FROM, LOT_NO__TO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_217_GROSS_SAL (ls_emp_code char) return number is lc_gross number(12,3); lc_gross1 number(12,3); lc_basic number(12,3); lc_plenc number(12,3); lc_exem_amt number(12,3); begin select sum(nvl(amount,0)) into lc_gross1 from employee_ad where emp_code = ls_emp_code and ad_code in ('BAS','HRA','CCA','KIT','SPL','DIS','SUPPL','TNG','TRANS','MED','CON','HELPA','PPA','UNI') and exp_date > sysdate; select amount into lc_exem_amt from it_calcdet where acct_prd ='201011' and emp_code = ls_emp_code and ad_code ='IT4HR'; select nvl(amount,0) into lc_basic from employee_ad where emp_code = ls_emp_code and ad_code ='BAS' and exp_date > sysdate; --- select nvl(sum(a.amount),0) into lc_plenc from employee_mthad a, acctprd b --- where a.emp_code = ls_emp_code -- and a.ad_code ='PLENC' -- and b.code = ls_acct_prd -- and a.eff_date between b.fr_date and b.to_date; -- dbms_output.put_line(lc_plenc); -- return round((lc_gross+(lc_basic*0.20)+(lc_basic*0.0833)+(lc_basic*.12)+lc_plenc),0); lc_gross := (lc_gross1-(lc_exem_amt/12)); return round((lc_gross+(lc_basic*0.20)+(lc_basic*0.0833)+(lc_basic*.12)),0); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DRCRRCP_IBCA BEFORE INSERT OR UPDATE OF confirmed ON drcr_rcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_ibcacount number(3) := 0; ls_sitecodercp char(5); ls_ibcagen varchar2(600); ll_mcount number := 0; ll_recvamt number := 0; BEGIN if :new.confirmed = 'Y' and :new.amount <> 0 then begin select trim(var_value) into ls_ibcagen from finparm where prd_code = '999999' and var_name = 'INV_IBCA_GEN'; exception when others then ls_ibcagen := 'Y'; end; if ls_ibcagen is null then ls_ibcagen := 'Y'; end if; if ls_ibcagen = 'Y' then begin select tot_amt - adj_amt into ll_recvamt from receivables where tran_ser in ('DRNRCP','CRNRCP') and ref_no = :new.tran_id; exception when others then ll_recvamt := 0; end; if(ll_recvamt <> 0) then begin select count(1) into ll_mcount from site_customer where site_code = :new.site_code and cust_code = :new.cust_code; exception when others then ll_mcount := 0; end; if ll_mcount > 0 then begin select site_code__rcp into ls_sitecodercp from site_customer where site_code = :new.site_code and cust_code = :new.cust_code; exception when others then null; end; else begin select c.site_code__rcp into ls_sitecodercp from customer c where c.cust_code = :new.cust_code; exception when others then ls_sitecodercp := :new.site_code; end; end if; if ls_sitecodercp is null or length(trim(ls_sitecodercp)) = 0 then ls_sitecodercp := :new.site_code; end if; if trim(:new.site_code) <> trim(ls_sitecodercp) then begin select count(1) into ll_ibcacount from receivables where tran_ser = 'R-IBCA' and ref_no = :new.tran_id and site_code = ls_sitecodercp ; exception when others then ll_ibcacount := 0; end; if ll_ibcacount = 0 then raise_application_error( -20601, 'IBCA not created receipt site [' || ls_sitecodercp || '] voucher site [' || :new.site_code || ']' ); end if; end if; end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX BENEFIT_TRACE_X1 ON BENEFIT_TRACE (ADJ_TYPE, BENEFIT_TYPE, BENEFIT_NO, LINE_NO__BENEFIT, REF_SER, REF_NO, LINE_NO__REF) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_DPI2 (iss_qty number,batch_size number,fill_weight number,actual_assay number,without_salt number,salt_form number) return number is potency_adj number(14,6); total_iss_qty number(14,6); begin total_iss_qty :=(iss_qty*batch_size*1000*100*salt_form)/(fill_weight*actual_assay*without_salt*1000); potency_adj := (total_iss_qty - iss_qty); return( potency_adj ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_DPI1 (iss_qty number,batch_size number,fill_weight number,actual_assay number) return number is potency_adj number(14,6); total_iss_qty number(14,6); begin total_iss_qty :=(iss_qty*batch_size*1000*100)/(fill_weight*1000*actual_assay); potency_adj := (total_iss_qty - iss_qty); return( potency_adj ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETSSCATTACHMENTCOUNT (as_tran_id in char) return number is tot_count number(14,3); begin begin SELECT count(*) into tot_count FROM SUPPLIER_BILL WHERE VOUCHER_NO = as_tran_id; exception WHEN no_data_found then tot_count := 0; when OTHERS THEN tot_count := 0; END; return tot_count ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_INVLOTNOPREF (as_lot_no__pref CHAR,as_item_code CHAR,as_site_code CHAR) return number IS ls_retval NUMBER(1) :=1; ls_lot_no__pref CHAR; lc_cnt number(3) :=0; stk_cnt number :=0; begin if(as_lot_no__pref is not null) then declare cursor c_lvetrace IS SELECT REGEXP_SUBSTR(as_lot_no__pref, '[^,]+', 1, level) as ls_lot_no__pref FROM dual CONNECT BY REGEXP_SUBSTR(as_lot_no__pref, '[^,]+', 1, level) IS NOT NULL; begin for i in c_lvetrace loop --raise_application_error( -20601, 'value of as_item_code is.. [' || as_item_code || ']'); select count(*) into stk_cnt from stock where lot_no = i.ls_lot_no__pref and item_code = as_item_code and site_code = as_site_code; --raise_application_error( -20601, 'value of ls_lot_no__pref is.. [' || i.ls_lot_no__pref || ']'); if(stk_cnt=0)then ls_retval := 0; RETURN ls_retval; else ls_retval :=1; --RETURN ls_retval; end if; --stop_loop := ls_retval>1; end loop; END; else ls_retval :=1; end if; RETURN ls_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_UPD_STOCK_TARE_WEIGHT (as_site stock.site_code%type) return number is ld_tare_weight inv_pack_rcp.tare_weight%type; ls_item_code inv_pack_rcp.item_code%type; ls_loc_code inv_pack_rcp.loc_code%type; ls_lot_no inv_pack_rcp.lot_no%type; ls_lot_sl inv_pack_rcp.lot_sl%type; cursor c1 is select distinct item_code, loc_code, lot_no, lot_sl, tare_weight from inv_pack, inv_pack_rcp where inv_pack.tran_id = inv_pack_rcp.tran_id and inv_pack_rcp.unit = 'KGS' and inv_pack.site_code = as_site and inv_pack_rcp.item_code like 'P%'; begin open c1 ; loop fetch c1 into ls_item_code, ls_loc_code, ls_lot_no, ls_lot_sl, ld_tare_weight; exit when c1%notfound; update stock set tare_weight = ld_tare_weight where site_code = as_site and item_code = ls_item_code and loc_code = ls_loc_code and lot_no = ls_lot_no and lot_sl = ls_lot_sl and unit = 'KGS' ; end loop; close c1; commit; return 1; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDER_CUST_PORD ON SORDER (CUST_PORD, PORD_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_UOM_SH_DESCR (as_unit char) return varchar2 is ls_uom_sh_descr varchar2(20); begin select sh_descr into ls_uom_sh_descr from uom where unit = as_unit ; return ls_uom_sh_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MISC_PAYABLES_DUE_DT_SITE_CODE ON MISC_PAYABLES (DUE_DATE, SITE_CODE, SUNDRY_TYPE, SUNDRY_CODE, TRAN_SER, ACCT_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_IND_REQ_DET_TRANFLOW (as_IND_no char) return varchar2 is v_str varchar2(10000); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select trim(a.descr) || ' (' || trim(a.item_code) || ')' as descr ,b.QUANTITY ,b.max_rate,b.req_date from item a ,indent_det b where a.item_code = b.item_code and b.ind_no=as_ind_no; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2,v_str_tmp3; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''||v_str_tmp3||''|| ''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Max rate'||''||''||'Required on'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE VISTPLANMASTERTABLE AS TABLE OF visitPlanMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX SORDER_TEMP_ORD_DATE ON SORDER_TEMP (ORDER_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RRCPDISHNR_TOT (as_sitecode in char,as_cust_code__from in char, as_cust_code__to in char,as_date__from in date,as_date__to in date) return NUMBER is ldec_total NUMBER(14,3); begin select sum(case when rcpdishnr.net_amt is null then 0 else rcpdishnr.net_amt end - case when rcpdishnr.bank_charges is null then 0 else rcpdishnr.bank_charges end) into ldec_total from rcpdishnr, customer, receipt, site where rcpdishnr.cust_code = customer.cust_code and rcpdishnr.receipt_no = receipt.tran_id and rcpdishnr.site_code = site.site_code and rcpdishnr.confirmed = 'Y' AND rcpdishnr.site_code = as_sitecode AND rcpdishnr.cust_code >= as_cust_code__from AND rcpdishnr.cust_code <= as_cust_code__to AND rcpdishnr.tran_date >= as_date__from AND rcpdishnr.tran_date <= as_date__to; return ldec_total; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_RT12 (lsite_code in char, litem_code in char, llot_no in char, ad_from_date in date, ltype in char, lavailable in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin if ltype = 'I' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (SELECT sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.eff_date > ad_from_date and a.ref_ser not in ('QC-ORD','I-PKI','I-PKR','XFRX') and instr(lavailable,c.available) > 0); end if; if ltype = 'B' then /* select min(a.crea_date) into ldt_crea_date from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 ; if ad_from_date < ldt_crea_date then return 0; end if; */ select sum(qty) into ld_eff_qty from (select sum(a.quantity) qty from stock a, invstat b , location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.lot_no = llot_no and instr(lavailable, b.available) > 0 union all select nvl((sum(eff_qty) * -1),0) qty from invtrace a, location b, invstat c where a.site_code = lsite_code and a.item_code = litem_code and a.lot_no = llot_no and a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.eff_date > ad_from_date and a.ref_ser not in ('QC-ORD','I-PKI','I-PKR','XFRX') and instr(lavailable,c.available) > 0); end if; if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITEDESCR (ls_itemcode in char, ls_lot_no in char) return number is ls_descr varchar2(60); ls_sitecode_own varchar2(60); ls_sitedesr varchar2(60); begin select item_lot_packsize.site_code__own , site.udf1 into ls_sitecode_own , ls_sitedesr from item_lot_packsize ,site where ( item_lot_packsize.site_code__own = site.site_code (+)) and item_lot_packsize.item_code = ls_itemcode and item_lot_packsize.lot_no__from <= ls_lot_no and item_lot_packsize.lot_no__to >= ls_lot_no and rownum = 1 ; if ls_sitecode_own is null then ls_descr := 'Master not Defined '; else ls_descr := ls_sitedesr; end if ; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_FORMATTED_DUE_STR ( as_status IN CHAR, as_status_date IN DATE, as_add_date IN DATE, as_exp_date IN DATE) RETURN VARCHAR2 IS cnt VARCHAR2(100); ls_fmt_string VARCHAR2(100); BEGIN IF as_status = 'P' then --for Pending Status SELECT CASE WHEN ( TRUNC(SYSDATE) - TRUNC(as_add_date) ) = 0 AND TRUNC((SYSDATE - as_add_date) * 24) = 0 THEN 'Overdue since ' || TRUNC((SYSDATE - as_add_date) * 24 * 60) || ' minutes' WHEN ( TRUNC(SYSDATE) - TRUNC(as_add_date) ) = 0 THEN 'Overdue since ' || TRUNC((SYSDATE - as_add_date) * 24) || ' hours' WHEN ( TRUNC(SYSDATE) - TRUNC(as_add_date) ) = 1 THEN 'Overdue since Yesterday' WHEN ( TRUNC(SYSDATE) - TRUNC(as_add_date) ) > 1 THEN 'Overdue since ' || ( TRUNC(SYSDATE) - TRUNC(as_add_date) ) || ' days' ELSE 'Overdue since ' || trunc(months_between(as_exp_date,as_add_date)) || ' months' END INTO ls_fmt_string FROM DUAL; END IF; IF as_status='C' THEN --for Complete Status SELECT CASE WHEN ( TRUNC(as_status_date) - TRUNC(as_add_date) ) = 0 THEN 'Started ' || TO_CHAR( as_add_date, 'hh:mi am') || ' - Ended ' || TO_CHAR( as_status_date, 'hh:mi am') || ' on ' || TO_CHAR( as_status_date, 'dd/mm/yy') ELSE 'Started ' || TO_CHAR( as_add_date, 'hh:mi am') || ' on ' || TO_CHAR( as_add_date, 'dd/mm/yy') || ' - Ended ' || TO_CHAR( as_status_date, 'hh:mi am') || ' on ' || TO_CHAR( as_status_date, 'dd/mm/yy') END INTO ls_fmt_string FROM DUAL; END IF; IF as_exp_date is not null THEN --for Expired SELECT ' Not Completed ' into ls_fmt_string FROM DUAL; END IF; RETURN ls_fmt_string; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_TRANS_HIERARCHY ON TRANS_HIERARCHY (REF_ID, REF_SER, REF_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX RECRSL_APPT_ID ON RECRSL (APPT_LETTER_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_BILL_AMT (as_ref_id in char, as_refser in char) return number is ln_bill_amt number(14,3); begin if trim(as_refser) = 'M-VOUC' then select bill_amt into ln_bill_amt from misc_voucher where tran_id = as_ref_id ; elsif trim(as_refser) = 'VOUCH' then select bill_amt into ln_bill_amt from voucher where tran_id = as_ref_id ; end if; if ln_bill_amt is null then ln_bill_amt := 0; end if; return ln_bill_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION WRAPE_LEAVES (PAR_VAL IN VARCHAR2, EMP_CODE IN CHAR, POS IN INT, SPACE_LVE IN VARCHAR2) RETURN NUMBER IS BALDAYS NUMBER(7,1); LV_CODE VARCHAR2(20); BEGIN SELECT DDF_GET_LEAVES(PAR_VAL, SPACE_LVE, POS) INTO LV_CODE FROM DUAL; --SELECT AVAILBAL_LV_1(LV_CODE,EMP_CODE) INTO BALDAYS FROM DUAL; SELECT DDF_GET_LEAVEBAL(EMP_CODE,LV_CODE,TO_DATE(SYSDATE)) INTO BALDAYS FROM DUAL; RETURN BALDAYS; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX GRADE_ALLOW_X ON GRADE_ALLOW (STATION_TYPE, GRADE_CODE, ALLOW_CODE, EFFECTIVE_FROM) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX TRV_ALLOWANCE_X ON TRV_ALLOWANCE (ALLOW_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DET_ORGUNIT_DESCR (as_orgUnit in char ,as_orgUnit_type in char) RETURN VARCHAR2 AS ls_descr varchar2(50); BEGIN if(as_orgUnit_type='I') then select descr into ls_descr from itemser where item_ser=as_orgUnit; end if; if(as_orgUnit_type='S') then select descr into ls_descr from site where site_code=as_orgUnit; end if; if(as_orgUnit_type='D') then select descr into ls_descr from department where dept_code=as_orgUnit; end if; return ls_descr; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX OBJ_SIGN_TRANS_REF_SER_STATUS ON OBJ_SIGN_TRANS (REF_SER, SIGN_STATUS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCP_TRAN_DATE_SITE_CODE ON PORCP (TRAN_DATE, SITE_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DRCRPAY_IBCA BEFORE INSERT OR UPDATE OF confirmed ON drcr_pay referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_ibcacount number(3) := 0; ls_sitecodepay char(5); ll_mcount number := 0; BEGIN if :new.confirmed = 'Y' and :new.amount <> 0 then -- 1. check pay site begin select count(1) into ll_mcount from site_supplier where site_code = :new.site_code and supp_code = :new.supp_code; exception when others then ll_mcount := 0 ; end; if ll_mcount > 0 then begin select site_code__pay into ls_sitecodepay from site_supplier where site_code = :new.site_code and supp_code = :new.supp_code; exception when others then null; end; else begin select s.site_code__pay into ls_sitecodepay from supplier s where s.supp_code = :new.supp_code; exception when others then ls_sitecodepay := :new.site_code; end; end if; if ls_sitecodepay is null or length(trim(ls_sitecodepay)) = 0 then ls_sitecodepay := :new.site_code; end if; if trim(:new.site_code) <> trim(ls_sitecodepay) then begin select count(1) into ll_ibcacount from misc_payables where tran_ser = 'P-IBCA' and ref_no = :new.tran_id and site_code = ls_sitecodepay ; /* select count(1) into ll_ibcacount from pay_ibca_det where ref_ser = 'M-VOUC' and ref_no = :new.tran_id;*/ exception when others then ll_ibcacount := 0; end; if ll_ibcacount = 0 then raise_application_error( -20601, 'IBCA not created pay site [' || ls_sitecodepay || '] voucher site [' || :new.site_code || ']' ); end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX BRANCH_X ON BRANCH (CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_R_REFSER_ENTITY (as_ref_ser in char,as_ref_id in char) Return Char is code_descr varchar(150); Begin If as_ref_ser = 'D-ISS' Then Select Concat(Concat(Distord_Iss.Site_Code__Dlv,' - '),Site.Descr) into code_descr From Distord_Iss inner Join Site on Distord_Iss.Site_Code__Dlv = Site.Site_Code where Distord_Iss.tran_ser = as_ref_ser and Distord_Iss.tran_id = as_ref_id ; ElsIf as_ref_ser = 'C-ISS' Then Select Concat(Trim(Consume_Iss.Emp_Code),concat(Concat(' - ',trim(Employee.Emp_FName)),concat(Concat(' ',trim(Employee.Emp_MName)),Concat(' ',trim(Employee.Emp_LName))))) into code_descr From Consume_Iss inner Join Employee on Consume_Iss.Emp_Code = Employee.Emp_Code where Consume_Iss.Cons_Issue = as_ref_id ; ElsIf as_ref_ser = 'S-DSP' Then Select Concat(Concat(Despatch.Cust_Code,' - '),Customer.Cust_Name) into code_descr From Despatch inner Join Customer on Despatch.Cust_Code = Customer.Cust_Code where Desp_id = as_ref_id ; ElsIf as_ref_ser = 'S-RET' Then Select Concat(Concat(SReturn.Cust_Code,' - '),Customer.Cust_Name) into code_descr From SReturn inner Join Customer on SReturn.Cust_Code = Customer.Cust_Code where SReturn.Tran_id = as_ref_id ; ElsIf (as_ref_ser = 'P-RCP' OR as_ref_ser = 'P-RET') Then Select Concat(Concat(Porcp.Supp_Code,' - '),Supplier.Supp_Name) into code_descr From Porcp inner Join Supplier on Porcp.Supp_Code = Supplier.Supp_Code where Porcp.Tran_Ser = as_ref_ser and Porcp.Tran_id = as_ref_id ; Else code_descr := ''; End If; Return code_descr; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_HOLTBLNO (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select eff_date,conf_date,chg_date,hol_tblno__fr from emp_employ_events where emp_code = AS_EMP_CODE and eff_date > AS_DATE and confirmed = 'Y' order by emp_code,eff_date; a_hol_tblno employee.hol_tblno%type; a_eff_date date; a_conf_date date; a_chg_date date; begin for i in c1 loop if (i.eff_date != a_eff_date and a_eff_date is not null) then exit; end if; if (a_conf_date is null) then a_hol_tblno := i.hol_tblno__fr; a_conf_date := i.conf_date; a_chg_date := i.chg_date; else if (i.conf_date < a_conf_date) then a_hol_tblno := i.hol_tblno__fr; a_conf_date := i.conf_date; a_chg_date := i.chg_date; elsif (i.conf_date = a_conf_date) then if (i.chg_date < a_chg_date) then a_hol_tblno := i.hol_tblno__fr; a_chg_date := i.chg_date; end if; end if; end if; a_eff_date := i.eff_date; end loop; if (trim(a_hol_tblno) is null) then select hol_tblno into a_hol_tblno from employee where emp_code = AS_EMP_CODE; end if; if (trim(a_hol_tblno) is null) then select hol_tblno into a_hol_tblno from site where site_code = ddf_hr_status(AS_EMP_CODE,AS_DATE,'W'); end if; return a_hol_tblno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_MFG_SUPPNAME_CODE (as_tran_id char,as_line_no number,as_flag char,as_flag_rnd char) return varchar2 is ls_supp_code varchar2(40); begin if as_flag_rnd='D' then if as_flag='C' then select supp_code into ls_supp_code from supplier where supp_code in (select stock.supp_code__mfg from workorder, workorder_iss, workorder_issdet, stock, bom, bomdet WHERE ( workorder.work_order = workorder_iss.work_order ) and ( workorder_iss.tran_id = workorder_issdet.tran_id ) and ( workorder_iss.site_code = stock.site_code ) and ( workorder_issdet.item_code = stock.item_code ) and ( workorder_issdet.loc_code = stock.loc_code ) and ( workorder_issdet.lot_no = stock.lot_no ) and ( workorder_issdet.lot_sl = stock.lot_sl ) and ( workorder.bom_code = bom.bom_code ) and ( bom.bom_code = bomdet.bom_code ) and ( ( bomdet.item_code is not null or bomdet.supp_code__mfg is not null )) and ( workorder_issdet.TRAN_ID = as_tran_id ) and ( workorder_issdet.line_no = as_line_no )); elsif as_flag='N' then select supp_name into ls_supp_code from supplier where supp_code in (select stock.supp_code__mfg from workorder, workorder_iss, workorder_issdet, stock, bom, bomdet WHERE ( workorder.work_order = workorder_iss.work_order ) and ( workorder_iss.tran_id = workorder_issdet.tran_id ) and ( workorder_iss.site_code = stock.site_code ) and ( workorder_issdet.item_code = stock.item_code ) and ( workorder_issdet.loc_code = stock.loc_code ) and ( workorder_issdet.lot_no = stock.lot_no ) and ( workorder_issdet.lot_sl = stock.lot_sl ) and ( workorder.bom_code = bom.bom_code ) and ( bom.bom_code = bomdet.bom_code ) and ( ( bomdet.item_code is not null or bomdet.supp_code__mfg is not null )) and ( workorder_issdet.TRAN_ID = as_tran_id ) and ( workorder_issdet.line_no = as_line_no )); end if; elsif as_flag_rnd='R' then if as_flag='C' then select supp_code into ls_supp_code from supplier where supp_code in (select stock.supp_code__mfg from workorder, WORDER_ISS_RND, WORDER_ISSdet_RND, stock, bom, bomdet WHERE ( workorder.work_order = WORDER_ISS_RND.work_order ) and ( WORDER_ISS_RND.tran_id = WORDER_ISSdet_RND.tran_id ) and ( WORDER_ISS_RND.site_code = stock.site_code ) and ( WORDER_ISSdet_RND.item_code = stock.item_code ) and ( WORDER_ISSdet_RND.loc_code = stock.loc_code ) and ( WORDER_ISSdet_RND.lot_no = stock.lot_no ) and ( WORDER_ISSdet_RND.lot_sl = stock.lot_sl ) and ( workorder.bom_code = bom.bom_code ) and ( bom.bom_code = bomdet.bom_code ) and ( ( bomdet.item_code is not null or bomdet.supp_code__mfg is not null )) and ( WORDER_ISSdet_RND.TRAN_ID = as_tran_id ) and ( WORDER_ISSdet_RND.line_no = as_line_no )); elsif as_flag='N' then select supp_name into ls_supp_code from supplier where supp_code in (select stock.supp_code__mfg from workorder, WORDER_ISS_RND, WORDER_ISSdet_RND, stock, bom, bomdet WHERE ( workorder.work_order = WORDER_ISS_RND.work_order ) and ( WORDER_ISS_RND.tran_id = WORDER_ISSdet_RND.tran_id ) and ( WORDER_ISS_RND.site_code = stock.site_code ) and ( WORDER_ISSdet_RND.item_code = stock.item_code ) and ( WORDER_ISSdet_RND.loc_code = stock.loc_code ) and ( WORDER_ISSdet_RND.lot_no = stock.lot_no ) and ( WORDER_ISSdet_RND.lot_sl = stock.lot_sl ) and ( workorder.bom_code = bom.bom_code ) and ( bom.bom_code = bomdet.bom_code ) and ( ( bomdet.item_code is not null or bomdet.supp_code__mfg is not null )) and ( WORDER_ISSdet_RND.TRAN_ID = as_tran_id ) and ( WORDER_ISSdet_RND.line_no = as_line_no )); end if; end if; return ls_supp_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RWSSCORE_DOC_TWICE_NOV (as_sales_pers char, as_from_date date, as_to_date date) return number is ls_return number (14,0); begin begin select count(*) into ls_return from (SELECT sm.strg_code, COUNT(SM.STRG_CODE) as as_count FROM STRG_MEET SM JOIN SALES_PERS S ON SM.SALES_PERS = S.SALES_PERS WHERE SM.EVENT_DATE BETWEEN as_from_date AND as_to_date AND sm.sales_pers=as_sales_pers and SM.STRG_TYPE = 'D' AND SM.STRG_CLASS_CODE = 'E' AND S.ITEM_SER ='OTC' group by sm.strg_code having COUNT(SM.STRG_CODE) >1 )a ; exception when no_Data_found then ls_return:=0; end; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION CHECHMOBILE ( p_whatsapp_mobile IN VARCHAR2 --(1.WHATSAPP_MOBILE) ) RETURN NUMBER IS -- Object Name: applicant_mgmt_applicant_info -- Event Type: field_validation -- Form Number: 1 -- Field Name: WHATSAPP_MOBILE -- Business Logic: length must be 10 -- Function Name: chechMobile BEGIN -- Check if the length of the mobile number is exactly 10 IF LENGTH(p_whatsapp_mobile) = 10 THEN RETURN 1; -- Valid mobile number ELSE RETURN 0; -- Invalid mobile number END IF; END chechMobile; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_INVOICE_IBCA BEFORE INSERT OR UPDATE OF confirmed ON invoice referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_ibcacount number(3) := 0; ls_sitecodercp char(5); ls_ibcagen varchar2(600); ll_mcount number := 0; ll_recvamt number := 0; BEGIN if :new.confirmed = 'Y' and :new.net_amt <> 0 then begin select trim(var_value) into ls_ibcagen from finparm where prd_code = '999999' and var_name = 'INV_IBCA_GEN'; exception when others then ls_ibcagen := 'Y'; end; if ls_ibcagen is null then ls_ibcagen := 'Y'; end if; if ls_ibcagen = 'Y' then begin select tot_amt - adj_amt into ll_recvamt from receivables where tran_ser = 'S-INV' and ref_no = :new.invoice_id ; exception when others then ll_recvamt := 0; end; if(ll_recvamt <> 0) then begin select count(1) into ll_mcount from site_customer where site_code = :new.site_code and cust_code = :new.cust_code; exception when others then ll_mcount := 0; end; if ll_mcount > 0 then begin select site_code__rcp into ls_sitecodercp from site_customer where site_code = :new.site_code and cust_code = :new.cust_code; exception when others then null; end; else begin select c.site_code__rcp into ls_sitecodercp from customer c where c.cust_code = :new.cust_code; exception when others then ls_sitecodercp := :new.site_code; end; end if; if ls_sitecodercp is null or length(trim(ls_sitecodercp)) = 0 then ls_sitecodercp := :new.site_code; end if; if trim(:new.site_code) <> trim(ls_sitecodercp) then begin select count(1) into ll_ibcacount from receivables where tran_ser = 'R-IBCA' and ref_no = :new.invoice_id and site_code = ls_sitecodercp ; exception when others then ll_ibcacount := 0; end; if ll_ibcacount = 0 then raise_application_error( -20601, 'IBCA not created receipt site [' || ls_sitecodercp || '] voucher site [' || :new.site_code || ']' ); end if; end if; end if; end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE BRANCODEMASTER AS OBJECT ( BRAND_CODE char (10), BRAND_DESCR VARCHAR2(60), visited_with_team CHAR(10) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_REG_NO (lsundry_type in char,lsundry_code in char,ltype in char) return char is ls_regno varchar(160); begin if lsundry_type ='O' then ls_regno := ' '; elsif lsundry_type ='S' then if ltype = 'L' then select tax_reg into ls_regno from supplier where supp_code = lsundry_code; elsif ltype = 'C' then select cst_no into ls_regno from supplier where supp_code = lsundry_code; elsif ltype = 'P' then select pan_no into ls_regno from supplier where supp_code = lsundry_code; elsif ltype = 'R' then select ser_tax_reg into ls_regno from supplier where supp_code = lsundry_code; elsif ltype = 'E' then select ecc_no into ls_regno from supplier where supp_code = lsundry_code; elsif ltype = 'H' then select CHQ_NAME into ls_regno from supplier where supp_code = lsundry_code; end if; elsif lsundry_type ='R' then if ltype = 'R' then select ser_tax_reg into ls_regno from strg_customer where sc_code = lsundry_code; elsif ltype = 'P' then select pan_no into ls_regno from strg_customer where sc_code = lsundry_code; elsif ltype = 'H' then select chq_name into ls_regno from strg_customer where sc_code = lsundry_code; elsif ltype = 'L' then ls_regno:='NA' ; end if; elsif lsundry_type ='C' then if ltype = 'L' then select lst_no into ls_regno from customer where cust_code = lsundry_code; elsif ltype = 'C' then select cst_no into ls_regno from customer where cust_code = lsundry_code; elsif ltype = 'P' then select tax_reg_3 into ls_regno from customer where cust_code = lsundry_code; elsif ltype = 'R' then select ser_tax_reg into ls_regno from customer where cust_code = lsundry_code; elsif ltype = 'E' then select ecc_no into ls_regno from customer where cust_code = lsundry_code; end if; elsif lsundry_type ='B' then if ltype = 'R' then select ser_tax_reg into ls_regno from bank where bank_code = lsundry_code; end if; elsif lsundry_type ='E' then if ltype = 'P' then select it_no into ls_regno from employee where emp_code = lsundry_code; end if; elsif lsundry_type ='P' then if ltype = 'P' then select pan_no into ls_regno from sales_pers where sales_pers = lsundry_code; elsif ltype = 'R' then select ser_tax_reg into ls_regno from sales_pers where sales_pers = lsundry_code; end if; elsif lsundry_type ='T' then if ltype = 'P' then select pan_no into ls_regno from transporter where tran_code = lsundry_code; elsif ltype = 'R' then select ser_tax_reg into ls_regno from transporter where tran_code = lsundry_code; end if; end if; return ls_regno; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_DESP_DET_TRANFLOW (as_despid char) return varchar2 is v_str varchar2(32767); type rc is ref cursor; v_str_tmp varchar2(1000); v_str_tmp1 varchar2(1000); v_str_tmp2 varchar2(1000); v_str_tmp3 varchar2(1000); lc_cnt number(3); c rc; begin begin lc_cnt := 0; open c for select a.descr,b.QUANTITY ,b.rate__stduom from item a ,despatchdet b where a.item_code = b.item_code and b.desp_id=as_despid and rownum <= 20; loop fetch c into v_str_tmp,v_str_tmp1,v_str_tmp2; exit when c%notfound; v_str := v_str||''||''||v_str_tmp||''||''||v_str_tmp1||''||''||v_str_tmp2||''||''; end loop; V_STR:=SUBSTR(V_STR,1,LENGTH(V_STR)); V_STR:=''||''|| ' Item Description '||''||''||'Quantity'||''||''||'Rate'||''||''||V_STR; exception when no_data_found then v_str:=' '; end; close c; return v_str; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EMP_APROVE_NAME (lsref_ser char ,lsref_id char, ls_call char) return char is ls_name char(80); ls_chgcode char(20); ls_empcode char(20); begin if lsref_ser = 'JOUR' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from journal where tran_id = lsref_id; elsif lsref_ser = 'VOUCH' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from voucher where tran_id = lsref_id; elsif lsref_ser = 'F-XFR ' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from fundtransfer where tran_id = lsref_id; elsif lsref_ser = 'S-INV' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from invoice where invoice_id = lsref_id; elsif lsref_ser = 'M-GEN' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_vouch_gen where tran_id = lsref_id; elsif lsref_ser = 'M-VOUC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_voucher where tran_id = lsref_id; elsif lsref_ser = 'M-PAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_payment where tran_id = lsref_id; elsif lsref_ser = 'DRNPAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_pay where tran_id = lsref_id; elsif lsref_ser = 'CRNPAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_pay where tran_id = lsref_id; elsif lsref_ser = 'DRNRCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'CRNRCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'MDRCRD' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'MDRCRC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_drcr_rcp where tran_id = lsref_id; elsif lsref_ser = 'E-PAY' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from payment_exp where tran_id = lsref_id; elsif lsref_ser = 'MPCANC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_payment_canc where tran_id = lsref_id; elsif lsref_ser = 'M-RCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from misc_receipt where tran_id = lsref_id; elsif lsref_ser = 'P-RCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from PORCP where tran_id = lsref_id; elsif lsref_ser = 'P-RET' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from PORCP where tran_id = lsref_id; elsif lsref_ser = 'P-VOUC' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from payr_voucher where tran_id = lsref_id; elsif lsref_ser = 'RCP' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from receipt where tran_id = lsref_id; elsif lsref_ser = 'R-DIS' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from rcpdishnr where tran_id = lsref_id; elsif lsref_ser = 'R-IBCA' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from rcp_ibca where tran_id = lsref_id; elsif lsref_ser = 'P-IBCA' then select emp_code__aprv , chg_user into ls_empcode , ls_chgcode from pay_ibca where tran_id = lsref_id; end if; if ls_call = 'E' then -- selecting user name from user table select emp_code into ls_empcode from users where code = ls_chgcode; end if; select ltrim(rtrim(NVL(emp_fname,''))) ||' '|| ltrim(rtrim(NVL(emp_mname,'')))||' '||ltrim(rtrim(NVL(emp_lname,''))||' ' ||'('||ltrim(rtrim(emp_code))||')') into ls_name from employee where emp_code = ls_empcode ; return ls_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_CENVAT (as_tran_id in char,as_flag in char) return varchar2 is ls_tran varchar2(20); ls_prcp_id char(10) ; begin select distinct prcp_id into ls_prcp_id from vouchrcp where tran_id= as_tran_id; if as_flag ='A' then select max(tran_date) into ls_tran from tax_processed where tax_processed.ref_id =ls_prcp_id; else select max(substr(sr_no,6,10)) into ls_tran from tax_processed where tax_processed.ref_id = ls_prcp_id; end if; return ls_tran; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCK_SOLD (lsite_code in char,litem_code in char,ad_from_date in date, ad_to_date in date, linstate IN char) return number is ld_tot_qty number(14,3); ls_bomcode char(10); ls_itembom char(10); ld_quantity number(14,3); ld_itemdet_qty number(14,3); ld_bom_qty number(14,3); ld_prop_qty number(14,3); ls_work_state char(5); cursor cur_bom_code is select distinct(BOM.ITEM_code) from bomdet, BOM where BOMDET.BOM_CODE = BOM.BOM_CODE AND BOMDET.item_code = litem_code group by BOM.ITEM_code; begin ld_tot_qty := 0; select station.state_code into ls_work_state from station,site where station.stan_code = site.stan_code and site.site_code = lsite_code; open cur_bom_code; LOOP fetch cur_bom_code into ls_itembom; EXIT when cur_bom_code%notfound; select NVL(bom_code,' ') into ls_bomcode from siteitem where item_code = ls_itembom and site_code = lsite_code; if nvl(length(trim(ls_bomcode)),0) = 0 then select bom_code into ls_bomcode from item where item_code = ls_itembom; end if; select nvl(bom.batch_qty,0) into ld_bom_qty from bom where bom_code = ls_bomcode; select sum(nvl(bomdet.qty_per,0)) into ld_itemdet_qty from bomdet where bom_code = ls_bomcode and bomdet.item_code = litem_code; if linstate = 'Y' then select sum(NVL(despatchdet.quantity,0)) into ld_quantity from despatchdet,despatch,station where despatchdet.desp_id = despatch.desp_id and despatch.stan_code = station.stan_code and despatch.site_code = lsite_code and despatchdet.item_code = ls_itembom and station.state_code = ls_work_state and despatch.desp_date >= ad_from_date and despatch.desp_date <= ad_to_date and despatch.confirmed = 'Y'; else select sum(nvl(despatchdet.quantity,0)) into ld_quantity from despatchdet,despatch,station where despatchdet.desp_id = despatch.desp_id and despatch.stan_code = station.stan_code and despatch.site_code = lsite_code and station.state_code <>ls_work_state and despatchdet.item_code = ls_itembom and despatch.desp_date >= ad_from_date and despatch.desp_date <= ad_to_date and despatch.confirmed = 'Y'; end if; ld_prop_qty := (ld_itemdet_qty/ld_bom_qty) * nvl(ld_quantity,0); ld_tot_qty := ld_tot_qty + ld_prop_qty; END LOOP; close cur_bom_code; return (ld_tot_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_IND_ORD_QTY (ls_ind in char) return number is ld_qty number(14,3); begin select nvl(sum(quantity),0) into ld_qty from porddet where ind_no = ls_ind; return(ld_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_CONV_QTY (SI_SALE_ORDER IN CHAR, SI_LINE_NO IN CHAR ) RETURN number is FLAG number ; quantity NUMBER; qtyDesp NUMBER; quantityAlloc NUMBER; convQtyStdU NUMBER; UNIT char(3); BEGIN BEGIN SELECT QUANTITY,qty_alloc,QTY_DESP,CONV__QTY_STDQTY,UNIT INTO quantity,quantityAlloc,qtyDesp,convQtyStdU,UNIT FROM SORDITEM WHERE SALE_ORDER = SI_SALE_ORDER AND TRIM(LINE_NO) = TRIM(SI_LINE_NO); FLAG := ((quantity * convQtyStdU)-(qtyDesp * convQtyStdU)-quantityAlloc ); EXCEPTION WHEN NO_DATA_FOUND THEN FLAG :=2; END; RETURN FLAG; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCP_PO_CONF ON PORCP (PURC_ORDER, CONFIRMED, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_NET_AMT_UP (as_tran_id char, as_phy_attrib char,flag char,as_flag char) return number is as_amt number (14,3); begin if flag='A' then if as_flag ='FOOD' then select sum(net_amt) into as_amt from porcpdet,item where porcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib); elsif as_flag ='MED' then select sum(net_amt) into as_amt from porcpdet,item where porcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib); end if ; elsif flag='B' then if as_flag ='FOOD' then select sum(net_amt) into as_amt from distord_issdet,item where distord_issdet.item_code =item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib ); elsif as_flag ='MED' then select sum(net_amt) into as_amt from distord_issdet,item where distord_issdet.item_code =item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib ); end if; elsif flag='C' then if as_flag ='FOOD' then select sum(net_amt) into as_amt from Distord_rcpdet ,item where Distord_rcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib ); elsif as_flag ='MED' then select sum(net_amt) into as_amt from Distord_rcpdet ,item where Distord_rcpdet.item_code=item.item_code and tran_id = as_tran_id and (item.phy_attrib_15 = as_phy_attrib ); end if; end if; return as_amt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PAYPARM_VALUE (AS_VAR_NAME VARCHAR2, AS_PRDCODE VARCHAR2) RETURN varchar2 is as_var_value varchar2(300); begin SELECT VAR_VALUE into as_var_value FROM PAYRPARM WHERE RTrim(PRD_CODE) = AS_PRDCODE AND RTrim(VAR_NAME) = AS_VAR_NAME; RETURN AS_VAR_VALUE; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CREDITAMT_TRANSLINK (ls_sreturn char) return NUMBER is LS_AMOUNT NUMBER(14,3); LS_INVOICE CHAR(10); begin select invoice_id into ls_invoice from sreturn where tran_id=ls_sreturn; if TRIM(LENGTH(ls_invoice)) =0 then select amount into ls_amount from misc_drcr_rcp where sreturn_no=ls_sreturn; else select amount into ls_amount from drcr_rcp where sreturn_no=ls_sreturn; end if; return ls_amount; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EXP_DATE (as_site_code stock.site_code%type, as_item_code stock.item_code%type, as_loc_code stock.loc_code%type, as_lot_no stock.lot_no%type,as_lot_sl stock.lot_sl%type ) return date is ldt_exp_date stock.exp_date%type; begin select exp_date into ldt_exp_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.loc_code = as_loc_code and stock.lot_no = as_lot_no and stock.lot_sl = as_lot_sl; if sqlcode = 100 and ((as_lot_sl) is null or length(trim(as_lot_sl)) = 0 ) or (as_loc_code is null or length(trim(as_loc_code)) = 0) then if as_lot_sl is null or length(trim(as_lot_sl)) = 0 then select min(exp_date) into ldt_exp_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.loc_code = as_loc_code and stock.lot_no = as_lot_no; elsif as_loc_code is null or length(trim(as_loc_code)) = 0 then select min(exp_date) into ldt_exp_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.lot_no = as_lot_no and stock.lot_sl = as_lot_sl; elsif as_loc_code is null or length(trim(as_loc_code)) = 0 and as_lot_sl is null or length(trim(as_lot_sl)) = 0 then select min(exp_date) into ldt_exp_date from stock where stock.quantity > 0 and stock.site_code = as_site_code and stock.item_code = as_item_code and stock.lot_no = as_lot_no; end if; end if; return ldt_exp_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE PICKRATETABLE AS TABLE OF pickRate; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LEAVE_APP_TYPE ( AS_EMP_CODE CHAR, AS_LEAVE_CODE CHAR, AS_USE_FLAG CHAR) RETURN VARCHAR2 IS LS_APP_TYPE VARCHAR2(10); LS_VAR_VALUE VARCHAR2 (200); LS_SPLIT_DATA1 VARCHAR2 (100); LS_COUNT1 NUMBER(10); LS_COUNT2 NUMBER(10); LS_COUNT3 NUMBER(10); type A_CURSOR1 IS ref CURSOR; type A_CURSOR2 IS ref CURSOR; A_CRR1 A_CURSOR1; A_CRR2 A_CURSOR2; BEGIN SELECT ddf_hr_site_env_value(as_emp_code,sysdate,'LEAVE_HR_APR') INTO ls_var_value FROM dual; IF LS_VAR_VALUE = ' ' THEN ls_app_type := 'LEAVE'; else ls_app_type := 'LEAVE'; OPEN A_CRR1 FOR 'SELECT REGEXP_SUBSTR('''||LS_VAR_VALUE||''', ''[^,]+'', 1, LEVEL) FROM dual CONNECT BY REGEXP_SUBSTR('''||LS_VAR_VALUE||''', ''[^,]+'', 1, LEVEL) IS NOT NULL'; <> loop fetch a_crr1 into ls_split_data1; exit when a_crr1%notfound; IF A_CRR1%found THEN select instr(ls_split_data1,AS_LEAVE_CODE||':') INTO LS_COUNT1 from dual; IF (LS_COUNT1 > 0) THEN select instr(ls_split_data1,':'||AS_USE_FLAG) INTO LS_COUNT2 from dual; IF (LS_COUNT2 > 0) THEN select instr(ls_split_data1,':',1,3) INTO LS_COUNT3 from dual; IF (LS_COUNT3 = 0) THEN LS_APP_TYPE:='LEAVE'; RETURN LS_APP_TYPE; ELSIF (LS_COUNT3 > 0) THEN LS_COUNT3 := LS_COUNT3 + 1; select substr(ls_split_data1,LS_COUNT3,length(ls_split_data1)) INTO LS_APP_TYPE from dual; RETURN LS_APP_TYPE; END IF; ELSE goto continue_a_crr1; END IF; ELSE goto continue_a_crr1; END IF; END IF; END LOOP; -- CURSOR1 LOOP END CLOSE A_CRR1; -- CURSOR1 CLOSE END IF; RETURN LS_APP_TYPE; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_OS_SALES_PERSON ( as_stancode char, as_tableno char, ad_sysdate date, ac_levelno number) return char is ls_salespers char(10); ls_level_pnt char(5); begin select level_code__parent into ls_level_pnt from hierarchy where stan_code = as_stancode and table_no = as_tableno and ad_sysdate between eff_from and valid_upto and level_no = ac_levelno ; select distinct nvl(sales_pers,' ') into ls_salespers from hierarchy_det where level_code = ls_level_pnt ; return ls_salespers ; EXCEPTION WHEN TOO_MANY_ROWS THEN ls_salespers := 'POOL' ; return ls_salespers ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX F16_PAYMENT_SITE_PRD_EMP ON FORM16_PAYMENT (SITE_CODE, PRD_CODE, EMP_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHECK_JV_ACCOUNT (as_acct_code char) return number is ret_val char; ls_acct_type char; begin select sundry_type into ls_acct_type from accounts where acct_code=as_acct_code; if ls_acct_type <> 'O' then ret_val := '1'; else ret_val := '0'; end if; return ret_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_WO_REF_QTY (as_workorder workorder.work_order%type, as_wo_en_tranid workorder_enhanc.tran_id%type) return number is ll_refqty number(14,3) := 0; begin begin select nvl(current_batch_qty,0) into ll_refqty from workorder where work_order = as_workorder; exception when others then ll_refqty := 0; end; return ll_refqty; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX INC_CHARGES_X ON INC_CHARGES (INC_CHG, FROM_DAY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMP_TRANS ON EMPTRANSFER (EMP_CODE, TRANS_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PRIMARY ON PAY_IBCA_DET (TRAN_ID, REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STOCK_POTENCY_PERC ( as_site_code stock.site_code%type, as_item_code stock.item_code%type, as_loc_code stock.loc_code%type, as_lot_no stock.lot_no%type, as_lot_sl stock.lot_sl%type) return number is ldec_potency_perc number(14,3); begin select nvl(potency_perc, 0) into ldec_potency_perc from stock where site_code = as_site_code and item_code = as_item_code and loc_code = as_loc_code and lot_no = as_lot_no and lot_sl = as_lot_sl; return ldec_potency_perc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_ISSDET_DIST_ORD ON DISTORD_ISSDET (DIST_ORDER, LINE_NO_DIST_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE ITEMMASTERTABLE AS TABLE OF itemMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_UNCB ( MSITE_CODE IN CHAR, MCUST_CODE IN CHAR, MITEM_CODE IN CHAR, MQUANTITY IN NUMBER, MTRAN_DATE IN DATE ) RETURN NUMBER IS SALERETQTY NUMBER(10) := 0; CONFQTY NUMBER(10) := 0; UNCONFQTY NUMBER(10) := 0; SALEQTY NUMBER(10) := 0; TT NUMBER(10) := 0; BEGIN /* FOR SALERETQTY */ SELECT NVL(SUM(CASE WHEN B.RET_REP_FLAG = 'R' THEN B.QUANTITY ELSE -B.QUANTITY END),0) INTO SALERETQTY FROM SRETURN A, SRETURNDET B WHERE A.TRAN_ID = B.TRAN_ID AND A.CUST_CODE = MCUST_CODE AND A.SITE_CODE = MSITE_CODE AND A.TRAN_DATE <= MTRAN_DATE AND B.ITEM_CODE = MITEM_CODE --AND B.LOT_NO = 'HK81049' AND A.CONFIRMED = 'Y' ; /* FOR CONFQTY */ SELECT NVL(SUM(CASE WHEN B.QUANTITY IS NULL THEN 0 ELSE B.QUANTITY END),0) INTO CONFQTY FROM CHARGE_BACK A, CHARGE_BACK_DET B WHERE A.TRAN_ID = B.TRAN_ID AND A.CUST_CODE = MCUST_CODE AND A.SITE_CODE = MSITE_CODE AND A.CONFIRMED = 'Y' AND B.ITEM_CODE = MITEM_CODE ; --AND B.LOT_NO = 'HK81049 ' /* FOR UNCONFQTY */ SELECT NVL(SUM(CASE WHEN B.QUANTITY IS NULL THEN 0 ELSE B.QUANTITY END),0) INTO UNCONFQTY FROM CHARGE_BACK A, CHARGE_BACK_DET B WHERE A.TRAN_ID = B.TRAN_ID AND A.CUST_CODE = MCUST_CODE AND A.SITE_CODE = MSITE_CODE AND (CASE WHEN A.CONFIRMED IS NULL THEN 'N' ELSE A.CONFIRMED END) = 'N' AND B.ITEM_CODE = MITEM_CODE ; --AND B.LOT_NO = 'HK81049' /* FOR SALEQTY */ SELECT NVL(SUM(B.QUANTITY),0) INTO SALEQTY FROM INVOICE A, INVOICE_TRACE B WHERE A.INVOICE_ID = B.INVOICE_ID AND A.CUST_CODE = MCUST_CODE AND A.SITE_CODE = MSITE_CODE AND A.TRAN_DATE <= MTRAN_DATE AND B.ITEM_CODE = MITEM_CODE --AND B.LOT_NO = 'HK81049' AND A.CONFIRMED = 'Y' ; TT := SALEQTY - (SALERETQTY + CONFQTY + UNCONFQTY ); IF TT >= MQUANTITY THEN RETURN 0; ELSE RETURN 1; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCP_GR_TRANID ON PORCP (GR_NO, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_INTTOWORD (var in number) return varchar2 is amt number; strt number; val number; str varchar2(15); c_str varchar2(400); flag number:=0; begin val:=round(var,2); amt:=floor(val); str:=to_char(amt); if val > 0then if length(str) >= 8 and length(str) <=10 then strt:=(length(str)-7); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' crore '; amt:=to_number(substr(to_char(amt),(strt+1),7)); flag:=0; end if; str:=to_char(amt); if ((length(str) >= 6 and length(str) <= 7) or flag = 1) then strt:=(length(str) - 5); str:=substr(str,1,strt); c_str:=c_str || initcap(case when to_number(str) > 0 then initcap(to_char(to_date(to_number(str),'J'),'JSP')) else '' end) || ' lakh '; amt:=to_number(substr(to_char(amt),(strt+1),5)); flag:=1; end if; str:=to_char(amt); if ((length(str) >= 1 and length(str) <= 5 ) or flag = 1) then c_str:=c_str || initcap(case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end); end if; else c_str := c_str || 'Zero'; end if; amt:= (val mod 1) * 100; if amt > 0 then c_str := case when c_str = '' or c_str is null then 'Zero and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end else c_str || ' and ' || case when amt > 0 then initcap(to_char(to_date(amt,'J'),'JSP')) else '' end end; end if; return (c_str); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_REQINFO (as_reqid char) return varchar2 is ls_REQDATE varchar2(15); ls_CUSTCODE varchar2(10); ls_REQTYPE varchar2(100); ls_itemdescr varchar2(500); ls_LOTNO varchar2(15); ls_DTLDESCR varchar2(1000); ls_COMPSTAT varchar2(30); ls_COMPSTATDT varchar2(15); ls_CUSTNAME varchar2(100); ls_COMPLAINDATE varchar2(15); ls_REQUESTVIA varchar2(50); ls_STDCOMPTIME varchar2(15); ls_EMPCODEASSIGN char(10); ls_retstr varchar2(500); begin begin select to_char(r.REQ_DATE,'DD-MON-YY') as REQ_DATE, r.CUST_CODE, trim(t.descr) as REQ_TYPE, i.descr as item_descr, r.LOT_NO, r.DTL_DESCR, r.COMP_STAT, to_char(r.COMP_STAT_DT,'DD-MON-YY') COMP_STAT_DT, r.CUST_NAME, to_char(r.COMPLAIN_DATE,'DD-MON-YY') COMPLAIN_DATE, r.REQUEST_VIA, To_char(nvl(r.STD_COMP_TIME,0)) as STD_COMP_TIME, r.EMP_CODE__ASSIGN into ls_REQDATE, ls_CUSTCODE, ls_REQTYPE, ls_itemdescr, ls_LOTNO, ls_DTLDESCR, ls_COMPSTAT, ls_COMPSTATDT, ls_CUSTNAME, ls_COMPLAINDATE, ls_REQUESTVIA, ls_STDCOMPTIME, ls_EMPCODEASSIGN from ser_request r, customer c, item i, ser_req_typ t where c.cust_code = r.cust_code and i.item_code = r.item_code and t.req_type = r.req_type and r.req_id = as_reqid; exception when others then ls_retstr := ' Customer : ' || trim(ls_CUSTNAME) || ' (' || trim(ls_CUSTCODE) || ')
'; ls_retstr := ls_retstr || 'Type : ' || ls_REQTYPE || ' Via : ' || trim(ls_REQUESTVIA) || ' on ' || trim(ls_COMPLAINDATE) || '

'; ls_retstr := ls_retstr || 'Detail : ' || ls_DTLDESCR || '

'; ls_retstr := ls_retstr || 'Ref # : ' || ls_LOTNO || ' Efforts : ' || ls_STDCOMPTIME || '

'; end; return ls_retstr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_EMP_ACTTIME_SPEND ( AS_RED_ID IN SER_REQ_FEEDBKDTL.REQ_ID%TYPE, AS_ACT_ID IN SER_REQ_FEEDBKDTL.ACTION_ID%TYPE) RETURN NUMBER IS ACTUAL_TIME NUMBER(15,2); BEGIN BEGIN SELECT SUM(SRFD.TIME_SPENT) INTO ACTUAL_TIME FROM SER_REQ_FEEDBKDTL SRFD JOIN SER_REQ_FEEDBK SRF ON SRFD.FEEDBK_ID = SRF.FEEDBK_ID JOIN SER_REQ_ACT_DETL SRAD ON SRAD.ACTION_ID = SRFD.ACTION_ID WHERE SRFD.REQ_ID = AS_RED_ID AND SRFD.ACTION_ID = AS_ACT_ID; EXCEPTION WHEN NO_DATA_FOUND THEN ACTUAL_TIME := 0; END; RETURN (ACTUAL_TIME); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SUNDRY ( ls_ref_ser in char, ls_tran_id in char, ls_type in char ) return varchar2 is ls_val customer.cust_name%type; ls_code invoice.cust_code%type; ls_name customer.cust_name%type; ls_sql varchar2(2000); begin if ls_ref_ser = 'S-INV' then select A.cust_code , B.cust_name into ls_code , ls_name from invoice A , customer B where A.cust_code = B.cust_code and Trim(A.invoice_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'VOUCH' then Select A.supp_code , B.supp_name into ls_code , ls_name From Voucher A , Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNPAY' Or ls_ref_ser = 'DRNPAY' Then Select A.supp_code , B.supp_name Into ls_code , ls_name From DRCR_Pay A , Supplier B Where A.supp_code = B.supp_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'CRNRCP' Or ls_ref_ser = 'DRNRCP' Then Select A.cust_code , B.cust_name Into ls_code , ls_name From DRCR_Rcp A , Customer B Where A.cust_code = B.cust_code And Trim(A.tran_id) = Trim(ls_tran_id); ElsIf ls_ref_ser = 'D-RCP' Then ls_sql := 'Select Nvl(Case A.sundry_type when ''C'' then (Select B.cust_name From Customer B '|| 'Where B.cust_code = A.sundry_code) when '|| '''S'' then (Select B.supp_name From Supplier B '|| 'Where B.supp_code = A.sundry_code)END,'|| ' (Select B.descr From Site B where B.site_code = A.site_code__dlv)),'|| ' Nvl(case A.sundry_type when ''C'' then (Select B.cust_code From Customer B '|| ' Where B.cust_code = A.sundry_code) when'|| '''S'' then (Select B.supp_code From Supplier B '|| ' Where B.supp_code = A.sundry_code)END,'|| ' (Select B.site_code From Site B where B.site_code = A.site_code__dlv))'|| ' From DistOrder A ' || ' Where (A.dist_order) = Trim(''' || ls_tran_id || ''')' ; Execute immediate ls_sql into ls_name , ls_code; ElsIf ls_ref_ser = 'D-ISS' Then ls_sql := 'Select Nvl(Case A.sundry_type when ''C'' then (Select B.cust_name From Customer B '|| 'Where B.cust_code = A.sundry_code) when '|| '''S'' then (Select B.supp_name From Supplier B '|| 'Where B.supp_code = A.sundry_code)END, '|| ' (Select B.descr From Site B where B.site_code = A.site_code__ship)),'|| ' Nvl(case A.sundry_type when ''C'' then (Select B.cust_code From Customer B '|| ' Where B.cust_code = A.sundry_code) when'|| '''S'' then (Select B.supp_code From Supplier B '|| ' Where B.supp_code = A.sundry_code)END,'|| ' (Select B.site_code From Site B where B.site_code = A.site_code__ship))'|| ' From DistOrder A ' || ' Where (A.dist_order) = Trim(''' || ls_tran_id || ''')' ; Execute immediate ls_sql into ls_name , ls_code; End If; ls_name := nvl(ls_name,' '); ls_code := nvl(ls_code,' '); If ls_type = 'C' Then ls_val := ls_code; Else ls_val := ls_name; End If; Return ls_val; End; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION VALID_GRACECOUNT (siteCode IN site.site_code%type, itemCode item.item_code%type, no_cons_unap siteitem.no_cons_unaprv%type, appr_supp char, disapprv_on_rej CHAR, item_ser IN item.item_ser%type, no_of_rej number) RETURN NUMBER IS result number(14,3); as_grace_db number(3); as_no_cons_unaprv_a number(3); -- grace count increase with 1 as_max_grc_count number(3); as_min_grc_count number(3); as_itmser_count number(3); site_ite_count number(3); begin SELECT VAR_VALUE INTO as_max_grc_count FROM DISPARM WHERE VAR_NAME='VQ_MAX_GRACE_COUNT' and PRD_CODE ='999999' and VAR_TYPE ='S'; SELECT VAR_VALUE INTO as_min_grc_count FROM DISPARM WHERE VAR_NAME='VQ_MIN_GRACE_COUNT' and PRD_CODE ='999999' and VAR_TYPE ='S'; dbms_output.put_line('Grace count is MAX_GRACE_COUNT ' || as_max_grc_count || ' MIN_GRACE_COUNT : ' || as_min_grc_count ); if (no_cons_unap > as_max_grc_count) then dbms_output.put_line('Grace count is more than 9 - ' || no_cons_unap); result:=0; end if; if (no_cons_unap <= as_max_grc_count) then SELECT COUNT(*) INTO site_ite_count FROM SITEITEM WHERE SITE_CODE = siteCode AND ITEM_CODE = itemCode; IF(site_ite_count > 0) then SELECT NVL(NO_CONS_UNAPRV,0) INTO as_grace_db FROM SITEITEM WHERE SITE_CODE = siteCode AND ITEM_CODE = itemCode; dbms_output.put_line('Grace count is less than 9 - ' || siteCode || ' ' || itemCode || ' ' || as_grace_db ); if(as_grace_db = no_cons_unap) then result:=1; else as_no_cons_unaprv_a := as_grace_db+1; dbms_output.put_line('Grace count is less than 9 -as_grace_db : ' || as_grace_db || ' as_no_cons_unaprv_a ' || as_no_cons_unaprv_a); --if existing grace count and new grace count same then no need to check if (as_grace_db > no_cons_unap) then dbms_output.put_line('Grace count is less than database '); result:=0; else --if existing grace count and new grace count is not same then allow only if it is +1 with available if (no_cons_unap = as_no_cons_unaprv_a ) then dbms_output.put_line('Grace count is +1 than existing '); result:=1; else dbms_output.put_line('Grace count is not +1 than existing '); --if(no_cons_unap =3 or no_cons_unap=2 or no_cons_unap=1) then if(no_cons_unap <= as_min_grc_count ) then dbms_output.put_line('Grace count is less than mis grc count '|| as_min_grc_count); result:=1; else dbms_output.put_line('Grace count is not +1 than existing '); result:=0; end if; end if; end if; end if; ELSE if(no_cons_unap <= as_min_grc_count ) then dbms_output.put_line('Grace count is less than mis grc count '|| as_min_grc_count); result:=1; else dbms_output.put_line('Grace count is not +1 than existing '); result:=0; end if; end if; end if; if(result = 1) then if(appr_supp = 'Y' ) then if(disapprv_on_rej ='Y') then if(no_of_rej >= 3) then SELECT COUNT(*) into as_itmser_count FROM ITEM WHERE ITEM_CODE =itemCode AND ITEM_SER IN (SELECT FLD_VALUE FROM GENCODES WHERE FLD_NAME ='ITEM_SER' AND MOD_NAME ='VQ' ); if(as_itmser_count > 0) then if(no_cons_unap >= as_min_grc_count) then dbms_output.put_line('Grace count is greater than Min count : ' || as_min_grc_count || 'Grace Count' || no_cons_unap); result:=1; else dbms_output.put_line('Grace count is less than Min count : ' || as_min_grc_count || 'Grace Count' || no_cons_unap); result:=0; end if; end if; end if; end if; end if; end if; dbms_output.put_line('Grace count at end '); return result; exception when no_data_found then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETCOUNT ( as_status CHAR, as_supp_code__mnfr CHAR, as_site_code CHAR, as_item_code CHAR, as_tran_date DATE, as_ref_ser CHAR, as_eff_from date, as_valid_upto date, as_check CHAR, as_asign_child_site CHAR) RETURN NUMBER IS lc_prcp_drcp NUMBER(7); lc_tot_prcp_drcp number(7); lc_no_item NUMBER(1); lc_no_site NUMBER(1); lc_no_cons_unaprv siteitem.no_cons_unaprv%type; lc_RE_QUALI_DATE_PIND DATE; lc_RE_QUALI_DATE_PORD DATE; lc_no_month_for_po NUMBER(2); lc_no_month_for_pi NUMBER(2); flag NUMBER(10); as_no_child_site NUMBER(1); as_no_parent_site NUMBER(1); BEGIN IF as_status ='U' OR as_status ='P' THEN SELECT SUM(lc_prcp_drcp) INTO lc_tot_prcp_drcp FROM ( --SELECT COUNT(*) lc_prcp_drcp Santosh 02-03-15 Commented and below line added Count taken from Header level, instead of detail level. SELECT COUNT( distinct(B.TRAN_ID)) lc_prcp_drcp FROM porcp b, porcpdet c, site s WHERE b.tran_id = c.tran_id and b.purc_order = c.purc_order and b.site_code = s.site_code AND S.SITE_TYPE != 'R' AND b.Confirmed = 'Y' AND c.supp_code__mnfr = as_supp_code__mnfr AND c.ITEM_CODE = as_item_code ------- Following condition is commented AND new condition is added by Manoj SArode on 02-Aug-2014 Start --AND B.SITE_CODE = as_site_code AND b.SITE_CODE IN ( select site_code from site where qualify_grp__site = (select qualify_grp__site from site where site_code = as_site_code ) ) ----------- Above condition is commented AND new condition is added by Manoj Sarode on 02-Aug-2014 End AND b.tran_date BETWEEN as_eff_from AND as_valid_upto UNION --SELECT COUNT(*) lc_prcp_drcp Santosh 02-03-15 Commented and below line added Count taken from Header level, instead of detail level. SELECT COUNT( distinct(B.TRAN_ID)) lc_prcp_drcp FROM distord_rcp b, distord_rcpdet c, SITE S WHERE b.tran_id = c.tran_id and b.dist_order = c.dist_order AND B.SITE_CODE = S.SITE_CODE AND S.SITE_TYPE != 'R' AND b.Confirmed = 'Y' AND c.supp_code__mfg = as_supp_code__mnfr AND C.ITEM_CODE = as_item_code --AND B.SITE_CODE = as_site_code ------- Following condition is commented AND new condition is added by Manoj SArode on 02-Aug-2014 Start AND B.SITE_CODE IN ( select site_code from site where qualify_grp__site = (select qualify_grp__site from site where site_code = as_site_code ) ) ----------- Above condition is commented AND new condition is added by Manoj Sarode on 02-Aug-2014 End AND b.tran_date BETWEEN as_eff_from AND as_valid_upto) a; -- Following code is commented and add the new sql condition by Manoj Sarode as we have to take the max (NO_CONS_UNAPRV) of child sites of particular site on 04-Aug-2014 Start -- SELECT count ( no_cons_unaprv) no_cons_unaprv INTO lc_no_cons_unaprv -- FROM siteitem -- WHERE site_code= as_site_code -- AND item_code = as_item_code; SELECT NVL (NO_CONS_UNAPRV,0) into lc_no_cons_unaprv FROM (SELECT MAX ( no_cons_unaprv) NO_CONS_UNAPRV FROM siteitem WHERE site_code IN (select site_code from site where qualify_grp__site = (select qualify_grp__site from site where site_code = as_site_code ) ) AND item_code = as_item_code ) A; -- Above code is commented and add the new sql condition by Manoj Sarode as we have to take the max (NO_CONS_UNAPRV) of child sites of particular site on 04-Aug-2014 Start -- if lc_no_cons_unaprv > 0 then -- SELECT NVL(trim(no_cons_unaprv),0) no_cons_unaprv INTO lc_no_cons_unaprv -- FROM siteitem -- WHERE site_code= as_site_code -- AND item_code = as_item_code; IF lc_tot_prcp_drcp >= lc_no_cons_unaprv THEN Flag :=0; RETURN Flag; ELSE Flag :=6; RETURN FLAG; END IF; -- end if; -- if lc_no_cons_unaprv>0 then elsif as_status = 'Q' THEN IF as_check ='Y' THEN SELECT VAR_VALUE INTO lc_no_month_for_po FROM DISPARM WHERE VAR_NAME='VQ_PORDER_VALIDITY'; SELECT VAR_VALUE INTO lc_no_month_for_pi FROM DISPARM WHERE VAR_NAME='VQ_PINDENT_VALIDITY'; SELECT REQLF_DATE_2, REQLF_DATE_1 INTO lc_RE_QUALI_DATE_PORD , lc_RE_QUALI_DATE_PIND FROM (SELECT ADD_MONTHS(REQUALIFICATION_DATE,lc_no_month_for_po) AS REQLF_DATE_2, ADD_MONTHS(REQUALIFICATION_DATE,lc_no_month_for_pi) AS REQLF_DATE_1 FROM SUPP_APPRV_ITEM b, --FOR SITE ITEM BY SABITA supp_apprv a WHERE b.SITE_CODE = as_asign_child_site AND a.supp_code__mnfr = b.supp_code__mnfr AND b.item_code = as_item_code AND a.supp_code__mnfr = as_supp_code__mnfr AND b.STATUS <> 'I' AND a.apprv_scope ='I' AND AS_TRAN_dATE BETWEEN B.eff_from AND B.valid_upto UNION SELECT ADD_MONTHS(REQUALIFICATION_DATE, lc_no_month_for_po) AS REQLF_DATE_2, ADD_MONTHS(REQUALIFICATION_DATE, lc_no_month_for_pi) AS REQLF_DATE_1 FROM supp_apprv a, supp_apprv_site b WHERE a.supp_code__mnfr = b.supp_code__mnfr AND b.supp_code__mnfr = as_supp_code__mnfr AND b.site_code = as_asign_child_site AND b.STATUS <> 'I' AND a.apprv_scope = 'S' AND AS_TRAN_dATE BETWEEN B.eff_from AND B.valid_upto UNION SELECT ADD_MONTHS(REQUALIFICATION_DATE, lc_no_month_for_po) AS REQLF_DATE_2, ADD_MONTHS(REQUALIFICATION_DATE, lc_no_month_for_pi) AS REQLF_DATE_1 FROM ITEMMNFR b, supp_apprv a WHERE b.item_code = as_item_code AND a.supp_code__mnfr = b.supp_code__mnfr AND a.supp_code__mnfr = as_supp_code__mnfr AND b.STATUS <> 'I' AND a.apprv_scope ='T' AND AS_TRAN_dATE BETWEEN B.eff_from AND B.valid_upto UNION SELECT ADD_MONTHS(REQUALIFICATION_DATE, lc_no_month_for_po) AS REQLF_DATE_2, ADD_MONTHS(REQUALIFICATION_DATE, lc_no_month_for_pi) AS REQLF_DATE_1 FROM supp_apprv a, supp_apprv_site b WHERE a.supp_code__mnfr = b.supp_code__mnfr AND b.supp_code__mnfr = as_supp_code__mnfr AND b.STATUS <> 'I' AND a.apprv_scope = 'V' AND AS_TRAN_dATE BETWEEN B.eff_from AND B.valid_upto)A; IF as_ref_ser ='P-ORD' THEN IF AS_TRAN_dATE <= lc_RE_QUALI_DATE_PORD THEN Flag :=7; ELSE Flag :=0; END IF; ELSIF as_ref_ser ='R-IND' THEN IF AS_TRAN_dATE <= lc_RE_QUALI_DATE_PIND THEN Flag :=7; ELSE Flag :=0; END IF; Else Flag :=1; END IF; END IF; END IF; RETURN flag; exception when others then Flag :=0; return flag; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_MAX_LTRAN_DATE ( p_site_code IN VARCHAR2, p_item_code IN VARCHAR2, p_lot_no IN VARCHAR2, p_loc_code IN VARCHAR2 ) RETURN DATE IS v_max_ltran_date DATE; BEGIN SELECT MAX(LTRAN_DATE) INTO v_max_ltran_date FROM stock WHERE site_code = p_site_code AND item_code = p_item_code AND lot_no = p_lot_no AND loc_code = p_loc_code; RETURN v_max_ltran_date; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN NULL; END get_max_ltran_date; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DGM_PLAN_GUEST_TYPE (SUNDRY_TYPE CHAR,NOS_ATTENDED CHAR,SUNDRY_CODE CHAR,GUEST_NAME CHAR,FACULTY_TYPE CHAR) RETURN VARCHAR IS DIS_DATA VARCHAR2(200); BEGIN IF (SUNDRY_TYPE IN ('R','E')) THEN DIS_DATA := GUEST_NAME||' ('|| SUNDRY_CODE||')'; ELSE IF (SUNDRY_TYPE IN ('U')) THEN DIS_DATA := GUEST_NAME; ELSE IF (SUNDRY_TYPE IN ('G')) THEN DIS_DATA := 'GUEST:'||NOS_ATTENDED; ELSE IF (SUNDRY_TYPE IN ('F') AND FACULTY_TYPE IN ('O','P')) THEN DIS_DATA := GUEST_NAME; ELSE IF (SUNDRY_TYPE IN ('F') AND FACULTY_TYPE IN ('S','C')) THEN DIS_DATA := GUEST_NAME||' ('|| SUNDRY_CODE||')'; END IF; END IF; END IF; END IF; END IF; RETURN DIS_DATA; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_DESC_SPECS (as_itemcode in char,as_rettype in char) return varchar2 is ls_specs varchar2(200); ls_itemtype item_type.item_type%type; ls_attrib1 item_type.phy_attrib_1%type; ls_attrib2 item_type.phy_attrib_2%type; ls_attrib3 item_type.phy_attrib_3%type; ls_attrib4 item_type.phy_attrib_4%type; ls_attrib5 item_type.phy_attrib_5%type; ls_attrib6 item_type.phy_attrib_6%type; ls_attrib7 item_type.phy_attrib_7%type; ls_attrib8 item_type.phy_attrib_8%type; ls_attrib9 item_type.phy_attrib_9%type; ls_attrib10 item_type.phy_attrib_10%type; ls_attrib11 item_type.phy_attrib_11%type; ls_attrib12 item_type.phy_attrib_12%type; ls_spec1 item.phy_attrib_1%type; ls_spec2 item.phy_attrib_2%type; ls_spec3 item.phy_attrib_3%type; ls_spec4 item.phy_attrib_4%type; ls_spec5 item.phy_attrib_5%type; ls_spec6 item.phy_attrib_6%type; ls_spec7 item.phy_attrib_7%type; ls_spec8 item.phy_attrib_8%type; ls_spec9 item.phy_attrib_9%type; ls_spec10 item.phy_attrib_10%type; ls_spec11 item.phy_attrib_11%type; ls_spec12 item.phy_attrib_12%type; begin ls_specs := ' '; select a.item_type,a.phy_attrib_1,a.phy_attrib_2,a.phy_attrib_3,a.phy_attrib_4, a.phy_attrib_5,a.phy_attrib_6,a.phy_attrib_7,a.phy_attrib_8, a.phy_attrib_9,a.phy_attrib_10,a.phy_attrib_11,a.phy_attrib_12, b.phy_attrib_1,b.phy_attrib_2,b.phy_attrib_3,b.phy_attrib_4, b.phy_attrib_5,b.phy_attrib_6,b.phy_attrib_7,b.phy_attrib_8, b.phy_attrib_9,b.phy_attrib_10,b.phy_attrib_11,b.phy_attrib_12 into ls_itemtype,ls_spec1,ls_spec2,ls_spec3,ls_spec4, ls_spec5,ls_spec6,ls_spec7,ls_spec8, ls_spec9,ls_spec10,ls_spec11,ls_spec12, ls_attrib1,ls_attrib2,ls_attrib3,ls_attrib4, ls_attrib5,ls_attrib6,ls_attrib7,ls_attrib8, ls_attrib9,ls_attrib10,ls_attrib11,ls_attrib12 from item a, item_type b where a.item_type = b.item_type and a.item_code = as_itemcode ; if ls_attrib1 is not null and length(ltrim(rtrim(ls_attrib1))) > 0 and ls_spec1 is not null and length(ltrim(rtrim(ls_spec1))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib1) || ' : ' || rtrim(ls_spec1) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib2 is not null and length(ltrim(rtrim(ls_attrib2))) > 0 and ls_spec2 is not null and length(ltrim(rtrim(ls_spec2))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib2) || ' : ' || rtrim(ls_spec2) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib3 is not null and length(ltrim(rtrim(ls_attrib3))) > 0 and ls_spec3 is not null and length(ltrim(rtrim(ls_spec3))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib3) || ' : ' || rtrim(ls_spec3) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib4 is not null and length(ltrim(rtrim(ls_attrib4))) > 0 and ls_spec4 is not null and length(ltrim(rtrim(ls_spec4))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib4) || ' : ' || rtrim(ls_spec4) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib5 is not null and length(ltrim(rtrim(ls_attrib5))) > 0 and ls_spec5 is not null and length(ltrim(rtrim(ls_spec5))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib5) || ' : ' || rtrim(ls_spec5) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib6 is not null and length(ltrim(rtrim(ls_attrib6))) > 0 and ls_spec6 is not null and length(ltrim(rtrim(ls_spec6))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib6) || ' : ' || rtrim(ls_spec6) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib7 is not null and length(ltrim(rtrim(ls_attrib7))) > 0 and ls_spec7 is not null and length(ltrim(rtrim(ls_spec7))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib7) || ' : ' || rtrim(ls_spec7) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib8 is not null and length(ltrim(rtrim(ls_attrib8))) > 0 and ls_spec8 is not null and length(ltrim(rtrim(ls_spec8))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib8) || ' : ' || rtrim(ls_spec8) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib9 is not null and length(ltrim(rtrim(ls_attrib9))) > 0 and ls_spec9 is not null and length(ltrim(rtrim(ls_spec9))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib9) || ' : ' || rtrim(ls_spec9) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib10 is not null and length(ltrim(rtrim(ls_attrib10))) > 0 and ls_spec10 is not null and length(ltrim(rtrim(ls_spec10))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib10) || ' : ' || rtrim(ls_spec10) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib11 is not null and length(ltrim(rtrim(ls_attrib11))) > 0 and ls_spec11 is not null and length(ltrim(rtrim(ls_spec11))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib11) || ' : ' || rtrim(ls_spec11) ; if as_rettype = 'V' then ls_specs := ls_specs || chr(13) ; end if; end if ; if ls_attrib12 is not null and length(ltrim(rtrim(ls_attrib12))) > 0 and ls_spec12 is not null and length(ltrim(rtrim(ls_spec12))) > 0 then ls_specs := ls_specs || ' ' || rtrim(ls_attrib12) || ' : ' || rtrim(ls_spec12) ; end if ; ls_specs := ltrim(rtrim(ls_specs)) ; return ls_specs; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_HOLIDAY_EXPENSE (AS_EMP_CODE CHAR,AS_PRD_CODE_FR CHAR,AS_PRD_CODE_TO CHAR,AS_EMP_WORK_DATE DATE) return char is a_hol_date char(11); begin SELECT distinct to_char(hol_date,'DD-MON-YYYY') into a_hol_date FROM holiday H WHERE H.HOL_DATE NOT IN( SELECT HOL_DATE_FOR FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND H.HOL_TBLNO=HOL_TBLNO AND HOL_DATE_FOR =AS_EMP_WORK_DATE) AND HOL_DATE =AS_EMP_WORK_DATE AND HOL_TBLNO=ddf_get_holtblno_expense(AS_EMP_CODE,AS_EMP_WORK_DATE); return a_hol_date; exception when no_data_found then begin SELECT DISTINCT to_char(HOL_DATE_TO,'DD-MON-YYYY') into a_hol_date FROM CHANGE_HOLIDAY WHERE EMP_CODE=AS_EMP_CODE AND HOL_TBLNO = ddf_get_holtblno_expense(AS_EMP_CODE,AS_EMP_WORK_DATE) AND HOL_DATE_FOR =AS_EMP_WORK_DATE; return a_hol_date; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_REMARK (as_refno in char, as_transer in char) return varchar2 is ls_remark varchar2(1000); begin ls_remark := ' '; begin if trim(as_transer) = 'S_INV' then select remarks into ls_remark from invoice where invoice_id = as_refno; elsif trim(as_transer) = 'R-IBCA' or trim(as_transer) = 'R-IBC1' or trim(as_transer) = 'R-IBC2' then select remarks into ls_remark from rcp_ibca where tran_id = as_refno; elsif trim(as_transer) = 'CRNRCP' or trim(as_transer) = 'DRNRCP' then select remarks into ls_remark from drcr_rcp where tran_id = as_refno; elsif trim(as_transer) = 'MDRCRC' or trim(as_transer) = 'MDRCRD' then select remarks into ls_remark from misc_drcr_rcp where tran_id = as_refno; end if; exception when others then ls_remark := ' '; end; return ls_remark; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_NO_MTHS_SERVICE (AS_EMP_CODE char,AS_PAY_TABLE char,AS_PRD_CODE char,AS_AD_CODE char,AS_FLAG char) return number is a_relieve_date employee.relieve_date%type; a_months number(13,2) := 0; a_fest_date date; begin select relieve_date into a_relieve_date from employee where emp_code = AS_EMP_CODE; select count(*) into a_months from employee a,employee_perk b where a.emp_code = AS_EMP_CODE and b.emp_code = AS_EMP_CODE and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; if (a_months <> 0) then if (AS_FLAG = 'M') then select trunc(months_between(to_date(to_char(b.amount),'YYYYMMDD')+1,date_join)) into a_months from employee a,employee_perk b where a.emp_code = AS_EMP_CODE and b.emp_code = AS_EMP_CODE and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; elsif (AS_FLAG = 'A') then select nvl(sum(a.amount),0) into a_months from employee_ad a,employee_perk b where a.emp_code = AS_EMP_CODE and a.ad_code in ('BAS','BASM') and b.emp_code = AS_EMP_CODE and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date and to_date(to_char(b.amount),'YYYYMMDD') between a.eff_date and a.exp_date; end if; select to_date(to_char(a.amount),'YYYYMMDD') into a_fest_date from employee_perk a where a.emp_code = AS_EMP_CODE and a.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between a.eff_date and a.exp_Date; if (a_relieve_date is not null and a_relieve_date < a_fest_date) then if (AS_FLAG = 'M') then a_months := -1; elsif (AS_FLAG = 'A') then a_months := 0; end if; end if; return a_months; end if; select count(*) into a_months from employee a,grade_perk b where a.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and a.grade = b.grade_code and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; if (a_months <> 0) then if (AS_FLAG = 'M') then select trunc(months_between(to_date(to_char(b.amount),'YYYYMMDD')+1,date_join)) into a_months from employee a,grade_perk b where a.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and a.grade = b.grade_code and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; elsif (AS_FLAG = 'A') then select nvl(sum(a.amount),0) into a_months from employee_ad a,grade_perk b,employee c where a.emp_code = AS_EMP_CODE and a.ad_code in ('BAS','BASM') and c.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and c.grade = b.grade_code and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date and to_date(to_char(b.amount),'YYYYMMDD') between a.eff_date and a.exp_date; end if; select to_date(to_char(b.amount),'YYYYMMDD') into a_fest_date from employee a,grade_perk b where a.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and b.grade_code = a.grade and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; if (a_relieve_date is not null and a_relieve_date < a_fest_date) then if (AS_FLAG = 'M') then a_months := -1; elsif (AS_FLAG = 'A') then a_months := 0; end if; end if; return a_months; end if; select count(*) into a_months from employee a,cadre_perk b where a.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and a.cadre = b.cadre_code and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; if (AS_FLAG = 'M') then select trunc(months_between(to_date(to_char(b.amount),'YYYYMMDD')+1,date_join)) into a_months from employee a,cadre_perk b where a.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and a.cadre = b.cadre_code and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; elsif (AS_FLAG = 'A') then select nvl(sum(a.amount),0) into a_months from employee_ad a,cadre_perk b,employee c where a.emp_code = AS_EMP_CODE and a.ad_code in ('BAS','BASM') and c.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and c.cadre = b.cadre_code and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date and to_date(to_char(b.amount),'YYYYMMDD') between a.eff_date and a.exp_date; end if; select to_date(to_char(b.amount),'YYYYMMDD') into a_fest_date from employee a,cadre_perk b where a.emp_code = AS_EMP_CODE and b.pay_table = AS_PAY_TABLE and b.cadre_code = a.cadre and b.ad_code = AS_AD_CODE and to_date(AS_PRD_CODE || '01','YYYYMMDD') between b.eff_date and b.exp_Date; if (a_relieve_date is not null and a_relieve_date < a_fest_date) then if (AS_FLAG = 'M') then a_months := -1; elsif (AS_FLAG = 'A') then a_months := 0; end if; end if; return a_months; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX LEGAL_AGR_CLAUSE_X ON LEGAL_AGR_CLAUSE (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_TAX_DATE (as_tran_code char,as_tran_id char,as_tax_code char,as_acct_code char) return date is ld_tax_form_date date; ls_var_value varchar2(30); ls_tax_form_date varchar2(30); ls_errcode varchar2(30); begin select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = as_acct_code; select distinct tax_form_date into ld_tax_form_date from taxtran WHERE TRAN_CODE = as_tran_code AND TRAN_ID = as_tran_id AND TAX_CODE = as_tax_code AND ACCT_CODE = ls_var_value; if ld_tax_form_date='' then ls_tax_form_date:=''; end if; return ld_tax_form_date; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STK_MVMT_LOC (as_tranid in char, as_refser in char, as_refid in char, as_lineno in char) return char is ls_fieldvalue char(250); ls_tempvar char(10); begin ls_fieldvalue := '' ; if ltrim(rtrim(as_refser)) = 'P-RCP' or ltrim(rtrim(as_refser)) = 'P-RET' then begin select supp_code into ls_tempvar from porcp where tran_id = rtrim(as_refid); select rtrim(nvl(supp_name,' ')) into ls_fieldvalue from supplier where supp_code = ls_tempvar; end; end if; if rtrim(ltrim(as_refser)) = 'S-DSP' then begin select rtrim(customer.cust_name) into ls_fieldvalue from despatch, customer where despatch.desp_id = as_refid and despatch.cust_code__dlv = customer.cust_code; end; end if; if rtrim(ltrim(as_refser)) = 'S-RET' then begin select 'Customer:'||rtrim(sreturn.cust_code)||' '||rtrim(customer.cust_name)||'-'||rtrim(city) into ls_fieldvalue from sreturn, customer where sreturn.tran_id = as_refid and sreturn.cust_code = customer.cust_code; end; end if; if rtrim(ltrim(as_refser)) = 'D-ISS' then begin select 'Issued To :'||rtrim(distord_iss.site_code__dlv)||' '||rtrim(site.descr)||'-'||rtrim(site.city) into ls_fieldvalue from distord_iss, site where distord_iss.tran_id = as_refid and distord_iss.site_code__dlv = site.site_code; end; end if; if rtrim(ltrim(as_refser)) = 'C-ISS' then begin SELECT 'Department :'||rtrim(DEPARTMENT.DESCR) into ls_fieldvalue FROM CONSUME_ISS, DEPARTMENT WHERE ( CONSUME_ISS.DEPT_CODE = DEPARTMENT.DEPT_CODE ) and ( ( CONSUME_ISS.CONS_ISSUE = as_refid ) ) ; end; end if; if rtrim(ltrim(as_refser)) = 'W-ISS' then begin SELECT 'Department :'||rtrim(DEPARTMENT.DESCR) into ls_fieldvalue FROM WORKORDER_ISS, DEPARTMENT WHERE ( WORKORDER_ISS.DEPT_CODE = DEPARTMENT.DEPT_CODE ) and ( ( WORKORDER_ISS.TRAN_ID = as_refid ) ) ; end; end if; if rtrim(ltrim(as_refser)) = 'W-RCP' then begin SELECT 'Department :'||rtrim(DEPARTMENT.DESCR) into ls_fieldvalue FROM workorder_receipt, workorder, department WHERE ( workorder_receipt.work_order = workorder.work_order ) and ( rtrim(workorder.val_mfg_taxtran) = rtrim(department.dept_code)) and ( ( WORKORDER_RECEIPT.TRAN_ID = as_refid ) ) ; end; end if; if rtrim(ltrim(as_refser)) = 'D-RCP' then begin select 'Issued From :'||rtrim(distord_rcp.site_code__ship)||' '||rtrim(site.descr)||'-'||rtrim(site.city) into ls_fieldvalue from distord_rcp, site where distord_rcp.tran_id = as_refid and distord_rcp.site_code__ship = site.site_code; end; end if; return ls_fieldvalue ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STATUTORY_OBJS_DET_X ON STATUTORY_OBJS_DET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_QC_TYPE (as_reftype in char, as_refno in char ) return char is ls_qctype char(1) ; begin if as_reftype = 'QC-ORD' then select nvl(qorder_type,'') into ls_qctype from qc_order where qorder_no = as_refno ; else ls_qctype := '' ; end if ; return ls_qctype ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BONUS_REMARKS (as_ref_id char, as_refser char ,as_netamt number, as_acct_code char) return varchar2 is as_remarks varchar2(1000); begin if as_refser = 'P-VOUC' then select max(fullfinal_det.remarks) into as_remarks from payr_voucher, fullfinal_det, fullfinal_hdr where payr_voucher.TRAN_ID = as_ref_id and payr_voucher.tran_type = 'FFS' and payr_voucher.TRAN_ID = fullfinal_det.TRAN_ID__PAYR and payr_voucher.ref_no = fullfinal_hdr.tran_id and fullfinal_hdr.tran_id = fullfinal_det.tran_id and fullfinal_det.net_amt = as_netamt and fullfinal_det.acct_code = as_acct_code ; end if; return as_remarks; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_EXCISE_DUTY (AS_TRAN_CODE CHAR,AS_TRAN_ID CHAR) RETURN DECIMAL IS ld_tax_amt DECIMAL(12,3); ls_exctax VARCHAR2(300); begin BEGIN SELECT VAR_VALUE into ls_exctax FROM DISPARM WHERE VAR_NAME = 'EXC_TAX_CODE' ; SELECT SUM(TAX_AMT) INTO LD_TAX_AMT FROM TAXTRAN WHERE TRAN_CODE=AS_TRAN_CODE AND TRAN_ID=AS_TRAN_ID AND instr(','||trim(LS_EXCTAX)||',',','||trim(TAX_CODE)||',')>0 ; exception when no_data_found then ld_tax_amt:=0; end; RETURN LD_TAX_AMT; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_PARTYORDER_DET ( as_invoice_id CHAR ,as_type CHAR) return NVARCHAR2 is ls_return NVARCHAR2(2000) ; ls_party_order_no1 NVARCHAR2(2000) ; ls_party_order_dt1 NVARCHAR2(2000) ; counter number(10); begin declare cursor cur1 is select distinct sorder.cust_pord,to_char(sorder.pord_date,'dd/mm/yy') as pord_date from invoice_trace,sorder where ( invoice_trace.sord_no = sorder.sale_order ) and invoice_trace.invoice_id = as_invoice_id order by sorder.cust_pord,to_char(sorder.pord_date,'dd/mm/yy') ; begin counter := 0; for i in cur1 loop counter := counter + 1; if counter = 1 then ls_party_order_no1:= i.cust_pord ; ls_party_order_dt1:= i.pord_date ; else if i.cust_pord is not null then ls_party_order_no1 := ls_party_order_no1 ||','|| i.cust_pord ; end if; if i.pord_date is not null then ls_party_order_dt1 := ls_party_order_dt1 ||','|| i.pord_date ; end if; end if; end loop ; end ; if as_type ='N' then ls_return := ls_party_order_no1 ; elsif as_type='D' then ls_return := ls_party_order_dt1 ; end if ; if ls_return IS NULL then ls_return := ' '; end if ; return ls_return ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_BUDGET_AMT_EXP (as_tran_code in char,as_site_cd in char,as_acct_code in char, as_cctr_code in char, as_anal_code in char, as_flag in char) return number is ac_budget_amt number(14,3); ld_tran_date date; ls_var_value char(30); ls_fin_ent char(10); ll_count number(3); ls_sitecode char(5); begin if as_tran_code = 'E-PAY' then -- select tran_date,substr(site_code,1,2) ,site_code into ld_tran_date,ls_fin_ent,ls_sitecode from payment_exp -- where tran_id = as_tran_id; select fin_entity into ls_fin_ent from site where site_code = as_site_cd; ls_sitecode := as_site_cd; end if; ld_tran_date := to_date(sysdate); if ld_tran_date is null then ac_budget_amt := -1; return ac_budget_amt; end if; select var_value into ls_var_value from finparm where var_name = 'ACTIVE_BUDGET'; if ls_var_value is null then ac_budget_amt := -1; return ac_budget_amt; end if; begin if ltrim(rtrim(as_flag)) = 'A' then select sum(case when a.budget_amt is null then 0 else a.budget_amt end) into ac_budget_amt from acctbudget a, budgets b where a.budget_id = b.budget_id and a.from_date <= ld_tran_date and a.to_date >= ld_tran_date and a.site_code = ls_sitecode and a.acct_code = as_acct_code and a.cctr_code = as_cctr_code and a.anal_code = as_anal_code and b.def_budget = 'Y'; elsif ltrim(rtrim(as_flag)) = 'D' then select (case when a.budget_amt is null then 0 else a.budget_amt end) into ac_budget_amt from acctbudget a, budgets b where a.budget_id = b.budget_id and a.from_date <= ld_tran_date and a.to_date >= ld_tran_date and a.site_code = ls_sitecode and a.acct_code = as_acct_code and a.cctr_code = as_cctr_code and b.def_budget = 'Y'; else select sum(case when a.budget_amt is null then 0 else a.budget_amt end) into ac_budget_amt from acctbudget a, budgets b where a.budget_id = b.budget_id and a.from_date <= ld_tran_date and a.to_date >= ld_tran_date and a.site_code = ls_sitecode and a.acct_code = as_acct_code and a.cctr_code = as_cctr_code and b.def_budget = 'Y' ; end if; exception when no_data_found then ac_budget_amt := 0; return ac_budget_amt ; end; return ac_budget_amt; exception when no_data_found then ac_budget_amt := -1; return ac_budget_amt ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INDENT_PURC (as_indno in char) return char is ls_purcorder char(10); cursor c1 is select porddet.purc_order from porddet, porder where porddet.purc_order = porder.purc_order and porddet.ind_no = as_indno order by porder.ord_date desc, porddet.purc_order desc; begin ls_purcorder := ' '; for cdescr in c1 loop begin exit when c1%notfound; ls_purcorder := cdescr.purc_order; exit; end; end loop; return ls_purcorder ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PROFWSHEETMSTSEQ_X ON PROF_WSHEET_MSTSEQ (HIER_KEY) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_BENEFIT_BANK_DETAILS (AS_ref_no despatchdet.invoice_id%type,as_line_no__ref despatchdet.line_no%type,as_type char) return varchar2 is is_bank_name varchar2(40); is_bank_code CHAR(20); is_bank_refno varchar2(40); is_exch_rate number(14,6); begin select receipt.EXCH_RATE,receipt.bank_code,bank.bank_name,bank.BANK_REFNO into is_exch_rate,is_bank_code,is_bank_name,is_bank_refno from rcpdet,receipt,bank,despatchdet where ( receipt.TRAN_ID = rcpdet.TRAN_ID ) and ( despatchdet.invoice_id = rcpdet.ref_no (+)) and ( receipt.bank_code = bank.bank_code (+)) and ( despatchdet.invoice_id = AS_ref_no ) and ( despatchdet.line_no = as_line_no__ref ) and ( rcpdet.REF_SER = 'S-INV' ); if as_type = 'A' then dbms_output.put_line('For ' || as_type || ' Return ' || trim(is_bank_code)); return trim(is_bank_code); elsif as_type = 'B' then dbms_output.put_line('For ' || as_type || ' Return ' || trim(is_bank_name)); return trim(is_bank_name); elsif as_type = 'C' then dbms_output.put_line('For ' || as_type || ' Return ' || trim(is_bank_refno)); return trim(is_bank_refno); else dbms_output.put_line('For ' || as_type || ' Return ' || to_char(is_exch_rate)); return to_char(is_exch_rate); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSTK_MVMT (as_tranid in char, as_refser in char, as_refid in char, as_fieldname in char, as_lineno in char) return char is ls_fieldvalue char(250); ls_tempvar char(10); begin if ltrim(rtrim(as_refser)) = 'ADJ-ISS' or ltrim(rtrim(as_refser)) = 'ADJRCP' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(ref_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from invtrace where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Reason:'||rtrim(nvl(reas_code,''))||' '||rtrim(nvl(remarks,'')) into ls_fieldvalue from invtrace where tran_id = as_tranid; end if; end; end if; if ltrim(rtrim(as_refser)) = 'C-ISS' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(cons_issue)||' Date:'||rtrim(nvl(to_char(issue_date,'dd/mm/yy'),'')) into ls_fieldvalue from consume_iss where cons_issue = as_refid; end if; if as_fieldname = 'FIELD2' then select 'Dept Code:'||rtrim(consume_iss.dept_code)||' '||rtrim(department.descr) into ls_fieldvalue from consume_iss, department where consume_iss.cons_issue = as_refid and consume_iss.dept_code = department.dept_code; end if; end; end if; if ltrim(rtrim(as_refser)) = 'D-ISS' OR ltrim(rtrim(as_refser)) = 'D-RCP' then begin if (ltrim(rtrim(as_refser)) = 'D-ISS') and as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from distord_iss where tran_id = as_tranid; end if; if (ltrim(rtrim(as_refser)) = 'D-RCP') and as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from distord_rcp where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' and ltrim(rtrim(as_refser)) = 'D-ISS' then select 'Site:'||rtrim(distord_iss.site_code__dlv)||' '||rtrim(nvl(site.descr,''))||'-'||rtrim(nvl(site.city,'')) into ls_fieldvalue from distord_iss, site where distord_iss.tran_id = as_refid and distord_iss.site_code__dlv = site.site_code; end if; if as_fieldname = 'FIELD2' and ltrim(rtrim(as_refser)) = 'D-RCP' then select 'Site:'||rtrim(distord_rcp.site_code__ship)||' '||rtrim(site.descr)||'-'||rtrim(site.city) into ls_fieldvalue from distord_rcp, site where distord_rcp.tran_id = as_refid and distord_rcp.site_code__ship = site.site_code; end if; end; end if; if ltrim(rtrim(as_refser)) = 'P-RCP' or ltrim(rtrim(as_refser)) = 'P-RET' then begin if as_fieldname = 'FIELD1' then select supp_code into ls_tempvar from porcp where tran_id = rtrim(as_refid); select 'Supp:'||rtrim(nvl(supp_code,''))||' '||rtrim(nvl(sh_name,''))||' - '||rtrim(nvl(city,'')) into ls_fieldvalue from supplier where supp_code = ls_tempvar; end if; if as_fieldname = 'FIELD2' then select supp_code__mnfr into ls_tempvar from porcpdet where tran_id = as_refid and line_no = as_lineno; select 'Mfg: '||rtrim(nvl(supp_code,''))||' '||rtrim(nvl(sh_name,''))||' - '||rtrim(nvl(city,'')) into ls_fieldvalue from supplier where supp_code = ls_tempvar; end if; if as_fieldname = 'FIELD3' then select 'Doc No.:' || rtrim(nvl(dc_no,''))||' Date:'||rtrim(nvl(to_char(dc_date,'dd/mm/yy'),'')) into ls_fieldvalue from porcp where tran_id = as_refid; end if; if as_fieldname = 'FIELD4' then select 'Batch No.:'||rtrim(nvl(batch_no,''))||' Mfg.:'||rtrim(nvl(to_char(mfg_date,'dd/mm/yy'),''))||' Exp. :'||rtrim(nvl(to_char(expiry_date,'dd/mm/yy'),'')) into ls_fieldvalue from porcpdet where tran_id = as_refid and line_no = as_lineno; end if; end; end if; if rtrim(ltrim(as_refser)) = 'R-BFS' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from receipt_backflush where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Item Code:'||rtrim(receipt_backflush.item_code)||' '||rtrim(item.descr) into ls_fieldvalue from receipt_backflush, item where receipt_backflush.tran_id = as_refid and receipt_backflush.item_code = item.item_code; end if; if as_fieldname = 'FIELD3' then select 'Lot no:'||lot_no into ls_fieldvalue from receipt_backflush where tran_id = as_refid; end if; end; end if; if rtrim(ltrim(as_refser)) = 'S-DSP' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(desp_id)||' Date:'||rtrim(nvl(to_char(desp_date,'dd/mm/yy'),'')) into ls_fieldvalue from despatch where desp_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Customer:'||rtrim(despatch.cust_code__dlv)||' '||rtrim(customer.cust_name)||'-'||rtrim(city) into ls_fieldvalue from despatch, customer where despatch.desp_id = as_refid and despatch.cust_code__dlv = customer.cust_code; end if; end; end if; if rtrim(ltrim(as_refser)) = 'S-RET' then begin if as_fieldname = 'FIELD1' then select 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_fieldvalue from sreturn where tran_id = as_tranid; end if; if as_fieldname = 'FIELD2' then select 'Customer:'||rtrim(sreturn.cust_code)||' '||rtrim(customer.cust_name)||'-'||rtrim(city) into ls_fieldvalue from sreturn, customer where sreturn.tran_id = as_refid and sreturn.cust_code = customer.cust_code; end if; end; end if; if rtrim(ltrim(as_refser)) = 'W-IRTN' or rtrim(ltrim(as_refser)) = 'W-ISS' then begin if as_fieldname = 'FIELD1' then select work_order, 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_tempvar, ls_fieldvalue from workorder_iss where workorder_iss.tran_id = as_refid; end if; if as_fieldname = 'FIELD2' then select work_order into ls_tempvar from workorder_iss where workorder_iss.tran_id = as_refid; select 'Item:'||rtrim(workorder.item_code)||' '||rtrim(item.descr) into ls_fieldvalue from workorder, item where workorder.tran_id = ls_tempvar and workorder.item_code = item.item_code; end if; if as_fieldname = 'FIELD3' then select work_order into ls_tempvar from workorder_iss where workorder_iss.tran_id = as_refid; select 'Batch No:'||workorder.lot_no into ls_fieldvalue from workorder where workorder.tran_id = ls_tempvar; end if; end; end if; if rtrim(ltrim(as_refser)) = 'W-RCP' then begin if as_fieldname = 'FIELD1' then select work_order, 'Tran ID:'||rtrim(tran_id)||' Date:'||rtrim(nvl(to_char(tran_date,'dd/mm/yy'),'')) into ls_tempvar, ls_fieldvalue from workorder_receipt where workorder_receipt.tran_id = as_refid; end if; if as_fieldname = 'FIELD2' then select work_order into ls_tempvar from workorder_receipt where workorder_receipt.tran_id = as_refid; select 'Item:'||rtrim(workorder.item_code)||' '||rtrim(item.descr) into ls_fieldvalue from workorder, item where workorder.tran_id = ls_tempvar and workorder.item_code = item.item_code; end if; if as_fieldname = 'FIELD3' then select work_order into ls_tempvar from workorder_receipt where workorder_receipt.tran_id = as_refid; select 'Batch No:'||workorder.lot_no into ls_fieldvalue from workorder where workorder.tran_id = ls_tempvar; end if; end; end if; return ls_fieldvalue ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_UMOINTEGRALQTY (as_unit_fr IN char,as_unit_to IN char,AS_ITEM IN CHAR) return number IS as_qty number(12,3); BEGIN BEGIN SELECT FACT into as_qty FROM UOMCONV WHERE unit__fr = as_unit_fr AND unit__to = as_unit_to; EXCEPTION WHEN NO_DATA_FOUND THEN as_qty := 0; WHEN TOO_MANY_ROWS THEN BEGIN SELECT FACT into as_qty FROM UOMCONV WHERE unit__fr = as_unit_fr AND unit__to = as_unit_to AND ITEM_CODE = AS_ITEM; EXCEPTION WHEN NO_DATA_FOUND THEN as_qty := 0; END; END; RETURN nvl(as_qty,0); END GET_UMOINTEGRALQTY; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_CONS_QCTRANS (as_tran_id in char, as_itemcode in char, as_lotno in char,as_loccode in char,as_lotsl in char) return varchar2 is ll_qccount number(6,0) := 0; ll_qtcount number(6,0) := 0; ll_qt1count number(6,0) := 0; ll_qt2count number(6,0) := 0; ll_qt3count number(6,0) := 0; ls_retval number := 0; lsite_code char(5); begin select site_code__ord into lsite_code from consume_iss where cons_issue =as_tran_id and tran_type='I'; Select count(*) into ll_qccount from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl=as_lotsl and status='U'; select count(*) into ll_qt2count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code=as_loccode and lot_sl IS NULL and status='U'; select count(*) into ll_qt3count from qc_order where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and loc_code IS NULL and lot_sl IS NULL and status='U'; Select count(*) into ll_qtcount from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and loc_code__trf=as_loccode and confirmed='Y'; select count(*) into ll_qt1count from qc_transfer where site_code=lsite_code and item_code=as_itemcode and lot_no=as_lotno and lot_sl=as_lotsl and confirmed='Y' and loc_code__trf<>as_loccode; if (ll_qccount>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt2count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qt3count>0 and ll_qtcount>0) then ls_retval:=0; elsif (ll_qccount >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt2count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qt3count >0 and ll_qt1count>0) then ls_retval:=1; elsif (ll_qccount>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt2count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; elsif (ll_qt3count>0 and ll_qtcount=0 and ll_qt1count=0) then ls_retval:=1; else ls_retval:=0; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_SPRS_WORK_STAN_TYPE ( ls_sales_pers sprs_travel.sales_pers%type, ld_travel_date sprs_travel.travel_date%type) return varchar2 is ls_stan_type stantype.stan_type%type; begin select a.stan_type into ls_stan_type from fieldactivity a where a.activity_code = (select max(activity_code) from sprs_travel where sales_pers = ls_sales_pers and travel_date = ld_travel_date); if ls_stan_type is null then select distinct(g.stan_type) into ls_stan_type from sprs_travel e,sprs_route f,stantype g where e.sales_pers = ls_sales_pers and e.travel_date = ld_travel_date and f.sprs_code = e.sales_pers and f.locality_code = e.locality_code and g.stan_type = f.station_type and g.precedence = (select min(d.precedence) from sprs_travel b, sprs_route c, stantype d where b.sales_pers = e.sales_pers and b.travel_date = e.travel_date and c.sprs_code = b.sales_pers and c.locality_code = b.locality_code and d.stan_type = c.station_type); end if; return ls_stan_type; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NUMBERTOWORD_CHEQUE (num NUMBER) RETURN VARCHAR2 IS RESULT VARCHAR2 (2000); n NUMBER := 0; l NUMBER := 0; x VARCHAR2 (2000) := ''; y VARCHAR2 (2000) := ''; x1 VARCHAR2 (2000) := ''; c1 VARCHAR2 (2000) := ''; decml NUMBER; decplace NUMBER; BEGIN n := ABS (ROUND (num, 2)); decplace := INSTR (num, '.'); IF n > 999999999.99 THEN RESULT := 'INVALID AMOUNT'; ELSE IF decplace > 0 THEN --decml := SUBSTR (n, decplace + 1, 2); decml := (n mod 1) * 100; y := TO_CHAR (TO_DATE (decml, 'J'), 'JSP') || ' '; y := y || ' PAISE '; n := FLOOR (n); ELSE y := ''; END IF; l := LENGTH (n); IF (n > 0 AND n <= 99999) THEN x := TO_CHAR (TO_DATE (n, 'J'), 'JSP') || ' '; ELSE IF (TO_NUMBER (SUBSTR (n, l - 5 + 1)) = 0) THEN x := ''; ELSE x := TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (n, l - 5 + 1)), 'J'),'JSP' ) || ' '; END IF; IF (l = 6) THEN x1 :=TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (n, 1, l - 5)), 'J'),'JSP' )|| ' LAKH '; ELSE IF (TO_NUMBER (SUBSTR (n, l - 5 - 1, 2)) = 0) THEN x1 := ''; ELSE x1 :=TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (n, l - 5 - 1, 2)),'J'), 'JSP') || ' LAKH '; END IF; IF (l >= 8) THEN c1 :=TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (n, 1, l - 7)),'J'),'JSP')|| ' CRORE '; END IF; END IF; END IF; IF n = 0 THEN RESULT := y || 'ONLY'; ELSIF n = 1 THEN RESULT := x || 'RUPEE ONLY'; if y is not null then RESULT := x || 'RUPEE AND ' || y || 'ONLY'; end if; ELSE RESULT := c1 || x1 || x || 'RUPEES ONLY'; if y is not null then RESULT := c1 || x1 || x || 'RUPEES AND ' || y || 'ONLY'; end if; END IF; END IF; IF SIGN (num) = -1 THEN RETURN 'NEGATIVE ' || RESULT; ELSE RETURN RESULT; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX SPRS_PLAN_X ON SPRS_PLAN (PLAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_EXCISE_RTVALUE (ldesp_id in char, litem_code in char, lline_no in char, lc_eff_qty in number) return NUMBER is lc_rem_value NUMBER(14,3); begin select nvl(sum(rate__stduom * lc_eff_qty),0) into lc_rem_value from despatchdet where desp_id = ldesp_id and item_code = litem_code and ltrim(line_no) = lline_no; return (lc_rem_value); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRIG_DISORD_TRANTYPE BEFORE INSERT OR UPDATE on DISTORDER FOR EACH ROW BEGIN IF :NEW.TRAN_TYPE IS NULL THEN :NEW.TRAN_TYPE := ' '; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_STATION_DESCR (ls_site_code char, ls_stan_code char) return varchar2 is ls_descr VARCHAR2(40); begin select descr into ls_descr from station where stan_code = (select stan_code from site where site_code = ls_site_code) and rownum =1; return (nvl(ls_descr,'')); exception when no_data_found then select descr into ls_descr from station where stan_code = ls_stan_code and rownum = 1; return (nvl(ls_descr,'')); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_REFERENCE_DESCR (as_type in char,as_ref_code in char) return varchar is ls_descr varchar(120); BEGIN if (as_type = 'I') then select DESCR into ls_descr from item where item_code = as_ref_code; else select supp_name into ls_descr from supplier where supp_code=as_ref_code; end if; RETURN ls_descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SERIES_DUP_X ON STRG_SERIES_DUP (SC_CODE, ITEM_SER, SALES_PERS, EFF_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RWSSCORE_DOC_ONCE_NOV (as_sales_pers char, as_from_date date, as_to_date date) return number is ls_return number (14,0); begin begin select count(*) into ls_return from (SELECT sm.strg_code, COUNT(SM.STRG_CODE) as as_count FROM STRG_MEET SM JOIN SALES_PERS S ON SM.SALES_PERS = S.SALES_PERS WHERE SM.EVENT_DATE BETWEEN as_from_date AND as_to_date AND sm.sales_pers=as_sales_pers and SM.STRG_TYPE = 'D' AND SM.STRG_CLASS_CODE = 'E' AND S.ITEM_SER ='OTC' group by sm.strg_code having COUNT(SM.STRG_CODE) =1 )a ; exception when no_Data_found then ls_return:=0; end; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_STN_CHALLAN_ADDR (as_tran_id in char) return char is ls_name varchar2(100); ls_add1 varchar2(100); ls_add2 varchar2(100); ls_add3 varchar2(100); ls_city varchar2(100); ls_state varchar2(100); ls_pin varchar2(100); ls_sundry varchar2(100); ls_type varchar2(100); ls_distord varchar2(100); ls_return varchar2(2000); ls_site varchar2(100); begin select dist_order into ls_distord from distord_iss where tran_id = as_tran_id; if sqlcode() <> 0 then ls_return := ''; else select sundry_code,sundry_type into ls_sundry,ls_type from distorder where dist_order = ls_distord; if sqlcode() <> 0 then ls_return :=''; elsif ls_sundry<>'0' or not(ls_sundry) is null then if ls_type = 'C' then select cust_name,addr1,addr2,addr3,city,state_code,pin into ls_name,ls_add1,ls_add2,ls_add3,ls_city,ls_state,ls_pin from customer where cust_code = ls_sundry; if sqlcode() <> 0 then ls_return := ''; end if; elsif ls_type = 'S' then select supp_name,addr1,addr2,addr3,city,state_code,pin into ls_name,ls_add1,ls_add2,ls_add3,ls_city,ls_state,ls_pin from supplier where supp_code = ls_sundry; if sqlcode() <> 0 then ls_return := ''; end if; end if; ls_sundry := ls_sundry || chr(10); if (ls_name )is null then ls_name := ''; else ls_name := trim(ls_name );end if; if (ls_add1 )is null then ls_add1 := ''; else ls_add1 := chr(10) || trim(ls_add1 );end if; if (ls_add2 )is null then ls_add2 := ''; else ls_add2 := chr(10) || trim(ls_add2 );end if; if (ls_add3 )is null then ls_add3 := ''; else ls_add3 := chr(10) || trim(ls_add3 );end if; if (ls_city )is null then ls_city := ''; else ls_city := chr(10) || trim(ls_city );end if; if (ls_state)is null then ls_state := ''; else ls_state := ', ' || trim(ls_state);end if; if (ls_pin )is null then ls_pin := ''; else ls_pin := ' - ' || trim(ls_pin);end if; ls_return := ls_sundry || ls_name || ls_add1 || ls_add2 || ls_add3 || ls_city || ls_state || ls_pin; else select site_code__dlv into ls_site from distord_iss where tran_id = as_tran_id; if sqlcode() <> 0 then ls_return := ''; else select descr,add1,add2,add3,city,state_code,pin into ls_name,ls_add1,ls_add2,ls_add3,ls_city,ls_state,ls_pin from site where site_code = ls_site; if sqlcode() <> 0 then ls_return := ''; else ls_site := ls_site || chr(10) ; if (ls_name )is null then ls_name := ''; else ls_name := trim(ls_name );end if; if (ls_add1 )is null then ls_add1 := ''; else ls_add1 := chr(10) || trim(ls_add1 );end if; if (ls_add2 )is null then ls_add2 := ''; else ls_add2 := chr(10) || trim(ls_add2 );end if; if (ls_add3 )is null then ls_add3 := ''; else ls_add3 := chr(10) || trim(ls_add3 );end if; if (ls_city )is null then ls_city := ''; else ls_city := chr(10) || trim(ls_city );end if; if (ls_state)is null then ls_state := ''; else ls_state := ', ' || trim(ls_state);end if; if (ls_pin )is null then ls_pin := ''; else ls_pin := ' - ' || trim(ls_pin );end if; ls_return := ls_site || ls_name || ls_add1 || ls_add2 || ls_add3 || ls_city || ls_state || ls_pin; end if; end if; end if; end if; return ls_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PORCPDET_PO_NO ON PORCPDET (PURC_ORDER, LINE_NO__ORD) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER TRIG_PAY_IBCADET before insert on pay_ibca_det for each row declare max_line_no number(4); begin max_line_no := 0; if :new.line_no is null then select max(line_no) into max_line_no from pay_ibca_det where tran_id = :new.tran_id; :new.line_no := nvl(max_line_no , 0) + 1; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_MFGDATE (as_workorder in char, as_lotno in char) return date is ldt_mfgdate date; ls_lotnoissue varchar2(120); ls_bomcode char(10); ls_string varchar2(1000); ls_token varchar2(1000); ls_sql varchar2(2000); ldt_today date; ldt_reldate date; begin begin select lot_no__issue, mfg_date__start, bom_code, rel_date into ls_lotnoissue, ldt_mfgdate, ls_bomcode, ldt_reldate from workorder where work_order = as_workorder; end; if ls_lotnoissue is null then ls_lotnoissue := ' '; end if; if ldt_mfgdate is null or to_char(ldt_mfgdate,'dd-mm-yyyy') = '01-01-1900' then begin loop exit when instr(ls_lotnoissue,',') = 0; ls_Token := ddf_get_token(ls_lotnoissue,',') ; ls_string := ls_string || '''' || ls_Token || ''','; end loop; end; ls_string := '(' || ls_string || '''' || ls_lotnoissue || ''') '; ls_sql := 'select min(mfg_date) from stock ' ; ls_sql := ls_sql || ' where item_code in ' ; ls_sql := ls_sql || ' (select distinct item_code from bomdet where bom_code = ''' || ls_bomcode ||''''; ls_sql := ls_sql || ' and consider_lot_no__issue = ''Y'' ) and lot_no IN ' || ls_string ; execute immediate ls_sql into ldt_mfgdate; if ldt_mfgdate is null then ldt_mfgdate := ldt_reldate; end if; if to_date(fn_sysdate()) - to_date(ldt_reldate) > 30 then -- return the date release date + 30 days ldt_mfgdate := to_date(ldt_mfgdate) + 30; end if; end if; return ldt_mfgdate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_INV_DETAIL ( minvoice_id varchar2, mline_no number, value_of varchar2 ) return varchar2 as ret_value varchar2(50); Begin if value_of = 'comp_code' then Begin select trim(udf3) into ret_value from site where site_code = (select site_code from invoice where invoice_id = minvoice_id); End; elsif value_of = 'comp_name' then Begin select trim(descr) into ret_value from site where site_code = (select site_code from invoice where invoice_id = minvoice_id); End; elsif value_of = 'comp_prod_code' then Begin select trim(item_code) into ret_value from invoice_trace where invoice_id = minvoice_id and line_no = mline_no; End; elsif value_of = 'val_applied_on' then --VAT applied on Begin select trim(udf6) into ret_value from site where site_code = (select site_code from invoice where invoice_id = minvoice_id); End; elsif value_of = 'excise_duity' then --Excise Duty Begin select round(a.rate,2) into ret_value from pricelist a, invoice_trace b where b.invoice_id = minvoice_id and b.line_no = mline_no and a.price_list = 'EXC' and a.item_code = b.item_code and a.list_type = 'B' and a.lot_no__from <= b.lot_no and a.lot_no__to >= b.lot_no; End; elsif value_of = 'pts' then --pts Begin select nvl(round(rate,4),0) into ret_value from invoice_trace where invoice_id = minvoice_id and line_no = mline_no; End; elsif value_of = 'ptr' then --ptr Begin select nvl(round(d.rate,2),0) into ret_value from pricelist d, gencodes c, sorder b, invoice_trace e, invoice a where a.invoice_id = minvoice_id and e.invoice_id = a.invoice_id and e.line_no = mline_no and b.sale_order = e.sord_no and c.fld_name = 'PRICE_LIST' and c.fld_value = b.price_list and d.price_list = c.udf_str1 and d.item_code = e.item_code and e.lot_no between d.lot_no__from and d.lot_no__to; if ret_value = 0 then select nvl(round(d.rate,2),0) into ret_value from pricelist d, invoice_trace e, invoice a where a.invoice_id = minvoice_id and e.invoice_id = a.invoice_id and e.line_no = mline_no and d.price_list = 'SRLGN' and d.item_code = e.item_code and e.lot_no between d.lot_no__from and d.lot_no__to; end if; Exception when no_data_found then select nvl(round(d.rate,2),0) into ret_value from pricelist d, invoice_trace e, invoice a where a.invoice_id = minvoice_id and e.invoice_id = a.invoice_id and e.line_no = mline_no and d.price_list = 'SRLGN' and d.item_code = e.item_code and e.lot_no between d.lot_no__from and d.lot_no__to; when too_many_rows then select max(nvl(round(d.rate,2),0)) into ret_value from pricelist d, gencodes c, sorder b, invoice_trace e, invoice a where a.invoice_id = minvoice_id and e.invoice_id = a.invoice_id and e.line_no = mline_no and b.sale_order = e.sord_no and c.fld_name = 'PRICE_LIST' and c.fld_value = b.price_list and d.price_list = c.udf_str1 and d.item_code = e.item_code and e.lot_no between d.lot_no__from and d.lot_no__to; End; elsif value_of = 'vat_perc' then --vat_perc Begin select max(ddf_inv_tax_itemwise(minvoice_id,mline_no,'PERC')) into ret_value from dual; End; End if; return ret_value; End fn_get_inv_detail; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RSITE_DESCR ( as_site_code CHAR) RETURN VARCHAR2 IS ls_descr VARCHAR2(100); BEGIN BEGIN SELECT descr INTO ls_descr FROM site WHERE site_code = as_site_code; EXCEPTION WHEN no_data_found THEN ls_descr := NULL; END; RETURN ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DESPATCH_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON DESPATCH referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; BEGIN if :new.confirmed = 'Y' then begin begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_DESP'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_despdet in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM DESPATCHDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.DESP_ID = :new.desp_id ) loop if cur_despdet.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then -- 1. check detail count and gltrace count begin select count(1) into ll_count from despatchdet where desp_id = :new.desp_id; exception when others then ll_count:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'S-DSP' and ref_id = :new.desp_id; exception when others then ll_glcount := 0; end; if ll_count > 0 then begin SELECT sum(cost_rate * quantity) into lc_rate FROM despatchdet where desp_id = :new.desp_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'S-DSP' and ref_id = :new.desp_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; -- count end end if ; end if; end; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_RETAGE (AS_GENDER NUMBER) RETURN NUMBER IS M_RETURN NUMBER(16,4) :=0; BEGIN M_RETURN := CASE WHEN AS_GENDER = 1 THEN 60 WHEN AS_GENDER = 2 THEN 59 ELSE 60 END; RETURN M_RETURN; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FT_BENEFIT_APPL_X ON FT_BENEFIT_APPL (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PK_SALES_PERFORMANCE_DET ON SALES_PERFORMANCE_DET (PRD_CODE, SALES_PERS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RITSHEET_DESCR (as_var_name in char) return varchar is ls_descr varchar(100); begin select descr into ls_descr from payrparm where prd_code='999999' and var_name=as_var_name; return ls_descr; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SORDERQTY (as_sorder in char, as_item_code in char) return number is lc_qty number(14,3); begin select nvl(sum(quantity__stduom),0) into lc_qty from sorddet where sale_order = as_sorder and item_code = as_item_code ; return lc_qty ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DRCR_PDET_X ON DRCR_PDET (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ACCT_DETRT_TYPE (ls_item_ser IN CHAR,ls_purpose IN CHAR,ls_item_code IN CHAR,ls_tran_type IN CHAR,ls_site_code IN CHAR) RETURN NUMBER IS ls_retval number(1):=1; acct_col_name VARCHAR(20); cctr_col_name VARCHAR(20); ls_fin_entity CHAR(10); ls_grp_code CHAR(5); ls_item_series CHAR(5); ls_fin_entity_val CHAR(10); ls_item_code_val CHAR(10); ls_group_cd_val CHAR(5); ls_item_ser_val CHAR(5); ls_tran_type_val CHAR(3); ls_site_code_val CHAR(10); ls_acct_col CHAR(10); ls_cctr_col CHAR(4); ls_acct_col_itm_sr CHAR(10); ls_cctr_col_itm_sr CHAR(4); ls_count NUMBER(6, 0); ls_stk_opt CHAR(1); ls_cnt NUMBER(6, 0); plsql_block VARCHAR2(500); begin ls_retval := 1; ls_fin_entity := ' '; ls_grp_code := ' '; ls_item_series := ' '; acct_col_name := ' '; cctr_col_name := ' '; ls_fin_entity_val := ' '; ls_group_cd_val := ' '; ls_acct_col := ' '; ls_cctr_col := ' '; ls_item_ser_val := ls_item_ser; ls_item_code_val := ls_item_code; ls_tran_type_val := ls_tran_type; ls_site_code_val := ls_site_code; ls_count := 0; if trim(ls_item_code_val) is null then ls_item_code_val := ' '; end if; if trim(ls_item_ser_val) is null then ls_item_ser_val := ' '; end if; if trim(ls_tran_type_val) is null then ls_tran_type_val := ' '; end if; if trim(ls_site_code_val) is null then ls_site_code_val := ' '; end if; begin begin select count(1) into ls_cnt from site where site_code =ls_site_code_val; end; if ls_cnt>0 then select fin_entity into ls_fin_entity from site where site_code =ls_site_code_val; end if; ls_cnt:=0; end; if ls_fin_entity='null' or trim(ls_fin_entity) = '' then ls_fin_entity := ' '; end if; begin select count(1) into ls_cnt from item where item_code =ls_item_code_val; end; if ls_cnt>0 then begin select grp_code, item_ser into ls_grp_code,ls_item_series from item where item_code =ls_item_code_val; end; ls_cnt:=0; end if; if trim(ls_item_series) is null then ls_item_series := ' '; end if; if trim(ls_purpose) = 'DIS' then acct_col_name :='acct_code__dis'; cctr_col_name :='cctr_code__dis'; ElsIf trim(ls_purpose) = 'TAXRECO' then acct_col_name :='acct_code__reco'; cctr_col_name :='cctr_code__reco'; ElsIf trim(ls_purpose) = 'COGS' then acct_col_name :='acct_code__cogs'; cctr_col_name :='cctr_code__cogs'; ElsIf trim(ls_purpose) = 'SAL' then acct_col_name :='acct_code__sal'; cctr_col_name :='acct_code__sal'; ElsIf trim(ls_purpose) = 'AR' then acct_col_name :='acct_code__ar'; cctr_col_name :='cctr_code__ar'; ElsIf trim(ls_purpose) = 'SRET' then acct_col_name :='acct_code__sret'; cctr_col_name :='cctr_code__sret'; ElsIf trim(ls_purpose) = 'IN' then begin select count(1) into ls_cnt from item where item_code =ls_item_code_val; end; if ls_cnt>0 then begin select stk_opt into ls_stk_opt from item where item_code =ls_item_code_val; end; ls_cnt:=0; end if; if trim(ls_stk_opt) = '0' then acct_col_name :='acct_code__ph'; cctr_col_name :='cctr_code__ph'; else acct_col_name :='acct_code__in'; cctr_col_name :='cctr_code__in'; end if; ElsIf trim(ls_purpose) = 'PO' then acct_col_name :='acct_code__ap'; cctr_col_name :='cctr_code__ap'; ElsIf trim(ls_purpose) = 'POVOU' then acct_col_name :='acct_code__ap'; cctr_col_name :='cctr_code__ap'; ElsIf trim(ls_purpose) = 'PORCP' then acct_col_name :='acct_code__pr'; cctr_col_name :='cctr_code__pr'; ElsIf trim(ls_purpose) = 'STKINV' then acct_col_name :='acct_code__in'; cctr_col_name :='cctr_code__in'; ElsIf trim(ls_purpose) = 'ADDCOST' then acct_col_name :='acct_code__adcost'; cctr_col_name :='cctr_code__adcost'; ElsIf trim(ls_purpose) = 'CISS' then acct_col_name :='acct_code__ciss'; cctr_col_name :='cctr_code__ciss'; ElsIf trim(ls_purpose) = 'XFRX' then acct_col_name :='acct_code__trf'; cctr_col_name :='cctr_code__trf'; ElsIf trim(ls_purpose) = 'FA-PL' then acct_col_name :='acct_code__pl'; cctr_col_name :='cctr_code__pl'; ElsIf trim(ls_purpose) = 'FA-LOSS' then acct_col_name :='acct_code__loss'; cctr_col_name :='cctr_code__loss'; ElsIf trim(ls_purpose) = 'FA' then acct_col_name :='acct_code__fa'; cctr_col_name :='cctr_code__fa'; ElsIf trim(ls_purpose) = 'ACCDEPR' then acct_col_name :='acct_code__acc_depr'; cctr_col_name :='cctr_code__acc_depr'; ElsIf trim(ls_purpose) = 'DEPR' then acct_col_name :='acct_code__depr'; cctr_col_name :='cctr_code__depr'; ElsIf trim(ls_purpose) = 'DEPRWB' then acct_col_name :='acct_code__depr_wb'; cctr_col_name :='cctr_code__depr_wb'; ElsIf trim(ls_purpose) = 'PPV' then acct_col_name :='acct_code__ppv'; cctr_col_name :='cctr_code__ppv'; ElsIf trim(ls_purpose) = 'PH' then acct_col_name :='acct_code__ph'; cctr_col_name :='cctr_code__ph'; ElsIf trim(ls_purpose) = 'AREV' then acct_col_name :='acct_code__arev'; cctr_col_name :='cctr_code__arev'; ElsIf trim(ls_purpose) = 'CRREV' then acct_col_name :='acct_code__crrev'; cctr_col_name :='cctr_code__crrev'; ElsIf trim(ls_purpose) = 'DREV' then acct_col_name :='acct_code__drev'; cctr_col_name :='cctr_code__drev'; ElsIf trim(ls_purpose) = 'DRREV' then acct_col_name :='acct_code__drrev'; cctr_col_name :='cctr_code__drrev'; ElsIf trim(ls_purpose) = 'FRECOST' then acct_col_name :='acct_code__fre'; cctr_col_name :='cctr_code__fre'; ElsIf trim(ls_purpose) = 'CLECOST' then acct_col_name :='acct_code__cle'; cctr_col_name :='cctr_code__cle'; ElsIf trim(ls_purpose) = 'INSCOST' then acct_col_name :='acct_code__ins'; cctr_col_name :='cctr_code__ins'; ElsIf trim(ls_purpose) = 'STKINVRCP' then acct_col_name :='acct_code__iss'; cctr_col_name :='cctr_code__iss'; ElsIf trim(ls_purpose) = 'APADV' then acct_col_name :='acct_code__ap_adv'; cctr_col_name :='cctr_code__ap_adv'; end if; ls_fin_entity_val := ls_fin_entity; ls_group_cd_val := ls_grp_code; if trim(ls_fin_entity_val) is not null then begin select count(1) into ls_count from item_acct_detr where fin_entity =ls_fin_entity_val; end; if ls_count = 0 then ls_fin_entity_val := ' '; end if; else ls_fin_entity_val := ' '; end if; plsql_block := 'select '||acct_col_name||', '||cctr_col_name||' from item_acct_detr where item_code =:1 and item_ser =:2 and tran_type =:3 and fin_entity=:4 and grp_code = :5'; for run_ctr in 0 .. 4 loop if run_ctr = 0 then begin select count(1) into ls_cnt from item_acct_detr where item_code =ls_item_code_val and item_ser =ls_item_ser_val and tran_type =ls_tran_type_val and fin_entity=ls_fin_entity_val and grp_code = ' '; end; if ls_cnt>0 then begin EXECUTE IMMEDIATE plsql_block INTO ls_acct_col,ls_cctr_col using ls_item_code_val,ls_item_ser_val,ls_tran_type_val,ls_fin_entity_val,' '; end; end if; ls_cnt:=0; end if; if run_ctr = 1 then begin select count(1) into ls_cnt from item_acct_detr where item_code =' ' and item_ser =ls_item_ser_val and tran_type =ls_tran_type_val and fin_entity=ls_fin_entity_val and grp_code = ls_group_cd_val; end; if ls_cnt>0 then begin EXECUTE IMMEDIATE plsql_block INTO ls_acct_col,ls_cctr_col using ' ',ls_item_ser_val,ls_tran_type_val,ls_fin_entity_val,ls_group_cd_val; end; end if; ls_cnt:=0; end if; if run_ctr = 2 then begin select count(1) into ls_cnt from item_acct_detr where item_code =ls_item_code_val and item_ser =' ' and tran_type =ls_tran_type_val and fin_entity=ls_fin_entity_val and grp_code = ' '; end; if ls_cnt>0 then begin EXECUTE IMMEDIATE plsql_block INTO ls_acct_col,ls_cctr_col using ls_item_code_val,' ',ls_tran_type_val,ls_fin_entity_val,' '; end; end if; ls_cnt:=0; end if; if run_ctr = 3 then begin select count(1) into ls_cnt from item_acct_detr where item_code =' ' and item_ser =' ' and tran_type =ls_tran_type_val and fin_entity=ls_fin_entity_val and grp_code = ls_group_cd_val; end; if ls_cnt>0 then begin EXECUTE IMMEDIATE plsql_block INTO ls_acct_col,ls_cctr_col using ' ',' ',ls_tran_type_val,ls_fin_entity_val,ls_group_cd_val; end; end if; ls_cnt:=0; end if; if run_ctr = 4 then begin select count(1) into ls_cnt from item_acct_detr where item_code =' ' and item_ser =ls_item_ser_val and tran_type =ls_tran_type_val and fin_entity=ls_fin_entity_val and grp_code = ' '; end; if ls_cnt>0 then begin EXECUTE IMMEDIATE plsql_block INTO ls_acct_col,ls_cctr_col using ' ', ls_item_ser_val,ls_tran_type_val,ls_fin_entity_val,' '; end; end if; ls_cnt:=0; end if; if trim(ls_acct_col) is null then ls_acct_col := ''; ls_cctr_col := ''; else exit; end if; end loop; if trim(ls_acct_col) is null then ls_item_ser_val := ls_item_ser; if trim(ls_item_ser_val) is null then ls_item_ser_val := ls_item_series; end if; if trim(ls_item_ser_val) is not null then ls_acct_col := ''; ls_cctr_col := ''; end if; begin select count(1) into ls_cnt from itemser where item_ser =ls_item_ser_val; end; if ls_cnt > 0 then begin plsql_block := 'select '||acct_col_name||', '||cctr_col_name||' from itemser where item_ser =:1'; EXECUTE IMMEDIATE plsql_block INTO ls_acct_col,ls_cctr_col using ls_item_ser_val; end; end if; ls_cnt:=0; if trim(ls_acct_col) is null then ls_retval := 0; end if; end if; RETURN ls_retval; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_UVSLRNO (as_lr_date in despatch.lr_Date%type) return number is FLAG NUMBER(1); ls_checkvalid char(1); begin begin select var_value into ls_checkvalid from disparm where prd_code = '999999' and var_name = 'LY_DESP_LRDT'; exception when others then ls_checkvalid := 'N'; end; if ls_checkvalid = 'Y' then --select (case when ? is null then 0 else 1 end) into ls_count from dual; if as_lr_date is null then RETURN 0; Else RETURN 1; end if; else RETURN 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_VALIDATE_PROJ_EMP_CODE ( as_login_emp_code char, as_PROJ_code char) return number is retVal number := 0; begin select Count(1) into retVal from proj_team a, proj_team_det b where a.team_code = b.team_code and a.team_code in (select team_code from project where proj_code=as_PROJ_code ) and (a.emp_code__head = as_login_emp_code or ( b.emp_code = as_login_emp_code and b.eff_from <= to_date(sysdate) and b.valid_upto >= to_date(sysdate) )); return retVal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_RET (as_tran_id char,as_item_code char,as_line_no char,ls_quantity number ) Return Integer Is Ll_Count Number(14,3); Ls_qty_rcp Number(14,3); Ls_qty_ret Number(14,3); Begin begin Select Count(*) Into Ll_Count From Item Where Item_Code=as_item_code And Stk_Opt='0'; exception when others then Ll_Count := 0; end; If Ll_Count>0 Then begin select d.quantity into Ls_qty_rcp from porcpdet d, porcp p where p.tran_id=d.tran_id and p.tran_ser='P-RCP' and d.tran_id =as_tran_id and TRIM(line_no)=TRIM(as_line_no) and p.confirmed='Y'; exception when others then Ls_qty_rcp := 0; end; begin select sum(quantity) into Ls_qty_ret from porcpdet d, porcp p where p.tran_id=d.tran_id and p.tran_ser='P-RET' and TRIM(line_no__rcp)=TRIM(as_line_no) and tran_id__rcp=as_tran_id and p.confirmed='Y'; exception when others then Ls_qty_ret := 0; end; if Ls_qty_rcp SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISCVCH_AC_PAY BEFORE INSERT ON misc_voucher referencing old as old new as new FOR EACH ROW declare ls_msg varchar2(2); begin if :new.acct_code__pay is null then :new.acct_code__pay := :new.acct_code__ap ; end if; if :new.cctr_code__pay is null then :new.cctr_code__pay := :new.cctr_code__ap ; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_BILL_NO (as_ref_id in char, as_refser in char, as_sundry_code in char , as_tran_id in char ) return char is ls_fieldvalue varchar2(1000); li_cnt number := 0; ls_select varchar2(1000); ctr number; begin begin ls_fieldvalue := '' ; if rtrim(as_refser) = 'M-VOUC' then select rtrim(bill_no)||' - '||bill_date ||' - '||trim(bank_code)||' - '||trim(pay_mode) into ls_fieldvalue from misc_voucher where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'VOUCH' then select rtrim(bill_no)||' - '||bill_date ||' - '||trim(bank_code)||' - '||trim(pay_mode) into ls_fieldvalue from voucher where tran_id = as_ref_id ; if (ls_fieldvalue is null) then select voucher.purc_order into ls_fieldvalue from voucher where voucher.tran_id = as_ref_id ; end if ; end if; if rtrim(as_refser) = 'M-PAY' then select rtrim(ref_no)||' - '|| ref_date||' - '|| rtrim(bank_code) ||' - '||trim(pay_mode) into ls_fieldvalue from misc_payment where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'P-IBCA' then begin declare cursor c1 is SELECT REF_NO ||' - ' ||REF_DATE || ' - ' || BANK_CODE INTO ls_fieldvalue FROM PAY_IBCA_DET WHERE TRAN_ID = as_ref_id and SUNDRY_CODE = as_sundry_code AND abs(TOT_AMT * EXCH_RATE) = ( select abs( (gltrace.dr_amt * gltrace.exch_rate) - ( gltrace.cr_amt * gltrace.exch_rate)) from gltrace where gltrace.tran_id = as_tran_id ) ; begin open c1; ctr := 1; loop fetch c1 into ls_fieldvalue ; if ctr > 0 then ls_fieldvalue := ls_fieldvalue ; end if ; exit when c1%NOTFOUND; ls_select := ls_select||' '|| ls_fieldvalue; ctr := ctr + 1; end loop ; close c1; ls_select := substr(ls_select,1,length(rtrim(ls_select)) - 1 ); return ls_select ; end ; end ; end if; if rtrim(as_refser) = 'R-IBCA' then begin declare cursor c2 is SELECT REF_NO ||' - ' ||REF_DATE || ' - ' || BANK_CODE INTO ls_fieldvalue FROM RCP_IBCA_DET WHERE TRAN_ID = as_ref_id and CUST_CODE = as_sundry_code AND abs(TOT_AMT * EXCH_RATE) = ( select abs( (gltrace.dr_amt * gltrace.exch_rate) - ( gltrace.cr_amt * gltrace.exch_rate)) from gltrace where gltrace.tran_id = as_tran_id ) ; begin open c2; ctr := 1; loop fetch c2 into ls_fieldvalue ; if ctr > 0 then ls_fieldvalue := ls_fieldvalue ; end if ; exit when c2%NOTFOUND; ls_select := ls_select||' '|| ls_fieldvalue; ctr := ctr + 1; end loop ; close c2; ls_select := substr(ls_select,1,length(rtrim(ls_select)) - 1 ); return ls_select ; end ; end ; end if; if rtrim(as_refser) = 'RCP' then select trim(ref_no)||' - '||ref_date||'-'||trim(cust_bank_ref)||' - '||trim(bank_code) ||' - '||trim(rcp_mode) into ls_fieldvalue from receipt where tran_id = as_ref_id; end if; if rtrim(as_refser) = 'MPCANC' then select rtrim(ref_no)||' - '||ref_date||' - '||trim(bank_code) ||' - '||trim(pay_mode) into ls_fieldvalue from MISC_PAYMENT_CANC where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'M-RCP' then select rtrim(ref_no)||' - '||ref_date||' - '||trim(bank_code)||' - '||trim(rcp_mode) into ls_fieldvalue from misc_receipt WHERE tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'M-PAY' then select rtrim(REF_NO)||' - '||ref_date||' - '||trim(bank_code)||' - '||trim(pay_mode) into ls_fieldvalue from misc_payment where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'E-PAY' then select rtrim(REF_NO)||' - '||ref_date||' - '||trim(bank_code)||' - '||trim(pay_mode) into ls_fieldvalue from payment_exp where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'R-DIS' then select rtrim(REF_NO)||' - '||ref_date||' - '||trim(bank_code)||' - '||trim(rcp_mode) into ls_fieldvalue from rcpdishnr where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'JOUR' then select rtrim(REF_NO)||' - '||trim(ref_ser) into ls_fieldvalue from journal where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'CRNINV' then select rtrim(invoice_id) into ls_fieldvalue from drcr_inv where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'DRNRCP' then select rtrim(invoice_id)||' - '||trim(tran_id__rcv) into ls_fieldvalue from drcr_rcp where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'CRNRCP' then select rtrim(invoice_id)||' - '||trim(tran_id__rcv) into ls_fieldvalue from drcr_rcp where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'MDRCRD' then select rtrim(sreturn_no)||' - '||trim(adj_misc_crn) into ls_fieldvalue from misc_drcr_rcp where tran_id = as_ref_id ; end if; if rtrim(as_refser) = 'MDRCRC' then select rtrim(sreturn_no)||' - '||trim(adj_misc_crn) into ls_fieldvalue from misc_drcr_rcp where tran_id = as_ref_id ; end if; exception when no_data_found then ls_fieldvalue := '' ; end; return LTRIM(RTRIM(ls_fieldvalue)); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX USER_POSITION_CONTEXT_X ON USER_POSITION_CONTEXT (PROFILE_ID, POSITION_CONTEXT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_UNIT_DESCR ( as_unit_code IN varchar2 ) RETURN varchar2 IS unit_descr varchar2(20); BEGIN IF as_unit_code = 'BAG' THEN unit_descr := 'BAGS'; ELSIF as_unit_code = 'BAL' THEN unit_descr := 'BALE'; ELSIF as_unit_code = 'BDL' THEN unit_descr := 'BUNDLES'; ELSIF as_unit_code = 'BKL' THEN unit_descr := 'BUCKLES'; ELSIF as_unit_code = 'BOU' THEN unit_descr := 'BILLION OF UNITS'; ELSIF as_unit_code = 'BOX' THEN unit_descr := 'BOX'; ELSIF as_unit_code = 'BTL' THEN unit_descr := 'BOTTLES'; ELSIF as_unit_code = 'BUN' THEN unit_descr := 'BUNCHES'; ELSIF as_unit_code = 'CAN' THEN unit_descr := 'CANS'; ELSIF as_unit_code = 'CBM' THEN unit_descr := 'CUBIC CENTIMETERS'; ELSIF as_unit_code = 'CMS' THEN unit_descr := 'CENTI METERS '; ELSIF as_unit_code = 'CTN' THEN unit_descr := 'CARTONS'; ELSIF as_unit_code = 'DOZ' THEN unit_descr := 'DOZENS'; ELSIF as_unit_code = 'DRM' THEN unit_descr := 'DRUMS'; ELSIF as_unit_code = 'GGK' THEN unit_descr := 'GREAT GROSS'; ELSIF as_unit_code = 'GMS' THEN unit_descr := 'GRAMMES'; ELSIF as_unit_code = 'GRS' THEN unit_descr := 'GROSS'; ELSIF as_unit_code = 'GYD' THEN unit_descr := 'GROSS YARDS'; ELSIF as_unit_code = 'KGS' THEN unit_descr := 'KILOGRAMS'; ELSIF as_unit_code = 'KLR' THEN unit_descr := 'KILOLITRE'; ELSIF as_unit_code = 'KME' THEN unit_descr := 'KILOMETRE'; ELSIF as_unit_code = 'MLT' THEN unit_descr := 'MILILITRE'; ELSIF as_unit_code = 'MTR' THEN unit_descr := 'METERS'; ELSIF as_unit_code = 'NOS' THEN unit_descr := 'NUMBERS'; ELSIF as_unit_code = 'OTH' THEN unit_descr := 'OTHERS'; ELSIF as_unit_code = 'PAC' THEN unit_descr := 'PACKS'; ELSIF as_unit_code = 'PCS' THEN unit_descr := 'PIECES'; ELSIF as_unit_code = 'PRS' THEN unit_descr := 'PAIRS'; ELSIF as_unit_code = 'QTL' THEN unit_descr := 'QUINTAL'; ELSIF as_unit_code = 'ROL' THEN unit_descr := 'ROLLS'; ELSIF as_unit_code = 'SET' THEN unit_descr := 'SETS'; ELSIF as_unit_code = 'SQF' THEN unit_descr := 'SQUARE FEET'; ELSIF as_unit_code = 'SQM' THEN unit_descr := 'SQUARE METERS'; ELSIF as_unit_code = 'SQY' THEN unit_descr := 'SQUARE YARDS'; ELSIF as_unit_code = 'TBS' THEN unit_descr := 'TABLETS'; ELSIF as_unit_code = 'TGM' THEN unit_descr := 'TEN GROSS'; ELSIF as_unit_code = 'THD' THEN unit_descr := 'THOUSANDS'; ELSIF as_unit_code = 'TON' THEN unit_descr := 'TONNES'; ELSIF as_unit_code = 'TUB' THEN unit_descr := 'TUBES'; ELSIF as_unit_code = 'UGS' THEN unit_descr := 'US GALLONS'; ELSIF as_unit_code = 'UNT' THEN unit_descr := 'UNITS'; ELSIF as_unit_code = 'YDS' THEN unit_descr := 'YARDS'; ELSE unit_descr := 'OTHERS'; END IF; RETURN unit_descr; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SORDFORM_MAX_LINE (TRANID IN CHAR) RETURN CHAR IS MCTR NUMBER; BEGIN SELECT COUNT(*) INTO MCTR FROM SORDFORMDET WHERE TRAN_ID = TRANID; IF MCTR > 150 THEN RETURN '0'; ELSE RETURN '1'; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083322 ON CONDN_ACC_DET (CONDN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FDF_TDS_HANDOVER_DATE (ls_ref_ser char , ls_vouch_no char) return varchar2 is ls_date varchar2(50) ; ls_date_det varchar2(50); ctr number(3); cursor c1 is select max (nvl(to_char(misc_payment.handover_date,'dd/mm/yy'),'') ) from misc_payment , misc_paydet where misc_payment.tran_id = misc_paydet.tran_id and misc_paydet.tran_ser='M-VOUC' and misc_paydet.vouch_no in ( select misc_voucher_trace.tran_id from misc_voucher_trace ,TAX where misc_voucher_trace.TAX_CODE = TAX.TAX_CODE AND misc_voucher_trace.amount <>0 and tax.tax_group in ('ITDS ','SRTDS','ECTDS','SHTDS') AND tran_id__ref in ( ls_vouch_no) ) order by handover_date desc ; begin open c1; ctr := 0; ls_date := ' ' ; loop fetch c1 into ls_date_det; exit when c1%NOTFOUND; if ctr > 0 then if length(rtrim(ls_date_det)) > 0 then ls_date_det := ','||ls_date_det ; end if ; end if ; ls_date := rtrim(ls_date)||''|| ls_date_det ; ctr := ctr + 1; end loop ; close c1; return ls_date ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_PRCP_CONSISTENCY BEFORE INSERT OR UPDATE OF confirmed ON porcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_invcount number(3) := 0; ll_poretncount number(3) := 0; ll_count number(6) := 0; ls_shexloccode location.loc_code%type; lc_allocqty number(14,3) := 0; ls_msg varchar2(2000); ls_dis_link CHAR (1); BEGIN ----- 19-sep-16 to avoid simultaneous edit and confirm by 2 users if :new.confirmed = 'N' and :old.confirmed = 'Y' then begin select count(1) into ll_invcount from invtrace where ref_ser in ('P-RCP', 'P-RET') and ref_id = :new.tran_id; exception when others then ll_invcount := 0; end; if ll_invcount > 0 then ll_invcount := 0; raise_application_error( -20601, 'Transaction is already confirmed, cannot update as unconfirmed'); end if; end if; --edi check for cancel and confirm porcp from salesreturn begin select dis_link into ls_dis_link from site_supplier where supp_code = :new.supp_code and site_code = :new.site_code and channel_partner = 'Y'; exception when others then ls_dis_link := ''; end; if :new.confirmed = 'Y' and ls_dis_link <> 'E' then begin select count(1) into ll_poretncount from porcpdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_poretncount:= 0; end; end if; if ll_poretncount > 0 then if :new.confirmed = 'Y' and :old.tran_ser = 'P-RET' then begin select count(1) into ll_poretncount from porcpdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_poretncount:= 0; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'P-RET' and ref_id = :new.tran_id and eff_qty < 0 ; exception when others then ll_invcount := 0; end; end if; if :new.confirmed = 'Y' and :old.tran_ser ='P-RCP' then begin select count(1) into ll_poretncount from porcpdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0'; exception when others then ll_poretncount := 0; end; begin SELECT VAR_VALUE into ls_shexloccode FROM DISPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'LOC_CODE__EX_SHT'; exception when others then ls_shexloccode := '@@@@@@@@'; end; begin select count(1) into ll_invcount from invtrace where ref_ser = 'P-RCP' and ref_id = :new.tran_id and eff_qty > 0 and loc_code <> ls_shexloccode; exception when others then ll_invcount := 0; end; end if; if ll_invcount <> ll_poretncount then ls_msg := ' missing lines ' ; for cur_tran in ( select to_number(trim(line_no)) as line_no from porcpdet w, item i where w.item_code = i.item_code and w.tran_id = :new.tran_id and i.stk_opt <> '0' minus select to_number(trim(ref_line)) from invtrace where ref_ser in ( 'P-RCP','P-RET') and ref_id = :new.tran_id ) loop ls_msg := ls_msg || '[' || to_char (cur_tran.line_no) ||']'; end loop; raise_application_error( -20601, 'Invtrace not updated for all the details trace count [' || to_char(ll_invcount) || '] det count [' || to_char(ll_poretncount) ||']' || ls_msg ); end if; if :new.confirmed = 'Y' and :old.tran_ser = 'P-RET' then begin select sum(ALLOC_QTY) into lc_allocqty from invalloc_trace where ref_ser = 'P-RET' and ref_id = :new.tran_id; exception when others then lc_allocqty:= 0; end; if lc_allocqty is null then lc_allocqty := 0; end if; if lc_allocqty <> 0 then raise_application_error( -20601, 'Net allocation quantity as per allocation trace is not zero [' || to_char(lc_allocqty) || ']'); end if; end if; ------------- flage to be updated here end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_NEAREXP (as_item_code in char, as_site_code in char ,as_loc_code in char,as_lot_no in char,as_lot_sl in char) return char is ls_track_shelf_life char(1); lc_min_shelf_life number(7,3); nearexp_date date ; exp_date date ; begin begin select min_shelf_life ,track_shelf_life into lc_min_shelf_life ,ls_track_shelf_life from item where item_code = as_item_code; exception when others then return 'N' ; end; if trim(ls_track_shelf_life) = 'Y' then begin select (ADD_MONTHS( to_date(sysdate), lc_min_shelf_life ) ) + 1 into nearexp_date from dual; exception when others then return 'N' ; end; begin select exp_date into exp_date from stock where item_code = as_item_code and site_code = as_site_code and loc_code = as_loc_code and lot_no = as_lot_no and lot_sl = as_lot_sl ; exception when others then return 'N' ; end; if exp_date <= nearexp_date then return 'Y' ; else return 'N' ; end if; else return 'N' ; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE EFFECTIVELEVELDMMASTER force AS OBJECT ( PARAM_NAME VARCHAR2(30), DESCR VARCHAR2(120), SH_DESCR VARCHAR2(60), PARAM_VALUE VARCHAR2(60), ACTUAL_VALUE VARCHAR2(60), PARAM_COLOR VARCHAR2(30), PARAM_IMG VARCHAR2(60), PRD_CODE VARCHAR2(30), link_metadata VARCHAR2(30), MGR_SUB VARCHAR2(30), EMP_DETAIL VARCHAR2(250) ); -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ACCTCODE (ls_acct_code CHAR,ls_descr CHAR) RETURN NUMBER IS LI_COUNT NUMBER(12) ; BEGIN DECLARE LI_COUNT NUMBER(12); SUM_COUNT NUMBER(12); TA_DESCR VARCHAR2(500); BEGIN LI_COUNT := 0; SUM_COUNT := 0; SELECT COUNT(1) INTO LI_COUNT FROM ACCOUNTS WHERE ACCT_CODE = ls_acct_code; IF LI_COUNT > 0 THEN SELECT DESCR INTO TA_DESCR FROM ACCOUNTS WHERE ACCT_CODE = ls_acct_code; if trim(ls_descr) <> trim(TA_DESCR) THEN select sum(cnt) into SUM_COUNT from (select count(*) cnt from acctbal where acct_code = ls_acct_code union select count(*) cnt from gltrace where acct_code = ls_acct_code ); if SUM_COUNT > 0 THEN return 1; END IF; ELSE return 0; END IF; END IF; end ; RETURN 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MDRCR_RND_OFF BEFORE INSERT OR UPDATE of RND_OFF ON MISC_DRCR_RCP referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.RND_OFF is null or :new.RND_OFF = 'null' then :new.RND_OFF := 'N'; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_STOCKQTY (as_item varchar2,as_site varchar2,adt_asondate date) return number is as_stkqty number(12,3); begin select sum(stock.quantity) into as_stkqty from stock,invstat where stock.inv_stat = invstat.inv_stat and invstat.plan_prod ='Y' and stock.site_code = as_site and stock.item_code = as_item and stock.ltran_date <= adt_asondate and stock.quantity >0 ; return as_stkqty ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_IND_ORDQTY BEFORE UPDATE OF ord_qty ON indent referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_docount number(6) := 0; ls_msg varchar2(2000); jobWorkType char(3); subcontractType char(3); pordTypeImpService char(3); begin if nvl(:new.ord_qty,0) < 0 then raise_application_error( -20601, 'Order quantity cannot be updated with negatrive value'); end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LOT_SL ( as_tran_id in distord_iss.tran_id%type, as_lot_sl in stock.lot_sl%type) return char is ls_site_code_from site.site_code%type; ls_site_code_to site.site_code%type; ls_state_code_from site.state_code%type; ls_state_code_to site.state_code%type; ls_type distord_iss.tran_type%type; ls_value disparm.var_value%type; ls_var_value disparm.var_value%type; ls_lot_sl stock.lot_sl%type; ls_type_matched char(1) := 'N'; li_pos number(6) := 0; begin begin select site_code, site_code__dlv, tran_type into ls_site_code_from, ls_site_code_to,ls_type from distord_iss where tran_id = as_tran_id ; exception when others then return 'ERRORDS000'; end; begin select state_code into ls_state_code_from from site where site_code = ls_site_code_from; exception when others then return 'ERRORDS000'; end; begin select state_code into ls_state_code_to from site where site_code = ls_site_code_to; exception when others then return 'ERRORDS000'; end; if trim(ls_state_code_from) <> trim(ls_state_code_to) then begin select var_value into ls_var_value from disparm where prd_code = '999999' and var_name = 'DISTORD_TYPE_FOR_1S'; end; while length(trim(ls_var_value)) > 0 loop li_pos := instr(ls_var_value, ','); if li_pos > 0 then -- this if condition added on 01/04/09 ls_value := fn_get_token(ls_var_value,','); if trim(ls_type) = trim(ls_value) then ls_type_matched := 'Y'; exit; end if; ls_var_value := substr(ls_var_value, li_pos + 1); else -- this else added on 01/04/09 if trim(ls_type) = trim(ls_var_value) then ls_type_matched := 'Y'; end if; exit; end if; end loop; if ls_type_matched = 'Y' then ls_lot_sl := '1S'; else ls_lot_sl := as_lot_sl; end if; else ls_lot_sl := as_lot_sl; end if; /*if ls_type = 'JW' then ls_lot_sl := as_tran_id; end if; */ return ls_lot_sl; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_TAX_PROC_REFID ON TAX_PROCESSED (REF_ID, REF_SER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_QUARLOC (tranId IN CHAR) RETURN CHAR is LOC_CODE__APRV CHAR(8); BEGIN select NVL(LOC_CODE__APRV,'') into LOC_CODE__APRV from qc_order where qorder_no=tranId; IF length(trim(LOC_CODE__APRV)) > 0 THEN LOC_CODE__APRV := TRIM(LOC_CODE__APRV) || 'Q'; ELSE LOC_CODE__APRV := TRIM(LOC_CODE__APRV); END IF; RETURN LOC_CODE__APRV; END DDF_GET_QUARLOC; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MISC_DRCR_RCP_CHK BEFORE INSERT OR UPDATE OF confirmed ON misc_drcr_rcp referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; lc_hdramt number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; ls_drcrflag misc_drcr_rcp.DRCR_FLAG%type; ls_refser gltrace.ref_ser%type; BEGIN if :new.confirmed = 'Y' then -- 1. check detail count and gltrace count begin --select amount, DRCR_FLAG into lc_hdramt,ls_drcrflag from misc_drcr_rcp --where tran_id = :new.tran_id; lc_hdramt := :old.amount ; ls_drcrflag := :old.DRCR_FLAG ; exception when others then lc_hdramt := 0; end; if ls_drcrflag = 'D' then ls_refser := 'MDRCRD'; else ls_refser := 'MDRCRC'; end if; begin select count(1) into ll_glcount from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if lc_hdramt <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but net amount is [' || to_char(lc_hdramt) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = ls_refser and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_hdramt <> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX MPS_ORDER_WORK_ORDER ON MPS_ORDER (WORK_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083396 ON DASHBOARD_DEFINITION (PROC_DESIGN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INTERESTTERM_DESCR ON INTERESTTERM (DESCR) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_EXTRACT_ATTRIBUTE_VALUE ( p_attrib_format IN VARCHAR2, p_attrib_value IN VARCHAR2, -- Changed from NUMBER to VARCHAR2 p_value_type IN NUMBER ) RETURN VARCHAR2 IS v_extracted_value VARCHAR2(4000); v_code_value VARCHAR2(4000); v_image_path VARCHAR2(4000); BEGIN -- Extract the corresponding attribute value BEGIN SELECT extracted_value INTO v_extracted_value FROM ( WITH extracted_data AS ( SELECT REGEXP_SUBSTR(p_attrib_format, '~~([^:]+):', 1, LEVEL, NULL, 1) AS extracted_value, REGEXP_SUBSTR(p_attrib_format || '~~', ':([^~~]+)~~', 1, LEVEL, NULL, 1) AS value FROM dual CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(p_attrib_format, '[^~~]', '')) + 1 ) SELECT extracted_value FROM extracted_data WHERE value = p_attrib_value ) WHERE ROWNUM = 1; EXCEPTION WHEN NO_DATA_FOUND THEN v_extracted_value := ' '; END; -- Extract the code value BEGIN SELECT value INTO v_code_value FROM ( WITH extracted_data AS ( SELECT REGEXP_SUBSTR(p_attrib_format || '~~', ':([^~~]+)~~', 1, LEVEL, NULL, 1) AS value FROM dual CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(p_attrib_format, '[^~~]', '')) + 1 ) SELECT value FROM extracted_data WHERE value = p_attrib_value ) WHERE ROWNUM = 1; EXCEPTION WHEN NO_DATA_FOUND THEN v_code_value := ' '; END; -- Determine image path IF p_attrib_format LIKE '%image%' THEN v_image_path := '/wildfly/server/default/deploy/ibase.ear/ibase.war/webitm/images/' || NVL(v_code_value, 'default') || '.svg'; ELSE v_image_path := null; END IF; -- Return based on value type CASE p_value_type WHEN 1 THEN RETURN NVL(v_extracted_value, 'UNKNOWN'); WHEN 2 THEN RETURN v_image_path; WHEN 3 THEN RETURN NVL(v_code_value, 'UNKNOWN'); ELSE RETURN NULL; END CASE; EXCEPTION WHEN OTHERS THEN RETURN 'ERROR'; END fn_extract_attribute_value; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGL_TRANS_DR1 (ldate_fr in date, ldate_to in date, lsite_code in char, lacct_code in char) return number is lc_dr_sum number(14,3); begin Select nvl(Sum(dr_amt),0) into lc_dr_sum from gltran where site_code = lsite_code and tran_date >= ldate_fr and tran_date <= ldate_to and acct_code = lacct_code; Return lc_dr_sum; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_PICK_RATE_CLQTY (as_price_list in char, ad_tran_date in date, as_item_code in char, as_lot_no in char, as_type in char,ac_qty pricelist.min_qty%type ) return number is mrate number(14,3); ls_type char(1); begin begin select list_type into ls_type from pricelist where price_list = as_price_list and rownum = 1; end; if ls_type = 'B' then select nvl(rate,0) into mrate from pricelist where price_list = as_price_list and item_code = as_item_code and list_type = 'B' and lot_no__from <= as_lot_no and lot_no__to >= as_lot_no and eff_from <= ad_tran_date and valid_upto >= ad_tran_date and min_qty <= ac_qty and max_qty >= ac_qty; end if; return mrate; exception when others then return 0; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE SP_HR_UPD_BK_DT_TRANS (AS_REF_SER IN char,AS_TRAN_ID IN char,AS_EMP_CODE IN char,AS_TRAN_DATE IN date, RETVAL OUT CHAR) is a_emp_code employee.emp_code%type; a_grade employee.grade%type; a_count number(5); a_grade_cnt number(5) := 0; a_eff_date date; a_grade_update boolean := true; begin --RETVAL := 'ERROR'; RETVAL := ''; if (AS_REF_SER = 'E-XPR') then select emp_code,eff_date,grade_code_to into a_emp_code,a_eff_date,a_grade from emp_employ_events where tran_id = AS_TRAN_ID and confirmed = 'Y'; elsif (AS_REF_SER = 'W-EDC') then select emp_code,tran_date,'#' into a_emp_code,a_eff_date,a_grade from employee_det_change where tran_id = AS_TRAN_ID and status = 'C'; elsif (AS_REF_SER = 'E-STS') then select emp_code,date__effchg,grade_n into a_emp_code,a_eff_date,a_grade from emp_statuschg where tran_date = AS_TRAN_DATE and emp_code = AS_EMP_CODE and confirm = 'Y'; end if; if (a_eff_date is null) then return; end if; select sum(cnt) into a_count from ( select count(*) cnt from emp_employ_events where emp_code = a_emp_code and eff_date > a_eff_date and confirmed = 'Y' union all select count(*) cnt from employee_det_change where emp_code = a_emp_code and tran_date > a_eff_date and status = 'C' union all select count(*) cnt from emp_statuschg where emp_code = a_emp_code and date__effchg > a_eff_date and confirm = 'Y' ); if (a_count = 0) then return; end if; declare cursor c1 is select eff_date,conf_date,chg_date,'E-XPR' ref_ser,tran_id,null tran_date,grade_code_fr,grade_code_to from emp_employ_events where emp_code = a_emp_code and eff_date > a_eff_date and confirmed = 'Y' union all select tran_date eff_date,conf_date,chg_date,'W-EDC' ref_ser,tran_id,null tran_date,'#' grade_code_fr,'#' grade_code_to from employee_det_change where emp_code = a_emp_code and tran_date > a_eff_date and status = 'C' union all select date__effchg eff_date,conf_date,chg_date,'E-STS' ref_ser,null tran_id,tran_date,grade_o grade_code_fr,grade_n grade_code_to from emp_statuschg where emp_code = a_emp_code and date__effchg > a_eff_date and confirm = 'Y' order by 1,2,3; begin for i in c1 loop if (AS_REF_SER != 'W-EDC' and i.ref_ser != 'W-EDC') then a_grade_cnt := a_grade_cnt + 1; if (a_grade_cnt = 1) then if (AS_REF_SER = 'E-XPR') then update emp_employ_events set grade_code_fr = i.grade_code_fr where tran_id = AS_TRAN_ID; elsif (AS_REF_SER = 'E-STS') then update emp_statuschg set grade_o = i.grade_code_fr where tran_date = AS_TRAN_DATE and emp_code = a_emp_code; end if; end if; if (i.grade_code_fr = i.grade_code_to and a_grade_update = true) then if (i.ref_ser = 'E-XPR') then update emp_employ_events set grade_code_fr = a_grade,grade_code_to = a_grade where tran_id = i.tran_id; elsif (i.ref_ser = 'E-STS') then update emp_statuschg set grade_o = a_grade,grade_n = a_grade where tran_date = i.tran_date and emp_code = a_emp_code; end if; elsif (i.grade_code_fr != i.grade_code_to and a_grade_update = true) THEN if (i.ref_ser = 'E-XPR') then update emp_employ_events set grade_code_fr = a_grade where tran_id = i.tran_id; elsif (i.ref_ser = 'E-STS') then update emp_statuschg set grade_o = a_grade where tran_date = i.tran_date and emp_code = a_emp_code; end if; a_grade_update := false; a_grade := i.grade_code_to; else a_grade := i.grade_code_to; end if; end if; end loop; if (AS_REF_SER != 'W-EDC') then update employee set grade = a_grade where emp_code = a_emp_code; end if; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083394 ON NET_PRINTERS (PRINTER_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_DISTISSITEM BEFORE INSERT OR UPDATE ON distord_issdet referencing old as old new as new FOR EACH ROW DECLARE ls_itemcodeord item.item_code%type; ls_itemcodeiss item.item_code%type; BEGIN ls_itemcodeiss := trim(:new.item_code); begin select trim(item_code) into ls_itemcodeord from distorder_det where dist_order = :new.dist_order and line_no = :new.LINE_NO_DIST_ORDER; exception when others then ls_itemcodeord := ' '; end; if ls_itemcodeord <> ls_itemcodeiss then raise_application_error( -20601, 'order detail item [' ||ls_itemcodeord ||'] not matching with issue item [' ||ls_itemcodeiss ||'] for line 3 [' || to_char(:new.line_no) ||']' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083390 ON IFSC (IFSC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE OBJ_EMPLOYEE_WISE_HIERARCHY IS OBJECT ( DIV VARCHAR2(200), TLM_HQ VARCHAR2(200), SLM_HQ VARCHAR2(200), FLM_HQ VARCHAR2(200), SO_HQ VARCHAR2(200), SO_DESG VARCHAR2(100), EMP_CODE CHAR(10), DATE_JOIN DATE, ISR_NAME VARCHAR2(250), TLM_CODE CHAR(10), SLM_CODE CHAR(10), FLM_CODE CHAR(10) ); -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DLVLOC_PK ON SALES_QUOT_DLV_LOC (QUOT_NO, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_SITE_ENV_VALUE (AS_EMP_CODE char,AS_DATE date,AS_VAR_NAME char) return char is a_value site_env.par_value%type; a_cadre employee.cadre%type; a_grade employee.grade%type; a_site employee.emp_site%type; a_count number(5); begin select ddf_hr_status(AS_EMP_CODE,AS_DATE,'S') into a_site from dual; select ddf_hr_status(AS_EMP_CODE,AS_DATE,'C') into a_cadre from dual; select ddf_hr_status(AS_EMP_CODE,AS_DATE,'G') into a_grade from dual; select count(*) into a_count from site_env where site_code = a_site and module_code = 'ADM' and level_type = 'G' and level_code = a_grade and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; if (a_count <> 0) then select par_value into a_value from site_env where site_code = a_site and module_code = 'ADM' and level_type = 'G' and level_code = a_grade and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; return a_value; end if; select count(*) into a_count from site_env where site_code = a_site and module_code = 'ADM' and level_type = 'C' and level_code = a_cadre and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; if (a_count <> 0) then select par_value into a_value from site_env where site_code = a_site and module_code = 'ADM' and level_type = 'C' and level_code = a_cadre and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; return a_value; end if; select count(*) into a_count from site_env where site_code = a_site and module_code = 'ADM' and level_type = 'X' and level_code = 'ZZZZZ' and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; if (a_count <> 0) then select par_value into a_value from site_env where site_code = a_site and module_code = 'ADM' and level_type = 'X' and level_code = 'ZZZZZ' and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; return a_value; end if; select count(*) into a_count from site_env where site_code = '99999' and module_code = 'ADM' and level_type = 'G' and level_code = a_grade and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; if (a_count <> 0) then select par_value into a_value from site_env where site_code = '99999' and module_code = 'ADM' and level_type = 'G' and level_code = a_grade and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; return a_value; end if; select count(*) into a_count from site_env where site_code = '99999' and module_code = 'ADM' and level_type = 'C' and level_code = a_cadre and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; if (a_count <> 0) then select par_value into a_value from site_env where site_code = '99999' and module_code = 'ADM' and level_type = 'C' and level_code = a_cadre and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; return a_value; end if; select count(*) into a_count from site_env where site_code = '99999' and module_code = 'ADM' and level_type = 'X' and level_code = 'ZZZZZ' and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; if (a_count <> 0) then select par_value into a_value from site_env where site_code = '99999' and module_code = 'ADM' and level_type = 'X' and level_code = 'ZZZZZ' and par_name = AS_VAR_NAME and AS_DATE between eff_date and upto_date; return a_value; end if; select count(*) into a_count from payrparm where prd_code = to_char(AS_DATE,'YYYYMM') and var_name = AS_VAR_NAME; if (a_count <> 0) then select var_value into a_value from payrparm where prd_code = to_char(AS_DATE,'YYYYMM') and var_name = AS_VAR_NAME; return a_value; end if; select count(*) into a_count from payrparm where prd_code = '999999' and var_name = AS_VAR_NAME; if (a_count <> 0) then select var_value into a_value from payrparm where prd_code = '999999' and var_name = AS_VAR_NAME; return a_value; end if; return a_value; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SALES_PERS (as_level_code in char, as_table_no in char) return varchar2 is ls_sales_pers varchar2(60); li_cnt number(4,0); begin select count(*) into li_cnt from hierarchy_det where level_code = as_level_code and table_no = as_table_no ; if li_cnt > 1 then ls_sales_pers := 'Pool'; else select b.sp_name into ls_sales_pers from hierarchy_det a, sales_pers b where a.sales_pers = b.sales_pers and a.level_code = as_level_code and a.table_no = as_table_no ; end if; return ls_sales_pers; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_CHK_RCP_SITE_BANK (as_site_code in receipt.site_code%type, as_bank_code in receipt.bank_code%type) return number is ls_count number(10,0); ls_bank_count number(10,0); begin begin ls_count :=0; SELECT count(1) into ls_count FROM FINPARM WHERE var_name='LY_CHKSITE_BANK' and var_value='Y'; exception when no_data_found then ls_count :=0; end; if ls_count >0 then begin select count(1) into ls_bank_count from site_bank where SITE_CODE=as_site_code and BANK_CODE=as_bank_code; exception when no_data_found then ls_bank_count :=0; end; IF ls_bank_count>0 THEN return 1; ELSE RETURN 0; END IF; else return 1; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STD_PAYSTRU_X ON STD_PAYSTRU (PAY_TABLE, GRADE, AD_CODE, EFF_DATE, VALID_UPTO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETSALESPER_NAME (p_sales_pers IN VARCHAR2) RETURN VARCHAR2 AS v_result VARCHAR2(1000); BEGIN select sp_name INTO v_result from sales_pers where sales_pers=p_sales_pers; RETURN v_result; END DDF_GETSALESPER_NAME; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX PLANOFACTION_PLAN_DATE ON PLANOFACTION (PLAN_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DESPATCHDET_SORDER ON DESPATCHDET (SORD_NO, LINE_NO__SORD, EXP_LEV) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_HR_ATTD_STATUS (AS_EMP_CODE char,AS_DATE date) return char is cursor c1 is select lve_code,lve_date_fr,lve_date_to,leave_starts,leave_ends from empleave where emp_code = AS_EMP_CODE and AS_DATE between lve_date_fr and lve_date_to and status = 'A' and use_flag = 'C' order by lve_date_fr,lve_date_to; cursor c2 is select date_from,date_to,tour_starts,tour_ends from tour where emp_code = AS_EMP_CODE and AS_DATE between date_from and date_to and status = 'A' order by date_from,date_to; a_status varchar2(5); a_areg_status attd_reg.status%type; a_work_days attd_reg.work_days%type; a_lop_days attd_reg.lop_days%type; a_out_time attendance_day.out_time%type; a_shift attendance_day.shift%type; a_day_no attendance_day.day_no%type; a_in_time workshft.in_time%type; a_fd_hrs workshft.fd_hrs%type; a_first varchar2(2); a_second varchar2(2); begin select status,work_days,lop_days into a_areg_status,a_work_days,a_lop_days from attd_reg where emp_code = AS_EMP_CODE and attd_date = AS_DATE; if (a_areg_status = 'W') then a_status := 'WO'; return a_status; elsif (a_areg_status = 'H') then a_status := 'PH'; return a_status; elsif (a_areg_status = 'P' and a_work_days = 1) then a_status := 'P'; return a_status; elsif (a_areg_status = 'A' and a_lop_days = 1) then a_status := 'A'; return a_status; end if; for i in c1 loop if (i.leave_starts = 'B' and i.leave_ends = 'E') or (i.lve_date_fr <> AS_DATE and i.lve_date_to <> AS_DATE) or (i.lve_date_fr <> i.lve_date_to and i.lve_date_fr = AS_DATE and i.leave_starts = 'B') or (i.lve_date_fr <> i.lve_date_to and i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_status := substr(i.lve_code,1,2); return a_status; else if (i.lve_date_fr = AS_DATE and i.leave_starts = 'B') then a_first := substr(i.lve_code,1,2); elsif (i.lve_date_fr = AS_DATE and i.leave_starts = 'M') then a_second := substr(i.lve_code,1,2); elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'M') then a_first := substr(i.lve_code,1,2); elsif (i.lve_date_to = AS_DATE and i.leave_ends = 'E') then a_second := substr(i.lve_code,1,2); end if; end if; end loop; for i in c2 loop if (i.tour_starts = 'S' and i.tour_ends = 'E') or (i.date_from <> AS_DATE and i.date_to <> AS_DATE) or (i.date_from <> i.date_to and i.date_from = AS_DATE and i.tour_starts = 'S') or (i.date_from <> i.date_to and i.date_to = AS_DATE and i.tour_ends = 'E') then a_status := 'T'; return a_status; else if (i.date_from = AS_DATE and i.tour_starts = 'S') then a_first := 'T'; elsif (i.date_from = AS_DATE and i.tour_starts = 'B') then a_second := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'B') then a_first := 'T'; elsif (i.date_to = AS_DATE and i.tour_ends = 'E') then a_second := 'T'; end if; end if; end loop; if (a_first is not null or a_second is not null) then if (a_lop_days <> 0) and (a_first is null) then a_first := 'A'; elsif (a_lop_days <> 0) and (a_second is null) then a_second := 'A'; end if; end if; if (a_first is not null or a_second is not null) then if (a_work_days <> 0) and (a_first is null) then a_first := 'P'; elsif (a_work_days <> 0) and (a_second is null) then a_second := 'P'; end if; end if; if (a_first is not null) then a_status := a_first; end if; if (a_second is not null) then a_status := a_status || '/' || a_second; end if; if (a_status is null) then select out_time,shift,day_no into a_out_time,a_shift,a_day_no from attendance_day where attd_date = AS_DATE and emp_code = AS_EMP_CODE; select in_time,fd_hrs into a_in_time,a_fd_hrs from workshft where shift = a_shift and day_no = a_day_no; if (ddf_time_in_mm(a_out_time) < (ddf_time_in_mm(a_in_time) + (a_fd_hrs * 60 / 2))) then a_status := 'P/A'; else a_status := 'A/P'; end if; end if; return a_status; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX EXPORT_FUNDDET_X ON EXPORT_FUNDET (TRAN_ID, REF_SER, REF_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083382 ON DWH_TABLES (TABLE_NAME) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_GP_NO (ls_ref_ser char, ls_ref_id char) return char is ls_gp_no char(20); ls_refser_ibca char(6); ls_refno_ibca char(10); begin if rtrim(ls_ref_ser) = 'S-INV' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b where b.desp_id = a.desp_id and b.invoice_id = ls_ref_id and rownum = 1; return ls_gp_no; elsif rtrim(ls_ref_ser) = 'CRNRCP' or rtrim(ls_ref_ser) = 'DRNRCP' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b , drcr_rcp c where c.invoice_id = b.invoice_id and b.desp_id = a.desp_id and c.tran_id = ls_ref_id and rownum = 1; return ls_gp_no; elsif rtrim(ls_ref_ser) like 'R-IBC%' then select ref_ser into ls_refser_ibca from rcp_ibca_det where ref_no = ls_ref_id and rownum = 1; if rtrim(ls_refser_ibca) = 'S-INV' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b where b.desp_id = a.desp_id and b.invoice_id = ls_ref_id and rownum = 1; return ls_gp_no; elsif rtrim(ls_refser_ibca) = 'CRNRCP' or rtrim(ls_refser_ibca) = 'DRNRCP' then select nvl(a.gp_no ,' ') into ls_gp_no from despatch a , invoice b , drcr_rcp c where c.invoice_id = b.invoice_id and b.desp_id = a.desp_id and c.tran_id = ls_ref_id and rownum = 1; return ls_gp_no; else ls_gp_no := ' '; return ls_gp_no; end if; else ls_gp_no := ' '; return ls_gp_no; end if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DISTORD_ISS_DIST_ORD ON DISTORD_ISS (DIST_ORDER) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_LAST_PLACEOF_RETURN ( ls_dcr_id char, ls_sales_pers char) return varchar2 is ls_last_place_of_return varchar2(60); ld_event_date date; begin begin SELECT loc.descr into ls_last_place_of_return FROM SPRS_TRAVEL ST, LOCALITY LOC WHERE ORDER_OF_VISIT = ( SELECT MAX( ORDER_OF_VISIT) FROM SPRS_TRAVEL WHERE SALES_PERS= ls_sales_pers AND TRAVEL_DATE =(SELECT MAX(TRAVEL_DATE) FROM SPRS_TRAVEL WHERE SALES_PERS= ls_sales_pers ) ) AND LOC.LOCALITY_CODE = ST.LOCALITY_CODE AND ST.SALES_PERS= ls_sales_pers AND ST.TRAVEL_DATE =(SELECT MAX(TRAVEL_DATE) FROM SPRS_TRAVEL WHERE SALES_PERS= ls_sales_pers); exception when no_data_found then ls_last_place_of_return := ''; end; return ls_last_place_of_return; end; -------fn_get_last_dcr_date -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX PDC_RECDET_REF_ID ON PDC_RECDET (REF_SER, REF_NO, TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_FIN_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_DPARM_VAL (LS_VAR_NAME VARCHAR2, LS_TAX_CODE VARCHAR2) RETURN number as LS_RET_VAL number(10,3); LS_VAR_VALUE VARCHAR2(100); BEGIN SELECT RTRIM( VAR_VALUE ) into LS_VAR_VALUE FROM DISPARM WHERE PRD_CODE = '999999' AND VAR_NAME = LS_VAR_NAME; SELECT instr ( LS_TAX_CODE ,LS_VAR_VALUE ) into LS_RET_VAL FROM DUAL ; RETURN LS_RET_VAL ; ENd; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_ALL_NEW_DR_CRTN_DATA (AS_SC_CODE varchar2 ) return number is a_retval number(1) := 0; a_count number(1); begin select count(*) into a_count from CUSTOMER_SERIES_UPLOAD where SC_CODE = AS_SC_CODE AND ( ( CONFIRMED = 'A' AND NVL(CONFIRMED_APRV2,'X') ='X' ) OR ( CONFIRMED ='R' AND CONFIRMED_APRV2 IS null AND CONFIRMED_BY_MKT = 'R' ) ); if (a_count = 1) then a_retval := 1; end if; return a_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_VLDITEMSER (as_emp_code char) return char is ls_item_ser char(5); begin declare ls_item_ser char(5); ls_div char(5); ln_cnt number(10,0); begin select item_ser into ls_item_ser from sales_pers where emp_code = as_emp_code; select count(*) into ln_cnt from fieldactivity where item_ser = ls_item_ser; if ln_cnt > 0 then ls_div := ls_item_ser; else ls_div := 'ALL'; end if; return ls_div; end; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_HR_EMP_CODE (AS_EMP_CODE char, AS_APP_TYPE char, AS_HR_NO_CNT number) return varchar2 is a_site employee.work_site%type; a_dept employee.dept_code%type; a_fin_entity finent.fin_entity%type; a_geo_loc site.geo_loc%type; a_hr_count number(1):=0 ; a_site_count number(1):=0 ; a_return varchar2(200); begin if AS_APP_TYPE = 'EMPOB' then select a.work_site, a.dept_code, c.fin_entity, b.geo_loc into a_site, a_dept, a_fin_entity, a_geo_loc from candidate a, site b, finent c where a.candidate_id = AS_EMP_CODE and c.fin_entity = b.fin_entity and b.site_code = a.work_site and a.status <> 'X'; elsif AS_APP_TYPE = 'OBDEL' then select count(1) into a_site_count from candidate where candidate_id =AS_EMP_CODE and (work_site is not null OR dept_code is not null); if a_site_count > 0 then select a.work_site, a.dept_code, c.fin_entity, b.geo_loc into a_site, a_dept, a_fin_entity, a_geo_loc from candidate a, site b, finent c where a.candidate_id = AS_EMP_CODE and c.fin_entity = b.fin_entity and b.site_code = a.work_site and a.status <> 'X'; else select a.work_site, a.dept_code, d.fin_entity, c.geo_loc into a_site, a_dept, a_fin_entity, a_geo_loc from employee a, candidate b, site c, finent d where b.candidate_id = AS_EMP_CODE and a.emp_code = b.emp_code__auth and d.fin_entity = c.fin_entity and c.site_code = a.work_site and b.status <> 'X'; end if; else select a.work_site, a.dept_code, c.fin_entity, b.geo_loc into a_site, a_dept, a_fin_entity, a_geo_loc from employee a, site b, finent c where a.emp_code = AS_EMP_CODE and c.fin_entity = b.fin_entity and b.site_code = a.work_site; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = a_dept and site_code = a_site and geo_loc = a_geo_loc ; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = a_dept and site_code = a_site and geo_loc = a_geo_loc) where rm = AS_HR_NO_CNT; return a_return; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = '99999' and site_code = a_site and geo_loc = a_geo_loc ; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = '99999' and site_code = a_site and geo_loc = a_geo_loc) where rm = AS_HR_NO_CNT; return a_return; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = '99999' and site_code = '99999' and geo_loc = a_geo_loc ; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = '99999' and site_code = '99999' and geo_loc = a_geo_loc ) where rm = AS_HR_NO_CNT; return a_return; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = '99999' and site_code = '99999' and geo_loc = '99999'; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = AS_APP_TYPE and dept_code = '99999' and site_code = '99999' and geo_loc = '99999') where rm = AS_HR_NO_CNT; return a_return; end if; if AS_APP_TYPE NOT IN ('SCLHR','SCCHR','EMPOB','OBDEL') then select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = a_dept and site_code = a_site and geo_loc = a_geo_loc ; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = a_dept and site_code = a_site and geo_loc = a_geo_loc) where rm = AS_HR_NO_CNT; return a_return; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = '99999' and site_code = a_site and geo_loc = a_geo_loc ; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = '99999' and site_code = a_site and geo_loc = a_geo_loc) where rm = AS_HR_NO_CNT; return a_return; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = '99999' and site_code = '99999' and geo_loc = a_geo_loc ; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = '99999' and site_code = '99999' and geo_loc = a_geo_loc ) where rm = AS_HR_NO_CNT; return a_return; end if; select count(1) into a_hr_count from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = '99999' and site_code = '99999' and geo_loc = '99999'; if a_hr_count > 0 then select emp_code__hr into a_return from (select emp_code__hr, rownum as rm from adm_env where trunc(sysdate) between valid_from and valid_to and fin_entity = a_fin_entity and app_type = '99999' and dept_code = '99999' and site_code = '99999' and geo_loc = '99999') where rm = AS_HR_NO_CNT; return a_return; end if; end if; return a_return; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_PORCPDET_NO_ART BEFORE INSERT ON PORCPDET FOR EACH ROW declare BEGIN if :NEW.NO_ART < 0 then raise_application_error( -20601, 'No of Arctile cannot be Zero [' || :new.tran_id || '] line [' || :new.line_no ||'] item code [' || trim(:new.item_code) ||']'); end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DDF_HR_TRF_LEAVEBAL ( AS_TRAN_ID IN VARCHAR, AS_CHG_USER IN CHAR, AS_EMP_CODE_TO IN CHAR, AS_CHG_TERM IN CHAR, as_out_param out VARCHAR) is BEGIN DECLARE ls_cnt NUMBER; ls_acct_prd emp_lveprkbal_trfdet.acct_prd%type; ls_balance_code emp_lveprkbal_trfdet.balance_code%type; ls_encashable emp_lveprkbal_trfdet.encashable%type; ls_lve_unit emp_lveprkbal_trfdet.lve_unit%type; ld_from_date emp_lveprkbal_trfdet.from_date%type; ld_to_date emp_lveprkbal_trfdet.to_date%type; ld_exp_date emp_lveprkbal_trfdet.exp_date%type; ls_balance emp_lveprkbal_trfdet.balance%type; CURSOR cur_leavetrf IS SELECT acct_prd, balance_code , encashable, lve_unit, from_date, to_date, exp_date, balance FROM emp_lveprkbal_trfdet WHERE TRAN_ID = as_tran_id GROUP BY ACCT_PRD, BALANCE_CODE, ENCASHABLE, LVE_UNIT, FROM_DATE, to_date, exp_date, BALANCE; BEGIN OPEN cur_leavetrf; LOOP FETCH cur_leavetrf INTO ls_acct_prd, ls_balance_code, ls_encashable, ls_lve_unit, ld_from_date, ld_to_date, ld_exp_date, ls_balance; SELECT COUNT(*) INTO ls_cnt FROM leavebal WHERE EMP_CODE = as_emp_code_to AND LVE_CODE = ls_balance_code AND eff_date = ld_from_date AND upto_date = ld_to_date; IF ls_cnt > 0 THEN UPDATE leavebal SET bal_days = bal_days + ls_balance WHERE EMP_CODE = as_emp_code_to AND LVE_CODE = ls_balance_code AND eff_date = ld_from_date AND upto_date = ld_to_date; ELSE INSERT INTO LEAVEBAL (EMP_CODE, LVE_CODE, EFF_DATE, UPTO_DATE, EXP_DATE, EDIT_FLAG, AVAIL_DAYS, CONS_DAYS, ENCH_DAYS, BAL_DAYS, PREV_BAL, ENCASHABLE, ACCT_PRD, CHG_DATE, CHG_USER, CHG_TERM, CONV_DAYS, LVE_UNIT ) VALUES ( as_emp_code_to, ls_balance_code, ld_from_date, ld_to_date, ld_exp_date, 'A', 0, 0, 0, ls_balance,0, ls_encashable,ls_acct_prd, sysdate,as_chg_user,AS_CHG_TERM,0,ls_lve_unit); END IF; EXIT WHEN cur_leavetrf%notfound; END LOOP; CLOSE cur_leavetrf; END; END; -- Failed to execute: SQL Statement ==> SQLException ORA-01408: such column list already indexed -- CREATE UNIQUE INDEX SYS_C0083374 ON EMP_SERVICEPRD_AMD (TRAN_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_SUNDRYTYPE (ltype in char,lcode in char,ls_ref_id in char,ls_ref_ser in char) return char is ls_val char(12); ls_type char(1); ls_code char(10); begin if ltype = 'O' then if ls_ref_ser = 'M-VOUC' then select sundry_type,sundry_code into ls_type, ls_code from misc_voucher where tran_id = ls_ref_id ; elsif ls_ref_ser = 'P-VOUC' then select emp_code into ls_code from payr_voucher where tran_id = ls_ref_id ; ls_type := 'E'; elsif ls_ref_ser = 'E-PAY' then select sundry_type,sundry_code into ls_type, ls_code from payment_exp where tran_id = ls_ref_id ; elsif ls_ref_ser = 'M-PAY' then select sundry_type,sundry_code into ls_type, ls_code from misc_payment where tran_id = ls_ref_id ; elsif ls_ref_ser = 'M-RCP' then select sundry_type,sundry_code into ls_type, ls_code from misc_rcpdet where tran_id = ls_ref_id and line_no = 1; elsif ls_ref_ser = 'RCP' then select cust_code into ls_code from receipt where tran_id = ls_ref_id; ls_type := 'C'; elsif ls_ref_ser = 'MPCANC' then select sundry_type,sundry_code into ls_type, ls_code from misc_payment_canc where tran_id = ls_ref_id ; end if; end if; ls_type := nvl(ls_type,' '); ls_code := nvl(ls_code,' '); ls_val := ls_type || ls_code; return ls_val; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GETHRVALUEDESCR (lshier_ref in varchar2,lshier_value in varchar2) return varchar2 is lshier_value_desc varchar2(1000); begin if trim(lshier_ref) ='C' then select cust_name into lshier_value_desc from CUSTOMER where cust_code = lshier_value; elsif trim(lshier_ref) = 'S' then select descr into lshier_value_desc from ITEMSER where ITEM_SER = lshier_value; elsif trim(lshier_ref) = 'A' then select descr into lshier_value_desc from STATE where STATE_CODE = lshier_value; elsif trim(lshier_ref) = 'L' then select descr into lshier_value_desc from GENCODES WHERE FLD_NAME='HIER_VALUE_1' AND MOD_NAME='W_PROF_WSHEET_MSTDET_CNF' AND FLD_VALUE = lshier_value; elsif trim(lshier_ref) = 'B' then select descr into lshier_value_desc from GENCODES WHERE FLD_NAME='HIER_VALUE_2' AND MOD_NAME='W_PROF_WSHEET_MSTDET_CNF' AND FLD_VALUE = lshier_value; elsif trim(lshier_ref) = 'D' then select descr into lshier_value_desc from GENCODES WHERE FLD_NAME='HIER_VALUE_4' AND MOD_NAME='W_PROF_WSHEET_MSTDET_CNF' AND FLD_VALUE = lshier_value; elsif trim(lshier_ref) = 'I' then select descr into lshier_value_desc from ITEM where ITEM_CODE = lshier_value; elsif trim(lshier_ref) = 'T' then select descr into lshier_value_desc from GENCODES WHERE FLD_NAME='HIER_VALUE_6' AND MOD_NAME='W_PROF_WSHEET_MSTDET_CNF' AND FLD_VALUE = lshier_value; elsif trim(lshier_ref) = 'NA' then lshier_value_desc := ''; else lshier_value_desc := 'NotExist..Chk:FN_GET_HR_VALUE_DESCR'; end if; return lshier_value_desc; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_FIN_USAGES ( AS_FINENTITY CHAR,as_site_code CHAR, as_ref_code CHAR) RETURN VARCHAR2 IS ls_USAGES siteregno.usage%type; BEGIN BEGIN Select USAGE into ls_USAGES from siteregno where fin_entity =AS_FINENTITY AND site_code = as_site_code and ref_code = as_ref_code; EXCEPTION when no_data_found then ls_USAGES := ''; END; return ls_USAGES ; END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STOCK_SUMMARY_X ON STOCK_SUMMARY (SITE_CODE, ITEM_CODE, LOC_CODE, INV_STAT) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION PICK_ZONE_CODE (marea_code in char) return char is mregion_code char(5); mzone_code char(5); begin select level_code__parent into mregion_code from hierarchy where level_code = marea_code; select level_code__parent into mzone_code from hierarchy where level_code = mregion_code; return mzone_code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX ACTION_ACTION_TYPE ON ACTION (ACTION_TYPE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PROCEDURE DP_SITEITEM_PO_ADD (ls_sitecodedlv in char, ls_sitecodesupp in char,ls_item_ser in char, ls_item_code in char, ls_commit in char,ls_errcode out char) as ls_supp_code char(10); ls_purc_order char(10); li_lineno number(3); li_cnt number(3); ls_status char(1); ls_unit char(3); ls_pack_code char(5); ls_pack_instr varchar2(60); ls_acct_code_dr char(10); ls_cctr_code_dr char(4); ls_acct_code_cr char(10); ls_cctr_code_cr char(4); BEGIN -- main ls_errcode := ' '; IF ls_sitecodedlv is null OR ls_item_ser is null OR ls_sitecodesupp is null THEN ls_errcode := ''; RETURN; END IF; IF length(ltrim(rtrim(ls_sitecodedlv))) = 0 OR length(ltrim(rtrim(ls_item_ser))) = 0 OR length(ltrim(rtrim(ls_sitecodesupp))) = 0 THEN ls_errcode := ''; RETURN; END IF; -- check for channel partner record select supp_code into ls_supp_code from supplier where site_code = ls_sitecodesupp and channel_partner = 'Y'; BEGIN -- po existance -- checking po existance select purc_order into ls_purc_order from porder where site_code__dlv = ls_sitecodedlv and item_ser = ls_item_ser and supp_code = ls_supp_code and confirmed = 'Y' ; BEGIN -- check po detail li_cnt := 0; select count(*) into li_cnt from porddet where purc_order = ls_purc_order and item_code = ls_item_code; if li_cnt > 1 then ls_errcode := 'MCPARPODET'; RETURN; else if li_cnt = 1 then select status into ls_status from porddet where purc_order = ls_purc_order and item_code = ls_item_code; if ls_status = 'C' then update porddet set status = 'O' where purc_order = ls_purc_order and item_code = ls_item_code; end if; else if li_cnt = 0 then select nvl(max(line_no),0) into li_lineno from porddet where purc_order = ls_purc_order ; IF li_lineno = 0 THEN li_lineno := 1; ELSE li_lineno := li_lineno + 1; END IF; -- get details from item select unit, pack_code, pack_instr into ls_unit, ls_pack_code, ls_pack_instr from item where item_code = ls_item_code ; -- get details from itemser select acct_code__in, cctr_code__in into ls_acct_code_dr, ls_cctr_code_dr from itemser where item_ser = ls_item_ser; -- get details from supplier select acct_code__ap, cctr_code__ap into ls_acct_code_cr, ls_cctr_code_cr from supplier where supp_code = ls_supp_code; BEGIN -- add po detail record insert into porddet (purc_order, line_no, site_code, item_code, quantity, unit, rate, discount, tax_amt, tot_amt, loc_code, req_date, dlv_date, remarks, unit__rate, conv__qty_stduom, conv__rtuom_stduom, unit__std, quantity__stduom, rate__stduom, pack_code, no_art, pack_instr, acct_code__dr, cctr_code__dr, acct_code__cr, cctr_code__cr, status, status_date) values (ls_purc_order, lpad(ltrim(to_char(li_lineno)),3), ls_sitecodedlv, ls_item_code, 1, ls_unit, 0, 0, 0, 0, 'FRSH', to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd'), to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd'), 'Record added from Siteitem', ls_unit, 1, 1, ls_unit, 1, 0, ls_pack_code, 0, ls_pack_instr, ls_acct_code_dr, ls_cctr_code_dr, ls_acct_code_cr, ls_cctr_code_cr, 'O', to_date(to_char(sysdate,'yyyy-mm-dd'),'yyyy-mm-dd')); EXCEPTION WHEN OTHERS THEN ls_errcode := 'ADDDET'; RETURN; END; end if; -- no detail record end if; -- only one detail record end if; -- more than 1 detail record if ls_commit = 'Y' then commit; end if; return; END; -- check po detail -- exception handle for po exitance exception WHEN NO_DATA_FOUND THEN ls_errcode := 'NOCPARPO'; RETURN; WHEN TOO_MANY_ROWS THEN ls_errcode := 'MORECPARPO'; RETURN; END; -- po existance -- exception handle for channel parner EXCEPTION WHEN NO_DATA_FOUND THEN ls_errcode := 'NOCPART'; RETURN; WHEN TOO_MANY_ROWS THEN ls_errcode := 'MORECPART'; RETURN; END; -- eof main -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_SHIPMENT_DT ON SHIPMENT (SHIPMENT_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_ACTUAL_WEEKLY_HOL (ls_emp_code char, ld_hol_date1 date,ld_hol_date2 date, ls_hol_type char) return number is lc_hol_days number; begin lc_hol_days := 0; select count(hol_date) into lc_hol_days from holiday where hol_date between ld_hol_date1 and ld_hol_date2 and hol_tblno = (select hol_tblno from employee where emp_code = ls_emp_code) and hol_date not in (select work_date from dr_main where work_date between ld_hol_date1 and ld_hol_date2 and sales_pers = ls_emp_code ) and hol_type = ls_hol_type ; return lc_hol_days; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX TIME_ALLOCATION_PA ON TIME_ALLOCATION (EMP_CODE, ALARM_SOUNDED, ALARM_ON) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX INV_FREEZE_DET_X1 ON INV_FREEZE_DET (TRAN_ID, LINE_NO, SITE_CODE, ITEM_CODE, LOC_CODE, LOT_NO, LOT_SL) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX STRG_SPON_REQ_BUGTALLOC_X ON STRG_SPON_REQ_BUGTALLOC (TRAN_ID, LINE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FIELD_HIERARCHY_X ON FIELD_HIERARCHY (STAN_CODE, ITEM_SER, TOWN_CODE, VERSION_ID) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_INVHOLDREL_HOLDQTY (as_tran_id IN INV_HOLD_DET.TRAN_ID%TYPE, as_line_no IN INV_HOLD_DET.LINE_NO%TYPE) return NUMBER is qty NUMBER(14,3); itemCode VARCHAR2 (10); locCode VARCHAR2 (8); lotNo VARCHAR2 (15); lotsl VARCHAR2 (15); siteCode VARCHAR2 (5); begin qty:=0; begin SELECT INV_HOLD_DET.ITEM_CODE ,INV_HOLD_DET.LOC_CODE,INV_HOLD_DET.LOT_NO, INV_HOLD_DET.LOT_SL,INV_HOLD_DET.site_code into itemCode,locCode,lotNo,lotsl,siteCode FROM INV_HOLD_DET INV_HOLD_DET WHERE INV_HOLD_DET.TRAN_ID = as_tran_id AND INV_HOLD_DET.LINE_NO = as_line_no; end; begin SELECT sum(quantity) INTO qty FROM stock where (1=1) AND (site_code = siteCode OR siteCode IS NULL) AND (item_code = itemCode OR itemCode IS NULL) AND (lot_no = lotNo OR lotNo IS NULL) AND (loc_code =locCode OR locCode IS NULL) AND (lot_sl =lotsl OR lotsl IS NULL) ; exception when others then qty := 0 ; return qty; end; return qty; end fn_invholdrel_holdqty; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE PACKAGE CHC_CHEM_PC_DM AS FUNCTION getChemPcInfo(empCode in char, eventDate in Date) RETURN CHC_CHEM_PC_TB PIPELINED; END CHC_CHEM_PC_DM; CREATE OR REPLACE PACKAGE BODY CHC_CHEM_PC_DM AS FUNCTION getChemPcInfo (empCode in char, eventDate in Date) RETURN CHC_CHEM_PC_TB PIPELINED IS AS_PRD_FR_DATE DATE; AS_PRD_TO_DATE DATE; AS_FR_DATE DATE; AS_TO_DATE DATE; UNCONFIRM_CNT NUMBER(3); AS_PRD_CODE CHAR(6); MGR_EMPS VARCHAR(1000); BEGIN SELECT FR_DATE, TO_DATE INTO AS_PRD_FR_DATE, AS_PRD_TO_DATE FROM PERIOD WHERE eventdate BETWEEN FR_DATE AND TO_DATE; SELECT LISTAGG((A.EMP_CODE ), ',') WITHIN GROUP (order by A.EMP_CODE) INTO MGR_EMPS FROM EMPLOYEE A, GRADE B,STATION STAN,STATE ST WHERE A.EMP_CODE IN (SELECT EMP_CODE FROM EMPLOYEE E1 WHERE RELIEVE_DATE IS NULL START WITH E1.EMP_CODE = empCode CONNECT BY PRIOR E1.EMP_CODE = E1.REPORT_TO) AND A.GRADE = B.GRADE_CODE AND A.STAN_CODE__HQ = STAN.STAN_CODE AND ST.STATE_CODE = STAN.STATE_CODE; for x in ( SELECT STRG_DR.STRG_CODE SC_CODE, STRG_DR.CHEM_NAME, STRG_DR.SPECIALITY, STRG_DR.PLANNED_VISIT, STRG_DR.CLASS, STRG_DR.CATEGORY, STRG_DR.LOCALITY, STRG_DR.ROUTE_TYPE, LISTAGG(TRIM('' || STRG_DR.DESCR || ''), ',') WITHIN GROUP (ORDER BY STRG_DR.STRG_CODE) AS MET_DATES, AS_PRD_CODE AS PRD_CODE, STRG_DR.SALES_PERS AS MGR_SUB, STRG_DR.DIVISION, STRG_DR.EMP_CODE, STRG_DR.EMP_NAME, STRG_DR.DESIGN, STRG_DR.HEAD_QUAT, STRG_DR.CHEM_ADDR FROM ( SELECT SM.STRG_CODE, EVENT_DATE,I.DESCR, SMO.ITEM_CODE, (SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME) AS CHEM_NAME, SPL.DESCR AS SPECIALITY, SS.NO_VISIT AS PLANNED_VISIT, SS.CATEGORY, LOC.DESCR AS LOCALITY, SSC.DESCR CLASS, (SELECT descr FROM SPRS_ROUTE ROUTE WHERE ROUTE.SPRS_CODE = SS.SALES_PERS AND ROUTE.ROUTE_ID = SS.ROUTE_ID) ROUTE_TYPE, SM.SALES_PERS, EMP.EMP_CODE, (EMP.EMP_FNAME || ' ' || EMP.EMP_MNAME || ' ' || EMP.EMP_LNAME) AS EMP_NAME, ITEMSER.DESCR AS DIVISION, EMP.DESIGNATION as DESIGN, STATION.DESCR AS HEAD_QUAT, (SC.ADDR1 || ' ' || SC.ADDR2 || ' ' || SC.ADDR3) AS CHEM_ADDR FROM STRG_MEET_ORDER SMO LEFT OUTER JOIN STRG_MEET SM ON SMO.DCR_ID=SM.DCR_ID AND SMO.QUANTITY > 0 and sm.strg_code = smo.strg_code LEFT OUTER JOIN ITEM I ON I.ITEM_CODE = SMO.ITEM_CODE LEFT OUTER JOIN STRG_CUSTOMER SC ON SC.SC_CODE = SM.STRG_CODE LEFT OUTER JOIN LOCALITY LOC ON SC.LOCALITY_CODE = LOC.LOCALITY_CODE LEFT OUTER JOIN STRG_SERIES SS ON SS.SC_CODE = SM.STRG_CODE AND SS.SALES_PERS = SM.SALES_PERS LEFT OUTER JOIN SALES_PERS SP ON SM.SALES_PERS = SP.SALES_PERS LEFT OUTER JOIN ITEMSER ITEMSER ON SP.ITEM_SER = ITEMSER.ITEM_SER LEFT OUTER JOIN STRG_SER_CLASS SSC ON SSC.ITEM_SER = SP.ITEM_SER AND SSC.CLASS_CODE = SS.CLASS_CODE LEFT OUTER JOIN EMPLOYEE EMP ON EMP.EMP_CODE = SM.SALES_PERS LEFT OUTER JOIN STATION STATION ON EMP.STAN_CODE__HQ = STATION.STAN_CODE LEFT OUTER JOIN SPECIALITY SPL ON SS.SPL_CODE = SPL.SPL_CODE WHERE SM.SALES_PERS in (SELECT RPAD(COLUMN_VALUE,10,' ') FROM TABLE( CSV_TO_ROW( (MGR_EMPS) ))) AND SM.EVENT_DATE = eventDate AND SM.STRG_CODE != '0000000000' ) STRG_DR GROUP BY STRG_DR.STRG_CODE,STRG_DR.CHEM_NAME, STRG_DR.SPECIALITY, STRG_DR.PLANNED_VISIT, STRG_DR.CATEGORY, STRG_DR.LOCALITY, STRG_DR.CLASS,STRG_DR.ROUTE_TYPE,STRG_DR.SALES_PERS, STRG_DR.EMP_CODE, STRG_DR.EMP_NAME,STRG_DR.DIVISION,STRG_DR.DESIGN,STRG_DR.HEAD_QUAT,STRG_DR.CHEM_ADDR ORDER BY STRG_DR.PLANNED_VISIT ) LOOP PIPE ROW (CHC_CHEM_PC_MST( x.SC_CODE,x.CHEM_NAME,x.SPECIALITY,x.PLANNED_VISIT,x.CLASS,x.CATEGORY,x.LOCALITY,x.ROUTE_TYPE,x.MET_DATES, x.PRD_CODE, x.MGR_SUB, x.DIVISION, x.EMP_CODE, x.EMP_NAME, x.HEAD_QUAT, x.DESIGN, x.CHEM_ADDR)); END LOOP; RETURN; END; END CHC_CHEM_PC_DM; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_LPARTY_APPL_FOR_SITE (as_partycode in LOANPARTY.PARTY_CODE%type, as_sitecode in site.site_code%type) return char is ls_varvalue disparm.var_value%type; ll_count number(2) := 0; ls_retval char(1) := 'N'; BEGIN begin select var_value into ls_varvalue from disparm where prd_code = '999999' and var_name = 'SITE_SPECIFIC_LPARTY'; exception when others then ls_varvalue := 'N'; end; if ls_varvalue = 'Y' then begin select count(1) into ll_count from SITE_LOANPARTY where site_code = as_sitecode and PARTY_CODE = as_partycode; exception when others then ll_count := 0; end; if ll_count > 0 then ls_retval := 'Y'; end if; else ls_retval := 'Y'; end if; RETURN(ls_retval); END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RPRD_CODE (mdate date) return varchar is code varchar(15); begin Select code into code from period where fr_date <= mdate and to_date >= mdate; return code; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX DSS_INDEX ON DWH_SALES_SUM (TRAN_ID, SITE_CODE, CUST_CODE, ITEM_CODE, LOT_NO, DOC_DATE, LINE_TYPE, LINE_NO, MRP, PTR, PTS) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DIST_SUPPLIER (as_distno distord_rcp.tran_id%type) return char is ls_site CHAR(60); begin Select b.descr into ls_site from distord_rcp a ,site b where a.site_code__ship = b.site_code and a.tran_id = as_distno; return(ls_site); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_SALERET_DRCR_CHK BEFORE INSERT OR UPDATE OF confirmed ON SRETURN referencing old as old new as new FOR EACH ROW DECLARE --PRAGMA AUTONOMOUS_TRANSACTION; ll_glcount number(3) := 0; ll_count number(3) := 0; ll_line_no number(3) := 0; lc_rate number(17,3) := 0; lc_gldr number(17,3) := 0; lc_glcr number(17,3) := 0; varvalue varchar2(10); INV_ACCT varchar2(10); lc_exit boolean:= false; -- CURSOR s_saleretrate is --SELECT cost_rate , line_no into lc_rate, ll_line_no FROM sreturndet where tran_id = :new.tran_id; BEGIN if :new.confirmed = 'Y' then begin begin select var_value into varvalue from finparm where var_name = 'INV_ACCT_SRET'; exception when others then varvalue:= 'N'; end; if varvalue = 'S' then varvalue:='Y'; for cur_salret in ( SELECT d.item_code,CASE WHEN S.INV_ACCT IS NULL THEN 'N' ELSE S.INV_ACCT END as INV_ACCT FROM SRETURNDET D, ITEM I, ITEMSER S WHERE D.ITEM_CODE = I.ITEM_CODE AND S.ITEM_SER = I.ITEM_SER and D.item_code = d.ITEM_CODE AND D.TRAN_ID = :new.tran_id ) loop if cur_salret.INV_ACCT = 'N' then lc_exit := true; varvalue := 'N'; exit; end if; end loop; end if; if (lc_exit = false) then if varvalue = 'Y' then begin -- 1. check detail count and gltrace count begin select count(1) into ll_count from sreturndet where tran_id = :new.tran_id; exception when others then ll_count:= 0; end; begin select count(1) into ll_glcount from gltrace where ref_ser = 'S-RET' and ref_id = :new.tran_id; exception when others then ll_glcount := 0; end; if ll_count > 0 then begin SELECT sum(cost_rate * quantity) into lc_rate FROM sreturndet where tran_id = :new.tran_id; exception when others then lc_rate := 0; end; if lc_rate <> 0 and ll_glcount = 0 then raise_application_error( -20601, 'GL not posted but rate is [' || to_char(lc_rate) || ']' ); end if; -- 2. check header amount, CR and gltrace DR, CR begin select sum(dr_amt * exch_rate), sum(cr_amt * exch_rate) into lc_gldr, lc_glcr from gltrace where ref_ser = 'S-RET' and ref_id = :new.tran_id; exception when others then lc_gldr := 0; lc_glcr := 0; end; if lc_rate<> 0 and abs(lc_gldr - lc_glcr) > 1 then raise_application_error( -20601, 'Debit or credit mismatch in gltrace GL DR [' || to_char(lc_gldr) || '] GL CR [' || to_char(lc_glcr) || ']' ); end if;--end rate end if; -- count end end; end if ;-- end of varvalue if end if; end ; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GETPOTENCY_BIOP (iss_qty number,batch_size number,potency number,fill_volume number,oa number) return number is potency_adj number(14,6); total_iss_qty number(14,6); begin total_iss_qty :=(iss_qty*batch_size*1000*potency*fill_volume*oa); potency_adj := (total_iss_qty - iss_qty); return( potency_adj ); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_SUN_GET_LST (MSTATE in char) return number is mrate number; begin if mstate = 'HP' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_HP'; elsif mstate = 'ME' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_ME'; elsif mstate = 'PO' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_PO'; elsif mstate = 'MZ' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_MI'; elsif mstate = 'MN' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_MN'; elsif mstate = 'NG' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_NG'; elsif mstate = 'AR' then select to_number(var_value) into mrate from disparm where var_name = 'SALES_TAX_AR'; end if; return mrate; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ZONE_X ON ZONE (CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_INDEX -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RGET_BILL_NO (as_ref_id in char, as_refser in char, as_sundry_code in char , as_tran_id in char ) RETURN CHAR IS LS_FIELDVALUE varCHAR2(6000); AS_REFSER_1 varCHAR2(250); li_cnt number := 0; as_count number; begin begin IF TRIM(AS_REFSER) = 'P-IBCA' THEN SELECT MISC_PAYABLES.TRAN_SER INTO AS_REFSER_1 FROM MISC_PAYABLES WHERE MISC_PAYABLES.REF_NO=(SELECT MP.REF_NO FROM MISC_PAYABLES MP WHERE MP.TRAN_SER='P-IBCA' AND MP.TRAN_ID = AS_REF_ID) AND MISC_PAYABLES.TRAN_SER <> 'P-IBCA' ; elsif TRIM(AS_REFSER) = 'R-IBCA' THEN SELECT RECEIVABLES.TRAN_SER INTO AS_REFSER_1 FROM RECEIVABLES WHERE RECEIVABLES.REF_NO=(SELECT RC.REF_NO FROM RECEIVABLES RC WHERE RC.TRAN_SER='R-IBCA' AND RC.TRAN_ID = AS_REF_ID) AND RECEIVABLES.TRAN_SER <> 'R-IBCA' ; ELSE AS_REFSER_1 := as_refser; END IF; if TRIM(as_refser_1) = 'CRNRCP' then SELECT NVL(DRCR_RCP.SRETURN_NO,'') || ' - ' || NVL(SRETURN.CUST_REF,DRCR_RCP.CUST_REF_NO) || ' - ' || NVL(SRETURN.CLAIM_DATE,DRCR_RCP.CUST_REF_DATE) || ' - ' || NVL((SELECT DESCR FROM GENCODES WHERE FLD_NAME='REAS_CODE' AND MOD_NAME='W_SALESRETURN' AND FLD_VALUE=SRETURN.REAS_CODE),'') into ls_fieldvalue from DRCR_RCP LEFT OUTER JOIN SRETURN ON SRETURN.TRAN_ID=DRCR_RCP.SRETURN_NO where DRCR_RCP.tran_id = as_ref_id; end if; if TRIM(as_refser_1) = 'F-XFR' then SELECT BANK_CODE__FROM || ' - ' || BANK_CODE__TO || ' - ' || XFR_MODE || ' - ' || NVL(TRIM(REF_NO),'') || ' - ' || NVL(TO_CHAR(REF_DATE),'') into ls_fieldvalue FROM fundtransfer WHERE fundtransfer.TRAN_ID = as_ref_id; end if; if TRIM(as_refser_1) = 'M-PAY' then select count(*) into as_count FROM MISC_PAYMENT INNER JOIN MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID GROUP BY MISC_PAYMENT.REF_NO; if as_count<50 then SELECT NVL(TRIM(MISC_PAYMENT.BANK_CODE),'') || ' - ' || NVL(TRIM(MISC_PAYMENT.REF_NO),'') || ' - ' || 'Agst : ' || LISTAGG(TRIM(MISC_PAYDET.VOUCH_NO||' - '|| MISC_PAYDET.PAY_AMT ),', ' ON OVERFLOW TRUNCATE '...' WITHOUT COUNT) WITHIN GROUP (ORDER BY MISC_PAYDET.TRAN_ID) AS VOUCH_NO INTO ls_fieldvalue FROM MISC_PAYMENT INNER JOIN MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID AND MISC_PAYMENT.SUNDRY_CODE=as_sundry_code GROUP BY MISC_PAYMENT.REF_NO,MISC_PAYMENT.BANK_CODE; else SELECT NVL(TRIM(MISC_PAYMENT.BANK_CODE),'') || ' - ' || NVL(TRIM(MISC_PAYMENT.REF_NO),'') || ' Too Many Vouchers :' ||as_count INTO ls_fieldvalue FROM MISC_PAYMENT INNER JOIN MISC_PAYDET ON MISC_PAYMENT.TRAN_ID = MISC_PAYDET.TRAN_ID WHERE MISC_PAYMENT.TRAN_ID=AS_REF_ID GROUP BY MISC_PAYMENT.REF_NO,MISC_PAYMENT.BANK_CODE; end if ; end if; if TRIM(as_refser_1) = 'M-RCP' then SELECT BANK_CODE || ' - ' || NVL(PARTY_BANK_REF,'') || ' - ' || (CASE WHEN MISC_RECEIPT.RCP_MODE='Q' THEN 'Cheque' WHEN MISC_RECEIPT.RCP_MODE='D' THEN 'Draft' WHEN MISC_RECEIPT.RCP_MODE='C' THEN 'Cash' WHEN MISC_RECEIPT.RCP_MODE='P' THEN 'Pay Order' WHEN MISC_RECEIPT.RCP_MODE='E' THEN 'Electronic' WHEN MISC_RECEIPT.RCP_MODE='R' THEN 'Credit Card' WHEN MISC_RECEIPT.RCP_MODE='Y' THEN 'Payment Advice' END) || ' - ' || NVL(TRIM(REF_NO),'')|| ' - ' || NVL(TO_CHAR(REF_DATE),'') INTO ls_fieldvalue FROM MISC_RECEIPT WHERE MISC_RECEIPT.TRAN_ID = as_ref_id; end if; if TRIM(as_refser_1) = 'M-VOUC' then SELECT NVL(BILL_NO,'')|| ' - ' ||BILL_DATE|| ' - ' ||NVL(SUPP_BILL_AMT,0) INTO ls_fieldvalue FROM MISC_VOUCHER WHERE MISC_VOUCHER.TRAN_ID = as_ref_id; end if; if TRIM(as_refser_1) = 'MDRCRC' then SELECT NVL(MISC_DRCR_RCP.SRETURN_NO,'')|| ' - ' || NVL(SRETURN.CUST_REF,MISC_DRCR_RCP.CUST_REF_NO) || ' - ' || NVL(SRETURN.CLAIM_DATE,MISC_DRCR_RCP.CUST_REF_DATE) into ls_fieldvalue from MISC_DRCR_RCP LEFT OUTER JOIN SRETURN ON SRETURN.TRAN_ID=MISC_DRCR_RCP.SRETURN_NO WHERE MISC_DRCR_RCP.TRAN_ID = AS_REF_ID ; end if; if TRIM(as_refser_1) = 'MDRCRD' then SELECT NVL(CUST_REF_NO,'')|| ' - ' ||CUST_REF_DATE INTO ls_fieldvalue FROM MISC_DRCR_RCP WHERE MISC_DRCR_RCP.TRAN_ID = AS_REF_ID; end if; if TRIM(as_refser_1) = 'MPCANC' then SELECT PAYMENT_NO|| ' - ' ||BANK_CODE|| ' - ' ||NVL(TRIM(REF_NO),'')|| ' - ' ||NVL(TO_CHAR(REF_DATE),'') INTO ls_fieldvalue FROM MISC_PAYMENT_CANC WHERE MISC_PAYMENT_CANC.TRAN_ID = AS_REF_ID; end if; if TRIM(as_refser_1) = 'R-DIS' then SELECT RCPDISHNR.RECEIPT_NO|| ' - ' || (RECEIPT.CUST_BANK_REF)|| ' - ' || NVL(TRIM(RCPDISHNR.BANK_CODE),'') || ' - ' || NVL(TRIM(RCPDISHNR.REF_NO),'')|| ' - ' || RCPDISHNR.REF_DATE INTO ls_fieldvalue FROM RCPDISHNR LEFT OUTER JOIN RECEIPT ON RECEIPT.TRAN_ID = RCPDISHNR.RECEIPT_NO WHERE RCPDISHNR.TRAN_ID = AS_REF_ID; END IF; if TRIM(as_refser_1) = 'RCP' then SELECT RECEIPT.BANK_CODE || ' - ' || NVL(RECEIPT.CUST_BANK_REF,'')|| ' - ' || (CASE WHEN RECEIPT.RCP_MODE='Q' THEN 'Cheque' WHEN RECEIPT.RCP_MODE='D' THEN 'Draft' WHEN RECEIPT.RCP_MODE='C' THEN 'Cash' WHEN RECEIPT.RCP_MODE='P' THEN 'Pay Order' WHEN RECEIPT.RCP_MODE='E' THEN 'Electronic' WHEN RECEIPT.RCP_MODE='R' THEN 'Credit Card' WHEN RECEIPT.RCP_MODE='Y' THEN 'Payment Advice' END) || ' - ' || TRIM(RECEIPT.REF_NO) || ' - ' || NVL(TO_CHAR(RECEIPT.REF_DATE) ,'') || ' Agst : ' || substr(rtrim(xmlagg(xmlelement(e,RCPDET.REF_NO||' - '|| RCPDET.RCP_AMT,',').extract('//text()') order by RCPDET.TRAN_ID).getclobval(),','),1,500) --LISTAGG(TRIM(RCPDET.REF_NO),', ' ON OVERFLOW TRUNCATE '...' WITHOUT COUNT) WITHIN GROUP (ORDER BY RCPDET.TRAN_ID) INTO LS_FIELDVALUE FROM RECEIPT,RCPDET WHERE RECEIPT.TRAN_ID = RCPDET.TRAN_ID AND RECEIPT.TRAN_ID = AS_REF_ID AND RCPDET.CUST_CODE=as_sundry_code GROUP BY RECEIPT.BANK_CODE, RECEIPT.CUST_BANK_REF, RECEIPT.RCP_MODE, RECEIPT.REF_NO, TO_CHAR(RECEIPT.REF_DATE); END IF; if TRIM(as_refser_1) = 'S-INV' then SELECT NVL(INVOICE.SALE_ORDER,'') || ' - ' || NVL(SORDER.CUST_PORD,'')|| ' - ' || NVL(TO_CHAR(SORDER.PORD_DATE ),'') INTO ls_fieldvalue FROM INVOICE LEFT OUTER JOIN SORDER ON INVOICE.SALE_ORDER = SORDER.SALE_ORDER WHERE INVOICE.INVOICE_ID = AS_REF_ID; END IF; if TRIM(as_refser_1) = 'VOUCH' then SELECT PURC_ORDER || ' - ' || NVL(BILL_NO,'')|| ' - ' || NVL(TO_CHAR(BILL_DATE),'') INTO ls_fieldvalue FROM VOUCHER WHERE VOUCHER.TRAN_ID = AS_REF_ID; END IF; if TRIM(as_refser_1) = 'DRNRCP' then SELECT NVL(DRCR_RCP.CUST_REF_NO,'') || ' - ' || NVL(TO_CHAR(DRCR_RCP.CUST_REF_DATE),'') || ' - ' || nvl((select descr from gencodes where fld_name='REAS_CODE' and mod_name='W_DRCRRCP_DR' and fld_value=sreturn.reas_code),'') into ls_fieldvalue from DRCR_RCP left outer join sreturn on DRCR_RCP.SRETURN_NO=sreturn.tran_id where DRCR_RCP.tran_id = as_ref_id; END IF; if TRIM(as_refser) = 'P-VOUC' then select payr_voucher.emp_code || ' - ' || employee.emp_fname || ' - ' ||nvl(employee.emp_mname,'') || ' - ' || nvl(employee.emp_lname,'') into ls_fieldvalue from payr_voucher,employee where employee.emp_code = payr_voucher.emp_code and payr_voucher.tran_id = as_ref_id ; end if; exception when no_data_found then ls_fieldvalue := ' ' ; end; return substr(ls_fieldvalue,1,500); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX KY_LOCATION ON LOCATION (LOC_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_CHK_WORK_FEEDBACK (as_workorder in char, as_trantype in char) return varchar2 is ll_reccount number(6,0) := 0; by_count number(6,0) := 0; wk_count number(6,0) := 0; as_route_code char(10); ls_retval number := 0; begin if (as_trantype='F') then begin select route_code into as_route_code from workorder where work_order=as_workorder; if as_route_code is not null then select count(*) into ll_reccount from procroute_oper_instr where route_code=as_route_code and TAKE_OBSERV ='Y'; if ll_reccount >0 then select count(*) into by_count from workorder_feedback where work_order=as_workorder and confirmed='Y'; else ls_retval:= 0; end if; if BY_COUNT>=LL_RECCOUNT then ls_retval:= 0; else ls_retval:= 1; end if; end if; end ; end if; return ls_retval; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_FINVAL_DLYRCP (ac_amount in number,al_no_days in number,as_crterm in char,ad_tran in date) return number is lc_intamt number(20,2); lc_finchg number(20,2); ls_type char; begin select fin_chg, fchg_type into lc_finchg, ls_type from crtermfc where cr_term = as_crterm and al_no_days >= min_day and al_no_days <= max_day and ac_amount >= min_cramt and ac_amount <= max_cramt and ad_tran >= eff_date and ad_tran <= valid_upto ; if SQLCODE <> 0 then lc_intamt := 0; else if ls_type = 'P' then lc_intamt := lc_finchg; elsif ls_type = 'F' then lc_intamt := 0; else return -1; end if; end if; Return lc_intamt; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_PPO_QTY ( as_sitecode in char, as_itemcode in char) return number is lc_ppoqty number(14,3) := 0; begin begin select sum(porddet.quantity - porddet.dlv_qty ) into lc_ppoqty from porddet, porder where porddet.purc_order = porder.purc_order and porddet.item_code = as_itemcode and porder.site_code__dlv = as_sitecode and porddet.status = 'O' and porddet.quantity - porddet.dlv_qty > 0 ; exception when others then lc_ppoqty := 0; end; if lc_ppoqty is null then lc_ppoqty := 0; end if; return (lc_ppoqty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_TAXABLEAMT BEFORE INSERT ON TAXTRAN FOR EACH ROW declare PRAGMA AUTONOMOUS_TRANSACTION; ls_taxtype char(1); lc_quantity number(14,3) := 0; lc_rate number(15,4) := 0; lc_discount number(14,3) := 0; lc_taxableamt number(14,3) := 0; lc_othchrg number(14,3) := 0; ll_count number(3) :=0; BEGIN if trim(:new.tran_code) in ('S-ORD','S-RET','P-ORD','P-RCP','P-RET','D-RCP','D-ISS') then select tax_type into ls_taxtype from tax where tax_code = :new.tax_code; if trim(ls_taxtype) in ('G','H','I') then begin if trim(:new.tran_code) = 'S-ORD' then select quantity__stduom,rate__stduom,discount into lc_quantity, lc_rate, lc_discount from sorddet where sale_order = :new.tran_id and line_no = :new.line_no; end if; if trim(:new.tran_code) = 'P-ORD' then select quantity__stduom,rate__stduom,discount into lc_quantity, lc_rate, lc_discount from porddet where purc_order = :new.tran_id and line_no = :new.line_no; end if; if trim(:new.tran_code) = 'S-RET' then select quantity__stduom,rate__stduom,discount into lc_quantity, lc_rate, lc_discount from sreturndet where tran_id = :new.tran_id and line_no = to_number(trim(:new.line_no)); end if; if trim(:new.tran_code) = 'P-RCP' or trim(:new.tran_code) = 'P-RET' then select quantity__stduom,rate__stduom,discount into lc_quantity, lc_rate, lc_discount from porcpdet where tran_id = :new.tran_id and line_no = :new.line_no; end if; if trim(:new.tran_code) = 'D-ISS' then select quantity,rate,discount into lc_quantity, lc_rate, lc_discount from distord_issdet where tran_id = :new.tran_id and line_no = to_number(trim(:new.line_no)); end if; if trim(:new.tran_code) = 'D-RCP' then select quantity,rate,discount into lc_quantity, lc_rate, lc_discount from distord_rcpdet where tran_id = :new.tran_id and line_no = to_number(trim(:new.line_no)); end if; exception when others then lc_quantity := 0; lc_rate := 0; lc_discount := 0; end; if lc_quantity is null then lc_quantity := 0; end if; if lc_rate is null then lc_rate := 0; end if; if lc_discount is null then lc_discount := 0; end if; begin select count(1) into ll_count from tbasseq where tax_base = :new.tax_base; exception when others then ll_count := 0; end; if ll_count > 0 then begin select sum(tax_amt) into lc_othchrg from taxtran where tran_id = :new.tran_id and line_no = to_number(trim(:new.line_no)) and tax_code in (select tax_code from tbasseq where tax_base = :new.tax_base); exception when others then lc_othchrg := 0; end; end if; lc_taxableamt := round( ((lc_quantity * lc_rate) - ((lc_quantity * lc_rate) * lc_discount / 100 )) + lc_othchrg,3); if round(:new.taxable_amt,3) <> lc_taxableamt and :new.tax_amt <> 0 then raise_application_error( -20601, 'For line # [' ||:new.line_no ||'] tax code [' || trim(:new.tax_code) || '] taxable amount is not matching with ((quantity__stduom * rate__stduom) - discount) is [' || to_char(lc_taxableamt) || '] but trying to insert in taxtran is [' || to_char(:new.taxable_amt) || '] '); end if; end if; end if; END ; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX FT_BENEFIT_SCH_X ON FT_BENEFIT_SCH (BEN_SCH) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_REMARKS (as_remarks1 in char,as_remarks2 in char) return varchar2 is ls_string varchar2(1000); ls_datas varchar2(1000); ls_newdatas varchar2(1000); ls_string1 varchar2(1000); begin select nvl(trim(as_remarks1),'')||nvl(trim(as_remarks2),'') into ls_string from dual; if length(ls_string) > 0 then while length(ls_string) > 0 loop select ddf_get_token(ls_string,'.')into ls_datas from dual; --dbms_output.put_line('ls_string ::: ' || length(ls_string)); ls_newdatas := ls_newdatas || ls_datas || chr(10); ls_string1 := substr(ls_string,length(ls_datas)+2,LENGTH(ls_string)); ls_string := ls_string1; --dbms_output.put_line('ls_string1 ::: ' || ls_string1); end loop; end if; return ls_newdatas; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX ITEMMNFR_DET_ITEM_CODE_X ON ITEMMNFR_DET (ITEM_CODE, SUPP_CODE__MNFR, SUPP_CODE, LICENCE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX COMPLEXITY_X ON COMPLEXITY (COMPLEXITY_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_VOUCH_REF_ID_14I23 (lsref_ser char,lsref_id char) return varchar2 is ls_no varchar2(5000); begin if lsref_ser = 'VOUCH ' then select 'Bill no : '|| trim( bill_no) ||' Bill Date : ' || to_char(bill_date , 'DD/MM/YY') into ls_no from voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'F-XFR ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date , 'DD/MM/YY') into ls_no from fundtransfer where tran_id = lsref_id and status = 'C'; elsif lsref_ser = 'M-VOUC' then select 'Bill no : '||trim(bill_no)||' Bill Date : ' || to_char(bill_date,'DD/MM/YY') into ls_no from misc_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRD' then select 'Invoice No : '|| trim(invoice_id)||' Invoice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MDRCRC' then select 'Invoice No : ' ||trim(invoice_id)||' Invice Date : ' || to_char(tran_date,'DD/MM/YY') into ls_no from drcr_rcp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'E-PAY ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payment_exp where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'MPCANC' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_payment_canc where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'M-RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from misc_receipt where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'P-VOUC' then select 'Ref No '||trim(ref_no)||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from payr_voucher where tran_id = lsref_id and confirmed = 'Y'; elsif lsref_ser = 'RCP ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from receipt where tran_id = lsref_id and confirmed ='Y'; elsif lsref_ser = 'R-DIS ' then select 'Ref No : '||trim(ref_no) ||' Ref Date : ' || to_char(ref_date,'DD/MM/YY') into ls_no from rcpdishnr where tran_id = lsref_id and confirmed = 'Y'; end if; return ls_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX APPR_GROUP_TABLE_PK ON APPR_GROUP_TABLE (APPR_TBLNO, APPR_GROUP) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_DATA -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX KY_MISC_VOUCHER_TRACE ON MISC_VOUCHER_TRACE (TRAN_ID, REF_SER, TRAN_ID__REF, LINE_NO, TAX_CODE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE USERS -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_RTAXTRANRECOAMT (as_tran_id in char) return number is lc_amount number(14,3); LS_VARVAL VARCHAR(500); LL_EXCHRATE NUMBER(14,3); begin SELECT VAR_VALUE INTO LS_VARVAL FROM DISPARM WHERE VAR_NAME ='EXC_TAX_CODE_MODVAT'; select nvl(sum(nvl(reco_amount,0)),0) into lc_amount from taxtran where ( taxtran.tran_code IN ('P-RCP','P-RET' ) and ( tran_id = as_tran_id ) and ( taxtran.tax_code in LS_VARVAL)) ; SELECT EXCH_RATE INTO LL_EXCHRATE FROM PORCP WHERE TRAN_ID= AS_TRAN_ID; return lc_amount * LL_EXCHRATE ; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_ITEM_RESTR_VALIDATE (as_site_code in char,as_type in char,as_old_code in char,as_new_code in char) RETURN CHAR IS ls_old_value CHAR(10); ls_count number := 0; begin If(as_type ='M') then select count(1) into ls_count from itemmnfr where item_code = as_new_code and supp_code in (select supp_code from itemmnfr where item_code = as_old_code ) and supp_code__mnfr in (select supp_code__mnfr from itemmnfr where item_code = as_old_code) ; end if; If(as_type ='S') then select count(1) into ls_count from supplieritem where item_code = as_new_code and supp_code in (select supp_code from supplieritem where item_code = as_old_code ) ; end if; If(as_type ='C') then select count(1) into ls_count from customeritem where item_code = as_new_code and cust_code in (select cust_code from customeritem where item_code = as_old_code ) ; end if; If(as_type ='P') then select count(1) into ls_count from pricelist where item_code = as_new_code and price_list in (select price_list from pricelist where item_code = as_old_code ) ; end if; If(as_type ='R') then select count(1) into ls_count from siteitemregno where item_code = as_new_code and fin_entity in (select fin_entity from siteitemregno where item_code = as_old_code ) and ref_code in (select ref_code from siteitemregno where item_code = as_old_code ) and site_code in (select site_code from siteitemregno where site_code = as_site_code ) ; end if; If(as_type ='N') then select count(1) into ls_count from itemregno where item_code = as_new_code and site_code in (select site_code from itemregno where site_code = as_site_code ) and ref_code in (select ref_code from itemregno where item_code = as_old_code ) ; end if; If(as_type ='I') then select count(1) into ls_count from siteitem where item_code = as_new_code and site_code in (select site_code from siteitem where site_code = as_site_code ) ; end if; if ls_count > 0 then return as_old_code; else return null; -- Sharad 22/2/2011 Changed from '' to null End if; end; -- Failed to execute: SQL Statement ==> SQLException ORA-02303: cannot drop or replace a type with type or table dependents -- CREATE OR REPLACE TYPE UDTT_SITE_INFO_CHANGE AS OBJECT ( DESCR VARCHAR2(60), ADD1 VARCHAR2(40) , ADD2 VARCHAR2(40) , ADD3 VARCHAR2(40) , CITY VARCHAR2(20) , PIN VARCHAR2(15) , STATE_CODE CHAR(5) , TELE1 VARCHAR2(15) , TELE2 VARCHAR2(15) , TELE3 VARCHAR2(15) , STAN_CODE CHAR(5) , STAN_DESCR VARCHAR2(40) , STATE_DESCR VARCHAR2(40) , COUNT_CODE CHAR(5), COUNT_DESCR VARCHAR2(40) ) -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION GET_SESSION_TYPE ( sess_type VARCHAR2 ) RETURN VARCHAR2 IS sessType VARCHAR2(100); BEGIN CASE sess_type WHEN 'M' THEN sessType := 'Meeting'; WHEN 'T' THEN sessType := 'Training'; ELSE sessType := 'Presentation'; END CASE; RETURN TRIM(sessType); END; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX WO_SITE_ORDERTYPE_LOT_NO ON WORKORDER (SITE_CODE, ORDER_TYPE, LOT_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS TABLESPACE ITM_MFG_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_VOUCH_DET ( as_ref_id char,as_ref_ser in char,sundry_type in char,sundry_code in char,as_text in varchar2 ) Return varchar2 is ls_text varchar2(100); Begin Select 'Test Demo' into ls_text From Dual; Return ls_text; End; --desc gltrace; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_DAY_OPBAL_GLTRACE_ALAC (m_frst_date in char,m_date_from in char, m_sundry_type in char,m_sundry_code in char,m_site_code char) return number is ld_day_op_bal number(14,3); begin Select Sum((dr_amt * exch_rate) - (cr_amt * exch_rate)) into ld_day_op_bal from gltrace where site_code= m_site_code and tran_date >= m_frst_date and tran_date < m_date_from and sundry_type = m_sundry_type and sundry_code = m_sundry_code; If ld_day_op_bal is null Then ld_day_op_bal := 0 ; End if; Return ld_day_op_bal; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_UNAPPR_LEV ( ls_empcode char, ls_lvecode char, ls_tranid char) return number is ls_unappr_lev number (5,1) ; begin select sum(no_days) into ls_unappr_lev from empleave where (emp_code = ls_empcode) and (lve_code = ls_lvecode) and (status = 'R') and (tran_id <> nvl(ls_tranid, ' ')) ; return ls_unappr_lev; exception WHEN NO_DATA_FOUND THEN return 0 ; end ; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_MDRCR_RDET BEFORE INSERT OR UPDATE ON misc_drcr_rdet referencing old as old new as new FOR EACH ROW DECLARE ll_glcount number(3) := 0; BEGIN if :new.net_amt is null then :new.net_amt := 0; end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_INV_CLSTK_PAR_LOC ( lsite_code in char, litem_code in char, lloc_code in char, lgetQV in char, ad_from_date in date, lavailable in char, as_excl_loc in char) return number is ld_eff_qty number(14,3); ldt_crea_date date; begin select sum(qty) into ld_eff_qty from (SELECT decode(lgetQV,'Q',sum(a.quantity),sum(a.quantity * a.rate)) qty from stock a, invstat b, location c where a.loc_code = c.loc_code and b.inv_stat = c.inv_stat and nvl(b.stat_type, ' ') <> 'S' and a.site_code = lsite_code and a.item_code = litem_code and instr(lavailable,b.available) > 0 and c.loc_code = lloc_code and c.loc_code not in (as_excl_loc) union all SELECT decode(lgetQV,'Q',sum(nvl(a.eff_qty,0) * -1),sum(nvl(a.eff_qty,0) * -1 * a.rate)) qty from invtrace a, location b, invstat c where a.loc_code = b.loc_code and b.inv_stat = c.inv_stat and nvl(c.stat_type, ' ') <> 'S' and a.item_code = litem_code and a.site_code = lsite_code and a.tran_date > ad_from_date and instr(lavailable,c.available) > 0 and b.loc_code = lloc_code and b.loc_code not in (as_excl_loc)); if ld_eff_qty is null then ld_eff_qty := 0; end if; return (ld_eff_qty); end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GIM_DATE (as_gimno porcp.tran_id%type) return date is ld_gimdate date ; begin select tran_date into ld_gimdate from porcp where tran_id=as_gimno; return(ld_gimdate); end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE INDEX EMPPROM_DATEWISE ON EMPPROMOTION (EMP_CODE, PROM_DATE) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_ADM_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_F16_FILELIST (AS_ACCT_PRD char, AS_EMP_CODE char, AS_PAN_NO char,AS_JBOSS_PATH char) return char is a_cnt number(2); b_cnt number(2); c_cnt number(2); c_fin_ent char(10); d_fin_ent char(10); a_file_name char(1000); begin select count(1) into a_cnt from it_calchdr a,employee b where a.acct_prd = AS_ACCT_PRD and a.emp_code = AS_EMP_CODE and a.emp_code = b.emp_code and b.it_no = AS_PAN_NO; if (a_cnt > 0) then select ';'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\F16\'||trim(AS_EMP_CODE)||'_'||'F16.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\F12BA\' ||trim(AS_EMP_CODE)||'_'||'F12BA.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\TRACES\'||trim(AS_PAN_NO)||'_'||substr(AS_ACCT_PRD,1,4)||'-'||substr(AS_ACCT_PRD,5,2)||'.pdf;' into a_file_name from dual; return a_file_name; end if; select count(1),c.fin_entity,d.fin_entity into b_cnt,c_fin_ent,d_fin_ent from emp_employ_events a,acctprd b,site c,site d where a.emp_code = AS_EMP_CODE and a.trans_type = 'T' and a.eff_date between b.fr_date and b.to_date and a.confirmed = 'Y' and c.site_code = a.site_code__wrk_fr and d.site_code = a.site_code__wrk_to and c.fin_entity <> d.fin_entity and b.code = AS_ACCT_PRD group by c.fin_entity,d.fin_entity; select count(1) into c_cnt from it_calchdr_split a,employee b where a.acct_prd = AS_ACCT_PRD and a.emp_code = b.emp_code and a.emp_code = AS_EMP_CODE and b.it_no = AS_PAN_NO; if (b_cnt > 0 and c_cnt > 0) then select ';'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\F16\' ||trim(AS_EMP_CODE)||'_'||'F16_'||trim(c_fin_ent)||'.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\F16\' ||trim(AS_EMP_CODE)||'_'||'F16_'||trim(d_fin_ent)||'.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\F12BA\' ||trim(AS_EMP_CODE)||'_'||'F12BA_'||trim(c_fin_ent)||'.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\F12BA\'||trim(AS_EMP_CODE)||'_'||'F12BA_'||trim(d_fin_ent)||'.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\TRACES\'||trim(AS_PAN_NO)||'_'||substr(AS_ACCT_PRD,1,4)||'-'||substr(AS_ACCT_PRD,5,2)||'.pdf;'||AS_JBOSS_PATH||'\server\default\deploy\ibase.ear\ibase.war\resource\doc\reports\'||AS_ACCT_PRD||'\TRACES\'||trim(AS_PAN_NO)||'_'||substr(AS_ACCT_PRD,1,4)||'-'||substr(AS_ACCT_PRD,5,2)||'_1.pdf;' into a_file_name from dual; return a_file_name; end if; return a_file_name; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_GET_ENTP_USERS_LICENCE (as_user_type IN CHAR ,as_enterprise IN CHAR ) return char is lic_users number(5); begin SELECT SUM(LIC_USERS) into lic_users from ENTP_USERS_LICENCE where USER_LIC_TYPE = as_user_type AND ENTERPRISE = as_enterprise; return lic_users; end; -- Failed to execute: SQL Statement ==> SQLException ORA-00955: name is already used by an existing object -- CREATE UNIQUE INDEX DR_INVOICE_DETAILS_X ON DR_INVOICE_DETAILS (SALES_PERS, WORK_DATE, INVOICE_NO) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE ITM_DIS_I1 -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TRIGGER DT_CHK_NOART BEFORE INSERT or update ON distord_issdet FOR EACH ROW DECLARE ls_qcreqd item.qc_reqd%type; BEGIN if :new.no_art < 0 or :new.no_art is null then raise_application_error( -20601, 'Number of article cannot be null or negative for line # [' || to_char(:new.line_no) ||']' ); end if; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION FN_FILTER_TEMPEMP ( ls_emp_type char ) Return Number Is li_cnt Number(1); begin li_cnt := 0; select count(1) into li_cnt from gencodes where fld_name = 'EMP_TYPE' and mod_name = 'W_EMP_TYPE' and fld_value = ls_emp_type; return li_cnt; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE TYPE CCTRMASTERTABLE AS TABLE OF cctrMaster; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_TOTAL_TAX_AMOUNT (MTAX_CODE CHAR) RETURN NUMBER IS MTAX NUMBER; BEGIN IF MTAX_CODE = 'CGST' THEN MTAX :='14'; elsif MTAX_CODE = 'SGST' THEN MTAX :='14'; elsif MTAX_CODE = 'IGST' THEN MTAX :='28'; END IF; RETURN MTAX; exception when no_data_found then return 0; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_SITEREGNO (as_site_code siteregno.site_code%type, as_ref_code siteregno.ref_code%type) return varchar is mreg_no siteregno.reg_no%type; begin begin select reg_no into mreg_no from siteregno where site_code = as_site_code and ref_code=as_ref_code; exception when others then mreg_no := ''; end; if mreg_no is null or length(trim(mreg_no)) = 0 then mreg_no :='UNREG'; end if ; return mreg_no; end; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_PALLET_ID_LINE_NO (AS_ORDER PICK_ISS_DET.PICK_ORDER%TYPE, AS_LINE_NO PICK_ISS_DET.LINE_NO__ORD%TYPE, AS_PICK_TYPE CHAR, AS_RET_VAL CHAR) RETURN CHAR IS AS_LOC_CODE__TO PICK_ISS_DET.LOC_CODE__TO%TYPE ; AS_PALLET_NO PICK_ISS_HDR.PALLET_NO%TYPE ; BEGIN IF AS_PICK_TYPE = 'P' THEN SELECT PICK_ISS_DET.LOC_CODE__TO, PICK_ISS_HDR.PALLET_NO INTO AS_LOC_CODE__TO, AS_PALLET_NO FROM PICK_ISS_DET, PICK_ISS_HDR WHERE PICK_ISS_DET.PICK_ORDER = AS_ORDER AND PICK_ISS_DET.LINE_NO__ORD = AS_LINE_NO AND PICK_ISS_DET.TRAN_ID = PICK_ISS_HDR.TRAN_ID AND PICK_ISS_HDR.PALLET_NO IS NOT NULL AND LENGTH(PICK_ISS_HDR.PALLET_NO) > 0; ELSE SELECT REPL_ISS_DET.LOC_CODE__TO, REPL_ISS_HDR.CARTON_NO INTO AS_LOC_CODE__TO, AS_PALLET_NO FROM REPL_ISS_DET, REPL_ISS_HDR WHERE REPL_ISS_DET.REPL_ORDER = AS_ORDER AND REPL_ISS_DET.LINE_NO__ORD = AS_LINE_NO AND REPL_ISS_DET.TRAN_ID = REPL_ISS_HDR.TRAN_ID AND REPL_ISS_HDR.CARTON_NO IS NOT NULL AND LENGTH(REPL_ISS_HDR.CARTON_NO) > 0; END IF; IF AS_RET_VAL = 'P' THEN RETURN AS_PALLET_NO ; ELSE RETURN AS_LOC_CODE__TO ; END IF; END; -- Failed to execute: SQL Statement ==> SQLException ORA-38824: A CREATE OR REPLACE command may not change the EDITIONABLE property of an existing object. -- CREATE OR REPLACE FUNCTION DDF_GET_EMP_WISE_HIERARCHY ( AS_DIV CHAR, AS_USER_CODE CHAR ) RETURN TBL_EMPLOYEE_WISE_HIERARCHY AS V_OBJ_EMP_WISE_HIARCHY TBL_EMPLOYEE_WISE_HIERARCHY; AS_BHR EXCEPTION; BEGIN WITH EMP AS (SELECT ITEMSER.SH_DESCR DIV , SALES_PERS.ITEM_SER , EMPLOYEE.EMP_CODE , GET_EMPLOYEE_NAME(EMPLOYEE.EMP_CODE) as SO_NAME , EMPLOYEE.GRADE , EMPLOYEE.DATE_JOIN AS DOJ , DDF_GET_STATION_DESCR(EMPLOYEE.EMP_CODE) AS HQ , EMPLOYEE.REPORT_TO FROM EMPLOYEE, SALES_PERS, ITEMSER WHERE EMPLOYEE.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and -- EMPLOYEE.WITH_HELD = 'N' -- AND EMPLOYEE.RELIEVE_DATE IS NULL AND SALES_PERS.SALES_PERS = EMPLOYEE.EMP_CODE AND ITEMSER.ITEM_SER = SALES_PERS.ITEM_SER AND SALES_PERS.ITEM_SER = AS_DIV AND EMPLOYEE.EMP_CODE IN (SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.CODE FROM USERS B WHERE B.CODE = AS_USER_CODE AND B.ACC_PARM1 = 'HIERARCHY' ) START WITH A.EMP_CODE = AS_USER_CODE CONNECT BY PRIOR A.EMP_CODE = A.REPORT_TO UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.CODE FROM USERS B WHERE B.CODE = AS_USER_CODE AND B.ACC_PARM1 = 'ALL' ) UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.CODE FROM USERS B, SALES_PERS C WHERE C.SALES_PERS = A.EMP_CODE AND B.CODE = AS_USER_CODE AND B.ACC_PARM1 != 'HIERARCHY' AND B.ACC_PARM1 != 'ALL' AND B.ACC_PARM1 IS NOT NULL AND INSTR(',' ||TRIM(B.ACC_PARM1) ||',',',' ||TRIM(C.ITEM_SER) ||',') > 0 ) UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.EMP_CODE FROM USERS B WHERE B.EMP_CODE = AS_USER_CODE AND B.ACC_PARM1 = 'HIERARCHY' ) START WITH A.EMP_CODE = AS_USER_CODE CONNECT BY PRIOR A.EMP_CODE = A.REPORT_TO UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.EMP_CODE FROM USERS B WHERE B.EMP_CODE = AS_USER_CODE AND B.ACC_PARM1 = 'ALL' ) UNION ALL SELECT A.EMP_CODE FROM EMPLOYEE A WHERE A.EMP_SITE IN (SELECT SITE_CODE FROM SITE WHERE SITE_TYPE = 'Y' ) and EXISTS (SELECT B.EMP_CODE FROM USERS B, SALES_PERS C WHERE C.SALES_PERS = A.EMP_CODE AND B.EMP_CODE = AS_USER_CODE AND B.ACC_PARM1 != 'HIERARCHY' AND B.ACC_PARM1 != 'ALL' AND B.ACC_PARM1 IS NOT NULL AND INSTR(',' ||TRIM(B.ACC_PARM1) ||',',',' ||TRIM(C.ITEM_SER) ||',') > 0 ) ) AND 'N' = (SELECT ( CASE WHEN L.WITH_HELD = 'Y' OR L.RELIEVE_DATE IS NOT NULL OR L.RESI_DATE IS NOT NULL THEN 'Y' ELSE 'N' END) FROM EMPLOYEE L WHERE L.EMP_CODE = (select EMP_CODE from users where code = AS_USER_CODE) ) ) SELECT OBJ_EMPLOYEE_WISE_HIERARCHY(A.DIV , A.TLM_HQ , A.SLM_HQ , A.FLM_HQ , A.SO_HQ , A.SO_DESG_CODE, A.EMP_CODE, A.DATE_JOIN, A.ISR_NAME, A.TLM_CODE, A.SLM_CODE , A.FLM_CODE ) BULK COLLECT INTO V_OBJ_EMP_WISE_HIARCHY FROM ( SELECT EMP.DIV , ( CASE WHEN EMP.GRADE IN ('1') THEN DDF_GET_STATION_DESCR(EMP.EMP_CODE) WHEN FLM.GRADE IN ('1') THEN DDF_GET_STATION_DESCR(FLM.EMP_CODE) WHEN SLM.GRADE IN ('1') THEN DDF_GET_STATION_DESCR(SLM.EMP_CODE) WHEN TLM.GRADE IN ('1') THEN DDF_GET_STATION_DESCR(TLM.EMP_CODE) ELSE 'V A C A N T' END) AS TLM_HQ , ( CASE WHEN EMP.GRADE IN ('6') THEN DDF_GET_STATION_DESCR(EMP.EMP_CODE) WHEN FLM.GRADE IN ('6') THEN DDF_GET_STATION_DESCR(FLM.EMP_CODE) WHEN SLM.GRADE IN ('6') THEN DDF_GET_STATION_DESCR(SLM.EMP_CODE) WHEN TLM.GRADE IN ('6') THEN DDF_GET_STATION_DESCR(TLM.EMP_CODE) ELSE 'V A C A N T' END) AS SLM_HQ , ( CASE WHEN EMP.GRADE IN ('VII') THEN DDF_GET_STATION_DESCR(EMP.EMP_CODE) WHEN FLM.GRADE IN ('VII') THEN DDF_GET_STATION_DESCR(FLM.EMP_CODE) WHEN SLM.GRADE IN ('VII') THEN DDF_GET_STATION_DESCR(SLM.EMP_CODE) WHEN TLM.GRADE IN ('VII') THEN DDF_GET_STATION_DESCR(TLM.EMP_CODE) ELSE 'V A C A N T' END) AS FLM_HQ , EMP.HQ as SO_HQ, DDF_SMKT_GEN_DET( EMP.EMP_CODE,NULL,NULL,NULL,'DESG') AS SO_DESG_CODE , (CASE WHEN EMP.GRADE IN ('4') THEN EMP.EMP_CODE ELSE '' END) AS EMP_CODE , EMP.DOJ AS DATE_JOIN, ( CASE WHEN EMP.GRADE IN ('4') THEN EMP.SO_NAME ELSE '' END) AS ISR_NAME , ( CASE WHEN EMP.GRADE IN ('1') THEN EMP.EMP_CODE WHEN FLM.GRADE IN ('1') THEN FLM.EMP_CODE WHEN SLM.GRADE IN ('1') THEN SLM.EMP_CODE WHEN TLM.GRADE IN ('1') THEN TLM.EMP_CODE ELSE 'VC0001' END) AS TLM_CODE , ( CASE WHEN EMP.GRADE IN ('6') THEN EMP.EMP_CODE WHEN FLM.GRADE IN ('6') THEN FLM.EMP_CODE WHEN SLM.GRADE IN ('6') THEN SLM.EMP_CODE WHEN TLM.GRADE IN ('6') THEN TLM.EMP_CODE ELSE 'VC0001' END) AS SLM_CODE , ( CASE WHEN EMP.GRADE IN ('VII') THEN EMP.EMP_CODE WHEN FLM.GRADE IN ('VII') THEN FLM.EMP_CODE WHEN SLM.GRADE IN ('VII') THEN SLM.EMP_CODE WHEN TLM.GRADE IN ('VII') THEN TLM.EMP_CODE ELSE 'VC0001' END) AS FLM_CODE FROM EMP , EMPLOYEE FLM, EMPLOYEE SLM, EMPLOYEE TLM WHERE FLM.EMP_CODE = EMP.REPORT_TO AND FLM.REPORT_TO = SLM.EMP_CODE AND SLM.REPORT_TO = TLM.EMP_CODE AND EMP.GRADE IN ('4') ) A; RETURN V_OBJ_EMP_WISE_HIARCHY; RAISE AS_BHR; EXCEPTION WHEN AS_BHR THEN RETURN NULL; end; -- No of Rows = 3219