&(ampersand) in the query for catsearch
I get an error in the catsearch below when Name variable contains an ampersand (&). Any suggestions.
FUNCTION NameDob (iFirst IN VARCHAR2,
iMiddle IN VARCHAR2,
iLast IN VARCHAR2,
iDobYMD IN VARCHAR2) -- CCYYMMDD)
RETURN QueryCurType
AS
c QueryCurType;
Name varchar2(100);
BEGIN
Name := iFirst||' '||iLast;
OPEN c FOR
SELECT *
FROM MASTER_TRACKEE
WHERE catsearch(full_name,Name,NULL) > 0;
RETURN c;
END NameDob;
In SQL, "&" is a reserved character.
Issue
SET DEFINE OFF
before entering your statement.
Similar Messages
-
Hi Guys,
What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10?
I have to write an AP Invoice Aging Report in Discoverer to show all unpaid invoices that have been transferred into GL... Business wants it to match one-to-one with the AP Trial Balance standard report...
Business wants to run the report for any date in a past...
The report has two parameters:
As Of Date - the same as As of Date for the AP Trial Report
Trial Balance Run Date - the date when Trial Balance was run...
Conditions are:
TRUNC(Invoice Date) <=TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
TRUNC(NVL(Payment Date,'01-JAN-5000')) > TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
TRUNC(Invoice Creation Date) <= TRUNC(NVL(TO_DATE(:Trial Balance Run Date),SYSDATE))
Distr Accounting Date <= TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
NVL(Distr Creation Date,Invoice Creation Date) <= TRUNC(NVL(TO_DATE(:Trial Balance Run Date),SYSDATE))
Show_Flag = 'YES', where:
Show_Flag = CASE WHEN ( NVL(Cancelled Date,'01-JAN-1901') > NVL(:As Of Date,SYSDATE) AND NVL(Inv Amount Aud,0) = 0 ) THEN 'YES' ELSE ( CASE WHEN NVL(Inv Amount Aud,0) = 0 THEN 'NO' ELSE 'YES' END ) END
There is a difference between the logic of my report, and the logic of AP Trial Balance...
Could you please advise what I'm missing?
Thanks,
IanaWhat is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10? You can get the code by opening the report in Reports Builder and get the query.
Or, enable trace/debug as per (FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]).
Thanks,
Hussein -
Issue While executing the Query for Pagination using ROWNUM with like
Issue While executing the Query for Pagination using ROWNUM with like.
Database is Oracle11G.
Oracle Database Table contains 8-9 lakh records
1) SQL equal (=)
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE A.REFERENCE = 'KMF22600920'
Execution Time:- 0.00869245 seconds
Returns 2 resultsets
2) SQL like (one %)
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE A.REFERENCE = 'KMF22600920%'
Execution Time:- 0.01094301 seconds
Returns 2 resultsets
3) SQL like (two%)
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE A.REFERENCE like '%KMF22600920%'
Execution Time:- 6.43989658 seconds
Returns 2 resultsets
In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
4) SELECT * FROM (
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
Execution Time:- Infinite
ResultSets:- No as execution time is infinite
a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
Could you please let us know what is the issue with two % used in like and rownum
5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
SELECT * FROM (
SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
Execution Time:- 7.41368914 seconds
Returns 2 resultsets
Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.
-
Can anyone share the query for inventory aging report
Is there any standard reports for inventory aging in oracle ebs 12.1.3 ....... If not can anyone share the query for inventory aging report
Hi,
It may not be so simple as you are trying to reproduce the historical value. I believe you have to create a temporary table first. Or you may use Command feather to get the required data in advance.
Thanks,
Gordon -
What will be the query for the below stated problem..??
Dear Sir
I want that in Incoming payment after selecting a Customer when we right click and select payment means under checks tab the bank details of that customer should be there i.e. According to Bank Code its Branch and Account no be shown with the help of a query. If anyone knows the query for this please let me know...Hello jyotasna ,
Let me try explain
SAP Process :-
When you make incoming payment with Cheque or bank then this is not complete sale cycle.
Bank Offset Account Debit
Customer Account Credit
You should make deposit(Banking>Incoming Payment>Deposit) for which you have made incoming payment.and here we put all info for bank account
Bank Account Debit
Bank Offset account Credit
Why :-
Suppose your client said that he deposit your cheque in bank in this date but due same bake issue or cheque issue the same cheque deposited in next day.
In this senario if i made this entry in SAP then we need to modify it based on Bank Reconciliation Statement(BRS)
We also have bank reconciliation set for same
Is there any confusion ?
Thanks
Manvendra Singh Niranjan
Edited by: Manvendra Singh Niranjan on Jul 13, 2011 1:10 PM -
Need to install only the query for fi account receivables standard data ?
Hi all,
I need to insall only the query for the standard business content for fi_ar in bw 3.5 ?
i have selected the cube and then in grouping i have selected data flow afterwards only.
And i have selected the queries only. but the cube is selected again. Should i uncheck the cube and install only the queries and transport it?
Pls guide me on this!!
Thanks
PoojaHi,
If the required cube is already avaialble and continue with the existing design, you can uncheck the cube and install only queries. Check all the prerequisites before installing queries like used infoobjects, other targets if any.
Hope this helps,
Regards,
Rama Murthy. -
Pls help me to modify the query for performance improvement
Hi,
I have the below initialization
DECLARE @Active bit =1 ;
Declare @id int
SELECT @Active=CASE WHEN id=@id and [Rank] ='Good' then 0 else 1 END FROM dbo.Students
I have to change this query in such a way that the conditions id=@id and [Rank] ='Good' should go to the where condition of the query. In that case, how can i use Case statement to retrieve 1 or 0? Can you please help me to modify this initialization?I dont understand your query...May be below? or provide us sample data and your output...
SELECT * FROM dbo.students
where @Active=CASE
WHEN id=@id and rank ='Good' then 0 else 1 END
But, I doubt you will have performance improvement here?
Do you have index on id?
If you are looking for getting the data for @ID with rank ='Good' then use the below:Make sure, you have index on id,rank combination.
SELECT * FROM dbo.students
where id=@id
and rank ='Good' -
View and the query for the view giving different datasets
I have a view created with the below syntax.
CREATE OR REPLACE FORCE VIEW vw_name (/*column names*/ )
AS SELECT /*column names*/ from tables
When I execute the query with which the view is constructed , I m getting different data set which contains 4690 rows
and when I exeute the view I m getting dataset which contains only 4657 rows.
Can you please explain why the differnce in count when the source for both is the same.Can you please explain why the differnce in count when the source for both is the same.Answer should be one of the following
1. The two query are not same
2. The table data has been modified
3. You are seeing at the wrong thing (manual error) -
Performance of the query for YTD info
Hi Experts,
I have a query it takes more time when you run that query for period or year. Like selection ceritaria is few days info work quick. But when it run for period it take more then 10 minutes.
Give me suggestions how to speed up the query
ThanksBuild aggregates. Goto RSRT, execute and debug, switch on statistics and display aggregates checkbox. See whether an aggregate is hit or why not and build aggregates accordingly.
Also look at statsitcs if database is performance killer see events 9000ff for this.
Other hints: reduce start level of your query and remove some chracteristics if possible.
Regards,
Juergen -
Tunning the query for faster record retrieval
Hi,
I am back, now this time I donot really know in which forum I should post this query, in XML or in Oracle Developers ?
Anyway...
The problem is :
I have a database with millions of record in that, I give a query based on some 4/5 parameters, and retrieve the records corresponding to that, I have added indexes in the database for faster retrieval of the same, but since the no of records returned is quite high and I planned to put a prev and next link to show only 10 records at a time, I had to get the count(*) of the number of records that match, here is the problem, since there are so many records, and count(*) doesn't consider index, it takes nearly 20-30 seconds for the retrieved list to be seen on the browser window, if I just remove that count(*), the retrieval is quite fast, but then there is no prev and next as I had linked them to count(*).
Could some one please let me know the proper way of doing it. I am a newbie to this and I have been doing some trial and error to get my work done.
Thanks in advance,
Regards,
Shanthi RajaramMake sure to select the COUNT() of an indexed column (the more selective the index the better), this way the optimizer can satisfy the count query with a few IO's of the index blocks instead of a full-table scan.
-
How to display language key (0LANGU) in the query for BW report
Hi,
Can someone tell me how to display language key (0LANGU) in the query? I want to display which language (English or French) is used for material description in BW report. Thx.hi,
check if the infoobject is kept as lang dependent or not for material text, else you need to create a masterdata attribute with text and lang keys and do corresponding mapping, so then it can be displayed in your report
regards
laksh -
How to execute the query for a block based on the parameter
Hi All,
Good evening.
i have requirement where i need to display the data in one block based on the selected items.
the scenario is like this...there are 2 LOV's and one apply button and one external region on the form.
so when u select the lov values and click on apply button the query should execute based on this 2 lov values.
i am not getting how to achieve this..i am very new to oracle forms..
Please Help..
Thanks
Bharat
please help..it is urgent..
thanks
bharat
Edited by: Bharat on Jan 31, 2012 5:19 AMBharat wrote:
Hi All,
Good evening.
i have requirement where i need to display the data in one block based on the selected items.
the scenario is like this...there are 2 LOV's and one apply button and one external region on the form.
so when u select the lov values and click on apply button the query should execute based on this 2 lov values.
i am not getting how to achieve this..i am very new to oracle forms..Another way you can do this. Create a lov and don't assign it to any column just one return item (should be id).
Now create a button may be your "apply button" write two trigger when-button-press and when-mouse-click.
at When -Button-Press trigger, change the block state to 'ENTER-QUERY' and at when-mouse-click show the LOV and then write execute_query.
Hope this will help you.
If someone's response is helpful or correct, please mark it accordingly. -
How to tune the query for duplicate records while joining the two tables
hi,i am executing the query which has retrieving multiple tables,in which one of them has duplicate record,how to get single record
Not enough info...subject says "tune" the query, message says "write" the query...and where is actual query that you had tried ?
-
Identify the query for the sid
I would like to caputure the query running by the sid 190
Please provide me any query to capture the querySELECT T.SQL_TEXT
FROM V$SQLTEXT T, V$SESSION S
WHERE S.SID = 190
AND S.SQL_ADDRESS = T.ADDRESS
ORDER BY T.PIECE; -
Need help in fixing the query for performance reasons
hi
I have a view in which I am calling a function to return some values I wand to get rid of the function and want to some how do all in the sql. Can I use case or something similar that will help me in avoiding the use of this function. Any help in this regard will highly be appreciated.
Query
SELECT SUBSTR(f_type_px17(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
from
px17_appointment ap,
/*context co_ap,*/
px17_payrollagreement pa,
px17_payrollgroup pg;
FUNCTION
CREATE OR REPLACE FUNCTION f_type_px17
fv_cidn IN px17_type_client.cidn%TYPE,
fv_oid IN px17_type_client.oid%TYPE,
fv_col IN VARCHAR2 DEFAULT NULL
) RETURN VARCHAR2 AUTHID CURRENT_USER AS
v_rtn_name px17_type_client.name%TYPE := NULL ;
v_rtn_desc px17_type_client.description%TYPE := NULL ;
BEGIN
IF fv_oid IS NOT NULL THEN
BEGIN
IF UPPER(SUBSTR(fv_oid,1,3)) = 'SYS' THEN
SELECT name, description
INTO v_rtn_name, v_rtn_desc
FROM px17_sys_type
WHERE oid = fv_oid
AND ROWNUM = 1 ;
ELSE
SELECT name, description
INTO v_rtn_name, v_rtn_desc
FROM px17_type_client
WHERE oid = fv_oid
AND cidn = fv_cidn
AND ROWNUM = 1 ;
END IF ;
EXCEPTION
WHEN no_data_found THEN
v_rtn_name := NULL ;
v_rtn_desc := NULL ;
END ;
END IF ;
IF (UPPER(NVL(fv_col, '~')) = 'NAME') THEN
RETURN v_rtn_name ;
ELSIF ((UPPER(NVL(fv_col, '~')) = 'DESC')
OR (UPPER(NVL(fv_col, '~')) = 'DESCRIPTION')) THEN
RETURN v_rtn_desc ;
ELSE
RETURN (NVL(v_rtn_name, CHR(155)) || '~' || NVL(v_rtn_desc, CHR(155))) ;
END IF ;
END f_type_px17 ;
/Well following is the whole code of a view and the functions releated, This will give you the whole picture and this query is running for long time.
create or replace view PX17_CHK_VW_SUMMARY_VW
(CIDN,BATCH_NUMBER, BUSINESS_UNIT, CHECK_VOUCHER_NUMBER, CHECK_VOUCHER_CODE, CHECKVIEW_CLOCK_NUMBER,
COMPANY_CHECKVIEW_HOME_DEPT, PERIOD_END_DATE, FEDERAL_TAX, GROSS_PAY, HOME_DEPARTMENT,
HOME_DEPARTMENT_DESC, LIVED_LOCAL_TAX_CODE, LIVED_STATE_TAX_CODE, LIVED_LOCAL_TAX, LIVED_STATE_TAX,
MEDICARE_TAX, NET_PAY, DEPARTMENT_WORKED_IN, PAY_TO_COMPANY_INDICATOR, PAY_DATE,
PAYROLL_NUMBER, SCHOOL_DISTRICT_TAX, CHECKVIEW_SCHOOL_DISTRICT, SOCIAL_SECURITY_TAX, SUI_SDI_TAX,
SUI_SDI_TAX_CODE, VOID_CHECK_INDICATOR, WEEK_NUMBER, WORKED_LOCAL_TAX_CODE, WORKED_STATE_TAX_CODE,
WORKED_LOCAL_TAX, WORKED_STATE_TAX, YEAR, COMPANY_CODE, FILE_NUMBER,
FIRST_NAME, LAST_NAME, LAST_NAME_FIRST_NAME, SOCIAL_SECURITY_NUMBER, STATUS,
OVERTIME_EARNINGS, OVERTIME_HOURS, REGULAR_EARNINGS, REGULAR_HOURS, VIEWPK,
HOME_COST_NUMBER, TAX_FREQUENCY, COMPANY_COST_NUMBER, COST_NUMBER_WORKED_IN, DISTRIBUTION_NUMBER,
TOTAL_DEDUCTIONS_AMOUNT, TOTAL_HOURS_AMOUNT, TOTAL_MEMO_AMOUNT, TOTAL_OTHER_EARNINGS, TOTAL_OTHER_HOURS,
CHECK_SEQ_NO, JOINKEY, CHECK_REVERSAL_INDICATOR
as
with user_security_homedept
AS
(select /*+ INLINE */ distinct cg.cidn,co_code,asso.oid,asso.name,department_Access ,t2.column_value dep,cg.oid
from px17_cocodegroup cg ,
px17_associate asso ,
px17_securityobject so,
px17_cocodegrp_securitygrp cs,
px17_security_group sg ,
TABLE(f_str2tbl_px17(cg.department_access)) t2
where cg.USEROID = asso.OID
and cg.co_code = substr(so.name,8,3)
and upper(asso.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
and cg.oid = cs.cocodegroupoid
and cs.securitygroupoid = sg.oid
and cg.cidn = asso.cidn
and cg.cidn = so.cidn
and cg.cidn = cs.cidn
and cs.cidn = sg.cidn
order by 2,1
user_security_cost_no
AS
(select /*+ INLINE */
cg.cidn,co_code,count(distinct cd.code)cost_no,cd.code
from px17_cocodegroup cg ,
px17_associate asso ,
px17_securityobject so,
px17_cocodegrp_securitygrp cs,
px17_security_group sg ,
px17_customaccessdetail cd
where cg.USEROID = asso.OID
and cg.co_code = substr(so.name,8,3)
and upper(asso.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
and cg.oid = cs.cocodegroupoid
and cs.securitygroupoid = sg.oid
and cg.oid = cd.cocodegroupoid(+)
and cg.cidn = cd.cidn(+)
and cg.cidn = asso.cidn
and cg.cidn = so.cidn
and cg.cidn = cs.cidn
and cs.cidn = sg.cidn
group by cg.cidn,co_code,cd.code
order by 2,1
super_user_check as
(SELECT
distinct a.cidn su_cidn,1 as su_user
FROM
px17_LINK LN
, px17_userprofile up
, px17_ASSOCIATE a
, px17_pcp_user pu
WHERE
a.oid = pu.oid
AND pu.userprofileoid = up.oid
AND LN.parentoid = up.oid
AND a.active = 1
AND a.cidn=pu.cidn
AND pu.cidn=up.cidn
AND ln.cidn=up.cidn
AND upper(a.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
AND upper(up.name) = upper('Super user')
nonsuper_user_check as
SELECT distinct a.cidn s_cidn , 1 as non_user
FROM
px17_LINK LN
, px17_userprofile up
, px17_ASSOCIATE a
, px17_pcp_user pu
WHERE
a.oid = pu.oid
AND pu.userprofileoid = up.oid
AND LN.parentoid = up.oid
AND a.active = 1
AND a.cidn=pu.cidn
AND pu.cidn=up.cidn
AND ln.cidn=up.cidn
AND upper(a.name) = upper(sys_context('payx_r17_app_context', 'app_userid'))
AND LN.childoid IN ( 'SYS:5:7478')
SELECT distinct
cidn
,batch_number Batch_Number
, business_unit Business_Unit
, check_voucher_number Check_Voucher_Number
, check_voucher_code Check_Voucher_Code
, clock_number CheckView_Clock_Number
, company_code_or_dept Company_CheckView_Home_Dept
, period_end_date Period_End_Date
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, 1, (INSTR(taxes_and_rates, '~', 1, 1) -1)), CHR(155), NULL)) Federal_Tax
, gross_pay Gross_Pay
, home_department Home_Department
, home_department_descr Home_Department_Desc
, SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 1) +1)
, INSTR(taxes_and_rates, '~', 1, 2) - (INSTR(taxes_and_rates, '~', 1, 1) +1)), CHR(155), NULL), 1, 32) Lived_Local_Tax_Code
, SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 2) +1)
, INSTR(taxes_and_rates, '~', 1, 3) - (INSTR(taxes_and_rates, '~', 1, 2) +1)), CHR(155), NULL), 1, 32) Lived_State_Tax_Code
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 3) +1)
, INSTR(taxes_and_rates, '~', 1, 4) - (INSTR(taxes_and_rates, '~', 1, 3) +1)), CHR(155), NULL)) Lived_Local_Tax
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 4) +1)
, INSTR(taxes_and_rates, '~', 1, 5) - (INSTR(taxes_and_rates, '~', 1, 4) +1)), CHR(155), NULL)) Lived_State_Tax
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 5) +1)
, INSTR(taxes_and_rates, '~', 1, 6) - (INSTR(taxes_and_rates, '~', 1, 5) +1)), CHR(155), NULL)) Medicare_Tax
, net_pay Net_Pay
, department_paid Department_Worked_In
, to_pay_indicator Pay_to_Company_Indicator
, pay_date Pay_Date
, payroll_number Payroll_Number
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 6) +1)
, INSTR(taxes_and_rates, '~', 1, 7) - (INSTR(taxes_and_rates, '~', 1, 6) +1)), CHR(155), NULL)) School_District_Tax
, SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 7) +1)
, INSTR(taxes_and_rates, '~', 1, 8) - (INSTR(taxes_and_rates, '~', 1, 7) +1)), CHR(155), NULL), 1, 32) CheckView_School_District
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 8) +1)
, INSTR(taxes_and_rates, '~', 1, 9) - (INSTR(taxes_and_rates, '~', 1, 8) +1)), CHR(155), NULL)) Social_Security_Tax
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 9) +1)
, INSTR(taxes_and_rates, '~', 1, 10) - (INSTR(taxes_and_rates, '~', 1, 9) +1)), CHR(155), NULL)) SUI_SDI_Tax
, SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 10) +1)
, INSTR(taxes_and_rates, '~', 1, 11) - (INSTR(taxes_and_rates, '~', 1, 10) +1)), CHR(155), NULL), 1, 32) SUI_SDI_Tax_Code
, void_check_indicator Void_Check_Indicator
, week_number Week_Number
, SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 11) +1)
, INSTR(taxes_and_rates, '~', 1, 12) - (INSTR(taxes_and_rates, '~', 1, 11) +1)), CHR(155), NULL), 1, 32) Worked_Local_Tax_Code
, SUBSTR(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 12) +1)
, INSTR(taxes_and_rates, '~', 1, 13) - (INSTR(taxes_and_rates, '~', 1, 12) +1)), CHR(155), NULL), 1, 32) Worked_State_Tax_Code
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 13) +1)
, INSTR(taxes_and_rates, '~', 1, 14) - (INSTR(taxes_and_rates, '~', 1, 13) +1)), CHR(155), NULL)) Worked_Local_Tax
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 14) +1)
, INSTR(taxes_and_rates, '~', 1, 15) - (INSTR(taxes_and_rates, '~', 1, 14) +1)), CHR(155), NULL)) Worked_State_Tax
, year Year
, company_code Company_Code
, file_number File_Number
, first_name First_Name
, last_name Last_Name
, name Last_Name_First_Name
, ssn Social_Security_Number
, status Status
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 15) +1)
, INSTR(taxes_and_rates, '~', 1, 16) - (INSTR(taxes_and_rates, '~', 1, 15) +1)), CHR(155), NULL)) Overtime_Earnings
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 16) +1)
, INSTR(taxes_and_rates, '~', 1, 17) - (INSTR(taxes_and_rates, '~', 1, 16) +1)), CHR(155), NULL)) Overtime_Hours
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 17) +1)
, INSTR(taxes_and_rates, '~', 1, 18) - (INSTR(taxes_and_rates, '~', 1, 17) +1)), CHR(155), NULL)) Regular_Earnings
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 18) +1)
, INSTR(taxes_and_rates, '~', 1, 19) - (INSTR(taxes_and_rates, '~', 1, 18) +1)), CHR(155), NULL)) Regular_Hours
, (company_code || '/' || ssn || '/' || file_number || '/' || TO_CHAR(payroll_number) || '/'
|| TO_CHAR(year) || '/' || TO_CHAR(week_number) || '/' || check_voucher_number
|| '/' || to_char(check_seq_num) || '/' || TO_CHAR(distribution_number)) Viewpk
, home_costnumber_desc Home_Cost_Number
, tax_frequency Tax_Frequency
, co_chkv_home_cost_no Company_Cost_Number
, cost_no_worked_in Cost_Number_Worked_In
, distribution_number Distribution_Number
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 19) +1)
, INSTR(taxes_and_rates, '~', 1, 20) - (INSTR(taxes_and_rates, '~', 1, 19) +1)), CHR(155), NULL)) Total_Deductions_Amount
, NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 20) +1)
, INSTR(taxes_and_rates, '~', 1, 21) - (INSTR(taxes_and_rates, '~', 1, 20) +1)), CHR(155), NULL)), 0) Total_Hours_Amount
, NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 21) +1)
, INSTR(taxes_and_rates, '~', 1, 22) - (INSTR(taxes_and_rates, '~', 1, 21) +1)), CHR(155), NULL)), 0) Total_Memo_Amount
, NVL(TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 22) +1)
, INSTR(taxes_and_rates, '~', 1, 23) - (INSTR(taxes_and_rates, '~', 1, 22) +1)), CHR(155), NULL)), 0) Total_Other_Earnings
, TO_NUMBER(REPLACE(SUBSTR(taxes_and_rates, (INSTR(taxes_and_rates, '~', 1, 23) +1)), CHR(155), NULL)) Total_Other_Hours
, check_seq_num Check_Seq_No
, (NVL(company_code, '~') || CHR(155) || NVL(file_number, '~') || CHR(155) || NVL(ssn, '~') || CHR(155) || NVL(TO_CHAR(year), '~') || CHR(155)
|| NVL(TO_CHAR(week_number), '~') || CHR(155) || NVL(TO_CHAR(payroll_number), '~')
|| CHR(155) || NVL(check_voucher_number, '~') || CHR(155) || NVL(TO_CHAR(check_seq_num), '~') || CHR(155) || NVL(TO_CHAR(distribution_number), '~')) Joinkey
, chk_reverse Check_Reversal_Indicator
FROM
SELECT
ch.cidn cidn
/*BATCH NUMBER*/
, ch.batch_nb batch_number
, /*BUSINESS UNIT*/
(select asso.description
from px17_appointment ap,
px17_jobposition jp,
px17_corporation co,
px17_associate asso,
px17_payrollagreement pa,
px17_payrollgroup pg
where
ch.cidn = pg.cidn
AND ch.cidn = pa.cidn
AND pa.cidn = pg.cidn
AND pa.cidn = ap.cidn
AND em.cidn = ap.cidn
AND ap.cidn = jp.cidn
and jp.cidn = co.cidn
and co.cidn = asso.cidn
and ch.co_code=pg.co_code
and ch.file_nb=pa.file_number
and pa.cocodeoid=pg.oid
and pa.appointmentoid=ap.oid
and em.oid=ap.employmentoid
and ap.jobpositionoid=jp.oid
and jp.corporationoid=co.oid
and co.oid=asso.oid) business_unit
, /*CHECK/VOUCHER NUMBER*/
ch.check_nb check_voucher_number
, /*CHECK/VOUCHER CODE*/
SUBSTR(f_type_px17(ch.cidn,ch.chkvchcodeoid, 'NAME'), 1, 255) check_voucher_code
, /*CLOCK NUMBER*/
ch.clock_id clock_number
, /* COMPANY CODE OR DEPT*/
ch.co_code||'/'||substr(ch.home_dept_code,1,20) company_code_or_dept
, /*PERIOD END DATE*/
ch.payroll_ending_date period_end_date
, /*GROSS PAY*/
NVL(chd.gross_pay_amt,0) gross_pay
, /*HOME DEPARTMENT*/
ch.home_dept_code home_department
, /*HOME DEPARTMENT DESCRIPTION*/
(select ty.description
from px17_type ty,px17_securityobject sc
where
ch.cidn = sc.cidn
and ty.cidn in ('COMMON', ch.cidn)
and ch.home_dept_code=ty.name
and ty.category='T_CO_DEPT'
and ty.securityoid=sc.oid
and ch.co_code=substr(sc.name,8)) home_department_descr
, /*NET PAY*/
nvl(chd.net_pay_amt,0) net_pay
, /*DEPARTMENT PAID*/
-- ch.paid_in_debt_code department_paid
chd.worked_in_dept department_paid
, /*TO PAY INDICATOR*/
decode(to_char(ch.pay_to_co),'1','Y','0','N',to_char(ch.pay_to_co)) to_pay_indicator
, /*PAY DATE*/
ch.pay_date pay_date
, /*PAYROLL NUMBER*/
to_char(ch.payroll_nb) payroll_number
, /*VOID CHECK INDICATOR*/
decode(to_char(ch.void_flag),'1','Y','0','N',to_char(ch.void_flag)) void_check_indicator
, /*WEEK NUMBER*/
TO_number(ch.week) week_number
, /*YEAR*/
to_char(ch.year) year
, /*COMPANY CODE*/
ch.co_code company_code
, /*FILE NUMBER*/
LPAD(ch.file_nb,6,0) file_number
, /*FIRST NAME*/
pe.first_name first_name
, /*LAST NAME*/
pe.last_name last_name
, /*NAME*/
pe.last_name||', '||pe.first_name name
, /*SSN*/
payx_r17_principal_info.masked_ssn(pe.unique_id, ch.cidn) ssn
, /*STATUS*/
(SELECT SUBSTR(f_type_px17(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
from
px17_appointment ap,
/*context co_ap,*/
px17_payrollagreement pa,
px17_payrollgroup pg
where
pg.cidn=ch.cidn
and pa.cidn=ch.cidn
and ap.cidn=pa.cidn
and ap.cidn = em.cidn
and ap.employmentoid=em.oid
and ap.active=1
and ap.oid=pa.appointmentoid
and lpad(to_char(pa.file_number),6,0)=ch.file_nb
and pa.cocodeoid=pg.oid
and pg.co_code=ch.co_code) status
-- FED TAX
-- , LIVED LOCAL TAX CODE, LIVED STATE TAX CODE, LIVED LOCAL TAX, LIVED STATE TAX, MEDICARE TAX
-- , SCHOOL DISTRICT TAX, SCHOOL DISTRICT, SOCIAL SECURITY TAX, SUI SDI TAX, SUI SDI TAX CODE
-- , WORKED LOCAL TAX CODE, WORKED STATE TAX CODE, WORKED LOCAL TAX, WORKED STATE TAX
-- , OVERTIME EARNINGS, OVERTIME HOURS, REGULAR EARNINGS, REGULAR HOURS
NVL (
(SELECT
TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2982', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2984', ci.code, NULL), NULL)), CHR(155)) || '~'
|| NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2987', DECODE(ci.code,'XX',null,ci.code), NULL), NULL)), CHR(155)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2984', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2987', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4118', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4114', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:4114', ci.code, NULL), NULL)), CHR(155)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2988', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2989', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2989', ci.code, NULL), NULL)), CHR(155)) || '~'
|| NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2983', ci.code, NULL), NULL)), CHR(155)) || '~'
|| NVL(MAX(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2986', ci.code, NULL), NULL)), CHR(155)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2983', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3709', DECODE(ci.taxcodeoid, 'SYS:4:2986', NVL(ci.amount,0), 0), 0) ), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3713', NVL(ci.amount,0), 0)), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3727', NVL(ci.amount,0), 0)), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3715', NVL(ci.amount,0), 0)), 0)) || '~'
|| TO_CHAR(NVL(SUM(DECODE(ci.histtypeoid, 'SYS:4:3716', NVL(ci.amount,0), 0)), 0)) || '~'
-- R16 columns.
-- Total Deductions Amount === Other Deductions on UI screen.
|| TO_CHAR(NVL(SUM(DECODE(chcat.name, 'DeductionHistory'
, DECODE(NVL(ci.statutory_ded, 0), 0
, DECODE(ci.taxcodeoid, NULL
, DECODE(ci.code, NULL, 0, NVL(ci.amount,0)), 0), 0), 0)), 0)) || '~' -- "Total Deductions Amount"
|| TO_CHAR(NVL(SUM(DECODE(chcat.name, 'OvertimeHours', NVL(ci.amount,0)
, 'AdditionalHours', NVL(ci.amount,0), 'RegularHours', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Hours Amount"
|| TO_CHAR(NVL(SUM(DECODE(chcat.name, 'Memo', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Memo Amount"
|| TO_CHAR(NVL(SUM(DECODE(chcat.name, 'AdditionalEarnings', NVL(ci.amount,0), 0)), 0)) || '~' -- "Total Other Earnings"
|| TO_CHAR(NVL(SUM(DECODE(chcat.name, 'AdditionalHours', NVL(ci.amount,0), 0)), 0)) -- "Total Other Hours"
FROM
px17_checkhistoryitem ci
, px17_sys_type chcat
WHERE
ci.cidn=chd.cidn
AND ci.checkhistorydistributionoid = chd.oid
AND chcat.category = 'CheckHistoryItem'
AND chcat.oid = ci.histtypeoid
-- AND ci.histtypeoid IN ('SYS:4:3713', 'SYS:4:3727', 'SYS:4:3715', 'SYS:4:3716', 'SYS:4:3709')
), '0' || '~' || CHR(155) || '~' || CHR(155)
|| '0~0~0~0~' || CHR(155) || '~0~0~' || CHR(155) || '~' || CHR(155) || '~'
|| CHR(155) || '~0~0~0~0~0~0'
) taxes_and_rates
, ch.check_seq_num check_seq_num
, ch.home_cost_number home_costnumber_desc
, SUBSTR(f_type_px17(ch.cidn,ch.payfrequencyoid, 'NAME'), 1, 255) tax_frequency
, (ch.co_code || '/' || ch.home_cost_number) co_chkv_home_cost_no
, chd.worked_in_cost_number cost_no_worked_in
, chd.distribution_number distribution_number
, DECODE(NVL(ch.reversed_flag, 0), 1, 'Y', 'N') chk_reverse
FROM
px17_checkhistory ch
, px17_employment em
, px17_person pe
, px17_payrollgroup pg
, px17_checkhistory_dist chd
, px17_appointment ap
WHERE
ch.cidn = em.cidn
and em.cidn = pe.cidn
and pg.cidn = ch.cidn
and ch.cidn = chd.cidn
and ap.cidn(+) = em.cidn
and ch.employmentoid=em.oid
AND em.personoid=pe.oid
AND pg.co_code = ch.co_code
AND ch.active = 1
AND ch.oid = chd.checkhistoryoid
AND ap.employmentoid(+) = em.oid
AND DECODE(ap.oid, NULL, 1, NVL((SELECT 1 FROM px17_payrollagreement pa
WHERE
pa.cidn = ap.cidn
and pa.cidn = ch.cidn
and pa.cidn = pg.cidn
and pa.appointmentoid = ap.oid
AND pa.file_number = ch.file_nb
AND pa.cocodeoid = pg.oid), 0)) = 1
and ch.cidn in (select distinct s_cidn from nonsuper_user_check)
AND ( sys_context('payx_r17_app_context', 'app_role') in ('ADP', 'CSR')
or (exists (select 1 from super_user_check where su_cidn =ch.cidn))
or (ch.cidn,ch.co_code,ch.home_dept_code) in (select cidn,co_code,dep from user_security_homedept)
or (ch.cidn,ch.co_code,ch.home_cost_number) in (select cidn,co_code,code from user_security_cost_no)
or ( exists(select co_code from user_security_homedept where cidn=ch.cidn and co_code = ch.co_code and dep is null)
and exists(select co_code from user_security_cost_no where cidn=ch.cidn and co_code = ch.co_code and cost_no = 0) )
Following are the functions being called:
create or replace type myTable_17 as table of varchar2(4000);
CREATE OR REPLACE function f_str2tbl_px17( p_str in varchar2 ) return myTable_17 pipelined
as
l_str long default p_str || ',';
l_n number;
begin
loop
l_n := instr( l_str, ',' );
exit when (nvl(l_n,0) = 0);
pipe row( ltrim(rtrim(substr(l_str,1,l_n-1))) );
l_str := ltrim( substr( l_str, l_n+1 ) );
end loop;
return;
end f_str2tbl_px17;
CREATE OR REPLACE FUNCTION f_check_purge_px17
fv_cidn px17_reservedfilenumber.cidn%TYPE,
fv_file_number px17_reservedfilenumber.file_number%TYPE,
fv_cocode px17_payrollgroup.co_code%TYPE DEFAULT NULL
) RETURN NUMBER AUTHID CURRENT_USER
AS
v_val NUMBER(5) ;
BEGIN
IF fv_cocode IS NULL THEN
RETURN 0 ;
END IF ;
SELECT 1 INTO v_val
FROM px17_reservedfilenumber a,
px17_payrollgroup b
WHERE
a.cidn = fv_cidn
AND b.cidn = fv_cidn
AND a.file_number = fv_file_number
AND a.parentoid = b.oid
AND b.co_code = fv_cocode
AND ROWNUM = 1 ;
RETURN 1 ;
EXCEPTION
WHEN no_data_found THEN
RETURN 0 ;
END f_check_purge_px17 ;
CREATE OR REPLACE FUNCTION f_check_security_px17
fv_cidn IN px17_type_client.cidn%TYPE,
fv_cocode px17_cocodegroup.co_code%TYPE -- pg.cocode
, fv_home_dept px17_type_client.name%TYPE -- ap.home_dept
) RETURN NUMBER AUTHID CURRENT_USER
AS
v_val NUMBER(5) ;
v_key VARCHAR2(20) ;
v_users VARCHAR2(4000) ;
v_cocodes VARCHAR2(4000) ;
BEGIN
BEGIN
SELECT c_user_list, c_cocodes, c_run_key
INTO v_users, v_cocodes, v_key
FROM px17_t_context_vals
WHERE c_run_key = (SELECT MAX(c_run_key) FROM px17_t_context_vals)
AND ROWNUM = 1 ;
EXCEPTION
WHEN no_data_found THEN
v_cocodes := NULL ;
END ;
IF v_cocodes IS NULL THEN
RETURN 1 ;
ELSIF INSTR( (v_cocodes || ','), (fv_cocode || ',') ) = 0 THEN
RETURN 0 ;
ELSE
BEGIN
SELECT
1
INTO
v_val
FROM
px17_type_client t
, px17_securityobject s
, px17_cocodegroup c
WHERE
t.securityoid=s.oid
AND t.category='T_CO_DEPT'
AND c.useroid=(SELECT a.oid
FROM px17_associate a
WHERE a.oid = c.useroid
AND a.active=1
AND UPPER(a.name) = UPPER(v_users)
AND ROWNUM = 1)
AND SUBSTR(s.name,8,3)=c.co_code
AND (c.department_access IS NULL
OR c.department_access LIKE '%' || t.name || '%')
AND SUBSTR(s.name,8,3) = fv_cocode
AND t.name = fv_home_dept
AND ROWNUM = 1 ;
RETURN 1 ;
EXCEPTION
WHEN no_data_found THEN
BEGIN
SELECT
1
INTO
v_val
FROM
px17_cocodegroup c
, px17_associate a
WHERE
c.useroid=a.oid
AND c.department_access IS NULL
AND c.co_code = fv_cocode
AND UPPER(a.name)= UPPER(v_users)
AND a.active=1
AND ROWNUM = 1 ;
RETURN 1 ;
EXCEPTION
WHEN no_data_found THEN
RETURN 0 ;
END ;
END ;
END IF ;
RETURN 0 ;
END f_check_security_px17 ;
SELECT SUBSTR(f_type_px17(ap.cidn,ap.currentstatusoid, 'DESC'), 1, 255)
from
px17_appointment ap,
/*context co_ap,*/
px17_payrollagreement pa,
px17_payrollgroup pg
CREATE OR REPLACE FUNCTION f_type_px17
fv_cidn IN px17_type_client.cidn%TYPE,
fv_oid IN px17_type_client.oid%TYPE,
fv_col IN VARCHAR2 DEFAULT NULL
) RETURN VARCHAR2 AUTHID CURRENT_USER AS
v_rtn_name px17_type_client.name%TYPE := NULL ;
v_rtn_desc px17_type_client.description%TYPE := NULL ;
BEGIN
IF fv_oid IS NOT NULL THEN
BEGIN
IF UPPER(SUBSTR(fv_oid,1,3)) = 'SYS' THEN
SELECT name, description
INTO v_rtn_name, v_rtn_desc
FROM px17_sys_type
WHERE oid = fv_oid
AND ROWNUM = 1 ;
ELSE
SELECT name, description
INTO v_rtn_name, v_rtn_desc
FROM px17_type_client
WHERE oid = fv_oid
AND cidn = fv_cidn
AND ROWNUM = 1 ;
END IF ;
EXCEPTION
WHEN no_data_found THEN
v_rtn_name := NULL ;
v_rtn_desc := NULL ;
END ;
END IF ;
IF (UPPER(NVL(fv_col, '~')) = 'NAME') THEN
RETURN v_rtn_name ;
ELSIF ((UPPER(NVL(fv_col, '~')) = 'DESC')
OR (UPPER(NVL(fv_col, '~')) = 'DESCRIPTION')) THEN
RETURN v_rtn_desc ;
ELSE
RETURN (NVL(v_rtn_name, CHR(155)) || '~' || NVL(v_rtn_desc, CHR(155))) ;
END IF ;
END f_type_px17 ;
*************************
Maybe you are looking for
-
SY-TABIX within a search help exit...
Hallo all, I tried to find an answer in earlier postst, but did not succeed, therefore this message. I have built a customtabel with several columns. For one of the columns I have built a custom search help, including some coding in the search help e
-
Hi, I cannot add new account and modify the name of the other account, why? thanks for your support. Alessandro.
-
Hello, I just got a new Imac and I am trying to use Migration Assistant to copy my pictures from Iphoto from my Powerbook. I am running Leopard 10.5.4 on the Powerbook. I copied the files and got a bunch of weird photo album names (ex: Album.999000.i
-
Is there a user exit to modify PO line item level..
Dear Friends, Is there a user exit to modify PO line item level.. Ravi
-
Post-refresh activities in BI after R/3 is restored or refreshed
Dear Experts From what i could recall, post-refresh of R/3 system requires certain steps to be done on the basis / Netweaver layer of BI before the system can be normalised. I recall that there is a RFC (sm59) user whose password I need to know in or