[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Using Stored Procedures within SQR with temp_tables.



I have a question about using stored procs within SQR with temp_tables.  Here
is my problem.

I have one stored proc that manipulates several temp_ tables.

When the stored proc finishes I have 2 temp tables.

I then want to step through the first temp_table and while I am stepping
through that table
I want to call a SQR procedure that will then step through the second table.
I have a one to many relationship between the two tables.

in code it looks something like this..

begin-sql -C1
create table ##table1
create table ##table2
end-sql

execute -C1
   @#rc = my_proc

I then want to enter a begin-select statment

begin-select -C1

company &company

  do process_table2

from ##table1
end-select


Begin-Procedure
begin-select -C1

more_data &more_data

from ##table2
where company=&company
end-select
End-Procedure

what happens is I get an error message back saying that:

requested -C database connection is already active.


I understand what the problem is, I am trying to enter two begin-selects with
the same connection number (C1).

I would like to know if there is a way I can make this work !

I tried creating the two tables with different connections, but there is know
way to tell the stored proc that I want to use two connections.
So the stored proc call bombs out saying that it can't find one of the tables.

I am running SQR 3.0.8 under SYBASE. 10.0.2.

Any help would be greatly appreciated.

Thanks,
John Palmieri