Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Basic PL/SQL script needed

Basic PL/SQL script needed

From: Jack Overhiser <overhisj_at_ewashtenaw.org>
Date: 15 Feb 2004 13:24:08 -0800
Message-ID: <2a66f459.0402151324.3660f1ec@posting.google.com>

I have taken over management of a data warehouse running on Oracle/Windows. I would like to add some code to the daily load processing scripts that would check that a table has been loaded, that is, has more than 0 records. I have .bat scripts that call SQL scripts. I'd like the SQL scripts to do a record count and if it is zero end with a non-zero return code. I think what I want to use is a PL/SQL block in the SQL script. I've come up with the following basic process. Can someone fill in the correct code to make it work? Thanks.

DECLARE
   recs number := 0;
BEGIN
   SELECT count(*) INTO recs FROM WarehouseTable;    IF recs = 0 THEN

      EXIT FAILURE;
   END IF;
END;
/ Received on Sun Feb 15 2004 - 15:24:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US