Home » Other » Training & Certification » Question about constraint?? (merged many)
Question about constraint?? (merged many) [message #378012] Sat, 27 December 2008 14:56 Go to next message
burak
Messages: 12
Registered: December 2008
Junior Member
I am studying at computer engineering and I need to solve this problem about oracle sql...
my question is about constraint ..I need to call constraint at select section and I will have result adding constraint with alter table wich ı have call ...but result seem code ...like alter table add constraint

please answer me.....

[Updated on: Mon, 29 December 2008 06:38] by Moderator

Report message to a moderator

Re: I have very problem please help me...... [message #378013 is a reply to message #378012] Sat, 27 December 2008 15:03 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Sorry, but that question makes absolutely no sense.

A constraint is NOTHING that you would "call at select section" (Whatever that means)

And what would be the actual difference between "have result adding constraint with alter table" (what you seem to want) and "result seem code of alter table add constraint code" (what you don't seem to want).

Both are about adding a constraint with an alter table statement.

What are you actually trying do do?
Re: I have a problem please help me...... [message #378014 is a reply to message #378012] Sat, 27 December 2008 15:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
ALTER TABLE, constraint clause

Regards
Michel
Re: I have very problem please help me...... [message #378015 is a reply to message #378013] Sat, 27 December 2008 15:11 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
okey ı will explian ...I have a table and ..I have constraints at table...I need to call constraint name with select for example select empvu20 from user_constraint
and result will be code of alter table add constraint empvu20 ... sth like that
Re: I have very problem please help me...... [message #378016 is a reply to message #378015] Sat, 27 December 2008 15:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So do it. What is your problem?

Regards
Michel
Re: I have very problem please help me...... [message #378017 is a reply to message #378016] Sat, 27 December 2008 15:22 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
okey

I have to see result with code..this code will be about adding constraint with alter table ....
Re: I have very problem please help me...... [message #378018 is a reply to message #378017] Sat, 27 December 2008 15:30 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Sat, 27 December 2008 22:14
So do it. What is your problem?

Regards
Michel

In other words, what prevent you from doing it? What did you try so far?

Before posting any SQL statement or PL/SQL code, please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel

[Updated on: Sat, 27 December 2008 15:38]

Report message to a moderator

Re: I have very problem please help me...... [message #378025 is a reply to message #378017] Sat, 27 December 2008 19:21 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
I know format ..my question is different so I can't explain so much..my sql code will return adding code of constraint wich ı have at my table....I dont how can I do this??
Re: I have very problem please help me...... [message #378030 is a reply to message #378025] Sat, 27 December 2008 22:28 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8635
Registered: November 2002
Location: California, USA
Senior Member
SCOTT@orcl_11g> EXEC DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM, 'SQLTERMINATOR', TRUE)

PL/SQL procedure successfully completed.

SCOTT@orcl_11g> SELECT DBMS_METADATA.GET_DDL
  2  	      (DECODE
  3  		(constraint_type,
  4  		 'R', 'REF_CONSTRAINT',
  5  		      'CONSTRAINT'),
  6  	      constraint_name)
  7  	      AS code_to_add_constraints
  8  FROM   user_constraints
  9  WHERE  table_name = 'EMP'
 10  /

CODE_TO_ADD_CONSTRAINTS
--------------------------------------------------------------------------------

  ALTER TABLE "SCOTT"."EMP" MODIFY ("EMPNO" NOT NULL ENABLE);



  ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "EMP_PK" PRIMARY KEY ("EMPNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS"  ENABLE;



  ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "EMP_FK_DEPT" FOREIGN KEY ("DEPTNO")
	  REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE;



  ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "EMP_FK_EMP" FOREIGN KEY ("MGR")
	  REFERENCES "SCOTT"."EMP" ("EMPNO") ENABLE;



SCOTT@orcl_11g> 

Question about constraint?? [message #378054 is a reply to message #378012] Sun, 28 December 2008 04:22 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
I cant give an example because ıt s my home work...
I need to code for add constraint with alter table..but this will be result...I mean see code at result..
for example ı will call my constraint with select from my table...the result ignore my constraint and adding code them
Re: Question about constraint?? [message #378060 is a reply to message #378054] Sun, 28 December 2008 04:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You don't need to create a new topic for the same question.
Now you have to explain what is the question and why the previous answers don't help you.
If it is your homework you have a text, post it instead of trying to rephrase something you seem to don't understand.

Quote:
ı will call my constraint with select from my table

This is meaningless.

Regards
Michel
Re: Question about constraint?? [message #378062 is a reply to message #378060] Sun, 28 December 2008 04:38 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
okey sorry I dont have text of question..
how can I see code at result??(not table or selected rows)
thanks.....
Re: Question about constraint?? [message #378067 is a reply to message #378062] Sun, 28 December 2008 04:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The result of what?
Explain your question.

Regards
Michel
Re: Question about constraint?? [message #378069 is a reply to message #378067] Sun, 28 December 2008 04:57 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
I will call my constraint from related table in a select section and then return to me adding constraint sql code ,wihch ı have called,ignore holder consraints and add them again but I see only sql code at result...
thanks...
Re: Question about constraint?? [message #378071 is a reply to message #378069] Sun, 28 December 2008 05:04 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Still don't undertand the question.
Why Barbara's answer does not answer it?

Regards
Michel
Re: Question about constraint?? [message #378072 is a reply to message #378071] Sun, 28 December 2008 05:14 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
I tried it but not working....
okey I will learn more about my question and ask again

thanks...
Re: Question about constraint?? [message #378073 is a reply to message #378072] Sun, 28 December 2008 05:17 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I tried it but not working....

If you don't say what you try and what you get we never can help you.

Regards
Michel
Need help about user_tab_columns [message #378197 is a reply to message #378012] Mon, 29 December 2008 05:44 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
hi,
i have a very big problem about oracle.It is about my school project.The problem is that i want to see the table's properties.I want to know how the table is created.For example:
create table TestTable(
2 ID VARCHAR2(4 BYTE) NOT NULL,
3 MyName VARCHAR2(10 BYTE),
4 MyDate DATE,
5 MyNumber Number(8,2)
6 )
7 /
I want to see that code by the command.But this will be done by "select" command.(Not DBMS_METADATA.GET_DDL).I want to details of this structure.(Note:The teacher said that it was about user_tab_columns)
Re: Need help about user_tab_columns [message #378199 is a reply to message #378197] Mon, 29 December 2008 05:45 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Read the OraFAQ Forum Guide before posting.
Re: Need help about user_tab_columns [message #378202 is a reply to message #378197] Mon, 29 December 2008 05:47 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
Search for "Reconstruct DDL for tables" in this site's Scripts section.
i want to see the constraints of table by "select" [message #378209 is a reply to message #378012] Mon, 29 December 2008 05:55 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
My problem is so confused i think.It is about the "select" command.I will write "select" command and the output will be like that:

ALTER TABLE EMPLOYEE
ADD CONSTRAINT REVENUE CHECK (SALARY + COMM > 25000)

So i will see that code by using "select" command but how?
Re: Need help about user_tab_columns [message #378211 is a reply to message #378197] Mon, 29 December 2008 05:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Same question that about the constraint this we, same answers, I merge them.

Regards
Michel
Re: i want to see the constraints of table by "select" [message #378213 is a reply to message #378209] Mon, 29 December 2008 05:58 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
Lookup USER_CONSTRAINTS in the reference guide.
Re: i want to see the constraints of table by "select" [message #378214 is a reply to message #378209] Mon, 29 December 2008 05:58 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No need to start new topics they will be merged.

Regards
Michel
Re: i want to see the constraints of table by "select" [message #378216 is a reply to message #378214] Mon, 29 December 2008 05:58 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
i need help
Re: i want to see the constraints of table by "select" [message #378217 is a reply to message #378216] Mon, 29 December 2008 06:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
But you still don't explain your question.

Regards
Michel
Re: i want to see the constraints of table by "select" [message #378218 is a reply to message #378216] Mon, 29 December 2008 06:01 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
This is not the first time you've spammed our forum with multiple posts! Next time your account will be blocked.
Re: i want to see the constraints of table by "select" [message #378219 is a reply to message #378217] Mon, 29 December 2008 06:04 Go to previous messageGo to next message
burak
Messages: 12
Registered: December 2008
Junior Member
You merged two questions.They were different.The problem is that i will write some "select" commands and then the structure about the table will come.This is so simple but i don't know.It was about user_tab_columns.I just don't know what to write in "select".
Re: i want to see the constraints of table by "select" [message #378222 is a reply to message #378219] Mon, 29 December 2008 06:09 Go to previous message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
The answer was provided. Please re-read this thread carefully. And if you are looking for a sucker to do your homework for you, please look elsewhere.
Previous Topic: books
Next Topic: What's OCP/OCA certification
Goto Forum:
  


Current Time: Thu Dec 08 12:29:47 CST 2016

Total time taken to generate the page: 0.09558 seconds