Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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!!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...