Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Want to test my MAP function

Re: Want to test my MAP function

From: mcstock <mcstockspamplug_at_spamdamenquery.com>
Date: Fri, 21 Nov 2003 14:05:16 -0500
Message-ID: <sfWdnfwvDLSd_yOiRVn-gQ@comcast.com>


the cause of the error is exactly as stated in the error text -- your SELECT ... FROM STUDENT_TABLE is trying to populate STUDENT_MEMBER with more than one row

1st thing -- try putting a WHERE clause on your SELECT to return just a single row, or use an explicit cursor or cursor loop to handle one row at a time

"James" <Jimbo_at_yahoo.com> wrote in message news:bplmv7$eva$1_at_titan.btinternet.com...
| I have created the following simple MAP function:
|
| MAP MEMBER FUNCTION getLname RETURN VARCHAR2 IS
| BEGIN
| RETURN (LastName);
| END;
|
| but am not sure how to use it. Here is the type it was created for:
|
| CREATE OR REPLACE TYPE student_type AS OBJECT
| (FirstName varchar2(15),
| LastName varchar2(15),
| Address address_type,
| Contact contact_type,
| DateOfBirth date,
| Nationality varchar2(15),
| AttendanceMode varchar2(15),
| StudentNo varchar2(15),
| Userid varchar(15),
| FeeStatus varchar2(25))
| /
|
| I have tried the following PL/SQL block but get the error described below:
| declare
| student_member student_type;
| result varchar2(50);
| begin
| select value(s) into student_member
| from student_table s;
|
| result := student_member.getLname();
|
| dbms_output.put_line(result);
| end;
|
| Error:
|
| declare
| *
| ERROR at line 1:
| ORA-01422: exact fetch returns more than requested number of rows
| ORA-06512: at line 5
|
| Any help would be very much appreciated.
|
|
Received on Fri Nov 21 2003 - 13:05:16 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US