ORA-01791

Hi All,
I have this sql statement:
Select Distinct EXTRACT(YEAR from A_DATE) from Attendances order by A_Date ASC;
the error:
ORA-01791: not a SELECTed expression

SQL> with attendances as
  2  (select add_months(sysdate, level*12 ) a_date
  3   from   dual
  4   connect by level <= 10
  5  )
  6  --
  7  -- actual query:
  8  --
  9  select distinct extract(year from a_date) yr
10  from   attendances
11  order by extract(year from a_date) asc;
        YR
      2010
      2011
      2012
      2013
      2014
      2015
      2016
      2017
      2018
      2019
10 rows selected.

Similar Messages

  • SQL Error: ORA-01791: not a SELECTed expression 01791. 00000 -  "not a SELE

    guys getting an error with a simple query. help me out please.
    the query is:
    select DISTINCT(product_code ||' ' || subproduct_code ||' '|| position_number) from alm_owner.wrr_recon_source order by product_code, subproduct_code, position_number;
    Error report:
    SQL Error: ORA-01791: not a SELECTed expression
    01791. 00000 - "not a SELECTed expression"
    *Cause:   
    *Action:
    any help is much appriciated.

    Raghunadh wrote:
    Yes. If he wants the result to be sorted on product_code, he can do something like:
    select DISTINCT Det from (
    select product_code ||' ' || subproduct_code ||' '|| position_number as Det
    from alm_owner.wrr_recon_source)
    order by substr(product_code,1);This will atleast sort the first section of the result. For example,
    @raghu> select distinct det from (select empno ||' ' || ename ||' '|| sal Det from emp);
    DET
    7499 ALLEN 1600
    7369 SMITH 5600
    7844 TURNER 7000
    7900 JAMES 950
    7654 MARTIN 6500
    7698 BLAKE 2850
    7788 SCOTT 3000
    7934 MILLER 6600
    7566 JONES 2975
    7839 KING 5000
    7521 WARD 1250
    7369 SMITH 800
    7844 TURNER 1500
    7876 ADAMS 1100
    7934 MILLER 1300
    7876 ADAMS 6200
    7782 CLARK 2450
    7521 WARD 6500
    7900 JAMES 5900
    7902 FORD 3000
    @raghu> select distinct det from (
    2  select empno ||' ' || ename ||' '|| sal Det from emp) order by substr(det,1);
    DET
    7369 SMITH 5600
    7369 SMITH 800
    7499 ALLEN 1600
    7521 WARD 1250
    7521 WARD 6500
    7566 JONES 2975
    7654 MARTIN 6500
    7698 BLAKE 2850
    7782 CLARK 2450
    7788 SCOTT 3000
    7839 KING 5000
    7844 TURNER 1500
    7844 TURNER 7000
    7876 ADAMS 1100
    7876 ADAMS 6200
    7900 JAMES 5900
    7900 JAMES 950
    7902 FORD 3000
    7934 MILLER 1300
    7934 MILLER 6600(Dont worry about the records in emp table, I inserted some sample duplicate records to test something)I don't understand what SUBSTR(det,1) is for. That's the same as ORDER BY det surely? Which is also the same as ORDER BY empno ||' ' || ename ||' '|| sal....
    Edited by: Bravid on Mar 2, 2012 11:56 AM

  • ORA-01791: not a SELECTed expression - Order by

    Hi,
    Below query is executing in one system (database version 10.2 64 bit) without any error.
    select distinct CONTRACTOR_ID,CONTRACTOR_NAME from CONTRACTOR order by REGISTRATION_NO
    But same query is not working in other system (database version 10.2 32-bit). It throws ORA-01791: not a SELECTed expression error.
    Please clarify why it is working in one system and not working in other system
    Thanks,
    Sujnan

    Does the CONTRACTOR table have it's keys defined in both databases?
    Oracle can decide to not do the DISTINCT (and thus allow such ORDER BY), in case it is aware of some key-column being selected. Take a look at this, same query, one works, one doesn't due to absence of primary key:
    SQL> create table myemp(empno number not null primary key, job varchar2(10))
    Table created.
    SQL> select distinct empno from emp order by job;
         EMPNO
             2
             1
    SQL> alter table emp drop primary key;
    Table altered.
    SQL> select distinct empno from emp order by job;
    select distinct empno from emp order by job
    ERROR at line 1:
    ORA-01791: not a SELECTed expression
    SQL>

  • ORA-01791: not a SELECTed expression

    How can i fix this error? Any help is apprecaited..
    SQL> create table test(no number,no1 number);
    Table created.
    SQL> insert into test values(1,1);
    1 row created.
    SQL> select distinct no,no1
    2 from test order by no1;
    NO NO1
    1 1
    SQL> SELECT distinct no||'|'||no1 from test
    2 order by no1;
    order by no1
    ERROR at line 2:
    ORA-01791: not a SELECTed expression
    SQL>

    Shrinika wrote:
    How can i fix this error? Any help is apprecaited..
    SQL> create table test(no number,no1 number);
    Table created.
    SQL> insert into test values(1,1);
    1 row created.
    SQL> select distinct no,no1
    2 from test order by no1;
    NO NO1
    1 1
    SQL> SELECT distinct no||'|'||no1 from test
    2 order by no1;
    order by no1
    ERROR at line 2:
    ORA-01791: not a SELECTed expression
    SQL>SELECT distinct no||'|'||no1 from test order by 1;

  • Error while generating the report on Test env (for divide condition)

    Hi All,
    I am facing the below error while generating the report in test environment while the same report is working fine on Prod environment.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1791 message: [Oracle][ODBC][Ora]ORA-01791: not a SELECTed expression. [nQSError: 16001] ODBC error state: S1000 code: 1791 message: [Oracle][ODBC][Ora]ORA-01791: not a SELECTed expression. [nQSError: 16015] SQL statement execution failed. (HY000)
    Actually the error is coming for the below logics:
    COUNT(DISTINCT RMA.RMA)/COUNT(DISTINCT User."User Name")
    "RMA Fact"."Module Backlog"/COUNT(DISTINCT User."User Name")
    Can anyone please tell if I need to make any configuration changes as the same logic works perfectly fine on production but not on test.
    Thanks in advance

    Is anyone having any idea about it...

  • Error in a report after enabling case insensitive search in conn pool prop

    Hi All,
    I put the below code in connection pool's connection string to enable case insensitive search.
    alter session set NLS_SORT=BINARY_CI
    alter session set NLS_COMP=LINGUISTIC
    After putting this code one of my report started giving the below error which was working fine otherwise.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. NQODBC SQL_STATE: HY000 nQSError: 10058 A general error has occurred. nQSError: 16001 ODBC error state: S1000 code: 1791 message: OracleODBCOraORA-01791: not a SELECTed expression. nQSError: 16001 ODBC error state: S1000 code: 1791 message: OracleODBCOraORA-01791: not a SELECTed expression. nQSError: 16015 SQL statement execution failed. (HY000)
    The report gives error for the below divide condition when I select a column from a different dimension (eg: region)
    COUNT(DISTINCT RMA.RMA)/COUNT(DISTINCT User."User Name")
    Can anyone please throw a light why this is happening.

    Below is the SQL which is throwing error in OBIEE. It was working fine when I tried running it in toad:
    select T1609.ATTRIB_05 as c1,
    count(distinct T1609.ATTRIB_42) as c2,
    TRUNC(T1159.FSCL_WEEK_START_DT) as c3
    from
    WC_DAY_D T1159 /* RMA_RECEIVED_DT(WC_DAY_D) */ ,
    WC_RMA_D T571,
    WC_FV_FA_D T1609,
    WC_FV_FA_F T1679
    where ( T571.ROW_WID = T1679.RMA_WID and T1159.ROW_WID = T1679.RMA_RECEIVED_WID and T1609.ROW_WID = T1679.FV_FA_WID and T1609.ATTRIB_39 <> 'FV' and (T571.STATUS_CD in ('2nd FA', '2nd FA Review', 'Closed')) and TRUNC(T1609.TODO_ACTL_END_DT) is not null and TRUNC(T1159.FSCL_WEEK_START_DT) between TIMESTAMP '2009-03-22 00:00:00' and TIMESTAMP '2009-04-12 00:00:00' )
    group by T1609.ATTRIB_05, TRUNC(T1159.FSCL_WEEK_START_DT)
    order by c3
    -------------------- Query Status: Query Failed: [nQSError: 16001] ODBC error state: S1000 code: 1791 message: [Oracle][ODBC][Ora]ORA-01791: not a SELECTed expression.
    [nQSError: 16001] ODBC error state: S1000 code: 1791 message: [Oracle][ODBC][Ora]ORA-01791: not a SELECTed expression.
    [nQSError: 16015] SQL statement execution failed.

  • ORDER BY using a Non-SELECT list column

    I need to SELECT DISTINCT values from a column and ORDER it by another column in the same table which is not in the SELECT list. When i got
    ORA-01791: not a SELECTed expression error, I tried various things like putting ORDER BY clause in the outer query, using a DISTINCT in the ORDER BY clause,..etc but couldn't succeed.
    SQL> create table sample_table (col1 number, col2 number);
    Table created.
    SQL> select distinct(col1)
      2  from sample_table
      3  order by col2;
    order by col2
    ERROR at line 3:
    ORA-01791: not a SELECTed expression
    SQL> select col1 from
      2  (select distinct(col1) col1 from sample_table)
      3  order by col2;
    order by col2
    ERROR at line 3:
    ORA-00904: "COL2": invalid identifier
    SQL> select distinct(col1) col1 from sample_table
      2  order by distinct(col2);
    order by distinct(col2)
    ERROR at line 2:
    ORA-00936: missing expressionAny workarounds for this seemingly simple requirement?

    Any workarounds for this seemingly simple requirement?This is not a simple requirement. It is a self contradictory requirement.
    You want to order an result on a attribute that you don't have. This is not possible from a logical point of view.
    Like saying,
    "I want the typical/distinct family size in houses in my town, ordered by house number."

  • Predicate push down in 10.2.0.3 but not in 11.1.0.7

    In the SQL and PL/SQL forum, there was an interesting question on why a predicate isn't pushed down in an 11.1.0.7 database while 10.2.0.3 did push the predicate, here: Same query works OK on 10.2.0.3 and not OK on 11.1.0.7-please help
    The last post contains 10053 trace output. Maybe any of the performance experts in this forum has an explanation?
    Regards,
    Rob.

    SQL> ALTER TABLE LOGIN ADD (
      2  CONSTRAINT FK_LOGIN_MPI
      3  FOREIGN KEY (MPID)
      4  REFERENCES PERSON_ID (MPID));
    REFERENCES PERSON_ID (MPID))
    ERROR at line 4:
    ORA-02270: no matching unique or primary key for this column-list
    SQL> Select
      2  rn,
      3  mpid,
      4  first,
      5  middle,
      6  last,
      7  account_status,
      8  username,
      9  last_login,
    10  date_added,
    11  degree,
    12  ssn
    13  from
    14  (
    15  Select
    16  rownum as rn,
    17  mpid,
    18  first,
    19  middle,
    20  last,
    21  account_status,
    22  username,
    23  last_login,
    24  date_added,
    25  degree,
    26  ssn
    27  from
    28  (
    29  SELECT distinct
    30  p.mpid as mpid,
    31  UPPER(name_first) as first,
    32  UPPER(name_middle_initial) as middle,
    33  UPPER(name_last) as last,
    34  l.account_status,
    35  username,
    36  TO_CHAR(last_login, 'DD-Mon-YYYY') as last_login,
    37  TO_CHAR(date_added, 'DD-Mon-YYYY') as date_Added,
    38  degree,
    39  ssn
    40  FROM
    41  PERSON_ID p,
    42  login l
    43  WHERE
    44  p.mpid=l.mpid AND UPPER(p.name_last) LIKE '%SMITH%'
    45  ORDER BY
    46  name_last ASC
    47  )
    48  )
    49  where
    50  rn >= 1 and rn <= 20;
    name_last ASC
    ERROR at line 46:
    ORA-01791: not a SELECTed expression
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bi
    PL/SQL Release 10.1.0.5.0 - Production
    CORE    10.1.0.5.0      Production
    TNS for Solaris: Version 10.1.0.5.0 - Production
    NLSRTL Version 10.1.0.5.0 - Productionbon, je n'ai pas de 10.1.0.4 windows, mais je doute que ça fasse vraiment la différence
    donne moi l'output dans sqlplus

  • Essbase studio drill thru report Test error

    Hi All,
    Essbase studio drill thru report is producing the below error: Unable to retrieve drill thru result.
    Error in the select statement. Line = 2466.
    Error in query execution. Please review the query and try again.
    Cannot execute a SQL query
    ORA-01791: not a SELECTed expression
    Any idea... i am able to test for some of the dimensions but this error is coming for a few dimensiosns .... i verified all the joins between dimensions and facts.. everything is fine.
    Thanks,
    Praveen

    Hi Glenn,
    This is a test report executed with in Studio console. Yes, i did verify the generated sql by studio server and was able to drill down to the detail. I dont find any information in the logs when testing this. Probably, i would need to increase logging level. Will do that and update here if i dont find much help there.
    Thanks,
    Praveen

  • Essbase Studio drill thru report error

    Hi All,
    Essbase studio drill thru report is producing the below error: Unable to retrieve drill thru result.
    Error in the select statement. Line = 2466.
    Error in query execution. Please review the query and try again.
    Cannot execute a SQL query
    ORA-01791: not a SELECTed expression
    Any idea... i am able to test for some of the dimensions but this error is coming for a few dimensiosns .... i verified all the joins between dimensions and facts.. everything is fine.
    Thanks,
    Praveen

    Hi Glenn,
    This is a test report executed with in Studio console. Yes, i did verify the generated sql by studio server and was able to drill down to the detail. I dont find any information in the logs when testing this. Probably, i would need to increase logging level. Will do that and update here if i dont find much help there.
    Thanks,
    Praveen

  • SQL statement errors in 10.2.0.3 but not 10.1.0.4

    One of my developers noticed some errors this morning after we moved over to 10.2.0.3 on windows. The query returns rows in 10.1.0.4 but in 10.2.0.3 returns an ORA-01791:not a SELECTed expression. Here is the query:
    Select
    rn,
    mpid,
    first,
    middle,
    last,
    account_status,
    username,
    last_login,
    date_added,
    degree,
    ssn
    from
    Select
    rownum as rn,
    mpid,
    first,
    middle,
    last,
    account_status,
    username,
    last_login,
    date_added,
    degree,
    ssn
    from
    SELECT distinct
    p.mpid as mpid,
    UPPER(name_first) as first,
    UPPER(name_middle_initial) as middle,
    UPPER(name_last) as last,
    l.account_status,
    username,
    TO_CHAR(last_login, 'DD-Mon-YYYY') as last_login,
    TO_CHAR(date_added, 'DD-Mon-YYYY') as date_Added,
    degree,
    ssn
    FROM
    PERSON_ID p,
    login l
    WHERE
    p.mpid=l.mpid AND UPPER(p.name_last) LIKE '%SMITH%'
    ORDER BY
    name_last ASC
    where
    rn >= 1 and rn <= 20

    SQL> ALTER TABLE LOGIN ADD (
      2  CONSTRAINT FK_LOGIN_MPI
      3  FOREIGN KEY (MPID)
      4  REFERENCES PERSON_ID (MPID));
    REFERENCES PERSON_ID (MPID))
    ERROR at line 4:
    ORA-02270: no matching unique or primary key for this column-list
    SQL> Select
      2  rn,
      3  mpid,
      4  first,
      5  middle,
      6  last,
      7  account_status,
      8  username,
      9  last_login,
    10  date_added,
    11  degree,
    12  ssn
    13  from
    14  (
    15  Select
    16  rownum as rn,
    17  mpid,
    18  first,
    19  middle,
    20  last,
    21  account_status,
    22  username,
    23  last_login,
    24  date_added,
    25  degree,
    26  ssn
    27  from
    28  (
    29  SELECT distinct
    30  p.mpid as mpid,
    31  UPPER(name_first) as first,
    32  UPPER(name_middle_initial) as middle,
    33  UPPER(name_last) as last,
    34  l.account_status,
    35  username,
    36  TO_CHAR(last_login, 'DD-Mon-YYYY') as last_login,
    37  TO_CHAR(date_added, 'DD-Mon-YYYY') as date_Added,
    38  degree,
    39  ssn
    40  FROM
    41  PERSON_ID p,
    42  login l
    43  WHERE
    44  p.mpid=l.mpid AND UPPER(p.name_last) LIKE '%SMITH%'
    45  ORDER BY
    46  name_last ASC
    47  )
    48  )
    49  where
    50  rn >= 1 and rn <= 20;
    name_last ASC
    ERROR at line 46:
    ORA-01791: not a SELECTed expression
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bi
    PL/SQL Release 10.1.0.5.0 - Production
    CORE    10.1.0.5.0      Production
    TNS for Solaris: Version 10.1.0.5.0 - Production
    NLSRTL Version 10.1.0.5.0 - Productionbon, je n'ai pas de 10.1.0.4 windows, mais je doute que ça fasse vraiment la différence
    donne moi l'output dans sqlplus

  • Analitic functions (problem with SELECT)

    Hi!
    I've got a problem with analitic functions (I'm newbie in this topic).
    I have a table gpw_notowania which have colums: not_open, not_minimum, not_maximum, not_close, not_volume, not_sp_id and not_date.
    I need to receive from database the information: what is the open, minimum, maximum, close and sum of volume in every week? I have tried the code below but it tells me: ORA-01791 (marking not_date in ORDER clause).
    Help me, please.
    SELECT     distinct
         FIRST_VALUE(not_open)      OVER (partition by to_char(not_date,'WW') ORDER BY not_date)          as open,
         MIN(not_minimum)     OVER (partition by to_char(not_date,'WW') ORDER BY not_date)          as minimum,
         MAX(not_maximum)     OVER (partition by to_char(not_date,'WW') ORDER BY not_date)          as maximum,
         FIRST_VALUE(not_close)     OVER (partition by to_char(not_date,'WW') ORDER BY not_date DESC)     as close,
         sum(not_volume)          OVER (partition by to_char(not_date,'WW'))                    as volume
    FROM     gpw_notowania
    WHERE     not_sp_id = 80
    ORDER BY not_date;

    This is an interesting question.
    create table SortWithDistinct(Val1,Val2,sortKey,SubSortKey) as
    select 1,3,10,1 from dual union all
    select 1,3,10,1 from dual union all
    select 1,3,10,1 from dual union all
    select 2,4,30,2 from dual union all
    select 2,4,30,2 from dual union all
    select 3,5,20,1 from dual union all
    select 3,5,20,1 from dual union all
    select 4,6,10,3 from dual union all
    select 5,5,10,2 from dual union all
    select 5,5,10,2 from dual union all
    select 9,9,10,4 from dual union all
    select 6,4,20,2 from dual union all
    select 6,4,20,2 from dual union all
    select 7,3,30,1 from dual union all
    select 7,3,30,1 from dual;
    select distinct Val1,Val2
      from SortWithDistinct
    order by sortKey,SubSortKey;
    ORA-01791: not a SELECTed expressionIt is one way that we use "group by".
    for instance
    select Val1,Val2
      from SortWithDistinct
    group by Val1,Val2
    order by max(sortKey),max(SubSortKey);
    Val1  Val2
       1     3
       5     5
       4     6
       9     9
       3     5
       6     4
       7     3
       2     4It is one way that we use "Inline View".
    for instance
    select Val1,Val2
    from (select distinct Val1,Val2,sortKey,SubSortKey
    from SortWithDistinct)
    order by sortKey,SubSortKey;
    Furthermore, we may use below alternative solution which uses "dense_Rank".
    select Val1,Val2
    from (select distinct Val1,Val2,
          dense_Rank() over(order by sortKey,SubSortKey) as willSortKey
            from SortWithDistinct)
    order by willSortKey;Because "distinct" works after OLAP.
    for instance
    SQL> select distinct ColA,ColB,Row_Number() over(order by 1) as Rank
      2  from (select 1 as ColA,1 as ColB from dual
      3  union all select 1,1 from dual
      4  union all select 1,1 from dual
      5  union all select 1,1 from dual
      6  union all select 2,2 from dual
      7  union all select 2,2 from dual
      8  union all select 2,2 from dual)
      9  order by 1,2,3;
    ColA  ColB  Rank
       1     1     1
       1     1     2
       1     1     3
       1     1     4
       2     2     5
       2     2     6
       2     2     7my site :-)
    http://www.geocities.jp/oraclesqlpuzzle/1-6.html

  • NOT SELECT command error

    Hi all,
    Kindly find out error in the follwing query
    thank you
    SELECT DISTINCT v1.terminalid AS terminalid, v1.jobrefno AS jobno,
    v1.jobdate AS jobdate, v1.sec AS section, v1.vessel AS vessel,
    TO_CHAR (v1.etd, 'DD/MM/YYYY') AS etd,
    TO_CHAR (v1.eta, 'DD/MM/YYYY') AS ETA , v1.consignee AS consignee,
    v1.billto AS billto, v1.containernumber AS containerno,
    v2.sales AS containersales, v3.sales AS jobsales,
    TO_CHAR (v1.dateofclereance,
    'DD/MM/YYYY') AS customsclearance,
    v1.deliverydate AS dlydate
    FROM view_uijobs_bd v1, container_sales_bd v2, job_sales_bd v3
    WHERE v1.jobrefno = v2.jobrefno
    +v1.CONTAINERNUMBER=v2.CONTAINERNO
    AND v1.jobrefno = v3.jobrefno
    AND TO_CHAR (v1.eta, 'dd-mon-yyyy') BETWEEN TO_DATE
    ('01-dec-2010',
    'dd-mon-yyyy'
    AND TO_DATE
    ('10-dec-2010',
    'dd-mon-yyyy'
    ORDER BY V1.ETA DESC
    errorno:
    ORA-01791 :NOT A SELECT EXPRESSION
    regards
    P Prakash

    If you are using DISTINCT you must order by one of the columns in the select list, you can't just order on a column from a table.
    So your order by should be...
    ORDER BY ETAso that it uses the resultant column, rather than the source.
    Also, your code is wrong...
    AND TO_CHAR (v1.eta, 'dd-mon-yyyy') BETWEEN TO_DATE
    ('01-dec-2010',
    'dd-mon-yyyy'
    AND TO_DATE
    ('10-dec-2010',
    'dd-mon-yyyy'
    )Should be...
                 AND TRUNC(v1.eta, 'dd') BETWEEN TO_DATE
                                                                    ('01-dec-2010',
                                                                     'dd-mon-yyyy'
                                                         AND TO_DATE
                                                                    ('10-dec-2010',
                                                                     'dd-mon-yyyy'
                                                                    )

  • Catching unnamed Oracle errors

    How do you handle specific Oracle errors such as the following:
    declare
      dummy varchar2(100);
    begin
      select distinct y into dummy
      from
        (select 'x' x, 'y' y
         from dual
         union all
         select 'x' x, 'y' y
         from dual)
      order by x;
      exception when ???
    end;What would go in the ??? part if I wanted to specifically handle the ORA-01791 error.
    Message was edited by:
    SamB

    something like this...
    SQL> DECLARE
      2   dummy VARCHAR2(100);
      3   v_error EXCEPTION;
      4  
      5   PRAGMA EXCEPTION_INIT(v_error, -01791);
      6  BEGIN
      7   SELECT DISTINCT y
      8   INTO dummy
      9   FROM (SELECT 'x' x, 'y' y FROM dual
    10         UNION ALL
    11      SELECT 'x' x, 'y' y FROM dual)
    12   ORDER BY x;
    13  EXCEPTION
    14   WHEN v_error THEN
    15     DBMS_OUTPUT.PUT_LINE('Exception Raised.');
    16  END;
    17  /
    Exception Raised.
    PL/SQL procedure successfully completed.

  • Time Stamp / DISTINCT conflict.

    In my following SQL query, I want to display records order by Date and Time. But it is conflicting with DISTINCT clause at the begining. When I remove TimeIssue from Order By, the query runs fine. I also want to know how to optimize the performance of this query.
    SELECT Distinct TmainEntry.DateIssue, TmainEntry.IndemNo, TmainEntry.PermitNo, TVisitorComposition.A12I, TVisitorComposition.C12I, TVisitorComposition.C5I, TVisitorComposition.A12F, TVisitorComposition.C12F, TVisitorComposition.C5F, TMainEntry.TotalVisitors, TMainEntry.NumVCam, TMainEntry.BookingType, TFees.EntryFee, TFees.VehicleFee, TFees.GuideFee, TFees.CameraFee, TFees.TotalFee, TMainEntry.ServiceCode
    FROM TMainEntry, TVisitorComposition, TEntryDates, RoundsInfo, TFees
    WHERE TMainEntry.PermitNo=TVisitorComposition.PermitNo and TMainEntry.PermitNo=RoundsInfo.PermitNo and TMainEntry.PermitNo=TFees.PermitNo and TmainEntry.DateIssue between ' 01-sep-2006' and ' 30-nov-2006' and TMainEntry.PermitStatus<>'C'
    ORDER BY TMainEntry.DateIssue, TMainEntry.TimeIssue;

    With DISTINCT, each ORDER BY item must also apppear in the SELECT list.
    What is displaying the error? It doesn't look like an Oracle error. These normally begin with something like "ORA-", for example,
    SQL> SELECT DISTINCT 'x' FROM dual ORDER BY dummy;
    SELECT DISTINCT 'x' FROM dual ORDER BY dummy
    ERROR at line 1:
    ORA-01791: not a SELECTed expression

Maybe you are looking for

  • Acrobat 9 + comments + replies + filters = deleted replies?

    Hi there, I am using Acrobat 9.3.4 Professional for Windows and have discovered a destructive problem that I dearly would like to solve - and am wondering whether you could help. Here is the scenario: 1) I open a PDF file with embedded comments. 2) I

  • IOS4 Upgrade: Complete disaster

    I am absolutely furious! After over 4 hours of mucking about, I've managed to upgrade to iOS4. However, ALL my app and phone settings have been deleted including ALL my text message history. I'm gutted! The first attempt to upgrade ended in an error

  • My wishes to Nokia

    Hey Nokia. I am really looking for a new phone. Can we have a Windows Phone with hardware keyboard, like the E7 but with actual hardware? Also with keyboard backlight, NFC, wireless charging, mirco sd slot and better display and camera? MWC shows som

  • SRM - Multiple PO Creation during "Processing Bid" (Buyer)

    Hi There, Can anyone tell which BADI can be used to group multiple PO to a single PO in following scenario. The objective is to group all line items within the same bid to create a single PO. Scenario: -     Requisitioner create a special request for

  • If you see .DS in all your folders... here's a solution

    I inadvertently turned on some normally invisible folder information. Probably a 3rd party app. At any rate, it was annoying seeing ".DS" in every folder I opened. I followed some links got the following information and it worked beautifully: Applica