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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:50:30+00:00 2026-05-22T23:50:30+00:00

How to define in PL/SQL the following structure: A list of strings which contains

  • 0

How to define in PL/SQL the following structure:

A list of strings which contains multiple rows.

Example:

'User A'
    -->
        (1)
            -->
                1
        (2)
            -->
                2


'User B'
    -->
        (1)
            -->
                0
        (2)
            -->
                9

The integers are defined as:

TYPE number_arry IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;

How to define the whole structure ?

I want to fill this structure from this table:

RowId | User_A | User_B  
------+--------+--------
1     |      1 |      0
2     |      2 |      0
3     |      3 |      9

With these statements:

CURSOR c1
        IS
            SELECT User_A, User_B FROM my_table;

OPEN c1;
    LOOP
        FETCH c1
          BULK COLLECT INTO
                my_dict('User A'),
                my_dict('User B')

        LIMIT 1000;

        EXIT WHEN c1%NOTFOUND;
    END LOOP;
  • 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-22T23:50:30+00:00Added an answer on May 22, 2026 at 11:50 pm

    You could use the following structure:

    SQL> CREATE TABLE my_table AS
      2     SELECT 1 user_a, 0 user_b FROM dual
      3     UNION ALL SELECT 2, 0 FROM dual
      4     UNION ALL SELECT 3, 9 FROM dual;
    
    Table created
    
    SQL> DECLARE
      2     CURSOR c1 IS
      3        SELECT User_A, User_B FROM my_table;
      4     TYPE number_arry IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      5     TYPE dictionary_type IS TABLE OF number_arry INDEX BY VARCHAR2(30);
      6     l_dico dictionary_type;
      7  BEGIN
      8     OPEN c1;
      9     LOOP
     10        FETCH c1 BULK COLLECT
     11           INTO l_dico('User A'), l_dico('User B') LIMIT 1000;
     12        EXIT WHEN c1%NOTFOUND;
     13     END LOOP;
     14     CLOSE c1;
     15  END;
     16  /
    
    PL/SQL procedure successfully completed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following example of the PHP/SQL which worked perfectly when editing one row
I have a table defined by the following SQL: CREATE TABLE test ( id
Consider the tables: ( -> denotes a SQL defined relationship) USER (userid, username, imageid->IMAGE.imageid)
I have a user defined function in SQL called getBuisnessDays it takes @startdate and
How to call a stored procedure from a user defined function in SQL Server
I have an user defined table function in SQL Server that aggregate data from
I have an SQL table with basically the following structure: PK (int, primary key),
I am making an app that lets user define their own data source (SQL),
I have a table discussion of which structure is following: Table name: discussion, Id
Is there a SQL equivalent to #define ? I am using NUMBER(7) for ID's

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.