How to get data from Oracle using Native SQL in SAP.. Problem with date

Hi Masters.
I'm trying to get data from an Oracle DB. I was able to connect to Oracle using tcode DBCO. The connetion works fine
I wrote this code and it works fine without the statement of where date > '01-09-2010'
But i need that statement on the select. I read a lot about this issue, but no answer.
My code is (this code is in SAP ECC 6.0)
DATA: BEGIN OF datos OCCURS 0,
      id_numeric(10),
      component_name(40),
      comuna(10),
      record_id(10),
      status,
      sampled_date(10),
      END OF datos.
DATA: c TYPE cursor.
EXEC SQL.
  connect to 'LIM' as 'MYDB'
ENDEXEC.
EXEC SQL.
  SET CONNECTION 'MYDB'
ENDEXEC.
EXEC SQL PERFORMING loop_output.
  SELECT ID_NUMERIC, COMPONENT_NAME, COMUNA, RECORD_ID, STATUS, SAMPLED_DATE
  into :datos from lims.SAMP_TEST_RESULT
  where     date > '01-09-2010'
ENDEXEC.
EXEC SQL.
  disconnect 'MYDB'
ENDEXEC.
How can i get the data from that date?? If i delete the where statemet, the program works well, it takes 30 mins and show all the data, I just need the data from that date.
Any help
Regards

Please refer the example in this link which deals with Oracle date format.
You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

