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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:05:49+00:00 2026-05-15T06:05:49+00:00

I am trying to convert queries like below to types so that I won’t

  • 0

I am trying to convert queries like below to types so that I won’t have to use GTT:

insert into my_gtt_table_1
(house, lname, fname, MI, fullname, dob)
(select house, lname, fname, MI, fullname, dob 
 from (select 'REG' house, mbr_last_name lname, mbr_first_name fname, mbr_mi MI, 
       mbr_first_name || mbr_mi || mbr_last_name fullname, mbr_dob dob from 
       table_1 a, table_b
       where a.head = b.head and mbr_number = '01' and mbr_last_name = v_last_name) c

above is just a sample but complex queries are bigger than this.
the above is inside a stored procedure. So to avoid the gtt (my_gtt_table_1). I did the following:

create or replace type lname_row as object
    (
     house varchar2(30)
     lname varchar2(30),
     fname varchar2(30),
     MI char(1),
     fullname VARCHAR2(63),
     dob DATE
     )

create or replace type lname_exact as table of lname_row 

Now in the SP:

type lname_exact is table of <what_table_should_i_put_here>%rowtype;
tab_a_recs lname_exact;

In the above I am not sure what table to put as my query has nested subqueries.

query in the SP: (I am trying this for sample purpose to see if it works)

        select lname_row('',
                                '',
                                '',
                                '',
                                '',
                                '',
                                sysdate) bulk collect
          into tab_a_recs
        from table_1;

I am getting errors like : ORA-00913: too many values

I am really confused and stuck with this 🙁

  • 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-15T06:05:49+00:00Added an answer on May 15, 2026 at 6:05 am

    You defined a type with 6 attributes and you try to instantiate it with 7 values. Try this instead:

        select lname_row(/*'',*/
                         '',
                         '',
                         '',
                         '',
                         '',
                         sysdate) bulk collect
          into tab_a_recs
        from table_1;
    

    Edit
    There also seems to be a confusion concerning types. In Oracle you can define types in SQL or in PL/SQL. SQL types are accessibles to SQL (!) while PL/SQL ones offer some extra features but are invisible to pure SQL (PL/SQL can also access SQL types).

    That being said, it is confusing and unwise to name types the same both in SQL and PL/SQL (you run into shadowing issues). You defined the lname_exact type two times (with your CREATE STATEMENT and in your DECLARE block). Since you are instantiating a lname_exact in a SQL statement, the type chosen in this case is the SQL type (with only 6 attributes).

    You should either remove the declaration of lname_exact on the SP or rename it.

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

Sidebar

Related Questions

I'm trying to convert my implementation of quicksort into a template that can be
I'm trying to convert some SQL queries into Linq to avoid multiple trips to
I am trying to convert a Linq query that I have working in Linq
Trying to convert this c code into MIPS and run it in SPIM. int
Im trying to convert the Vaadin demo for JPAContainer to use hibernate instead of
I'm trying to convert a Math Formula into PHP code. You can see the
I've got a project that I'm trying to convert to F#, with a fair
I have a SQL query Question, I am trying to nest two separate queries
I have a service containing the following method, which queries a repository, like so:
I'm trying to convert some Oracle SQL queries to work with (in theory) any

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.