create or replace
PROCEDURE showb53rep(
	id_in IN poles_zeros.pz_key%TYPE
 )
IS
	rtype      pz_data.type%TYPE;
	value1     string(15);
	value2     string(15);
	value3     string(15);
	value4     string(15);
	rep1       integer;
	rep2       integer;
	linestr    string(20);
	lineno     integer;

	CURSOR cr_repeat_pz IS
		SELECT  type,
			to_char(r_value,'S0.99999EEEE'),
			to_char(i_value,'S0.99999EEEE'),
			to_char(r_error,'S0.99999EEEE'),
			to_char(i_error,'S0.99999EEEE')
		FROM PZ_Data
		WHERE key = id_in
		ORDER BY row_key;

BEGIN
	DBMS_OUTPUT.enable(1000000);
	rep1 := 1;
	rep2 := 1;

	IF NOT cr_repeat_pz%ISOPEN THEN
		OPEN cr_repeat_pz;
	END IF;

	FETCH cr_repeat_pz into rtype, value1, value2, value3, value4;

	WHILE cr_repeat_pz%FOUND
	LOOP
		IF( (rep1 = 1 ) and (rtype = 'Z') ) THEN
			linestr := 'B053F10-13 ';
			DBMS_OUTPUT.PUT_LINE('#              Complex zeroes:');
			DBMS_OUTPUT.PUT_LINE('#              i  real          imag          real_error    imag_error' );
			rep1 := 0;
			lineno := 0;
		END IF;
		IF( (rep2 = 1 ) and (rtype = 'P') ) THEN
			linestr := 'B053F15-18 ';
			DBMS_OUTPUT.PUT_LINE('#              Complex poles:');
			DBMS_OUTPUT.PUT_LINE('#              i  real          imag          real_error    imag_error' );
			rep2 := 0;
			lineno := 0;
		END IF;
		DBMS_OUTPUT.PUT_LINE( linestr || to_char(lineno,'9999') || ' ' || value1 || ' ' || value2 || ' ' || value3 || ' ' || value4 );
		FETCH cr_repeat_pz into rtype, value1, value2, value3, value4;
		lineno := lineno + 1;
	END LOOP;
	close cr_repeat_pz;
END;
