How to return all columns starting with E?

How to return all columns starting with E in emp table?
My attempts (below) were unsuccessful.
SQL> SELECT E* from emp;
SELECT E* from emp
ERROR at line 1:
ORA-00936: missing expression
SQL> SELECT E.* FROM EMP;
SELECT E.* FROM EMP
ERROR at line 1:
ORA-00904: "E": invalid identifier
SQL> SELECT EMP.E* FROM EMP;
SELECT EMP.E* FROM EMP
ERROR at line 1:
ORA-00936: missing expression

You need to do it dynamically:
SQL>  var cur refcursor
SQL>  declare
  co varchar2(40);
begin
  for c in (select column_name from cols where table_name = 'EMP' and column_name like 'E%') loop
    co := co || c.column_name || ',';
  end loop;
  open :cur for 'select '|| rtrim(co,',') || ' from emp';
end;
PL/SQL procedure successfully completed.
SQL>  print cur
     EMPNO ENAME    
      7369 SMITH    
      7499 ALLEN    
      7521 WARD     
      7566 JONES    
      7654 MARTIN   
      7698 BLAKE    
      7782 CLARK    
      7788 SCOTT    
      7839 KING     
      7844 TURNER   
      7876 ADAMS    
      7900 JAMES    
      7902 FORD     
      7934 MILLER   
14 rows selected.

