-- orders1.sql

CREATE OR REPLACE PROCEDURE count_po1(
  start_dt DATE, end_dt DATE, total OUT NUMBER)
AS
BEGIN
  IF end_dt IS NULL THEN
    SELECT count(po_number)
      INTO total
      FROM po_header
     WHERE order_date >= start_dt;
  ELSE
    SELECT count(po_number)
      INTO total
      FROM po_header
     WHERE order_date BETWEEN start_dt AND end_dt;
  END IF;
END count_po1;
/
