> -----Original Message-----
> From: Anu Comar/Radsystems [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 12, 2003 3:52 PM
> To: Holland, John
> Subject: Re: Insert trigger
> 
> 
> 
> 
> 
> 
> 
> Hi John,
> 
> Thanks for your help.  I would like to create an Insert trigger before
> inserting the value in the table for a column from a sequence 
> that I have
> created( I don't want to have the datatype defined as integer 
> serial) .
> e.g.
> 
> create sequence seq_sce_tab
> INCREMENT BY 1
> START WITH   1
> NOMAXVALUE
> NOCYCLE
> CACHE 10
> 
> 
> CREATE TABLE SEQ_TEST (
>                   ROW_ID                INTEGER  not null,
>                   PROD_GRP             CHAR(10) NOT NULL,
>                   PROD_GRP_DESC        VARCHAR(32),
>                   SITE_NO              DECIMAL(10))
> 
> CREATE TABLE SEQ_TESTA (
>                   ROW_ID                INTEGER  not null,
>                   ITEM          CHAR(10) NOT NULL,
>                   ITEM_DESC        VARCHAR(32),
>                   SITE_NO              DECIMAL(10))
> 
> Now I would like to create a trigger/s which will execute 
> before I insert
> into any of the above tables and put the nextval into the 
> row_id column of

in sapdb there are no before insert triggers. one can however, emulate these
with the insert trigger and an update statement with an ignore trigger
suffix.


> the tables from the sequence that is created above by adding 1 to the
> last_number field of the sequence.
> 
> Please advise.
> 
> Thanks
> Anu
> 
> 
> 
> 
> 
> 
> 
>                                                               
>              
>              "Holland, John"                                  
>              
>              <john.holland@ban                                
>              
>              cotec.de>                                        
>           To 
>                                        
> "'[EMAIL PROTECTED]'"        
>              12/02/2003 05:58          
> <[EMAIL PROTECTED]>          
>              AM                                               
>           cc 
>                                                               
>              
>                                                               
>      Subject 
>                                        Re: Insert trigger     
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
>                                                               
>              
> 
> 
> 
> 
> 
> "Anu Comar/Radsystems" <[EMAIL PROTECTED]> schrieb im 
> Newsbeitrag
> news:OFF996AD5A.36A7E577-ON85256CCA.00731DDC-85256CCA.00739044
@radsystems.co

m...
>
>
>
>
> Hi,
>
> How can I create an insert trigger on table "TEST" which has say three
> columns i.e
>
> rowid, site, description.
>
> I also want the rowid to get the next value i.e. old.rowid +1.
select TEST.nextval from sysdba.dual
>
> Please advise.  Any example I see on the SAP site is for update
trigger!!!
http://www.sapdb.org/ <doc path>
/da/ed9036dfe4b903e10000009b38f889/frameset.htm
insert trigger cannot have any any columns defined as with update triggers
and the trigger event is insert
i.e.

create trigger test_insert_trigger for [user.]TEST after insert execute (
<do something useful>
select TEST.nextval from sysdba.dual;
<do something else useful>
)

>
> Thanks
> Anu Comar

hth,

john

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

Reply via email to