How to remove column name in select clause

Hello Guys,
I just want to remove a column name in select clause. Because, I don't want to write all column names. I hope I express myself.
In other words, I want the following.
Select   * - unwanted_column  from table;
instead of this
Select col1, col2, col3, col4, ........ col 10000 from table;

Hi,
Sorry, there's nothing in SQL that means "all columns *except* ...". As the others have said, the only way to get those results in SQL is to list all the columns you do want.
Your front end may have some feature that allows you to hide a specific column. For example, in SQL*Plus, you can use <tt> COLUMN ... NOPRINT </tt> , like this:
COLUMN      dname     NOPRINT
SELECT       *
FROM       scott.dept
ORDER BY  dname
;Output:
`   DEPTNO LOC
        10 NEW YORK
        40 BOSTON
        20 DALLAS
        30 CHICAGOThere is a column called dname in the scott.dept table; the query above actually uses it. But, because of the COLUMN command, SQL*Plus won't display that column.
Edited by: Frank Kulash on Feb 26, 2013 10:10 AM
Changed scott.dept example.

Similar Messages

  • How to mention column names in LIKE clause ?

    Hi.
    i need a query like this. is it possible ?
    select * from tableA inner join tableB on a.col1 = b.col1 and a.col1 LIKE b.col1||'%'

    is it possible?Yes, although it doesn't make sense to do an equality join on the same columns you're then doing a like comparison on.
    Did you try it?
    If not why not? Takes less time than asking a question.
    SQL> create table tablea
      2  (col1 varchar2(10));
    Table created.
    SQL>
    SQL> create table tableb
      2  (col1 varchar2(1));
    Table created.
    SQL>
    SQL> insert into tablea values ('apple');
    1 row created.
    SQL>
    SQL> insert into tableb values ('a');
    1 row created.
    SQL>
    SQL> select * from tablea a join tableb b on a.col1 like b.col1||'%';
    COL1       C
    apple      a
    SQL>

  • How to get column names for a specific view in the scheme?

    how to get column names for a specific view in the scheme?
    TIA
    Don't have DD on the wall anymore....

    or this?
    SQL> select text from ALL_VIEWS
      2  where VIEW_NAME
      3  ='EMP_VIEW';
    TEXT
    SELECT empno,ename FROM EMP
    WHERE empno=10

  • How to pass column name as a   values from one page  to another

    hi
    i have created a report(pivot) from a table
    SQL> SELECT * FROM T;
    C1  C2          C3 D                SEQ
    A   AA           2                    1
    A   AB           3                    2
    A   AC           2                    3
    B   AB           5                    4
    B   AC           6                    5
    SQL> SELECT C1
      2  ,NVL(MAX(CASE WHEN C2='AA' THEN C3 END),'') AA
      3  ,NVL(MAX(CASE WHEN C2='AB' THEN C3 END),'') AB
      4  ,NVL(MAX(CASE WHEN C2='AC' THEN C3 END),'') AC
      5  ,SUM(C3) FROM T GROUP BY C1;
    C1          AA         AB         AC    SUM(C3)
    A            2          3          2          7
    B                       5          6         11
    SQL>
    my requirement in Apex is like this(reverse)
    eg-
    when i click on cell values '2' then,it should return
    C1  C2          C3 D                SEQ
    A   AA           2                    1
    {quote}how to pass column name as a  values from one page to another
    for example i have to pass 'c2' as a value to next page{quote}for report pivot you can reffer below link
    Report
    Amu

    thanks for your reply
    i 'm doing what exactly you mention here .
    my problem here is
    i have 15 columns
    i am executing a query based on the values of the column(column name)  in the target page
    1)here i am passing(all) the column values to the next page-but  i want to pass only one column values(column name)
    when i click on any cell of that  column
    OR
    2)i can pass all column name to target page -there(in the target page) i can filter out
    i think option 1 would good if you filter out the unwanted columns
    Regards
    Amul

  • How to rename column name of table?

    Hello...
    How to rename column name of table?
    The column have data.
    Thanks.
    Martonio.

    The following should work in 9i release 2 and above.
    SQL> create table mytable(col1 varchar2(2),
      2  col2 date);
    Table created.
    SQL> insert into mytable values('t1',sysdate);
    1 row created.
    SQL> select * from mytable;
    CO COL2
    t1 30-NOV-04
    1 row selected.
    SQL> desc mytable
    Name                                      Null?    Type
    COL1                                               VARCHAR2(2)
    COL2                                               DATE
    SQL> alter table mytable rename column col2 to mydate;
    Table altered.
    SQL> desc mytable
    Name                                      Null?    Type
    COL1                                               VARCHAR2(2)
    MYDATE                                             DATE
    SQL> select * from mytable;
    CO MYDATE
    t1 30-NOV-04
    1 row selected.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Productionhttp://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/wnsql.htm#972698

  • Concat to retrieve column name in select

    This is basically what I am trying to do:
    SELECT 'LY_'&#0124; &#0124;to_char(sysdate,'MON')&#0124; &#0124;'SALES' FROM TERR_ACCT_SUM
    Except, instead of returning "LY_OCTSALES", I would like to select the rows in the column LY_OCTSALES. How can I "create" the column name to select?

    Not sure if your question was meant using SQL*PLUS or java code.
    If you want to use JDBC you could create SQL statements in a String variable and pass it to the executeQuery() method in the Statement object .
    If you are using BC4J if you want you could create Dynamic View Objects based on SQL statments created at the run time.
    raghu

  • Change column names when selecting from a collection

    Anyone know how to change C001,C002...etc to readable column names when selecting from a collection? Aliases don't work!
    Paul Platt

    Paul,
    Edit the report attributes and change the column headings by selecting the "Custom" radio button first.
    Sergio

  • Item value as column name in select

    Hi,
    I have a problem with selecting the columns in the query using items. For example: I have a query:
    select column_a from table; or select column_b from table;
    and I want to do something like this:
    - any item in which I choose the column name
    - query: select column_from_item from tale
    Is it possible?
    My apex version: 4.0.2.00.07
    My oracle db version: oracle 11g

    Unfortunately, it does not work. For example:
    I have a table book (title, themes ...), which is eight rows. When I create a static list of items containing the column names (display name and returns the name) and a report based on select according to your design(select :P5_select from table;), you get eight records in the name of the column.
    item: select list -> static list -> display value: Title, return value: Title, name: P1_title
    select :P1_title from books;
    result which i get:
    Title
    Title
    Title
    Title

  • How to get column names in table maintenance dialog?

    I created a new Z table and created a maintanance dialog so that I can maintain the table through sm30. i don't see columns names on maintenance screen, just a "+" sign for each column! Could someone please tell me how to display column name?
    Thanks.
    Mithun

    Hello Mithun
    The column texts are taken from the field descriptions of the data elements used in your z-table. A "+" sign usually indicates that none of the field descriptions of the data element has been maintained.
    Regards
      Uwe

  • How to pass column name at run time in function.

    how to pass column name at run time in function as parameter.
    thank in advance
    pramod patel

    Hello,
    Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
    Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
    p_value_number in number)
    return number is
    v_stmt varchar2(500);
    begin
    v_stmt := 'update emp
    set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
              where empno = 7369';
    execute immediate v_stmt;
    return 0;
    commit;
    end;
    call to this function can be like this..
    declare
    v_number               number;
    begin
    v_number := fun_updtest('SAL',5000);
    end;
    Adinath Kamode

  • Maximum no. of columns allowed in SELECT clause - Urgent please

    Hi,
    I am constructing SQL query dynamically in a stored proc. based on user inputs. I am getting following error when I have around 400 columns in my SELECT clause. FROM, WHERE, GROUP BY clauses are same eventhough I have 30 columns and I don't have any problems here. Can anyone please let me know what is maximum no. of columns allowed in a query. I am working on Oracle 9i Release2.
    Thanks in advance.

    ORA-01467 sort key too longIt's not the SELECT clause that causes this, it's most likely the GROUP BY clause. Basically, the columns in the GROUP BY clause have to fit comfortably within a single database block. Does that sound like it might be a problem with your query?
    Cheers, APC
    Message was edited by:
    APC

  • How to use column name as variable in select statement

    hi,
    i want to make a sql query where in select statement using variable as a column name. but its not working plz guide me how can i do this.
    select :m1 from table1;
    regards

    Hi,
    Is this what you want..
    SQL> select &m1 from dept;
    Enter value for m1: deptno
    old   1: select &m1 from dept
    new   1: select deptno from dept
        DEPTNO
            10
            20
            30
            40
    SQL> select &m1 from dept;
    Enter value for m1: dname
    old   1: select &m1 from dept
    new   1: select dname from dept
    DNAME
    ACCOUNTING
    RESEARCH
    SALES
    OPERATIONS
    SQL> select &&m1 from dept;
    Enter value for m1: loc
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTON
    SQL> select &&m1 from dept;
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTONIf you use single '&' then each time you fire the query, It will ask for the new value..
    But if you will use double '&&' the value of m1 will be persistent across the session..
    Twinkle

  • How to find column names in a table

    Am learning the basics of SQL Plus.
    Have entered the following query:
    SELECT * FROM t_ebb_session;
    This gives me the following output.
    USER_ID SESSION_ID LAST_ACCE
    However LAST_ACCE is not the full name of the column as I get 'Invalid column name when I use it in a select statement.
    How do I display the full name?

    By default, SQL*Plus will set the column display width of a character column to its size in the database, and the heading will be the column name in uppercase, truncated to fit that width if necessary. (There is a different rule for numeric columns.)
    You can override this with the COLUMN command, e.g:
    COLUMN some_column_name FORMAT a30 HEADING "Alternative Name"
    Check out the SQL*Plus documentation for all the COLUMN options.

  • How to validate column name in dynamic made sql?

    Oracle db, jdbc, web app with struts2/spring.
    Example table could be this:
    CREATE TABLE album
    album_id number(10)  not null,
      artist  varchar2(50) not null,
    title  varchar2(50) not null,
      released  DATE,  
      CONSTRAINT album_pk PRIMARY KEY (album_id)
    );In may app the user MAY search, MAY sort, and the result from an select might return 10.000 rows.
    The basic sql usually look like this.
    String sql = "select album_id, artist, title, released from album";Then in the html page the user can add search criteria for each column. Like type "iron maiden" in artist field, put "1982" in released field. And you all know what the exceptionally result should be from that :)
    Now I need to modify the sql a bit:
    if( artist search field contains stuff )
       sql = sql + " where nvl( artist,' ') like ?"
    }we try use prepared statements right? So we use ? as placeholders, and then add "iron maiden" into this statement later on.
    Nice, no big fuzz right, and pretty safe from sql injections i guess.
    But now I have to have an if/else for every single field in the table. Boring. In my app I got like 25 tables like this, with 20 columns minimum. Copy/Paste have never been so boring.
    I also might have to add "order by" with user selected columns and their order. I have to count the query to get total result in case i got to split it up in pages. So there is alot of if/else and sql = sql + "more stuff", and sticking to ? and pure prepared statements is impossible.
    But doing this is not good either:
    for( each element in a map)
      sql = sql + " and nvl( " + key + ",' ') like ?"
    }Where key is "artist".
    In struts and other tag libs its easy to make kode like:
    <s:textfield name="model.addSearch( 'artist' )" value="%{model.getSearch( 'artist' )}" size="30" />
    Silly example maybe, but just to make a point.
    Inputed values in an html form, can very easily be a part of a dynamic created sql - which becomes a security problem later on.
    Artist is an column name. Key should be validated if it contained an valid column name.
    I could make a list of strings, containing valid column names to check against.
    My question is if there is possible to get this type of information from the database, so I don't have to hand-make these lists?
    But I also want to keep the number of heavy and slowing queries down.
    My app have like 25 tables now, and I could easily get away with hand-make everything, copy/paste around etc. But I have more projects and this question will be here next time too. And after there again...

    Etharo wrote:
    Metadata. Then I have to query the database, take the result and use it for validating of input. If my sql only query 1 table, then this is ok. In this case I could do with that. But if the sql query mutliple tables, with sub-selects, unions etc. Then I might have to query all tables first, and even then I might not have what I want.
    The best way is of course to run the query, then get the metadata from that query - cause then im 100% sure what columns will be returned, and then I can validate with that.... 1 query is often not that slow. But I might query once to find total number of rows the query return in order to decide if we need to page the result. then query to get the metadata for validating input, then query to get the result... Maybe this is ok -but my head don't like it as an general ok thing to do, but I can't really say why...If you have a gui screen then it needs to correspond to some specific query. It can't be all possible combinations.
    So once you know the query you can obtain the meta data using a query that returns no results. Like the following.
    select * from mytable wheren 1 = 0
    >
    Jschell:
    I agree to what you say. I don't understood everything you said tho.
    Im not sure if you talk about having 1 search field (like google), and you input stuff there that might be in any columns.
    I have several search fields in one-to-one relasionship with view column/sql query column.
    Then you already know what the field represents. So validate it in the gui and not via the database.
    The first is way more advanced since you have to cover any input, any column, any case etc. Pluss add ranking. Lots of work for someone who have done little searchengines.
    Latter is simpler, but might also be limiting.Huh?
    As an example if you have a call center then the operators are not going to be doing unrestricted searches to find customers. They are going to look using a very limited set of data like the customer name and telephone number.
    >
    My job is very much like an consulent. They got an app, I shall add a new feature. The app is old and ugly coded. My boss ask how long it takes to make this, I say 2months, he decide 1 month. My dev time for features is rarely above 1 month, and I don't make much new apps.
    So I don't have the time to make advanced codegenerator, or spend time to evaluate various frameworks. Bringing an framework into the existing code is actually difficult. But I do want to improve the code, and add good code into the existing app that can be extended without evil pain.
    That doesn't jive with your OP. You made the following statement "My app have like 25 tables now, and I could easily get away with hand-make everything,...".
    That suggests that you are doing much more than simply updating an existing application.
    If you only need to add one new field then you should do only that. You shouldn't be attempting to add a system spanning validation system.
    On the other hand if you are in fact adding a validation system, then code generation makes it likely that it would take less time or no more than the same. And it is less likely to introduce bugs.
    Learn how to make an code generator? Well I guess thats what I asked help for - point me in the right direction if you could pls. Putting strings together to become code in an logic way is usually manageable, at least for simple querys. Evaluating that the generated code is good/safe - got no good clues...
    Learn about frameworks? Got no time. Hope I will get the time, but I won't. The customer must want to spend the money so I can get the time, that won't happen cause an framework does not add features, its only cost saving in terms of dev time, and maintenance time. The customer have no such focus/interest. They got a bit money to spend now and then regularily. i.e. government.
    I just want to try code as good as possible so I save myself from errors, painfull rewrites, and dev-time that gets out of proportions because of stupid code. So the question is actually about me trying to improve myself, its just that i don't know how right now.There are two goals.
    1. Implement a specific feature in an existing application.
    2. Learn a new way to solve problems.
    Nothing says that the second will help with the first. They should be addressed separately and your post doesn't make it clear what the first is so it is hard to say how it should be down.
    As for the second I already made a suggestion which provides two new ways to solve problems.

  • How to pass column name in slect statement in query

    hi,
    i want to make a report where in query select statement using variable as a column name. but its not working plz guide me how can i do this.
    i have created a function which return column name through variable & that variable i want to to use in select statement
    select :m1 from table1;
    regards

    Hi,
    Create a user parameter (say P_field), and assign a valid field name as initial value (say NAME), And In the Query, write
    SELECT CODE, &P_field FN_FIELD FROM <table_name> WHERE <condition>And in the BEFORE PARAMETER FORM Trigger under the Report Triggers, write,
    function BeforePForm return boolean is
    begin
      :P_field := <your_function_call>;
      return (TRUE);
    end;And use that FN_FIELD field in the report.
    Hope this will clear your issue.
    Regards,
    Manu.

Maybe you are looking for

  • Iphone 5 settings turn off difficulty

    - why are some settings very difficult to turn off?  I can only turn them off when I press super hard...  wifi and hotspot especially.  I know someone else with the same problem but for airplane mode.  are these screen problems?

  • MTD(Month To Date) and YTD(Year To Date) with one example

    can any ont Explain about MTD(Month To Date) and YTD(Year To Date) with one example plz

  • Source file after done editing?

    Imovie 10 -  got into today and was happy with some things, but not how they removed the ability to see the original source file Example:  I have a 10min movie of a birthday Import,  edit ,  export 3 min of footage The other 7 minutes are gone.   Wha

  • Cue point event to display text link in movie

    HI -- This may be a fairly mundane question but I am having a hard time figuring it out. I have a movie with several cue point events. I would like a text link to be added to the right of the movie when a certain cue point is hit. I would like the li

  • Set search help dynamically to SAP Standard Screen

    Hi, I have one issue where I have to Create f4 help For a field present on SAP standard screen. Please advice how to do that. Can i dynamically set Search help in any screen-exit of the standard screen? Please help. Screen No is 130 and Program is SA