My application requires to return at most 100 items in customer's shopping
cart. After browsing the manuals, I did not find a way to pass an array 
into/from a stored procedure. So here is what I could do:
========
create dbproc my_proc(in, out item1, out item2,...,out item100) as
begin
...
if $rc=0 then fetch into :item1 else stop(0,'no data');
if $rc=0 then fetch into :item2 else stop(0,'no data');
...
end;
=========
But when I load the stored procedure, I got segfault since the statement is 
too long. The question is: does SAPDB support array as input/output parameter 
to stored procedure? If not, any suggestions on how to get this done?

Another solution is using dynamic SQL, I have not investigated on that,
but my concern is since it is dynamic, the performance might not as good as 
stored procedure.

The third solution is still using stored procdure:
=======
create dbproc my_proc(in, out item) as
begin
select into :item from...
end;
=========  
Then in the client code, I have:
+++++++
strcpy(select, "CALL GETSCDETAIL(?,?,?,?)");
SQLPrepare (hstmt, select, SQL_NTS)
SQLBindParameter(...)
rc=SQLExecute()
if (rc== SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
 while(1) {
    rc=SQLFetch(hstmt);
  }
}
++++++++
SQLExecute returns 0, But SQLFetch returns: invalid cursor status.
Did I miss something? The same logic works fine with SQL (eg. SELECT).
but not with stored procedure.

Thanks in advance for your help!
Jenny 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to