oracle11g - converting to Oracle sp from SQL Server 2 lines "not recognized" -
i using oracle sql developer scratch editor tool. there couple of small errors, not sure how fix.
--sqldev:following line not recognized while @i <= @pat_cnt --sqldev:following line not recognized begin select pat_number , patient_id , mrn , last_name , first_name , unit_code , nursing_unit , sdt , edt , shift_code , start_time , end_time v_pat_number, v_patient_id, v_mrn, v_last_name, v_first_name, v_unit_code, v_nursing_unit, v_sdt, v_edt, v_shift_code, v_start_time, v_end_time tt_v_pats pkey = v_i; begin v_l_cur_date := trunc_date(v_p_start_date) ; end; --sqldev:following line not recognized while @l_cur_date <= optc.trunc_date(@p_end_date) --sqldev:following line not recognized begin
it's not obvious me attempting here...
in pl/sql, variables declared in declare section of anonymous pl/sql block or in is/ as section of named pl/sql block (a stored procedure or stored function). in pl/sql, begin needs paired end-- see bunch of begin statements in code no associated end. , in pl/sql, don't use @ refer variables.
something syntactically valid, it's not obvious want, however.
declare v_pat_number tt_v_pats.pat_number%type; v_patient_id tt_v_pats.patient_id%type; v_mrn tt_v_pats.mrn%type; v_last_name tt_v_pats.last_name%type; v_first_name tt_v_pats.first_name%type; v_unit_code tt_v_pats.unit_code%type; v_nursing_unit tt_v_pats.nursing_unit%type; v_sdt tt_v_pats.sdt%type; v_edt tt_v_pats.edt%type; v_shift_code tt_v_pats.shift_code%type; v_start_time tt_v_pats.start_time%type; v_end_time tt_v_pats.end_time%type; v_pat_cnt integer := 100; begin in 1 .. v_pat_cnt loop select pat_number , patient_id , mrn , last_name , first_name , unit_code , nursing_unit , sdt , edt , shift_code , start_time , end_time v_pat_number, v_patient_id, v_mrn, v_last_name, v_first_name, v_unit_code, v_nursing_unit, v_sdt, v_edt, v_shift_code, v_start_time, v_end_time tt_v_pats pkey = i; <<do local variables>> end loop; end; of course, can use record types simplify code bit
declare v_pats_rec tt_v_pats%rowype; v_pat_cnt integer := 100; begin in 1 .. v_pat_cnt loop select * v_pats_rec tt_v_pats pkey = i; <<do record>> end loop; end;
Comments
Post a Comment