> Daniel chopped it off in his version

yeah since I was getting errors, I was trying to simplify to determine the problem.

>flpweb is not the CF datasource, per se, though in your set up, it might be.
>It's actually the oracle user account.

ah that makes a world of difference.  It's scoped.  We don't seem to have users of a table; I don't generally include un/pwd.

>The other two you are correct on. However, if you're getting the
>insufficient privs error, I would say that you got the general info correct.
>Let's take CF out of the picture for a moment. In your Oracle account (via
>sqlplus or Toad or whatever tool you use), log in as the user that owns the
>table you're going to update.
>Run the trigger script.

I don't have access to the GUI tools here at the college.  Our IT has told my partner here that they're insecure so off-limits.  Really doesn't help, since I'm a DB novice.

Nonetheless, I got the command to make the trigger work using your original code, which was easy once I realized there was no 'user'.  It told me that it executed.  I did:
-----
CREATE OR REPLACE TRIGGER trg_hhp_calendar_id
BEFORE INSERT
ON hhp_calendar
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
����iCounter hhp_calendar.id%TYPE;
����cannot_change_counter EXCEPTION;
BEGIN
����IF INSERTING THEN
��������Select uniqueNum_s.NEXTVAL INTO iCounter FROM Dual;
��������:new.id := iCounter;
����END IF;

����IF UPDATING THEN
��������IF NOT (:new.id = :old.id) THEN
������������RAISE cannot_change_counter;
��������END IF;
����END IF;

EXCEPTION
���� WHEN cannot_change_counter THEN
�������� raise_application_error(-20000, 'Cannot Change Counter Value');
END;
/

---------
btw, it didn't like the "BEFORE INSERT��OR UPDATE".  I had to delete the OR UPDATE, so I guess I shouldn't have included the "IF UPDATE" part.  oh well, no real harm.

Now the bad part.  When I try to insert a new record, I receive an error, "[Macromedia][Oracle JDBC Driver][Oracle]ORA-04098: trigger 'DPCH.TRG_HHP_CALENDAR_ID' is invalid and failed re-validation".

Also, in the INSERT, I fill in an entry for ID, which is also being filled by the trigger.  I just figured that the trigger would toss it.  True?  The insert looks like:

INSERT INTO HHP_CALENDAR
      (id,header,http,description,dateAdded,event_date,image)
     VALUES    (6,'#Form.header#','#Form.http#','#Form.description#',#the_date#,#the_event_date#,'#Form.image#')
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to