Amazing!!

67 lines of Oracle code = 15 lines of simple R:Base code!!

David Blocker
[EMAIL PROTECTED]
781-784-1919
Fax: 781-784-1860
Cell: 339-206-0261
----- Original Message -----
From: "Claudine Robbins" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Friday, May 20, 2005 9:37 AM
Subject: [RBG7-L] - RE: off topic


> Javier and David,
>
> >It would be really nice if you could post the equivalent code in
R:Base...
> Javier, you're very funny but looks aren't everything! <g>
>
> > and could you show us that in R:Base - ese?
> David, do you mean ease?
>
> It so happens that I actually (sort of) understood this code snippet and
> deciphered what I needed from it.  It's not called 'code' for nothing.
> However, for most of the application, I recreated the business logic and
> with a lot of help from the list (my thanks to everyone, I couldn't keep
> doing it everyday without you), rooted out its basic simplicity and
> converted it to R:Base functionality.
>
> --CALCULATE BILLING_AMT IN d_b_allocation
> --Total of ADJUSTED_TOTAL in d_invoice_header
> --and DA_FEE in d_b_allocation
>
> SET ERROR MESSAGES 2038 OFF
> SET VAR vbatchdate = 12/20/04
> DROP VIEW calc_view NOCHECK
> CREATE TEMP VIEW calc_view (id,dafee,adtotal,bamount) +
> AS SELECT  t43.invoice_id, +
> t43.da_fee, +
> t61.adjusted_total, +
> (t43.da_fee+t61.adjusted_total) +
> FROM d_b_allocation t43, d_invoice_header t61 +
> WHERE  t43.invoice_id=t61.invoice_id +
> AND da_invoice_dt = .vbatchdate
> SET ERROR MESSAGES 2038 ON
> update d_b_allocation set billing_amt = T2.bamount +
> from d_b_allocation T1, calc_view T2 where T1.invoice_id = T2.id
> RETURN
>
> > > James,
> > >
> > > No one on earth (and that's no exaggeration...) can speak about R:Base
> > as
> > > comprehensively and eloquently as Razzak Memon!
> > >
> > > I've never used Access and don't ever plan to, but I have been
> > converting
> > an
> > > Oracle database into R:Base and just for grins, some simple Oracle
code
> > > follows so that you can compare the readability with what you are
> > accustomed
> > > to in R:Base:
> > >
> > > CREATE OR REPLACE FUNCTION DA_GET_TOTAL_BILLING_AMOUNT(PARM_CARRIER
> > NUMBER,
> > > PARM_INBOX_STATE NUMBER) RETURN NUMBER IS
> > > FOUND                   BOOLEAN;
> > > WK_TOTAL                DA_BILLING_ALLOCATION.BILLING_AMT%TYPE;
> > > WK_BILLING_COUNT        DA_BILLING_ALLOCATION.BILLING_AMT%TYPE;
> > > WK_DA_FEE        DA_BILLING_ALLOCATION.DA_FEE%TYPE;
> > > CURSOR                  C_GET_AMOUNT(VAR_CARRIER NUMBER,
VAR_INBOX_STATE
> > > NUMBER) IS
> > >                                 SELECT SUM(A.BILLING_AMT),
> > > COUNT(A.BILLING_AMT)
> > >                                 FROM DA_INVOICE_HEADER B,
> > > DA_BILLING_ALLOCATION A, DA_INBOX C
> > >                                 WHERE C.INVOICE_ID = B.INVOICE_ID AND
> > > B.INVOICE_ID = A.INVOICE_ID
> > >                                         AND B.CARRIER = VAR_CARRIER
AND
> > > C.INBOX_STATE = VAR_INBOX_STATE;
> > > CURSOR                  C_GET_FRONTED_AMOUNT(VAR_CARRIER NUMBER) IS
> > >                                 SELECT SUM(A.FRONTED_AMT)
> > >                                 FROM DA_INVOICE_HEADER B,
> > > DA_BILLING_ALLOCATION A, DA_INBOX C
> > >                                 WHERE C.INVOICE_ID = B.INVOICE_ID AND
> > > B.INVOICE_ID = A.INVOICE_ID
> > >                                 AND B.CARRIER = VAR_CARRIER AND
> > > C.INBOX_STATE = 6
> > >                                 AND A.FRONTED_AMT > 0;
> > > CURSOR                  C_GET_DA_FEE(VAR_CARRIER NUMBER,
VAR_INBOX_STATE
> > > NUMBER) IS
> > >                                 SELECT DA_FEE
> > >                                 FROM DA_INVOICE_HEADER B,
> > > DA_BILLING_ALLOCATION A, DA_INBOX C
> > >                                 WHERE C.INVOICE_ID = B.INVOICE_ID AND
> > > B.INVOICE_ID = A.INVOICE_ID
> > >                                 AND B.CARRIER = VAR_CARRIER AND
> > > C.INBOX_STATE = VAR_INBOX_STATE;
> > > BEGIN
> > >         IF PARM_INBOX_STATE = 9 THEN
> > >                 OPEN C_GET_FRONTED_AMOUNT(PARM_CARRIER);
> > >                 FETCH C_GET_FRONTED_AMOUNT INTO WK_TOTAL;
> > >                 FOUND := C_GET_FRONTED_AMOUNT%FOUND;
> > >                 CLOSE C_GET_FRONTED_AMOUNT;
> > >                 IF NOT FOUND THEN
> > >                         WK_TOTAL := 0;
> > >                 END IF;
> > >         ELSE
> > > OPEN C_GET_DA_FEE(PARM_CARRIER,PARM_INBOX_STATE);
> > > FETCH C_GET_DA_FEE INTO WK_DA_FEE;
> > > CLOSE C_GET_DA_FEE;
> > >                 OPEN C_GET_AMOUNT(PARM_CARRIER, PARM_INBOX_STATE);
> > >                 FETCH C_GET_AMOUNT INTO WK_TOTAL, WK_BILLING_COUNT;
> > >                 FOUND := C_GET_AMOUNT%FOUND;
> > >                 CLOSE C_GET_AMOUNT;
> > >                 IF NOT FOUND THEN
> > >                         WK_TOTAL := 0;
> > >                 ELSE
> > >                         WK_TOTAL := WK_TOTAL - (WK_BILLING_COUNT *
> > > WK_DA_FEE);
> > >                 END IF;
> > >         END IF;
> > > RETURN WK_TOTAL;
> > > END DA_GET_TOTAL_BILLING_AMOUNT;
> > > /
> > >
> > > > -----Original Message-----
> > > > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of james
> > > > hageman
> > > > Sent: Thursday, May 19, 2005 1:58 PM
> > > > To: RBG7-L Mailing List
> > > > Subject: [RBG7-L] - off topic
> > > >
> > > > I am finding myself being required to justify the use of Rbase
instead
> > > > of Access at this Univ. Apparently just saying it's way better, see
> > for
> > > > yourself doesn't cut it.
> > > >
> > > > I am looking for some help in examples of why Rbase is better and
that
> > > > is does use a real programming language and a list of major
> > > > organizations that are using rbase. I know Razzak is doing work for
> > the
> > > > FBI and believe the US Navy. Others?
> > > >
> > > > Thanks much.
> > > >
> > > >
> > > >
> > > > James Hageman, CITA I
> > > > University of Delaware Archives
> > > > 002 Pearson Hall
> > > > Newark ,DE 19716
> > > > 302-831-3127
> > > > [EMAIL PROTECTED]
> > >
> > >
>
>

Reply via email to