Terminated with error: <br>REP-300: service handle not initialized [message #424396] |
Fri, 02 October 2009 01:52 |
bechara.daccache
Messages: 14 Registered: September 2008 Location: Lebanon
|
Junior Member |
|
|
Dear,
I created a report.
when we try to run it from the application it shows the following error:
"Terminated with error: <br>REP-300: service handle not initialized ==> SELECT payr.emp_id payr_emp_id, "
But the query where this error points works fine on "Toad", in other words, there is no syntax errors.
Anyway this is the query:
SELECT payr.emp_id pyr_emp_id,
payr.com_code pyr_com_code,
HR_ROUND(SUM(payr.amount),5) ADD_amount,
reco.name_e ADD_paye_name,
reco.sort_order
FROM payrolls payr,
pay_elements paye,
hr_report rep,
hr_report_columns reco,
hr_column_pay_element cpe
WHERE payr.payp_id = :P_PERIOD_ID
AND payr.com_code = :P_COMP_CODE
AND payr.paye_code = paye.code
AND to_number(to_char(paye.addition_flag)) =1
AND payr.com_code = paye.com_code
AND :p_payroll_type = 'F'
AND reco.repo_seq = rep.seq
AND cpe.reco_repo_seq = reco.repo_seq
AND cpe.reco_seq = reco.seq
AND cpe.paye_code = paye.code
AND rep.code='001'
and reco.code = '01'
GROUP BY payr.emp_id, payr.com_code,reco.name_e, reco.sort_order
UNION
SELECT payr.emp_id emp_id,
payr.com_code com_code,
SUM(payr.amount) ,
reco.name_e paye_name,
reco.sort_order
FROM trial_payrolls payr,
pay_elements paye,
hr_report rep,
hr_report_columns reco,
hr_column_pay_element cpe
WHERE payr.payp_id = :P_PERIOD_ID
AND payr.com_code = :P_COMP_CODE
AND payr.paye_code = paye.code
AND to_number(to_char(paye.addition_flag)) =1
AND payr.com_code = paye.com_code
AND :p_payroll_type = 'T'
AND payr.amount IS NOT NULL
AND reco.repo_seq = rep.seq
AND cpe.reco_repo_seq = reco.repo_seq
AND cpe.reco_seq = reco.seq
AND cpe.paye_code = paye.code
AND rep.code='001'
GROUP BY payr.emp_id, payr.com_code, /*paye.code ,*/reco.name_e, reco.sort_order/*, paye.order_by*/
ORDER BY 5
Something weird about this query is that the field " paye.addition_flag" has a datatype: Number, but I was obliged to force it by "To_Number" to put the condition.( I never knew why!)
After some searches, I discovered that this is some kind of space allocation error.
Please can you help me solving this problem, because it took too much time, and I can't find any solution.
And if you needed any clarification, do not hesitate asking me anything.
Best Regards,
Bechara
|
|
|
|
|
Re: Terminated with error: <br>REP-300: service handle not initialized [message #424680 is a reply to message #424396] |
Mon, 05 October 2009 05:24 |
cookiemonster
Messages: 13962 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
That makes absolutely no sense. If anything the version with the to_number should be slower as it'll prevent index usage.
If you're having to use to_number here that means something is wrong. So I'd concentrate on getting to the bottom of that. It might even fix your other issue.
Post explain plans for the query with and without the to_number/to_char.
|
|
|
|