-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Oracle constraints problems . ?
PostPosted: Fri Sep 24, 2010 9:24 pm 
Newbie

Joined: Tue Jul 20, 2010 1:53 am
Posts: 18
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Sep 25 06:40:40 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> connect
Enter user-name: system
Enter password:
Connected.
SQL> select * from emp;

ID NAME SAL JOB HIREDATE DEPTNO
---------- --------------- ---------- ---------- --------- ----------
ADDS
---------------
100 Johan 1300 CLERK 21-SEP-10 10
HYD


SQL> desc emp;
Name Null? Type
----------------------------------------- -------- ----------------------------

ID NOT NULL NUMBER(6)
NAME VARCHAR2(15)
SAL NOT NULL NUMBER(10)
JOB VARCHAR2(10)
HIREDATE DATE
DEPTNO NUMBER(5)
ADDS VARCHAR2(15)

SQL> create table kota as select * from emp;

Table created.

SQL> select * from kota;

ID NAME SAL JOB HIREDATE DEPTNO
---------- --------------- ---------- ---------- --------- ----------
ADDS
---------------
100 Johan 1300 CLERK 21-SEP-10 10
HYD


SQL> desc kota;
Name Null? Type
----------------------------------------- -------- ----------------------------

ID NUMBER(6)
NAME VARCHAR2(15)
SAL NOT NULL NUMBER(10)
JOB VARCHAR2(10)
HIREDATE DATE
DEPTNO NUMBER(5)
ADDS VARCHAR2(15)

Question emp table is the base table ,when was going for copy the table(kota) base table to kota "all constraints('primary key') not coming why ? i try to modify those tables but no use.please let me share my problem .


Top
 Profile  
 
 Post subject: Re: Oracle constraints problems . ?
PostPosted: Mon Sep 27, 2010 4:18 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
kotapati.krishna wrote:
Question emp table is the base table ,when was going for copy the table(kota) base table to kota "all constraints('primary key') not coming why ? i try to modify those tables but no use.please let me share my problem .


If I understand correctly you ask why the is no primary key on "kota"? Because you didn't define any... You told oracle to "create table kota as select * from emp". That's it. You have to use some ALTER TABLE after that step and define a primary key.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.