Need conditional execution of DECLARE AT

From: Bill Ford <wwford_at_ingr.com>
Date: 5 Oct 1994 18:57:39 GMT
Message-ID: <36usv3$mv_at_b23a.b23a.ingr.com>


I have a situation in Oracle 7, where, if a condition is true, I want to do a DECLARE AT ... STATEMENT so that all transactions will be performed on a remote kernal. i.e.:

if (cond)
{

	EXEC SQL DECLARE db_name DATABASE;
	EXEC SQL AT db_name DECLARE ORASTATEMENT STATEMENT;
}

At this point, I have already assigned the "T:remote_node:SID" string to a db_string and done a CONNECT AT db_name USING db_string (if the cond(ition) is true).

Anyway, this worked fine when the cond(ition) was true. Unfortunately, when the condition was not true, the transactions were STILL being performed against the remote database. The mere presence of the above two lines caused the transactions to be re-routed, even though they exist inside a "non-executed" logical branch.

SO...I guess that means at pre-compile time, the pcc compiler sees those lines, and does some razzmatazz with them, regardless of their place in the code.

Does anyone know any way of getting "conditional" execution of the DECLARE AT functionality?

Bill Ford
wwford_at_ingr.com
Intergraph Corporation Received on Wed Oct 05 1994 - 19:57:39 CET

Original text of this message