PL/SQL Code: Parsing Name Value Pairs.

PL/SQL Code: Parsing Name Value Pairs.

Post by sat » Fri, 20 Jul 2001 02:12:28

Anyone have a storedproc or module for processing NameValue pairs as shown below?


I don't want to reinvent the wheel... as there is not enough time....

thanks in adv,


1. name/value pairs in a table, need help with reporting techniques

Hi, I was wondering if someone could lend some experience or
assistance to this problem.

I have a table.

stuff_id int,
stuff_name varchar(10),
stuff_propname varchar(10),
stuff_propvalue varchar(10)

There could be multiple rows for any given "stuff_name" that
correspond to the number of name/value pairs inserted into the table.
I'd like to be able to "turn the row on its side", basically be able
to (through either a view or stored procedure, which ever would be
faster) create a report that would set all of the "stuff_propname"
fields as columns, with the "stuff_propalue"'s displayed in the
corresponding row for that column.

some sample data to make this more clear:

stuff_id stuff_name stuff_propname  stuff_propvalue
-------- ---------- -------------- -----------------
1         apple       color           red
2         apple       taste           yummy
3         apple       origin          new york state
4         tomato      color           red
5         tomato      taste           hearty
6         tomato      origin          new jersey
7         tomato      seeds           true

report would look something like this

stuff_name  color  taste   origin          seeds
----------  -----  -----   ------          -----
apple       red    yummy   new york state  null
tomato      red    heary   new jersey      true

thanks for any and all help,

2. HELP! Error: 17832: Unable to read login packet(s) every day 1 time

3. Extracting name value pairs from an XML string

4. FREE DOWLOAD - Recital 8.0 JDBC developer

5. Issue with SPs returning name-value pairs

6. DALLAS - Oracle DBA

7. multiple fields under one ALIAS

8. Modelling items with attribute name/value pairs

9. How to pivot a table of name/value pairs based on the lastest timestamp for a given pair?

10. PL/SQL - IN OUT PARAMETER problem: ORA-06502: PL/SQL: Numeric or value error

11. Re-parsing for SQL associated with PL/SQL cursor variables

12. How do I parse name into first and last name fields