ajaybelde
asked on
is there a way i define constant globally in oracle
I want to define a constant or some macro defined value in oracle db and use it globally or at schema level. is that possible by any means.
Here was a macro defined for IPNEWVAL address lengths we want use in various places (db definitions and SPs).
is there a way i can define a value to IPNEWVAL=say some value 120 and use the defined IPNEWVAL in SP,Trigger or constarints
ex: instead of giving constant value 120. i want pas IPNEWVAL which is defined already using that my contsraint can get the value.
CHECK (name NOT MATCHES '' AND LENGTH(name) <= IPNEWVAL)
Here was a macro defined for IPNEWVAL address lengths we want use in various places (db definitions and SPs).
is there a way i can define a value to IPNEWVAL=say some value 120 and use the defined IPNEWVAL in SP,Trigger or constarints
ex: instead of giving constant value 120. i want pas IPNEWVAL which is defined already using that my contsraint can get the value.
CHECK (name NOT MATCHES '' AND LENGTH(name) <= IPNEWVAL)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sdstuber: how would i call the context in trigger. and also i just want to use the conext has a fixed constant like number 100. and should be able to call it in trigger and SP
any time you need to find the value you use
SYS_CONTEXT('mycontext','i pnewval')
whether in a trigger, sql statement, constraint, pl/sql function, etc
SYS_CONTEXT('mycontext','i
whether in a trigger, sql statement, constraint, pl/sql function, etc
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
and also can we use Types here?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
your's suggestion was helpful and i was able to help appteam
You might want to declare it as a constant though instead of just another variable.