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

Home -> Community -> Usenet -> c.d.o.server -> Re: Stored Procedure

Re: Stored Procedure

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 1997/11/18
Message-ID: <64rt3n$lu5$1@news01.btx.dtag.de>#1/1

rkrishag_at_ikon.com wrote:
>
> Hi,
>
> Can any one help me write a stored procedure. The requirement is like
> this. I have a number of load tables. Records are continuosly loaded into
> this using sqlloader. Each upload has a unique batch id. There is an
> audit table which monitors the number of records being loaded everyday. A
> field of audit table contains the name of the table on which the upload
> was performed. For each upload a record is inserted in the audit table
> which now has the batch id and the table name on which the upload was
> done.
>
> I want to write a query for which I pass the load table name and batch id
> as the parameter. The query should access the corresponding load table
> and according to the batch id determine how many records have been
> loaded. Since there are more than 20 load tables how do I write a stored
> procedure or a trigger.
>
> Please do get back to me on this ASAP.
>
> Regards
> Rajesh
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet

Hi Rajesh,

try something like this:

set termout off
set echo off
set pagesize 0
spool c:\c_rec1.sql
select 'SELECT ' TABLE_NAME || 'table, ' || BATCH_ID ||' id, COUNT(<pk-field>) FROM ' || TABLE_NAME || ' WHERE BATCH_ID = ' || BATCH_ID ||'; ' from <audit_table>;
spool off
spool c:\c_rec2.sql
@c:\c_rec1.sql
spool off

-- 
Regards

Matthias Gresz    :-)
Received on Tue Nov 18 1997 - 00:00:00 CST

Original text of this message

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