statement

NAME
SYNTAX
DESCRIPTION
SIMPLE STATEMENTS
NOTES
COPYRIGHT
SEE ALSO

NAME

statement − RWP*Load Simulator statement syntax

SYNTAX

statement ::=
  simpledeclaration
| identifier ( [ concatenation { , concatenation } ] ) [ atclause ]
| identifier ( := | ||= | += ) concatenation
| identifier ( <= | >= | >>= | >|= | <|= ) concatenation
| null [ concatenation ]
| return [ concatenation ]
| exit concatenation
| break
| shift
| wait expression
| system concatenation [ , identifier ]
| getrusage
| regexsearch
| regexsubstitute
| regexextract
| compoundstatement
| filestatement
| printfstatement
| databasestatement
| sqlstatement
| identifier [ atclause ]
| abort

terminatedstatement ::=
  statement ;
| embeddedsqltext
| embeddedsqltext atclause ;

statementlist ::= { terminatedstatement }

DESCRIPTION

Executable statements are either simple declarations, assignments, procedure calls, and many more that execute actual code. They can be nested which is used for loops, procedure bodies, etc. Statements are terminated by a semicolon, and cannot be empty, so there are never two semicolons following each other.

SIMPLE STATEMENTS

identifier( ... )

An identifier followed by a potentially empty list of comma-separated expressions inside a set of parentheses is a procedure call. If an at clause is provided, the execution will be against the specified database.

assignment

An identifier followed by one of the assignment operators and a concatenation modifies the variable on the left side. The := operator is an ordinary assignment, the += operator adds the value of the concatenation to the variable, the ||= operator appends the value of the concatenation to the variable. Data types can be freely mixed in rwloadsim, and if you assign an empty string or a string that contains only white space characters to an integer or a double, the variable will be set to null.

Assignments are not expressions, so you cannot do something like:

a := b := 0;

The assignment operators >=, >>=, <=, >|=, <|= are used with files to respectively open for write, append, read, write to a pipeline or read from a pipeline. See filestatement(1rwl) for details.

null

The null command does nothing. If it is followed by a concatenation that concatenation is calculated and its result is ignored.

return

Return execution from a procedure or a function. In a function the return keyword must be followed by a concatenation which will be the return value.

break

Break out of the innermost loop or execute block and continue execution after the end keyword that finishes that loop or execute block. If the loop is a cursor loop, the cursor will be canceled.

exit

Exit from your rwloadsim program with the provided exit value; this cannot be done from inside a procedure or function. If you do not have an explicit exit, the exit code will be zero if there are no syntax or runtime errors, otherwise non-zero. Note that if there are syntax errors in your code before an exit statement, the exit statement may not be executed.

shift

Shift positional arguments $2, $3, etc. once to the left and reduce the argument counter $# by one. Note that the right most argument will stay unchanged.

wait

Suspend execution for a number of seconds which is a double. If a database session is held, the session will not be released during the wait. If the expression is zero or less, there is no wait.

system

The concatenation will be executed as an operating system command. If a comma and an identifier is present, the identifier must be a string and stdout from the command will be saved in it after removing any terminating newline. Note that the exit code from the operating system command will be ignored; if you need the return value, use the system function in stead.

getrusage

Call the getrusage function filling in values for the usrseconds and sysseconds variables.

abort

Perform an immediate abort of the rwloadsim program by simply calling exit(3). This should only used in abnormal circumstances.

statementlist

A statement list is a potentially empty sequence of statements each followed by a terminating ;. They are used in compound statements such as procedures, loops, etc.

identifier

An identifier that is not followed by an open parenthesis must be a SQL statement, see sqlexecution(1rwl).

NOTES

The run keyword that initiates a thread execution is not a statement. It can therefore not be used inside if/then/else, procedures or the like; it can only be a program element. If you need your code to support multiple different thread exeuctions, you can use conditional compilation.

COPYRIGHT

Copyright © 2023 Oracle Corporation
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

SEE ALSO

rwlprogram(1rwl), simpledeclaration(1rwl), regexsearch(1rwl), regexsubstitute(1rwl), regexextract(1rwl), compoundstatement(1rwl), filestatement(1rwl), printfstatement(1rwl), sqldeclaration(1rwl), sqlexecution(1rwl), sqlstatement(1rwl), atclause(1rwl), databasestatement(1rwl), expression(1rwl), concatenation(1rwl), rwloadsim(1rwl), conditional(1rwl)