Migrating Sybase code to Oracle 11g

Hi All,
We have to migrate Sybase code to Oracle 11g.
When we are doing a SELECT .. INTO in Sybase , even if the query is returning more than 1 row , sybase selects 1 of the rows and populates the variables.
But while migrating this code to oracle, we are getting TOO_MANY_ROWS Exception.
We need to migrate the code from SYBASE to ORACLE without disturbing the logic.
Can someone please tell me the logic applied by SYBASE to pick up the record?
And if someone has faced this issue, then what can be done to resolve this.
Regards,
Riddhisha Khamesra

The result 3 is the last entered record (not the amount of records..).
So the first approach to write a dummy procedure that will select all records in Oracle like:
CREATE OR REPLACE PROCEDURE last_record
v_arg1 OUT NUMBER
AS
BEGIN
SELECT col1
INTO v_arg1
FROM tt_tmp ;
END;
and hopefully returns only the last record will fail with:
SQL> variable outvar number
SQL> exec last_record (:outvar)
BEGIN last_record (:outvar); END;
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "SYSTEM.LAST_RECORD", line 9
ORA-06512: at line 1
One possible approach to get the last (and only the last) record that was entered into the table is to use rownum:
The select might look like "select col1 from (select col1, rownum from tt_tmp order by rownum desc) where rownum=1;"
So the procedure can be coded as:
CREATE OR REPLACE PROCEDURE last_record
v_arg1 OUT NUMBER
AS
BEGIN
SELECT col1
INTO v_arg1
from (select col1, rownum from tt_tmp order by rownum desc) where rownum=1;
END;
Now calling it in SQL*Plus:
SQL> variable outvar number
SQL> exec last_record (:outvar)
PL/SQL procedure successfully completed.
SQL> print :outvar
OUTVAR
7
The value 7 is the last record I've inserted into my tt_tmp table:
SQL> select * from tt_tmp;
COL1 COL2
1 1
2 2
8 8
7 7

