NTP_V2/db/receipts-gn-permit.sql

12 lines
526 B
SQL

-- Permit receipts: the grains (GN) permit number of the receipt, "رقم الارسالية" (legacy form field GNPN, which the legacy never stored).
-- Run in the primary (NAFITHTCS) schema BEFORE deploying this version of the receipts screen. Safe to re-run; not run by the app.
DECLARE
n NUMBER;
BEGIN
SELECT COUNT(*) INTO n FROM user_tab_columns WHERE table_name = 'PERMITS_RECEIPTS' AND column_name = 'GN_PN';
IF n = 0 THEN
EXECUTE IMMEDIATE 'ALTER TABLE PERMITS_RECEIPTS ADD (GN_PN NUMBER)';
END IF;
END;
/