GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  General

 Print  |  
Question:   hi how to place different column in on column
eg:if we have address column in that we have to place addr1,addr2,addr3.




September 09, 2006 09:03:10 #1
 opbang   Member Since: March 2006    Total Comments: 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';



     

 

Back To Question