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: PLSQL/cursor newbie question

Re: PLSQL/cursor newbie question

From: Peter H. Larsen <petlars_at_pip.dknet.dk>
Date: 1998/01/21
Message-ID: <34c7813e.5710270@news2.dknet.dk>#1/1

On Wed, 21 Jan 1998 13:51:08 -0500, "H. John C. Hopkins" <john_nospam_at_hpe.ufl.edu> wrote:

>I'm trying to write a Before Delete trigger that will check whether or not
>the current user created the record s/he's trying to delete. (The creator's
>user name is stored in the field userid.) This restriction should only
>apply to users who are assigned the role TESTROLE.

This is one of the FAQs ... you cannot use roles within stored procedures like Triggers are. They are disabled. If you need to store users in groups for query, then you need a table to enter them in.

But what's wrong with just testing on username? You wanted to check if the user created the record ... if you use the USER fantom column to enter the username into a column in the table upon creation, then just check on the USER against the :OLD.CREATED_BY column in the trigger and if they match accept. Otherwise reject.

Regards
Peter H. Larsen (petlars_at_pip.dknet.dk)
Oracle Consultant (not affiliated with Oracle) Received on Wed Jan 21 1998 - 00:00:00 CST

Original text of this message

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