Similar Messages

  • SQL Developer 3.1 not migrating Sybase Users to Oracle 11g R2

    I have tried both online and offline capture and the Sybase users are not being captured (Tables, Views, Procedures Worked). I searched this forum and saw another post about this issue but the Oracle representative never came back with a final finding/answer. We have 1000+ users to migrate so all help is appreciated.

    Hello.
    sorry for the delay (if you need quicker response I suggest that you open a Service Request in My Oracle Support).
    In your first post you said that you tried online and offline migration. So for an offline migration you have created the scripts using the Create Database Capture Scripts menu button. Then you have run that scripts against Sybase. Has there been created a file SYB15_SYSUSERS.dat (or SYB12_SYSUSERS.dat if your Sybase version is 12)? If that file has been created, does it contain anything or is it empty?
    Regards
    Wolfgang

  • Sybase ASE to Oracle 11g conversion

    Hi,
    Can anyone please look at the following Sybase ASE to Oracle 11g conversion - the top remarked code is the original Sybase version and the two UPDATE blocks below are hopefully doing the same task... What I need to know is if there is a more simple (less code change) way of doing the same task, either as a single UPDATE or preferably even more similar to the original Sybase code..?
    -- /* now apply allocations */
    -- update diary_items
    -- set id_user = ia.id_user ,
    -- tx_icon_user = 'urlcats:/user_grey.gif?method:getAllocationInfo'
    -- from diary_items di,
    -- item_allocation ia
    -- where di.id_diary_item = ia.id_object
    -- and ia.id_object_type = 'W'
    -- and ia.id_user != 'autocats'
    -- OK!
    -- ??? Need to check if second UPDATE which is the same as above is required again...
    /* now apply notes */
    UPDATE diary_items
    SET diary_items.tx_icon_user =
    ( SELECT 'urlcats:/user_grey.gif?method:getAllocationInfo'
    FROM item_allocation
    WHERE item_allocation.id_object = diary_items.id_diary_item )
    WHERE EXISTS
    ( SELECT item_allocation.id_object
    FROM item_allocation
    WHERE item_allocation.id_object = diary_items.id_diary_item
    AND item_allocation.id_object_type = 'W'
    AND item_allocation.id_user != 'autocats' )
    UPDATE diary_items
    SET diary_items.id_user =
    ( SELECT item_allocation.id_user
    FROM item_allocation
    WHERE item_allocation.id_object = diary_items.id_diary_item )
    WHERE EXISTS
    ( SELECT item_allocation.id_object
    FROM item_allocation
    WHERE item_allocation.id_object = diary_items.id_diary_item
    AND item_allocation.id_object_type = 'W'
    AND item_allocation.id_user != 'autocats' )
    Many thanks!!!
    Edited by: 881552 on 25-Aug-2011 04:39

    I managed to work it out in the end - here's the solution...
    /* now apply allocations */
    update diary_items
    set ( id_user,
    tx_icon_user ) =
    ( select ia.id_user,
    'urlcats:/user_grey.gif?method:getAllocationInfo'
    from diary_items di,
    item_allocation ia
    where di.id_diary_item = ia.id_object
    and ia.id_object_type = 'W'
    and ia.id_user != 'autocats'
    )

  • Steps for migrating from Oracle10g to Oracle 11g

    Hi,
    Please send me steps to migrate from Oracle10g to Oracle 11g on Redhat Linux x86_64 on RAC with ASM.
    Regards,
    Tushar

    http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/toc.htm

  • Migrating from MySQL to Oracle 11g

    can u tell me the steps to migrating database from MySQL to Oracle using SQL Developer?
    I have installed Oracle 11g(11.1.0.6.0) in server and SQl Developer in my local system.
    I connected to MySQL and Oracle in SQL Developer and tried to MIgrate everything in MySQL to Oracle using Quick Migrate option.
    it took one and half day but didn't work at last...
    is there any pre tasks that i need to do before migrating to oracle from MySQL?
    and also when i export the MySQL data to Oracle using SQL Developer,it is giving data type mismatch errors like (date, boolean etc...).
    please give a reply what i need to do and any refferences also very much appreciated.

    hi Turloch ,
    I followed the steps mentioned above.
    When I right click my MySQL server db Connection and click "Capture MySQL server", it just shows a dialog with "Close" enabled.
    after clicking the close button, it gives following error messages.
    oracle.dbtools.metadata.persistence.PersistableObject.doInsert(PersistableObject.java:238)
    the same error is coming no of times.
    Kindly help me in this regard.

  • Migrating MySQL database to Oracle 11g RAC

    Hi,
    I would like to migrate an entire database from MySQL to my new Oracle 11g RAC. How do I do it?

    Hi Turloch,
    I was able to configure SQLDeveloper to connect to Oracle and MySQL.
    I am having a hard time migrating data from mysql maybe due to table size. I got mysql tables with more than 20M and the PC am running the sqldeveloper is running out of memory every time I try to migrate the tables.
    Can you share some experience migrating from MySQL to Oracle?
    Thank You.

  • Migrate Informix 11 to Oracle 11g

    Hi,
    Are there any Oracle or third-party tools to assist with the migration of a database from Informix 11 to Oracle 11g? All the stuff I've found seems to stop at Informix 9.
    Thanks
       Brian

    Hi Brian,
      If your management do not want to pay for Dg4Informix then you could use the Database Gateway for ODBC (DG4ODBC) which is included in your RDBMS license but needs a third-party ODBC driver.  It has less functionality than the DG4Informix but can be used for simple processing.
    See the following -
    Note.233876.1   Options for Connecting to Foreign Data Stores and Non-Oracle Databases (Doc ID 233876.1)    
    Note.252364.1   Functional Differences Between DG4ODBC and Specific Database Gateways (Doc ID 252364.1)
    Regards,
    Mike

  • Migrating Sybase users to Oracle

    I am migrating a lists of users from Sybase to Oracle. These users are created in Oracle with connect and resource privileges. I would only want the users to have create session privilege. Is there a way to specify the privilege before users are created?
    thanks.

    Hello,
    There is a round about way for doing this. Can you generate the migration scripts, and do a find replace for the "connect, resource" privileges and replace it with the "create session" previlege.
    Alternatively, once the database is migrated, you can write up a small script that will change the privileges in the destination table.
    Not very sure if we can change these options in the workbench itself before we migrate.
    Regards,
    Srinivas Nandavanam

  • Sqldeveloper capturing null DB during Migration Sysbase 15 to Oracle 11g.

    I am doing offline migration from Sybase to Oracle using SQLdeveloper 3.0.02 . I have performed below steps:
    1) Create a user (without CREATE ROLE, CREATE USER, DROP ANY SEQUENCE, DROP ANY TABLE, DROP ANY TRIGGER, DROP USER, DROP ANY ROLE, GRANT ANY ROLE privileges due to security reasons I can't have these privileges. This user have all other privileges suggest as per Oracle docs)
    2) Create a migration repository
    3) Made a connection and associate the migration repository to it.
    4) Generate the offline Sybase capture files using sqldeveloper and generate the dat files having Sybase structure.
    5) Tool -> migration -> migrate -> following the wizard instructions I start the migration.
    Now the message window showing me 1) capturing connections 2) capturing catalogs and then directly migration is successful. Finally there is no error message.
    I have checked the migration project navigation window and found that sql developer has captured the null database.
    I checked the migration repository tables and found that only MD_CONNECTIONS, MD_CATALOGS and MD_DERIVATIVE tables are populated.
    Could you please suggest me why SQL developer captured the null database. ( No Sybase database objects are captured from Sybase15.ocp file)
    ASAP reply would be appreciated.
    Regards
    Abdul
    Edited by: Abdul Nazar Ali on Apr 9, 2013 9:28 AM
    Edited by: Abdul Nazar Ali on Apr 9, 2013 9:28 AM

    Hi,
    At that time SQL developer was not able to capture the connection details. The error msg was "Capturing connection failed". So we downloaded the sybase jtds driver and recaptured ocp files from sybase and run the migration again...this time capture connection is successful and capturing of cataloge is successful and after that sql developer can't able to capture any sybase db objects from sybase15.ocp
    We going to upgrade sql developer to latest version and will try it again.
    Regds,
    Abdul
    Edited by: Abdul Nazar Ali on Apr 9, 2013 2:22 PM

  • Migrating from SQL to ORACLE 11g : naming length Issue using synonyms...

    Hi,
    In sql I have maximum length of objects is 98 char
    now i m migrating it into oracle , i m using synonyms for it ..
    it is showing synonyms created ...
    but it gets converted into encrypted forms,
    due to this i m not able to use actual synonyms that i have created
    so tell me how can i create synonyms of more than 30 characters
    If this is not possible , then wht else solution by which i can solve ma problem.
    please give me solution asap!!!!!!!

    Create synonym name with more than 30 character.

  • Migrating from Informix to Oracle 11g

    Hi,
    I have downloaded the Migration workbench, and the plug-ins Inofrmix7.jar from http://www.oracle.com/technetwork/topics/index-095746.html. Kindly could you please tell me from where i can download the ifxjdbc.jar. Are these files same with different name.
    Regards

    Hello,
    What you need is the Informix Dynamic Server JDBC Driver, version 1.4 JAR file, ifxjdbc.jar.
    This driver is shipped with the Informix Dynamic Server software. I am not sure you can download it freely.
    Regards,
    Jean-Patrick

  • Sybase group to oracle roles

    I've been testing Sybase to Oracle migration using SQL Developer 3.1.06 release. I dont see the user/groups on the Sybase is not getting converted in respective roles in Oracle. Am i missing something here? Any help is much appropriated.
    Thanks
    ~ G

    Looks like a open issue. My Query is very similar to one below. Any update on this? Is this a know issue on SQL Developer migration option for Sybase? Can someone confirm..
    SQL Developer 3.1 not migrating Sybase Users to Oracle 11g R2

  • Migrate peoplesoft sybase HR database to oracle 11g

    Hi All,
    We am looking to migrate from sybase 12 to Oracle 11g. We are not sure on which path to choose for this migration to be done. Ths sybase Database is around 55 GB. Below are few questions. Please let me know. The down time on this database can not be more than 2 days at the max.
    1. What is the best and fastest way to do this, if there is one?
    2. Any Documentation on steps involved in migration?
    3. Do we have to use any 3rd party tools for this?
    4. Can we achieve the data migration with sql loader, if yes is it the suggested way to do this and is there any documentation on this?
    I tried sql developer to do the migration but it did not go well and finally found that it is not the way to migrate a Database with peoplesoft environment, below is the link to explain more about what I have done with sql developer.
    If there is any other information required, below link has almost all the information.
    Re: Migrate peoplesoft sybase HRMS database to oracle 11g
    Thanks
    Kranthi

    1)     Build an Oracle Demo system patched to the same release level as the current production system.
    2)     Launch Application Designer and compare the production system to the demo system so you may capture the modifications.
    3)     Load a custom table with the tables listed in the MVPRDEXP.EXP in the production system. Run a script to create an export script for all PSRECDEFN where the RECTYPE is 0. This identifies all application data tables. You may want to dms export large tables in parallel.
    4)     DMS Import the exported data into the Oracle instance.
    5)     Reapply the modifications.

  • SQL Developer not migrating Sybase data

    Hi,
    I am trying to migrate data using the SQL developer tool from a Sybase database to Oracle 11g. When using the Migration Repository, I am able to recreate the schema but am not able to export the database content. (i.e. Not able to do the Data Move). I tried doing a Offline migration but the generated datamove files does not have any content. Anyone aware of any issue with the data migration tool with SQL developer ?
    I have tied exporting data from the table directly to generate SQL inserts but even this is not helping. Any suggestions ?
    Regards,
    Nelson

    Hi Nelson,
        Could you detail the exact steps you followed and what options you chose at each of the panels in the migration steps ? this will help to see where you may be having problems.
    Regards,
    Mike

  • Sybase Timestamp in Oracle

    Hi,
    I am in the process of migrating Sybase database to oracle 10g.
    In Sybase there is a column exist in most of the tables with datatype Timestamp, the data looks like 0x467469786abfc324, this is automatically generated while inserting or updating a table.
    Is this equivalent to rowid in Oracle? or please suggest a equivialent solution in oracle.
    Thanks,
    DJ

    Yes. The Sybase Timestamp is essentially a surrogate row identifier and should not be moved into Oracle.
    In Oracle, especially with newer technologies such as Advanced Compression, we enable and expect row movement so it is rowids
    should not be treated as static. If you need a surrogate key then create a SEQUENCE object and use that to generate the surrogate key.

Maybe you are looking for

  • How to adjust wide screen format?

    I just installed AppleTv connected to my A/V amp. the monitor out is to a projector and then a 110" screen. video from AppleTV are the correct width, but not the correct height. the vids don't fill the screen vertically. I see this happen with letter

  • Converting 23.976 ProRes to PAL 25fps.

    I need to convert some 23.98HD ProRes to PAL SD. I tried using Graeme Nattress' conversion software, but I find that there is a slight stutter where his software creates an extra frame - the 25th frame. He advised me to use Cinema Tools to create a f

  • Apps won't update.  Help?

    My Apps download, start to install and immediately stop.  It then says I still need to update the apps.  Any ideas?  Thanks.

  • Object Spacing Help

    Okay, I'll bet this question has been asked, but I can't think of the correct search term, apparently. Here's the problem page: http://web.mac.com/bcargill/iWeb/Talitha/Main.html On the left, there are links to other photo pages. The template comes w

  • Video Content Type Welcome Page

    For most document sets, you can determine which fields show on the welcome page by going to Document Set settings - Welcome Page Columns, but the Welcome Page Columns section does not show on the OOB Video Content Type. How do I change which fields s