Home » SQL & PL/SQL » SQL & PL/SQL » Split a row into multiple rows (Oracle)
Split a row into multiple rows [message #685396] Thu, 23 December 2021 06:15 Go to next message
syam09
Messages: 1
Registered: December 2021
Junior Member
I have values as below

ID  Attribute_Name  Operator    Value
--- --------------- --------    ---------------------
10  test1           In          ('ABC','BCD')
10  test2           =           0
10  test3           <>          11
10  test4           In          ('A1','A2','A3','A4')
11  test3           =           25
11  test4           In          ('B1','B2','B3')
12  test1           Not In      ('C1','C2','C3')
12  test2           =           120
12  test3           =           'D'
12  test4           <>          30
12  test5           In          ('E1','E2','E3')

I required the Oracle query result in below format. I tried multiple ways but not getting in required format

ID    Result
---   ---------------------------------------------

10  test2=0~test3<>11~test1='ABC'~test4='A1'
10  test2=0~test3<>11~test1='ABC'~test4='A2'
10  test2=0~test3<>11~test1='ABC'~test4='A3'
10  test2=0~test3<>11~test1='ABC'~test4='A4'
10  test2=0~test3<>11~test1='BCD'~test4='A1'
10  test2=0~test3<>11~test1='BCD'~test4='A2'
10  test2=0~test3<>11~test1='BCD'~test4='A3'
10  test2=0~test3<>11~test1='BCD'~test4='A4'
11  test3=25~test4='B1'
11  test3=25~test4='B2'
11  test3=25~test4='B3'
12  test1<>'C1'~test2=120~test3='D'!test4<>30~test5='E1'
12  test1<>'C2'~test2=120~test3='D'!test4<>30~test5='E1'
12  test1<>'C3'~test2=120~test3='D'!test4<>30~test5='E1'
12  test1<>'C1'~test2=120~test3='D'!test4<>30~test5='E2'
12  test1<>'C2'~test2=120~test3='D'!test4<>30~test5='E2'
12  test1<>'C3'~test2=120~test3='D'!test4<>30~test5='E2'
12  test1<>'C1'~test2=120~test3='D'!test4<>30~test5='E3'
12  test1<>'C2'~test2=120~test3='D'!test4<>30~test5='E3'
12  test1<>'C3'~test2=120~test3='D'!test4<>30~test5='E3'
Thanks.
Re: Split a row into multiple rows [message #685397 is a reply to message #685396] Thu, 23 December 2021 08:08 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Welcome to the forum.
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Indent the code, use code tags and align the columns in result.

Also always post your Oracle version, with 4 decimals (query v$version), as often solution depends on it.

With any SQL or PL/SQL question, please, post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Previous Topic: Flatten table to get unique VALUES
Next Topic: How to update the nested array in json clob column data using plsql..?
Goto Forum:
  


Current Time: Thu Mar 28 20:58:43 CDT 2024