Native SQL to an external oracle database

Hello experts,
     I like to read some data from an external oracle database with native sql statements.
Which prerequisites are neccessary to do so?
In detail: which customizing must be performed?
Wich authorizations are necessary on the local SAP-system and on the oracle-site?
Many thanks for your help!
         Best regards
                            Elmar

first, you need the SAP database library for Oracle. on Windows, filename is dboraslib.dll
then, you create a user ID on your external database
then ,you configure table DBCON
read:
https://forums.sdn.sap.com/click.jspa?searchID=9272762&messageID=1193314
https://forums.sdn.sap.com/click.jspa?searchID=9272762&messageID=2806510

Similar Messages

  • Native SQL: insert data into oracle database, no return message.

    hi,
    the statement : insert into <TableName> values (Source)
    how can I know if the data have already insert to the database table?
    now I have a program have this problem: the data has already exist, but there's no error message return when insert the same data again.
    data: dbs like dbcon-con_name value 'HRGK',
                       dbtype type dbcon_dbms.
    data: sqlerr_ref type ref to cx_sql_exception,
             exc_ref    type ref to cx_sy_native_sql_error,
             error_text type string.
    data: cnt type i,
            i(2) type c.
    set locale language 'E'.
    EXEC SQL.
      CONNECT TO :DBS
    ENDEXEC.
    EXEC SQL.
      SET CONNECTION :DBS
    ENDEXEC.
    EXEC SQL.
      SELECT COUNT(*) from org_unit into :cnt
    ENDEXEC.
    write: / cnt.
    *do.
    i = 'A'.               
    try.
        EXEC SQL.
          BEGIN
           insert into ORG_UNIT ( ORGAN_ID, UNIT_NO, UNIT_NAME, PARENT_ID)
                         values ( 'A', '123412', 'SDFSG', 'DDS');                     " ORGAN_ID is primary key
    " If the data 'A' has already exist in database ORG_UNIT, it will show error message
    " But if I use :I instead 'A', it will not show error message.
            IF SQL%FOUND THEN
               COMMIT;
            END IF;
          END;
        endexec.
        EXEC SQL.
          SELECT COUNT(*) from ORG_UNIT into :cnt
        ENDEXEC.
        write: / cnt.
    catch cx_sy_native_sql_error into exc_ref.
        error_text = exc_ref->get_text( ).
        write: / error_text.
      catch cx_sql_exception into sqlerr_ref.
        perform handle_sql_exception using sqlerr_ref.
    endtry.
    EXEC SQL.
      disconnect :DBS
    ENDEXEC.
    *enddo.
    *&      Form  handle_sql_exception
    form handle_sql_exception
      using p_sqlerr_ref type ref to cx_sql_exception.
      format color col_negative.
      if p_sqlerr_ref->db_error = 'X'.
        write: / 'SQL error occured:', p_sqlerr_ref->sql_code,
               / p_sqlerr_ref->sql_message.                     "#EC NOTEXT
      else.
        write:
          / 'Error from DBI (details in dev-trace):',
            p_sqlerr_ref->internal_error.                       "#EC NOTEXT
      endif.
    endform.                    "handle_sql_exception
    please help to see the words:
    *" If the data 'A' has already exist in database ORG_UNIT, it will show error message*
    *" But if I use :I instead 'A', it will not show error message.*
    in the program.
    Thanks a lot!

    resumption and jer,
    Sorry I cannot format the code for easy reading!
    The page is submitting to itself. See action = \"$uri\". I used the same logic to enter SELECT querries into the database. It pulls and displays data back on the webpage. The code I used for this is below. Compare it with the one above for inserting data into the table.
    <?php
    // connect to oracle
    $username = "xxxxx";
         $paswd = "yyyyy";
         $dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
              "(HOST=patriot.gmu.edu)(PORT=1521))".
              "(CONNECT_DATA=(SID=COSC)))";
         $db_conn = ocilogon($username, $paswd, $dbstring);
    // username and password will be unset if they weren't passed,
    // or if they were wrong
    if( !isset($query)) {
    // just print form asking for account details
    echo "<form action=\"$uri\" method=post>\n";
    echo "<p>Enter Query: ";
    echo "<input type=text size=100 maxlength=200 name=query value=\"$query\">\n";
    echo "<br><input type=submit name=submit value=Submit>\n";
    echo "</form>\n";
    exit;
    // remove unwanted slashes from the query
    $query = stripslashes($query);
    // run the query
    $stmt = OCIParse($db_conn, $query);
    OCIExecute($stmt, OCI_DEFAULT);
    // Open the HTML table.
    print '<table border="1" cellspacing="0" cellpadding="3">';
    // Read fetched headers.
    print '<tr>';
    for ($i = 1;$i <= ocinumcols($stmt);$i++)
    print '<td class="e">'.ocicolumnname($stmt,$i).'</td>';
    print '</tr>';
    // Read fetched data.
    while (ocifetch($stmt))
    // Print open and close HTML row tags and columns data.
    print '<tr>';
    for ($i = 1;$i <= ocinumcols($stmt);$i++)
    print '<td class="v">'.ociresult($stmt,$i).'</td>';
    print '</tr>';
    // Close the HTML table.
    print '</table>';
    OCIFreeStatement($stmt);
    OCILogoff($db_conn);
    ?>

  • How to connect from SAP on DB2 for i5/OS to external oracle database

    Hello,
    I managed to retrieve data from an external DB2 for i5/OS database using ABAP Native SQL running on another i5/OS server.
    I also managed to retrieve data from an external oracle database using ABAP Native SQL running on another Windows/Oracle server.
    Now i want to use ABAP Native SQL running on an i5/OS and retrieve data from an external Oracle database?
    I suppose i need software to connect fron I5/OS to this oracle database like you need extra software when you want to connect to an i5/OS database if you are running SAP on Windows (read note 751451)
    Does anybody know?
    Thanks in advance
    Bertil Rebergen

    Hello Bertil,
    to access an Oracle database from within an SAP system you'll need SAP's database interface library specific for Oracle plus the Oracle database client library utilized by SAP's database interface library. Both need to be available for the operating system your application server runs on, i.e. IBM i5/OS in your scenario.
    Since the required Oracle database client software is not available for IBM i5/OS your SAP application servers on IBM i5/OS cannot access your Oracle database.
    To overcome this limitation you would need to add at least one additional SAP application server based on Windows or Linux/Power to your current SAP system utilizing IBM DB2 for i5/OS. Since the required software libraries are available for these two operating systems you will be able to solve your problem this way.
    Best Regards, Christian Hoelters, SAP AG.

  • 64 bit SAP to 32 bit External Oracle Database connectivity failing

    Dear All,
    We are trying to connect to an external Oracle database thru DBCON method. We are able to connect to Oracle server from our IDES server which is a 32 bit server, but when we are trying to connect our development server which is a 64 bit server, the connectivity is failing.
    we copied the correct 64 bit *.lib file to the SAP server but still same result. We are getting the error message - Work Process restarted. Session terminated.
    the Oracle server we are trying to connect is 32 bit, can this create some problem ?
    kindly any one help us in this reagrd.
    thanks in advance,
    Saurabh.

    Hi Eric,
    thanks for the advice but I am a bit confused as where to execute that sqlplus command/query ?
    in the Oracle server or from SAP and what does system/password@DEV means ??
    can you elaborate on this please.
    here i would like to add that we have connected to the external Oracle server using linked server approach of MS SQL (our SAP default database) and so our connectivity is happening till SQL level i.e. I am able to connect to the Oracle and query it using OpenQuery syntax. the problem is appearing when I am trying to connect from the ABAP level.
    kindly suggest as to what can be the solution of this issue.
    thanks
    Saurabh.

  • Setup tcp connection to external oracle database

    Hello All,
    I have a requirement to setup a tcp connection in SM59 from BI 7 to an external oracle database.
    I am through with the first step of modifying the tnsnames.ora and now I am able to connect from OS level of BID server to this external oracle database O1.
    But, I want to know what options do I need to use to setup a tcp/ip connection?
    How should I register the program (if required)?
    Can anyone please advise whats the best way to resolve this issue?
    Thanks,
    Antarpreet

    Hi,
    Yes, We have installed Oracle Client.
    No, We couldnt find the libdora.dll file in the SAP Server system. From where can we find this file to install ??
    Thanks & Regards,
    Saurabh.

  • Run sql statements in PL/Sql Developer without installing Oracle database?

    Hi all,
    I wish to ask is there any possibility to run Run sql statements in PL/Sql Developer without installing Oracle database?
    Regards.

    Hello Jimmy,
    this is the forum for the tool SQL Developer and, as the title says, *(Not for general SQL/PLSQL questions)*.
    PL/Sql Developer is not an Oracle tool, but from allound allroundautomations.
    And you need access to a database to run SQL statements. This does not need to be one installed by yourself.
    Regards
    Marcus

  • How to generate .SQL format file from oracle database?

    How to generate .SQL format file from oracle database?
    I have a database of Oracle 8.1.6,now want to generate script file (including table structure,index,etc.) from it,What should I do?
    Thanks.

    Your question pertains to the Database Export/Import. This forum exclusively focusses on the export/import utilities that come along with "Oracle Portal" which is a web-based tool. Could you please post your question under the RDBMS export/import or migration forum.

  • Execute Function in external ORACLE Database

    Hi Gurus,
    I'm working with Native SQL, trying to execute a function (NOT a procedure) present in an Oracle Database.
    I have the DBCO table ready and the conection is working fine, but when I want to execute the function I get the following error (with short dump):
    Database error text: "ORA-00900: invalid SQL statement"
    Database error code: 900
    Triggering SQL statement:
    :VALIDO := cai_valido_i   ? , ? , ? , ? , ? , ? )"
    Looks like this is a syntax error when i'm trying to use the function. I try to call the function with EXECUTE PROCEDURE, but another error appear, saying that the procedure doesn't exist.
    This is the function that I need to call in Oracle:
    cai_valido_i
       (ccai in number,
        ccuit in number,
        cfecha in date,
        ccod_tc in number,
        cpto_vta in number,
        cnro in number)   return number
    I Hope somebody can help me with this.
    Kind regards,
    Roberto.-

    Not sure how to call Functions but I executed procedures as below:
      EXEC SQL PERFORMING <SAP_SUBROUTINE>.
        SELECT <PROCEDURE>(
               :<IN_PAR1>,
               :<IN_PAR2>,
               :<IN_PAR3>)
          INTO :<OUT_PAR1>
          FROM DUAL
      ENDEXEC.
    Thnaks,
    Shashi Reddy

  • How to migrate an existing Microsoft SSIS deployment if it is decided to replace SQL Server with an Oracle database?

    Hi Oracle Gurus!
    Currently, I am designing an ETL solution that transforms and loads a lot of data from flat files and sends it to an SQL Server 2008 R2 database for storage. However, at a future point of time, it may be decided to add or even replace SQL Server with an Oracle 11g database.
    Currently, I am writing script transforms in C# to dynamically generate SSIS packages to tansform and load the data into SQL Server. But considering that in future, an Oracle 11g or 12c database might be added to, or replace the SQL Server database, how do I make my script transforms (or whatever else I am developing currently for SQL Server) reusable to the extent possible?
    Or more precisely, what steps do I take, from an Oracle point of view, to ensure that any future migration of data to an Oracle database would be smooth to the extent possible?
    Looking up to my Oracle Gurus for enlightenment in this matter!
    Novice Kid

    When you're writing your on C# code to load data into the SQL Server you have to modify the routines so that they will work with Oracle.
    One approach is to use the extproc agent which would allow you to directly call external programs with all the logic in it to perform the load of your files and to put the data into the Oracle database. Another option would be to use utl_file package (or equivalents) which will allow you to open external files from your Oracle database and to directly read its content and then to pass it to the related tables.

  • Querying SQL server table from Oracle database 11g

    Hi all
    We are using oracle database 11g R2 on REL 5 and i have an SQL server database used by one of our application.
    In my Oracle database, i want to query one table in my SQL server database and to link it in a table in Oracle database to compare data.
    Is there a way like database link or something else to do this need>
    Please send a link or pots here step by step the way on how to accomplish my query.
    Thank you.

    Yes, you can set up your SQL Server as an external database link, using Oracle Heterogeneous Services with SQL Server as an ODBC connection (easier to do if your Oracle server is a Windows server, a little more tricky if your Oracle server is *nix based)
    Here's the documentation... for 11gR2
    http://www.oracle.com/pls/db112/search?remark=quick_search&word=heterogeneous+services

  • Using Native SQL in ABAP for DB2 database

    Dear Friends,
           I have 500K records in ITAB(Internal table) which needs to insert in 'Z' transparent table. Currently it is taking hours of time for insertion and commit. 
    Does using Native SQL helps in performance or any suggestions? If so please send the code. Our database is DB2.
    Your immediate reply is appreciated. Thanks in advance.

    Hi Rama,
    Using array inserts and commit after each Insert, set up your array size as a parameter and try  different array sizes.
    I would start with 2000 and increment by 1000 or 2000 and see what the optimal array size is.
    I would think more commits are desirable, as the array gets bigger it takes longer for the system to prepare in the event of a rollback.
    Just remember to commit after each insert. And are you enqueueing the table first?
    Hope this helps.
    Filler

  • MS SQL Procedure Call from Oracle Database

    I have Oracle Database 11g connected to MS Sql Server 2008 via dg4msql, and need to execute procedure on MS Sql with parameters from Oracle, and get dataset (table) as a result.
    I'm not sure is it possible to call procedure directly from Oracle; One solution would be make function on MS SQL, and put select on procedure from Oracle, but what with parameters?
    Is there some possibility to call this procedure from Oracle and get this dataset as a cursor?
    Thanks in advance!
    Edited by: mihaelradovan on 2012.04.26 14:35

    Yes, of course I have DB Link in Oracle and procedure in SQL Server.
    Btw, I can select data from SQL Server table.
    I made one function in SQL Server, and I can not make select on this function, but in SQL Server I made view as select * from function_name, and select on this view from Oracle works. But problem is I have to call this procedure or function with parameters, and with view I can not do this.
    So, I must call procedure or function with parameters directly. I made all by the book (Oracle® Database Gateway for SQL Server User’s Guide), but probably I miss something...

  • Implementing SQL Plan Management on Oracle Database 11.2.0.2

    Environment:
    Oracle Linux 5 update 10 (UEK)
    Oracle GI 11.2.0.2.0 (Oracle ASM 11.2.0.2)
    Oracle Database 11.2.0.2.0 Enterprise Edition with RAC option (3 nodes)
    No PSU applied/CPU July 2013 applied to RDBMS
    Database servicing Siebel CRM 8.1.1.1 Application that uses bind peeking.
    Siebel CRM soon to be version 8.1.1.11
    There are a few bugs for SQL Plan Management (SPM) on 11.2.0.2 (see below).  The slowness and non-peeked binds issues seem very problematic.  I've seen a few bloggers recommend to not use SPM unless your at Oracle Database 12c.  Several of the bugs seemed to be fixed in 11.2.0.3 but we don't have any plans to move to 11.2.0.3 since we'll most likely be at 12.1.0.x in 7 months.  Any recommendation from the community on whether I should capture and use SQL Plan Management with 11.2.0.2?  Why, why not?  If there's other relevant information needed, let me know.
    Bug 9910484 - SQL Plan Management Capture uses excessive space in SYSAUX (Doc ID 9910484.8)
    Affects:
    Product (Component) Oracle Server (Rdbms)
    Range of versions believed to be affected Versions >= 11.1 but BELOW 12.1
    Versions confirmed as being affected
    •11.2.0.2
    •11.2.0.1
    •11.1.0.7
    Platforms affected Generic (all / most platforms affected)
    Fixed:
    •12.1.0.1 (Base Release)
    •11.2.0.3 (Server Patch Set)
    •11.2.0.2 Patch 4 on Windows Platforms
    •11.1.0.7 Patch 41 on Windows Platforms
    Bug 11719151 - SQL Plan Management capture causes slowness (Doc ID 11719151.8)
    Affects:
    Product (Component) Oracle Server (Rdbms)
    Range of versions believed to be affected Versions >= 11.2.0.2 but BELOW 12.1
    Versions confirmed as being affected
    •11.2.0.2
    Platforms affected Generic (all / most platforms affected)
    Fixed:
    •12.1.0.1 (Base Release)
    •11.2.0.3 (Server Patch Set)
    •11.2.0.2 Patch 22 on Windows Platforms
    Bug 9942454 - DBMS_SPM.LOAD_PLANS_FROM_SQLSET gets XML parsing error (Doc ID 9942454.8)
    Affects:
    Product (Component) Oracle Server (Rdbms)
    Range of versions believed to be affected Versions BELOW 12.1
    Versions confirmed as being affected
    •11.2.0.2
    •11.2.0.1
    •11.1.0.7
    Platforms affected Generic (all / most platforms affected)
    Fixed:
    •12.1.0.1 (Base Release)
    •11.2.0.3 (Server Patch Set)
    Bug 12732879 - Execution Plan of Query with non-peeked binds is not reproducible (Doc ID 12732879.8)
    Affects:
    Product (Component) Oracle Server (Rdbms)
    Range of versions believed to be affected Versions >= 9.2 but BELOW 12.1
    Versions confirmed as being affected
    •11.2.0.3
    •11.2.0.2
    •11.1.0.7
    Platforms affected Generic (all / most platforms affected)
    Fixed:
    •12.1.0.1 (Base Release)
    •11.2.0.4 (Future Patch Set)
    Bug 11687175 - High DFS lock handle waits in the database with SPM if FIXED_DATE is set (Doc ID 11687175.8)
    Affects:
    Product (Component) Oracle Server (Rdbms)
    Range of versions believed to be affected Versions >= 11 but BELOW 12.1
    Versions confirmed as being affected
    11.2.0.2
    11.2.0.1
    11.1.0.7
    11.1.0.6
    Platforms affected Generic (all / most platforms affected)
    Fixed:
    12.1.0.1 (Base Release)
    11.2.0.3 (Server Patch Set)
    Bug 13384234  ORA-29981 with select query with database Change notification
    Affects:
    Product (Component) Oracle Server (Rdbms)
    Range of versions believed to be affected Versions BELOW 12.1
    Versions confirmed as being affected
    11.2.0.2
    Platforms affected Generic (all / most platforms affected)
    Fixed:
    11.2.0.4 (Future Patch Set)
    Thanks so much.

    See these MOS Docs
    11.2.0.2 Patch Set - Availability and Known Issues (Doc ID 1179474.1)
    Important Changes to Oracle Database Patch Sets Starting With 11.2.0.2 (Doc ID 1189783.1)
    HTH
    Srini

  • 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

  • How to migrate Azure SQL Codefirst DB to Oracle database?

    Hi,
    we have been developing a Web application with Windows Azure Code first  SQL DB using Code first approach.
    In the future we want to migrate our Azure SQL Code first DB to Oracle. If we migrate it to Oracle, does the application works fine? or do we need to do any additional actions in migrating from Azure SQL Code first  db to Oracle DB?
    It would be great if  anyone provides me complete information on this.

    Hi,
    You should be able to move the Azure SQL Code First Database to Oracle Database. You will have to make minor changes, for e.g connection string.
    Please have a check on the below link which talks about using Entity Framework 6 Code First with Azure SQL database as a backend. It will give you an idea on how to approach your migration.
    http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
    Regards,
    Mekh.

