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

NickR2600-Oracle

So when would it be beneficial to have an abstract method in a super class? One answer would be because the sub classes have no shared functionality. Or in other words, because the functionality is so different between subclasses. Or because the functionality can't be defined yet.

In Java Puzzle Ball, I have an abstract class called GameObject. It's inherited by a lot of different concrete classes: bumpers, assignable behaviors, level geometry... And one if its responsibilities is to define what happens when a collision occurs. But I have to leave the collision effect method abstract. The geometry of all these objects are so dramatically different, there isn't any shared functionality I can write to define how the physics of all these different angles and shapes should work. The best I can do is write an abstract method as a promise to implement the functionality somewhere later down the inheritance structure.

pastedImage_0.png

AjayKumarGuttikonda

Thank you so much for taking time out and answering the question in very elaborated manner. I understand, the conclusion is Account class need not be abstract as all methods are implemented and also there is no problem Account class being abstract as the abstract class by definition can have all methods implemented. Can you please also explain why in this case it is beneficial to have Account class as abstract since we have implemented all methods.

NickR2600-Oracle

You got it.  I'm glad you're enjoying the course

It's more of a design choice in this example.  Even though Account could technically exist as a concrete class, I only meant for it to be a container for all the fields and methods shared by savings and checking accounts.  So to reinforce that decision and prevent instances of Accounts from getting created, the class is left abstract.

One other thing to consider is that Accounts don't have an accountType field, but savings and checking account classes do.  Looking back, maybe I should have written an abstract method into the Account class to somehow enforce the need for this field.

1 - 3
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,040 views