SimonSellick
Programmer
Hi,
I've written a function that returns a user-defined type (a PL/SQL RECORD structure). It compiles OK (within a package that defines the type) and appears to work correctly.
What syntax do I need to use the function in an UPDATE statement (again, within the package)? I'm trying this form:
...but I'm getting an error returned: ORA00902 invalid datatype.
Here is an example that shows the problem:
spec
body
I suspect that the 'invalid datatype' error indicates that the function isn't returning a type that SQL knows about. Is there a way to do what I want to in straight SQL or will I have to resort to a cursor and collect the individual fields separately?
Any assistance welcomed.
Simon.
I've written a function that returns a user-defined type (a PL/SQL RECORD structure). It compiles OK (within a package that defines the type) and appears to work correctly.
What syntax do I need to use the function in an UPDATE statement (again, within the package)? I'm trying this form:
Code:
update tbl
set col1 = func(args).col1
, col2 = func(args).col2
;
Here is an example that shows the problem:
spec
Code:
.
.
.
type a_rec is record (
agent tbl.agent%type
, contract_ref tbl.contract_ref%type
);
.
.
.
Code:
.
.
.
create or replace function a (aa varchar2) return a_rec as
r a_rec;
begin
r.agent := 'FRED';
return r;
end;
.
.
.
select pkg.a('a').agent from dual;
.
.
.
Any assistance welcomed.
Simon.