Running SQL Server Function and Procedures from Oracle

I am trying to run SQL Server 2005 functions and/or procedures from a SQL statement in Oracle. I have gone throught the hetergeneous services and have connected to the SQL Server database successfully. I can also do a query to a table in SQL Server successfully; but I have not been able to execute a procedure or a function.

Have you tried Oracle syntax? It seems to me that you have only tried T-SQL syntax, e.g. execute proc.
Wrap it in a begin..end tag like you would a normal PL/SQL function or proc call. Assumption is that as Oracle makes the remote database (via the dblink) look like an Oracle database, you should also play along and pretend it is one and treat it as such.
E.g.declare
  r integer;
begin
  -- execute remote proc
  procFoo@dblink( 'ABC' );
  -- call a remote function
  r := funcFoo@dblink( 123 );
end;

Similar Messages

  • How to run the Oracle Triggers,Functions and Procedures from java

    Hi ,
    I want to execute the Oracle's Triggers, Functions and Procedures from java as like executing the SQL commands by using Execute statements.
    Or can we have some other option for doing this.
    Plz help me ...

    you can use CallableStatement interface of JDBC to execute any DBMS triger,stored procedure ....
    refer any of the JDBC book for extra help
    hope you got it
    Azeem Ahmed

  • How to integrate from MS SQL SERVER 2005 and Flatfile to Oracle 10g.

    Hi
    I am new to ODI. I am trying to load sample data from MS SQL Server 2005 and Flatfile to Oracle 10g.
    1. I have created three models.
    1-1. SQL2005 (SRC_CUSTOMER table)
    1-2. Flatfile (SRC_AGE_GROUP.txt & SRC_SALES_PERSON.txt)
    1-3. Oracle 10g (TRG_CUSTOMER table)
    You may know I got those environments from the ODI DEMO environment.
    2. I could able to reverse the tables also.
    3. I have created an interface which contains source table (from MSSQL 2005), Flatfile and target table from ORACLE model.
    4. I have imported the knowledge modules. But I am confusing in selecting the knowledge modules to source and target tables.
    I've selected LKM File to SQL for flatfile model.
    I've also selected LKM SQL to SQL for MSSQL 2005 model and IKM Oracle Incremental Update for the target table (ORACLE).
    I've also implemented the interface that I created. It worked without errors. But there is no data in target table which is TRG_CUSTOMER.
    I really would like to know what happened and what the problems are.
    You can email me [email protected]
    Thanks in advance
    Jason Lee

    what did give for SRC_AGE_GROUP SRC_CUSTOMER join condition
    if it is
    (SRC_CUSTOMER.AGE=SRC_AGE_GROUP.AGE_MIN) AND SRC_CUSTOMER.AGE=SRC_AGE_GROUP.AGE_MAX
    give it as
    (SRC_CUSTOMER.AGE>SRC_AGE_GROUP.AGE_MIN) AND SRC_CUSTOMER.AGE<SRC_AGE_GROUP.AGE_MAX

  • Any problems if run SQL Server 2005 and Essbase Server on 1 machine?

    <p>Hi, I would like to know if there's any problems in terms ofperformance when running SQL Server 2005 and Essbase Server on 1machine?</p><p> </p><p>Currently, my users are using Excel File (Lock & Send) toupload data to the Essbase Server and it took about 30 mins perexcel file upload. Application Manager is installed on client's andserver PC for adminstration.</p><p> </p><p>Now, I need to implement Datawarehouse and wish to installSQL Server 2005 on the current machine my Essbase Server isrunning. I will need to do simple SQL statements on the SQL Server2005 such as Update, Select, Insert etc.</p><p> </p><p>When comes to performance issues, will my current Essbase Serverbe affected? What if 2 users are accessing the Essbase Server andSQL Server at the same time? Will any data be lost in the midst ofextracting data?</p><p> </p><p>I hope someone can advise. Appreciate that. Thank you.</p>

    <blockquote>quote:<br><hr><i>Originally posted by: <b>roy_choy</b></i><BR><BR>Currently, my users are using Excel File (Lock & Send) to<BR>upload data to the Essbase Server and it took about 30 mins per<BR>excel file upload. <BR>I hope someone can advise. Appreciate that. Thank you.</p><hr></blockquote><BR>My test server is running both Essbase and SQLServer, but I think that you have a bigger problem.<BR><BR>If a lock and send is taking 30 minutes, you are using the wrong technology to load Essbase. You should really consider doing the load using a data load rule. If that isn't the problem, it may be that you are having a real performance problem. If you are moving enough data to require a half hour load, it should be probably be loaded from a text file, or even a spreadsheet, using a data load rule. Text file loads are a bit better than excel, especially when there are formatting issues. <BR><BR>Lock and sends are fine for changing parameters and doing adjustments, but heavy duty data loads really work a lot better with load rules.

  • Error converting SQL Server DDL and views to Oracle

    I am trying to convert SQL Serve 2008 on windows to Oracle 11g using SQL Developer 3.2.20.09. I am using the jtds-1.2.7 drivers to connect to SQL Server.
    I have made several attempts to run the conversion and am getting the tables, indexes, and triggers converted with no issue. However, my Procedures and views are not coming across. All of them are giving similar errors as:
    "Failed To Convert Stored Procedure get_compvision > esp3.dbo.get_compvision:unexpected end of subtree: Line 0 Column 0"
    When I log into the source SQL Server environment using SQL Developer, I get an empty SQL Editor window with "null" when I try to {right-click -> "Open"} on the Procedure.
    Logging into SQL Server Administrator as the same user I can see the source code, so the issue appears to be related to SQL Developer and not my user privleges. I am a dbo alias in SQL Server.
    In addition, if I click on a view, I can see the data and metadata, but not the SQL that defines the view. I see tabs for column, data, triggers, and details.
    In addition, if I go to the "capture" for my Migration project and drill down to procedures, I can see them listed, but each and every procedure gives me a "/* DDL not accesible */" error. I get teh same results for views, triggers and indexes.
    Can someone help me? I have been googling for days!
    Edited by: user4714217 on Jan 24, 2013 12:54 PM

    SELECT v.vnd_c, CASE v.use_parent_addr_flg WHEN 0 THEN a.str_1 ELSE pa.str_1 END AS str_1,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.str_2 ELSE pa.str_2 END AS str_2,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.str_3 ELSE pa.str_3 END AS str_3,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.city ELSE pa.city END AS city,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.state ELSE pa.state END AS state,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.zipcode ELSE pa.zipcode END AS zipcode,
    CAST((CASE v.use_parent_addr_flg WHEN 0 THEN (CASE a.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END)
    ELSE (CASE pa.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END) END) AS char(1)) AS foreign_flg,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.country ELSE pa.country END AS country,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.cre_d ELSE pa.cre_d END AS cre_d,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_d ELSE pa.mod_d END AS mod_d,
    CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_by ELSE pa.mod_by END AS mod_by
    FROM dbo.om_vendor AS v LEFT OUTER JOIN
    dbo.om_address AS a ON a.vnd_id = v.vnd_id AND a.addr_c = 1 INNER JOIN
    dbo.om_owner AS o ON v.owr_id = o.owr_id INNER JOIN
    dbo.om_address AS pa INNER JOIN
    dbo.primary_vendors AS pv ON pa.vnd_id = pv.vnd_id ON o.part_id = pv.part_id
    WHERE (pa.addr_c = 1)
    WHICH TRANSLATES TO
    SELECT v.vnd_c ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.str_1
    ELSE pa.str_1
    END str_1 ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.str_2
    ELSE pa.str_2
    END str_2 ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.str_3
    ELSE pa.str_3
    END str_3 ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.city
    ELSE pa.city
    END city ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.STATE
    ELSE pa.STATE
    END STATE ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.zipcode
    ELSE pa.zipcode
    END zipcode ,
    (CASE v.use_parent_addr_flg
    WHEN 0 THEN (CASE a.foreign_flg
    WHEN 1 THEN 'Y'
    ELSE 'N'
    END)
    ELSE (CASE pa.foreign_flg
    WHEN 1 THEN 'Y'
    ELSE 'N'
    END)
    END) foreign_flg ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.country
    ELSE pa.country
    END country ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.cre_d
    ELSE pa.cre_d
    END cre_d ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.mod_d
    ELSE pa.mod_d
    END mod_d ,
    CASE v.use_parent_addr_flg
    WHEN 0 THEN a.mod_by
    ELSE pa.mod_by
    END mod_by
    FROM om_vendor v
    LEFT JOIN om_address a
    ON a.vnd_id = v.vnd_id
    AND a.addr_c = 1
    JOIN om_owner o
    ON v.owr_id = o.owr_id
    JOIN om_address pa
    JOIN primary_vendors pv
    ON pa.vnd_id = pv.vnd_id
    ON o.part_id = pv.part_id
    WHERE ( pa.addr_c = 1 );
    Edited by: user4714217 on Jan 24, 2013 1:43 PM

  • SQL Server 2005 data pull from Oracle

    Hi, I am learning how to use Oracle and I ran into this problem.
    My database is running on SQL Server 2005.
    I have an ODBC connection to Oracle. I also have a VB .Net script that queries the Oracle table that the data resides in.
    When the job is running, and if it stalls, I do not get a timeout error. It locks down my database and no other source systems can feed data to me; these are back logged in the queue.
    Is there an easier way for me to make a connection that will pull data on a consistent basis? Please help ...
    Student Learner

    Learning how to use Oracle does not include taking data from Oracle and putting it into SQL Server.
    From your description of what is happening I agree with BluShadow. This is not an Oracle issue. This is a coding in VB .NET issue.
    Posting the statements you are executing against some unknown version of Oracle would be a good starting point.

  • How to move functions and procedures from packages into a schema?

    Hello,
    I have below requirements for a homework and my question is if someone can point me in the right direction to find documentation which can help me solve the below. Any information will be very much appreciated. Thank you.
    Write procedures and functions (included or not in packages)under the form scripts  .txt or .sql . Once they have been launched in SQL developer they should more the functions and the procedures from the packages in the current schema. If the current schema contains only 2 packages, pac1( with procedures p11,p12 and the functions f11,f12,f13) and pac2( contains the following procedures p21,p22,p23 and the functions f21 and f21( overloading cases), the execution of the scripts will generate the following effects:
    The procedures p11,p12,p21,p22 ,p23 and the functions f11,f12 and f13 will be created in the current schema.
    pac2 will contain 2 instances of the overloading function- f21; they will be kept in the package, without being created in the current schema; so all the procedures/functions overloaded will be kept in the original packages
    If pac1 contains variables, cursors and public types, we will keep only the package specifics( and delete the body);generally if the packages do not contain procedures or functions overloaded the body will be deleted and if no variables, cursors, public types then we will delete the header.
    If in the triggers, procedures, functions  we will call procedures/functions from the packages(the procedures and the functions moved in the current schema) they reference will need to be updated ( via amending the body or recompile) for example if pa1.p12 will need to be replaced with p12.
    The scripts will have to have numbers in the following series( 01....n) and characters that explain the content.

    My only advice would be to remember that these are public forums and if YOU can find them, so can your instructors.
    Also, those are horrible procedure and function names
    This assignment seems to be around overloading pl/sql objects and order of precedence...do a search on the Oracle Docs around overloading and inheritence
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28371/adobjplsql.htm#i21148

  • Best Practice to fetch SQL Server data and Insert into Oracle Tables

    Hello,
    I want to read sqlserver data everry half an hour and write into oracle tables ( in two different databases). What is the best practice for doing this?
    We do not have any database dblinks from oracle to sqlserver and vice versa.
    Any help is highly appreciable?
    Thanks

    Well, that's easy:
    use a TimerTask to do the following every half an hour:
    - open a connection to sql server
    - open two connections to the oracle databases
    - for each row you read from the sql server, do the inserts into the oracle databases
    - commit
    - close all connections

  • Connecting to SQL Server on Win NT from Oracle On Unix

    I have Oracle database in one unix machine.
    I have to connect with the orcle database on unix from the sql server on windous NT.
    This can be accomplished trough ODBC but do not know the exact driver or an interface through which i can connect with the unix oracle database.
    If anybody have any idea about commecting two hetrogeneaus databases on two different OS.
    Please Help
    Thanks in advance.
    Satish Pahade

    Once a time I practise the replication betweem the sql server and oracle in UNIX.
    I just succeed in replication from sql server to oracle db.
    I can recall that this donot need ODBC.
    YuePeng Chen.
    [email protected]

  • SQL Server Problems and Questions from an SQL dummy

    I am an SQL Dummy!
    In the old 2008 version of SQL I had to run a script to fix a rounding error in my Microsoft Accounting software (no longer supported)  I think I have version 10 now?
    SQL FIX for Fiscal Year won't close
    Need to use Sql Management Studio (as oppose to more obscure osql.exe)
    to run sql script
    b) Use Sql Management Studio to execute script below:
    SELECT *
    FROM dbo.CashPostingTable
    WHERE (amountcredit <> amountCreditCompanyCurrency OR amountDebit <>
    amountDebitCompanyCurrency) AND exchangeRate=100
    If you get any rows/data back, proceed to step c), if no result, a more
    serious problem - good lucks or buy help.
    c) Use Sql Management Studio to execute script below:
    UPDATE cashpostingtable
    SET amountCreditCompanyCurrency = amountCredit,
    amountDebitCompanyCurrency = amountDebit,
    companyAmountRemainder = accountAmountRemainder
    WHERE (amountcredit <> amountCreditCompanyCurrency OR amountDebit <>
    amountDebitCompanyCurrency) AND exchangeRate=100
    Management Studio no longer works.  Is there a way to do the same thing in the version I have?
    Thank you,
    Dean

     I am an SQL Dummy!
    In the old 2008 version of SQL I had to run a script to fix a rounding error in my Microsoft Accounting software (no longer supported)  I think I have version 10 now?
    SQL FIX for Fiscal Year won't close
    Need to use Sql Management Studio (as oppose to more obscure osql.exe)
    to run sql script
    b) Use Sql Management Studio to execute script below:
    SELECT *
    FROM dbo.CashPostingTable
    WHERE (amountcredit <> amountCreditCompanyCurrency OR amountDebit <>
    amountDebitCompanyCurrency) AND exchangeRate=100
    If you get any rows/data back, proceed to step c), if no result, a more
    serious problem - good lucks or buy help.
    c) Use Sql Management Studio to execute script below:
    UPDATE cashpostingtable
    SET amountCreditCompanyCurrency = amountCredit,
    amountDebitCompanyCurrency = amountDebit,
    companyAmountRemainder = accountAmountRemainder
    WHERE (amountcredit <> amountCreditCompanyCurrency OR amountDebit <>
    amountDebitCompanyCurrency) AND exchangeRate=100
    Management Studio no longer works.  Is there a way to do the same thing in the version I have?
    Thank you,
    Dean

  • How to use type, packages, functions, and procedures in another schema ?

    I have two target schema in one OWB project, such as A and B. In a mapping of A, I would like to use some types, packages, functions, and procedures from B. I have tried the method of synonym as suggested, but I could not find the metadata of these when importing ... The only type of synonym I can import is the synonym for table. Is there a bug for synonym?
    If I cannot use synonym for this issue, is there another way to solve the problem?

    Now, in some instances you will absolutely need to create the second module as Carsten describes, however it should also be noted that you can reference objects in things like Expressions even if you have not loaded up the metadata. It is only when you need strong binding that it becomes neccessary to import objects. For everything else, as long as the reference will resolve at compile-time then you are good to go.
    For example, I have a function in one target schema (S1) and a private synonym to it in another(s2). A mapping in the S2 schema has an expression object that uses the synonym to the function in the expression property for a couple of the output attirbutes. The synonym has not been loaded into metadata - indeed OWB has no knowledge of its existance. But it resolves at compile time so the mapping validates and generates successfully.
    Mike

  • How to switch between SQL Server Express and SQL Server Evaluation

    I have both SQL Server Express and SQL Server Evaluation installed on my laptop. 
    I am wondering how to start SQL Server Evaluation; when I click All Programs > SQL Server Management Studio, I always get SQL Server Express (which I installed on my laptop a couple years ago). 
    I just downloaded SQL Server Evaluation (a couple days ago). 
    Whenever I try to access SQL Server Evaluation, I always seem to get SQL Server Express. 
    Sorry if this is a trivial thing; I just can’t seem to get it to work (and I Googled for a solution before posting this).
    Thanks everyone!!

    Ah!  It worked!!  This is great!!  It seems like I can connect to my version of SQL Server Evaluation, named 'EXCEL-PC\EXCEL'.
    Somehow, though, I seem to keep getting errors in my BIDS when I try to run an SSIS project.  See below:
    Ah!  It worked!!  This is great!!  It seems like I can connect to my version of SQL Server Evaluation, named 'EXCEL-PC\EXCEL'.
    I am getting an error that VS is unable to load a document:
    BIDS has to be installed by one of these editions of SQL Server 2008: Standard, Enterprise, Developer, or Evaluation. 
    To install BIDS, run SQL Server Setup and select Business Intelligence Development Studio.
    #1)  I recently downloaded and installed SQL Server Evaluation (specifically for the opportunity to try using BIDS and learn about this technology).
    #2)  When I run BIDS > SSIS, I get the error I described above. 
    #3)  I have had SQL Server Express installed for a couple years on my laptop
    So, my question is this: is it possible that BIDS > SSIS is picking up my SQL Server Express, instead of SQL Server Evaluation? 
    If so, how can I get BIDS to point to SQL Server Evaluation? 
    You can see in the image above that I have my BIDS Data Connections pointing to EXCEL-PC\EXCEL, which is the name of my SQL Server Evaluation. 
    Is this correct?  Why doesn’t this work? 
    I’ve spent some considerable time on this.  I’m close to just uninstalling EVERYTHING pertaining to SLQ Server, and just reinstalling SQL Server Evaluation, but this will take some time, and I don’t necessarily want
    to get rid of my SQL Server Express.  However, if that’s the only way to get this working, then that’s what I’ll do.
    I’d greatly appreciate any insight into this!!

  • Calling a sql server sproc and function from oracle gateway

    Hello ,
    i am new to oracle gateway,
    we are trying to call a sql server 2008 stored procedure and function which return result set like a table result set.
    Can you please share some syntax of how to do it.
    and capture the data set and loop through or output it.
    Thanks
    madhu

    On My Oracle Support you find some notes how to do that. The first one is
    Different Methods For Calling MS SQL Server Procedures Using DG4MSQL (Doc ID 197192.1)
    and a note using result sets (it was written fir the Sybase gateway but works the same way for DG4MSQL) is:
    How to Call a Remote Sybase Procedure Using DG4SYBS (Doc ID 351400.1)
    - Klaus

  • Invoking SQL Server function from Oracle

    Hi all,
    My question involves Oracle and SQL Server. I have a function in SQL Server that returns the count of rows in a table in SQL Server itself. I
    wish to invoke this function (in SQL Server) from Oracle. I have Transparent Gateway through which I usually connect to SQL Server to get the count. Is there a way in which I can execute the function (in SQL Server) from Oracle, something like below:
         select function_in_sql_server@transparent_gateway from dual;Thanks,
    ...

    I found below two links:
    how to call a sql server stored procedure from oracle
    http://en.allexperts.com/q/Oracle-1451/2008/6/Calling-SQL-Stored-procedure-1.htm
    Regards
    Girish Sharma

  • 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

Maybe you are looking for