URGENT - Does Select Query Sort based on RowId ?

Does Select Query Sort based on RowId ?
Eg: Select * from Employee;
RowId primkey name
aaaa 1 kiran
aaab 2 kumar
aaac 3 someone
Now when i delete the primkey: 2 row.
I will have:
RowId primkey name
aaaa 1 kiran
aaac 3 someone
Now when i insert a new record:
RowId primkey name
aaaa 1 kiran
aaac 3 someone
[Comment: Here the rowid can either be a new one like 'aaad' or 'aaab' is also reused.]
aaad 4 somename
My requirement is that the 'aaab' should not be reused.
Can any one pls suggest some way.

Dear Friend,
Plese gothrougth once following steps... (One by One)
Hope you can understand how Rowid Creating and Updting in you table.
SQL> select rowid,enumber from t;
ROWID ENUMBER
AAAJ4oAABAAAWlyAAA 1
AAAJ4oAABAAAWlyAAB 2
AAAJ4oAABAAAWlyAAC 3
AAAJ4oAABAAAWlyAAD 4
SQL> select rowid,enumber from t where enumber = 2;
1 row deleted.
SQL> insert into t values(9):
1 row created.
SQL> select rowid,enumber from t;
ROWID ENUMBER
AAAJ4oAABAAAWlyAAA 1
AAAJ4oAABAAAWlyAAC 3
AAAJ4oAABAAAWlyAAD 4
AAAJ4oAABAAAWlyAAE 9
SQL> delete from t where enumber = 3;
1 row deleted.
SQL> insert into t values(3);
1 row created.
SQL> select rowid,enumber from t;
ROWID ENUMBER
AAAJ4oAABAAAWlyAAA 1
AAAJ4oAABAAAWlyAAB 3
AAAJ4oAABAAAWlyAAD 4
AAAJ4oAABAAAWlyAAE 9
Regards,
G V Sreenivasulu

