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 7551861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:36:29+00:00 2026-05-30T10:36:29+00:00

I have a regular table called TABLE1 with a column NUMBER(8) and a column

  • 0

I have a regular table called TABLE1 with a column NUMBER(8) and a column varchar2(100).

Now I’ve created an OBJECT TYPE T_MYTYPEwith two attributes: one NUMBER and another varchar2.

In a nutshell, they are exactly the same.

Now I want to do the following.

v_obj T_MYTYPE;

begin 
 select * into v_obj from TABLE1 t1 where t1.num = 9;--guaranteed to return only ONE row!!
end;  

but PL/SQL: ORA-00947: not enough values..

This is quite frustrating… I just want to be able to return ONE row of data into a collection!! Be it a RECORD or a OBJECT TYPE!!, I don’t care… I just can’t seem to make this work..!!!! Can anyone help??

  • 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-05-30T10:36:31+00:00Added an answer on May 30, 2026 at 10:36 am

    You can. You just need to use the object constructor

    SQL> create type t_simple_emp
      2      as object
      3  (
      4    empno number,
      5    ename varchar2(100)
      6  );
      7  /
    
    Type created.
    
    SQL> declare
      2    l_simple_emp t_simple_emp;
      3  begin
      4    select t_simple_emp( empno, ename )
      5      into l_simple_emp
      6      from emp
      7     where ename = 'KING';
      8  end;
      9  /
    
    PL/SQL procedure successfully completed.
    

    In your case, it would be

    SELECT t_mytype( column1, column2 )
      INTO v_obj
      FROM table1 t1
     WHERE t1.num = 9;
    

    If all you want to do is select an entire row from a table into a record type, however, then you’d want to do as ruakh suggested and just declare a %ROWTYPE record

    declare
      l_emp_rec emp%rowtype;
    begin
      select *
        into l_emp_rec
        from emp
       where ename = 'KING';
    end;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the regular aspnet_Users table I have created two sub-tables with one to one
I have a database table with a column where every entry is a regular
I have a table in Oracle with a VARCHAR column called DESCRIPTION. Some of
I have a table with a timestamp column that records when the record is
I have a table id|customer_id|comment 1 34 good 2 23 bad 3 34 regular
In my user_accounts table, I have a field called source which is an ENUM
I have a table called members. I am looking on advice how to improve
I have table in mysql database with autoincrement PRIMARY KEY. On regular basis rows
I have table called location with a field area. This field can contain various
I have a table called location with a field area . This field can

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.