Trigger Question

Discussion forum about all things SqlBase or SqlTalk
EwaldP
Austria
Posts: 351
Joined: 07 Mar 2017, 08:00
Location: Austria

Trigger Question

Post by EwaldP » 11 Nov 2022, 11:58

Hi,

I'm an absolute newbie in triggers and stored procedures. I want to try the sample from the documentation but the sample shows the error "Error: 09938 PRS IPS Procedure section (name) expected".
SQLBase 12.1

Any hints are welcome
Ewald

CREATE TABLE PRESIDENT
(PRES_NAME varchar(20) not null,
BIRTH_DATE date,
YRS_SERV integer,
DEATH_AGE integer,
PARTY varchar (20),
STATE_BORN varchar(20));

CREATE TABLE ELECTION
(ELECTION_YEAR smallint,
CANDIDATE varchar(20),
VOTES float,
WINNER_LOSER_INDIC char(1));


CREATE TRIGGER TRG_NEWPRES
after insert on SYSADM.PRESIDENT
(execute inline (1792,'Jefferson T',4,'L')
PROCEDURE: PROC_NEWPRES static
Parameters
Number: nElecYear
String: sCandidate
Number: nVotes
String: sWinLose
Local Variables
Sql Handle: hSqlCur
Actions
On Procedure Startup
Call SqlConnect(hSqlCur)
Call SqlPrepare(hSqlCur, 'Insert into \
sysadm.election values \
(:nElecYear, :sCandidate, :nVotes, :sWinLose)')
On Procedure Execute
Call SqlExecute(hSqlCur)
On Procedure Close
Call SqlDisconnect(hSqlCur)
)
for each statement;
Ewald P. Palmetshofer
EDV-Hausleitner GmbH
4020 Linz
www.edv-hausleitner.at

User avatar
Steve Leighton
Site Admin
Site Admin
New Zealand
Posts: 442
Joined: 05 Mar 2017, 20:57
Location: Stroud, England <--> Tauranga, New Zealand

Re: Trigger Question

Post by Steve Leighton » 13 Nov 2022, 02:45

.
Its all about the indentation.
The Trigger and Proc compile fine once you get the indentation correct :
Its a lot easier to use SqlCommand Centre sbccntr.exe to format your Script, rather than SQLTalk.
SQLBase will come up with any weird and wonderful errors when 99% of the time - its the indentation which has to be spot-on.

The following complies, and the only change I made was the indents.:
Trigger.JPG
You do not have the required permissions to view the files attached to this post.
Greetings from New Zealand
Steve Leighton

Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand

www.banksidesystems.co.uk

Image

Return to “SqlBase General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests