Data type for storing latitude and longitude in oracle database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:38:09

问题


I want to store latitude and longitude in oracle db. Which data type its good to use it for both these fields. I really appreciate for your reply.

"latitude": 48.858844300000001,
"longitude": 2.2943506,

回答1:


Each column would be NUMBER(x+3,x) where x is the maximum number of decimal places you would ever wish to store (48.858844300000001 is VERY precise).




回答2:


CREATE TABLE cola_markets ( mkt_id NUMBER PRIMARY KEY, name VARCHAR2(32), shape SDO_GEOMETRY);

And for point

CREATE TYPE sdo_point_type AS OBJECT ( X NUMBER, Y NUMBER, Z NUMBER); CREATE TYPE sdo_elem_info_array AS VARRAY (1048576) of NUMBER; CREATE TYPE sdo_ordinate_array AS VARRAY (1048576) of NUMBER;

For inserting and select queries please read Oracle document here



来源:https://stackoverflow.com/questions/38374775/data-type-for-storing-latitude-and-longitude-in-oracle-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!