Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Every Row into an individual Columns in SQL Query

534103Jan 15 2010 — edited May 15 2010
Hi Experts,
BANNER                                                                          
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production          
PL/SQL Release 11.1.0.7.0 - Production                                          
CORE	11.1.0.7.0	Production                                                      
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production                         
NLSRTL Version 11.1.0.7.0 - Production          
-- DROP TABLE RENDER_VALUES;
CREATE TABLE RENDER_VALUES
(
    ID          INTEGER PRIMARY KEY,
    FIELD_NAME  VARCHAR2(1000),
    FIELD_VALUE VARCHAR2(1000)
);
INSERT INTO RENDER_VALUES(ID,FIELD_NAME,FIELD_VALUE)VALUES(1,'CropX','10.31234');
INSERT INTO RENDER_VALUES(ID,FIELD_NAME,FIELD_VALUE)VALUES(2,'CropY','20.31234');
INSERT INTO RENDER_VALUES(ID,FIELD_NAME,FIELD_VALUE)VALUES(3,'Height','100');
INSERT INTO RENDER_VALUES(ID,FIELD_NAME,FIELD_VALUE)VALUES(4,'Width','200');
COMMIT;
SELECT FIELD_NAME,FIELD_VALUE FROM RENDER_VALUES;
FIELD_NAME	FIELD_VALUE
CropX		10.31234
CropY		20.31234
Height		100
Width		200
I need the output as:
CropX		CropY		Height	Width
10.31234	20.31234	100	200
Just for sample ..i have given Four Values in Field name Column...there can be (n) no.of values in that and to get each row
into an individual columns...how can i do something like this?

- Dharan V
This post has been answered by Frank Kulash on Jan 15 2010
Jump to Answer

Comments

Ian G Clough

Hi James,
If you make the office's location the identifying attribute for the office (delete the other attribute as it's no longer required) and then your rules can look like this:
Screenshot 2022-04-28 at 10.07.09.pngScreenshot 2022-04-28 at 10.10.07.pngI'm not sure how you might infer other details about the office unless those could be shared rules.
Best regards
Ian

James Woon - Monad

Thanks for that suggestion!
In this case, I have used 'the office location' as an example entity attribute that needs to be populated. But unfortunately, the actually attribute are dates. So maybe something like the office's opening date. We also do need to maintain the identifier (XYZ1, ABC2, etc.).
Therefore, don't think the proposed solution would work :(

Richard Napier

Hello James,
Personally I wouldn't use inclusions. I would use Decision Services. Then I can create two separate decision services, in separate Workspaces, give users permissions, use the Viewer role or the Author role to let people view or edit the Decision Services. Generally I have much more control over them.
image.pngimage.pngI would create references in the OPM project to each of the decision services
image.png
image.png
And create entities to support ABC, XYZ and then the master entity to contain both
image.png
Then I would merge the two entities into one and copy over the location to the master entity.
image.png
image.pngJust my two cents
Have a lovely day

James Woon - Monad

Ah... Decision Services! Sad to say we're on Private Cloud 20C. 
Yes, this is probably the best solution for anyone looking to solve this issue.
(I tried to mark this as answered but it seems I chose 'Discussion' instead of 'Question' for this post)
As always, appreciate your contributions to the community, Richard!

Richard Napier

Ah, I see. I was confused by you saying you had a test project in 21D. Happy to help, James. Whether it be a discussion or a question :)

1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 12 2010
Added on Jan 15 2010
19 comments
7,124 views