Maybe you are looking for

  • Can't print from MacOS 10.4.9 to wireless router ASUS 500Deluxe.

    How to set up printer HP LaserJet 1020 in MacOS 10.4.9, wich connected to wireless router ASUS 500Deluxe. Then I tring to print, it writing SENDING CONTROL FILE, when SPOOLING LPR JOB, and NO JOB PRINTING. http://www.volny.cz/kolia/sanagroup/1/pictur

  • Problem in reading Sql server data from text file.

    I am selecting record from sql server 2005 and save the result in text file. The text file contains , delimiter. I am reading same txt file from java & insert into database. But it shows "��S and box like characters along with original text. Regards

  • Airplay rented movie from iPad to ATV2

    Hi - I rented a movie on my iPad and then wanted to playback on my ATV2 using Airplay, however when I try to do this I just get a timer, or sometimes a frozen image of the start of the film on the TV or content Not Supported on this device. Should th

  • I am trying to change my country but iTunes won't let me

    iTunes won't let me buy from my original country as the credit card is invalid in that country.  When I try to change the country it keeps reverting back to the original country.  How do I change the country without opening a new iTunes account?

  • APEX Report Output Formats

    In the SQL Workshop query builder can the output of these queries be changed to HTML or ASCII? We have WEBDB running and are able to change the output formats at run time.