Retrieving data from different node in SQL

Hi friends,
First of all:
        BANNER
1     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
2     PL/SQL Release 11.2.0.3.0 - Production
3     CORE     11.2.0.3.0     Production
4     TNS for Linux: Version 11.2.0.3.0 - Production
5     NLSRTL Version 11.2.0.3.0 - ProductionI have a small but annoying problem. I have to build a bank application which must take data from an input file, and, based on those information, to execute some stored procedures (create a new customer, create a new account, create a transaction for an account).
For example: the input file contain few new customers (FirstName, LastName, SocialSecurityNumber, BirthDay, Address and PhoneNo), for each customer at least 1 account to be created, for each account 1 or more transactions (the amount of transaction).
Let me be more specific. This is an XML as a input file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<doc>
  <PERS_INFO>
    <lastname>John</lastname>
    <firstname>Doe</firstname>
    <social_security_no>1800325171545</social_security_no>
    <birthday>25/03/1980</birthday>
    <address>Principal, 15</address>
    <phoneno>0040722222222</phoneno>
    <acc>
      <transaction>200</transaction>
      <transaction>150</transaction>
      <transaction>-23</transaction>
    </acc>
    <acc>
      <transaction>450</transaction>
    </acc>
    <acc>
      <transaction>800</transaction>
      <transaction>320</transaction>
      <transaction>-125</transaction>
    </acc>
  </PERS_INFO>
  <PERS_INFO>
    <lastname>Smith</lastname>
    <firstname>Pop</firstname>
    <social_security_no>2851211173377</social_security_no>
    <birthday>11/12/1985</birthday>
    <address>FirstAvenue, 20</address>
    <phoneno>0040744444444</phoneno>
    <acc>
      <transaction>444</transaction>
      <transaction>550</transaction>
    </acc>
    <acc>
      <transaction>113</transaction>
      <transaction>-50</transaction>
      <transaction>89</transaction>
    </acc>
    <acc>
      <transaction>300</transaction>
    </acc>
  </PERS_INFO>
