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 -> object-relational help reqd

object-relational help reqd

From: david <david_at_blah.blah>
Date: Mon, 8 Jul 2002 08:23:32 +0000 (UTC)
Message-ID: <agbi64$96o$1@helle.btinternet.com>


I am v new to Oracle and would appreciate help with a couple of very trivial teething troubles I am having. thanks

I have tried to create a hello world application in Oracle 9i at the command line of SQL plus.

I want to create an object which holds a salutation string (e.g. "hello") that has a method that I pass in my name and it returns the concatenated string hello David

I have a few questions:

Q1. The last line wont work (I'm not particularly suprised as I dont really know what I am doing), what should I be typing to test my method. Q2. If I do the "Create Type" and the "Create Type Body" commands separately
(using SQL*PLUS to type a command at a time and press F5 between each) then
it creates the type and then the body. If I have them both in the window when I press F5 then it comes back with compilation errors. (btw I get similar compilation errors when trying to do this via the console but that will be the my step when I get this trivial case working)

CREATE TYPE HELLOOBJECT AS OBJECT
(

   HELLOSTRING VARCHAR2(10),
   MEMBER FUNCTION TALKTOME (MYNAME VARCHAR2) RETURN VARCHAR2 );

CREATE TYPE BODY HELLOOBJECT AS
  MEMBER FUNCTION TALKTOME (MYNAME VARCHAR2) RETURN VARCHAR2 IS   BEGIN
    RETURN HELLOSTRING+MYNAME;
  END TALKTOME;
 END; CREATE TABLE SALUTATIONS OF HELLOOBJECT;

INSERT INTO SALUTATIONS VALUES ('ALRIGHT ');
INSERT INTO SALUTATIONS VALUES ('Morning ');
INSERT INTO SALUTATIONS VALUES ('Hi ');

SELECT S.* FROM SALUTATIONS S; SELECT VALUE(S).TALKTOME(' David') FROM SALUTATIONS

thanks Received on Mon Jul 08 2002 - 03:23:32 CDT

Original text of this message

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