Executes the parameterised prepared SQL statement represented by Cursor, previously prepared by session_sql_prepare/4 or session_sql_prepare_query/5. The parameter values for this execution is supplied by Tuple.
Tuple is a structure whose name and arity match the parameter template when Cursor was prepared, and the arguments give the values for the parameters for this execution, and must be compatible with the type specified by the template, except that an argument can be an uninstantiated variable, to denote a NULL value for the corresponding parameter.
If the SQL statement is a query, then it should be prepared as a query using session_sql_prepare_query/5, and results can be obtained from the query by the cursor_*_tuple family of predicates. A dbi_bad_template error would be raised if the query was prepared with session_sql_prepared/4, because no result tuple template was specified.
This predicate is called with default options for the cursor, i.e. it is equivalent to calling cursor_next_execute/3 with an empty Options list.
% note '?' in SQL in the syntax MySQL uses for placeholders. This may be % different in other DBMS transfer_(Session, Amount, FromAccount, ToAccount) :- SQL = "update accounts set balance = balance + ? \ where id = ?", Deduct is - Amount, % incbal(1.0,12) is the parameter template session_sql_prepare(Session,incbal(1.0,12),SQL,Update), cursor_next_execute(Update,incbal(Deduct,FromAccount)), cursor_next_execute(Update,incbal(Amount,ToAccount)).