</doc>This input file should start the following:
- create 2 new customers (using a stored procedure Pr_Add_New_Cust):
1. John Doe / 1800325171545 / 25.03.1980 / Principal, 15 / 0040722222222
2. Smith Pop / 2851211173377 / 11.12.1985 / FirstAvenue, 20 / 0040744444444
- for John Doe I have to create 3 new account (using a stored procedure Pr_Add_New_Account):
- account 1 - for this account I have to create 3 new transactions (using a stored procedure Pr_Create_New_Trans): DEPOSIT 200$, DEPOSIT 150$, WITHDRAW 23$
- account 2 - for this account I have to create 1 new transactions (using a stored procedure Pr_Create_New_Trans): DEPOSIT 450$
- account 3 - for this account I have to create 3 new transactions (using a stored procedure Pr_Create_New_Trans): DEPOSIT 800$, DEPOSIT 320$, WITHDRAW 125$
- for Smith Pop I have to create 3 new account (using a stored procedure Pr_Add_New_Account):
- account 1 - for this account I have to create 2 new transactions (using a stored procedure Pr_Create_New_Trans): DEPOSIT 444$, DEPOSIT 550$
- account 2 - for this account I have to create 3 new transactions (using a stored procedure Pr_Create_New_Trans): DEPOSIT 113$, WITHDRAW 50$, DEPOSIT 89$
- account 3 - for this account I have to create 1 new transactions (using a stored procedure Pr_Create_New_Trans): DEPOSIT 300$
Well, I'm thinking to do that by loading that XML into a pre-staging table - INS_STG1 - (the loading part is not an issue for the moment) and by parsing the XML in order to get my necessary information (inserting into the second staging table INS_STG2) to launch those procedures.
Something like this (for the moment I insert only the customer information since I don't know how to get to the second level):
DECLARE 
   TYPE ty_rec_1    IS RECORD (v_cust_firstname       VARCHAR2(32),
                               v_cust_lastname        VARCHAR2(32),
                               v_cust_persnumcode     VARCHAR2(32),
                               v_cust_birthday        VARCHAR2(32),
                               v_cust_address         VARCHAR2(32),
                               v_cust_phoneno         VARCHAR2(32));
   TYPE ty_cur_1       IS REF CURSOR RETURN ty_rec_1;
   TYPE ty_arr_rec_1   IS TABLE OF ty_rec_1 INDEX BY PLS_INTEGER;
   cur_1               ty_cur_1;
   arr_rec_1           ty_arr_rec_1;
   my_xml              xmltype;
   N_BULK_SIZE         NUMBER := 1000;
BEGIN
  SELECT xml_column INTO my_xml FROM INS_STG1;
  OPEN cur_1 FOR
    SELECT extractvalue(column_value, '/PERS_INFO/firstname')          "v_cust_firstname",
           extractvalue(column_value, '/PERS_INFO/lastname')           "v_cust_lastname",
           extractvalue(column_value, '/PERS_INFO/social_security_no') "v_cust_persnumcode",
           extractvalue(column_value, '/PERS_INFO/birthday')           "v_cust_birthday",
           extractvalue(column_value, '/PERS_INFO/address')            "v_cust_address",
           extractvalue(column_value, '/PERS_INFO/phoneno')            "v_cust_phoneno"      
    FROM TABLE(XMLSequence(my_xml.extract('/doc/PERS_INFO'))) t;
    LOOP
       FETCH cur_1 BULK COLLECT INTO arr_rec_1 LIMIT N_BULK_SIZE;
       EXIT WHEN arr_rec_1.COUNT() = 0;
       FORALL n_idx1 IN 1..arr_rec_1.COUNT()
         INSERT INTO INS_STG2
           (cust_firstname, cust_lastname, cust_persnumcode, cust_birthday, cust_address, cust_phoneno)
          VALUES
          (arr_rec_1(n_idx1).v_cust_firstname, arr_rec_1(n_idx1).v_cust_lastname,
           arr_rec_1(n_idx1).v_cust_persnumcode, arr_rec_1(n_idx1).v_cust_birthday,
           arr_rec_1(n_idx1).v_cust_address, arr_rec_1(n_idx1).v_cust_phoneno);
     END LOOP;
   CLOSE cur_1; 
  COMMIT;             
END;That procedure is based on the SQL query that I start to ply with in order to understand how to get the information from XML using SQL (the XML is hard-coded)
SELECT extractvalue(column_value, '/PERS_INFO/firstname')    "First Name",
       extractvalue(column_value, '/PERS_INFO/lastname')     "Last Name",
       extractvalue(column_value, '/PERS_INFO/social_security_no')  "Social Security No",
       extractvalue(column_value, '/PERS_INFO/birthday')     "Birth-day",
       extractvalue(column_value, '/PERS_INFO/address')      "Address",
       extractvalue(column_value, '/PERS_INFO/phoneno')      "Phone No"
  FROM TABLE(XMLSequence(
             XMLTYPE(
             '<?xml version="1.0" encoding="ISO-8859-1"?>
              <doc>
                <PERS_INFO>
                  <lastname>John</lastname>
                  <firstname>Doe</firstname>
                  <social_security_no>1800325171545</social_security_no>
                  <birthday>25/03/1980</birthday>
                  <address>Principal, 15</address>
                  <phoneno>0040722222222</phoneno>
                  <acc>
                    <transaction>200</transaction>
                    <transaction>150</transaction>
                    <transaction>-23</transaction>
                  </acc>
                  <acc>
                    <transaction>450</transaction>
                  </acc>
                  <acc>
                    <transaction>800</transaction>
                    <transaction>320</transaction>
                    <transaction>-125</transaction>
                  </acc>
                </PERS_INFO>
                <PERS_INFO>
                  <lastname>Smith</lastname>
                  <firstname>Pop</firstname>
                  <social_security_no>2851211173377</social_security_no>
                  <birthday>11/12/1985</birthday>
                  <address>FirstAvenue, 20</address>
                  <phoneno>0040744444444</phoneno>
                  <acc>
                    <transaction>444</transaction>
                    <transaction>550</transaction>
                  </acc>
                  <acc>
                    <transaction>113</transaction>
                    <transaction>-50</transaction>
                    <transaction>89</transaction>
                  </acc>
                  <acc>
                    <transaction>300</transaction>
                  </acc>
                </PERS_INFO>
              </doc>').extract('/doc/PERS_INFO'))) t;My problem is that query goes only at the first level (the customer level). I don't know how to get to the second/third level (account/transactions level).
Now, that query return:
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444and I want it to return like this:
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  1   200
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  1   150
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  1  -23
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  2   450
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  3   800
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  3   320
Doe     John     1800325171545     25/03/1980     Principal, 15     0040722222222  3  -125
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444  1   444
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444  1   550
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444  2   113
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444  2  -50
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444  2   89
Pop     Smith     2851211173377     11/12/1985     FirstAvenue, 20     0040744444444  3   300What I have to do to that SQL query to get the result at the transaction level (as in the second table)? That XML can be subject of improvement as well. If another structure serve better for my purpose, please let me know.
Thanks!

As [url http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions061.htm#SQLRF06173]extractvalue is deprecated in your version, you need to switch to another method as the documentation suggests.
Going forward with that, here is a starter SQL that gives you the desired output
WITH INS_STG1 AS
(SELECT XMLTYPE('<?xml version="1.0" encoding="ISO-8859-1"?>
              <doc>
                <PERS_INFO>
                  <lastname>John</lastname>
                  <firstname>Doe</firstname>
                  <social_security_no>1800325171545</social_security_no>
                  <birthday>25/03/1980</birthday>
                  <address>Principal, 15</address>
                  <phoneno>0040722222222</phoneno>
                  <acc>
                    <transaction>200</transaction>
                    <transaction>150</transaction>
                    <transaction>-23</transaction>
                  </acc>
                  <acc>
                    <transaction>450</transaction>
                  </acc>
                  <acc>
                    <transaction>800</transaction>
                    <transaction>320</transaction>
                    <transaction>-125</transaction>
                  </acc>
                </PERS_INFO>
                <PERS_INFO>
                  <lastname>Smith</lastname>
                  <firstname>Pop</firstname>
                  <social_security_no>2851211173377</social_security_no>
                  <birthday>11/12/1985</birthday>
                  <address>FirstAvenue, 20</address>
                  <phoneno>0040744444444</phoneno>
                  <acc>
                    <transaction>444</transaction>
                    <transaction>550</transaction>
                  </acc>
                  <acc>
                    <transaction>113</transaction>
                    <transaction>-50</transaction>
                    <transaction>89</transaction>
                  </acc>
                  <acc>
                    <transaction>300</transaction>
                  </acc>
                </PERS_INFO>
              </doc>') xml_column FROM DUAL
-- The above simulates your table.  Only the below matters.
SELECT xt.First_Name, xt.birth_day, xt2.acc_rn, xt3.trans
  FROM INS_STG1,
       XMLTable('/doc/PERS_INFO'
                PASSING INS_STG1.xml_column
                COLUMNS
                First_Name   VARCHAR2(20) PATH 'firstname',
                Birth_day    VARCHAR2(10) PATH 'birthday',
                acc_xml      XMLType      PATH 'acc') xt,
       XMLTable('/acc'
                PASSING xt.acc_xml
                COLUMNS
                acc_rn       FOR ORDINALITY,
                tran_xml     XMLTYPE      PATH 'transaction') xt2,
       XMLTable('/transaction'
                PASSING xt2.tran_xml
                COLUMNS
                trans        NUMBER       PATH '.') xt3;producesFIRST_NAME           BIRTH_DAY      ACC_RN      TRANS
Doe                  25/03/1980          1        200
Doe                  25/03/1980          1        150
Doe                  25/03/1980          1        -23
Doe                  25/03/1980          2        450
Doe                  25/03/1980          3        800
Doe                  25/03/1980          3        320
Doe                  25/03/1980          3       -125
Pop                  11/12/1985          1        444
Pop                  11/12/1985          1        550
Pop                  11/12/1985          2        113
Pop                  11/12/1985          2        -50
Pop                  11/12/1985          2         89
Pop                  11/12/1985          3        300Now ... there is probably a better XQuery way to pull that off, but I'll save that example for someone better at XQuery than myself.
I will also include that it is possible all this work could be done in a single SQL statement as shown by
[url http://odieweblog.wordpress.com/2012/05/10/how-to-load-xml-data-into-multiple-tables/]How To : Load XML data into multiple tables

Similar Messages

  • How to retrieve Data from SAP BW to  SQL

    Hi All,
    i am looking for way to retrieve Data from SAP BW to SQL.
    Could you please give me some indcations or a document on how to implement it?
    Thanks in advance
    Cheers
    Gilo

    Hi,
    You need to use open hub destination. third party tool destination for SQL
    SAP BW TO SQL -- Extraction to the third-party tool can be executed as follows:
           1.      You define an open hub destination with Third-Party Tool as the destination type.
           2.      You create an RFC destination for your third-party tool and enter it in the definition of the open hub destination.
           3.      You use API RSB_API_OHS_DEST_SETPARAMS to define the parameters for the third-party tool that are required for the extraction.
           4.      You either start extraction immediately or include it in a process chain. You can also start this process chain from the third-party tool using process chain API RSPC_API_CHAIN_START. The extraction process then writes the data to a database table in the BI system.
           5.      When the extraction process is finished, the system sends a notification to the third-party tool using API RSB_API_OHS_3RDPARTY_NOTIFY.
           6.      The extracted data is read by API RSB_API_OHS_DEST_READ_DATA.
           7.      The status of the extraction is transferred to the monitor by API RSB_API_OHS_REQUEST_SETSTATUS.

  • Retrieving data from different tables in the same time crash

    Hi
    this is probably the wrong way to do it, but this is how I did:
    - I wanted a screen with 3 datagrids components retrieving data from 3 different tables.
    - I could make it work while enabling 1 or 2 of them.  When the 3 are enabled, I get this error:
    btw its a huge msg, I will trim it:
    ArgumentError: Can't find ManagedQuery or ManagedOperation named: getItems_paged     at mx.data::RPCDataServiceAdapter/executeQuery()[C:\depot\DataServices\branches\lcds_modeler 101\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:325]     at mx.data::RPCDataServiceAdapter/processDataMessage()[C:\depot\DataServices\branches\lcds_m odeler101\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:920]     at RPCDataServiceRequest/invoke()[C:\depot\DataServices\branches\lcds_modeler101\frameworks\ projects\data\src\mx\data\RPCDataServiceAdapter.as:1668]     at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\depot\DataServices\branches\lcds_m odeler101\frameworks\projects\data\src\mx\data\DataStore.as:3343] ...  it continues forever. 
    the getItems_paged is a auto generated function inside the php class flex generates to handle the tables.
    Each of the datagrid is a custom component. I made so to avoid keeping a bunch of code lines in the main 'page'.
    Any suggestion to make it work smoothly?
    Thanks in advance,
    btp~

    Hi
    this is probably the wrong way to do it, but this is how I did:
    - I wanted a screen with 3 datagrids components retrieving data from 3 different tables.
    - I could make it work while enabling 1 or 2 of them.  When the 3 are enabled, I get this error:
    btw its a huge msg, I will trim it:
    ArgumentError: Can't find ManagedQuery or ManagedOperation named: getItems_paged     at mx.data::RPCDataServiceAdapter/executeQuery()[C:\depot\DataServices\branches\lcds_modeler 101\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:325]     at mx.data::RPCDataServiceAdapter/processDataMessage()[C:\depot\DataServices\branches\lcds_m odeler101\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:920]     at RPCDataServiceRequest/invoke()[C:\depot\DataServices\branches\lcds_modeler101\frameworks\ projects\data\src\mx\data\RPCDataServiceAdapter.as:1668]     at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\depot\DataServices\branches\lcds_m odeler101\frameworks\projects\data\src\mx\data\DataStore.as:3343] ...  it continues forever. 
    the getItems_paged is a auto generated function inside the php class flex generates to handle the tables.
    Each of the datagrid is a custom component. I made so to avoid keeping a bunch of code lines in the main 'page'.
    Any suggestion to make it work smoothly?
    Thanks in advance,
    btp~

  • Retrieve data from different database

    Hi all,
    I have 2 database servers, servar a and server b, i created a form from server a table, in the same form i have a LOV, i want to see data in this LOV from server b table.
    how i can do it ?
    thanks
    Noman

    Thanks for your early reply,
    Can you please more elaborate how I retrieve data from server b in LOV after creating a link with server b.
    What I did exactly I made a data base string in server a from server b, still I am confuse how I retrieve my data from that server database..
    Noman

  • Retrieving Data from different Tables with same tuple name

    Hi,
    I am made the following query from different tables. A tuple "name" is appearing in some tables. So when I run the qiery in a Java class, it delivers the same result of c.name, bpl.name and p.name. The result of c.name is correct, but the other 2 names are overwritten. It works perfect in a postgreSql query tool. How can I correct it, plz?
    SELECT c.ad_client_id, c.name, o.c_order_id, o.ref_order_id, bp.name, bpl.name, o.dateordered, o.datepromised, od.c_orderline_id,p.m_product_id,p.name, cur.iso_code, od.qtyordered
    FROM adempiere.ad_client c, adempiere.c_order o, adempiere.c_orderline od, adempiere.c_bpartner bp, adempiere.m_product p, adempiere.c_bpartner_location bpl, adempiere.c_currency cur
    WHERE c.ad_client_id =11 and c.ad_client_id = o.ad_client_id and bp.c_bpartner_id=o.c_bpartner_id and o.c_order_id = od.c_order_id and od.m_product_id = p.m_product_id and o.c_bpartner_location_id =bpl.c_bpartner_location_id and o.c_currency_id=cur.c_currency_id;
    Cheers

    Hi,
    create alias, if u have similar field names as below. Use the alias name (rs.getString("cname") and rs.getString("bpname") and so on ) to retrive data.
    SELECT c.ad_client_id, c.name as cname, o.c_order_id, o.ref_order_id, bp.name as bpname, bpl.name as bplname, o.dateordered, o.datepromised, od.c_orderline_id,p.m_product_id,p.name as pname, cur.iso_code, od.qtyordered
    FROM adempiere.ad_client c, adempiere.c_order o, adempiere.c_orderline od, adempiere.c_bpartner bp, adempiere.m_product p, adempiere.c_bpartner_location bpl, adempiere.c_currency cur
    WHERE c.ad_client_id =11 and c.ad_client_id = o.ad_client_id and bp.c_bpartner_id=o.c_bpartner_id and o.c_order_id = od.c_order_id and od.m_product_id = p.m_product_id and o.c_bpartner_location_id =bpl.c_bpartner_location_id and o.c_currency_id=cur.c_currency_id;Regards,
    Ram

  • Retrieve data from different record

    I want to display a characteristic from a previous record, from the same cube, but display it in the current record row.
    i.e. get the most recent activity of type"XX" and display the result characteristic from that record on the most recent "YY" activity record.
    Hope this makes sense.
    Is the only way to do this in a Virtual Key figure?
    Thanks

    Solved problem, posting this incase others have problem
    I solved this problem by using an Infoset. To get the most recent record I used the TOP N (1) in a condition on a RKF.

  • What are the different ways of retrieving data from Oracle8i

    What are the different ways of retrieving data from Oracle8i
    into my HTML page ?
    Is it JDBC and ODBC ?
    Is there any other way ?
    null

    Methods I tried,
    Applet using SQLJ/JDBC with JDBC drivers thin or Oci8,
    Oracle Web Publishing Assistant,
    HTP/HTF PL/SQL packages (if you have OAS 4.0)
    Webserver Generator of Designer 2000 (if you have OAS 4.0)
    Arun (guest) wrote:
    : What are the different ways of retrieving data from Oracle8i
    : into my HTML page ?
    : Is it JDBC and ODBC ?
    : Is there any other way ?
    null

  • MS SQL database needs to run mdx query to analysis services to retrieve data from a BPC 10 Netweaver cube(view only)

    We are in the process of migrating from BPC7 SP12 Microsoft sql server to BPC10 netweaver on a sql server with BW7.4 and need to integrate our home grown data warehouse which is on a Microsoft sql server.  The data warehouse currently connects to BPC7 using integration services/analysis services and runs mdx queries to analysis services to retrieve data from the BPC7 cube (view only).  Please provide documentation on how to create this same integration with our data warehouse using BPC10 netweaver on a sql server.

    When you were setting up your ODBC data source for
    the Text driver, did you click on the "Options"
    button? There's a lot of options in there that I
    didn't understand at first glance.Yes I clicked on the options button, but the only thing there is dealing with file extensions. I left it set to the default.
    I have since tried closing my connection after I insert a record, I then try executeQuery, but still no luck. Seems strange that I can write to the file but not read from it. If any thing I'd expect the opposite problem.
    I have also tried using the class "JoltReport" from the sun tutorial instead of my own with the same result.
    Message was edited by:
    Hentay

  • Error while retrieving data from PL/SQL Table using SELECT st. (Urgent!!!)

    Hi Friends,
    I am using Oracle 8.1.6 Server, & facing problems while retrieving data from a PL/SQL Table:
    CREATE or REPLACE PROCEDURE test_proc IS
    TYPE tP2 is TABLE of varchar2(10); --declared a collection
    dt2 tP2 := tP2('a','b','c');
    i NUMBER(8);
    begin
    SELECT COUNT(*) INTO i FROM TABLE(CAST(dt2 as tP2));
    DBMS_OUTPUT.PUT_LINE('**'||i);
    end;
    While executing the above procedure, I encountered foll. error:
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [],
    ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [], [], [], [], []
    ORA-06553: PLS-801: internal error [0]
    Can anyone please help me, where the problem is??
    Is it Possible to retrieve data from PL/SQL TABLE using SELECT statement? & How ?
    Thanks in advance.
    Best Regards,
    Jay Raval.

    Thanks Roger for the Update.
    It means that have to first CREATE TYPE .. TABLE in database then only I can fire a Select statement on that TYPE.
    Actually I wanted to fire a Select statement on the TABLE TYPE, defined & declared in PLSQL stored procedure using DECLARE TYPE .. TABLE & not using CREATE TYPE .. TABLE.
    I was eager to know this, because my organization is reluctant in using CREATE TYPE .. TABLE defined in the database, so I was looking out for another alternative to access PL/SQL TABLE using Select statement without defining it database. It would have been good if I could access a PLSQL TABLE using Select statement Declared locally in the stored procedure.
    Can I summarize that to access a PL/SQL TABLE using SELECT statement, I have to first CREATE TYPE .. TABLE?
    If someone have any other idea on this, please do let me know.
    Thanks a lot for all help.
    Best Regards,
    Jay Raval.
    You have to define a database type...
    create type tP2 is table of varchar2(10)
    CREATE OR REPLACE PROCEDURE TEST_PROC
    IS
    dt2 tP2 := tP2('a','b','c');
    i NUMBER(8);
    begin
    SELECT COUNT(*) INTO i FROM TABLE(CAST (dt2 AS tP2));
    DBMS_OUTPUT.PUT_LINE('**'||i);
    end;
    This will work.
    Roger

  • Failed to retrieve data from the database. 42000(Microsoft)(ODBC SQL Server

    Failed to retrieve data from the database. 42000(Microsoft)(ODBC SQL Server Driver)(SQL Server)Line 1: Incorrect syntax near 's'

    Hi Diptesh,
       What is your crystal reports version ? CRXI or higher?
    And does your filter bject consists of apostrophie s fields?
    If this is the case then this is a known issue try installing the latest service packs or fix packs to see if it resolves the issue?
    Regards,
    Vinay

  • Retrieve data from 2 columns of 2 different tables and display in 1 column

    Hi,
    Is it possible to retrieve data from 2 different columns of 2 different tables and display it in the same column of a datablock in a form.
    For example:
    Table A
    Col1
    1
    2
    3
    Table B
    Col1
    2
    4
    5
    The column from the datablock in the form should display the following:
    1
    2
    3
    2
    4
    5

    You can create a view
    select ... from table_a
    union
    select ... from table_b
    and base the block on that.
    However, if you want to allow DML on the block it gets more complicated.

  • Problem retrieving Data from a CDATA-Section using XMLDOM

    Hello,
    Ware: Oracle 8.1.7.4 64bit, XDK for PL/SQL Version 9.2.0.3, Solaris8 64bit
    I can't retrieve Data from the CDATA-Section of an XML-String, neither with
    getData(DOMCharacterData) or substringData. Also getLength fails. I get always
    the following error:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.ClassCastException
    ORA-06512: at "XML_SCHEMA.XMLCHARDATACOVER", line 0
    ORA-06512: at "XML_SCHEMA.XMLDOM", line 853
    ORA-06512: at "SCHWABE.XML_TEST", line 47
    ORA-06512: at line 1
    I can successfully cast the DOMNode to a CharacterData with makeCharacterData
    and check with isNull (DOMCharacterData) (returns FALSE).
    My Testcase:
    1) A Function which build a XML-Document:
    CREATE OR REPLACE FUNCTION XML_ResponseCalc RETURN VARCHAR2 IS
    doc VARCHAR2(32767);
    BEGIN
    doc :=
    '<?xml version="1.0" encoding="UTF-8"?>
    <RSDecEng>
    <Version>1.00</Version>
    <ResponseCalc>
    <ID>00000000000000000014</ID>
    <Burst>
    <Definition>
    <Count>1</Count>
    <ID>
    <Start>1</Start>
    <Length>4</Length>
    </ID>
    <Var>
    <Name>Risiko_1</Name>
    <Start>5</Start>
    <Length>5</Length>
    </Var>
    </Definition>
    <Data>
    <Length>9</Length>
    <Count>5</Count>
    <![CDATA[
    1 0.001
    2 0.002
    3 0.003
    4 0.004
    5 0.005
    6 0.006
    7 0.007
    8 0.008
    9 0.009
    10 0.010
    ]]>
    </Data>
    </Burst>
    </ResponseCalc>
    </RSDecEng>
    2) The Procedure which parses the XML-Document (no Exception-Handling):
    CREATE OR REPLACE PROCEDURE XML_TEST IS
    Parser XML_SCHEMA.XMLParser.Parser;
    DOMDocument XML_SCHEMA.XMLDOM.DOMDocument;
    DOMNode XML_SCHEMA.XMLDOM.DOMNode;
    DOMNodeItem XML_SCHEMA.XMLDOM.DOMNode;
    DOMNodeList XML_SCHEMA.XMLDOM.DOMNodeList;
    DOMCharacterData XML_SCHEMA.XMLDOM.DOMCharacterData;
    TheDocument CLOB;
    ID VARCHAR2(100);
    Data VARCHAR2(200);
    BEGIN
    -- LOB
    DBMS_LOB.CREATETEMPORARY(TheDocument, TRUE);
    DBMS_LOB.WRITEAPPEND(TheDocument, LENGTH(XML_ResponseCalc), XML_ResponseCalc);
    -- Parse
    Parser := XML_SCHEMA.XMLParser.NewParser;
    XML_SCHEMA.XMLParser.ParseCLOB(Parser, TheDocument);
    DOMDocument := XML_SCHEMA.XMLParser.GetDocument(Parser);
    XML_SCHEMA.XMLParser.FreeParser(Parser);
    -- Node
    DOMNode := XML_SCHEMA.XMLDOM.MakeNode(DOMDocument);
    -- Get ID
    DOMNodeList := XML_SCHEMA.XSLProcessor.SelectNodes
    (DOMNode,'/RSDecEng/ResponseCalc/ID/text()');
    IF XML_SCHEMA.XMLDOM.GetLength(DOMNodeList) > 0 THEN
    DOMNodeItem := XML_SCHEMA.XMLDOM.Item(DOMNodeList, 0);
    XML_SCHEMA.XMLDOM.WriteToBuffer(DOMNodeItem, ID);
    SYS.DBMS_OUTPUT.PUT_LINE ('ID: '||ID);
    END IF;
    -- Get CDATA
    DOMCharacterData := XML_SCHEMA.XMLDOM.MakeCharacterData(DomNode); -- <-- ok here...
    IF NOT XML_SCHEMA.XMLDOM.isNull (DOMCharacterData) THEN -- <-- ...and here
    Data := XML_SCHEMA.XMLDOM.GETDATA(DOMCharacterData); -- <-- ...but here Exception raise
    END IF;
    END;
    I hope you can help me.
    Thank you in advance
    Markus Schwabe

    You need to notice the definitions for makecharacterdata:
    FUNCTION makeCharacterData(n DOMNode) RETURN DOMCharacterData;
    PURPOSE
    Casts given DOMNode to a DOMCharacterData
    It only do the casting.

  • Crystal Reports - Failed to retrieve data from the database

    Hi There,
    I'm hoping that somebody can help me.
    I've developed a crystal report from a stored procedure which I wrote. I can execute the stored procedure within SQL Server and within the Crystal Reports designer without any errors. Furthermore, I have imported the report into sap and can run it within SAP from the server without any errors. SAP version 8.81 PL5
    The issue is that when it's run from a client machine, I get the following error: "Failed to retrieve data from the database. Details: Database Vendor Code: 156. Error in the File RCR10010 {tempfile location}
    Here's a list of things which I have tried, all to no avail:
    - Checked user permissions to ensure that they have proper authorizations
    - Re-set the datasource connection and re-imported the report to SAP.
    - Exported the report and reviewed the datasource connection and re-imported to SAP.
    - Tried to run the report on multiple machines to ensure that it's not machine specific
    - Tried to run the report using different users to ensure it's not user specific.
    - Tested other reports built from stored procedures on client machines to ensure that they work.
    Any assistance in this would be GREATLY appreciated.
    Thank you

    After further testing, we found that the report could be run within SAP on any work station which had the CR designer installed on it.
    As it turns out, the procedure which I wrote has temp tables in it.  The runtimes built into the SAP client install do not support creating temp tables when executing the report from within SAP.  Which is why the report could not retreive data.
    To work around this, I installed external runtimes which were the same version of the Crystal Report and now the report can be run within SAP from any workstation which has the external runtimes (and not just the runtimes within the SAP client).
    I hope this makes sense.

  • Select data from different database

    hi,
    may I know how to select data from different database?
    for example,
    I've 2 databases, OracleDB and OracleAR
    Connect with OracleAR in SQL*Plus
    select * from OracleDB.TableName
    does Oracle support this kind of query?
    how can I retrieve data from other database while im connecting with
    other database?

    Hi,
    Yes, it's possible. No, your syntax won't work.
    First of all you have to define a DATABASE LINK inside the DB where you are already connected (in this case OracleAR). Read docs how to do that.
    Second thing is the query. It will look like
    SELECT * from TableName@<NameOfDatabaseLink>Greetings,
    Guido

  • Duplicate the details section when I retrieve data from Delivery notes

    Hey all.
    I built a query that retrieve data from ODLN and it works fine.
    But, when I have a Delivery Notes Document that has items from some different orders (that I copy them to Delivery notes of course) it duplicate my rows in the report
    I run the query at SQL server and it's work fine (on the same document)
    Is someone knows why this is happen?

    If one of these programs will not kick the iPod out of recovery mode than you are out of luck.
    For PC
    RecBoot: Easy Way to Put iPhone into Recovery Mode
    or
    http://joshuabailey1997.wordpress.com/2010/09/02/recboot-v1-3/
    If necessary:
    Download QTMLClient.dll & iTunesMobileDevice.dll for RecBoot
    and                                           
    RecBoot tip
    RecBoot may have problems on 64X windows, then try:       
    Tenorshare ReiBoot – Enter & Exit iPhone, iPad, iPod Recovery Mode with a Single Click
    For MAC or PC       
    The Firmware Umbrella - TinyUmbrella
    Installs blootware on PC too
    Your only home is to restore from your last backup
    iOS: Back up and restore your iOS device with iCloud or iTunes       

Maybe you are looking for

  • PL/SQL cursor loop...error  INTO clause needed...but multiple rows

    Oracle 11gR2 Linux x86_64 Hi all, I am running the below PL/SQL block but getting the below error. From what I know, the INTO clause can only be used when a single row will be returned. In this case, I know it returns multiple rows, so why is it aski

  • Sequencing of variables when executing a planning function in IP

    I am using BI Integrated Planning and have created a web application that executes a u201CCopyu201D planning function on the click of a button. The u201CCopyu201D planning function has a number of variables to accept u201CThe Fromu201D and u201CTou20

  • Delete statements are taking longer time

    Hi All, I have an issue with delete statement. below are my oracle DB details. SQL>select * from v$version; BANNER Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production PL/SQL Release 11.1.0.6.0 - Production CORE 11.1.0.6.0 Pro

  • Sorry there was a problem checking your details.

    Hi, When I go to run the broadband speed test on the BT website it says. Thought it was the website at first as it started doing this the other day. Sorry there was a problem checking your details. Please check you have entered the correct telephone

  • BI Publisher extension for Open Office

    Is there any BI Publisher extension available for Open Office(v3.3) for creating templates ?