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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:03:31+00:00 2026-06-07T21:03:31+00:00

Folks, I have a oracle database table which has name value pairs. A set

  • 0

Folks,

I have a oracle database table which has name value pairs. A set of name value pairs is identified by row_num. Also set size may vary.

I want to create a view which converts set of name value pair into one row in view.

I hope my question is clear

Please let me know how to define this

I gave sample sql for table creation and inserts for you convenience

Thanks

create table name_value_pair (row_num varchar2(32), name varchar2(32),value varchar2(32));

insert into name_value_pair values ('row1', 'Col1', 'Val11');
insert into name_value_pair values ('row1', 'Col2', 'Val12');
insert into name_value_pair values ('row1', 'Col3', 'Val13');
insert into name_value_pair values ('row1', 'Col4', 'Val14');
insert into name_value_pair values ('row1', 'Col5', 'Val15');

insert into name_value_pair values ('row2', 'Col1', 'Val21');
insert into name_value_pair values ('row2', 'Col2', 'Val22');
insert into name_value_pair values ('row2', 'Col3', 'Val23');
insert into name_value_pair values ('row2', 'Col4', 'Val24');
insert into name_value_pair values ('row2', 'Col5', 'Val25');

insert into name_value_pair values ('row3', 'Col1', 'Val31');
insert into name_value_pair values ('row3', 'Col2', 'Val32');
insert into name_value_pair values ('row3', 'Col3', 'Val33');
insert into name_value_pair values ('row3', 'Col4', 'Val34');
insert into name_value_pair values ('row3', 'Col5', 'Val35');

insert into name_value_pair values ('row4', 'Col1', 'Val41');
insert into name_value_pair values ('row4', 'Col2', 'Val42');
insert into name_value_pair values ('row4', 'Col3', 'Val43');
insert into name_value_pair values ('row4', 'Col4', 'Val44');
insert into name_value_pair values ('row4', 'Col5', 'Val45');

insert into name_value_pair values ('row5', 'Col1', 'Val51');
insert into name_value_pair values ('row5', 'Col2', 'Val52');
insert into name_value_pair values ('row5', 'Col3', 'Val53');
insert into name_value_pair values ('row5', 'Col4', 'Val54');
insert into name_value_pair values ('row5', 'Col5', 'Val55');

commit;
  • 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-07T21:03:33+00:00Added an answer on June 7, 2026 at 9:03 pm

    you can use the query when creating the view:

    select
      row_num, 
      max(decode(name, 'Col1', value)) col1, 
      max(decode(name, 'Col2', value)) col2,
      ...
    from name_value_pair
    group by row_num;
    

    Perhaps you should reconsider the data model. This kind of data model sucks. Queries can’t be optimized, hard to set constraints, and almost impossible to maintain data integrity.

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

Sidebar

Related Questions

Folks, I have a problem. I am a writing a script in python which
I have a schema in an Oracle 11g R2 database that I'm trying to
Curious whether folks have setup 2 way transactional replication on the tables ASP.NET uses
I have seen several places in stackoverflow where folks have elegantly and easily turned
hi folks i have a subroutine called CheckDate() in the code behind. How would
Folks, We have been using OpenXml APIs found in System.IO.Packaging for creating a package
I'm hoping to hear from a cross-section of folks who have SharePoint installed at
folks. I would really appreciate to have your help on the following question: In
I have an array with a set of elements. I'd like to bring a
last.fm has this nifty feature when you're adding an event. you have the Artists

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.