Here is a standalone anonymous block one could execute in PL*SQL:
- Code: Select all
DECLARE
ts TIMESTAMP;
BEGIN
ts := SYSTIMESTAMP;
:outTS := ts;
END;
. . . to execute it from ST, one would do (in a workspace):
- Code: Select all
connection := AbtDbmSystem activeDatabaseConnection
flushCache;
autoCommit: true;
commitUnitOfWork;
yourself.
wStream := WriteStream on: String new.
wStream
nextPutAll: 'DECLARE '; cr;
nextPutAll: 'ts TIMESTAMP; '; cr;
nextPutAll: 'BEGIN '; cr;
nextPutAll: 'ts := SYSTIMESTAMP; '; cr;
nextPutAll: ':outTS := ts; '; cr;
nextPutAll: 'END; '.
timeStampName := 'outTS'.
inOutParams := AbtCompoundType new
addField: (AbtOracle10TimeStampField new
name: timeStampName).
aDict := Dictionary new.
aDict
at: timeStampName
put: (AbtTimestamp now
date: (Date today addDays: 3);
yourself).
anonymousBlockSpec := AbtAnonymousBlockSpec new
plSqlString: wStream contents;
useSqlCall: true;
parameters: inOutParams.
resultSet := connection invokeAnonymousBlockSpec: anonymousBlockSpec withInputDictionary: aDict.
resultSet
--tc