Comment

Monday Afternoon Music: Don Ross

146
Walter L. Newton2/22/2010 3:03:10 pm PST

re: #139 HoosierHoops

Hire me… here’s a sample of well written code… make believe it’s a live job interview… here’s some of my coding…

CREATE OR REPLACE
PACKAGE BODY hpcbaby_rpt AS

— 1) build a cursor with FDD seq’s from the report_hpc_layoutd set up information
— 2) loop through FDD seq cursor
— 3) use FDD seq’s from FDD seq cursor to pass to the insert/select below
— 4) fill in the nulls with the data from the FDD seq cursor columns
— 5) insert/select below will populate the hpc_rpt_temp table

— don’t forget staff initials with perform date

— Programmer - Walter L. Newton Dec. 2006

PROCEDURE stage_baby_data (p_request_id IN NUMBER,
p_report_sname IN VARCHAR2,
p_facility_id IN VARCHAR2,
p_pat_seq IN NUMBER,
p_report_baby IN VARCHAR2
) IS

CURSOR cur_report_hpc_layout (c_report_sname VARCHAR2, c_facility_id VARCHAR2) IS
SELECT report_hpc_layout.form_data_dict_seq,
report_hpc_layout.sort_order,
report_hpc_layout.display_label,
reportmods.mod_name,
reportmods.mod_seqno
FROM reportmods,
report_hpc_layout
WHERE upper(reportmods.report_sname) = upper(c_report_sname)
and reportmods.mod_seqno = p_request_id
and reportmods.rep_var_seq = report_hpc_layout.rep_var_seq
AND report_hpc_layout.facility_id = c_facility_id
order by report_hpc_layout.sort_order;

— initialize some variables

x_facility varchar2(3);
x_facility_id varchar2(3);

confirm_type varchar2(1);

cur_report_hpc_layout_rec cur_report_hpc_layout%ROWTYPE;

c_display_time CONSTANT VARCHAR2(21) := ‘hh24:mi’;
c_display_date CONSTANT VARCHAR2(21) := rpt_util.get_date_mask(p_facility_id);
c_display_date_time CONSTANT VARCHAR2(21) := rpt_util.get_date_mask(p_facility_id) %P%%P% ’ hh24:mi’;

— for apgars

x_apgar_string varchar2(100);
x_apgar_1 varchar2(15);
x_apgar_5 varchar2(15);
x_apgar_10 varchar2(15);
x_apgar_15 varchar2(15);
x_apgar_20 varchar2(15);

— for temp,pulse,respiration

x_tpr_string varchar2(100);
x_tpr_1 varchar2(100);
x_tpr_2 varchar2(100);

— end initialize some variables


begin

— check if passed facility ID has a set up in report_hpc_layout
— If not, set facility ID to default ‘ALL’

x_facility_id := p_facility_id;

SELECT distinct rhl.facility_id
INTO x_facility
FROM reportmods rm,
report_hpc_layout rhl
WHERE upper(rm.report_sname) = upper(p_report_sname)
AND rm.rep_var_seq = rhl.rep_var_seq
AND rhl.facility_id = p_facility_id;

exception
when others then
x_facility_id := ‘ALL’;

— get confirmed_by parameter from the report set up table reportvars

SELECT reportvars.value
into confirm_type
FROM reportmods,
reportvars
WHERE upper(reportmods.report_sname) = upper(p_report_sname)
and reportmods.mod_seqno = p_request_id
and reportmods.rep_var_seq = reportvars.rep_var_seq
AND upper(reportvars.label) = ‘CONFIRMED_BY’
and upper(reportvars.facility_id) = upper(p_facility_id);

— Create report configuration cursor and loop through the records and insert the record into
— the temporary report table hpc_rpt_temp for the passed BABY and MOTHER

FOR cur_report_hpc_layout_rec IN cur_report_hpc_layout (p_report_sname, x_facility_id)
LOOP

(gee, formatting went bonkers)