Similar Messages

  • How to get resultset from oracle procedure use ejb3

    how to get resultset from oracle procedure use ejb3
    i know oracle procedure should like this
    Create or replace PROCEDURE resultset_test(
    aaa IN NUMBER,
    bbb OUT sys_refcursor) ....
    but what s the ejb3 scripts looks like? please give me an example or link~
    ths

    - there are no EJB3 scripts, only compiled application code
    - the part of the EJB spec that deals with databases is called the Java Persistence API, but likely you are just looking for the JDBC API.
    Now you should know what to Google to get your "example script": "java jdbc oracle procedure"

  • What is the easiest way to export all tables data from Oracle to MS SQL Server?

    Hello MS,
    I would like to export all tables from Oracle 11.2 to MS SQL Server 2012 R1.
    Using the tool "Microsoft SQL Server Migration Assistant v6.0 for Oracle" did not work for me because there are too many warnings and errors regarding the schema creation (MS cannot know it because they are not the schema designer). My idea is
    to leave/skip the schema creation to the application designer/supplier and instead concentrate on the Oracle data export and MS SQL data import.
    What is the easiest way to export all tables data from Oracle to MS SQL Server quickly?
    Is it:
    - the „MS SQL Import and Export Data“ Tool
    - the “MS SQL Integration Services” Tool
    - not Oracle dump *.dmp format because it is a propritery binary format
    - flat file *.csv (delimited format)
    Thanks!

    Hi lingodingo,
    If you want to directly export all tables from Oracle database to SQL Server, I suggest you use SQL Server Import and Export Wizard. Because you just need to follow the wizard with GUI, this is the easiest way.
    If you want to make some modification for the tables‘ data before loading to SQL Server, I suggest you use SQL Server Integration Services package. For more details, please refer to the following similar thread:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/38b2bed2-9d4e-48d4-a33f-1d9eed1c062d/flat-file-to-sql-server?forum=sqldatamining
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Error while retreiving data from oracle using EJB.

    HII All,
    I m getting this error while trying to retreive data from oracle DB using EJB.
    An error has occurred. Maybe the request is not accepted by the server:
    Exception in method empName.
    HTTP/1.1 500 Internal Server Error
    Connection: close
    Server: SAP J2EE Engine/6.40
    Content-Type: text/xml; charset=UTF-8
    Set-Cookie: <value is hidden>
    Date: Mon, 24 Jul 2006 10:50:11 GMT
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Exception in method empName.</faultstring><detail><ns1:com.sap.engine.services.ejb.exceptions.BaseEJBException xmlns:ns1='http://sap-j2ee-engine/client-runtime-error'>Exception in method empName.</ns1:com.sap.engine.services.ejb.exceptions.BaseEJBException></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
    Thanks in advance
    Devendra Phate.

    Hi Devendra,
    this error message does not tell me much. Pleas either start debugging or watch your logs for more detailed messages.
    Regards,
    Benny

  • How to get information from Oracle's views

    Hi,
    I need to get information from Oracle's views about:
    * in which table's column is set index
    * what type of index is on this column
    * name of a trigger which exist on a table
    * type of trigger (before, after etc)
    * trigger status (enable, disable)
    Thanks for help.

    Hi..
    One of the best way to know which views to use is doing select * from dict where table_name like 'xxx';
    For example in your case you needed to know about the indexes and triggers so
    SQL> select * from dictionary where table_name like 'DBA_IND%';
    TABLE_NAME                     COMMENTS
    DBA_INDEXES                    Description for all indexes in the database
    *DBA_IND_COLUMNS                COLUMNs comprising INDEXes on all TABLEs and CLUSTERs*
    DBA_IND_EXPRESSIONS            FUNCTIONAL INDEX EXPRESSIONs on all TABLES and CLUSTERS
    DBA_INDEXTYPES                 All indextypes
    DBA_INDEXTYPE_COMMENTS         Comments for user-defined indextypes
    DBA_INDEXTYPE_ARRAYTYPES       All array types specified by the indextype
    DBA_INDEXTYPE_OPERATORS        All indextype operators
    DBA_IND_PARTITIONS
    DBA_IND_SUBPARTITIONS
    DBA_IND_STATISTICS             Optimizer statistics for all indexes in the database
    10 rows selected.
    SQL> select * from dictionary where table_name like 'DBA_TRI%';
    TABLE_NAME                     COMMENTS
    DBA_TRIGGERS                   All triggers in the database
    DBA_TRIGGER_COLS               Column usage in all triggers
    Reading the comments you can know which view to use, then  describe the view and use what you need

  • How to get structure from Idoc using function module?

    Hi all,
    I am looking for a function module in order to get the structure of a message type used for iDoc. The aim is to get the data element from the different fields in order to check authority if the data element is BUKRS.
    Thanks for your help!
    David

    Hi David,
    You can use the FM "IDOC_TYPE_COMPLETE_READ" which will get you the complete details of the IDOC type along with data elements referred for each fields in the segments.
    The aim is to get the data element from the different fields in order to check authority if the data element is BUKRS.
    Not sure if i understood the above requirement, if you could provide more info on the requirement, i guess you might get better a better solution from the forum. As there are other data elements with different names for company code (just look up *BUKRS* in SE11 under Data Elements to see what i mean), not sure if you can cover it all.
    Regards,
    Chen

  • Read data from SharePoint using ABAP sql command

    We need to read data from a SharePoint site and update the sap object services with the information. There is a lot of information on how to put data into Sharepoint from SAP, but we need to get data from SharePoint and put it into SAP. Is it possible to retrieve data from SharePoint using sql command in ABAP program? If it is possible, what do we need to do to have SAP recognize where to get the SharePoint data?
    Richard Newman

    Hi Newman,
    You can use native sql in your abap code to read data from SharePoint's database. But I would suggest you to generate a SharePoint webservice which can provide you the neccessary data so that you can consume this webservice in ABAP
    (Will be quite faster than native sql).
    Regards,
    Ozcan.

  • Migrating data from Oracle 9i to SQL Server 2005

    I am new to both. I need to first migrate data from oracle to sql server. After this I need to create a daily nightly batch process to insert new records from oracle to sql server into that table.
    As my knowledge in SQL server is zero. Can somebody help me how I can accomplish this.
    Somebody told me that I can use sql server import/export to do initial data dump into sql server and after that I can create a link in in oracle to do new iserts for new records. does any one have some example on this. I will really apprecite this if someone can give me step by step example. Thanks

    I have been to SQL Server training, but my SQL server databases are off the shelf system, so I don't have to muck with them. Anyway, Sql Server is just MS Access on steroids, so some of the same concepts apply. You need to create an external table links to oracle. The following tidbits I found by googling might help you.
    http://www.sqlmag.com/Article/ArticleID/22264/sql_server_22264.html
    http://www.lazydba.com/sql/1__152.html
    http://www.sswug.org/see/35034
    http://decipherinfosys.wordpress.com/2007/07/16/linked-servers-in-sql-server/
    Some of the above require subscriptions (free and or paid). Hope this helps.

  • Help needed with variable - trying to get data from Oracle using linked svr

    Sorry if I posted this in the wrong forum - I just didn't know where to post it.
    I'm trying to write a simple stored procedure to get data from an oracle database via a linked server in SQL Enterprise manager. I have no idea how to pass a variable to oracle.
    Here's how I would get the variable in SQL:
    declare @maxkey INTEGER
    select @maxkey= MAX(keyfield) from [server].Data_Warehouse.dbo.mytable
    select * from [server].Data_Warehouse.dbo.mydetailtable where keyfield=@maxkey
    the select statement I need to do in oracle would use that variable like this:
    select * from OPENQUERY(OracleLinkedServer,'select
    * from ORACLEDB.TABLE where keyfield > @maxkey')
    and I get this message: OLE DB provider "OraOLEDB.Oracle" for linked server "OracleLinkedServer" returned message "ORA-00936: missing expression".
    I realize that I can't pass the @maxkey variable to oracle - so how do I accomplish this?

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • Return Data from Oracle using a web service in AXIS - please help

    Hi Forum,
    I am very new to web services and Java tech. and recently I have been assigned to work with technology and I am struggling to learn it and need your help and assistance.
    I am trying to return some data from a an oracle database but I have to do that using a web service and I am using AXIS. For example below is a simple program that returns two columns for the demo EMP table
    import java.sql.*;
    class emp {
    public static void main(String args[])
    throws ClassNotFoundException, SQLException {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // or you can use:
    // DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott", "tiger");
    Statement stmt = conn.createStatement( );
    ResultSet rset = stmt.executeQuery("select * from emp");
    while(rset.next( )) {
    System.out.println(rset.getString(1));
    System.out.println(rset.getString(2));
    rset.close( );
    stmt.close( );
    conn.close( );
    } but I do not know how to convert this into a web service.
    Please help.
    Thanks in advance.
    Regards,
    Ravi

    The following code returns Document. I will be calling the below function to convert my Resultset to document. In my JWS file i simply call a method with parameters. can a web service method in .jws file return Document type. It shows error will doing so. Please help me.
    public static Document toDocument(ResultSet rs) throws ParserConfigurationException, SQLException
              Document res_doc = null;
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document doc = builder.newDocument();
              Element results = doc.createElement("Results");
              doc.appendChild(results);
              ResultSetMetaData rsmd = rs.getMetaData();
              int colCount = rsmd.getColumnCount();
              while (rs.next())
              Element row = doc.createElement("Row");
              results.appendChild(row);
              for (int i = 1; i <= colCount; i++)
              String columnName = rsmd.getColumnName(i);
              Object value = rs.getObject(i);
              Element node = doc.createElement(columnName);
              node.appendChild(doc.createTextNode(value.toString()));
              row.appendChild(node);
              return res_doc;
         }

  • How to get substring from string using index?

    hi,
    here i am having string ,
    i want the pullareddy from below line ,
    i know how to get from substring.
    but i want to get the above using "index",
    can any help how to do it?
    String str1="janapana,pullareddy, in malaysia";
    jpullareddy

    get the start index with indexAt("pullareddy")
    get the end index with adding the length of the word to the start
    get the char[] of str1 with toCharArray()
    make a new string with the chars from start to end index.

  • How to get GMT or IST using PL/SQL FUNCTION

    Hello I am using Oracle 10G database (OS: Windows-32 and Windows-64).
    How can i get the date and time GMT or International time without referring SYSDATE / DBDATE.
    Actual problem the DB-Sever date/time is frequently manipulated by end user and i want to log the actual date and time of transaction in some audit table.
    Regards,
    Tarun

    It won't increase your server load, you'd simply have a lot of http wait events and the performance of your application would depend on your customers internet connection. Something not very desireable if you ask me, and most certainly will cause you headaches. Really bad headaches, and one day someone will ask who came up with the brilliant idea to get the system timestamp via http instead of...+sysdate+ (I smell a http://thedailywtf.com/ article coming up).
    Anyway; here it goes: the http based sysdate function. I am using mod_plsql for my "webservice" running on a server from where I trust the date is correct. You can use anything you like, for a "real" webservice, the implementation will be a little bit different than that. Google would know the answer on how to call webservices from the database.
    $[CHE_TEST@asterix1_impl] create or replace procedure server_time as
      2  begin
      3  htp.print(to_char(sysdate, 'dd.mm.yyyy hh24:mi:ss'));
      4  end;
      5  /
    Procedure created.As you can see the procedure does nothing else then outputting the sysdate of my database server in a specified date format. Then, on a different server I call the mod_plsql procedure via utl_http:
    $[CHE_TEST@asterix2_al32utf8] create or replace function get_server_time return date is
      2  begin
      3    --default would be 60, this is clearly too much
      4    utl_http.set_transfer_timeout(1);
      5    return to_date(utl_http.request('http://ias4/asterix1_impl_cronet/server_time'), 'dd.mm.yyyy hh24:mi:ss');
      6  exception
      7    when utl_http.REQUEST_FAILED then
      8      return sysdate;
      9  end;
    10
    11  /
    Function created.Now get_server_time will give me the time of my first database server (except the HTTP Request fails for some reason, then it'll be sysdate)
    $[CHE_TEST@asterix2_al32utf8] select get_server_time from dual;
    GET_SERVER_TIME
    24.07.2012 13:35:00Again if you are going down that road use the function carefully and not in every end of your application as it will give you performance problems.
    cheers

  • Transfer data from Oracle 7 to SQL server 2005

    Hello guys,
    I am new in Oracle and I need some help from you:
    I have an Oracle database 7 and I need to transfer some tables into MS SQL Server 2005.
    Is there any ORACLE utility (compatible with ver 7) to help me in this task?
    If not, what is the way to trasfer data from a Oracle database 7 to SQL Server 2005?
    Thank in advance

    SQL Server can access Oracle database via the Linked Database feature however I do not know if you could find a Oracle 7 database compatiable Oracle client to use with a SQL Server 2005 database. i would not even try to configure this.
    What I suggest is you use SQLPlus to spool out delimited data into flat files, copy/FTP etc ... those flat files to your SQL Server box, and use BCP to load the data into SQL Server.
    There have been numberous posts of generating delimited flat files from Oracle data posted here on the forum but here is one method that will work on version 7:
    How do I export a database table to a flat file ?
         http://www.jlcomp.demon.co.uk/faq/flatfile.html
    HTH -- Mark D Powell --

  • Error While reading CLOB from Oracle using WebLogic Connection Pool, Works fine with out using pool

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

  • How to get information from a text editor in the SAP standard transactions

    Hi SAP gurus I have a requirement in which it is required to gte the information from a text editor(which is not a field) in mm02 (click on) goto Purchase Order Text  in this view there is a text editor there is some text  in te the text editor i have to get that information in a table can it be done if so please give example and steps
    Points will be given to useful information

    Ah yes, excellent question, and not really a clear cut answer. In my experience, the easiest way to find this information is to simply create the text using the standard transaction, in this case MM02.  Then go to transaction SE16, using table STXH, do a query on this table, entering your user name, and today's date as the creation date.  The results should show the text that you just created, now you can see the object, id, and the way the name is being used here. 
    I also understand that in some cases, there is a button next to the editor in the screen which gives you some idea of these values, but this is not implemented everywhere, and I believe that I've only seen this in one place, can't remember where, but the first solution above will always work for you.
    Regards,
    Rich Heilman

Maybe you are looking for

  • Intel i965 on 2.6.28 kernel --- results with xf86-video-intel 2.5.99.

    I compiled and booted into 2.6.28 and switched xorg.conf back to EXA. Ok, it worked a little bit better but it did not WOW me.  So, I compiled by hand the latest intel driver and DAMN! very smooth in Compiz... "lightening fast"  I don't have any 3d g

  • Command-5 shortcut for 5-star rating photos in iPhoto not working

    When I go to 5-star rate a photo in iPhoto using the default Command-5 shortcut, the shortcut no longer works. The Command-1, Command-2, Command-3, Command-4 shortcuts work for (1-star through to 4-star ratings), but for some reason Command-5 no long

  • How can I control the delay pedal with a MIDI keyboard?

    Okay, I'm looking to perform the song 'Are You In?' by Incubus with some friends, and here's what I want to do... I have my guitar plugged into a Behringer UCG102 Guitar Link The link is then plugged into my MacBook running GarageBand I have an amp p

  • How to save mail content in IE ?

    I can save each mail in Netscape with 'save frame as',but can't save mail in Internet Explorer. Anyone know how to save mail in IE ?

  • Empty regions in Cross Tab report

    How to remove the blank spaces, empty spaces in a cross tab report? Basically ,I created a cross tab report and in my report I have multiple fields in the left section of the cross tab. And because of this a huge empty region comes up directly above