Results 1 to 4 of 4

Thread: Create function

  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Unanswered: Create function

    hi guys
    i created type as object then i created body of type to insert my function but it dose not work any one can tell me WHY??

    Code:
    create type resource_type as object (
    title varchar2(35),
    publisher varchar2(35),
    location varchar2 (35),
    isbn_no varchar2 (15),
    cover_type varchar2 (20),
    no_of_page number (4),
    length varchar2 (10),
    file_format varchar2 (10),
    storage_type varchar2 (15),
    date_taken date,
    date_return date,
    member function getstatus return varchar2,
    PRAGMA RESTRICT_REFERENCES(getstatus, WNDS)
    );
    /
        
       
    -----------------------------------------------------
    create type body resource_type as
    member function getstatus return varchar2 is
    begin
    if (sysdate-date_taken) <= 14 then
    status:='on loan';
    
    elseif (sysdate-date_taken) > 14 then
    status:='over due';
    endif;
    
    else status:='available';
    endif;
    
    return (status);
    end;
    end;
    end;
    /

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    what is the advantage/purpose of utilizing TYPE datatype?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    the reason of created type is that i want to use TYPE(with its columns) in other tables ....but the problem is with the function ??

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    dose not work
    This is not a valid Oracle error message.

Posting Permissions

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