You are on page 1of 4

7/19/2016

ORA02253:constraintspecificationnotallowedhere[SOLVED]ToolboxforITGroups

LogIn

SearchToolbox.com

Blogs

Topics

Discussions

Oracle Groups

OracleDevelopment

Research

CreateanAccount

Directory

ASKANEWQUESTION

ORA02253:constraintspecificationnot
allowedhere
saissaskedAug5,2011|Replies(5)

Hi,
I'mnotgettingsolutionforthebelowerror.pleasesuggestindetail,i.e.ifconstraint
keywordistoberemovedwhatexactlyshldthecodebeas.
SQL>createtableemp_column_level_cons(empnonumber(4)constraint
empcol_empno_pkprimarykey,
2enamevarchar2(15)unique,
3jobvarchar2(20)notnull,
4salnumber(7,2)check(salbetween1500and25000),
5deptnonumber(4)constraintempcol_deptno_fkforeignkeyre
ferencesdept(deptno)ondeletecascade)
deptnonumber(4)constraintempcol_deptno_fkforeignkeyreferencesdept(deptno)
o
*
ERRORatline5:
ORA02253:constraintspecificationnotallowedhere

Related
Discussions
ORA02253:constraintspecificationnotallowedhere
ORA00907:missingrightparenthesis

innerjoinwithgroupby(avgfunction)
Listingcolumnsforaforeignkey
EmployeeTable
ORA00907:MissingRightParenthesis
ModifyConstraint(PKandFK)
ORA02250:missingorinvalidconstraintname
BlogArticles
CatastrophicCICSpronounced'KICKS'
The60'sIBM&theSevenDwarves
Flamesinthemailbox

Thanksinadvance,
Jointhisgroup

BestAnswer Updated
HelloSais
Unliketheprimarykeyyoucannotjustattachtheforeignkeyconstrainttothe
columndeclaration.Findbelowthecodethatshouldwork.Alternativelyyou
couldsendalltheconstraintbelowafterthewholedeclarationslikeinthe
secondone.
SQL>createtableemp_column_level_cons(empnonumber(4)constraint
empcol_empno_pkprimarykey,
2enamevarchar2(15)unique,
3jobvarchar2(20)notnull,
4salnumber(7,2)check(salbetween1500and25000),
5deptnonumber(4),
constraintempcol_deptno_fkforeignkey(deptno)re
ferencesdept(deptno)ondeletecascade)

http://oracle.ittoolbox.com/groups/technicalfunctional/oracledevl/ora02253constraintspecificationnotallowedhere4351267

1/4

7/19/2016

ORA02253:constraintspecificationnotallowedhere[SOLVED]ToolboxforITGroups

SQL>createtableemp_column_level_cons(empnonumber(4),
2enamevarchar2(15)unique,
3jobvarchar2(20)notnull,
4salnumber(7,2)check(salbetween1500and25000),
5deptnonumber(4),
constraintempcol_empno_pkprimarykey(empno),
constraintempcol_deptno_fkforeignkey(deptno)referencesdept(deptno)on
deletecascade)
BestRegards
____
NorbertFrancisOseiAsomani
P.O.BoxCE11021|TemaGhana
email@removed
Phone:+23322307172
Mobile:+233244814147

OriginalanswerbyNorbertAsomaniAug5,2011
Contributors:

PopularWhitePaperOnThisTopic

BestPracticesforaBIandAnalyticsStrategy

AllReplies(5)
NorbertAsomanirepliedAug5,2011

BestAnswer

HelloSais
Unliketheprimarykeyyoucannotjustattachtheforeignkeyconstrainttothecolumn
declaration.Findbelowthecodethatshouldwork.Alternativelyyoucouldsendall
theconstraintbelowafterthewholedeclarationslikeinthesecondone.
SQL>createtableemp_column_level_cons(empnonumber(4)constraint
empcol_empno_pkprimarykey,
2enamevarchar2(15)unique,
3jobvarchar2(20)notnull,
4salnumber(7,2)check(salbetween1500and25000),
5deptnonumber(4),
constraintempcol_deptno_fkforeignkey(deptno)re
ferencesdept(deptno)ondeletecascade)

