Friday, December 19, 2014

ORA-01791: not a SELECTed expression during valeset creation

I have come across this error while i was trying to use a select statement in the table column while creating the Table value set.I used the below sql statement

SELECT DISTINCT XIH.BATCH_NO FROM XXMCNG_IREQ_HEADERS XIH ORDER BY XIH.REQ_DATE;

Cause : There is an incorrect ORDER BY item. The query is a SELECT DISTINCT query with an ORDER BY clause. In this context, all ORDER BY items must be constants, SELECT list expressions, or expressions whose operands are constants or SELECT list expressions.

Action :
Remove the order by clause from the SQL statement.
(or)
create a view with the same query and the call the view in the Table column while creating the Table value set.

Note :
=====
Restrictions on the ORDER BY Clause.The following restrictions apply to the ORDER BY clause:

•If you have specified the DISTINCT operator in the statement,then this clause cannot refer to columns unless they appear in the select list.
•An order_by_clause can contain no more than 255 expressions.
•You cannot order by a LOB, LONG, or LONG RAW column, nested table, or varray.
•If you specify a group_by_clause in the same statement, then this order_by_clause is restricted to the following expressions:

◦Constants
◦Aggregate functions
◦Analytic functions
◦The functions USER, UID, and SYSDATE
◦Expressions identical to those in the group_by_clause
◦Expressions comprising the preceding expressions that evaluate to the same value for all rows in a group.

 Also See : Creating Table Valuesets from backend in Oracle Applications.

Challa.

No comments:

Post a Comment