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

Showing Answers 1 - 2 of 2 Answers

opbang

  • Sep 22nd, 2006
 

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';



Dhruv

  • Oct 11th, 2006
 

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

  Was this answer useful?  Yes

neela manohar

  • Jan 10th, 2007
 

 better to use nested table concept here.

  Was this answer useful?  Yes

siva14329

  • Mar 17th, 2009
 

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions