Jean-Michel OLTRA wrote :

>> You are asking for dynamic sql having parameters inside a db-procedure ?
>> Sorry, this is still not possible.
>> But you may return a cursor created by a dynamic sql statement. Example :
>I know, I "just" want to fetch such a cursor in an OUT parameter.
>the resultset is one value: one row:one column resultset

So you want to do something like this ?

create dbproc test (in stmt char(100), out val integer) as
execute stmt;
fetch into :val;

in this case you will get error -4000, unknown result name, because the
result cursor does not exist a compile time. 
As a workaround you may introduce some dirty code to force compilation :

create dbproc test (in stmt char(100), out val integer) as
if false
then
  begin
  create table temp.dummy (dummy int);
  select * from temp.dummy;
  end;
execute stmt;
fetch into :val;

However, this is dangerous, because you have to ensure that the statement 
returns a resultset having exactly one column of the data type of the output parameter
at execution time.
If this is not true, unpredictable errors may occur.

Actually you need dynamic sql with parameters, but this feature is not available yet.  
 
Regards,
Thomas

-- 
Thomas Anhaus
SAP DB, SAP Labs Berlin
[EMAIL PROTECTED]
http://www.sapdb.org/
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general



-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to