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: PL/SQL help needed

Re: PL/SQL help needed

From: Gygy Berlogea <PleasePostOn_at_TheNewsGroup.com>
Date: Fri, 06 Aug 1999 19:26:59 GMT
Message-ID: <7GGq3.2414$Hq5.7545@cabot.ops.attcanada.net>


But wait,

Here we have a summary of the PREVIOUS solutions. Please note the naming convention used for the cursor variable "i" ( = previously "policy_number" )
this, in it's own length, would consume most Oracle resources, and there's always a chance that someone might be able to read and = understand this code (!!!).

The Observer.

  Kenneth C Stahl wrote in message =
<379DC9B7.8A652258_at_Unforgettable.com>...

  Yee gads, how did you ever come up with this code?

  If you want to update specific rows, do it like this:

  Declare
  CURSOR some_policies IS
  SELECT p.policy_number,

                 p.policy_date_time
                 p.rowid
  FROM   policy p,
                register_cur rc

  WHERE p.policy_number = rc.policy_number   AND p.renewal_code = 1
  AND rc.status_1 = 5;

  BEGIN

      FOR I IN some_policies LOOP
          UPDATE policy
          SET    non_renewal_reason = 'I'
          WHERE rowid = i.rowid;
          COMMIT;

        DBMS_OUTPUT.PUT_LINE (SQL%ROWCOUNT || ' policies.');
        DBMS_OUTPUT.PUT_LINE ('Policy number ' || v_policy_no || ' .');
                  END LOOP;

  END;   Ken Received on Fri Aug 06 1999 - 14:26:59 CDT

Original text of this message

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