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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie Question

Re: Newbie Question

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 28 Nov 2002 16:17:12 -0800
Message-ID: <3de6b208@news.victoria.tc.ca>


Dulacka (jsoames-is_at_shaw.ca) wrote:
: I am a seasoned cobol programmer who is new to Oracle. My cobol
: experience is in the Unisys arena. ie I have been using a DMSII
: database (uses pointers).

: I have a basic understanding of Oracle and cursors but I am having
: difficulty understanding how to write a batch update program.

: For example:

: I have a table that contains 10 rows (table A.) Each row in table A
: will be added to another table (table B) and the original row (in
: tabel A) will be updated with todays date. If there are any errors
: adding the row to table B the transaction is aborted and the program
: continues with the next row in table A.

: Basically the program is reading a table of recurring invoices that
: are posted to the actual invoice table.

: If I use the same logic with Oracle the cursor is closed and the
: program ends abnormally.

: If I was to write this program from scratch how would I do it? Read
: rows from table A to a temp file and then read each record from the
: temp?

: Any help with this would be appreciated.

: Also, if any one could direct me to sample programs it would be
: greatly appreciated.

: Thanks in advance

INSERT INTO actual_invoices
(

    SELECT the,required,columns,and,perhaps,the,SYSDATE     FROM recurring_invoices
    WHERE the recurring invoice fulfills your

           requirements to generate an invoice for 
           some specified time period

)

Transactions mean that either all the required actual_invoices are generated, or none are. (So if you have a problem then simply re-run the insert statement). A primary constraint of some sort on the actual_invoices table ensures the insert cannot be run more than once.

$0.02 Received on Thu Nov 28 2002 - 18:17:12 CST

Original text of this message

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