oracle spatial中的sdo_point为什么不能写入变量

qq_29501865 2018-06-05 11:16:01
decalre
lon integer:=5;
lat integer:=1;
begin
insert into tempdatapool(id,MMSI,receivetime,location) values(
6,
231,
to_date('2016-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'),
sdo_geometry(2001,8307,
sdo_point_type(8,12,null),--x,y的位置必须填写数字吗,怎么能把lon和lat的值写进去呢
null,null
));
end;
...全文
1233 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2018-06-05
  • 打赏
  • 举报
回复
把你的完整语句贴出来,包括建表语句,还有你的数据库版本也说一下。
qq_29501865 2018-06-05
  • 打赏
  • 举报
回复
我试过啊,报错:列在此处不允许
卖水果的net 2018-06-05
  • 打赏
  • 举报
回复

-- 直接写就可以了
SQL> 
SQL> create table test(id int, location sdo_geometry);
Table created
SQL> declare
  2    lon integer := 5;
  3    lat integer := 1;
  4  begin
  5    insert into test(id, location)
  6    values(6,
  7       sdo_geometry(2001,
  8                    8307,
  9                    sdo_point_type(lon, lat, null),
 10                    null,
 11                    null));
 12  end;
 13  /
PL/SQL procedure successfully completed
SQL> col id format a10;
SQL> select * from test;
        ID LOCATION
---------- --------
         6 <Object>
SQL> drop table test;
Table dropped

SQL> 

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