cancel
Showing results for 
Search instead for 
Did you mean: 

cursor not open

0 Kudos
3,813

I created the following procedure in IQ

create procedure stage.test_proc
as
begin
declare @sql nvarchar(1000)
select @sql = 'select top 10 * into #temp from systable' execute(@sql)
select * from #temp
end

But I go the following error when I execute sp in interactive sql. what did I do wrong

Cursor not open SQLCODE=-180, ODBC 3 State="34000"

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Sybase IQ is SAP IQ.

justin_willey
Participant
0 Kudos

Yes - but this forum is concerned with SAP SQL Anywhere - a different product. There are some similarities in some of the tools but you are more likely to get help on a forum where people use the product you are asking about.

The problem could be with your

select @sql='select...'
statement. You could try using
SET @SQL='select....'

In Watcom-SQL syntax (rather than T-SQL that you seem to be using) this works (on SQL Anywhere v11.0.1):

alter procedure test_proc()
RESULT ( table_id unsigned int ,file_id smallint ,count unsigned bigint ,first_page smallint ,last_page int ,primary_root int ,creator unsigned int ,first_ext_page smallint ,last_ext_page smallint ,table_page_count int ,ext_page_count int ,object_id unsigned bigint ,table_name char(128) ,table_type char(8) ,view_def long varchar ,remarks long varchar ,"replicate" char(1) ,existing_obj char(1) ,remote_location long varchar ,remote_objtype char(1) ,srvid unsigned int ,server_type char(7) ,primary_hash_limit smallint ,page_map_start smallint ,source long varchar ,"encrypted" char(1)  ) 
begin 
declare @sql nvarchar(1000); 
set @sql = 'select top 10 * into #temp from systable';
execute immediate @sql; 
select * from #temp 
end