ORACLE equivalent of DBSERVERNAME
Posted in 2004
Topics: Networking & sqlhosts Configuration
For all the INFORMIX and ORACLE savvy folks :
In INFORMIX there is a default value called DBSERVERNAME that can be
assigned to a column during the table definition as follows:
create table t1 (c1 char(18) default DBSERVERNAME );
Is there an ORACLE 9i equivalent for DBSERVERNAME that can be used in the
table.column definition?
Thanks.
--
Rajiv Jhaveri
rjhaveri@optonline.net
And this DBSERVERNAME, when used with a column in the manner you have
specified, does what?
"Rajiv Jhaveri" <rjhaveri@optonline.net> wrote in message news:<cdot0e$q4u10@kcweb01.netnews.att.com>...
> For all the INFORMIX and ORACLE savvy folks :
>
> In INFORMIX there is a default value called DBSERVERNAME that can be
> assigned to a column during the table definition as follows:
> create table t1 (c1 char(18) default DBSERVERNAME );>
> Is there an ORACLE 9i equivalent for DBSERVERNAME that can be used in the
> table.column definition?
>
>
> Thanks.
scottishpoet wrote:
> And this DBSERVERNAME, when used with a column in the manner
> you have specified, does what?
Good question! A better example might be something like:
create table t1
(c1 serial NOT NULL,
c2 char(18) default DBSERVERNAME);
There was a thread within just the past couple of days about using default
values on an insert and the fact that you must supply at least one column
for the insert. The example given - with just one field in the table -
could not use the default value as that one field would have to be specified
in the insert statement. That is what you were getting at, isn't it?
And, just to be a bit more thorough... using DBSERVERNAME as a default
insert value would use the name of the server as the value to insert into
that field. (Big surprise, right?) Oh, one final note on that - the
documentation (Guide to SQL: Syntax, version 9.4) recommends the field be
defined to hold 128 bytes.
> "Rajiv Jhaveri" <rjhaveri@optonline.net> wrote:
> > For all the INFORMIX and ORACLE savvy folks :
> >
> > In INFORMIX there is a default value called DBSERVERNAME that can be
> > assigned to a column during the table definition as follows:
> > create table t1 (c1 char(18) default DBSERVERNAME );> >
> > Is there an ORACLE 9i equivalent for DBSERVERNAME that can be used in
the
> > table.column definition?
I'm afraid I can't help the original poster with the Oracle part of the
question.
--
June Hunt
June C. Hunt wrote:
> scottishpoet wrote:
>
>>And this DBSERVERNAME, when used with a column in the manner
>>you have specified, does what?
>
>
> Good question! A better example might be something like:
>
> create table t1
> (c1 serial NOT NULL,
> c2 char(18) default DBSERVERNAME);>
> There was a thread within just the past couple of days about using default
> values on an insert and the fact that you must supply at least one column
> for the insert. The example given - with just one field in the table -
> could not use the default value as that one field would have to be specified
> in the insert statement. That is what you were getting at, isn't it?
>
> And, just to be a bit more thorough... using DBSERVERNAME as a default
> insert value would use the name of the server as the value to insert into
> that field. (Big surprise, right?) Oh, one final note on that - the
> documentation (Guide to SQL: Syntax, version 9.4) recommends the field be
> defined to hold 128 bytes.
>
>
>>"Rajiv Jhaveri" <rjhaveri@optonline.net> wrote:
>>
>>>For all the INFORMIX and ORACLE savvy folks :
>>>
>>> In INFORMIX there is a default value called DBSERVERNAME that can be
>>>assigned to a column during the table definition as follows:
>>> create table t1 (c1 char(18) default DBSERVERNAME );>>>
>>>Is there an ORACLE 9i equivalent for DBSERVERNAME that can be used in
>
> the
>
>>>table.column definition?
>
>
> I'm afraid I can't help the original poster with the Oracle part of the
> question.
>
> --
> June Hunt
Go to http://www.psoug.org
Click on Morgan's Library
Click on SYS_CONTEXT Built-in Function
This is a subset of the environment variables are available in Oracle.
At least one of these should meet your need. Just remember that in
Oracle database does not equal instance. You connect to an instance ...
not a database.
Daniel Morgan