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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:54:32+00:00 2026-06-02T09:54:32+00:00

I am having a normal table temp and a nested table temp_nt Temp ————-

  • 0

I am having a normal table temp and a nested table temp_nt

Temp
-------------
 ID    Status
-------------
 1     open
 2     close
 3     open
 4     open
 5     close
---------------

Suppose my nested table is having list of ID, X

Lets say the data in nested table is like

temp_nt(1).ID=1 temp_nt(1).X='ANC'
temp_nt(2).ID=2 temp_nt(2).X='pqr'
temp_nt(3).ID=3 temp_nt(3).X='ANCF'
temp_nt(4).ID=4 temp_nt(4).X='ANCF'

Can it be possible to join both to get the data like below,

   Status   COUNT
 -----------------------
    open     3
    close    1
 -----------------------

Since ID=5 is not present in the nested table, therefore it is excluded from the count

  • 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-02T09:54:34+00:00Added an answer on June 2, 2026 at 9:54 am

    It would help to define exactly what objects you’re working with…

    You have a table with 5 rows of data

    SQL> create table foo(
      2    id number,
      3    status varchar2(10)
      4  );
    
    Table created.
    
    SQL> insert into foo values( 1, 'open' );
    
    1 row created.
    
    SQL> insert into foo values( 2, 'close' );
    
    1 row created.
    
    SQL> insert into foo values( 3, 'open' );
    
    1 row created.
    
    SQL> insert into foo values( 4, 'open' );
    
    1 row created.
    
    SQL> insert into foo values( 5, 'close' );
    
    1 row created.
    

    But then how is your nested table defined? Is it defined in SQL or PL/SQL? Are you using the object from SQL or PL/SQL?

    If you have defined the nested table in SQL

    SQL> create type foo_obj is object (
      2    id number,
      3    status varchar2(10)
      4  );
      5  /
    
    Type created.
    
    SQL> create type foo_nt
      2      as table of foo_obj;
      3  /
    
    Type created.
    

    And you are using the nested table in PL/sQL, you can use the TABLE operator

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    l_foos foo_nt := new foo_nt();
      3  begin
      4    l_foos.extend(4);
      5    l_foos(1) := new foo_obj( 1, 'ANC' );
      6    l_foos(2) := new foo_obj( 2, 'pqr' );
      7    l_foos(3) := new foo_obj( 3, 'ANCF' );
      8    l_foos(4) := new foo_obj( 4, 'ANCF' );
      9    for x in (select t.status, count(*) cnt
     10                from foo t,
     11                     table( l_foos ) l
     12               where t.id = l.id
     13               group by t.status)
     14    loop
     15      dbms_output.put_line( x.status || ' ' || x.cnt );
     16    end loop;
     17* end;
    SQL> /
    close 1
    open 3
    
    PL/SQL procedure successfully completed.
    

    Is that what you’re looking for? Or do you have a different setup?

    If you are defining a local collection in PL/SQL, you won’t be able to use that collection in a SQL statement since the SQL engine isn’t able to access any information about the collection type. If you want to use the collection in SQL, it would make much more sense to define the collection in SQL.

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

Sidebar

Related Questions

Having a list of data object and something visual to represent each, where would
I have a function that generates normal random number matrix having normal distribution using
Hi, i have been having some problems using JSON data in flash builder lately
Using table creation as normal: t = Table(name, meta, [columns ...]) This is the
Problem: A Table in MySQL that has a few normal fields and one text
I'm having a problem with IE7 displaying a table (don't worry it's used for
I am having an issue with how the iPhone reuses Cells in table. The
I'm having a problem while trying to dynamically change a table cell's styling class
I've got a tr:table that I need to style using CSS. All the normal
I got a table with a normal setup of auto inc. ids. Some of

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.