Similar Messages

  • How to bring all columns in a single/first page in report painter

    Hi Experts,
    There are 9 columns in a report painter which includes 1 lead column.
    7 columns comes in a first page including lead column and rest 2 columns goes to second page. This report is copied from another report where all columns comes in a first page only. if the original report comes in one page then why not the new report.
    Please suggest how to bring all columns in a single/first page in the new report.
    Please revert if I'm confused anywhere.
    Thanks in advance
    Arabinda

    Hi Rajneesh,
    Thanx for the quick reply. When I change the column width to 10 it comes in one page. But the requirement is to keep the column width to at least 12 or 14 and moreever the original report from where this report is copied having the same no of columns and the column width for original report is 14 and it comes in one page only.
    Do I need to do something more to achieve this. My question is how the original reports data comes in one page where as the current report having issue with same number of columns.
    Pls suggest.
    Thanx,
    Arabinda

  • How to print all columns in one page

    Hi,
    Can anybody explain me how to print all columns in one page.we have around 15 to 20 columns for 4 reports and all these reports are build on one multiprovider.we are using BW 3.5.
    Can anyone explain me  how to print ALL COLUMNS IN ONE PAGE  .currently they are getting all columns in 2 to 3 pages. They are using PORTAL to run the reports here.
    Is it possible to do by customizing Webtemplate or by macros in Workbook.Please help me
    Edited by: kotha123 on Oct 11, 2010 5:58 PM

    Hi,
    Your best bet is to use a workbook template or else Excel to pdf option...Thanks

  • How can I make textedit start with a new (blank) document?

    How can I make textedit start with a new (blank) document?
    Instead of it starting up with a dialogue box to select an existing or start a new document.

    @Alley_Cat thanks for the ideas.
    I turned off System Preferences > iCloud > Documents&Data - problem solved.
    I'll use DropBox instead  - it provides the options for a better experience.  I hope Apple keep working on iCloud so that it doesn't go the way of Moble Me.

  • How to remove all columns and cells in numbers

    how to remove all columns and cells in numbers

    Click on the Table's icon in the Sheets list. Press delete.
    Done.
    Regards,
    Barry

  • How to export All computer list with operating system from AD and all attributes like disable or enable and OU location also?

    how to export All computer list with operating system from AD and all attributes like disable or enable and OU location also?
    I have tried with dsquery below but status is not showing there.
    dsquery * -filter "(objectCategory=computer)" -attr name operatingSystem

    last logon user name - not really stored (or lined) with computer object.  However, you can get this info during the logon process or from the computer.  Here is method:
    http://portal.sivarajan.com/2010/07/user-profile-and-os-info-powershell.html
    Santhosh Sivarajan | Houston, TX | www.sivarajan.com
    ITIL,MCITP,MCTS,MCSE (W2K3/W2K/NT4),MCSA(W2K3/W2K/MSG),Network+,CCNA
    Windows Server 2012 Book - Migrating from 2008 to Windows Server 2012
    Blogs: Blogs
    Twitter: Twitter
    LinkedIn: LinkedIn
    Facebook: Facebook
    Microsoft Virtual Academy:
    Microsoft Virtual Academy
    This posting is provided AS IS with no warranties, and confers no rights.

  • How to set all new vm with VLAN ID as a default settings and alose set the avaiablity high .

    How to set all new vm with VLAN ID as a default settings and alose set the avaiablity high .

    Hi Ramy,
    As a work around , you can create a VM without installing OS and  configure the Vlan of VNic , then export it .
    The new VM will be with Vlan ID when you import the "export file".(note : you need to select "copy the virtual machine " in the tab "choose import type" during importing ) .
    Hope this helps
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to compare all columns in a SELECT with all columns in a Cursor ?

    Hi All,
    I would like to know if something like this is possible in PL/SQL
    I have a cursor CUR1 which is a SELECT * FROM T1.
    And in my loop for every record found in CUR1 I am trying to retrieve its consecutive record in the table T2. Unfortunately T1 and T2 do not have a primary key so there are duplicates. But if I can compare each column of CUR1 with its respective column in T2, I can find the record. But the question is how ?
    So I tried something like this, but of course this is wrong, but hope this would give you an idea of what I trying
    VAR_T2 T2%ROWTYPE;
    CUR_T1 IS SELECT * FROM T1
    LOOP CUR_TI
    SELECT * INTO VAR_T2
    FROM T2 WHERE
    ‘ALL COLUMNS OF T2’ = ALL COLUMNS OF CUR1;
    So is there a easy way to accomplish this. Thank you, AJ

    As Walter says, this is simply an intersect if you are comparing all the columns.
    However, if you really must do it in a slow by slow, PL/SQL loop (no real valid reason why you would though)...
    DECLARE
      VAR_T2 T2%ROWTYPE;
      CUR_T1 IS
        SELECT * FROM T1;
    BEGIN
      FOR i IN CUR_TI
      LOOP
        SELECT * INTO VAR_T2
        FROM T2
        WHERE T2.col1 = i.col1
          AND T2.col2 = i.col2
          AND T2.col3 = i.col3
          AND T2.colN = i.colN;
      END LOOP;
    END;There is no simple mechanism for just saying "compare all the columns", you will have to specify each one individually in the WHERE clause.

  • With Guide - How to see all movies starting at a specific time ????

    Does anyone know how to use the remote/guide to identify all movies starting at a certain time.  I see a ton of movie channels but its next to impossible to wade through all the channels looking for movies starting at a specific time.
    All of my previous digital cable services had a similar serach function?
    Help ?

    I believe you can using the modes.....click on the right arrow on the remote and should bring up modes select Movies just remember to change it back or all you will see in the guide is movies

  • How to check all columns existing in a table?

    Hello.
    I'm writing a function that returns average value of every numeric column existing in a database.
    I have a general idea how to do it, but I need just one more thing, look at the expamle:
    select table_name from user_tables where rownum=1
    this allows me to select names of all tables, and then I can access them 1 by 1...
    But now i have a little problem - how to access all the atributes in selected table in this way?
    Oh, and I have a problem with this rownum... For example it works for 1 (shows 1st row - name of first table) but does not for 2, or greater number :(.
    And expresions like rownum < 5 work, but rownum > 3 not :/. What may be the reason?
    Thank you for help!
    Regards.

    user13483761 wrote:
    Thanks a lot! This 3 atributes is all I need, its a way lot easier than I thought before. I simply use cursor loop and your advices.
    Almost got working code - but there is 1 error telling that select is incorrect :/. Why is that?
    create or replace
    FUNCTION SHOW_ALL
    RETURN VARCHAR2 IS
    v_ret VARCHAR(100):='Null';
    BEGIN
    DECLARE
    CURSOR cur_stats IS SELECT table_name, column_name, data_type
    FROM user_tab_columns;
    v_zdanie VARCHAR(100);
    BEGIN
    FOR v_cur IN cur_stats LOOP
    IF v_cur.data_type = 'NUMBER'
    THEN
    strike
    --> select 'In table ' || v_cur.table_name || ' average value of ' ||--
    --> v_cur.column_name || ' is:' || avg(v_cur.column_name)--
    --> into v_zdanie--
    --> from v_cur.table_name;--
    strike
    >
    dbms_output.put_line(v_zdanie);
    END IF;
    END LOOP;
    RETURN v_ret;
    END;
    END SHOW_ALL;
    select 'In table ' || v_cur.table_name || ' average value of ' ||
    v_cur.column_name || ' is:' || avg(v_cur.column_name)
    into v_zdanie
    from v_cur.table_name;
    sql_developer tells that this 'table or perspective does not exist' or sth like that, I translated from my native language.You are missing lot of things in the function, you are hard coding the return value to null?
    What you should do is as below:
    remove the part what you have written, i have strike that above. declare a variable your_select_statement VARCHAR2(1000);
    your_select_statement := 'select nvl(avg('||v_cur.column_name||'),0) from '||v_cur.table_name;
    execute immediate your_select_statement into v_zdanie;
    dbms_output.put_line('In table ' || v_cur.table_name || ' average value of ' ||v_cur.column_name || ' is:' ||v_zdanie);

  • How to return all field names in a table

    How do you write a report to return all field names in a table? I prefer the field names in a column.
    Thanks
    Wayne

    Hi,
    In Oracle it is,
    Select column_name from user_tab_cols where table_name  = 'Table_Name';
    Note: Table_Name should be in capital letters
    In MS SQL Server it is,
    SELECT Column_Name + ', '
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_NAME = 'Table_Name'
    Hope this helps!
    Thanks
    -Azhar

  • How to select all columns in a trigger?

    I add a "before delete" trigger on a table, in order to insert the records to a backup table before they are deleted.
    but I cannot write like this : insert into t_backup select * from :old;
    The table has more than 30 columns so I don't want to select them one by one, how can I select all columns?

    Yes, it is possible by writing something like this :
    where col1 = :old.col1; But it is not directly supported. First, we need a package to remember all the OLD records:.... and please see below link for complete code in action :
    http://www.dbforums.com/oracle/925729-trigger-back-up-data.html
    What I am doing here, just copying the code and replacing "emp" with "test" (The table name on which I am going to apply this using notepad find and replace):
    SQL> select * from test_backup;
    no rows selected
    SQL> select * from test;
             A
             1
             2
             4
             5
    SQL> select * from test_backup;
    no rows selected
    SQL>
    create or replace package test_trg_pkg as
      type test_type is table of test%ROWTYPE index by binary_integer;
      test_tab test_type;
    end;
    create or replace trigger test_bds before delete on test
    begin
      test_trg_pkg.test_tab.delete;
    end;
    create or replace trigger test_adr after delete on test
    for each row
    declare
      -- To allow us to select the old values
      pragma autonomous_transaction;
    begin
      select *
      into   test_trg_pkg.test_tab(test_trg_pkg.test_tab.COUNT+1)
      from   test
      where  a = :old.a;  <----- Here you have to give your column name.
    end;
    create or replace trigger test_ads after delete on test
    begin
      for i in 1..test_trg_pkg.test_tab.COUNT loop
        insert into test_backup values test_trg_pkg.test_tab(i);
      end loop;
    end;
    SQL> delete from test where a=1;
    1 row deleted.
    SQL> select * from test_backup;
             A
             1
    SQL> delete from test where a=2;
    1 row deleted.
    SQL> select * from test_backup;
             A
             1
             2
    SQL>Regards
    Girish Sharma

  • How can I replace column value with a particular value in SQL

    Hi All,
    Can anyone please tell me how can I format my output with replacing a column value with a specific value which actually depends on the present value of the column
    I am executing the following SQL statement
    select state,count(id) from <table_name> where composite_dn= <composite_dn_name> group by state;
    My Present output is:
    State No.Of Instance
    1 3
    3 28
    I want to replace the value in the column state as follows
    State No.OfInstances
    Completed 3
    Faulted 28
    I want "1" to be reppaced by "Completed" and "3" to be replaced by "Faulted"
    Is is possible with SQL or PL/SQL , if it is then how can I achieve this required result. Please help!!
    Thanks in Advance!!
    Edited by: Roshni Shankar on Oct 27, 2012 12:38 AM

    Hi Roshni,
    I guess this CASE clause can be simulated by a DECODE and also it is very easy to use.
    Refer -- http://www.techonthenet.com/oracle/functions/decode.php
    select decode(t1.state,t2.state_id,t2.state_name), t1.count_id
    from <table_2> t2, (select state,count(id) count_id
    from <table_name>
    where composite_dn= <composite_dn_name>
    group by state) t1
    where t1.state = t2.state_id;HTH
    Ranit B.
    Edited by: ranit B on Oct 27, 2012 2:02 PM
    -- link added
    Edited by: ranit B on Oct 27, 2012 2:19 PM
    -- sample code added

  • DB Adapter not returning all columns from a sql table type

    Using Soa Suite 10.1.3.4.
    Calling DB Adapter from bpel to a database package procedure with an OUT NOCOPY parameter based on a TABLE OF type.
    It works fine except that I only get the first 14 columns out of 55.
    Can query all columns from Sqldeveloper or Sqlplus.
    XML skema reflects all columns correct.
    Same result without NOCOPY in parameter.
    HaveI missed some details/limitations?

    hi
    here is how I solved it.
    first create custom view that will find all requred data.
    in my case it was
    tables :
    ADRCITYT
    ADRCITY
    ADRPCDCITY
    T005S
    T005U
    joins :
    ADRCITY     CLIENT     =     ADRCITYT     CLIENT
    ADRCITY     COUNTRY     =     ADRCITYT     COUNTRY
    ADRCITY     CITY_CODE     =     ADRCITYT     CITY_CODE
    ADRCITY     CLIENT     =     ADRPCDCITY     CLIENT
    ADRCITY     COUNTRY     =     ADRPCDCITY     COUNTRY
    ADRCITY     CITY_CODE     =     ADRPCDCITY     CITY_CODE
    T005S     MANDT     =     ADRCITY     CLIENT
    T005S     BLAND     =     ADRCITY     REGION
    T005S     MANDT     =     T005U     MANDT
    T005S     LAND1     =     T005U     LAND1
    T005S     BLAND     =     T005U     BLAND
    and finaly searh help
    ORT01     3     3     PAD_ORT01
    CITY_CODE     0     2     CITY_CODE
    PSTLZ     1     1     PSTLZ_HR
    STATE     4     4     REGIO
    BEZEI     5     5     BEZEI20
    COUNTRY     0     6     LAND1
    LANGU     0     7     LANGU

  • How use replace all grid row with variable value

    hi master
    sir i have master detail form
    in detail form i have 5 column grid thate have 25 row at time
    one column name id
    such as id have value 23
    but i want replace all id row with 555
    how i replace all id in grid with 555 befor commit_form
    how i use loop for grid
    or any other method
    please give me idea
    thank's
    aamir

    Go_Block('Detail');
    First_Record;
    Loop
      :detail.item := '...' ;
      Exit when :system.last_Record = 'TRUE' ;
      Next_record;
    End loop;
    First_Record ;Francois

Maybe you are looking for

  • Generate Script to Project doesn't  generate CREATE OR REPLACE objects

    Hi, I am using VS2008 SP1 with ODT. If I go to ServerExplorer to connected database and run Generate Script to Project the object (Package, package body , function ...) is always created to the project as CREATE function myfunction. I need to have it

  • Only last pm_order operation in 0PM_DS04_Q0021 query?

    Hi Experts, When I execute query 0PM_DS04_Q0021 - Outstanding Order List,which runs over the DSO 0PM_DS04 - Maintenance Orders, Operations and Costs, I expect to have actual and planned time by order, but for all operations that occur in that PM orde

  • How to publish a p2p/multicast stream

    Hello,    Suppose I have a RTMP server (wowza) which strems this : rtmp://192.168.0.10/live, and the stream name is my.stream    The question is : which tool should I use to publish this stream to FMS using p2p/multicast mode ? So the output will be

  • Extracting Data

    Hi everyone I am a complete noob to Java but have a requirement at work that needs a solution and the only way I can think to do it is through a Java Program. I basically need a program that will reed data from the following website: http://www.banko

  • Can't install Adobe DNG Recover Edge plug-in (Info.lua: bad header in precompiled chunk)

    Hello, I tried to install the Adobe DNG Recover Edge plug-in in Lightroom 4.3. After adding it in the plug-in manager I get the error: Info.lua: bad header in precompiled chunk Can someone help me with this or had anyone the same issue? Martin