wrap in procedures

This commit is contained in:
Paul Trowbridge 2025-09-16 22:34:50 -04:00
parent 12787d297b
commit 4b477b990f
3 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,8 @@
CREATE OR ALTER PROCEDURE pricing.rebuild_pricelist
AS
BEGIN
SET NOCOUNT ON;
DROP TABLE pricing.pricelist_ranged;
CREATE TABLE pricing.pricelist_ranged (
@ -197,3 +202,4 @@ FROM
ranged;
--CREATE INDEX pricelist_ranged_idx ON pricing.pricelist_ranged(jcpart, jcplcd, vb_from, vb_to);
END;

View File

@ -1,3 +1,8 @@
CREATE OR REPLACE PROCEDURE pricequote.rebuild_pricelist()
LANGUAGE plpgsql
AS $$
BEGIN
DROP TABLE IF EXISTS uomc;
CREATE TEMP TABLE uomc AS (
@ -97,5 +102,7 @@ SELECT
price
FROM ranged;
END;
$$;
CREATE INDEX pricelist_ranged_idx ON pricequote.pricelist_ranged ( jcpart ASC , jcplcd ASC , vb_from ASC , vb_to ASC ) ;
--CREATE INDEX pricelist_ranged_idx ON pricequote.pricelist_ranged ( jcpart ASC , jcplcd ASC , vb_from ASC , vb_to ASC ) ;

View File

@ -1,3 +1,7 @@
CREATE OR ALTER PROCEDURE pricing.rebuild_targets
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM pricing.target_prices;
@ -20,3 +24,5 @@ SELECT
math
FROM
usmidsap02.ubm.pricequote.target_prices_view;
END;