>Daniel,
>Can you create the sequence and then just run a test on it outside the
>trigger. In other words, just try this:
>
>SELECT uniqueNum_s.nextval FROM dual;
>
>Does this work?

Hey Deanna,

I get "invalid character".  I'm using a form which takes the statement and puts it in a CF query.  Oh wait.  I removed the semi-colon and it executed the statement.  So yay! something worked.

>Here's an example of a trigger that I use for updates/inserts. On insert, it
>"auto-increments" the id field. On update, it checks to make sure someone
>isn't trying to change the primary key and raises an error if they do.

yeah that's what I'm trying to do.
In your example, is flpweb the table name or the datasource?  Then how-about cfs_breakfastdata?  Is breakfastdataid the column?  When I changed this to my own information, I get the error "insufficient priveleges" which makes me think that I'm using the values in the incorrect places.  For the top part of what you gave me, I transposed:

-- dpch is datasource
-- hhp_calendar is the table
-- id is the primary key updated by the sequence

CREATE OR REPLACE TRIGGER hhp_calendar.trg_hhp_calendar_id
BEFORE INSERT  OR UPDATE
ON hhp_calendar.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;
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to