Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9091365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:35:33+00:00 2026-06-16T22:35:33+00:00

The following code creates an object table with a get_age function using oracle sql*plus.

  • 0

The following code creates an object table with a get_age function using oracle sql*plus.

Create Type C_type as Object(
  Cname varchar(30),
  dob  Date,
  classification Number,
  sample_clip Blob
)
/

ALTER TYPE C_type
  ADD MEMBER FUNCTION get_age RETURN INTEGER;


CREATE OR REPLACE TYPE BODY C_type AS
MEMBER FUNCTION get_age RETURN INTEGER IS
currenttime_age integer; 
BEGIN
  currenttime_age := (SYSDATE - dob)/365.25; 
  RETURN currenttime_age;   
END get_age;
END;
/

my intention is to add another function that returns a character

  • classification as ‘short’ (if below 5), ‘medium’ ( between 5-45 ) and ‘long’ (over 45)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:35:34+00:00Added an answer on June 16, 2026 at 10:35 pm

    Try this instead. My Bad.

    DROP TYPE c_type
    /
    
    CREATE TYPE C_type AS OBJECT
    (
       Cname VARCHAR (30),
       dob DATE,
       classification NUMBER,
       sample_clip BLOB,
       MEMBER FUNCTION get_age
          RETURN INTEGER,
       MEMBER FUNCTION get_class
          RETURN VARCHAR2
    )
    /
    
    
    CREATE OR REPLACE TYPE BODY C_type
    AS
       MEMBER FUNCTION get_age
          RETURN INTEGER
       IS
          currenttime_age   INTEGER;
       BEGIN
          currenttime_age := (SYSDATE - dob) / 365.25;
          RETURN currenttime_age;
       END get_age;
    
    
       MEMBER FUNCTION get_class
          RETURN VARCHAR2
       IS
          result   VARCHAR2 (10);
       BEGIN
          result :=
             CASE
                WHEN classification < 5 THEN 'short'
                WHEN classification BETWEEN 5 AND 45 THEN 'medium'
                WHEN classification > 45 THEN 'long'
             END;
    
          RETURN result;
       END get_class;
    END;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the difference between the following code? CREATE TYPE f1_MemberType AS OBJECT (
I am trying to define a type using the following code. CREATE OR REPLACE
I have the following code that creates a serverside object of the xmlhttp class.
The following code: gb = self.request.form['groupby'] typ = self.request.form['type'] tbl = self.request.form['table'] primary =
Have the following code which creates a table of all the images in a
the following code (from a database object created for each new view): -(void)update:(NSString *)queryText{
The following code creates a field with multiple checkboxes. How do I set the
The following code demonstrates my dilemma. The code creates a background thread which processes
I created a grid of buttons. The following code creates the buttons and displays
I have the following code which creates a simple window with two buttons which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.