Hi,
 
in a trigger/dbproc do NOT use a semicolon just in front of an ELSE.
 
Elke
SAP Labs Berlin
 
-----Original Message-----
From: Brandon Kohn [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 18. Oktober 2001 19:55
To: [EMAIL PROTECTED]
Subject: SQL trigger error

Hi Guys,
 
I'm trying to figure out the syntax for writing a trigger.  I have an error in the following trigger from SQl Studio:
 
create trigger insert_profile for profiles after INSERT execute (
 VAR $j int;
 $nstep FLOAT;
 $vlow FLOAT;
 $vhigh FLOAT;
 $dv FLOAT;
 $flim FLOAT;
 $v FLOAT;
 $dfold FLOAT;
 $df FLOAT;
 $vmean FLOAT;
 BEGIN
  SET $j = 0;
  SET $nstep = 300.0;
  SET $vlow = 0.0;
  SET $vhigh = 4.0;
  SET $dv = ($vhigh-$vlow)/$nstep;
  SET $flim = 0.01;
  SET $v = 0.0;
  SET $dfold = 0.0;
  SET $df = 0.0;
  WHILE ($v < $vhigh AND $j < 2) DO BEGIN
      WHILE ($v < $vmean AND $df <= $dfold) DO BEGIN
    SET $v = $v+ $dv;
    SET $dfold=$df;
    SET $df = EXP(par1 * ($v -par0) + par2 * POWER($v-par0,2) + par3 * POWER($v-par0,3));
    IF ($j = 0 AND $df > $flim) THEN BEGIN
     SET minimum = $v-$dv;
     SET $j = $j+1;
    END;
    ELSE IF ($j = 1 AND $df < $flim) THEN BEGIN
     SET maximum = $v - $dv;
     SET $j = $j+1;
    END;
   END;
  END;
 END;
)
 
The error is the following:
 
Native error: -5015
Text: [sap ag][sqlod32 dll][sap db]Syntax error or access violation;-5015 pos(779) Missing keyword:begin,try,select,set,fetch,declare,continue,close,break etc...
 
I've never been much for following replacement rules well (the syntax description in the manual).. is there some obvious error here that I'm not seeing?
 
Thanks
Brandon Kohn
+377 97 97 41 50 ext. 306 (Work)
+377 97 77 86 71 (Home)
Monaco

Reply via email to