I know its a tough task to do , but let me explain in it with a sample.
I have a stroed procedure as below. in SQL Servier2008 DB.
CREATE PROCEDURE emp_details_info
(
@inMarker numeric(7,0),
@inRuleId numeric(7,0),
@inPeriodId numeric(7,0),
@inPK varchar(50),
@inDebug varchar(12) = null
)
AS
set nocount on
--------------------------------------------------- Variable Declaration --
declare @lclPeriodId numeric(7,0)
declare @id numeric(7,0), @typeId numeric(7,0)
declare @lclCmd varchar(255)
declare @lclErrorNum integer
set @lclErrorNum = 0
declare @lclStatus integer
set @lclStatus = 0
------------------------------------------------------------------- Body --
begin
select @lclPeriodId = period_id from employ_calendar_period
where calendar_name = 'MONTHLY'
and emp_num = (select min(emp_num) from employ_calendar_period where calendar_name = 'MONTHLY')
if (@inDebug is not null)
print 'Executing emp_details_info'
select @id = perspective_id, @typeId = type_id
from attendance_rules_for_times rpt
join emp_attendance_type rpty
on rpty.emp_attendance_type_id = rpt.attendance_rules_id
where
rpty.rule_id = @inRuleId and rpty.employee_order = 2
update employee_job_tree
set computed_salary = case when ( isnull(view1.emp_type,0) ) = 1.0 then isnull(cdd3.value,0) else isnull(fdd2.value,0) end
from employee_job_tree ejt
join emp_vwcatalog_detail empvwd1 on
ejt.detail_id = empvwd1.detail_id
join VWEMPLOYEE_LEAF view1 on
vwcd1.emp_id = view1.emp_id
and view1.emp_period_id = view1.emp_current_period_id
and view1.emp_effective_period_id = view1.emp_current_period_id
left outer join employee_detail_data_b edd2 on
ejt.emp_detail_id = edd2.detail_id
and edd3.type_id = @typeId
where ejt.employee_rule_marker = @inMarker
set @lclErrorNum = @@error
if ((@lclStatus != 0) or (@lclErrorNum != 0))
begin
set @lclCmd = 'ERROR: Failed to exec emp_details_info {' + dbo.Emp_Render(@empId) + ':' +'}'
exec Emp_Log_Message @lclErrorNum, 'ERROR', '__ENGINE', 'STEP1', @lclCmd
goto exception
end
return 0
exception:
return 1
end
-- emp_details_info
Me trying to write the above stored procedure in java code using JOOQ API, so that i can execute it using java compiler and interpreter.
But i have a tough time to write it in JOOQ API, getting the input parameters, joins , assigning local variable values in select statement.
Can you provide me help in order to conver it entirely to java code.
Thank you.