Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

sql - Exceeding the permissible coordinate zone

I work in apex oracle, I have a table with geo-coordinates and objects. When I seal this object, I fill out the form. When I fill out this form, I select an object from the LoV from the "test1" table, also in the form of automatically pulling my location into cells P1_long, and P1_lati. I wish that when I stored this form in the "test2" table, I calculated the difference of geo-coordinates between the geodata that is in the "test1" table and in my form. And if this difference is more than -+0.001 then an entry was made in the table "ero_tabel" that the geo-coordinates are violated I created a dynamic promotion, and I'm trying to write something like this

CREATE TABLE test1
(
objects_name  varcahar2(10),
geo-latit varcahar2(20),
geo-long varcahar2(20)
);
INSERT INTO test1
     VALUES ('House', '60.2311699999996', '12.454977900000003');
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I can see a few issues (need a variable to hold the data, a query can not be directly used in IF) in your code and Updated your code block as follows:

DECLARE
    LV_GEO_LONG   TEST1.GEO_LONG%TYPE; -- variable to hold geo_long
BEGIN
    SELECT
        GEO_LONG
    INTO LV_GEO_LONG -- storing geo_long value to newly defined variable
    FROM
        TEST1
    WHERE
        OBJECTS_NAME = P1_SEALING_OBJECT;

    IF ABS(TO_NUMBER(:P1_LONG) - LV_GEO_LONG) > 0.001 THEN -- checking for the difference
        INSERT INTO EROR_TABLE VALUES (
            '1',
            SYSDATE,
            P1_SEALING_OBJECT
        );
    END IF;

END;
/

Cheers!!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...