SQL>createtableemp_column_level_cons(empnonumber(4),
2enamevarchar2(15)unique,
3jobvarchar2(20)notnull,
4salnumber(7,2)check(salbetween1500and25000),
5deptnonumber(4),
constraintempcol_empno_pkprimarykey(empno),
constraintempcol_deptno_fkforeignkey(deptno)referencesdept(deptno)ondelete
cascade)
BestRegards
____
NorbertFrancisOseiAsomani
P.O.BoxCE11021|TemaGhana
email@removed

http://oracle.ittoolbox.com/groups/technicalfunctional/oracledevl/ora02253constraintspecificationnotallowedhere4351267

2/4

7/19/2016

ORA02253:constraintspecificationnotallowedhere[SOLVED]ToolboxforITGroups
Phone:+23322307172
Mobile:+233244814147

ganeshvelagarepliedAug5,2011

Hi,
Ithinkthatthefollowingcodeworksfine.
createtableemp_column_level_cons(empnonumber(4)constraint
empcol_empno_pkprimarykey,
enamevarchar2(15)unique,
jobvarchar2(20)notnull,
salnumber(7,2)check(salbetween1500and25000),
deptnonumber(4)constraintempcol_deptno_fkre
ferencesdept(deptno)ondeletecascade)

regards,
V.Ganesh.

rajareddyrepliedAug5,2011

Hitrylikethis

createtableemp_column_level_cons(empnonumber(4)constraint
empcol_empno_pkprimarykey,
enamevarchar2(15)unique,
jobvarchar2(20)notnull,
salnumber(7,2)check(salbetween1500and25000),
deptnonumber(4)
constraintempcol_deptno_fkreferencesdept(deptno)ondeletecascade)

SQLUSA.comrepliedAug5,2011

InSQLServeryoucandeclareFOREIGNKEYintabledefinitionforexamplelikein
Sales.SalesOrderDetailtable:
ProductIDINTREFERENCESProduction.Product(ProductID)
KalmanToth,SQLServerTraining&BusinessIntelligenceTraining
SQL2008GRANDSLAMhttp://sqlusa.com/order2008grandslam/

WhitePapersandWebcasts
Popular
BigDataandtheCMO:AnIntroductiontotheChallengeand...
MoreWhitePapers

saissrepliedAug5,2011

Hi,
Thanksforyourvaluablesuggestion.
Regards,
saiss

http://oracle.ittoolbox.com/groups/technicalfunctional/oracledevl/ora02253constraintspecificationnotallowedhere4351267

3/4

7/19/2016

ORA02253:constraintspecificationnotallowedhere[SOLVED]ToolboxforITGroups

Thisthreadhasbeenclosedduetoinactivity.
Startanewthreadhere

ToolboxforIT
MyHome
Topics
People
Companies
Jobs
WhitePaperLibrary
CollaborationTools
DiscussionGroups
Blogs
FollowToolbox.com
ToolboxforITonTwitter
Toolbox.comonTwitter
Toolbox.comon
Facebook

TopicsonToolboxforIT

Toolbox.com

DataCenter
DataCenter

EnterpriseArchitecture&EAI
EnterpriseArchitecture&EAI

Development
CLanguages
Java
VisualBasic
WebDesign&Development

InformationManagement
BusinessIntelligence
Database
DataWarehouse
KnowledgeManagement
Oracle

EnterpriseApplications
CRM
ERP
PeopleSoft
SAP
SCM
Siebel

ITManagement&Strategy
EmergingTechnology&Trends
ITManagement&Strategy
Project&PortfolioManagement

Networking&Infrastructure
Hardware
Networking
CommunicationsTechnology
OperatingSystems
Linux
UNIX
Windows
Security
Security
Storage
Storage

CloudComputing
CloudComputing

About
News
Privacy
TermsofUse
WorkatToolbox.com
Advertise
Contactus
ProvideFeedback
HelpTopics
TechnicalSupport
PCMagDigitalGroup

OtherCommunities
ToolboxforHR
ToolboxforFinance

Copyright19982016ZiffDavis,LLC(Toolbox.com).Allrightsreserved.Allproductnamesaretrademarksoftheir
respectivecompanies.Toolbox.comisnotaffiliatedwithorendorsedbyanycompanylistedatthissite.
PCMagDigitalGroup AdChoices

http://oracle.ittoolbox.com/groups/technicalfunctional/oracledevl/ora02253constraintspecificationnotallowedhere4351267

4/4

You might also like