GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  General
Go To First  |  Previous Question  |  Next Question 
 General  |  Question 204 of 211    Print  
hi how to place different column in on column
eg:if we have address column in that we have to place addr1,addr2,addr3.

  
Total Answers and Comments: 6 Last Update: March 17, 2009     Asked by: vijay 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 22, 2006 09:03:10   #1  
opbang Member Since: March 2006   Contribution: 46    

RE: hi how to place different column in on column

CREATE OR REPLACE TYPE address AS OBJECT (
add1 varchar2(25)
add2 varchar2(25)

add3 varchar3(25)

);

CREATE TABLE customer (
cust_id NUMBER(10)

Cust_name varchar2(25)
addre address);

set describe depth all;

desc customer;

INSERT INTO customer

(cust_id cust_name addre)
VALUES
(1 Ramesh address('Plot No.25' 'Sidharth Colony Hyderabad'));


INSERT INTO customer

(cust_id cust_name addre)
VALUES
(2 Suresh address('Plot No.42' 'Sri Ram Nagar Bangalore'));


SELECT * FROM customer;

-- selective select


SELECT *
FROM customer p
WHERE p.addre.add3 'Hyderabad';




 
Is this answer useful? Yes | No
October 11, 2006 07:50:49   #2  
Dhruv        

RE: hi how to place different column in on column

Above mention solution doesn't work. check it out.


 
Is this answer useful? Yes | No
December 12, 2006 00:05:33   #3  
sravan1 Member Since: September 2006   Contribution: 10    

RE: hi how to place different column in on column
The above solution is working. Correct the gramatical mistakes and it is fixed.
 
Is this answer useful? Yes | No
January 10, 2007 01:34:55   #4  
neela manohar        

RE: hi how to place different column in on column
better to use nested table concept here.
 
Is this answer useful? Yes | No
February 10, 2007 12:51:01   #5  
ddkdhar Member Since: June 2006   Contribution: 48    

RE: hi how to place different column in on column
can any body explain the concept here
 
Is this answer useful? Yes | No
March 17, 2009 08:21:20   #6  
siva14329 Member Since: March 2009   Contribution: 1    

RE: hi how to place different column in on columneg:if we have address column in that we have to place addr1,addr2,addr3.

That time use Abstract Data Type i.e.
first step create type.

SQL>create type full_add
SQL>( addr1 varchar2(15) addr2 varchar2(15) addr3 varchar2(15));


Second step
Now full_add is abstract type then add to your table.
SQL>alter table
SQL>add column ( addr full_add);
| |
(Variable) (data type)


If any comments welcome.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape