Table name alias too long in Oracle?

Posts   
 
    
rich
User
Posts: 22
Joined: 09-Sep-2004
# Posted on: 12-Jan-2005 15:46:50   

I have hit some generated code that is creating SQL with table identifiers aliased using table name plus "__ALIAS". Unfortunately these are greater than 30 characters in length and give ORA-00972 in the Oracle version I am using.

I seem to recall something in method arguments somewhere about table aliases but should the LLBLGen code not spot this before doing it? Are there any workarounds which don't involve changing our (multi-database) data logic code? Hopefully there is just something I've missed.

Thanks

rich
User
Posts: 22
Joined: 09-Sep-2004
# Posted on: 12-Jan-2005 15:55:14   

By the way, it's a prefetch path that's creating a sub-query containing the alias that is too long. A brief look at the methods involved doesn't seem to show anywhere for me to affect the aliasing that takes place. The only aliasing stuff I can see in the helpfiles is information about aliasing when you relate to the same table twice. Am I missing something or do I need to shorten the actual database object name to sort this out?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Jan-2005 16:57:03   

This is caused by the prefetch path definition code which is stored in templates.

It is caused by the fact that '__ALIAS' is appended to the intermediateentity name. It's best to shorten that name to 23 characters or less.

You can also update the template if you want, but that's not recommended. I can't alter this to another value as several customers have code written based on '__ALIAS' being appended to the query to apply sorting on that intermediate entity. I didn't know there was that limit for oracle (another customer had the same issue last week) until .. last week. simple_smile I did fix an issue with the m:n prefetch paths 2 days ago in the runtime libs which generated large alias names for column names which could exceed 30 characters as well.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 17-Jan-2005 15:51:19   

I've decided to fix this. "__ALIAS" has been changed to "_". Please download teh latest shared templates archive. If you have code relying on that suffix, you have to change that code to work with the new templates.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 18-Jan-2005 11:00:18   

Hi Frans,

I've just taken on this problem for rich (my colleague). I was just dreading changing the name of all the tables that are >23 chars, thank god you decided to change it!!

Cheers - I'll let you know how the latest build goes wink

carlor
User
Posts: 34
Joined: 12-Jan-2005
# Posted on: 10-Mar-2005 17:49:38   

Hi there,

I think I've run into the same problem. Can you confirm?

I have a few tables with column names that are 30 characters long. Trying to load a collection with a filter based on that column name causes the ORA-00972 error whereas performing the same operation with a 29 character long column name is successful.

Is this caused by LLBL prepending the underscore on the column name? If this is the case, we can change the column names because we are still in the early stages of the project.

Thank you,

Carlo.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Mar-2005 17:54:47   

Yes, the problem you're running into is indeed the appended _ to make possible duplicate names not existing.

Frans Bouma | Lead developer LLBLGen Pro
carlor
User
Posts: 34
Joined: 12-Jan-2005
# Posted on: 10-Mar-2005 19:52:06   

Thank you.

Carlo.

carlor
User
Posts: 34
Joined: 12-Jan-2005
# Posted on: 10-Mar-2005 21:44:29   

So, now for a possibly stupid question...

The database has been changed to reduce the length of the column names. I started up the designer and refreshed the catalog so that the new names show up in the Catalog Explorer.

Now, how do I get those new names migrated to the Project Explorer for the existing entities? I thought it would have been done automatically when I either refreshed the catalog or regenerated the project. I guess I can either rename the columns manually but then I run the risk of spelling mistakes, missing some, etc. I could also delete the entity and then re-add it but I would be afraid of that affecting typed lists, etc.

Any suggestions?

Thanks,

Carlo.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Mar-2005 23:30:33   

carlor wrote:

So, now for a possibly stupid question...

The database has been changed to reduce the length of the column names. I started up the designer and refreshed the catalog so that the new names show up in the Catalog Explorer.

Now, how do I get those new names migrated to the Project Explorer for the existing entities? I thought it would have been done automatically when I either refreshed the catalog or regenerated the project. I guess I can either rename the columns manually but then I run the risk of spelling mistakes, missing some, etc. I could also delete the entity and then re-add it but I would be afraid of that affecting typed lists, etc.

That feature, synchronizing entity names with their mapped table names (and fields etc.) is added to 1.0.2004.2, now in beta. So it's coming soon, the 1.0.2004.1 version doesn't have this.

Frans Bouma | Lead developer LLBLGen Pro
carlor
User
Posts: 34
Joined: 12-Jan-2005
# Posted on: 11-Mar-2005 16:12:46   

Hi there,

Ok. So I tried deleting the entities that contained the long field names and re-added the entities with the shortened names. That didn't work because there are relations spread all through the project that didn't get updated.

Please tell me I don't have to regenerate the whole project from scratch just because some field names changed. Please tell me I'm just missing something very simple...

Unless there is a simple solution, I'm going to have to revert to an earlier version of the project (before I added the tables with the long field names) and try to rebuild the project to the current state.

Carlo.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 11-Mar-2005 16:44:39   

As I said earlier, teh current version, 1.0.2004.1, doesn't have that feature yet (1.0.2004.2, now in beta, does), so these names aren't updated when a table name changes in the database. I'm sorry.

Frans Bouma | Lead developer LLBLGen Pro