说我有这个对象类型:
create or replace
TYPE "InvestorInfoObject" AS OBJECT
(
"InvestorAccount" Varchar2(15 Char),
"InvestorSeqNo" NUMBER(15,0),
"FirstName" VARCHAR2(50 CHAR) ,
);
我需要一个函数来从不同的表中选择一些值并返回一个“InvestorInfoObject”。像这样的东西:
create or replace
FUNCTION "GetInvestorInfo"
(
Par_InvestorAccount "Pos"."InvestorAccount"%Type
)
Return "InvestorInfoObject" As
investorObj "InvestorInfoObject";
Begin
Select
"InvestorInfoObject"(InvAccounts."InvestorAccount",InvAccounts."InvestorSeqNo",Individuals."FirstName")
into investorObj
From "InvestorAccounts" InvAccounts
Inner Join "Individuals" Individuals
On InvAccounts."InvestorSeqNo"=Individuals."Seq"
Where "InvestorAccount"=Par_Investoraccount;
RETURN Investorobj;
END "GetInvestorInfo";
但这导致错误“错误(17,5):PL / SQL:忽略SQL语句”。这样做的正确语法是什么?
答案 0 :(得分:0)
如果您要求返回多个可以使用集合
完成的值可以使用
声明
type student_mark是整数的varray(10);
x student_mark;
function double_marks(x student_mark)return
student_mark是
y student_mark;
开始
y:= x;
for i in 1..x.count loop
y(i):= 2 * y(i);
结束循环;
返回y;
端;
开始
x:= student_mark(156,206,360);
DBMS_OUTPUT.PUT_LINE(double_marks(X)(1));
DBMS_OUTPUT.PUT_LINE(double_marks(X)(2));
DBMS_OUTPUT.PUT_LINE(double_marks(X)(3));
端;
在这里你也可以使用object而不是varray。一旦我执行了
,我会回复你您提供的代码