Calling MSSQL SERVER STORED PROCEDURE FROM ORACLE STORED PROCEDURE

Hi Guys,
I want to call a stored procedure from mssql server 2005 as part of a stored procedure in PL/SQL. How do I go about this? I've already set up the linked servers.

http://en.allexperts.com/q/Oracle-1451/2008/6/Calling-SQL-Stored-procedure-1.htm
Does this help?

Similar Messages

  • Need Example on calling a unix shell script from oracle stored procedure

    Hi
    Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
    Have a nice time.
    Thanks & Regards
    Jogesh

    If you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL

  • 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 Botica

    Oracle 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

  • How to call a sql server stored procedure from oracle

    Hi all,
    Please anybody tell me how to call a sql server stored procedure from oracle.
    I've made an hsodbc connection and i can do insert, update, fetch data in sql server from oracle. But calling SP gives error. when I tried an SP at oracle that has line like
    "dbo"."CreateReceipt"@hsa
    where CreateReceipt is the SP of sql server and hsa is the DSN, it gives the error that "dbo"."CreateReceipt" should be declared.
    my database version is 10g
    Please help me how can i call it... I need to pass some parameters too to the SP
    thanking you

    hi,
    thank you for the response.
    when i call the sp using DBMS_HS_PASSTHROUGH, without parameters it works successfully, but with parameters it gives the following error
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver]Invalid parameter number[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (SQL State: S1093; SQL Code: 0)
    my code is,
    declare
    c INTEGER;
    nr INTEGER;
    begin
    c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@hsa;
    DBMS_HS_PASSTHROUGH.PARSE@hsa(c, 'Create_Receipt(?,?)');
    DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,1,'abc');
    DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,2,'xyz');
    nr:=DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@hsa(c);
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@hsa(c);
    end;
    Create_Receipt is the sp which requires two parameters.
    please give me a solution
    thanking you
    sreejith

  • Calling Java programs from Oracle Stored Procedure

    Is it possible to call Java programs from Oracle stored procs? If possible Can this be used to exchange data from other applications? Is there a better method/feature in oracle for doing data exchange with other apps?

    If what you mean by Oracle stored procedures is pl/sql then yes.
    You can create a "wrapper" this way:
    CREATE OR REPLACE FUNCTION xmlXform
    in_mapUrl IN VARCHAR2,
    in_inputUrl IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA NAME
    'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
    RETURN java.lang.String';
    Then load the java as:
    loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
    The java, given the correct permissions, can do anything java can do including communicate with outside applications.
    Is this the "best" way... depends on what you are trying to accomplish.

  • Calling OLE API from Oracle Stored Procedure

    An application that I need to intergate with exposes only the OLE API. How can I invoke these OLE APIs from Oracle stored procedure? Do I need any special/ additional Oracle components? Can you please help. Any links to examples would be very helpful. Thanks.

    If what you mean by Oracle stored procedures is pl/sql then yes.
    You can create a "wrapper" this way:
    CREATE OR REPLACE FUNCTION xmlXform
    in_mapUrl IN VARCHAR2,
    in_inputUrl IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA NAME
    'com.yourcompany.xml2any.xform(java.lang.String,java.lang.String)
    RETURN java.lang.String';
    Then load the java as:
    loadjava -user youruser/youruserpasswd -resolve -verbose lib/xmlparserv2.jar classes/com/yourcompany/xform.class classes/com/yourcompany/xml2any.class
    The java, given the correct permissions, can do anything java can do including communicate with outside applications.
    Is this the "best" way... depends on what you are trying to accomplish.

  • Converting MS Sql server stored proc to Oracle stored procedure

    I need to convert this MS SQL Server 200 stored procedure to Oracle stored procedure. Any help great appreciated.
    Thank you,
    set nocount on
    declare @sp varchar(100)
    set @sp = '<< stored procedure name goes here >>'
    declare @oid int
    select @oid = o.id from sysobjects o where o.name = @sp
    declare @last int
    -- function signature
    select @last = max(c.colid)
    from dbo.syscolumns c
    where c.id = @oid
    select case c.colid
    when 1 then '[ SqlCommandMethod(CommandType.StoredProcedure) ]'
    + char(13) +
    'public static SqlCommand ' + @sp + '(' + char(13) +
    ' [ NonCommandParameter ] SqlConnection
    ' connection '
    + char(13) +
    else ''
    end
    + ' ' +
    case t.name
    when 'char' then
    '[ SqlParameter(' + convert(nvarchar(10), c.length) + ')  '
    when 'varchar' then
    '[ SqlParameter(' + convert(nvarchar(10), c.length) + ') ] '
    when 'nchar' then
    '[ SqlParameter(' + convert(nvarchar(10), c.length / 2) + ') ] '
    when 'nvarchar' then
    '[ SqlParameter(' + convert(nvarchar(10), c.length / 2) + ') ] '
    else ''
    end
    +
    case t.name
    when 'char' then 'string'
    when 'nchar' then 'string'
    when 'varchar' then 'string'
    when 'nvarchar' then 'string'
    when 'bit' then 'bool'
    when 'datetime' then 'DateTime'
    when 'float' then 'double'
    when 'real' then 'float'
    when 'int' then 'int'
    else 'object /* ' + t.name + ' */'
    end
    + ' ' + lower(substring(c.name, 2, 1)) + substring(c.name, 3, 100)
    +
    case c.colid
    when @last then ')' + char(13) + '{'
    else ','
    end
    from dbo.syscolumns c
    left outer join dbo.systypes t on c.xusertype = t.xusertype
    where c.id = @oid
    order by c.colid
    -- call to generator
    select case c.colid
    when 1 then
    ' return SqlCommandGenerator.GenerateCommand(connection,' +
    char(13)
    else ''
    end
    + ' ' + lower(substring(c.name, 2, 1)) + substring(c.name,
    3, 100)
    +
    case c.colid
    when @last then ');' + char(13) + '}'
    else ','
    end
    from dbo.syscolumns c
    where c.id = @oid
    order by c.colid

    It would have helped if you had posted your code.
    To create tables in procedures, you can use EXECUTE IMMEDIATE. For example, if within a procedure, you want to:
    CREATE TABLE table_name
    (column1 NUMBER,
    column2 VARCHAR2 (30),
    column3 DATE);
    Then, from within a procedure you can:
    CREATE OR REPLACE PROCEDURE procedure_name
    AS
    BEGIN
    EXECUTE IMMEDIATE 'CREATE TABLE table_name
    (column1 NUMBER,
    column2 VARCHAR2 (30),
    column3 DATE)';
    END procedure_name;
    EXEC procedure_name
    For the procedure to count the number of business days between two input dates, see the following link:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:91212348059

  • Calling DB2 Stored Proc from Oracle DB

    Hi,
    I am having two different database running (One is oracle on solaris while the other one is db2 on os/390 mainframe) i want to pass the data realtime. Is there any way I can call a DB2 stored procedure from oracle directly. If anyboy can help in this will be really helpful.
    thanks,
    Kishor

    odi version we have is  ODI_11.1.1.6.0, it is not migrated and 'Always Execute' option is checked already.
    tried using variables in capital format but did not worked,
    begin
    schema_name.proc_name(#LV_TABLE_NAME,#LV_SCHEMA_NAME,#LV_START_DATE,#LV_END_DATE);
    end;
    odi is giving error if it finds any bug in stored proc but after fixing its completing successfully without errors in operator but i am not able to see the result.
    Please advise.

  • How to connect to UNIX OS from oracle stored procedure

    Hi,
    I need to connect to UNIX OS from oracle stored procedure.
    Curently working in Oracle9i.
    I tried in google but I could'nt get any.
    Can you send me pointers on how to do this.
    Thanks,
    Kavitha.

    Can use Java Stored Proc, or an External Proc.
    Java method:
    create or replace and compile Java Source named "OSCommand" as
    -- java:        OS COMMAND
    -- descr:       Executes an Operating System Command using the JAVA RTS
    -- IN parameter:        os command to execute (including fully qualified path names)
    -- OUT parameter:       returncode [\nstring]
    --                      where string a max of 32000 chars of the output of the command
    --                      (note that \n is used as separators in the string)
    --                      returncode=-1   Java RTS error occurred (e.g. command does not exist)
    --                      returncode=255  o/s command failed (e.g. invalid command params)
    import java.io.*;
    import java.lang.*;
    public class OSCommand{
            public static String Run(String Command){
                    Runtime rt = Runtime.getRuntime();
                    int     rc = -1;
                    try{
                            Process p = rt.exec( Command );
                            int bufSize = 32000;
                            int len = 0;
                            byte buffer[] = new byte[bufSize];
                            String s = null;
                            BufferedInputStream bis = new BufferedInputStream( p.getInputStream(), bufSize );
                            len = bis.read( buffer, 0, bufSize );
                            rc = p.waitFor();
                            if ( len != -1 ){
                                    s = new String( buffer, 0, len );
                                    return( s );
                            return( rc+"" );
                    catch (Exception e){
                            e.printStackTrace();
                            return(  "-1\ncommand[" + Command + "]\n" + e.getMessage() );
    show errors
    create or replace function osexec( cCommand IN string ) return varchar2 is
    -- function:    OS EXEC
    -- descr:       Executes an Operating System Command
    language        JAVA
    name            'OSCommand.Run(java.lang.String) return java.lang.String';
    show errors===
    This can then be used from PL/SQL and even SQL. e.g.
    SQL> select osexec( '/bin/date' ) from dual;
    OSEXEC('/BIN/DATE')
    Wed Nov  9 13:30:13 SAST 2005
    SQL>Note the Java permissions required - replace FOO with the name of applicable Oracle schema
    ==begin
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.io.FilePermission',
                    '<<ALL FILES>>',
                    'execute'
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'writeFileDescriptor',
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'readFileDescriptor',
            commit;
    end;
    /==
    Last thing... note that opens a potential giant size security hole into the Oracle Server Platform. So implement it properly using a proper Oracle security model.

  • Email from oracle stored procedure

    Can any one provide sample code for sending email from oracle stored procedure please.

    What do you mean "clicked on my link" and "login
    page"? It sounds like you're describing a web based
    interface, which would imply that you were using the
    HTTP protocol, not SMTP, and connecting on port 80
    (or 443 if you're using HTTPS). If you want to send
    an email from Oracle, you're going to need access to
    an SMTP server, not a HTTP server.
    JustinSorry. I was trying different things to test it. I put that link in an email just to test if it was valid. I am using the util_smtp package. Have you gotten this to work?

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • How to create java stored procedure from oracle(Dastageer)

    how to create java stored procedure from oracle-please help me to create the procedure.

    Hi,
    This forum is exclusively for discussions related to Sun Java Studio Creator. Please post your question in the appropriate forum.
    Thanks,
    RK.

  • Arabic characters from Oracle Stored Procedure

    Hi,
    I am having a problem displaying arabic fields from Oracle Stored Procedure. When viewing the arabic field on the web page, i get the following:
    ÙƒØكد Øاكد غبد افلبٍ افاربش
    I have checked with our Oracle DBAs and we seem to be using the AR8ISO8859P6 (ISO-8859-6). I tried to set the return string encoding to UTF-16 and ISO-8859-6 but still no use.
    What should be done to display it?

    Bashar Abdullah wrote:
    Hi,
    I am having a problem displaying arabic fields from Oracle Stored Procedure. When viewing the arabic field on the web page, i get the following:
    I have checked with our Oracle DBAs and we seem to be using the AR8ISO8859P6 (ISO-8859-6). I tried to set the return string encoding to UTF-16 and ISO-8859-6 but still no use.
    What should be done to display it?The first place I'd ask is the Oracle JDBC forum:
    http://forums.oracle.com/forums/forum.jspa?forumID=99
    Joe

  • Exec stored procedure from another stored procedure - not working

    Hey, we've got a bunch of .sql files that we run, and some of them are stored procedures. Our programs call the stored procedures from within the .sql files and that works, but we've tried calling a stored procedure from another stored procedure and it won't compile. The syntax looks the same, and we can run that second stored procedure from the SQL*Plus command prompt just fine, so we know it's in there. It doesn't matter whether we type exec or execute in the first stored procedure--it still gives us a compilation error. Here's the relevant bit of the code:
            delete CMHISTORYINDEX;
            commit;
            exec SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;
    /Here's where we go into SQL*Plus and try to compile it:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    SQL> @sp_daily_closing.sql
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE SP_DAILY_CLOSING:
    LINE/COL ERROR
    34/7     PLS-00103: Encountered the symbol "SP_DAILY_TOTAL" when expecting
             one of the following:
             := . ( @ % ;
             The symbol ":=" was substituted for "SP_DAILY_TOTAL" to continue.
    SQL>We've also tried changing SP_DAILY_CLOSING to lowercase, but it doesn't seem to help. As I mentioned before, we can type that same sort of thing in .sql files that are not stored procedures and the exec is compiled fine and runs correctly. What are we doing wrong?

    In the stored procedure remove "exec" :
            delete CMHISTORYINDEX;
            commit;
            SP_DAILY_TOTAL;
    END SP_DAILY_CLOSING;

  • Calling Web Service passing xml from Oracle Forms

    Hello,
    I need to call a .net web service from Oracle Forms that passes in xml data and returns xml data.
    I have seen several examples of how to create a wrapper in jdev and then to import the code
    into forms. I just have not seen any examples that are passing parmameters especially not xml
    as a parameter and that have an active wsdl that I can see how it relates to the code created.
    I have a wrapper but cannot figure out where and what notation to use to include passing in
    an xml object.
    Does anyone have an example passing in xml where the wsdl is still available to see?'
    Forms version 10.1.2.0.2. Jdev 10.1.3.4
    Thanks,
    Linda
    Edited by: lboyce on Jan 5, 2009 2:30 PM

    Also here you have several options...
    1. you can make a PJC (bean) which include a webservice stub generated with axis (you can make a stub and also test a webservice with this tool: www.soapui.org)..
    2. you can make a database webservice with JPublisher and then just call a pl/sql wrapper for this webservice
    4. you can call a webservice with java api (HttpsURLConnection, HttpURLConnection or with apache HTTPClient api) from your PJC for example:
    the code below is used as java stored procedure to call a .net webservice on https
    ====================================
    public static int getPStopnja(String polica, String reg_oznaka,
    String ime_osiguranika,
    String naziv_osiguranika,
    String leasing,
    String[] doc) {
    String l_polica="";
    String l_reg_oznaka="";
    String l_ime_osiguranika="";
    String l_naziv_osiguranika="";
    String l_leasing ="";
    URL url = null;
    HttpsURLConnection conn = null;
    BufferedReader br = null;
    String lineIn = null;
    StringBuffer sb = new StringBuffer();
    OutputStream os = null;
    int rc = 0;
    //kontrole
    l_polica = polica==null ? "":polica;
    l_reg_oznaka = reg_oznaka==null ? "": reg_oznaka;
    l_ime_osiguranika = ime_osiguranika==null ? "": ime_osiguranika;
    l_naziv_osiguranika = naziv_osiguranika==null ? "": naziv_osiguranika;
    l_leasing = leasing==null ? "": leasing;
    String body = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;";
    body += "&lt;soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"https://services.huo.hr/web_ao/\"&gt;";
    body += "&lt;soapenv:Header/&gt;";
    body += "&lt;soapenv:Body&gt;";
    body += "&lt;web:get_pstupanj&gt;";
    body += "&lt;web:param_in&gt;";
    body += "&lt;web:polica&gt;"+l_polica+"&lt;/web:polica&gt;";
    body += "&lt;web:reg_oznaka&gt;"+l_reg_oznaka+"&lt;/web:reg_oznaka&gt;";
    body += "&lt;web:ime_osiguranika&gt;"+l_ime_osiguranika+"&lt;/web:ime_osiguranika&gt;";
    body += "&lt;web:naziv_osiguranika&gt;"+l_naziv_osiguranika+"&lt;/web:naziv_osiguranika&gt;";
    body += "&lt;web:leasing&gt;"+l_leasing+"&lt;/web:leasing&gt;";
    body += "&lt;/web:param_in&gt;";
    body += "&lt;/web:get_pstupanj&gt;";
    body += "&lt;/soapenv:Body&gt;";
    body += "&lt;/soapenv:Envelope&gt;";
    SSLContext sslContext = null;
    try {
    sslContext = SSLContext.getInstance("TLS");
    X509TrustManager[] xtmArray = new X509TrustManager[|http://forums.oracle.com/forums/] { xtm };
    sslContext.init(null, xtmArray, new java.security.SecureRandom());
    } catch (GeneralSecurityException gse) {
    doc[0] = gse.toString();
    return -1;
    if (sslContext != null) {
    conn.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
    try {
    conn.setDefaultHostnameVerifier(hnv);
    } catch (Exception ex) {
    doc[0] = ex.toString();
    return -1;
    try {
    URL st = new URL("https://services.huo.hr/web_ao/web_ao.asmx");
    conn = (HttpsURLConnection)st.openConnection();
    conn.setRequestMethod("POST");
    conn.setRequestProperty("Host", "services.huo.hr");
    conn.setRequestProperty("Content-Length", "" + body.length());
    conn.setRequestProperty("SOAPAction",
    "\"https://services.huo.hr/web_ao/get_pstupanj\"");
    conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8");
    conn.setDoOutput(true);
    OutputStreamWriter wr =
    new OutputStreamWriter(conn.getOutputStream());
    wr.write(body);
    wr.flush();
    BufferedReader in =
    new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null) {
    sb.append(new String(inputLine.getBytes(),"UTF-8"));
    in.close();
    //System.out.println(new String(sb.toString().getBytes(),"ISO8559_2"));
    doc[0] = sb.toString();
    return 0;
    } catch (Exception e) {
    doc[0] = e.toString() + " ===&gt; " + body + " ==&gt;length= " + body.length();
    return -1;
    ====================================
    best regards
    Edited by: Peterv6i on Jan 6, 2009 8:34 AM
    Edited by: Peterv6i on Jan 6, 2009 8:40 AM

Maybe you are looking for

  • RFC or Bapi RFC  ? to import RFC Adaptive Model - Is the same one or other?

    Hi: I want to know if is exactly the same to import a RFC not a (BAPI marked as RFC) to use the model, since I'm getting this error: [Info]:     Creating Model: PepueModel [Info]:     Creating Model Class: Z_Psim_Ngc_Pep_Ue_Input [Info]:     Creating

  • Multiplot XY graph : error when wiring 24 to active plot property node

    I'm using LabVIEW 2009 When I wire 24 or higher to the active plot property node of a multiplot XY graph , I receive error message : error 1077 Property Node (arg 1) in Untitled 1 <APPEND> Property Name: <b>Active Plot</b> Anyone a suggestion ? Solve

  • Premiere Elements 3.0--Deactivate

    How do I deactivate Photoshop Elements 5.0 and Premier Elements 3.0? Currently, my computer is not hooked up to the internet--I realize it needs to be before deactivating (not a problem). But when I look at PS Elements or Premier Elements>Help, there

  • Alter database open resetlog?

    Hi all, I am trying the Database cloning(new database name) in my development environment(Oracle 11g r1 Windows 2003 Server). While Creating a new controlfile we need pass command like this "CREATE CONTROLFILE REUSE SET DATABASE "ORCL2" RESETLOGS FOR

  • Pls explain

    Hi, Could anyone pls tell me what actually it means by doing this: Map map = new HashMap(); or Map map = new HashTree(); Actually Map is an interface and HashMap implements it..But if we do like this HashMap map = new HashMap(); still we will be able