[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] Does OR-54 Raise an error in a Begin-SQL Block??



It sounds a bit risky--if it doesn't matter whether you can UPDATE, why do it?

But here's what I'd do. Create a PL/SQL procedure, something like

CREATE OR REPLACE PROCEDURE try_to_update
   (p_seq IN abuc_buchung.buc_dfuehaus%TYPE,
    p_bucid IN abuc_buchung.buc_bucid%TYPE,
    p_status OUT VARCHAR2)
AS
  CURSOR c_abuc IS
   SELECT buc_dfuehaus
   FROM abuc_buchung
   WHERE buc_bucid = p_bucid
   FOR UPDATE OF buc_dfuehaus NOWAIT;
  v_dfuehaus abuc_buchung.buc_dfuehaus%TYPE;
BEGIN
    OPEN c_abuc;
    FETCH c_abuc INTO v_dfeuhaus;
   UPDATE abuc_buchung
     SET buc.dfuehaus = p_seq
      WHERE CURRENT OF c_abuc;
      COMMIT;                                       -- closes this and other 
FOR UPDATE cursors;
    p_status := 'OK'
EXCEPTION WHEN OTHERS THEN
   p_status = 'NOT OK';
END try_to_update;

Then call the procedure from your Begin-SQL paragraph.

In fact, whenever your SQRs are performing DML on a  table, it would be well to 
create a package, and put the DML there
   


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users