Hi Steve,
There are 2 solutions:
1. try to add "COMMIT ON RETURN YES"
Create Or Replace Procedure HSCOMMON10.TESTCOMMIT()
Language Sql
Modifies Sql Data
Commit On Return Yes
Set Option Commit=*CHG
Begin Atomic
Create Table HSCOMMON10.TESTCOMMIT (MYINT Integer, MYCHAR
Varchar(10));
End;
2. start the compound statement with BEGIN NOT ATOMIC and include a COMMIT
in your source code
Create Or Replace Procedure HSCOMMON10.TESTCOMMIT()
Language Sql
Modifies Sql Data
Set Option Commit=*CHG
Begin Not Atomic
Create Table HSCOMMON10.TESTCOMMIT (MYINT Integer, MYCHAR
Varchar(10));
Commit;
End;
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve
Richter
Sent: Dienstag, 5. September 2017 18:20
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: commit inserts made in SQL procedure
running an SQL procedure that creates a new table from the resulting rows of
a select statement. The code runs, but then when I signoff the system is
deleting the table. I guess because of commitment control.
how do I commit changes made in an SQL procedure?
I am using "set option commit = *chg" . Which I read says the sql
procedure should auto commit its changes. But the auto commit is not
happening.
Running the COMMIT command, the system comes back and says COMMIT defn not
found. But I WRKJOB option 16 commitmet control status, and there are two
committment definitions.
Commitment
Definition Text
APLUS Activation-group-level
QDBAGILE Activation-group-level
here is the SQL procedure:
CREATE or replace PROCEDURE SRICHTER/cca_hsdetCca(
)
LANGUAGE SQL
MODIFIES SQL DATA
set option commit = *chg
BEGIN atomic
declare vSqlCode decimal(5,0) ;
declare sqlCode int DEFAULT 0 ;
DECLARE VMSG CHAR(256) ;
DECLARE VCMDSTR CHAR(256) ;
DECLARE DUMMY INTEGER ;
declare vPrCatNum int ;
create table srsql/hsdetcca as (
select a.*, b.cmcscl cscl, b.cmcssc cssc
from hsdetv1 a
join cusms b on a.csno = b.cmcsno and b.cmcono = 1
where b.cmcscl = '05' and year(a.ivdate) >= 2016
and a.litp = 'I' or ( a.litp = 'C' and a.itno = '&6' )
) with data ;
END
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.