Migrating Stored Procedures

I am trying to migrate a SQL Server 7.0 database to Oracle. There is a stored procedure in SQL Server, that needs to be migrated. I edited the stored procedure in the SQL Server 7.0 Source Model tried creating the Oracle Model, but it still gives me and error..
"failed to parse procedure text - CustOrderHist: Parse error at line 14 column 19. Encountered: <EOF>

There's the Migration Guide for Sybase and SQLServer from the Oracle docs
http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/win.920/a97248/toc.htm
You should also read at least the first few chapters of Tom Kyte's book
http://asktom.oracle.com/pls/ask/z?p_url=http://www.amazon.com/exec/obidos/ASIN/1861004826/asktom-20&p_cat=BOOK&p_company=10
Hth
Martin

Similar Messages

  • How to Migrate Stored procedure on Sql server 2008 to Oracle Database

    Guys, I need help vey badly as I am new in this field.
    Problem is that, I have to migrate stored procedure on Sql server 2008 to oracle Oracle database:
    Whole scenario--
    1. Sql Server 2008 application on Windows server (source machine)
    2. I have to migrate 70 Stored Procedure
    3. To Oracle Database on Linux machine (Target machine)
    Any method (no problem)
    Please, help me or give me any reference as I don't know which keyword is differ in both database.
    Thanks in advance

    Hi,
      You could the free Oracle SQL*Developer to do this.
    There is information and a download link here -
    Oracle SQL Developer&lt;/title&gt;&lt;meta name=&quot;Title&quot; content=&quot;Oracle SQL Developer&quot;&gt;&lt;meta n…
    and information on using it for migrations here -
    http://www.oracle.com/technetwork/database/migration/index-084442.html
    You could use it in 2 ways -
    1. Go through a migration but just pull the stored procedure code from the file created after you generate the SQL from the SQL*Server database
    2. Use the scratch editor accessed from -
    - Tools - Migration - Scratch Editor
    and paste the SQL*Server stored procedure code into the window and it will convert it to Oracle code. The tool is very good but may have problems if you have very complicated procedures that use SQL*Server specific utilities.
    Regards,
    Mike

  • Migrating Stored Procedure from Informix

    I am seeking tool to migrate stored procedure from Infromix 11.5(installed at one customer) into Oracle.
    I find that Oracle Migration Workbench can only support migration from Informix version lower than 9.4.
    Any ideal about migration stored procedures from Infromix 11.5 into Oracle?
    Any help is highly appreciated!
    tom

    Mike,
    Wrong forum, for this question, suggest you ask it in the PL/SQL forum.
    Jim Stern

  • Migrating Stored procedure from Oracle to Mysql

    Dear All,
    Please suggest, is ther any tool of stored procedure migration from oracle to mysql.
    I tried some tool like
    1. Intelligent Converter.
    2. Sql way
    3. Mysql Migration Toolkit.
    But procedure cannot migrate properly.
    hb venki

    Venki,
    I think you are in the wrong place, try finding a MySQL forum ;0)

  • Customize the stored procedure migrating of MWB

    Hi, All,
    Is there anybody know how much customize we can have for using
    the MWB when migrate stored procedure? For sample I have a SQL
    Server 6.5 strored procedure like following:
    /******************* SQL Server 6.5 sp *************/
    CREATE PROCEDURE sp_SelectUsers
    AS
    select
    tbl_Sp_users.ID, UserName, Password, ExpiresOn,
    PwdChangedDate, tbl_Sp_UserGrps.name
    from
    tbl_Sp_users, tbl_Sp_UserGrps
    where
    GroupID = tbl_Sp_UserGrps.id
    order by username
    /******************* end ***************************/
    After I migrate it to Oracle 8 with MWB, I got following object,
    one Pkg and one Procedure in Oracle db, like following:
    /****************** Oracle Pkg **********************/
    CREATE OR REPLACE PROCEDURE sp_SelectUsers(
    RC1 IN OUT sp_SelectUsersPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT tbl_Sp_users.ID, UserName, Password,
    ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    tbl_Sp_users, tbl_Sp_UserGrps
    WHERE GroupID = tbl_Sp_UserGrps.id
    ORDER BY username ;
    END sp_SelectUsers;
    /******************* Oracle Procedure ****************/
    PROCEDURE sp_SelectUsers(
    RC1 IN OUT sp_SelectUsersPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT tbl_Sp_users.ID, UserName, Password,
    ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    tbl_Sp_users, tbl_Sp_UserGrps
    WHERE GroupID = tbl_Sp_UserGrps.id
    ORDER BY username ;
    END sp_SelectUsers;
    /******************* end *****************************/
    As our client use RDO as access method, there is no way we can
    use this migrated SP in RDO and return resultset. We need
    convert this SP to following to be able to use RDO to get
    resultset back in client:
    /******************* need convert to *********************/
    create or replace package sp_selectUsersPkg
    as
    cursor c1
    is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
    PwdChangedDate, tbl_Sp_UserGrps.name
    from tbl_Sp_users, tbl_Sp_UserGrps
    where GroupID = tbl_Sp_UserGrps.id
    order by username;
    type UsersCur
    is ref cursor return c1%ROWTYPE;
    procedure sp_selectUsers(UserCursor in out UsersCur );
    END;
    create or replace package body sp_selectUsersPkg
    as
    procedure sp_selectUsers(UserCursor in out UsersCur )
    is
    begin
    open UserCursor for
    select tbl_Sp_users.ID, UserName,
    password, ExpiresOn,
    PwdChangedDate, tbl_Sp_UserGrps.name
    from tbl_Sp_users, tbl_Sp_UserGrps
    where GroupID = tbl_Sp_UserGrps.id
    order by username;
    end;
    end;
    /******************* end *********************************/
    Is there any idea how we can do this? I hope we don't need do
    this manually.
    Thank you very much for any help!
    Jing
    null

    I have done a rough example of using VB6, RDO and ODBC
    drivers, which may be of help to some workbench users:
    Calling Oracle 8.1.5 stored procedures with ref cursors using RDO
    and Visual
    Basic.
    Ver 0.1 [email protected]
    Summary
    Versions Used
    Table
    Code
    With Explicit Ref Cursor Argument
    Without Explicit Ref Cursor Argument
    Actions
    Summary
    This gives a comparison of the connectivity between Visual Basic
    and Oracle,
    with both the intersolve and oracle drivers. The Oracle odbc
    still has
    significant
    shortcomings in comparison to the intersolve/Merant driver.
    Versions Used
    Visiual Basic 6.0, Oracle odbc driver 8.1.5.3.0, Oracle Database
    8.1.5.0.0 on
    NT, intersolve/Merant 3.5 32 bit Oracle driver.
    Table
    html table replaced by rough results in ascii form
    test case with named result set cursor variable:
    sSQL = "{CALL reftest.GetEmpData(?)}"
    oracle 8.1.5.3
    could not find item indicated by text, known vb6.0 bug?, thinks
    reftest is user
    intersolve
    could not find item indicated by text, known vb6.0 bug?, thinks
    reftest is user
    sSQL = "begin reftest.GetEmpData(?); end;"
    oracle 8.1.5.3
    run time error 40002 driver not capable
    intersolve
    ok
    sSQL = "{CALL GetEmpData(?)}"
    oracle 8.1.5.3
    run time error 40002 driver not capable
    intersolve
    could not find item indicated by text,?(similar to bug above?)
    at qd.rdoParameters(0).Type = rdTypeVARCHAR
    sSQL = "begin GetEmpData(?); end;"
    oracle 8.1.5.3
    run time error 40002 driver not capable
    intersolve
    ok
    procedure with result set last argument wanting to be simulated
    as not
    argument result set
    strsql = "{CALL BYROYALTYPkg.byroyalty()}"
    oracle 8.1.5.3
    ok
    intersolve
    ok
    strsql = "begin BYROYALTYPkg.byroyalty(); end;"
    oracle 8.1.5.3
    wrong number of arguments in byroyalty
    intersolve
    ok
    strsql = "{CALL byroyalty() }"
    oracle 8.1.5.3
    wrong number of arguments
    intersolve
    ok
    strsql = "begin byroyalty(); end;"
    oracle 8.1.5.3
    wrong number of arguments
    intersolve
    ok
    Code
    With Explicit Ref Cursor Argument
    Oracle Stored Procedures and Packages
    (on scott/tiger account)
    create or replace package reftest as
    cursor c1 is select ename from emp;
    type empCur is ref cursor return c1%ROWTYPE;
    procedure GetEmpData(EmpCursor in out empCur );
    END;
    create or replace package body reftest as
    procedure GetEmpData(EmpCursor in out empCur) is
    begin
    open EmpCursor for select ename from emp;
    end;
    end;
    create or replace procedure GetEmpData(EmpCursor in out
    reftest.empCur)
    is
    begin
    open EmpCursor for select ename from emp;
    end;
    VB code
    Private Sub Command1_Click()
    Dim cn As New rdoConnection
    Dim qd As rdoQuery
    Dim rs As rdoResultset
    Dim cl As rdoColumn
    Static Number As Integer
    Number = 0
    cn.Connect = "uid=scott; pwd=tiger; DSN=Oracle;"
    'enable the MS Cursor library
    cn.CursorDriver = rdUseOdbc
    'Make the connection
    cn.EstablishConnection rdDriverPrompt
    sSQL = "BEGIN GetEmpData(?); END;"
    Set qd = cn.CreateQuery("", sSQL)
    qd.rdoParameters(0).Type = rdTypeVARCHAR
    'Dynamic or Keyset is meaningless here
    Set rs = qd.OpenResultset(rdOpenStatic)
    'all the output is routed to the debug window
    Debug.Print ".....Starting Result Sets....."
    Do
    Debug.Print
    Debug.Print
    Do Until rs.EOF
    For Each cl In rs.rdoColumns
    If IsNull(cl.Value) Then
    Debug.Print " "; cl.Name; "NULL"; 'Error
    trap for
    null fields
    Else
    Debug.Print " "; cl.Name; " ";
    cl.Value;
    End If
    Next
    Debug.Print
    rs.MoveNext
    Loop
    Loop While rs.MoreResults
    cn.Close
    End Sub
    Without Explicit Ref Cursor Argument
    Oracle Stored Procedures and Packages
    (requires table:
    SQL> desc MTG_VERSION
    Name
    Null?
    Type
    VERSION
    NUMBER
    create or replace PACKAGE BYROYALTYPkg AS
    TYPE RT1 IS RECORD (
    val MTG_VERSION.VERSION%TYPE
    TYPE RCT1 IS REF CURSOR RETURN RT1;
    PROCEDURE byroyalty(
    RC1 IN OUT BYROYALTYPkg.RCT1);
    END;
    create or replace PACKAGE BODY BYROYALTYPkg AS
    PROCEDURE byroyalty(
    RC1 IN OUT BYROYALTYPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT VERSION FROM MTG_VERSION;
    END byroyalty;
    END;
    create or replace PROCEDURE byroyalty(
    RC1 IN OUT BYROYALTYPkg.RCT1)
    AS
    StoO_selcnt INTEGER;
    StoO_error INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2(255);
    StoO_sqlstatus INTEGER;
    BEGIN
    OPEN RC1 FOR
    SELECT VERSION FROM MTG_VERSION;
    END byroyalty;
    VB code
    Dim env1 As rdoEnvironment
    Dim conn1 As rdoConnection
    Dim strsql As String
    Dim ps As rdoPreparedStatement
    Dim rs As rdoResultset
    Private Sub Command1_Click()
    strsql = "begin byroyalty(); end;"
    'in oracle odbc driver uses refcusor argument to
    get result set
    Set ps = conn1.CreatePreparedStatement("PsTest",
    strsql)
    Set rs = ps.OpenResultset(rdOpenStatic)
    Text1 = rs!Version
    rs.Close
    End Sub
    Private Sub Form_Load()
    rdoEngine.rdoDefaultCursorDriver = rdUseOdbc
    Set env1 = rdoEngine.rdoCreateEnvironment(" ", " ", " ")
    strsql = "ODBC;DSN=tot4;UID=test;PWD=test;"
    Set conn1 = env1.OpenConnection(" ", rdDriverPrompt, False,
    strsql)
    conn1.QueryTimeout = 3600
    End Sub
    Actions
    Encourage odbc to allow result sets , via the odbc processed
    extra
    argument, outside of packages.
    Document the current situation, and keep users informed of
    developments.
    Turloch
    Oracle Migration Workbench Team
    Turloch O'Tierney (guest) wrote:
    : Jing,
    : Note that there is an example in the FAQ where the intersolve
    : driver was used so no change was required in the client code.
    The
    : intersolve driver optionally converts the extra argument into a
    : result set. With the Oracle ODBC driver the argument needs to
    be
    : explicitly handled.
    : Is there a problem with RDO and the 8.0.5 ODBC driver handling
    : package references?
    : Turloch
    : Turloch O'Tierney
    : Oracle,
    : Migration and Technology Group.
    : FAQ entry reproduced:
    : How are result sets/dynasets returned to the calling program?
    : The Oracle Migration Workbench parser adds an extra
    argument
    : of type REF CURSOR for result
    : sets/dynasets. This type is understood and can be
    : manipulated by both PL/SQL and Oracle JDBC. Oracle8
    : release 8.0.5 ODBC drivers support REF CURSORs which means
    : that the additional argument must be
    : explicitly handled by the application, and the client
    : application code must be changed. However, some
    : third-party vendors such as Intersolv supply ODBC drivers
    : for Oracle that support REF CURSORs and can, in
    : addition, implicitly make use of REF CURSORs for using
    : result sets/dynasets. Therefore, no change is
    : required in the client application code. This is
    illustrated
    : in the following examples of an MS SQL Server
    : stored procedure and its equivalent Oracle package and
    : stored procedure as generated by the Oracle
    : Migration Workbench parser.
    : MS SQL Server Stored Procedure
    : CREATE PROCEDURE byroyalty
    : AS
    : select au_id from titleauthor
    : GO
    : Oracle8i Package and Stored Procedure
    : PACKAGE BYROYALTYPkg AS
    : TYPE RT1 IS RECORD (
    : au_id titleauthor.au_id%TYPE
    : TYPE RCT1 IS REF CURSOR RETURN RT1;
    : END;
    : PROCEDURE byroyalty(
    : RC1 IN OUT byroyaltyPkg.RCT1)
    : AS
    : StoO_selcnt INTEGER;
    : StoO_error INTEGER;
    : StoO_rowcnt INTEGER;
    : StoO_errmsg VARCHAR2(255);
    : StoO_sqlstatus INTEGER;
    : BEGIN
    : OPEN RC1 FOR
    : SELECT au_id FROM titleauthor;
    : END byroyalty;
    : The following example illustrates the typical ODBC code
    used
    : by Intersolv to call the above MS SQL Server
    : stored procedure. This code also works for the above
    : Oracle8i package and stored procedure. Note that error
    : handling must be added in a real application:
    : SQLPrepare(...,'{call byroyalty()}',...)
    : SQLExecute()
    : SQLBindCol()
    : SQLFetch()
    : Comments:
    : SQLPrepare(...,'{call byroyalty()}',...) is the ODBC SQL
    : syntax used to execute stored procedures.
    : SQLExecute()executes the stored procedure.
    : SQLBindCol()assigns storage for result column 1 in the
    : result set (au_id).
    : SQLFetch() fetches the first record from the result set
    : generated by the stored procedure.
    : The following examples illustrate how to call the above MS
    : SQL Server stored procedure with result
    : sets/dynasets in Visual Basic using DAO and RDO on top of
    : ODBC. This code works for Oracle8i packages
    : and stored procedures if you use an Intersolv ODBC driver
    to
    : understand Oracle REF CURSORs.
    : DAO
    : Private Sub Command2_Click()
    : Dim sSql As String
    : sSql = "{call byroyalty()}"
    : 'In Oracle ODBC driver use refcusor argument to get
    : result set
    : Set rCustomers = dbsServer.OpenRecordset(sSql,
    : dbOpenDynamic)
    : Text4 = rCustomers.Fields(0)
    : theend:
    : End Sub
    : Please note, this example assumes that a DAO connection
    has
    : been set up already.
    : RDO
    : Private Sub Command1_Click()
    : StrSql = "{call byroyalty}"
    : 'in oracle odbc driver uses refcusor argument to get
    : result set
    : Set Ps = connx1.CreatePreparedStatement("PsTest",
    : StrSql)
    : Set Rs = Ps.OpenResultSet(rdOpenStatic)
    : Text3 = Rs!au_id
    : Rs.Close
    : End Sub
    : Please note, this example assumes that an RDO connection
    has
    : been set up already.
    : Jing Zhang (guest) wrote:
    : : Hi, All,
    : : Is there anybody know how much customize we can have for
    using
    : : the MWB when migrate stored procedure? For sample I have a
    SQL
    : : Server 6.5 strored procedure like following:
    : : /******************* SQL Server 6.5 sp *************/
    : : CREATE PROCEDURE sp_SelectUsers
    : : AS
    : : select
    : : tbl_Sp_users.ID, UserName, Password, ExpiresOn,
    : : PwdChangedDate, tbl_Sp_UserGrps.name
    : : from
    : : tbl_Sp_users, tbl_Sp_UserGrps
    : : where
    : : GroupID = tbl_Sp_UserGrps.id
    : : order by username
    : : /******************* end ***************************/
    : : After I migrate it to Oracle 8 with MWB, I got following
    : object,
    : : one Pkg and one Procedure in Oracle db, like following:
    : : /****************** Oracle Pkg **********************/
    : : CREATE OR REPLACE PROCEDURE sp_SelectUsers(
    : : RC1 IN OUT sp_SelectUsersPkg.RCT1)
    : : AS
    : : StoO_selcnt INTEGER;
    : : StoO_error INTEGER;
    : : StoO_rowcnt INTEGER;
    : : StoO_errmsg VARCHAR2(255);
    : : StoO_sqlstatus INTEGER;
    : : BEGIN
    : : OPEN RC1 FOR
    : : SELECT tbl_Sp_users.ID, UserName, Password,
    : : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    : : tbl_Sp_users, tbl_Sp_UserGrps
    : : WHERE GroupID = tbl_Sp_UserGrps.id
    : : ORDER BY username ;
    : : END sp_SelectUsers;
    : : /******************* Oracle Procedure ****************/
    : : PROCEDURE sp_SelectUsers(
    : : RC1 IN OUT sp_SelectUsersPkg.RCT1)
    : : AS
    : : StoO_selcnt INTEGER;
    : : StoO_error INTEGER;
    : : StoO_rowcnt INTEGER;
    : : StoO_errmsg VARCHAR2(255);
    : : StoO_sqlstatus INTEGER;
    : : BEGIN
    : : OPEN RC1 FOR
    : : SELECT tbl_Sp_users.ID, UserName, Password,
    : : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
    : : tbl_Sp_users, tbl_Sp_UserGrps
    : : WHERE GroupID = tbl_Sp_UserGrps.id
    : : ORDER BY username ;
    : : END sp_SelectUsers;
    : : /******************* end *****************************/
    : : As our client use RDO as access method, there is no way we
    can
    : : use this migrated SP in RDO and return resultset. We need
    : : convert this SP to following to be able to use RDO to get
    : : resultset back in client:
    : : /******************* need convert to *********************/
    : : create or replace package sp_selectUsersPkg
    : : as
    : : cursor c1
    : : is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
    : : PwdChangedDate, tbl_Sp_UserGrps.name
    : : from tbl_Sp_users, tbl_Sp_UserGrps
    : : where GroupID = tbl_Sp_UserGrps.id
    : : order by username;
    : : type UsersCur
    : : is ref cursor return c1%ROWTYPE;
    : : procedure sp_selectUsers(UserCursor in out UsersCur );
    : : END;
    : : create or replace package body sp_selectUsersPkg
    : : as
    : : procedure sp_selectUsers(UserCursor in out UsersCur )
    : : is
    : : begin
    : : open UserCursor for
    : : select tbl_Sp_users.ID, UserName,
    : : password, ExpiresOn,
    : : PwdChangedDate, tbl_Sp_UserGrps.name
    : : from tbl_Sp_users, tbl_Sp_UserGrps
    : : where GroupID = tbl_Sp_UserGrps.id
    : : order by username;
    : : end;
    : : end;
    : : /******************* end *********************************/
    : : Is there any idea how we can do this? I hope we don't need do
    : : this manually.
    : : Thank you very much for any help!
    : : Jing
    Oracle Technology Network
    http://technet.oracle.com
    null

  • MS SQL Server system stored procedures can't be migrated into Oracle 11g

    During database migration from MS SQL Server 2008 to Oracle 11g R2, if the application stored procedure invokes the MS SQL Server system stored procedures (for example: sp_getapplock, sp_releaseapplock ....), these SQL server system stored procedures can't be transferred. See following migrated Oracle application stored procedure for example:
    create or replace
    PROCEDURE spPwSysID_GetNextID
    v_ID OUT NUMBER,
    iv_SysType IN NVARCHAR2 DEFAULT NULL ,
    iv_Cnt IN NUMBER DEFAULT NULL
    AS
    v_SysType NVARCHAR2(50) := iv_SysType;
    v_Cnt NUMBER(10,0) := iv_Cnt;
    v_result NUMBER(10,0);
    BEGIN
    --SQL Server BEGIN TRANSACTION;
    utils.incrementTrancount;
    v_Systype := UPPER(v_Systype) ;
    IF v_Cnt < 1 THEN
    v_Cnt := 1 ;
    END IF;
    v_result :=sp_getapplock(v_Resource => v_Systype,
    v_LockMode => 'Exclusive') ;
    IF v_result >= 0 THEN
    BEGIN
    SELECT ID
    INTO v_ID
    FROM PWSYSID
    WHERE SysType = v_SysType;
    IF SQL%ROWCOUNT = 1 THEN
    UPDATE PwSysID
    SET ID = ID + v_cnt
    WHERE SysType = v_SysType;
    ELSE
    BEGIN
    INSERT INTO PwSysID
    ( ID, SysType )
    VALUES ( v_cnt + 1, v_SysType );
    v_ID := 1 ;
    END;
    END IF;
    v_result :=sp_releaseapplock(v_Resource => v_Systype) ;
    END;
    ELSE
    BEGIN
    raise_application_error( -20002, 'Lock failed to acquire to generate Cityworks Id.' );
    END;
    END IF;
    utils.commit_transaction;
    END;

    During database migration from MS SQL Server 2008 to Oracle 11g R2, if the application stored procedure invokes the MS SQL Server system stored procedures (for example: sp_getapplock, sp_releaseapplock ....), these SQL server system stored procedures can't be transferred. See following migrated Oracle application stored procedure for example:
    create or replace
    PROCEDURE spPwSysID_GetNextID
    v_ID OUT NUMBER,
    iv_SysType IN NVARCHAR2 DEFAULT NULL ,
    iv_Cnt IN NUMBER DEFAULT NULL
    AS
    v_SysType NVARCHAR2(50) := iv_SysType;
    v_Cnt NUMBER(10,0) := iv_Cnt;
    v_result NUMBER(10,0);
    BEGIN
    --SQL Server BEGIN TRANSACTION;
    utils.incrementTrancount;
    v_Systype := UPPER(v_Systype) ;
    IF v_Cnt < 1 THEN
    v_Cnt := 1 ;
    END IF;
    v_result :=sp_getapplock(v_Resource => v_Systype,
    v_LockMode => 'Exclusive') ;
    IF v_result >= 0 THEN
    BEGIN
    SELECT ID
    INTO v_ID
    FROM PWSYSID
    WHERE SysType = v_SysType;
    IF SQL%ROWCOUNT = 1 THEN
    UPDATE PwSysID
    SET ID = ID + v_cnt
    WHERE SysType = v_SysType;
    ELSE
    BEGIN
    INSERT INTO PwSysID
    ( ID, SysType )
    VALUES ( v_cnt + 1, v_SysType );
    v_ID := 1 ;
    END;
    END IF;
    v_result :=sp_releaseapplock(v_Resource => v_Systype) ;
    END;
    ELSE
    BEGIN
    raise_application_error( -20002, 'Lock failed to acquire to generate Cityworks Id.' );
    END;
    END IF;
    utils.commit_transaction;
    END;

  • Check Stored Procedures after Migration from MS SQL Server 2008 to Oracle11

    I successfully migrated my application database (azteca) from MS SQL Server 2008 to Oracle 11g R2. After migration, I found there are few stored procedures are not valid. How do I check these invalid stored procedures and find what is wrong with them by using SQL Developer? Thanks for your help.
    Kevin

    Hi Kevin,
    You posted quite a bit today, so perhaps you have already worked this out. If not...
    1. View -> Reports -> Data Dictionary Reports -> All Objects -> Invalid Objects [for a specific schema name]
    2. Next, for each invalid stored procedure listed in (1)...
    a. Open in the code editor from the Connections navigator tree
    b. Click on the Compile icon (two gears meshed together) in code editor tool bar.
    c. Look in the Compiler log pane for errors.
    d. Correct the errorsOf course, success in addressing any errors depends on your skill level dealing with Oracle PL/SQL.
    Also, it may be helpful to read over section *3.2 Stored Procedures* in the supplementary migration guide:
    http://docs.oracle.com/cd/E35137_01/doc.32/e18462/trig_stored_proc.htm#CHDEIGBC
    Regards,
    Gary
    SQL Developer Team

  • How to migrate MySQL stored procedure to Oracle

    Hi All,
    I migrated mysql 5.1.42-enterprise-gpl-advanced DB to oracle using sqldeveloper 3.1.07 tool.
    DB objects migrated successfully except Stored Procedures.
    I verified .sql and Out files.. Capture process not captured stored procedures SQL.
    Could you please suggest, where I can verify exact error or how to fix this issue.
    Thanks in advance.

    Hi,
      The SQL*Developer version you are using is an old one and you should use the latest version available from this link -
    Oracle SQL Developer
    However, even the v4 version does not support the migration of MySQL stored procedures as shown in this link -
    http://www.oracle.com/technetwork/developer-tools/sql-developer/supportedmigplatforms-086703.html
    You will have to manually convert the MySQL stored procedures to an Oracle format, as even the 'Scratch Editor' under 'Tools - Migration' - does not have an option for MySQL conversion.
    The documentation has details of the difference between MySQL and Oracle stored procedures -
    Oracle® SQL Developer Supplementary Information for MySQL Migrations
    in the chapter Triggers and Stored Procedures
    Regards,
    Mike

  • How to exclude stored procedures from migration

    Is there a way to excloude  procedures functions and views from migration sybase to oracle

    Hi,
       In the v4 SQL*Develeoper ONLINE migration in the TRANSLATE panel you can remove the 'ALL_PROCEDURES' object.
    Alternatively, in the script generated to create the objects you could manually remove the stored procedure code.
    Regards,
    Mike

  • Migrating DESKI Reports (Stored Procedures) from 6x to XI 3.1

    I am migrating DESKI reports based off of Stored procedures from a 6x environment to XI 3.1
    I have created a new OLE DB connection pointing to the new SQL server.
    I need to find out how to point my report to the new connection.
    I have seen in that in case of DESKI reports using universes, I can go to Data Manager --> Definition tab and point to my new universe there.
    But in case of stored procedure report, that option is not available.
    Can someone let me know how to go about migrating these reports which are pointing to Stored Procedures.
    Thanks

    Note that I have never done it.
    But I heard you could create a new universe with a derived table. In the SQL of the derived table you can call the stored procedure. The connection of that new universe is your stored procedure connection.
    Build you report with that new universe, using the derived table.

  • Migrating Transact SQL Stored Procedure & Funtions  to Oracle 9i Procedures

    Is it possible to Migrate Transact SQL Stored Procedure & Funtions in MS-SQL to Oracle 9i Procedures & Funtion . I am an Bigginer in Oracle and SQL.Is their any tool available for this?

    This feature is currently available in the Oracle Migration Workbench. with the Microsoft SQL Server plugins.
    Have you tried it?
    Regards,
    Niall

  • Sybase to Oracle Stored Procedure migration Help

    Hello,
    There is a Stored Procedure in Sybase and needs to be migrated to Oracle 10g. I need some quick help in creating temporary table and store the result set temporary. Here's the script.
    Select distinct WC_POSITION_D.WID,
    WC_POSITION_D.POSITION_NAME,
              WC_POSITION_D.CURR_MTH_CAPACITY,
    WC_POSITION_D.NEXT_MTH_CAPACITY into #capcity
    from WC_POSITION_D
    ***********Below SQL extract no.of skills per position for the currentMonth Active ********************
    select WC_POSN_SKILL_F.POSN_WID,
    count(WC_POSN_SKILL_F.SKILL_WID) as curr_skills into #currskills
    from WC_POSN_SKILL_F
    where WC_POSN_SKILL_F.Flag = 'A'
    group by WC_POSN_SKILL_F.POSN_WID
    ***********Below SQL extract no.of skills per position for the NextMonth Active ********************
    select WC_POSN_SKILL_F.POSN_WID,
    count(WC_POSN_SKILL_F.SKILL_WID) as next_skills into #nextskills
    from WC_POSN_SKILL_F
    group by WC_POSN_SKILL_F.POSN_WID
    ***********Below SQL calculates CURR_MNTH_DMD,NEXT_MNTH_EXP_DMD per position ********************
    select #capacity.WID,
    ((#capacity.CURR_MTH_CAPACITY)/curr_skills) as CURR_MTH_DMD,
         ((#capacity.NEXT_MTH_CAPACITY)/next_skills) as NEXT_MTH_DMD into #demand
    from #capacity, #skills
    where #capacity.WID = #skills.POSN_WID
    ***********Below statement populate CURR_MNTH_DMD,NEXT_MNTH_EXP_DMD in WC_POSN_SKILL_F ********************
    UPDATE WC_POSN_SKILL_F
    set WC_POSN_SKILL_F.CURR_MNTH_DMD = #demand.CURR_MTH_DMD, WC_POSN_SKILL_F.NEXT_MNTH_EXP_DMD = #demand.NEXT_MTH_DMD
    from WC_POSN_SKILL_F,#demand
    where WC_POSN_SKILL_F.POSN_WID = #demand.WID
    any kind of immediate help/input appreciated.

    Be careful porting code like this directly. Reason:
    The reasons for using Temporary Tables in Sybase is invalid in Oracle.
    In Sybase one needs to minimize locks and lock contention and escalation. This is done using temporary tables. Your Sybase script is typical of this approach - which is valid in Sybase.
    However, this is not valid in Oracle. Oracle is at its core designed very differently from Sybase. A single lock in Oracle has the same overheads as a million locks - none. In Oracle, readers-of-data cannot block writers-of-data and vice versa. In Oracle there is no lock escalation - ever. This concept/problem does not exist. Period.
    Porting your Sybase code to Oracle will be an attempt at using Oracle as a Sybase. Oracle is a very poor Sybase.
    I urge you not to do a direct port. You will become very frustrated with Oracle. You will conclude that Oracle sucks. Use Oracle as it has been designed.. or IMO, bluntly put, do not use it all.

  • MSSQL stored procedures to Oracle migration

    I am working on a migration from MSSQL2K to Oracle 10g. I have used the Oracle Migration Workbench to do the initial conversion, and I am having to do a ton of by hand conversion. There are some stored procedures that the OMWB did not bring over at all, however.
    Does anybody know of a utility that can take a single MSSQL stored procedure and convert it to a Oracle PL/SQL procedure or function? I am somewhat tired of doing entire procedures by hand. It is very tedious.
    wally

    Wally, there is a process to this kind of migration. In a lot of instances the OMWB will not map some of your stored procedures and hence, at the end of the migration you will see them as missing. Go back to the Source model view and using the log window, filter so you just see the errrors. Comment out the offending statements and right click on the object to parse it again. If it is correct it will appear in the Oracle Model. Once it has appeared there it will be generated into your Oracle database. However, you may still need to verifiy that you have got equivilence by testing the procedure.

  • Stored procedures not working after migrating from 8i to 10g

    The Oracle stored procedures are generating an error following upgrading a ColdFusion web application from Oracle8i to 10g release 2.
    "Error","jrpp-102","05/28/08","13:35:09","insite","Error Executing Database Query.[Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'S_DEFAULT_LETTER_SETTING' ORA-06550: line 1, column 7: PL/SQL: Statement ignored The specific sequence of files included or processed is: new_letter.cfm, line: 63 "
    I've been looking at this for about 3 days with a colleague in the office. We can resolve this be recreating the stored procedure with a new name (e.g. adding the suffix "_v2"). Its not really practical for us to do this throughout the system. Anyone know what the root cause might be?
    I'm currently connecting to Oracle10g using SQLTools and Oracle8 client. I've yet to upgrade to Oracle10 client.
    I've tried selecting all the stored procedures and re-compiling them but it appeared to make no difference.

    The Oracle stored procedures are generating an error following upgrading a ColdFusion web application from Oracle8i to 10g release 2.
    "Error","jrpp-102","05/28/08","13:35:09","insite","Error Executing Database Query.[Macromedia][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'S_DEFAULT_LETTER_SETTING' ORA-06550: line 1, column 7: PL/SQL: Statement ignored The specific sequence of files included or processed is: new_letter.cfm, line: 63 "
    I've been looking at this for about 3 days with a colleague in the office. We can resolve this be recreating the stored procedure with a new name (e.g. adding the suffix "_v2"). Its not really practical for us to do this throughout the system. Anyone know what the root cause might be?
    I'm currently connecting to Oracle10g using SQLTools and Oracle8 client. I've yet to upgrade to Oracle10 client.
    I've tried selecting all the stored procedures and re-compiling them but it appeared to make no difference.

  • Migrating from TSQL Need Help? printing multiple columns in Stored procedur

    I need to create a Stored Procedure which returns set of columns not all
    (for eg FirstName, LastName, Dept_Id) from emloyee table based on certain conditions.
    In TSQL, it is very simple to create such stored procedures which return full recordset(or subset).
    I tried creating explicit cursors but I can print only one record at a time. I dnt want concatenation of columns. I want seperate columns in ouput. How to achieve this.?
    Code : (But i can only concatenate and print results, what i want is diffrent columns)
    declare
    f_name employees.first_name%type;
    l_name employees.last_name%type;
    cursor c is
    select first_name,last_name
    from employees;
    begin
    open c;
    loop
    fetch c into f_name,l_name;
    exit when c%notfound;
    DBMS_OUTPUT.PUT_LINE (f_name||' '||l_name);
    end loop;
    close c;
    end;

    Another very informative article on ref cursors:
    PL/SQL 101 : Understanding Ref Cursors

Maybe you are looking for