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

  • Home
  • SEARCH
  • 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 7720741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:44:52+00:00 2026-06-01T03:44:52+00:00

I first created a Type and then created a Table and then inserted 1

  • 0

I first created a Type and then created a Table and then inserted 1 row into the table which was successful but when I fire the Select query on Table I get errors:

create type My_type as Object
(
fname varchar2(10),
lname varchar2(10)
); 

Now created the table

create table My_table 
(
name My_type,
phone number
);

Inserted a row

insert into My_table values ( My_type('Abc','Xyz'), 122);

Fire the Select query

select * from My_table;

Error : ORA-00932: inconsistent datatypes: expected NUMBER got OODB.MY_TYPE

select name.fname, name.lname, phone from My_table;

Error : ORA-00904: “NAME”.”LNAME”: invalid identifier

select My_type.fname, My_type.lname, phone from My_table;

Error : ORA-00904: “MY_TYPE”.”LNAME”: invalid identifier

  • 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-01T03:44:53+00:00Added an answer on June 1, 2026 at 3:44 am

    If you use a current version of SQL*Plus, this should work

    SQL> create type My_type as Object ( fname varchar2(10), lname varchar2(10) );
      2  /
    
    Type created.
    
    SQL> create table My_table ( name My_type, phone number );
    
    Table created.
    
    SQL> insert into My_table values ( My_type('Abc','Xyz'), 122);
    
    1 row created.
    
    SQL> column name format a30;
    SQL> select * from My_table;
    
    NAME(FNAME, LNAME)                  PHONE
    ------------------------------ ----------
    MY_TYPE('Abc', 'Xyz')                 122
    

    It is possible that if you’re using a really old version of SQL*Plus or if you’re using some other client tool that the client tool doesn’t know how to handle object types.

    Outside of classroom exercises, you don’t generally define tables that have object types in the real world. It’s much more common to use object types in PL/SQL code to simplify processing– dealing with objects that are stored as part of the data model, on the other hand, tends to be problematic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I have created a table called Placemarks containing a column of type 'geography'.
I created a rounded box/button and sliced its first corner, the middle bar (which
First.. here are the two tables I've created (sans irrelevant columns).. CREATE TABLE users_history1
First Problem: When user deleted particular row then i have to remove that row
I have a big project that was first created in Borland C++ 6. We're
First,I created a hidden frame like this: var oHiddenFrame = null; if(oHiddenFrame == null){
I have a folder with these files: alongfilename1.txt <--- created first alongfilename3.txt <--- created
I recently created my first bash script, and I am having problems perfecting it's
I just created my first MVC2 project using the standard template. I need to
I've just created my first Preview 5 error and it doesn't seem to place

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.