Query Records

"SELECT * FROM emp WHERE name <= 'Lawrance' AND ROWNUM <= '10';"
I can get the first 10 rows in the table emp. How can I get the 10 rows immediate before 'Lawrance' ?
null

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by mark king ([email protected]):
something like this:
SELECT * FROM emp WHERE name <= 'Lawrance' minus
SELECT * FROM emp WHERE rownum <=
(select count(*) - 10 from emp
where name <= 'Lawrance' ) ;
Good Luck<HR></BLOCKQUOTE>
Hi Mark King,
Yours method can solve the problem. In the second Where Clause, "name <= 'Lawrance' and " need to be added before "rownum".
Thanks a lot.
Xinjian
null

Similar Messages

  • Query records using a date DD-MON-YYYY in Forms 6i and 10g

    In Forms 6i, I can query records by entering >20-dec-2006 in a date field which has length of 12 with a date format mask DD-MON-YYYY in date item property. Once this form is converted to 10g, I can only enter >2-dec-2006 for querying. If trying to enter the >20-dec-2006, then, it becomes >20-dec-200 and have no record found. Although I have the date length increased to 20, the result stays the same: can't enter 2 digits for day.
    Thanks for your help in advance.

    Appreciate your help. The date field has a format mask of DD-MON-YYYY. By entering >2-dec-2005 it will automatically be displayed as >2-DEC-2005 in Forms 6i or 10g. Also, the query property has case insensitive checked as Yes. The problem is with 10g, I can not enter anything at the 12th position. I can enter the date up to the 11th position >20-dec-200. In Forms 6i, this is not a problem. Thanks.

  • FRM - 41105 You Cannot query records without a saved parent record

    I have 3 data blocks. The contro data block have document type and document number if we come to new record(I have written execute query for both header and detail part) the header block will show the detail of the documnet header(Header Details) and detail block will show the detail part.
    But my problem is when new record instance only the header block is querying and detail block is not querying and giving an error message(*FRM - 41105 You Cannot query records without a saved parent record*)!!
    Plz help me!!
    Thanks in advance,

    yea header tables PK is refered in the details table.
    and i have master record created already and have the detail record for those master records in the table.
    i want to query the detail record related to that master when we select a document number and document code in the control block.
    Its querying the master detail relevent to that header and giving this error messge while quering the detail record..

  • How to display a select query record in a tool tip?

    hi,
    How to display a select query record in a tool tip?
    for example i have a report employee. when i move the mouse pointer over a employee name, the tool tip should display the respective department id, department name...of that employee name.
    select dep_id, dep_name ....from department where employee.....Is it possible?
    thanks

    Dear Skud,
    Yes its possible..select ''||ename||'' from emp
    other wise you can use jQuery tooptip or some other JScript bundles.
    Thanks and Regards
    Maheswara

  • In forms 4.5 when query record assigning value is possible?How?

    Hi all,
    when query record ,depending on condition i can assign value.
    I done but it give error first delete or create record error?
    How can i overcome this problem.
    Thanks
    venkata.

    IF v_value = 'Y'
    THEN
    lvl$std.copy_number(0,'BLK1.V_ITEM_NAME1');
    ND IF;
    I written in post-query.What does
    lvl$std.copy_number(0,'BLK1.V_ITEM_NAME1');do that
    :blk1.v_item_name1 := 0;doesn't?

  • Form Error 40507: unable to fetch next query record

    Hi there folks,
    I have a Form (10g) where I have a Master Block and a Detail block. However, the other day, there was an Error reported:
    ORACLE error: unable to fetch next query record
    When we do capture Errors, we also capture the Last Query run. From that, it says that the last record that was queried was in the Detail block (Which is multi-record block) in tabular form. I looked at the Error Message but there is not much information on this Error.
    So, it's just a base table block and it has a drop down list which has two values. Any ideas what could have happened?
    Thanks!

    The Block is based on a a table. As a mattr of fact, there are 3 blocks in the form and they are all based on tables. Now, it migth be wrong for me to assume that the detail block in the one that caused the problem just because the Last Query was based on the detail block.
    Block 1 is a single record block -- Master Block
    Block 2 is a tabular block -- Detail Block
    Block 3 is a tabular block -- Detail Block
    There are two relations:
    Block 1 and Block 2
    Block 1 and Block 3

  • Hierarchical Tree Data Query/Record Group Question

    I need help with Hierarchical Forms right now. I'm currently trying to implement a hierarchical tree to display the different items in different categories. I have been reading up on it for the past few days, and i do not understand a few things.
    What is the difference between a data query and record group? they seem the same to me.
    How does the XX = prior XXX work? i understand that this is what connects the parent to the child.
    How do you determine what depth the node is? its done in the record group/data query, but how do i decide what level it is dynamically?
    Thanks a lot in advance!

    Thanks! I am unable to create a table specifically for the tree because i am using tables that have been ported live and are in use. My question about levels is how do I know which depth the node is. For example, i have a category called Information Technology and a category item called Business Informatics. I want to know how to decide that the Category(information technology) is on level 1 and the Item(business informatics) is on level 2.
    Information Technology
    |_
    Business Informatics
    And i do know how the Connect By XX = prior XXX works in the data query/record group.
    Thanks for your help!

  • FRM 40507 Unable to fetch next query record ??

    I am working on forms/oracle 10G
    there is this form which has a Combo Box list item.
    data in this list is fetched from a table 'A'.
    while saving data the value in the list item is saved in
    another table 'B'
    Now when i try to query the form using F11 and Ctrl + F11
    it gives me an error :
    FRM: frm 40507 UNABLE TO FETCH NEXT QUERY RECORD
    please guide what should i do ?? ...
    regards

    Details of the FORM :
    a) there is only one table
    b) we are using 2 datablocks . parent and child. This is because the child is
    displaying about 5 records. No parent child relation is set in the datablocks yet or in the table. can we do this in a single table ?
    c) now the user shall select a value from the activity list ( combo box ) . The date and time are auto populated in when new form instance. User then enters data for the child records and clicks save.
    d) data is save correctly.
    e) but while querying data that is saved it errors out saying that : FRM 40507 Unable to fetch next query record
    Will we have to define a parent child relation in the single table or in the datablocks ?
    i m really confused ??
    Regards

  • How to make record dirty programmatically after query record from db

    Hallo,
    JDeveloper 10.1.3.2
    I try to make record dirty after I query records.
    In VORowImpl.java I overwrite the populate() method:
    protected void populate(ResultSet resultSet) {
    super.populate(resultSet);
    setStatus("J");
    If I query DB for the first time, everything is ok.
    For the second time I get the errror:
    500 Internal Server Error
    oracle.jbo.TooManyObjectsException: JBO-25013: Te veel objecten komen overeen met de primaire sleutel oracle.jbo.Key[1 ].     
    at oracle.jbo.server.EntityCache.add(EntityCache.java:555)
         at oracle.jbo.server.ViewRowStorage.entityCacheAdd(ViewRowStorage.java:1762)
         at oracle.jbo.server.ViewRowImpl.entityCacheAdd(ViewRowImpl.java:2151)
         at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:1073)
         at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:2946)
         at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:2839)
         at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:2252)
         at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:2127)
         at oracle.jbo.server.QueryCollection.get(QueryCollection.java:1501)
         at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:3650)
         at oracle.jbo.server.ViewRowSetIteratorImpl.doFetch(ViewRowSetIteratorImpl.java:2818)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2674)
         at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2634)
         at oracle.jbo.server.ViewRowSetIteratorImpl.getRowAtRangeIndex(ViewRowSetIteratorImpl.java:722)
         at oracle.jbo.server.ViewRowSetImpl.getRowAtRangeIndex(ViewRowSetImpl.java:3672)
         at oracle.jbo.server.ViewObjectImpl.getRowAtRangeIndex(ViewObjectImpl.java:6288)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding$FacesModel._bringInToRange(FacesCtrlRangeBinding.java:541)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding$FacesModel.setRowIndex(FacesCtrlRangeBinding.java:504)
         at oracle.jheadstart.controller.jsf.bean.JhsCollectionModel.setRowIndex(JhsCollectionModel.java:361)
         at oracle.adf.view.faces.component.UIXCollection.setRowIndex(UIXCollection.java:379)
    Thanks,
    Anna
    Edited by: adekkers on 11-nov-2010 16:13

    I'll try to explain.
    I have a db-view.
    I have instead of triggers on this view.
    The user queries my view. A set of records appears on screen (for example 15).
    The user changes some attributes for 2 records.
    Other records stay in retrieved state. Or he does not change any record at all
    The user wants all 15 records to be committed in database. Even this records are not updated on screen.
    There is logics in instead of triggers, that makes real table-updates.
    I'm not a guru in jdeveloper.
    I thougt it is possible make records dirty after retrieving from database. In that case the jdeveloper can use normal commit-button without extra coding from my side.
    The problem: I can not put retrieved record in dirty status.
    If I use populate method in VO I get the error when I query my view for the second time.
    Dimitar, sorry.
    I did not understand your explanation.
    Can you please give some example.
    Thanks,
    Anna

  • URGENT..Date Query..How to Query Records created between 2 dates..

    Hi,
    I want to Query records which are created between 2 dates.
    I can use trunc(creation_date) this will give all the records for that day.
    I have to run a program every 15-20 minutes.
    following is an example
    example
    sysdate = 1/19/03 1:03:42 PM
    record1 creation date = 1/17/03 11:54:10 AM
    record2 creation date = 1/17/03 11:53:49 AM
    record3 creation date = 1/17/03 11:53:08 AM
    last resuest_date = 1/17/03 10:00:08 AM
    now i have to query records created between
    sysdate and last_request_date
    please reply ASAP
    Thanks
    Arun

    SELECT TO_CHAR(creation_date, 'DD-MON-YYYY') creation_date
    FROM navneet
    WHERE TO_CHAR(TO_DATE(creation_date, 'DD-MON-YYYY'), 'DD-MON-YYYY') BETWEEN
    TO_CHAR(TO_DATE('17-JAN-2003', 'DD-MON-YYYY'), 'DD-MON-YYYY') AND
    TO_CHAR(TO_DATE('20-JAN-2003','DD-MON-YYYY'),'DD-MON-YYYY');

  • SQL Query record coount before firing

    Hi All
    Let me know if there is any way to find the record count before firing the sql statemtent. I have tried using explain plan, but it gives the estimated rows returned by the query. I need to find the count before firing the query and will decide whether to fire my query or not.

    Let me know if there is any way to find the record
    count before firing the sql statemtent. No there isn't.

  • Displaying items based on Query record count (Forms 4.5)

    I have a special requirement.
    Assume col1 that I am selecting from table temp.
    select col1 from temp;
    Now if query fetches 9 records.
    Each column I want to show like this.
    1 2 3 4 5 6
    7 8 9
    If query fetches 15 records.
    Each column I want to show like this.
    1 2 3 4 5 6
    7 8 9 10 11 12
    13 14 15.
    That means items displayed on screen chages based on output of
    query.
    Pls. suggest some solution.
    null

    When i made the above query a view and created an oracle portal form. I get this error when I try to retrieve all the records in that view i made above.
    An unexpected error occurred: ORA-01445: cannot select ROWID from a join view without a key-preserved table (WWV-16016)
    What does the "key-preserved table" mean?

  • Displaying items based on Query record count

    I have a special requirement.
    Assume col1 that I am selecting from table temp.
    select col1 from temp;
    Now if query fetches 9 records.
    Each column I want to show like this.
    1 2 3 4 5 6
    7 8 9
    If query fetches 15 records.
    Each column I want to show like this.
    1 2 3 4 5 6
    7 8 9 10 11 12
    13 14 15.
    That means items displayed on screen chages based on output of
    query.
    Pls. suggest some solution.
    null

    You can't do this with the custom search portlet.
    You can use Omniportlet to display the items - using the SQL datasource (new in the July PDK) to query the content repository views. You could use the parameter form portlet provided with Omniportlet to build the selection list.
    Regards,
    Jerry
    PortalPM

  • Insert/Query records of custom objects

    We are looking for a generic programmatic solution to query/insert/delete records of custom objects. Using different WSDLs for custom objects and making calls to APIs of multiple stubs is NOT a generic solution. The main purpose of generic solution is – least bother about the number of custom objects present in any OCOD instance and their WSDLs. I am a bit ready to take minor hit on performance and others.
    Any suggestion? Idea?

    We are looking for a generic programmatic solution to query/insert/delete records of custom objects. Using different WSDLs for custom objects and making calls to APIs of multiple stubs is NOT a generic solution. The main purpose of generic solution is – least bother about the number of custom objects present in any OCOD instance and their WSDLs. I am a bit ready to take minor hit on performance and others.
    Any suggestion? Idea?

  • Unable to query records with data in exponential value ? ?

    Hello,
    I have a strange problem here, hope someone can answer my query.
    I have 2 tables where the 1st col is a seq with datatype NUMBER(22) and NOT NULL constraint. Now, the value within that col is quite large and hence when I query the table in TOAD/SQL developer it displays output in exponential form. Now the issue is this, In one table I'm able to find/search a particular row by using the exp value within where clause and the same is not possible in other table.
    The sample data is here.
    I'm able to search record by using the below values in 1 table but same is not possible in another.
    1200000211600013
    1.20000021160001E15
    Can anybody tell me what could be the possible reason for this or where should I look for to find an answer?
    Thanks in Advance!!
    Toufiq

    Seems there's no problem in Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    with
    numbers as
    (select 1200000211600013330 the_number from dual union all
    select 1200000211600013333 from dual
    select n.the_number,s.search_string
      from numbers n,
           (select :your_number search_string
              from dual
           ) s
    where n.the_number(+) = to_number(s.search_string)
    THE_NUMBER
    SEARCH_STRING
    1200000211600013333
    1200000211600013333
    THE_NUMBER
    SEARCH_STRING
    1200000211600013333
    1.200000211600013333E18
    THE_NUMBER
    SEARCH_STRING
    1200000211600013333
    12000002116.00013333E+8
    THE_NUMBER
    SEARCH_STRING
    1200000211600013330
    1.20000021160001333E+18
    THE_NUMBER
    SEARCH_STRING
    1.20000021160001333E17
    Even implicit conversion seems to work
    select n.the_number,s.search_string,dump(s.search_string,16) search_dump,dump(n.the_number) result_dump
      from numbers n,
           (select :your_number search_string
              from dual
           ) s
    where s.search_string = n.the_number(+)
    THE_NUMBER
    SEARCH_STRING
    SEARCH_DUMP
    RESULT_DUMP
    1200000211600013330
    1.20000021160001333E18
    Typ=1 Len=22: 31,2e,32,30,30,30,30,30,32,31,31,36,30,30,30,31,33,33,33,45,31,38
    Typ=2 Len=11: 202,2,21,1,1,22,17,1,2,34,31
    Regards
    Etbin

  • Query Records between thwo dates in a Auto Customization Criteria

    Hello all
    Lets say I have following attributes in my VO
    HeaderId
    DocNo
    TransDate
    OrgId
    DocStatus
    DocType
    I have following field in my CustomSimpleSearch (Auto Customization Criteria)
    DocStatus
    DocType
    My Results table populated fine according to above two fields. But i want to add
    "StartDate" and "EndDate" in my CustomSimpleSearch which should be matched
    with "TransDate" so that query becomes
    TransDate between "StartDate" and "EndDate". I mean i want to populate my records also on TransDate basis
    Kindly provide me a step by step solution or any tutorial which can help me as I am very new to OAF.
    Regards

    What Ram said is the only option if you want to stick with the Query region. Otherwise you can look to define your own query page and the corresponding logic which will be more troublesome just to achieve your 1 requirement.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Account description not shown in cash journal

    hi when i am looking the cash journal report in S_P6B_12000118 than i am not able to see the respective GLs  from which i have done entries. how can i see the GLs , so that i can do proper reporting or there is any other way to check it

  • How do i update from OS 10.4 to OS 10.5?

    Hi, I'm trying to update my OS from 10.4 to 10.5 but I can't find any software update on the mac website.  Any advice would be much appreciated!

  • Problem with Dual-SIM

    Hi. I have such a problem, that I'm using a dual SIM card in my Nokia E7, but I don't see that they're calling my business or my private number. Is there an app that would show me the number, where to they call?

  • Help for logic

    Hi I have one scenerio. I need to create a table wtih ID,creation_dt,password. I have to maintain password history. If I first time login and enter a new pwd then it will store in my table. next time he/she change the password then it will also store

  • Copy to disk "c:" failed.

    I updated my itunes on my 64 bit windows machine, and now I can't sync up or back up any of my devices. The message is: Attempting to copy to the disk "c:" failed. You do not have enough access privileges for this operation. This has worked fine up u