Meno Abels wrote :
>Hello,
>i'am running a 7.4.3.14 database-server on linux, but i don't
>think that my problem depends to any enviroment specific. The
>problem is that dbproc's has a little different behavior than
>in db2 or oracle. In my case i create an procedure with the
>following:
> create dbproc GoForIt(out sum integer)
> AS
> VAR i1 integer;
> BEGIN
> select id from IdTable;
> while $rc = 0 do
> BEGIN
> FETCH INTO i1;
> SET sum = sum + i1;
> END;
> END;
>This isn't realy useful but to enought for demostrate the problem:
>If I create this procedure i get back:
> General error;-8031 POS(113) Owner must be specified.
>This is quite easy to solve i had to write:
> select id from MYDBUSER.IdTable;
>instead of
> select id from IdTable;
>But in my context i didn't know the name of MYDBUSER. With db2
>or oracle if no user is specified the current user is used
>and everything is fine, In sapdb I have to specify the user.
>I tried around with get_owner() but than i have dynamic sql(execute)
>in my procedure which increases the complexity without any
>need of it. Is there a way around these unlikely behavior
>difference?
>To solve these Problem on my site i have to parse the sql
>before it is transfered to the db in my application an add the
>username to the sql. This is very unattractive solution.
If you create a db-procedure, SAPDB compiles it into a byte code. This compilation
needs a unique identification of a tables accessed inside your procedure. This is why
you have to specify the table owner.
If you want to access the tables of the current user and you are ABSOLUTELY SURE, that
the table structures at compilation time and runtime are the same, you may use the
USER
function to specify the current user as table owner :
create dbproc GoForIt(out sum integer)
AS
VAR i1 integer;
BEGIN
select id from USER.IdTable;
while $rc = 0 do
BEGIN
FETCH INTO i1;
SET sum = sum + i1;
END;
END;
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
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general