473,385 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question on Alias

Hi,

An alias is an alternate name for a table or a view. Now, suppose I
create an alias on a non existent table in the control centre , it
gives me a warning but it still creates the alias for an object which
is not even present.

create alias newalias for nonexistenttable;

[IBM][CLI Driver][DB2/NT] SQL0403W The newly defined alias
"TARIQ.newalias" resolved to the object "TARIQ.nonexistenttable" which
is
currently undefined. SQLSTATE=01522

My question is when an alias points to some thing which is present in
the database,
why does it allow to CREATE the alias when the object is not present?

Regards,
rAinDeEr

Jun 22 '06 #1
6 6970
"rAinDeEr" <ta**********@gmail.com> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
Hi,

An alias is an alternate name for a table or a view. Now, suppose I
create an alias on a non existent table in the control centre , it
gives me a warning but it still creates the alias for an object which
is not even present.

create alias newalias for nonexistenttable;

[IBM][CLI Driver][DB2/NT] SQL0403W The newly defined alias
"TARIQ.newalias" resolved to the object "TARIQ.nonexistenttable" which
is
currently undefined. SQLSTATE=01522

My question is when an alias points to some thing which is present in
the database,
why does it allow to CREATE the alias when the object is not present?

Regards,
rAinDeEr


That is a design decision. One advantage is that if you drop a table and
recreate it, the alias does not need to be recreated.
Jun 22 '06 #2

Hi Mark,
That is a design decision. One advantage is that if you drop a table and
recreate it, the alias does not need to be recreated.


That doesnt answer my question. I dont have any table/view but still I
am able to create an object which is of no use to me. It should display
a database error, right?

Regards,
rAinDeEr

Jun 22 '06 #3
"rAinDeEr" <ta**********@gmail.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...

Hi Mark,
That doesnt answer my question. I dont have any table/view but still I
am able to create an object which is of no use to me. It should display
a database error, right?

Regards,
rAinDeEr


No, it does not give a database error. You can create the alias before the
table, or you can drop the table and the alias still exists.
Jun 22 '06 #4
Mark A wrote:
"rAinDeEr" <ta**********@gmail.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...
Hi Mark,
That doesnt answer my question. I dont have any table/view but still I
am able to create an object which is of no use to me. It should display
a database error, right?

Regards,
rAinDeEr


No, it does not give a database error. You can create the alias before the
table, or you can drop the table and the alias still exists.

The "technical" reason why this works is that teh ALIAS contains no
information that requires the existence of the underlying objects.
It's just a forward pointer.
By contrast a view needs to be able to derive the column names and
column types, so it requires teh underlying table to exists.
Note that You can't use the alias in e.g. a view unless the underlying
object exists.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Jun 22 '06 #5

Serge Rielau wrote:
Mark A wrote:
"rAinDeEr" <ta**********@gmail.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...
Hi Mark,
That doesnt answer my question. I dont have any table/view but still I
am able to create an object which is of no use to me. It should display
a database error, right?

Regards,
rAinDeEr


No, it does not give a database error. You can create the alias before the
table, or you can drop the table and the alias still exists.

The "technical" reason why this works is that teh ALIAS contains no
information that requires the existence of the underlying objects.
It's just a forward pointer.
By contrast a view needs to be able to derive the column names and
column types, so it requires teh underlying table to exists.
Note that You can't use the alias in e.g. a view unless the underlying
object exists.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/


Hi,

Agree its a forward pointer. But if i Dont have any thg to point why
does it create a pointer....

<<Sigh>>...May be there is lot of Technical Design involved..lot of
advantages that I dont see...will come back 2morrow and think about
it...

Thanks Mark , Serge

Regards,
rAinDeEr

Jun 22 '06 #6
Ian
rAinDeEr wrote:

Agree its a forward pointer. But if i Dont have any thg to point why
does it create a pointer....

<<Sigh>>...May be there is lot of Technical Design involved..lot of
advantages that I dont see...will come back 2morrow and think about
it...


Why is this a problem?

Realize that aliases are "special" objects. If you try and do a select
from an alias that points to nothing, you will get SQL0204N (table does
not exist), but the error message refers to the table referenced by the
alias, not the alias.

Also, if you say, "drop table my.alias", would you expect DB2 to drop
the alias or the table?

Jun 22 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: A.V.C. | last post by:
Hello, I found members of this group very helpful for my last queries. Have one problem with CASE. I can use the column name alias in Order By Clause but unable to use it in WHERE CLAUSE. PLS...
12
by: John Sidney-Woollett | last post by:
I have to convert an java web application currently using an Oracle DB back end to one using a Postgres backend. In Oracle much of the application logic is abstracted away from the java...
2
by: tom horner | last post by:
Any ideas on why drop and create alias statements would take a long time? We recently went through an upgrade of our production database, which included alter statements to table structures,...
5
by: Santiago Ordax Solivellas | last post by:
Hi. We have almost all our tables defined on library lib1 and some on lib2. We have alias defined on lib1 to access tables on lib2 so there is no need to qualify library name. Alias for tables on...
24
by: ark | last post by:
Hello group, Could you help me with this: static const int x; ............ something ............. static const int x = 17; It looks perfectly legal to me but MSVC/C++ 6.0 gives, on the...
3
by: xllx.relient.xllx | last post by:
I have a question about an example presented in the book "INFORMIT C++ Reference Guide" by Danny Kalev: <code> string getmagicword() ( return string("Supercalifragilisticexpialidocious"); );
30
by: Logos | last post by:
I have what may be a bug, or may be a misunderstanding on how pass by reference and class inheritance works in PHP. Since I'm relatively new to PHP, I'm hoping for a little outside help to shed...
8
by: joemacbusiness | last post by:
Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial:...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
Can someone confirm if my no spam alias is set up correctly to get answers to questions. I have been talking to the concierge for over a week to get an answer to a question. Each time I am told to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.