Read only view which has an ORDER BY clause

Aim to create a read only view which has an ORDER BY clause
Sample script
CREATE TABLE tab1 (
col1 VARCHAR2(3),
col2 NUMBER
INSERT INTO tab1(col1, col2) VALUES ('ccc', 30);
INSERT INTO tab1(col1, col2) VALUES ('bbb', 20);
INSERT INTO tab1(col1, col2) VALUES ('ddd', 40);
INSERT INTO tab1(col1, col2) VALUES ('aaa', 10);
COMMIT;
-- To creat View
CREATE OR REPLACE VIEW v_tab1
AS
SELECT
col1,
col2
FROM
tab1
ORDER BY
col1
WITH READ ONLY;
I get the following error
WITH READ ONLY
ERROR at line 10:
ORA-00933: SQL command not properly ended
When I comment out the ORDER BY clause, the view is created
Pls let me know how I can create a read only view with ORDER BY clause

Hi,
take a look at the documentation for CREATE VIEW, there is a restriction:
"You cannot specify the ORDER BY clause in the subquery if you also specify the subquery_restriction_clause."
Wolfgang

Similar Messages

  • How to set the view, which has to be shown at runtime?

    Hi,
    in my application i have more than one view, but at runtime only one of these views has to be shown. I want to decide this via a parameter that I get from the url.
    How can i set the right view to be showing at runtime?
    I tried it with a StartView which fires the right Outbound Plug in his wdDoInit-Method. This is working fine, but the problem is, that the method OnPlugDefault() of ComponentInterfaceViewController isn't called already at this time. So in the Init-Method of the StartView I don't have the given URL Parameter, so I can't decide which Plug I want to fire. The method OnPlugDefault() is called only after the init-method of the StartView.
    Is there any other possibilty to set the view, which has to be shown, at runtime?
    Thanks and Best Regards
    Katharina

    Hi,
    One way is you can pass the parameter in the URL , read the parameter and then fire the outbound plug depending upon that.
    You can read the parameters as follows
    HttpServletRequest request =Task.getCurrentTask()
         .getWebContextAdapter()
         .getHttpServletRequest();
    String[] param1 = request.getParameterValues("<<PARAMETRNAME");
    if(param1.equals("VALUE"))
      fire outbound plug1;
    Regards, Anilkumar

  • Read-Only view object won't give me it's row

    Hi,
    I have a read only view object which when executed has one row in it, but the next method returns null.
    this is my code in the AM:
        public Row getPerson() {
            Row row = null;
            ViewObject vo = getPersonsView1();
            vo.setNamedWhereClauseParam("p_login_id", getUserPrincipalName());
            vo.executeQuery();
            System.out.println("rows:" + vo.getEstimatedRowCount());
            if (vo.hasNext())
               row = vo.next();
            return row;  
        }and the console log:
    06/09/15 10:37:57 [513] select person_id,
    login_id,
    orig_system_id,
    person_type,
    title,
    preferred_name,
    preferred_name ||' '||surname full_name,
    first_name,
    other_names,
    surname,
    phone_work,
    email_address
    from sys_persons
    where person_type = 'Staff'
    and login_id = :p_login_id
    06/09/15 10:37:57 [514] Bind params for ViewObject: PersonsView1
    06/09/15 10:37:57 [515] Binding null of type 12 for "p_login_id"
    06/09/15 10:37:57 [516] *** DCDataControl.sync() called from :DCBindingContainer.refresh
    06/09/15 10:37:57 [517] *** DCDataControl.sync() called from :DCBindingContainer.refresh
    06/09/15 10:37:57 [518] **** refreshControl() for BindingContainer :rft_ConsolePageDef
    06/09/15 10:37:57 [519] *** DCDataControl.sync() called from :DCBindingContainer.refresh
    06/09/15 10:37:57 [520] *** DCDataControl.sync() called from :DCBindingContainer.refresh
    06/09/15 10:38:00 [521] Column count: 12
    06/09/15 10:38:00 [522] ViewObject: PersonsView1 Reusing defined prepared Statement
    06/09/15 10:38:00 [523] Bind params for ViewObject: PersonsView1
    06/09/15 10:38:00 [524] Binding param "p_login_id": banstey
    06/09/15 10:38:00 rows:1
    Source breakpoint occurred at line 38 of SystemServiceImpl.java.Note above System.out.println("rows:" + vo.getEstimatedRowCount()); returns:
    06/09/15 10:38:00 rows:1
    but when i debug with a break point in the above method if (vo.hasNext()) returns false.
    I have tried doing row = vo.next(); without the if statement, but row still evaluates to null.
    The VO returns one record in the BC4J tester and I have this exact method and VO defined in another project and it works there. Tearing my hair out with this one...
    Brenden

    try RowSetIterator instead,
    RowSetIterator it = vo.createRowSetIterator("myIt");
    if(it.hasNext())
    MyVORowImpl row = (MyVORowImpl)it.next()
    //don't forget close the RowSetIterator
    I guess you use the VO.next(), but the current row of the VO is the one you get from db, and his next is null...

  • TM Contention and Read Only Views - Toad

    I have a case where a select against a view that has the read only option caused TM contention. I realize that the TM can be fixed by indexing the unindexed foreign key which I plan to do. The user only has select privilege so the locking must have come from select for update, but when I checked the query it was a select against a read only view from Toad. Has anyone seen the case where Toad does a select for update behind the scenes which causes locking issues. I am thinking this must be the case otherwise I do not know how a select against a readonly view could hold a lock.

    user12191713 wrote:
    I have a case where a select against a view that has the read only option caused TM contention. I realize that the TM can be fixed by indexing the unindexed foreign key which I plan to do. The user only has select privilege so the locking must have come from select for update, but when I checked the query it was a select against a read only view from Toad. Has anyone seen the case where Toad does a select for update behind the scenes which causes locking issues. I am thinking this must be the case otherwise I do not know how a select against a readonly view could hold a lock.using sqlplus post the same SQL & results
    Handle:     user12191713
    Status Level:     Newbie
    Registered:     Aug 4, 2011
    Total Posts:     40
    Total Questions:     25 (19 unresolved)
    I extend to you my condolences; since you rarely get your questions answered here.

  • Partial read-only view object. How to make it work?

    Hello,
    is there a way to have a "partial" read-only view object, where some attributes are based on an EO and some others are extracted directly from a table with no corresponding EO?
    On this view-object it should be possible to perform row insertions from an af:table, in a way that, after validation (i.e. a row selection change), the values on the attributes not based on the EO do not get lost, even if they do not have any attributes based on an EO.
    On the other hand, if I use fake EO attributes ($none$) for those read-only attributes, their values will not gest lost after validation of the new interted rows, but in this case, when the table is first rendered on the page, the table shows empty values on those items, probably because the EO attributes are empty when the query is performed.
    Note that It seems I cannot use Transient attributes where their value is calculated with a SQL statement, since it would mean I would have to perform an heavy SQL statement for every transient attribute.
    Is there any other solution, I hope the problem is clear.

    That solution does not cover the case where an attributed of one entity used as reference is calculated from a SQL expression with parameters involving the remaining attributes of the same entity.
    For example consider a reference-only entity based on a table with one field T(COD). This entity has one more attribute other than COD itself, CALCULATED_VALUE.
    How can I bind the attribute CALCULATED_VALUE to a SQL expression which is a function of COD: MyDBPackage.GetValue(COD, :environment), where :environment is bind variable?
    The frameowork always give me JBO-exception , asking to specify IN or OUT for the variable.

  • ADF View Criteria on a Read Only View Object

    Hi,
    I have created a read only view object using a query. The query consists of analytical functions to fetch the AVG values dynamically.
    So far my approach worked fine.
    I want the Average values in my query to be calculated dynamically based on the certain view criteria.
    But after applying view criteria, my query is formulated as shown below:
    SELECT * FROM (SELECT   RECEIVED_YEAR,
               WEEK_NO,
               NO_RECEIVED,
               NO_STARTED,
               ROUND (TO_NUMBER (REPLACE (AVG_HRS_TO_START, ':', '.')),2) AVG_HRS_TO_START,
               ROUND (AVG (TO_NUMBER (REPLACE (AVG_HRS_TO_START, ':', '.'))) OVER (ORDER BY RECEIVED_YEAR),2)              OVERALL_AVG_HRS,
               GOAL_HRS,
               ROUND (AVG (NO_STARTED) OVER (ORDER BY RECEIVED_YEAR), 2) AVG_NO_STARTED,
               ROUND (AVG (NO_RECEIVED) OVER (ORDER BY RECEIVED_YEAR), 2) AVG_NO_RECEIVED
               FROM ORDERS_RCPT_TO_START_VW
    ORDER BY RECEIVED_YEAR, WEEK_NO) QRSLT  WHERE ( ( ( ( (RECEIVED_YEAR = :RecdYear ) AND (WEEK_NO <= :weekNo ) ) ) ) )
    As per this query, it is calculating the Average values first and then applying filter criteria rather than applying the filter criteria and calculating average values.
    Please help me on this.

    Entity objects are used to update/delete/insert data to the database.
    If all your base DB object offers is read then just create a read only view object.

  • Finding Application Module name in read-only view object classes

    Hi all,
    I have a fairly basic question about finding application module name when we are coding in ViewObject java classes.
    I want to know how can I obtain <<application module>> NAME that our current view object is contained in it at run-time. I think there should be a way to find current application module NAME, when we are in ViewObject classes including View Object, View Row or view object definition classes (I've overridden all mentioned classes).
    I should notify that since our view object is read-only I may not count on view object's entity classes, coz as you know a read-only view object don't have any entity in it!
    So, if you have any idea about finding current application module name in view object java classes please let me know.
    Appreciate for your replies,
    Nasser

    Thanks guy, it was helpful:)
    Now i can access application module name through viewObject classes.
    But another question is raised...sorry if i m boring:( I promise its the final question ;)
    Is there a way to get application module name in an extended version of JboException class?
    Thanks again for your reply:)
    Nasser

  • Updatable view and Read only view

    Jdev version 11.1.1.6
    1. Can we use an updatable view instead of readonly view for LOVs?
    2. In my use case, I am having a panel-tabbed component. I create Region in the first tab & create Countries in the second tab. If I use a LOV for Regions based on the read-only view, then the data created & COMMITTED in the first tab is not getting reflected in the LOV in the second tab. But, if I use an updatable view for the Region field's LOV, then the LOV works fine. But, want to know if it is fine to use an updatable view for LOVs.

    Quotation from the developer guide
    >
    Best Practice: When you need to create a read-only view object for
    data lookup, you should use the entity-based view object and deselect
    the Updatable option in the Entity Objects page of the view object
    overview editor.
    >
    >
    View objects can either be related to underlying entity objects or not. When a view
    object is related to one or more underlying entity objects the default behavior supports
    creating new rows and modifying or removing queried rows. However, the update
    feature can be disabled by deselecting Updatable in the overview editor for the
    entity-based view object
    >
    So the answer for your first question is Yes

  • Get var from InputText based on a "read only view"

    Hi.
    I have build some read only views from DB.
    All my views are linked.And the Data of each View is shown with " selectOneChoice" or "inputText".
    So far so good.
    But now my 1.problem.
    How can I get the value of the inputText ( coordinates" lat , long ") in a var to use it with a google maps function like
    map.addOverlay(createMarker(new GLatLng(lat,long)))
    2. problem
    how can i change the readout value of the inputText from[i] 51,2456 to 51.2456 for example
    Hope for your help!
    Chris

    Hi,
    Yes, I'am talking about ViewObjects in ADF Business Components.
    Version view:
    ADF Business Components     10.1.3.41.57
    BPEL Designer     10.1.3.3.0 (Build 070615.0525)
    CVS Version     Internal to Oracle JDeveloper (client-only)
    Java(TM) Platform     1.5.0_06
    Oracle IDE     10.1.3.41.57
    Struts Modeler Version     10.1.3.41.57
    UML Modelers Version     10.1.3.41.57
    Versioning Support     10.1.3.41.57
    For UserInterface I'am using "Web Tier--->JSF--->JSF JSP
    I've got 5 read only views: Region, Country, City, Location and Koord ( including all coordinates of Location)
    Now I want to show a marker in googleMaps with these coordinates but it doesn't work.
    function load() {
    if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(51,6),1);
    var Lat;
    var Longi;
    here starts my problem
    map.addOverlay(createMarker(new GLatLng(Lat,Longi))) } }
    </script>
    <afh:body onload="load()" onunload="GUnload()">
    <af:messages/>
    <af:form id="frm">
    </input>
    <af:selectOneChoice id="navList1" autoSubmit="true"
    value="#{bindings.LolaRegionV1.inputValue}"
    label="#{bindings.LolaRegionV1.label}">
    <f:selectItems value="#{bindings.LolaRegionV1.items}"/>
    </af:selectOneChoice>
    <af:inputText value="#{bindings.LolaKoordV1Lat1.inputValue}"
    label="#{bindings.LolaKoordV1Lat1.label}"
    required="#{bindings.LolaKoordV1Lat1.mandatory}"
    columns="#{bindings.LolaKoordV1Lat1.displayWidth}"
    partialTriggers="navList4" id="input1">
    <af:validator binding="#{bindings.LolaKoordV1Lat1.validator}"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.LolaKoordV1Lat1.format}"/>
    </af:inputText>
    <af:inputText value="#{bindings.LolaKoordV1Longi.inputValue}"
    label="#{bindings.LolaKoordV1Longi.label}"
    required="#{bindings.LolaKoordV1Longi.mandatory}"
    columns="#{bindings.LolaKoordV1Longi.displayWidth}"
    partialTriggers="navList4" id="input2">
    <af:validator binding="#{bindings.LolaKoordV1Longi.validator}"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.LolaKoordV1Longi.format}"/>
    </af:inputText>
    </af:form>
    I cant'*t give out the value of Lat , Longi to show the Marker.But a simple example like
    var x;
    var y;
    x = "51";
    y = "6";
    map.addOverlay(createMarker(new GLatLng(x,y)))
    is running.
    Thank you for help!
    Christian
    Message was edited by:
    user585675
    Message was edited by:
    user585675

  • Need to make a dff field read only if it has data

    Hi,
    we added dffs to the manage sites page, i am extending the controller to do some validations of this DFF page. I need to make dff read only if it has some data. The following code is not working.
    public void processRequest(OAPageContext pageContext,OAWebBean webBean)
    super.processRequest(pageContext,webBean);
    OAApplicationModule xam = paramOAPageContext.getApplicationModule(paramOAWebBean);
    OAViewObjectImpl DffVO = (OAViewObjectImpl)xam.findViewObject("SitesFlexVO");
    OAViewRowImpl DffRow = (OAViewRowImpl)DffVO.getCurrentRow();
    if(DffRow.getAttribute("Attribute1")!= null)
    OADescriptiveFlexBean dffBean = (OADescriptiveFlexBean)webBean.findChildRecursive("Attribute1");
    dffBean.setReadOnly(true);
    can you please suggest whats wrong and give me a correct solution.
    Thanks,
    Kiran M.

    Thanks for the reply nani,
    it didnot work, i am getting the following exception.
    ## Detail 0 ##
    java.lang.NullPointerException
         at xxtjx.oracle.apps.pos.supplier.webui.XXTJXByrMngSiteDFFCO50.processRequest(XXTJXByrMngSiteDFFCO50.java:43)
    The error line 43 in my code is
    dffBean.setReadOnly(true);
    so i feel there is something wrong with this command. I kept this validation in process request and i am able to fetch attribute values in process request. so i feel there is no issue fetching the attribute value. i feel its the issue with the set command.
    Let me know if you have any other solution.
    Thanks,
    Kiran M.

  • Need to display the messages in a view which has the pop up on it

    Hello all,
    I have a view(View 1) in which if i click a button a pop up is being displayed.
    Now on the pop up(which has view 2 of window 2) i have a button(Ok) and if i click it then based on a condition i need to close the pop up and then display the message in the message area of View 1.
    Now if i click the button on the Pop up then it is being closed and the message is not being displayed on view 2.
    I think the message is being displayed on the pop up and is being closed after that.
    How can i display my message on View 1.
    Any ideas...Please help
    Thanks in advance,
    Shravan

    Hi Shravan,
    Create Message area in view1.
    and also give VIEW name wile displaying error message and try.
    *   report message
      CALL METHOD lo_message_manager->REPORT_ERROR_MESSAGE
        EXPORTING
          MESSAGE_TEXT              =
    *      PARAMS                    =
    *      MSG_USER_DATA             =
    *      IS_PERMANENT              = ABAP_FALSE
    *      SCOPE_PERMANENT_MSG       = CO_MSG_SCOPE_CONTROLLER
          VIEW                      =   VIEW1 .
    Cheers,
    Kris.

  • How to read a file which has header and without header

    Hi,
    I have a file to file scenario wherein there are txt files in the source system, some of which has header and some without header.
    How does the sender adapter dynamically identify a file with header and without header.
    I knew that File content Conversion in the sender adapter with "Recordsets per message = 1" can read the header.  But how to handle dynamically.
    Thanks in advance for suggestions and advice.
    Regards.
    Praveen

    Hi,
    Let me give a more clear picture:-
    One of my file which has header and the corresponding values is listed hereunder:
    PERNR;KID;PNALT;NACHN;NAME2;VORNA;TITEL;TITL2 and so on.....
    ;1200;1200;Angus;; and so on.........
    Other file which has no header but only values in it:-
    1200;1200;;Werner;Angus and so on.......
    The structure remains same for all the files.  The only difference is that some of the file has header in it and some without header.  The Message Type is mentioned hereunder:-
    DT_LegacyEmployee (Category - Complex Type)
         Employees (Category - Element, Occurence - 1)
              Employee (Categroy - Element, Type - DT_LegacyEmployee_Row, Occurence - 0...unbounded)
                   PERNR
                   KID
                   PNALT
                   NACHN
                   NAME2 and so on......     
    I read the file in record row.  The file conversion parameters in the file sender adapter are mentioned hereunder:-
    Document Name - MT_LegacyEmployee
    Document Namespace - http://abc.com/xi
    Recordset Name - Employees
    Rescordset Structure - Employee,*
    Recordsets per Message - 1
    Key Field Type - String (Case Sensitive)
    Employee.fieldSeparator - ;
    Employee.endSeparator - 'nl'
    Employee.fieldNames - PERNR,KID,PNALT,NACHN,NAME2,VORNA,TITEL,TITL2 and so on........
    How do we dynamically identify whether the file has header or not.  Even if the file has header or without header, the file needs to be picked and transferred to the target system.  Kindly clarify.
    Regards.
    Praveen

  • Read-only view for XMLType data

    HI Gentlemen,
    When I execute my SQL statement:
    select extract(object_value,'/keytabs/keytab/@SN') SN from keytabs
    against a schema-based XMLType table from SQL*Plus I get normal response:
    EXTRACT(OBJECT_VALUE,'/KEYTABS/KEYTAB/@SN')
    S_KBV_GESCHLECHT
    S_VDX_KONTENART
    However, when I create a Fusion application with business components, and a custom view in the Model project with the SQL statement above,
    it yields:
    oracle.sql.OPAQUE@1623820.
    Attribute type is String, and query column is VARCHAR(255). There is no entity because the view is read-only.
    Can anyone help me how to directly query XMLType to display the contents?
    Thanks, regards
    Miklos HERBOLY

    Can you try:
    select cast(extract(object_value, '/keytabs/keytab/@SN') as varchar2(255)) SN
    from keytabsJohn

  • Problem in creating Entity for view which has "INSTEAD OF " trigger

    Hi ,
    I have an entity based on a Non updatable Database view (DB_VIEW).this database view has an INSTEAD OF trigger which validates
    and save data into a table.
    And I have a BC4J view based on this entity.
    Problem :
    When I try to insert a record using bc4j view object,I get following error
    ORA-22816: unsupported feature with RETURNING clause
    Query sent by view Object is :
    BEGIN INSERT INTO DB_VIEW(COLUMN1,COLUMN2,COLUMN3) VALUES (:1,:2,:3) RETURNING ROWID INTO
    :4; END;
    I am not able to insert any record in that view.
    I tried removing rowID from my BC4J entity and View but problem is that in Databae view there is no
    column which can be set as a primary key other then ROWID.

    I had the same problem.
    Oracle 9.2 sadly does not support the RETURNING clause for database views with INSTEAD OF triggers.
    Here is Steves Solution:
    1. Create a custom entity def impl class for your entity on the Java panel
    2. override the isUseReturningClause() and return false
    That should work in 9.0.3.4, 9.0.4 build 1419, and 9.0.5.1 production.
    from How to disable generation of RETURNING clause?
    Hth, Markus

  • Filter  only records which has particular column initial

    Hi friends
      I am using filter for a table view, in my talbe for a particular column , it has initial values also for some records,
      my question is how the user can filter only the records that has the particular column value is initial.
       what has to write in the filter field

    i am not sure how you can handle it with FILTER = SERVER
    but if you set it to APPLICATION, then you can write your own logic . for filtering. in this case in the filter field you may request the user to enter "INITIAL" to search for initial values. This text  "INITIAL" you can capture in your oninputprocessing and filter the table.
    other option (not exactly FILTER) is to set sort = SERVER and user can do ascending sort to see the initial value records first.
    Regards
    Raja

