Table aliases

Hi all,
I want to know whether use of table alias insted of table name uses less memory. What does this mean Table aliases help to keep SQL code smaller, therefore using less memory.

Where did you read that line? I'm hard-pressed to see how adding an alias can change performance characteristics.
Now, it may help to add aliases to the columns you're selecting, i.e.
SELECT a.col1,
       b.col2,
       c.col3
  FROM table1 a,
       table2 b,
       table3 c
WHERE ...because at parse time Oracle doesn't have to figure out what table col1 is coming from. The odds that this savings will be significant, however, are pretty minimal.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • Referencing table-aliased column names in JDBC

    We are attempting to port an application from MySQL to Oracle 8i, using JDBC as the database connection technology. The app has SQL statements using joins, e.g.
    SELECT A.*, B.* FROM table1 A, table2 B WHERE A.field1=B.field2 etc
    Often the tables have columns sharing the same name, so the table alias is required to avoid ambiguity (e.g. both tables have column ID, so they must be referenced as A.ID or B.ID).
    When using MySQL, the Java code
    String strField = rset.getString( "SURNAME" );
    or
    String strField = rset.getString( "A.SURNAME" );
    both succeed if the column name is unique, and if it is not unique, only the second form works. However, with Oracle, the second form never works, even though the column name is a valid column in the table aliased as A. Providing the whole table name does not work either:
    String strField = rset.getString( "table1.SURNAME" );
    If the Oracle JDBC driver does not support the {table-alias}.{column-name} syntax, then presumably the only way to reference ambiguous columns in joins is to supply the column number instead. (e.g. getString( 14 )). Our application generates dynamic SQL, and having to do this would be a MAJOR problem.
    We are currently using Oracle 8i - might this have been fixed in the move to 9i?
    Many thanks for any help,
    Steve Francis,
    London, UK.

    Can't do it by alias, as you would just repeat the
    calculation/function/whatever and add whatever additional "stuff"
    to create your new column.
    ISNULL(row1, 99999) AS ideal,
    ISNULL(row1, 99999)+10 AS newideal
    etc.
    Phil

  • Table aliases and Code Insight Completion

    Oops, never mind, I see there are lots of threads on this... so the big question is: Does anyone know when this will be supported?
    One thing I am noticing with the new SQL Developer is that if you use table aliases (as we do here) that Code Insight Completion doesn't work. For example, if I type the following SQL:
    SELECT *
    FROM My_Table mt
    WHERE mt.
    At the point where I put the dot (i.e. mt.) I would assume that code insight would drop down a box showing me the columns in the alias mt (i.e. My_Table). But nothing happens. Now if I put the full table name My_Table in there (i.e. WHERE My_Table.) then the drop down occurs. But not if you use a table alias - and putting the full table name in defeats the purpose of using aliases.
    I know that in other SQL developers (such as PL/SQL Developer) this works fine and we are used to it working this way with aliases. Is there another way to get SQL Developer to do it this way? Or is this going to have to be a NEW feature later on?
    Thanks.
    Tom
    Message was edited by:
    tbsimpson

    Try searching this has been answered.
    http://forums.oracle.com/forums/search.jspa?objID=f260&q=alias+insight
    -kris

  • Supporting table aliases for auto-completion.

    New patch but still no sign of the supporting table aliases for auto-completion.
    This is THE point where my team is desperatly waiting for so we can kick Toad out.

    Hi,
    The team is working on the next release of SQL Developer, the new patch was out in May. ;-)
    As I am checking the list of requests from the forum against the new release, I see we have addressed a long list of requests. This alias auto-completion has been requested and we have it on our task list, regrettably it will not be available in 1.1.
    A reminder that we have a Feature Request page on the Exchange, where you are welcome to add feature requests. I understand that by adding your comment here, you are also highlighting how important this feature it is to you and your team. It has a high priority on our feature task list.
    Regards
    Sue

  • Column and table aliases

    Hi,
    I was wondering if any of you know how to do the following:
    I have two tables (A & B).
    The columns on these two tables are similar in name in some cases eg: name and visit. So for table A I created an alias such as tb1 and for table2 tb2.
    This means now that my fields are referenced as: tb1.name and tb2.name.
    Now, I've got that sql code in an INLINE VIEW. I want to now reference those inline columns, how do I do it?
    I've got this as an example and would like to know if someone can shed some light on this:
    select re.name,re.visit from (select tb1.name,tb2.name,tb1.visit from table1 tb1, table2 tb2 where some_criteria_here) re
    where rownum <10;
    Thanks for your help.
    -J

    Just give those two name columns aliases in the inline view:
    select name1, name2, visit
      from (select tb1.name name1, tb2.name name2, tb1.visit
              from table1 tb1,
                   table2 tb2
             where some_criteria_here)
    where rownum < 10;I'm assuming there is an order by clause in that inline view that you are not showing here - that is the only reason you would need to use an inline view, otherwise it should just be:
    select tb1.name name1, tb2.name name2, tb1.visit
      from table1 tb1,
           table2 tb2
    where some_criteria_here
       and rownum < 10;

  • EPMA 11.1.2.1 Interface Tables Aliases are added as orphans

    Hi,
    I am setting up an EPMA shared library through interface tables and my aliases are not being recognized as aliases. EPMA is trying to import them as members and cannot find a hierarchy, so it is adding them to my shared dimensions as orphans.
    In my database, I have it set up as follows (for simplicity I will only use 1 dimension (Years) and the alias for that dimension).
    IM_DIMENSION
    LOADID-----C_DIMENSION_NAME-----C_DIMENSION_CLASS_NAME-----C_MEMBER_TABLE_NAME-----C_HIERARCHY_TABLE_NAME
    NULL-----------YEARS-------------------------YEAR-------------------------------------NULL---------------------------------YEARS_VW
    C_PROPERTY_ARRAY_TABLE_NAME-----C_DIM_PROPERTY_TABLE_NAME
    YEARS_ALIAS_VW-------------------------------NULL
    In my YEARS_VW I have
    LOADID-----PARENT-----CHILD-----ISPRIMARY
    null-------------YEARS--------FY09----- 1
    null-------------YEARS--------FY10----- 1
    and i have this for FY09- FY16 (The alias will be the year written out 2009, 2010, 2011, 2012, etc)
    My alias view looks like this:
    LOADID------PROPERTY------NAME------KEY------VALUE
    null--------------Alias---------------2009-------Default---null
    I have a row for each year 2009-2016
    Within EPMA, I created the alias dimension and the years dimension. I associated the alias dimension to the years dimension. I also created the import profile for the years dimension (PROF_YEARS). In the Map Dimensions section I have the dimension Years mapped to the Years shared library and selected replace as the process type. In the mapping options, only the alias column shows up and it is automatically mapped to Alias.
    When I run the profile, I get the following errors:
    "Member '2009' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2010' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2011' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2012' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2013' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2014' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2015' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    "Member '2016' will be added but it is an orphan. Please check the Hierarchy Section/Table for member"
    (I get this error for each alias that I have)
    The members all get added correctly, but the aliases are not being added as aliases, but as orphan members.
    Any help you can provide would be greatly appreciated.
    Thanks,
    Daniel

    If you are just using the default alias and you want to put an alias against a member then you include it in your hierarchy table.
    You would have a column called ALIAS=DEFAULT e.g.
    LOADID-----PARENT-----CHILD-----ALIAS=DEFAULT------ISPRIMARY
    null-----------YEARS-------FY09----- 2009----------------------1
    You would then map the column in the import profile
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Using Text Predicates with table aliases

    Is there any way to use text predicates with the CONTAINS operator against an event based on a table alias? Just trying to add the function "Contains" to the event struct doesn't work, and reading through the developer's guide, it looks like I need to manually construct an attribute set and add an exf$text attribute for it to work.
    The note in the docs says "The attribute sets consisting of one or more text attributes have to be assembled using the ADD_ELEMENTARY_ATTRIBUTE procedure and they cannot be created from an existing object type" and even if I created an attribute set from my table-alias-based event struct and added a new exf$text attribute to it, I can't see how the data would get from the table column into that attribute for evaluation. Is this use case unsupported?

    > {quote:title=user10427457 wrote: The reasons why I'm going to all this trouble are because 1) I'd like to keep my rules together and avoid having to have a separate rule class for the text-search rules, and 2) doing an object-based rule where I pass the CLOB in would prevent me from being able to use the CONTEXT index, which enables me to use other operators like WITHIN SENTENCE in my rules.
    > }{quote}
    Text feature has two types of indexes - CONTEXT and CTXRULE. CONTEXT index is ideal for searching for a document that matches a given query pattern. CTXRULE is used to identify a query pattern that matches a given document. Your application is best suited for CTXRULE and not the CONTEXT index. The Expression Filter automatically uses the CTXRULE index for attributes that are identified as Text attributes (using exf$text). This way you can write a single expression involving scalar attributes as well as text predicates and match them against instances of the event structure. Please read the following chapters for a better understanding of this functionality.
    Document classification - CTXRULE:
    http://download.oracle.com/docs/cd/B14117_01/text.101/b10729/classify.htm
    Expression Filter with CTXRULE:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b31088/exprn_spatialpred.htm#CHDDBICC
    In short, you should be able to create a Text attribute in the object-based event structure and expect the Expression Filter to automatically make use of CTXRULE index when appropriate.
    Regards,
    -Aravind.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Table aliases while creating views in KM

    Hello All,
    While executing an interface I noticed that it failed on the LKM step -
    Create View on Source
    (LKM MSQL to MSQL)
    On investigation, I found the error was because of an in invalid alias (alias created was a sql server keyword) that ODI had assigned to the source table. I extracted the code from the KM and I am hoping someone could direct me on how I could modify the KM so that the alias ODI creates is different from what its currently set to.
    TIA
    MN

    MN you dont need to modify the KM , when you click on the required Datastore , you will find the alias name , there change it accordingly or in the Datastore itself. I think that should help you .

  • Why Do we need to go for Alias? What are the Different uses of Aliases?

    Hello Everybody?
    I wanted to know the uses of aliases in RPD level. I do know some points like they will be used as a duplicate copy for the base tables and they will be used to remove the circular joins, otherthan this can anybody please give me a brief view about the different uses of Aliases.

    This article gives some good arguments for why you should use aliases:
    http://it.toolbox.com/blogs/achieving-great-bi/physical-layer-tips-and-gotchas-16445
    1. Import physical tables without FK joins turned on. Make the joins yourself, so there is nothing hidden that could cause problem. You should "own" your joins, not the other way around.
    2. Aliases are the technique one uses to eliminate circular joins. An easy example of how to use aliases is when you have a lookup table, like W_LOV_D - each version of it requires an alias, which will be joined to differently.
    3. With all tables & aliases, using a naming standard will guarantee that only one physical layer object will exist in one Business Model object. If you prefix every object in the physical layer with its Logical usage first (essentially making everything an alias), you will not be able to use the Customer (W_COUNTRY_D) table in the Employee logical table, as the standard would require you to use a table alias called Employee (W_COUNTRY_D).

  • Selecting two different Names using the same table with same field

    Hello,
    I am trying to display several fields from different tables. Here are some of the fields that I need: The instructor needs to go after the social.
    WESL | ENGR-1101-SW1 | Hinojosa | Ashley | Social | Instructor |
    I am using a table where they have the social and I need to get both the student and the instructor. How do I select the instructor when the instructor's id is on a different table. example
    CLASS PERSON CLASS_ASSIGN
    student_id student_id: name facutly_id
    Here is the code that I have so far and it works.
    rem ----------------
    rem Filename: cer.sql
    rem Purpose: to get data from banner and put into flat file
    rem Date: August 17, 2006 4:51 P.M.
    rem Author: Robert Hernandez
    rem ---------------
    rem Notes: Need to add the Instructor - having problems
    rem using the same spriden_id.
    rem Also need to have admissions enter the grad date for
    rem several students: Procedure is working as is.
    declare
    l_output utl_file.file_type;
    grad_month varchar2(2);
    buffer varchar2(1000);
    cursor cursor1 is
    select ssrmeet_bldg_code,
    ssbsect_subj_code,
    ssbsect_crse_numb,
    ssbsect_seq_numb,
    spriden_last_name,
    spriden_first_name,
    spriden_id,
    scbcrse_title,
    ssbsect_term_code,
    sfrstcr_grde_code,
    sorhsch_graduation_date,
    decode(substr(sorhsch_graduation_date,4,3),'JAN','01',
    'FEB','02',
    'MAR','03',
    'APR','04',
    'MAY','05',
    'JUN','06',
    'JUL','07',
    'AUG','08',
    'SEP','09',
    'OCT','10',
    'NOV','11',
    'DEC','12') as grad_month,
    sorhsch_sbgi_code
    from ssbsect,ssrmeet,sfrstcr,spriden,scbcrse,sorhsch
    where rownum < 200
    and ssbsect_seq_numb like 'S%'
    and (ssrmeet_term_code = ssbsect_term_code
    and ssrmeet_crn = ssbsect_crn)
    and (ssbsect_crn = sfrstcr_crn
    and sfrstcr_pidm = spriden_pidm
    and length(spriden_id) = 9
    and substr(spriden_id,1,1) <> 'A')
    and (ssbsect_crse_numb = scbcrse_crse_numb
    and ssbsect_subj_code = scbcrse_subj_code)
    and spriden_pidm = sorhsch_pidm
    and sorhsch_graduation_date is null
    order by ssbsect_crse_numb;
    begin
    l_output := utl_file.fopen('CER','rbfpce.txt','W');
    for cur1_rec in cursor1 loop
    buffer:= cur1_rec.ssrmeet_bldg_code||'|'||
    cur1_rec.ssbsect_subj_code||'-'||
    cur1_rec.ssbsect_crse_numb||'-'||
    cur1_rec.ssbsect_seq_numb||'|'||
    cur1_rec.spriden_last_name||'|'||
    cur1_rec.spriden_first_name||'|'||
    substr(cur1_rec.spriden_id,1,3)||'-'||
    substr(cur1_rec.spriden_id,4,2)||'-'||
    substr(cur1_rec.spriden_id,6,4)||'|'||
    cur1_rec.scbcrse_title||'|'||
    cur1_rec.ssbsect_term_code||'|'||
    cur1_rec.sfrstcr_grde_code||'|'||
    '20'||SUBSTR(cur1_rec.sorhsch_graduation_date,8,2)||
    cur1_rec.grad_month||'|'||
    cur1_rec.sorhsch_sbgi_code;
    utl_file.put_line(l_output,buffer,false);
    end loop;
    utl_file.fclose(l_output);
    exception
    when no_data_found then
    utl_file.fclose(l_output);
    end;
    /

    Can you be more precise , please :
    - which table stores the people identities ? (I call this one Identity)
    - which table gives the class where the student works in (I cal l this one Claa_attendees)
    - which table gives the instructor of a class (I call this one Class)
    If your issue is that you have one table which stores Itendities , and you need to display Student identity and Instructor Identity, you have to call this table twice in your query , using table aliases . I mean :
    Select Stud_iden.name, Instr_iden.name
    From Identity Stud_iden, Identity Instr_iden, Class_attendees, Class
    Where Class.clas_id = class_attendees.class_id
    and class.instructor_id = Instr_iden.people_id
    and class_attendees.student_id = Stud_iden.people_id
    Is this what you need to do ?

  • Changing the LTS mapping in BMM layer  to new Physical Alias table

    Experts
    I need to change the source table mapping in my BMM layer to new physical tables aliases.
    I have finished BMM layer design (column name changes, business friendly names etc.) before actually creating the alias tables in the Physical layer and I know I hv to run for hiding now. I expected changing the logical source mapping to the new aliases will work but it's not the case though it works partially. Since the Column names are changed in the bmm, I have to manually change the Expression, Physical Table in the LTS column mapping tab for each non-matching name logical columns.
    Column mapping is intact where both the BMM columns and the new Physical alias names match.
    eg: CALENDER_YEAR(BMM) ---> CALENDAR_YEAR(Physical alias) mapping is intact but
    Week Day(BMM) ---> WEEK_DAY(Physical alias) need to be changed manually.
    Any tips/suggestions will be appreciated.
    Regards,
    Tom

    Hi Tom,
    I too do not see any other options here other than manually modifying the individual logical columns. When there is a new logical column, we have to map it manually to the physical column explicitly because the Admin tool will not know which physical column to pick up.
    Hope this helps.
    Thank you,
    Dhar

  • Updating one table with mult. table where clause

    I'm having problems with my update statement. I want to update one table that has a mulitple table where clause. Not sure how to accomplish this. Here is what I have so far.
    update lawson.apvenmast a
    set vendor_status = 'I'
    where ((select * from apinvoice i
    where i.due_date <= TO_DATE('20011231', 'YYYYMMDD') and
    i.vendor = a.vendor)
    ((apvenmast.ven_class = 'INS') or
    (apvenmast.ven_class = 'REF')));
    Am I on the right track?
    thanks in advance for any help.
    Lisa Mears

    A lot is missing.
    where ((select * from apinvoice iA where clause should be like
    where <something> IN (select <something> from ...)
    ((apvenmast.ven_class = 'INS') or
    (apvenmast.ven_class = 'REF')));Where does this belong? There is no AND or OR with these two lines.
    Check your table aliases too.

  • Universe creation- without fact tables

    Hi All,
    I want to create a universe , but the problem is I don have any fact tables in my database. So in which schema i can create a universe?
    I have one Master table with all  Primary Key? So i thought of mapping this master table with other Dimansion table?say any advantages/ disadvatages of star Schema?

    Hi,
    I don't want to talk about adavantages/diadvantages of star schema as if would take time.
    My recommendation is that if you cannot change the database schema of your customer you can build a universe on any database schema and use all features that to obtain the best universe you can have:
    <ul><li>Create table aliases
    <li>Create contexts if needed
    <li>Create derived tables to avoid contexts or complex joins
    <li>etc
    I already had, in the past, to build a universe on schema that contained only a big table and I successfully created a universe and used it.
    Didier

  • Cannot access columns in a result set using table alias in Oracle database

    I have a query which joins a few tables. There are a few columns in various tables with identical names. In the query, I have assigned table aliases for each table thinking it'll be the manner in which I access a specific column in a specific database table. However, when trying to retrieve the column, I'm getting an exception stating "Invalid column name". I had no problem doing so in my last project when I was coding against MySQL database so this is likely to be a driver implementation issue. My current workaround is to assign a column alias though I find this to be annoying and it does make the query very verbose.
    My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.
    I'm querying an Oracle 10i database in a managed environment (database connection is obtained from a Weblogic data source).
    Sample query:
    select
    a.address1,
    d.address1
    from
    account a
    inner join
    department d on a.department_id = d.department_id
    where
    a.account_id = 1000;
    When trying to access a ResultSet instance in the following manner, I will get an exception:
    rs.getString("d.address1");
    Retrieving "address1" will return the first column in the select clause.

    jonathan3 wrote:
    My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Since you already figured out that you can use an alias one can suppose that it is the last in that you are missing that you already have a solution.
    You can try extracting the meta data to see if it has a name without the alias. Probably not.
    Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.One can only suppose that you consider using names "elegant".

  • Alias Tables and Duplicate tables in Physical Layer

    Hi all,
    I have a small doubt in physical layer. We have two options when we right click table, 'Alias' and 'Duplicate'. To create another instance of a table, can we use any one of these. Does it make any difference
    Thanks & Regards,
    Jagi

    Hi,
    If u duplicate any table the join conditions will carry with respective tables , same name appending (TableName#1)
    In case of alias u need to specify joins conditions explicitly
    We can use same table with different constrains to the same table
    Aliases used, if you need to replicate a physical table and not create multiple tables with the same data
    If you delete any column in the Original table automatically deleted in alias
    table and Its not reflected in Duplicate table.
    Steps:
    Right Click the original table. Choose New Object and choose Alias.
    The mistake most people make is try to bring in the same table again and rename it or choose Duplicate by right clicking the original table.
    Thanks,
    Balaa...

Maybe you are looking for

  • Optional MTOM as by MTOM Serialization Policy

    Hello All, I can't seem to find how to implement a jax-ws web service that allows both optimized and non-optimized messages as stated in MTOM Serialization Policy (http://www.w3.org/TR/2007/WD-soap12-mtom-policy-20070918/). Is it implied that when ja

  • Can you simultaneously display multiple images in a slideshow?

    I think you were able to do this in previous versions of Aperture. Weren't there slideshow themes that showed, say, four images at a time? Is this capability gone now?

  • MM reports required

    Hi experts, We need one report which will show accounting entries not posted in FI . Regards, Samaar

  • Idoc xml msg

    Can we track idoc xml msg directly from Integration Server?

  • HTTP parameter for payload size in SXMB_ADM

    Hi, In integration engine configuration (SXMB_ADM), we can configure parameters like the HTTP_TIMEOUT etc. Is there any parameter regarding payload size that can be processed with an HTTP post? Also, does this change dynamically depending upon curren