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.
Similar Messages
-
How to call MSSQL stored procedure from oracle database
MSSQL and Oracle databases are linked thru ODBC link using Oracle HSODBC.
I can query MSSQL table or view from Oracle Database using standard notation for acessing remote objects schema.object@dblink_name...
Can anybody give me syntax for calling MSSQL stored procedure thru ODBC database link?
I tried syntax exec schema.stored_procedure@dblink_name but it doesn't work...i'm getting schema.stored_procedure must be declared error...
Tnx,in advance!
Dejan BoticaOracle database 10gR2.
MSSQL2000 database.
For example query:
select * from dbo.Tbl_Test@kron@dw_jamnica; works fine...
...while for example exec dbo.Test@kron@dw_jamnica;
reports error:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBO.TEST@KRON@DW_JAMNICA' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Table Tbl_Test and procedure Test exists in MSSQL instance.
Regards,
Dejan -
Please help convert MSSQL Stored Procedure to Oracle PL/SQL
Hi there to all,
this be my first post to these forums. I have already posted this question on a microsoft msdn forum, until someone advised that I ask my question here - dunno why I didnt think of that! ?:|
Im working with an Oracle 10g Database from an ASP.NET 2.0 application, and want to know if it Oracle supports OPENXML (rhetorical question I fear!). The reason I ask is because I want to create an Oracle Stored Procedure that will accept an XML string as an input parameter, prepare it, select from it, and then insert it into an Oracle table.
I have done this successfully in SQL server using the following as an example:
CREATE PROCEDURE [dbo].[Employee_INSERT]
bq. @INSERTRECORD XML
AS
BEGIN
bq. DECLARE @XDOC INT; \\ EXEC sp_xml_preparedocument @XDOC OUTPUT, @INSERTRECORD; \\ INSERT INTO [dbo].[REC_Employees] (
bq. bq. [EMPTITLE], \\ [EMPFNAME], \\ [EMPLNAME], \\ [EMPDEPTID], \\ [EMPBEGINDATE], \\ [EMPACTIVE], \\ [EMPDATEADDED]
bq. )
bq. SELECT
bq. bq. [EMPTITLE] = Title, \\ [EMPFNAME] = Firstname, \\ [EMPLNAME] = LastName, \\ [EMPDEPTID] = DepartmentID, \\ [EMPBEGINDATE] = StartDate, \\ [EMPACTIVE] = IsActive, \\ [EMPDATEADDED] = GETUTCDATE()
bq. FROM
bq. bq. OPENXML(@XDOC, '/EMPREC/Table', 2) \\ WITH (
bq. bq. Title VARCHAR(10), \\ FirstName VARCHAR(50), \\ LastName VARCHAR(50), \\ DepartmentID INT, \\ StartDate DATETIME, \\ IsActive BIT
bq. bq. );
bq. EXEC sp_xml_removedocument @XDOC;
END
I would sincerely appreciate any help in this regard!
PS - Please excuse the formatting!
Much Thanks!
regards
shalanAssuming your table is named DESTINATION
Name Null? Type
TITLE VARCHAR2(10)
FIRSTNAME VARCHAR2(50)
LASTNAME VARCHAR2(50)
DEPARTMENT NUMBER
STARTDATE DATE
ISACTIVE NUMBERYou can use a procedure like:
create or replace
procedure test (p_xml in xmltype)
is
begin
insert into destination
select title
, firstname
, lastname
, department
, to_date (startdate, 'yyyy-dd-mm hh24:mi:ss') startdate
, isactive
from (xmltable ('/EMPREC/Table' passing p_xml
columns title varchar2(5) path 'Title'
, firstname varchar2(10) path 'FirstName'
, lastname varchar2(10) path 'LastName'
, department number path 'Department'
, startdate varchar2(20) path 'StartDate'
, isactive number path 'IsActive'
) temp
end test;to create records in the table
Removed a unnecessary SELECT FROM DUAL...
Edited by: Alex Nuijten on Jan 19, 2009 2:24 PM -
Need sample source code for calling stored procedure in Oracle
Hi.
I try to call stored procedure in oracle using JCA JDBC.
Anybody have sample source code for that ?
Regards, Arnold.Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
I have the Procedure defined as below in the SFCS1 package body
Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
BEGIN
Open O_Cursor FOR
SELECT CompanyId, CompanyName
FROM Company
WHERE CompanyProvince IN ('AL','AK');
END Company_Selection;
In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
DECLARE
A SFCS1.T_Cursor;
BEGIN
SFCS1.Company_Selection(A);
go_Block ('Block36');
The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause. -
How to use a stored procedure in oracle reports
How to use a stored procedure in oracle reports
Dear,
In report triggers you can write your procedure/functions or call it like
function AfterPForm return boolean is
begin
myprocedure(:mydate);
return (TRUE);
end;
Thanks
Jamil -
SQLException while calling a Stored Procedure in Oracle
Hi all,
I am getting this error while calling a Stored Procedure in Oracle...
java.sql.SQLException: ORA-00600: internal error code, arguments: [12259], [], [
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:207)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:540)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1273)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:780)
at oracle.jdbc.driver.OracleResultSet.next(OracleResultSet.java:135)
at StoredProcedureDemo.main(StoredProcedureDemo.java:36)
The Program is ...
import java.sql.*;
public class StoredProcedureDemo {
public static void main(String[] args) throws Exception {
Connection con = null;
ResultSet rs = null;
Statement st = null;
CallableStatement cs = null;
int i;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:SHYAM","scott","tiger");
System.out.println("Got Connection ");
st = con.createStatement();
String createProcedure = "create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS"
+" Emp_name VARCHAR2(10);"
+" CURSOR c1 (Depno NUMBER) IS"
+" SELECT Ename FROM emp WHERE deptno = Depno;"
+" BEGIN"
+" OPEN c1(Dept_num);"
+" LOOP"
+" FETCH c1 INTO Emp_name;"
+" EXIT WHEN C1%NOTFOUND;"
+" END LOOP;"
+" CLOSE c1;"
+" END;";
System.out.println("Stored Procedure is \n"+createProcedure);
i = st.executeUpdate(createProcedure);
System.out.println("After creating the Stored Procedure "+i);
cs = con.prepareCall("{call Get_emp_names(?)}");
System.out.println("After calling the Stored Procedure ");
cs.setInt(1,20);
System.out.println("Before executing the Stored Procedure ");
rs = cs.executeQuery();
System.out.println("The Enames of the given Dept are ....");
while(rs.next()) {
System.out.println("In The while loop ");
System.out.println(rs.getString(1));
catch (Exception e) {
e.printStackTrace();
Stored Procedure is ...
create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS
Emp_name VARCHAR2(10);
CURSOR c1 (Depno NUMBER) IS
SELECT Ename FROM emp WHERE deptno = Depno;
BEGIN
OPEN c1(Dept_num);
LOOP
FETCH c1 INTO Emp_name;
EXIT WHEN C1%NOTFOUND;
END LOOP;
CLOSE c1;
END;
Stored procedure is working properly on sql*plus(Oracle 8.1.5)) editor. But it is not working from a standalone java application. Can anyone please give me a solution.
thanks and regards
Shyam KrishnaThe first solution is to not do that in java in the first place.
DDL should be in script files which are applied to oracle outside of java.
Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation. -
Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)
Hi All,
We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
Database is Oracle.
*Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
If both are equal, then
if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
else if the field: 'qq' in YY table equals to "Modify" then take the data from the view table: 'Modify_View'.
Finally, We need to archive the selected data from the respective view table.*
From each table, data will come differently, means with different field names.
I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
Is there any way other than Stored Procedure?
How to handle Data Types as data is coming from two different tables?
Can we create one data type for two tables?
Is BPM required for this to collect data from two different tables?
Can somebody guide me on how to handle this?
Waiting eagerly for help which will be rewarded.
Thanks and Regards,
Jyothirmayi.Hi Gopal,
Thank you for your reply.
>Is there any way other than Stored Procedure?
Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
I need to select the data from different tables based on some conditions. Let me simplify that.
Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
How can we meet this by configuring sender adapter with ATP?
================================================================================================
>How to handle Data Types as data is coming from two different tables?
If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
we need to take data only from one table at a time. It is not join of two tables.
================================================================================================
Thanks,
Jyothirmayi. -
Calling stored procedure in Oracle forms
I have a stored procedure in Oracle which is declared as follows in the package
SFCS1.Company_Selection(O_Cursor IN OUT T_Cursor, cls IN Varchar2);
Where T_Cursor is defined as a Ref Cursor
From the Oracle forms I'm using the following code
SFCS1.Company_Selection(A,my_cls);
go_block('Block50');
Execute_Query;
I get the error message "FRM40505:Oracle Error: Unable to Perform Query". If I hardcode the value of my_cls in the query it runs properly. Any solutions will be really helpful
Further to this, I want to put the single quotes around a value (for eg. 'A') from a variable. For instance I'm getting a value from my_cls and for the output I want to surround it with the single quotes, can somebody tell me how to do it.
Thanks in advanceThis is a bit of a roundabout way to do it? Try setting up the block data source as procedure and set the values in the property palette of the data block.
e.g.
Query Data Source Type = Procedure
Query Data Source Name = SFCS1.Company_Selection
Query Data Source Columns = (Whatever columns/items you have in your datablock)
Query Data Source Arguments = Argument names are your ref cursor and your variable.
Check out basing data blocks on Ref Cursors.
HTHs
L :-) -
How to verify stored procedures in Oracle 10g.
I would like to locate default stored procedure in Oracle 10g database.
And Suggest which stored procedure can be converted in to JAVA code ??If the Java part of the question refers to looking for potential to speed up your stored procedures:
You should consider native compilation which transfers your code to shared libraries which are bound to the DB kernel.
In this case however consider, that this does not make any sense/improvement for pure data access statements but only for procedures consisting of complex algorithmic processing.
For details refer to
[How native compilation works|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2280]
and
[Setting Up and Testing PL/SQL Native Compilation|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2309] -
How to write a PL/SQL stored procedure in Oracle to call Webservice
Can any one pelase send me a code on how to write a PL/SQL stored procedure in Oracle database to call the Webservice ?
Thanks,
RajeshWere you able to solve this problem
-
How to Create a Stored Procedure in Oracle
I try to create a very simple Stored Procedure from Oracle SQL Developer, got the following error. Can someone give me some help on this? I am new on this. Thanks.
Error(4,1): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := ( ; not null range default character The symbol ";" was substituted for "BEGIN" to continue.
create or replace PROCEDURE Test
AS ACCESSTYP_ID ACCESSTYP.ACCESSTYPCD%TYPE
BEGIN
SELECT ACCESSTYPCD
INTO ACCESSTYP_ID
FROM ACCESSTYP
WHERE ACCESSTYPCD = 'WWW';
END;I found out I forgot to put ";" after the declare.
How do I test it call this stored procedure from
Oracle SQL Developer.
create or replace PROCEDURE Test_VL
AS ACCESSTYP_ID
ACCESSTYP.ACCESSTYPCD%TYPE;
SELECT ACCESSTYPCD
INTO ACCESSTYP_ID
FROM ACCESSTYP
WHERE ACCESSTYPCD = 'WWW';
END;in your SQL Developer window just enclosed your procedure with a Begin ... End.
Begin
Test_VL;
End; -
Dear Friends,
I have a lot of c-stored procedures for DB2,
now,I want to use these c-stored procedures in Oracle directly without any changes.
I'm not sure whether this method is right.
Please help me.
GuangI think, that the best way inclusion of business logic into ORACLE database as a TABLE-constraints, triggers and stored procedures for guaranteeing data integrity.
But if you have really a LOT of c-stored procedures and you need provide quick startup with ORACLE, than you can use your c-procedures as "external calls" with ORACLE.
Unfortunately I don't know DB2 c-stored procedures specifics and can't give finally recommendations for you.
Sincerely, Urry -
Stored procedure in Oracle 8.1.7.0
HI,
my oracle version is 8.1.7.0
I've created this stored procedure:
CREATE OR REPLACE procedure CREATE_TAB1
IS
SVUOTA VARCHAR2(64);
PRAGMA AUTONOMOUS_TRANSACTION;
err_num number;
err_msg varchar2(100);
BEGIN
SVUOTA := 'TRUNCATE TABLE TAB1 REUSE STORAGE';
EXECUTE IMMEDIATE SVUOTA;
INSERT INTO TAB1
SELECT "COD_IMM","PIANO","COD_RITMI","TOTAL_AREA","MAX_AREA"
FROM (SELECT a.*,
MAX(total_area) OVER (PARTITION BY cod_imm, piano) max_area
FROM REP_02_TEST1 a
where a.COD_RITMI not in ('04'))
WHERE max_area = total_area;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
err_msg:= SUBSTR(SQLERRM, 1, 100);
err_num:= SQLCODE;
INSERT INTO tab_error (proc_name, err_code, err_msg, err_date)
VALUES ('CREATE_TAB1', err_num, err_msg, sysdate);
COMMIT;
END CREATE_TAB1;
but when I compile I get this error
PROCEDURE AFM.CREATE_TAB1
On line: 14
PLS-00103: Encountered the symbol "(" when expecting one of the following:
, from
the procedure stop on line:
MAX(total_area) OVER (PARTITION BY cod_imm, piano) max_area
I think that oracle version 8.1.7.0 not allow the code "OVER (PARTITION BY"
I tried also with:
EXECUTE IMMEDIATE 'INSERT INTO TAB1
SELECT "COD_IMM","PIANO","COD_RITMI","TOTAL_AREA","MAX_AREA"
FROM (SELECT a.*,
MAX(total_area) OVER (PARTITION BY cod_imm, piano) max_area
FROM REP_02_TEST1 a
where a.COD_RITMI not in ('04'))
WHERE max_area = total_area';
but I get:
PROCEDURE AFM.CREATE_TAB1
On line: 16
PLS-00103: Encountered the symbol "04" when expecting one of the following:
How can I create my stored procedure with Oracle version 8.1.7.0
Thank in advance!What is this code suppose to accomplish?
Is this type of processing not possible using Global Temporary Tables?
Oracle8i PL/SQL did not parse analytic functions correctly so you would have to make that SELECT a view and then SELECT from that view in PL/SQL.
I tried also with:When you wrap the SELECT in EXECUTE IMMEDIATE you have to properly use the single quotes. The single quote that appears at this line:
where a.COD_RITMI not in ('04'))is assumed by the compiler as the end of the string started by EXECUTE IMMEDIATE. That is not what you want.
Please post some more details about the type of procesing that this code is suppose to accomplish so we can suggest alternatives to get it done better. -
Stored procedure in oracle plsql giving Error
Hi all,
I want to create stored procedure in oracle.
In that,I want to update if record is present in the table else want to insert that record in that table.
Here is my stored proc which I write.
I have very little knowledge about oracle(to be honest no knowledge).
Below is my code and the purpose of this code is to insert/update the data based on the entry what ever the user makes in cognos report studio report view.
Collapse | Copy Code
create or replace
PROCEDURE INSERTCOMMENTS
N_HATID NUMBER
, N_IN_NUMBER NUMBER
, N_POINTS VARCHAR2 DEFAULT 255
, N_QETYPE VARCHAR2 DEFAULT 255
) AS
BEGIN
IF((SELECT COUNT(*) FROM CCM_REPORT_USER.POINTS_QETYPE_COMMENTS
WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.HATID = N_HATID)=0)
THEN (INSERT INTO "CCM_REPORT_USER"."POINTS_QETYPE_COMMENTS" (HATID, IN_NUMBER, POINTS, QETYPE)
VALUES (N_HATID , N_IN_NUMBER , N_POINTS , N_QETYPE,));
ELSE
(UPDATE "CCM_REPORT_USER"."POINTS_QETYPE_COMMENTS" SET CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.POINTS = N_POINTS
AND CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.QETYPE = N_QETYPE
WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.HATID = N_HATID)
AND WHERE CCM_REPORT_USER.POINTS_QETYPE_COMMENTS.IN_NUMBER = N_IN_NUMBER)
END IF;
END INSERTCOMMENTS;948677 wrote:
I want to create stored procedure in oracle.
I have very little knowledge about oracle(to be honest no knowledge).If you are new to Oracle you should first be familiar with the manuals before writing code
http://tahiti.oracle.com/
For the latest version
http://www.oracle.com/pls/db112/homepage
And then start with *2 Day Developer's Guide*
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10766/toc.htm
SQL Language Reference
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm
Concepts
http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/toc.htm
PL/SQL Language Reference
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/toc.htm
And the Error Messages references for looking up the errors you will encounter when starting out
http://download.oracle.com/docs/cd/E11882_01/server.112/e17766/toc.htm
>
In that,I want to update if record is present in the table else want to insert that record in that table.
Here is my stored proc which I write.Once you know where the manuals are you would see that you would not write a stored procedure, you would use the MERGE command to do this
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9016.htm#i2081218
Which you can of course put in a stored procedure if you like. -
Hi, I create a stored procedure in Oracle 10g and I want to run this same procedure in Oracle 8. Anybody knows the syntax for this procedure in Oracle 8?
Here are the stored procedure:
create or replace PROCEDURE Sp06_Rel_Acoes_Usuario (dt_inicio IN VARCHAR2, dt_fim IN VARCHAR2, filtro IN VARCHAR2, v_cursor OUT sys_refcursor)
IS
BEGIN
OPEN v_cursor FOR
SELECT A.AD013_DTOCORRENCIA, A.AS013_APLICATIVO, A.AS002_CDUSUARIO, A.AS013_DADOADICIONAL, AC.AS012_DSACAO
FROM T013_ACAOUSUARIO A, T012_ACAO AC
WHERE A.AD013_DTOCORRENCIA BETWEEN TO_DATE(dt_inicio,'dd/mm/yyyy HH24:MI:SS') AND TO_DATE(dt_fim,'dd/mm/yyyy HH24:MI:SS')
AND A.AS002_CDUSUARIO = filtro AND A.AN012_CDACAO = AC.AN012_CDACAO
ORDER BY A.AD013_DTOCORRENCIA;
END;I'm pasting your code in proper format - so that everyone can understand what you have posted here.
create or replace PROCEDURE Sp06_Rel_Acoes_Usuario (dt_inicio IN VARCHAR2,
dt_fim IN VARCHAR2,
filtro IN VARCHAR2,
v_cursor OUT sys_refcursor)
IS
BEGIN
OPEN v_cursor FOR
SELECT A.AD013_DTOCORRENCIA,
A.AS013_APLICATIVO,
A.AS002_CDUSUARIO,
A.AS013_DADOADICIONAL,
AC.AS012_DSACAO
FROM T013_ACAOUSUARIO A, T012_ACAO AC
WHERE A.AD013_DTOCORRENCIA BETWEEN TO_DATE(dt_inicio,'dd/mm/yyyy HH24:MI:SS')
AND TO_DATE(dt_fim,'dd/mm/yyyy HH24:MI:SS')
AND A.AS002_CDUSUARIO = filtro
AND A.AN012_CDACAO = AC.AN012_CDACAO
ORDER BY A.AD013_DTOCORRENCIA;
END;Try to post script in proper format. It will be easier for everyone to go through your problem and debug it.
Regards.
Satyaki De.
Maybe you are looking for
-
Exception in BEX Query Designer 7.10 when restricting dataprovider in filte
Hello, when I build a query in the Query Designer 7.10 and try to restrict the infoprovider in the filter to access a mulitprovider I get the exception: "Unhandled exception has occurred in your application..... Index was out of range........" Our Sy
-
Audiobooks going into "Other" folder when syncing on 5th gen video ipod
Suddenly a bunch of audiobooks I bought recently are not syncing properly. They seem to be going into the "other" category because when I look at my iPod memory summary, the colored bar chart, I see that category (in orange) growing but Audio (blue)
-
How i can make a backup without separate hdd?
How i can make a backup without seperate hdd?
-
Interactive Document (PDF) where the video works on iPad
Has anyone been able to use video in an InDesign interactive document (CS5.5) that works on the iPad? I tried using the mp4 format but it still doesn't play on the iPad (it doesn't even show up in the document). I'd love to be able to create a docume
-
Is it ok if I use ipod usb adapter model a1102 charger for my iphone 4?
Is it ok if I use ipod usb adapter model a1102 charger for my iphone 4?