Redian新闻
>
PL/SQL function 使用求教?
avatar
PL/SQL function 使用求教?# Database - 数据库
f*e
1
我要计算两点间距离,需要用到built-in function POWER and SQRT,
下面的code 该如何调用这些函数修改?
create or replace type Point as object(
X float,
Y float
);
/
create or replace type Line as object(
SP point,
EP point,
member function length return FLOAT, /* get line length */
pragma restrict_references(length,WNDS,WNPS)
);
/
create or replace type body Line as
member function length return FLOAT is
dx float; -- x direction distance square
dy float; -- y direction distance squa
avatar
n*a
2
create or replace type body Line as
member function length return FLOAT is
dp float; -- real distance
begin
SELECT SQRT(POWER((sp.x-ep.x),2)+POWER((sp.y-ep.y),2)) into dp FROM
DUAL;
return dp;
end;
end;
/

【在 f***e 的大作中提到】
: 我要计算两点间距离,需要用到built-in function POWER and SQRT,
: 下面的code 该如何调用这些函数修改?
: create or replace type Point as object(
: X float,
: Y float
: );
: /
: create or replace type Line as object(
: SP point,
: EP point,

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。