text: DROP VIEW IF EXISTS view_persediaan_barang3_snt;
  
  CREATE VIEW view_persediaan_barang3_snt AS
  
  SELECT
  *,
  CASE	WHEN pra_saldo > 0 AND jumlah >= pra_saldo
  	    THEN pra_saldo
  	WHEN pra_saldo > 0 AND jumlah < pra_saldo
  	    THEN jumlah
  	ELSE 0
  END	AS saldo
  
  
  FROM
  view_persediaan_barang2_snt
  
  WHERE
  1 = 1  AND
  id_skpd = 9;
  
  
  
  GRANT ALL PRIVILEGES ON view_persediaan_barang3_snt TO lap_snt;
  REVOKE INSERT, UPDATE, DELETE ON view_persediaan_barang3_snt FROM lap_snt;
  