Results 1 to 4 of 4

Thread: PL/SQL Error...

  1. #1
    Join Date
    Jan 2003
    Posts
    67

    Unanswered: PL/SQL Error...

    Hi any clues you can give me will be a big help.

    I get the following error on the third and last select in the group of statements below:

    ORA-06550 Line 10, Column 1:
    PLS-00428 an INTO clause is expected in this select statement.

    (tables are also below)
    Code:
    ============= CODE ============= 
    DECLARE 
    lng FLOAT; 
    lat FLOAT; 
    distance NUMBER := 500; 
    zip VARCHAR(64) := '19464'; 
    BEGIN 
    SELECT pqr INTO lng FROM (SELECT DISTINCT ((a.LONGITUDE)*180)/3.14 pqr FROM W6ADMIN.W6ZIPDATA a WHERE a.zipcode=zip); 
    SELECT pqr INTO lat FROM (SELECT DISTINCT ((a.LATITUDE)*180)/3.14 pqr FROM W6ADMIN.W6ZIPDATA a WHERE a.zipcode=zip); 
    
    SELECT a.*, 
    POWER((POWER((lat- (b.LATITUDE*180)/3.14),2)+POWER((lng-(b.LONGITUDE*180)/3.14),2)),.5) AS Distance 
    FROM W6ADMIN.W6ENGINEERS a, W6ADMIN.W6ZIPDATA b 
    WHERE RTRIM(a.POSTCODE)=RTRIM(b.zipcode) AND 
    (POWER((POWER((lat-(b.LATITUDE*180)/3.14),2)+POWER((lng-(b.LONGITUDE*180)/3.14),2)),.5)) <= distance 
    ORDER BY POWER((lat-(b.LATITUDE*180)/3.14),2)+POWER((lng-(b.LONGITUDE*180)/3.14),2); 
    
    END; 
    
    =========== END CODE ==============
    I figure that *INTO* has nothing to do with it. It is just a basic select statement.
    Code:
    ============== START TABLES ========= 
    CREATE TABLE W6ADMIN.W6ZIPDATA 
    ( 
    ZIPCODE VARCHAR2(64) NOT NULL, 
    LONGITUDE FLOAT NOT NULL, 
    LATITUDE FLOAT NOT NULL 
    ) 
    
    -- I removed most columns from this table since they really don't have anything to do with this. 
    CREATE TABLE W6ADMIN.W6ENGINEERS 
    ( 
    NAME VARCHAR2(255) NULL, 
    ID VARCHAR2(64) NULL, 
    REGION NUMBER NULL, 
    DISTRICT NUMBER NULL, 
    POSTCODE VARCHAR2(64) NULL 
    ) 
    
    ========== END TABLES ==========
    Thanks for your thoughts

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Exclamation

    An INTO is missing from this statement:

    Code:
    
    SELECT a.*, 
    POWER((POWER((lat- (b.LATITUDE*180)/3.14),2)+POWER((lng-(b.LONGITUDE*180)/3.14),2)),.5) AS Distance 
    INTO .....What?
    FROM W6ADMIN.W6ENGINEERS a, W6ADMIN.W6ZIPDATA b 
    WHERE ...
    
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Jan 2003
    Posts
    67

    Hummmm

    I didn't realize that it had to be "into" someting can't I just select the data to view it?

    Thanks

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Lightbulb

    Yes, but not inside a pl/sql block.
    All selects in a pl/sql block require an INTO ... statement (except for some cursors).

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •