>2. I am trying to create a trigger and I am getting various different
>error. Please help. Below is how I would create it in oracle. How do I
>create the same trigger in sapdb.

>create or replace trigger identity_CMQ_IN_QUEUE before insert on
>CMQ_IN_QUEUE
>for each row
>begin
>  /*
>  ** --- Get the next value  ---
>  */
>  select seq_CMQ_IN_QUEUE.NEXTVAL into :new.ID from dual;
>end;

It seems, that you just want to generate the keys of CMQ_IN_QUEUE automatically.
If you don't depend on that specific sequence seq_CMQ_IN_QUEUE, you may
create the key of CMQ_IN_QUEUE as datatype SERIAL, which will produce
ascending keys without an insert trigger. 

If you depend on sequence seq_CMQ_IN_QUEUE, you can try to
simulate the behavior by an AFTER trigger :

create trigger identity_CMQ_IN_QUEUE for CMQ_IN_QUEUE after insert execute
(
  update CMQ_IN_QUEUE set id = seq_CMQ_IN_QUEUE.NEXTVAL 
         WHERE SYSKEY = :SYSKEY;
  if $rc <> 0
  then
      stop ($rc);
)

This solution assumes, that table CMQ_IN_QUEUE has no user
defined key.

Thomas

-- 
Thomas Anhaus
SAP DB, SAP Labs Berlin
[EMAIL PROTECTED]
http://www.sapdb.org/
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to