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 -> Function Construction. Help!

Function Construction. Help!

From: <saks1000_at_my-deja.com>
Date: Tue, 20 Jul 1999 17:38:40 GMT
Message-ID: <7n2c6v$2oo$1@nnrp1.deja.com>


I want to construct a simple function that returns the reference to an object, with a parameter being 'name'. The error that I get is undocumented in the installatino cd that I have. Does anyu body have an idea why I get this error? THanks.

SQL> select REF(d) from departments d where d.Name = 'Computer Science'   2 /

REF(D)



000028020950166F7149811BF7E0340800209F477450166F7148E21BF7E0340800209F47 7400C00409000E

SQL> create or replace function get_dref (name IN VARCHAR) RETURN REF department IS
  2 d_ref REF department;
  3 begin
  4 select REF(d) into d_ref from departments d where d.Name = name;   5 end get_dref;
  6 /

Function created.

SQL> SELECT get_dref('Computer Science') FROM DUAL   2 /
SELECT get_dref('Computer Science') FROM DUAL

       *
ERROR at line 1:

ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "PTAPIA.GET_DREF", line 4
ORA-06512: at line 1


SQL> Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Jul 20 1999 - 12:38:40 CDT

Original text of this message

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