MySQL LIMIT clause equivalent in ORACLE statement

Is there an Oracle SQL statement that would be equivalent to the MySQL LIMIT clause used to return only part of a result set?

The preferred solution is to make use of the analytic function ROW_NUMBER. There is a description in the Oracle documentation. The final example shown returns only the fifty-first through one-hundredth row of the EMPLOYEES table:
SELECT last_name FROM
   (SELECT last_name, ROW_NUMBER() OVER (ORDER BY last_name) R FROM employees)
   WHERE R BETWEEN 51 and 100;An alternative is to use:
    select *
      from ( select a.*, rownum rnum
            from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
           where rownum <= MAX_ROWS )
     where rnum >= MIN_ROWS;which is discussed on asktom.oracle.com. This works from Oracle 8.1 onwards.
-- cj

Similar Messages

  • WITH clause equivalent in oracle 8i

    Hi friends,
    The "WITH" clause is very well supported in Oracle 9i. Is there any equivalent ways to use it in Oracle 8i?
    Regards
    J.B

    Dear J. B.!
    No, there isn't an equivalent for WITH in Oracle 8i. The only workaround for you is to build inline views in the FROM-Clause of your statements. Please have a look at the following link. It shows some example using a WITH-Clause and the equivalent SQL-Statements with an inline view.
    [http://www.oracle-base.com/articles/misc/WithClause.php]
    Yours sincerely
    Florian W.

  • Simple LIMIT Clause Impossible?

    Is the simple LIMIT clause available in other databases simply impossible in Oracle? This is driving me nuts and I'm just not finding a good answer.
    For example, the query:
    SELECT * FROM MYUSER ORDER BY LOGIN LIMIT 41, 20
    This would return up to 20 rows starting at row 41 in the query.
    How is this done in Oracle?
    I've seen ROWNUM, but:
    SELECT * FROM MYUSER ORDER BY LOGIN WHERE ROWNUM > 40 AND ROWNUM < 61
    This won't work because ROWNUM > x is not valid and will always return nothing. Also the ORDER BY is done after the where, so you wouldn't get the right rows anyway.
    You can fix the ORDER BY problem with:
    SELECT * FROM MYUSER (SELECT LOGIN FROM MYUSER ORDER BY LOGIN) WHERE ROWNUM > 40 AND ROWNUM < 61
    But you still have the ROWNUM > x is invalid problem.
    This seems just as silly as Oracle's NULL == '' problem. But anyway...
    Let me explain why I need this and maybe someone can tell me what I can do as a workaround.
    I have a web application that (among many other things) has a table of users. This table can easily reach into the tens of thousands of entries.
    The web application allows the administrator to page through the list of users, sorting by different criteria, so that they can locate a particular user, group of users, or just so they can generally browse things.
    I attempt to keep as little stateful information as possible so that memory (and other resources) aren't wasted.
    When a user clicks on the list of users, I do a query for the first 20 rows and display them, sorted by whatever criteria the user sets. The user can then hit the "next page" link and I do another query for rows 21-40 and display those. And so on, both forward and backward, with an option to go to the first 20 and the last 20.
    I'm doing all this through Java and JDBC on a proprietary web server that supports Java servlets.
    I could keep a result set open and that would help with page forwards (just grab the next 20 from the set). But what about paging backward? Or jumping ahead to the end? Or jumping ahead or backward several pages?
    This seems like a very common web application theme. What am I missing?
    Greg
    null

    To answer your last question ('What am I missing?') first - you aren't missing anything.
    You are correct - this is a very common question. You will find a dozen or more similar questions if you search this forum (search on ROWNUM).
    Oracle assigns ROWNUM as the result set records are being retrieved. Naturally this is before the ORDER BY clause since Oracle can't order what doesn't exist.
    That is why 'ROWNUM <' works (oracle quits when the desired number of rows is reached) but 'ROWNUM >' does not work (ROWNUM will never get to the desired number).
    The trick is to use a nested query or multiple nested queries. Oracle 8i supports the ORDER BY clause in nested queries.
    The first (innermost) query selects records and orders them.
    The second query is used to wrap the first query and assign row numbers.
    The third query selects the desired range of rows from the second query.
    'select * from (select rownum rn, e.* from
    (select * from emp order by ename desc) e) where rn >= 4'
    If an ORDER BY is not needed you can eliminate the first query.
    'select * from (select rownum rn, e.* from emp e) where rn >= 4'
    The inner query creates the RN column based on ROWNUM and the outer query uses the RN column (just as if it existed in a table) to select records with an RN value >= 4.
    Keep in mind that the performance will go down as the number of records goes up.
    For best results you need have a column in the table that you can use in the WHERE clause. Unfortunately this isn't always possible if you are trying to support generic ORDER BY clauses.
    One way that is often useful to try to understand why things like this 'are the way they are' is to examine how you would perform the task manually.
    Suppose I place in front of you a stack of 8 1/2 X 11 paper whose pages are not numbered and ask you to find and make copies of pages 40 - 60.
    How would you do it? You would start counting from the beginning. When you reach page 40 you would copy the next 20 pages.
    When you are done the pile of paper is in exactly the same state as when you started.
    Now I ask you to give me copies of pages 61 to 80.
    You have to start all over at the beginning as if the first request never happened.
    That's pretty much what the computer has to do.
    If the pages are numbered you can go directly to the desired pages.
    Now what if I ask you to copy pages 20 to 30 after you sort them in order by LAST NAME?
    There are exceptions (e.g. parallel processing, neural networks) but generally the computer can only do what you can do yourself. It can just do it faster and more efficiently.
    Certain types of problems are not well-suited for the computer and some problems cannot be solved at all.
    null

  • Jet OLEDB 'LIMIT' clause

    Hi Folks,
    I'm monitoring an access database for new records using LV2009 + the Database connectivity toolset(not 8.5.1 as in sig). Anyway the number of rows could be on the order of 200,000+, so I want to limit my query to only one record, the last. Unable to get the LIMIT clause to function, I searched and came across this: http://office.microsoft.com/en-us/access/HP010322501033.aspx. It states:
    Microsoft Jet SQL does not support the following ANSI SQL features:
    DISTINCT aggregate function references. For example, Microsoft Jet SQL does not allow SUM(DISTINCT columnname).
    The LIMIT TO nn ROWS clause used to limit the number of rows returned by a query. You can use only the WHERE Clause to limit the scope of a query.
    Is this the problem I'm going up against? The reason I use Jet is because I can more easily programatically load individual databases (and not have to mess around with UDL files).
    Any thoughts on a work-around?
    Happy Wiring,
    Jamie
    v2009 devel. w/RT
    Attachments:
    DB-test.zip ‏27 KB

    Potential workaround: may not be the most efficient solution though (my only exp. w/database access is from PHP/mySQL many years back!). Comments welcome. :-)
    v2009 devel. w/RT
    Attachments:
    DB-access-TEST_v2.vi ‏25 KB

  • Question on passing string values to Partition clause in a merge statement

    Hello All,
    I am using the below code to update specific sub-partition data using oracle merge statements.
    I am getting the sub-partition name and passing this as a string to the sub-partition clause.
    The Merge statement is failing stating that the specified sub-partition does not exist. But the sub-partition do exists for the table.
    We are using Oracle 11gr2 database.
    Below is the code which I am using to populate the data.
    declare
    ln_min_batchkey PLS_INTEGER;
    ln_max_batchkey PLS_INTEGER;
    lv_partition_name VARCHAR2 (32767);
    lv_subpartition_name VARCHAR2 (32767);
    begin
    FOR m1 IN ( SELECT (year_val + 1) AS year_val, year_val AS orig_year_val
    FROM ( SELECT DISTINCT
    TO_CHAR (batch_create_dt, 'YYYY') year_val
    FROM stores_comm_mob_sub_temp
    ORDER BY 1)
    ORDER BY year_val)
    LOOP
    lv_partition_name :=
    scmsa_handset_mobility_data_build.fn_get_partition_name (
    p_table_name => 'STORES_COMM_MOB_SUB_INFO',
    p_search_string => m1.year_val);
    FOR m2
    IN (SELECT DISTINCT
    'M' || TO_CHAR (batch_create_dt, 'MM') AS month_val
    FROM stores_comm_mob_sub_temp
    WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val)
    LOOP
    lv_subpartition_name :=
    scmsa_handset_mobility_data_build.fn_get_subpartition_name (
    p_table_name => 'STORES_COMM_MOB_SUB_INFO',
    p_partition_name => lv_partition_name,
    p_search_string => m2.month_val);
                        DBMS_OUTPUT.PUT_LINE('The lv_subpartition_name => '||lv_subpartition_name||' and lv_partition_name=> '||lv_partition_name);
    IF lv_subpartition_name IS NULL
    THEN
                             DBMS_OUTPUT.PUT_LINE('INSIDE IF => '||m2.month_val);
    INSERT INTO STORES_COMM_MOB_SUB_INFO T1 (
    t1.ntlogin,
    t1.first_name,
    t1.last_name,
    t1.job_title,
    t1.store_id,
    t1.batch_create_dt)
    SELECT t2.ntlogin,
    t2.first_name,
    t2.last_name,
    t2.job_title,
    t2.store_id,
    t2.batch_create_dt
    FROM stores_comm_mob_sub_temp t2
    WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val
    AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
    m2.month_val;
    ELSIF lv_subpartition_name IS NOT NULL
    THEN
                        DBMS_OUTPUT.PUT_LINE('INSIDE ELSIF => '||m2.month_val);
    MERGE INTO (SELECT *
    FROM stores_comm_mob_sub_info
    SUBPARTITION (lv_subpartition_name)) T1
    USING (SELECT *
    FROM stores_comm_mob_sub_temp
    WHERE TO_CHAR (batch_create_dt, 'YYYY') =
    m1.orig_year_val
    AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
    m2.month_val) T2
    ON (T1.store_id = T2.store_id
    AND T1.ntlogin = T2.ntlogin)
    WHEN MATCHED
    THEN
    UPDATE SET
    t1.postpaid_totalqty =
    (NVL (t1.postpaid_totalqty, 0)
    + NVL (t2.postpaid_totalqty, 0)),
    t1.sales_transaction_dt =
    GREATEST (
    NVL (t1.sales_transaction_dt,
    t2.sales_transaction_dt),
    NVL (t2.sales_transaction_dt,
    t1.sales_transaction_dt)),
    t1.batch_create_dt =
    GREATEST (
    NVL (t1.batch_create_dt, t2.batch_create_dt),
    NVL (t2.batch_create_dt, t1.batch_create_dt))
    WHEN NOT MATCHED
    THEN
    INSERT (t1.ntlogin,
    t1.first_name,
    t1.last_name,
    t1.job_title,
    t1.store_id,
    t1.batch_create_dt)
    VALUES (t2.ntlogin,
    t2.first_name,
    t2.last_name,
    t2.job_title,
    t2.store_id,
    t2.batch_create_dt);
    END IF;
    END LOOP;
    END LOOP;
    COMMIT;
    end;
    Much appreciate your inputs here.
    Thanks,
    MK.

    I've not used partitioning, but I do not see MERGE supporting a variable as a partition name in
    MERGE INTO (SELECT *
    FROM stores_comm_mob_sub_info
    SUBPARTITION (lv_subpartition_name)) T1
    USING ... I suspect it is looking for a partition called lv_subpartition_name.
    I also don't see why you need that partition name - the ON clause should be able to identify the partition's criteria.

  • Issue while using SUBPARTITION clause in the MERGE statement in PLSQL Code

    Hello All,
    I am using the below code to update specific sub-partition data using oracle merge statements.
    I am getting the sub-partition name and passing this as a string to the sub-partition clause.
    The Merge statement is failing stating that the specified sub-partition does not exist. But the sub-partition do exists for the table.
    We are using Oracle 11gr2 database.
    Below is the code which I am using to populate the data.
    declare
    ln_min_batchkey PLS_INTEGER;
    ln_max_batchkey PLS_INTEGER;
    lv_partition_name VARCHAR2 (32767);
    lv_subpartition_name VARCHAR2 (32767);
    begin
    FOR m1 IN ( SELECT (year_val + 1) AS year_val, year_val AS orig_year_val
    FROM ( SELECT DISTINCT
    TO_CHAR (batch_create_dt, 'YYYY') year_val
    FROM stores_comm_mob_sub_temp
    ORDER BY 1)
    ORDER BY year_val)
    LOOP
    lv_partition_name :=
    scmsa_handset_mobility_data_build.fn_get_partition_name (
    p_table_name => 'STORES_COMM_MOB_SUB_INFO',
    p_search_string => m1.year_val);
    FOR m2
    IN (SELECT DISTINCT
    'M' || TO_CHAR (batch_create_dt, 'MM') AS month_val
    FROM stores_comm_mob_sub_temp
    WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val)
    LOOP
    lv_subpartition_name :=
    scmsa_handset_mobility_data_build.fn_get_subpartition_name (
    p_table_name => 'STORES_COMM_MOB_SUB_INFO',
    p_partition_name => lv_partition_name,
    p_search_string => m2.month_val);
                        DBMS_OUTPUT.PUT_LINE('The lv_subpartition_name => '||lv_subpartition_name||' and lv_partition_name=> '||lv_partition_name);
    IF lv_subpartition_name IS NULL
    THEN
                             DBMS_OUTPUT.PUT_LINE('INSIDE IF => '||m2.month_val);
    INSERT INTO STORES_COMM_MOB_SUB_INFO T1 (
    t1.ntlogin,
    t1.first_name,
    t1.last_name,
    t1.job_title,
    t1.store_id,
    t1.batch_create_dt)
    SELECT t2.ntlogin,
    t2.first_name,
    t2.last_name,
    t2.job_title,
    t2.store_id,
    t2.batch_create_dt
    FROM stores_comm_mob_sub_temp t2
    WHERE TO_CHAR (batch_create_dt, 'YYYY') = m1.orig_year_val
    AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
    m2.month_val;
    ELSIF lv_subpartition_name IS NOT NULL
    THEN
                        DBMS_OUTPUT.PUT_LINE('INSIDE ELSIF => '||m2.month_val);
    MERGE INTO (SELECT *
    FROM stores_comm_mob_sub_info
    SUBPARTITION (lv_subpartition_name)) T1 --> Issue Here
    USING (SELECT *
    FROM stores_comm_mob_sub_temp
    WHERE TO_CHAR (batch_create_dt, 'YYYY') =
    m1.orig_year_val
    AND 'M' || TO_CHAR (batch_create_dt, 'MM') =
    m2.month_val) T2
    ON (T1.store_id = T2.store_id
    AND T1.ntlogin = T2.ntlogin)
    WHEN MATCHED
    THEN
    UPDATE SET
    t1.postpaid_totalqty =
    (NVL (t1.postpaid_totalqty, 0)
    + NVL (t2.postpaid_totalqty, 0)),
    t1.sales_transaction_dt =
    GREATEST (
    NVL (t1.sales_transaction_dt,
    t2.sales_transaction_dt),
    NVL (t2.sales_transaction_dt,
    t1.sales_transaction_dt)),
    t1.batch_create_dt =
    GREATEST (
    NVL (t1.batch_create_dt, t2.batch_create_dt),
    NVL (t2.batch_create_dt, t1.batch_create_dt))
    WHEN NOT MATCHED
    THEN
    INSERT (t1.ntlogin,
    t1.first_name,
    t1.last_name,
    t1.job_title,
    t1.store_id,
    t1.batch_create_dt)
    VALUES (t2.ntlogin,
    t2.first_name,
    t2.last_name,
    t2.job_title,
    t2.store_id,
    t2.batch_create_dt);
    END IF;
    END LOOP;
    END LOOP;
    COMMIT;
    end;
    Much appreciate your inputs here.
    Thanks,
    MK.
    (SORRY TO POST THE SAME QUESTION TWICE).
    Edited by: Maddy on May 23, 2013 10:20 PM

    Duplicate question

  • DMBS_SQL.to_refcursor equivalent in Oracle 10g

    Hello,
    Is there any other way to get result as a refcursor in Oracle 10g with DBMS_SQL? I have the function that function generate dynamic query and execute with DBMS_SQL. This function called by java code for viewing result as report. How can I do this, is there equivalent in Oracle 10g for DMBS_SQL.to_refcursor? Please help.
    Thanks,

    ilkinesrefli wrote:
    Is it difficult to understand my answers?Yes, because they are not accurate. You keep saying you can't use ref cursors and must use DBMS_SQL, but you have failed to show us why that is so.
    It is impossible because there is dynamic where clause in my query. Show us why it's impossible.
    BluShadow     please solve this one:
    p_sql := 'select empno, ename, deptno from emp where deptno=:pdeptno';
    if ... then
    p_sql := p_sql || ' AND empno=:pempno';
    end if;
    ...Is it possible by your way?Yes, ref cursors can be used for dynamic queries. basic example...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function get_refcursor(p_sql in varchar2
      2                                          ,p_whereclause in varchar2 := null
      3                                          ,p_whereval in number := null) return sys_refcursor is
      4    v_rc sys_refcursor;
      5  begin
      6    if p_whereval is not null then
      7      open v_rc for p_sql||' where '||p_whereclause using p_whereval;
      8    else
      9      open v_rc for p_sql;
    10    end if;
    11    return v_rc;
    12* end;
    SQL> /
    Function created.
    SQL> var rc refcursor;
    SQL> exec :rc := get_refcursor('select empno, ename, deptno from emp');
    PL/SQL procedure successfully completed.
    SQL> print rc;
         EMPNO ENAME          DEPTNO
          7369 SMITH              20
          7499 ALLEN              30
          7521 WARD               30
          7566 JONES              20
          7654 MARTIN             30
          7698 BLAKE              30
          7782 CLARK              10
          7788 SCOTT              20
          7839 KING               10
          7844 TURNER             30
          7876 ADAMS              20
          7900 JAMES              30
          7902 FORD               20
          7934 MILLER             10
    14 rows selected.
    SQL> exec :rc := get_refcursor('select empno, ename, deptno from emp', 'deptno = :1', 20);
    PL/SQL procedure successfully completed.
    SQL> print rc;
         EMPNO ENAME          DEPTNO
          7369 SMITH              20
          7566 JONES              20
          7788 SCOTT              20
          7876 ADAMS              20
          7902 FORD               20
    SQL>So, please explain to us again why ref cursors are impossible to use and you have to use DBMS_SQL?

  • Oracle statement to SQL Server

    Hi All,
    I have a oracle statement, I need same logic in SQL Server. I know in SQL server we use CASE statement instead of decode, but I don't understand this oracle statement
     Select count(decode(sign((A.StartDate - A.EndDate) - 60) ,-1, 'NewDateField',0, 'NewDateField')) NewDateField_1
    From SampleTable A
     I need SQL code for this in SQL server.
    Thanks in advance,
    RH
    sql

    Hi sql9, I am guessing here since DDL is missing.
    The code you have shown, calculating difference between startdate and enddate and then deducting 60. The result is checking to see whether negative number or zero ignoring positive number. Finally counting how many of these in a table ie., looks like counting
    number of records whose elapsed days between startdate and enddate are less than or equal to 60 days.
    Select count(decode(sign((A.StartDate - A.EndDate) - 60) ,-1, 'NewDateField',0, 'NewDateField')) NewDateField_1
    From SampleTable A
    Few interesting observations:
    1. Perhaps startdate and enddate columns are integer data types as there are no date manipulation functions used.
    2. It never yields either 0 or positive number unless startdate is greater than enddate.
    Please refer the code shown below to prove the above mentioned points. Also note that CNT1, CNT2 and CNT3 are all equivalent to your expected result to pass to aggregate function COUNT. Hope it helps.
    declare @SampleTable table ( id int identity,startDate datetime, EndDate datetime, startDT int, EndDt int )
    insert into @SampleTable(startDate, EndDate, startDT, EndDt )
    values ('04/01/2014', '04/23/2014', 20140401, 20140423),
    ('01/01/2013', '04/03/2013', 20130101,20130403),
    ('04/05/2013','04/05/2013', 20130405,20130405),
    ('04/05/2013','04/05/2014', 20130405,20140405)
    select
    startdate, enddate,
    dateadd(day,60, startdate) 'Add 60 days',
    datediff(day, startdate, enddate) 'elapsed days',
    case
    when dateadd(day, 60,startdate)>= enddate then 1
    else null
    end as 'cnt1',
    case
    when startdate>= dateadd(day, -60,enddate) then 1
    else null
    end as 'cnt2',
    case
    when datediff(day, startdate, enddate) <=60 then 1
    else null
    end as 'cnt3',
    startDT,
    enddt
    from @SampleTable
    select
    count(
    case (sign((startDT - enddt)-60))
    when -1 then 'NewDateField'
    when 0 then 'NewDateField'
    end
    ) as NewDateField_1
    from @SampleTable

  • LIMIT clause

    When I used MS Access with sql language I remender that for limiting retrieved records of a query I could use:
    SELECT TOP 1 * from TABLE_NAME
    So I searched for a similar clause for oracle queries and someone pointed me the LIMIT clause.
    Could anyone gimme an example on how to use it?

    The rownum usage can answered to the OP question, depend of what exactly he wants... but like below seems a little better :
    SCOTT@demo102> select empno, ename, sal, deptno from emp;
         EMPNO ENAME             SAL     DEPTNO
          7369 SMITH            8000         20
          7499 ALLEN           16000         30
          7521 WARD            12500         30
          7566 JONES           29750         20
          7654 MARTIN          12500         30
          7698 BLAKE           28500         30
          7782 CLARK           24500         10
          7788 SCOTT           30000         20
          7839 KING            50000         10
          7844 TURNER          15000         30
          7876 ADAMS           11000         20
          7900 JAMES            9500         30
          7902 FORD            30000         20
          7934 MILLER          13000         10
    14 rows selected.
    SCOTT@demo102> select empno, ename, sal, deptno
      2            from (select empno, ename, sal, deptno from emp order by sal desc)
      3            where rownum <=5;
         EMPNO ENAME             SAL     DEPTNO
          7839 KING            50000         10
          7788 SCOTT           30000         20
          7902 FORD            30000         20
          7566 JONES           29750         20
          7698 BLAKE           28500         30
    SCOTT@demo102> Anyway, like I said in the link given earlier, there is rank, dense_rank which can help for different requirements.
    Nicolas.

  • Subquery in IN clause of an select statement

    Hi friends,
    The Subquery in IN clause of an select statement take long time , is there any alternate ??
    >select * from oudata.SURVEY_USER_ANSWERS
    >where user_id in (select user_id from oudata.SURVEY_USERS where trunc(course_start_date) <'01-Jun-2007');
    thnaks,
    raj
    Edited by: infant_raj on May 28, 2009 12:09 AM

    infant_raj wrote:
    Hi friends,
    The Subquery in IN clause of an select statement take long time , is there any alternate ??
    select * from oudata.SURVEY_USER_ANSWERS
    where user_id in (select user_id from oudata.SURVEY_USERS where trunc(course_start_date) <'01-Jun-2007');
    No database version specified?
    No table structures/indexes given?
    No indication of the cardinality, selectivity, skew of the data being queried.
    Have you got a function based index for "trunc(course_start_date)"?
    Why are you not specifying your comparison date as a DATE datatype rather than relying on implicit conversion? i.e. it should be "to_date('01-Jun-2007','DD-MON-YYYY')"
    Have statistics been gathered on the data
    [How to post a SQL statement tuning request|http://forums.oracle.com/forums/thread.jspa?threadID=863295&tstart=0]
    [When your query takes too long...|http://forums.oracle.com/forums/thread.jspa?messageID=1812597#1812597]

  • HANA equivalent of oracle's sql%rowcount to get affected rows.

    I want to get the number of rows affected from an insert or update statement inside a stored procedure.
    Is there any equivalent to oracle's sql%rowcount that can be called after the query.
    For example:
    create procedure procedure_name
    begin
         declare l_c integer;
         insert into table values ('somevalue');
         l_c := sql%rowcount; -- This would return 1 for the row inserted.
    end;

    Yes, after the INSERT statement....
    SELECT ::ROWCOUNT into L_C FROM DUMMY;
    Cheers,
    Rich Heilman

  • Migrating mysql 5.0.45 to Oracle 11g

    I am usign SQL developer 1.5 on Ubuntu Hardy . I am able to capture and convert model , but when I try to generate oracle DDL ,, generate ORACLE SQL box only show 11 sequences .
    I have 94 tabkles , 154 indexes ...etc. I tried using Sun 1.5 and Sun 1.6 JVM. When I look at the sql file on my linux box , it only has statement to create user and 11 sequeces I am unable to figure out what is going on . Can some one please explain.
    This is how I installed SQL developer
    Down loaded sqldeveloper1.5 for Redhat
    Used alien to convert it to Debian
    dpkg -i the package
    Installed JVM through spt-get install jvm
    Anyhelp is appreciated
    Thanks
    Vipul

    Hello Sir,
    At the outset, I would like to convey my regards for extending your support to resolve the issue.
    My objective is to migrate MySQL 5 database entirely to Oracle 9.2.0.1.0 database.
    I have been using SQLDeveloper 1.2.2998. as migration tool. The Plugin is mysql-connector-java-5.0.6.jar. The steps which I followed for Migration are as follows.
    1. Create a New connection for source database for MySQL
    2. Create a New connection for target database for Oracle
    3. Create Repository for Target database.
    4. Associate Repository
    5. Quick Migrate
    I was able to migrate all the tables. But Views, Procedures, Functions and Triggers were not effected in the oracle database. While I found by selecting the procedures in the Converted Model that the syntax remained same as of MySQL. I raised the issue in Oracle Metalink. They have filed a Bug 6275523. But the issue is very sensitive to our business due to time frame as the alternative is only manual migration. Please do help me in this issue of migrating Stored procedures, Views, Functions and triggers into Oracle.

  • Values from a Multi-Select in the where clause of a Select statement

    I have a web page that solicits query parameters from the user.
    The selections that the user makes will populate the WHERE clause of a Select statement.
    One of the controls on the page is a multi-select control.
    When this page posts, I would like to execute a Select statement wherein the selected values from this control appear in the .. Column IN ( <list here> ) portion of the WHERE clause.
    This is an extremely common scenario, but I cannot seem to locate a how-to or message thread that addresses this specific case.
    I have an idea that it may involve dynamic SQL or Execute Immediate, but cannot seem to pin down the answer.
    Any help would be greatly appreciated!

    anonymous - As illustrated here: Re: Search on a typed in list of values
    Scott

  • Order by clause  Dynamic in Oracle function

    How can i get order by Clause Dynamic in Oracle function
    My function Returns sql query with SYS_REFCURSOR . and i will pass the order by column as input parameter
      create or replace
    FUNCTION TEST_SSK
            p_srot  number
    RETURN SYS_REFCURSOR
    AS
    C_testssk SYS_REFCURSOR;
    BEGIN
    OPEN C_TESTSSK FOR
    SELECT LOAN_CODE,LOAN_DATE,DUE_DATE,LOAN_AMT FROM LOAN_MASTER
    order by P_SROT;
    return C_testssk;
    end;Edited by: user10736825 on Dec 22, 2010 11:34 AM

    you can go for a dynamic query ;)
    create or replace
    FUNCTION TEST_SSK
            p_srot  number
    RETURN SYS_REFCURSOR
    AS
    C_testssk SYS_REFCURSOR;
    l_str VARCHAR2(4000);
    l_order VARCHAR2(100);
    BEGIN
    l_str := 'SELECT LOAN_CODE,LOAN_DATE,DUE_DATE,LOAN_AMT FROM LOAN_MASTER ';
    IF p_sort = 'LC'
    THEN
      l_order := ' ORDER BY LOAN_CODE ';
    ELSIF p_sort = 'LD'
    THEN
      l_order := ' ORDER BY LOAN_DATE ';
    END IF;
      l_str := l_str || l_order ;
    OPEN C_TESTSSK FOR l_str;
    return C_testssk;
    end;

  • SQL XMLExplicit equivalent in oracle

    Hi
    Is there any equivalent in oracle for SQL XMLExplicit?
    In SQL the XMLExplicit will add all the retunded nodes under the single root node like that any equivalent is available in oracle.
    Thanks
    Surendra

    I hope you will get better answers if you post this in Sql/Plsql Forum ..
    PL/SQL
    This one is one of the genuine and active forums .. :)

Maybe you are looking for