0
votes

I'm trying to insert a distance value returned by the SELECT statement, however, I'm getting the following error -

ORA-06550: line 12, column 9: PL/SQL: ORA-00936: missing expression ORA-06550: line 9, column 5: PL/SQL: SQL Statement ignored

DECLARE
    l_lat VARCHAR2(100);
    l_lng VARCHAR2(100);
    l_postcode VARCHAR2(8) := :P2_POSTCODE;

BEGIN
    brian.GEOCODE_GM_XML (l_postcode, l_lat, l_lng);

    INSERT INTO RESTAURANTS_IMAGES_VIEW (DISTANCE)
    VALUES 
    (
        SELECT SDO_GEOM.SDO_DISTANCE
        (a.location,
        SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(l_lat, l_lng, null), null, null), 0.005) distance
        FROM RESTAURANTS_IMAGES_VIEW a
    );
END;

Is there any mistake I'm making here?

1

1 Answers

0
votes

If SDO_GEOM.SDO_DISTANCE is a procedure and inside of the brakets you want to give the specific parameters based on the query, please put SELECT in front of a.location. Moreover, what do you want to do is this:

insert into restaurants_images_view(distance) select... from..

You do not have to use values after insert.