I'm attempting to write a stored procedure in Oracle (which I have come to hate (beside the point)) When executing the stored proc I'm told I've retrieved too many rows (eg. more than 1), but when querying the data via text, it tells me clearly that only one row matches this criteria.
create or replace PROCEDURE GETADDRESSCOORDS ( HOUSE IN VARCHAR2 , STREET IN VARCHAR2 , X OUT NUMBER , Y OUT NUMBER ) AS BEGIN SELECT X_COORD, Y_COORD INTO X,Y FROM MASTER_ADDRESS WHERE HOUSE=HOUSE AND STR_NAME=STREET AND PRE_DIR IS NULL; END GETADDRESSCOORDS;
When run, I receive this error msg:
SQL> execute getaddresscoords('1550', 'BEDFORD', :X, :Y) BEGIN getaddresscoords('1550', 'BEDFORD', :X, :Y); END; * ERROR at line 1: ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at "TAXLOTS.GETADDRESSCOORDS", line 9 ORA-06512: at line 1
So I got too many rows...but when I execute this:
SQL> SELECT MAX(rownum) from MASTER_ADDRESS where HOUSE='1550' AND STR_NAME='BEDFORD' AND PRE_DIR IS NULL; MAX(ROWNUM) ----------- 1
what am I missing here?