Maybe you are looking for

  • Re : Intercompany stock transfer

    Hi        While creating a PO the following error is coming Not possible to determine shipping data for material CCC Customer CUST1 does not exist (please change entry in plant CP01) Material CCC mainly procured internally (please check your input) S

  • Can't find iTunes Library on external drive after iTunes 8 install

    My music library (50GB) has always been on an external drive. After installing iTunes 8 I went to preferences to change from default to this drive but nothing showed up. The complete library is still on the disk. Tried reinstalling V 7 but still no l

  • Sound does not work

    I know this is a frequent topic, but i couldn't find the answer in wiki or anywhere else. I have a fresh installation of arch, everything works fine except sound. [root@jachym jachym]# hwd -s|grep Sound Sound(a) : 82801I ICH9 Family HD Audio Controll

  • Use of Presentation Variables in Navigated Report Title

    Hi All, It's regarding the presentation variable in report title. I have value interaction to another report based on Prompted values. But when we click on the value it will go to another report page and giving the results, but the title view is not

  • Sticky load balancing across 2 ports with cookies

    Hi, I have a server configuration where I have 1 top level Apache server that deals with SSL termination (and handles static content) and proxy passes dynamic content onto 2 Tomcat servers on 2 ports, one for http requests (9001) and one for the requ