Similar Messages

  • Select query resulting in redo?

    Hi All,
    Does select query results in redo? In what cases this happens?
    Regards,
    Sphinx

    mtefft wrote:
    Another possibility is that the SELECT query invokes a PL/SQL function that performs insert, update or delete.
    This is a poor practice for a number of reasons but they are out there.
    Disagree with that. Proof:
    SQL> create table x(y number);                                   
    Table created.                                                   
    SQL> create function f return number as                          
      2  begin                                                       
      3  insert into x values (2);                                   
      4  return 1;                                                   
      5  end;                                                        
      6  /                                                           
    Function created.                                                
    SQL> select dummy, f() from dual;                                
    select dummy, f() from dual                                      
    ERROR at line 1:                                                 
    ORA-14551: cannot perform a DML operation inside a query         
    ORA-06512: at "HR.F", line 3                                     

  • Redo entry generation for select query

    Does "SELECT" query generate redo entry?
    If yes, Why?

    A SELECT may generate redo for "delayed block cleanout" and "delayed logging block cleanout" when it is querying blocks that were recently updated by a transaction that did not execute a "commit cleanout" completely.
    See http://jonathanlewis.wordpress.com/2009/06/16/clean-it-up/
    Hemant K Chitale

  • How does the CBO calculate the selectivity for range predicates on ROWID ?

    Hi all,
    I'm wondering how the CBO estimate the selectivity for range predicates based on ROWID columns.
    For example, for the following query the CBO estimates there's going to be 35004 rows returned instead of 7:
    SQL> SELECT count(*)
      FROM intsfi i
    WHERE
    ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH';  2    3    4
      COUNT(*)
             7
    Elapsed: 00:00:02.31
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'iostats last'));
    PLAN_TABLE_OUTPUT
    SQL_ID  aqbdu2p2t6w0z, child number 1
    SELECT count(*)   FROM intsfi i  WHERE  ROWID>='AAADxyAAWAAHDLIAAB' AND
    ROWID<='AAADxyAAWAAHDLIAAH'
    Plan hash value: 1610739540
    | Id  | Operation             | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   0 | SELECT STATEMENT      |         |      1 |        |      1 |00:00:02.31 |   68351 |
    |   1 |  SORT AGGREGATE       |         |      1 |      1 |      1 |00:00:02.31 |   68351 |
    |*  2 |   INDEX FAST FULL SCAN| INTSFI2 |      1 |  35004 |      7 |00:00:02.31 |   68351 |
    Predicate Information (identified by operation id):
       2 - filter((ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH'))According to Jonathan Lewis' book, for a normal column the selectivity would have been:
    (value_column1-value_column2)/(high_value-low_value)+1/num_distinct+1/num_distinct
    But here with the ROWID column, how does the CBO make its computation ?
    SINGLE TABLE ACCESS PATH
      Single Table Cardinality Estimation for INTSFI[I]
      Table: INTSFI  Alias: I
        Card: Original: 14001681.000000  Rounded: 35004  Computed: 35004.20  Non Adjusted: 35004.20

    Hi Jonathan,
    Some Clarifications
    =============
    DELETE /*+ ROWID(I) */ FROM INTSFI I WHERE
    (I.DAVAL<=TO_DATE('12032008','DDMMYYYY') AND (EXISTS(SELECT 1 FROM
    INTSFI S WHERE S.COINT=I.COINT AND S.NUCPT=I.NUCPT AND S.CTSIT=I.CTSIT
    AND NVL(S.RGCID,-1)=NVL(I.RGCID,-1) AND S.CODEV=I.CODEV AND
    S.COMAR=I.COMAR AND S.DAVAL>I.DAVAL) AND I.COMAR IN (SELECT P.COMAR
    FROM PURMAR P WHERE P.NUPUR=1))) AND ROWID>='AAADxyAAWAAHDLIAAB' AND
    ROWID<='AAADxyAAWAAHDLIAAH'
    Plan hash value: 1677274993
    | Id  | Operation                      | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |   0 | DELETE STATEMENT               |         |      1 |        |      0 |00:00:05.94 |   53247 |    |          |          |
    |   1 |  DELETE                        | INTSFI  |      1 |        |      0 |00:00:05.94 |   53247 |    |          |          |
    |*  2 |   HASH JOIN SEMI               |         |      1 |   9226 |      7 |00:00:05.94 |   53180 |   783K|   783K|  471K (0)|
    |   3 |    NESTED LOOPS                |         |      1 |   9226 |      7 |00:00:00.01 |      10 |    |          |          |
    |*  4 |     TABLE ACCESS BY ROWID RANGE| INTSFI  |      1 |   9226 |      7 |00:00:00.01 |       6 |    |          |          |
    |*  5 |     INDEX UNIQUE SCAN          | PURMAR1 |      7 |      1 |      7 |00:00:00.01 |       4 |    |          |          |
    |   6 |    INDEX FAST FULL SCAN        | INTSFI1 |      1 |     14M|   7543K|00:00:01.73 |   53170 |    |          |          |
    Predicate Information (identified by operation id):
       2 - access("S"."COINT"="I"."COINT" AND "S"."NUCPT"="I"."NUCPT" AND "S"."CTSIT"="I"."CTSIT" AND
                  NVL("S"."RGCID",(-1))=NVL("I"."RGCID",(-1)) AND "S"."CODEV"="I"."CODEV" AND "S"."COMAR"="I"."COMAR")
           filter("S"."DAVAL">"I"."DAVAL")
       4 - access(ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH')
           filter("I"."DAVAL"<=TO_DATE(' 2008-03-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
       5 - access("P"."NUPUR"=1 AND "I"."COMAR"="P"."COMAR")
    When I force the NESTED LOOP SEMI JOIN the query runs faster:
    DELETE /*+ ROWID(I) */ FROM INTSFI I WHERE
    (I.DAVAL<=TO_DATE('12032008','DDMMYYYY') AND (EXISTS(SELECT /*+ NL_SJ
    */ 1 FROM INTSFI S WHERE S.COINT=I.COINT AND S.NUCPT=I.NUCPT AND
    S.CTSIT=I.CTSIT AND NVL(S.RGCID,-1)=NVL(I.RGCID,-1) AND S.CODEV=I.CODEV
    AND S.COMAR=I.COMAR AND S.DAVAL>I.DAVAL) AND I.COMAR IN (SELECT P.COMAR
    FROM PURMAR P WHERE P.NUPUR=1))) AND ROWID>='AAADxyAAWAAHDLIAAB' AND
    ROWID<='AAADxyAAWAAHDLIAAH'
    Plan hash value: 2031485112
    | Id  | Operation                      | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   0 | DELETE STATEMENT               |         |      1 |        |      0 |00:00:00.01 |      94 |
    |   1 |  DELETE                        | INTSFI  |      1 |        |      0 |00:00:00.01 |      94 |
    |   2 |   NESTED LOOPS SEMI            |         |      1 |   9226 |      7 |00:00:00.01 |      27 |
    |   3 |    NESTED LOOPS                |         |      1 |   9226 |      7 |00:00:00.01 |       9 |
    |*  4 |     TABLE ACCESS BY ROWID RANGE| INTSFI  |      1 |   9226 |      7 |00:00:00.01 |       5 |
    |*  5 |     INDEX UNIQUE SCAN          | PURMAR1 |      7 |      1 |      7 |00:00:00.01 |       4 |
    |*  6 |    INDEX RANGE SCAN            | INTSFI1 |      7 |     14M|      7 |00:00:00.01 |      18 |
    Predicate Information (identified by operation id):
       4 - access(ROWID>='AAADxyAAWAAHDLIAAB' AND ROWID<='AAADxyAAWAAHDLIAAH')
           filter("I"."DAVAL"<=TO_DATE(' 2008-03-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
       5 - access("P"."NUPUR"=1 AND "I"."COMAR"="P"."COMAR")
       6 - access("S"."COINT"="I"."COINT" AND "S"."NUCPT"="I"."NUCPT" AND
                  "S"."CTSIT"="I"."CTSIT" AND "S"."CODEV"="I"."CODEV" AND "S"."COMAR"="I"."COMAR" AND
                  "S"."DAVAL">"I"."DAVAL")
           filter(NVL("S"."RGCID",(-1))=NVL("I"."RGCID",(-1)))the above post is from Ahmed AANGOUR
    Case 1 - . If you check Plan hash value: 16772749938
    =====
    TABLE ACCESS BY ROWID RANGE| INTSFI  For every row access from INTSFI - it fetches a record from INDEX UNIQUE SCAN | PURMAR1
    If we check A-rows = 9226
    9226 * 7 = 64582 request across the table - perhaps with hint of rowid it fetches exact rows from PURMAR1
    in this case i think going for hash join with ordered hints (jonathan as you suggest go for leading hint's instead of ordered) - from INTSFI - PURMAR1 - instead of going for IN clause would get the rows that satifies the ("P"."NUPUR"=1 AND "I"."COMAR"="P"."COMAR")
    |*  2 |   HASH JOIN SEMI               |         |      1 |   9226 |      7 |00:00:05.94 |   53180 |   783K|   783K|  471K (0)|
    |   3 |    NESTED LOOPS                |         |      1 |   9226 |      7 |00:00:00.01 |      10 |    |          |          |
    |*  4 |     TABLE ACCESS BY ROWID RANGE| INTSFI  |      1 |   9226 |      7 |00:00:00.01 |       6 |    |          |          |
    |*  5 |     INDEX UNIQUE SCAN          | PURMAR1 |      7 |      1 |      7 |00:00:00.01 |       4 |    |          |          |My understanding with above plan would change to
    HASH JOIN
    TABLE ACCESS BY ROWID RANGE| INTSFI
    INDEX UNIQUE SCAN | PURMAR1
    HASH JOIN
    INDEX FAST FULL SCAN | INTSFI1
    Which migt be feasible.
    2 .
    DELETE /*+ ROWID(I) */ FROM INTSFI I WHERE
    (I.DAVAL<=TO_DATE('12032008','DDMMYYYY') AND (EXISTS(SELECT /*+ NL_SJ
    */ 1 FROM INTSFI S WHERE S.COINT=I.COINT AND S.NUCPT=I.NUCPT AND
    S.CTSIT=I.CTSIT AND NVL(S.RGCID,-1)=NVL(I.RGCID,-1) AND S.CODEV=I.CODEV
    AND S.COMAR=I.COMAR AND S.DAVAL>I.DAVAL) AND I.COMAR IN (SELECT P.COMAR
    FROM PURMAR P WHERE P.NUPUR=1))) AND ROWID>='AAADxyAAWAAHDLIAAB' AND
    ROWID<='AAADxyAAWAAHDLIAAH'Ahmed AANGOUR, modified the query by /*+ NL_SJ */ hint, Instead of that in to remove the most of the rows as we join the tables using subquery, I still doubt it
    to go push_predicate hints - still doubt it.
    Jonathan your comments are most valuable in the above two cases..
    Looking forward to calrify my understanding with concepts of indexes for above test cases
    - Pavan Kumar N

  • SELECT query - problem with SORT

    Hi,
    Same select query behaves different way on development and quality server
    on Development it returns unsorted and Quality returns sorted
    it can be resolved by SORT but why does it behave differently
    Do you know what is setting in database
    thanks

    From F1 on SELECT:
    Orders the records in a SELECT statement. Without the ORDER-BY clause, the order
    in which the selected lines are supplied is undefined. This means that two similar SELECT
    statements may produce lines in a different order.
    Rob

  • SELECT QUERY  BASED ON SECONDARY INDEX

    Hi all,
    CAN ANYONE TELL ME HOW TO WRITE SELECT QUERY BASED ON SECONDARY INDEX.
    IN WHAT WAY DOES IT IMPROVE PERFORMANCE.
    i KNOW WHEN CREATING SECONDARY INDEX I NEED TO GIVE AN INDEX NO -iT SHOULD BE ANY NUMBER RIGHT?
    I HAVE TO LIST ALL PRIMARY KEYS FIRST AND THEN THE FIELD FOR WHICH I AM CREATING SECONDARY INDEX RIGHT?
    LETS SAY I HAVE 2 PRIMARY KEYS AND I WANT TO CREATE SEONDARY INDEX FOR 2 FIELDS THEN
    I NEED TO CREATE A SEPERTE SECONDARY INDEX FOR EACH ONE OF THOSE FIELDS OR ONE SHOULD BE ENOUGH
    pLS LET ME KNOW IF IAM WRONG

    HI,
    If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVINGclauses, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
    You create secondary indexes using the ABAP Dictionary. There you can create its columns and define it as UNIQUE. However, you should not create secondary indexes to cover all possible combinations of fields.
    Only create one if you select data by fields that are not contained in another index, and the performance is very poor. Furthermore, you should only create secondary indexes for database tables from which you mainly read, since indexes have to be updated each time the database table is changed. <b>As a rule, secondary indexes should not contain more than four fields</b>, <b>and you should not have more than five indexes for a single database table</b>.
    <b>What to Keep in Mind for Secondary Indexes:</b>
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eb2d446011d189700000e8322d00/content.htm
    http://www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
    Regards
    Sudheer

  • SQL SELECT Query Help   ..Please its very Urgent!!

    Hi All,
    I am having Oracle Database whice is storing 1000's of records daily.
    I need to select some information based on date and time.
    I am having two coloumns for Date and time. The first column(testDate) of type Date stores date as MM/DD/YY format and the second column(testTime)of type Numeric stores the time in seconds.
    The Example data is :
    testDate ------=-- testTime
    11/12/2002 --- 35000
    11/12/2002 --- 43000
    11/12/2002 --- 45000
    11/12/2002 --- 75000
    11/13/2002 --- 2000
    11/13/2002 --- 3500
    11/13/2002 --- 4300
    11/13/2002 --- 9800
    11/13/2002 --- 23000
    11/14/2002 --- 5000
    11/14/2002 --- 10000
    11/14/2002 --- 15000
    How can i write a SELECT Query to get the records of specific date and seconds to next day specific date and seconds.I mean i want all the records between 11/12/2002 --- 43000 seconds to 11/14/2002 --- 1000 seconds.
    If any one helps me in this regard iam very thank full to them.Its very urgent for me.
    Thanks

    Hi m7nra,
    I used the query as
    SELECT * FROM table
    WHERE testDate + (testTime/(24*60*60)) BETWEEN TO_DATE('MM/DD/YYYY','12.11.2002') AND TO_DATE('MM/DD/YYYY','14.11.2002')
    its giving DATE FORMAT NOT RECOGNIZED error.
    The Example data is :
    testDate ------=-- testTime
    11/12/2002 --- 35000
    11/12/2002 --- 43000
    11/12/2002 --- 45000
    11/12/2002 --- 75000
    11/13/2002 --- 2000
    11/13/2002 --- 3500
    11/13/2002 --- 4300
    11/13/2002 --- 9800
    11/13/2002 --- 23000
    11/14/2002 --- 5000
    11/14/2002 --- 10000
    11/14/2002 --- 15000
    infact i need all the records between 11/12/2002 --- 43000 seconds to 11/14/2002 --- 1000 seconds.
    Please help me to find a full query beacuse iam very new to Oracle.
    Thanks,
    S R Mannava

  • Create a collection in the beforeshown by query sort by designer does not sort

    In the beforeshown function of a screen, I create a collection. This collection will be displayed in my target screen. I have added in the designer a Sort order by the displayed screen does not conform to this sort.
    Where is my error? The creation of the collection in the beforeshown function makes the query sort order execute before the collection is really created? Or the collection is not really database saved because it has been created in the beforeshown function?
    In the case I must do the sort in the Created function of the target screen with something like
    screen.StrengthCollection.setOrderBy()
    But I do not know how to give the right parameter to setOrderBy...
    Yves Pflieger

    Hi,
    You can try
    To Bind a Query Parameter to a Field
    1.Create a query that accepts a parameter (for example: the ID of a customer). For more information, see How to: Design a Query by Using the Query Designer.
    2.Add the query to the Screen Content Tree. For more information, see How to: Design a Silverlight Screen by Using the Screen Designer.
    3.Add a local field to the screen. For more information, see How to: Add a Local Property to a Silverlight Screen.
    4.In the Screen Members List of the Screen Designer, select the parameter of the query.
    5.On the View menu, click Properties Window.
    6.Select the Parameter Value text box.
    7.Select or type the name of the local field.
    You can refer to article below:
    https://msdn.microsoft.com/en-us/library/ff851987.aspx

  • SQL Server Query - Sorting of records in desc not as expected - Urgent Help needed

    Hi,
    I have a query
    SELECT a.* FROM
    (SELECT '1234' AS id, '001' AS co_id, 'VA' AS state_id, 'AA' AS company
    UNION
    SELECT '1234' AS id,'012' AS co_id,'VA' AS state_id,'AA' as company
    )a ORDER BY id,co_id DESC
    The above query returns a result as expected. But when we include state_id on the order by clause the desc result behaves different.
    SELECT a.* FROM
    (SELECT '1234' AS id, '001' AS co_id, 'VA' AS state_id, 'AA' AS company
    UNION
    SELECT '1234' AS id,'012' AS co_id,'VA' AS state_id,'AA' as company
    )a ORDER BY id,co_id,state_id DESC
    As highlighted on both pic, Even though the state_id value and other values are same, the result is not sorted in desc on the second case.
    Please let me know how to fix this..

    Hi,
    Which means that i have to give desc on
    every columns on the order by clause if i want whole result on desc..
    Any way, thanks a lot.
    Yes. The direction of sort has to be set for each field
    so if there are fields A,B,C and you want sort based on ASC on A and desecending on B,C you need to use
    ORDER BY A,B DESC,C DESC
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Does this query need function based index?

    Hello All,
    I have a strange problem. I have a table DM_T_CLEAN_EXCEPTION_LOG and I am doing a query in reports as follows:
    select COUNT(*) NO_OF_ALL_RECORDS
    FROM DM_T_CLEAN_EXCEPTION_LOG
    WHERE CREATE_DATE > to_date(to_char(sysdate -1 ,'dd-mon-yyyy') || ' 05:00:00PM' ,'dd-mon-yyyy hh:mi:sspm')
    AND EXCEPTION_SEVERITY = :EXCEPTION_SEVERITY
    AND EXCEPTION_DESCRIPTION = :EXCEPTION_DESCRIPTION
    Now I created indexes on CREATE_DATE, EXCEPTION_SEVERITY and EXCEPTION_DESCRIPTION. It says Index Skip Scan so I think it is slow. I tried even creating function based index on create_date using the to_date(to_char(create_date,'dd-mon-yyyy') but then it does a full table scan. Can anyone tell me what is the right way in this situation?
    Thanks

    It says Index Skip Scan so I think it is slow.Is it really slow or do you only think that it is slow ?
    If it is slow, please show us the explain plan with cardinalities, so we can figure out if an index on (exception_severity,exception_description,create_date) is more beneficial than your current one on (create_date,exception_severity,exception_description).
    Regards,
    Rob.

  • How can i update rows  in a table based on a match from a select query

    Hello
    How can i update rows in a table based on a match from a select query fron two other tables with a update using sqlplus ?
    Thanks Glenn
    table1
    attribute1 varchar2 (10)
    attribute2 varchar2 (10)
    processed varchar2 (10)
    table2
    attribute1 varchar2 (10)
    table3
    attribute2 varchar2 (10)
    An example:
    set table1.processed = "Y"
    where (table1.attribute1 = table2.attribute1)
    and (table1.attribute2 = table3.attribute2)

    Hi,
    Etbin wrote:
    Hi, Frank
    taking nulls into account, what if some attributes are null ;) then the query should look like
    NOT TESTED !
    update table1 t1
    set processed = 'Y'
    where exists(select null
    from table2
    where lnnvl(attribute1 != t1.attribute1)
    and exists(select null
    from table3
    where lnnvl(attribute2 != t1.attribute2)
    and processed != 'Y'Regards
    EtbinYes, you could do that. OP specifically requested something else:
    wgdoig wrote:
    set table1.processed = "Y"
    where (table1.attribute1 = table2.attribute1)
    and (table1.attribute2 = table3.attribute2)This WHERE clause won't be TRUE if any of the 4 attribute columns are NULL. It's debatable about what should be done when those columns are NULL.
    But there is no argument about what needs to be done when processed is NULL.
    OP didn't specifically say that the UPDATEshould or shouldn't be done on rows where processed was already 'Y'. You (quite rightly) introduced a condition that would prevent redo from being generated and triggers from firing unnecessarily; I'm just saying that we have to be careful that the same condition doesn't keep the row from being UPDATEd when it is necessary.

  • Select query based on joining of tables from different database is taking too long

    Hi Team,
    Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million records and also Table3 and Table4 (of different database) might
    contain close to 1million records.
    Select T1.*
    From DB1.dbo.Table1 T1
    Join DB1.dbo.Table2 T2 on RTRIM(T1.Col3) = RTRIM(T2.Col3)
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    Join Table3 U on CA.Col2 = U.Col2 AND RTRIM(T2.Col2) = U.Col3
    Where U.Col4 NOT IN ('A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7','A8','A9')
    And (T1.flg IS NULL OR T1.flg = 'N')
    And LTRIM(RTRIM(T2.Col2)) NOT IN ('B1','B2')
    How can i improve the performance of this query. Actual thing is update the data in Db1.dbo.table1 based on the conditions but if the select is taking close to 1hr then update will take hours together. Indexes already implemented on all the tables.
    Thanks,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Thanks.
    Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
    This join is not working with spaces if Rtrim is not used.
    Thanks! Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

  • Select query based on userinput

    Hi Folks...
    I posted this in another forum, but no reply,so I am posting it here too. I am trying to make a select query based on a user input. Earlier I was having probelms making a select query and printing out the result in the stack trace,with the advice given, I managed to solve that. I am now modifying that code to make a query based on user input, however it's not working, following is the code:
    String userId = request.getRemoteUser();  String sql = "SELECT hoursused FROM sysuser WHERE iduser = ?";    try      {        Connection connection = dataSource.getConnection();        PreparedStatement preparedStatement = connection.prepareStatement(sql);        preparedStatement.setString(1, userId);                ResultSet srs = preparedStatement.executeQuery(sql);                            while(srs.next()) {                          String hoursused = srs.getString("hoursused");                          System.out.println("The hours used are " + hoursused);    }                  }    catch (SQLException e)      {    e.printStackTrace();    }        } 
    stack trace seems to suggest I may have a probelm with this statement:
    "SELECT hoursused FROM sysuser WHERE iduser = ?"; 
    I am not sure how to rectify this, I hope someone can advise, thanks.

    Hi jschell..
    Thanks for responding, I appreciate it. The problem has been solved. No 'sysuser' is not a reserved word in Mysql. Based on the advice given in another forum and also from this site, I managed to solve the problem. I only made one change. This:
    ResultSet srs = preparedStatement.executeQuery(sql);     was changed to this:
    ResultSet srs = preparedStatement.executeQuery();  Thanks.

  • Select Query Based on date condition

    Hi ,
    Is it Possible.
    i want to run select query based on date condition.
    Eg...
    if the date between 01-jan-01 and 01-jan-05 then
    select * from table1;
    if the date between 02-jan-05 and 01-jan-08 then
    select * from table2;
    Becaz i have data in 2 diffrent tables , based on the date condition i wnt to run the select statement to diffrent tables.
    i dont want plsql here Just SQL needed.
    thanks,
    -R
    Edited by: infant_raj on May 5, 2009 11:48 PM

    Helo Kanish,
    this is not the one i was asking..
    wht i mean was .
    i use bind variable to get date while running the select statement , once i get the date then i want to choose any one of the table to run select query.
    EG..
    select col1,col2 from table1 where date between only if 01-jan-01 and 01-jan-05;
    select col1,col2 from table2 where date between only if 02-jan-05 and 01-jan-08;
    Run any one of the two . not all
    thanks,
    _raj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Select query based LOV for tabular form attributes

    Hi HTMLDB Team,
    Congrats u all for the new release of HTMLDB in htmldb.oracle.com.
    I badly need a solution of the below problem.
    Say , i have table called user_col_comments now i want to display the table_name ,column_name and comments in a tabular form.I displayed only one row for the tabular form.Now i create a select query based LOV for attribute table_name where i got all table_name in drop down list.
    Point is that after selecting any data from drop down table list i want to get the corresponding fields to be populated in column_name attributes.How can i wrote the select query based LOV for the attibute column_name.
    I wrote it as 'select column_name d,column_name r from user_col_comments where table_name=:TABLE_NAME Its not working?
    Similarly i want same thing to display for comments after matching both table_name and column_name.
    Any solution to get rid of those problem will be highly appreciable...
    If u need my htmldb.oracle.com userid and password to solve the problem i will sure let u email it.
    Cheers,
    Eman

    hi rchalton,
    can u plz little bit more clearer .I know hopefully u can imagine the problem and may u guide me thru proper way.....One think i understand that there must be multiple process and submit but "only when..." that u have said i cant understand that part........
    U are welcome to give me proper solution.....
    Thanks for the reply ....atleast one can pay hid to me.....
    Cheers,
    Eman

Maybe you are looking for

  • Audio Output with firewire audio interface issue

    Hi, i have a quick question that maybe someone here can answer for me. I originally posted this in the OS X forum but someone recommended that I may get better help here. I have a PowerPC G5 with Mac OS X 10.4.11. I do a lot of home recording and use

  • Hyperlinks in Multi-state object?

    I can't find the answer in the Help PDF, maybe because it is maybe even impossible to achieve it... or maybe there is a trick... How can I make hyperlinks to work in a Multi-state object? Thank you

  • How do you restrict rows returned in a group by query

    I have a select statement with a "group by" and a "order by" clause and I want the number of rows returned restricted to the first 10. Normally this is easy using rownum but it does not work in my case with the "group by" and a "order by" clauses. An

  • How to Restart a CallManager 7.1

    We have a callmanager v7.1, and we need to restart it. can anyone tell what are the steps to doing the correct sequence?

  • Join help

    Hi, I have two tables: project project_id description document document_id project_id title author The relationship is one to many between project and document (a project can have many document but a document can only be for one project) I want to cr