Error in join query

I get error in following querY sAying "Unable to interpret XKTSCH".
report ZTF1.
tables: AFKO, AFVC.
DATA: XSTEUS LIKE AFVC-STEUS,
      XKTSCH LIKE AFVC-KTSCH,
      XLTXA1 LIKE AFVC-LTXA1.
SELECT SINGLE AFVCSTEUS AFVCKTSCH AFVC~LTXA1 FROM
  AFVC INNER JOIN AFKO
    ON AFVCAUFPL = AFKOAUFPL 
     INTO XSTEUS XKTSCH XLTXA1
      where AFKOAUFNR = '007200000059' and AFVCVORNR = '0010'.
WRITE:/ XSTEUS.
WRITE:/ XKTSCH.
WRITE:/ XLTXA1.

Hi tushar
Just write your varaible in bracket as:
.. INTO ( XSTEUS XKTSCH XLTXA1 ) where ...
Regards
Ashish Jain

Similar Messages

  • DNS Error while joining the machine to domain.

    I get the below error while joining a new Win7 machine to the domain.
    I can ping and successfully resolve nslookup on both server and client machine.
    Both client and server (2008r2) are virtual machines, with private ip's on LAN...
    The following error occurred when DNS was queried for the service location (SRV) resource record used to locate a domain controller for domain
    magic.com:
    The error was: "DNS name does not exist."
    (error code 0x0000232B RCODE_NAME_ERROR)
    The query was for the SRV record for _ldap._tcp.dc._msdcs.magic.com
    Common causes of this error include the following:
    - The DNS SRV record is not registered in DNS.
    - One or more of the following zones do not include delegation to its child zone:
    magic.com
    com
    . (the root zone)
    For information about correcting this problem, click Help.
    Looks like some problem with my DNS.
    Also i tried to uninstall/ re-install the DNS role.
    What should be the TCP/IP network configuration???
    System Security analyst at CapG

    I get the below error while joining a new Win7 machine to the domain.
    I can ping and successfully resolve nslookup on both server and client machine.
    Both client and server (2008r2) are virtual machines, with private ip's on LAN...
    The following error occurred when DNS was queried for the service location (SRV) resource record used to locate a domain controller for domain
    magic.com:
    The error was: "DNS name does not exist."
    (error code 0x0000232B RCODE_NAME_ERROR)
    The query was for the SRV record for _ldap._tcp.dc._msdcs.magic.com
    Common causes of this error include the following:
    - The DNS SRV record is not registered in DNS.
    - One or more of the following zones do not include delegation to its child zone:
    magic.com
    com
    . (the root zone)
    For information about correcting this problem, click Help.
    Looks like some problem with my DNS.
    Also i tried to uninstall/ re-install the DNS role.
    What should be the TCP/IP network configuration???
    System Security analyst at CapG
    Also something to look in, i do not have the usual folders below 'Forward lookup zone', i.e, Sites, Home, tcp etc..
    I beleive these are required. I am not sure.!!. I did re-install the role, no change :-(
    System Security analyst at CapG

  • MS SQL - Syntax error for valid query

    I have a problem with the second query in this code (gives me
    a syntax error in my HAVING line)
    <cfquery name="getDupes" datasource="#application.ODBC1#"
    dbtype="ODBC" username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT *
    FROM view_FormCount
    WHERE formCount >= 2
    ORDER BY formNum
    </cfquery>
    <cfset variables.lstForms = "">
    <cfoutput query="getDupes">
    <cfset variables.lstForms=
    listAppend(variables.lstForms,"'#getDupes.formNum#'")>
    </cfoutput>
    <cfset variables.whereClause = "(formNum =
    #ReplaceNoCase(variables.lstForms,',',' OR formNum =
    ','ALL')#)">
    <cfquery name="getDetails"
    datasource="#application.ODBC1#" dbtype="ODBC"
    username="#application.userNameODBC1#"
    password="#application.userPassODBC1#">
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    FROM tblForms INNER JOIN tblCompanies ON tblForms.formCustNum
    = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr
    HAVING #variables.whereClause#
    ORDER BY tblForms.formNum, tblForms.formCustNum
    </cfquery>
    Now, the really odd thing is if I just take the query text
    out of the CFQUERY tags and use CFOUTPUT instead (to see in my
    browser what query is getting executed) I get a query that I can
    paste into Enterprise Mgr and runs fine.
    I can even paste the resulting text into my code in a CFQUERY
    and CF will run it fine.
    In other words, the dynamic version query gives me an error,
    but if I just output the SQL statement, copy-and-paste that into
    the CFQUERY that's erroring out (replacing what's there) to run as
    a static query, it works fine (sample of static query below).
    The error I get when I try to do it dynamically is "Error
    Executing Database Query. [Macromedia][SQLServer JDBC
    Driver][SQLServer]Line 4: Incorrect syntax near '10169318'. The
    error occurred on line 21." which is where the HAVING clause
    starts.
    SELECT tblForms.formNum, tblForms.formName,
    tblForms.formCustNum, tblCompanies.companyAbbr FROM tblForms INNER
    JOIN tblCompanies ON tblForms.formCustNum = tblCompanies.companyNum
    GROUP BY tblForms.formNum, tblForms.formName, tblForms.formCustNum,
    tblCompanies.companyAbbr HAVING (formNum = '10169318' OR formNum =
    '1016CONCERTA' OR formNum = '1016NSAIDS' OR formNum =
    '1016STRATTERA' OR formNum = '1016WELLBUTRIN' OR formNum =
    '18504211' OR formNum = '185093807' OR formNum = '73208565' OR
    formNum = '732120027' OR formNum = '7322154' OR formNum = '7323402'
    OR formNum = '7323522' OR formNum = '73238900' OR formNum =
    '7324211' OR formNum = '7324211S' OR formNum = '7324265' OR formNum
    = '73242891' OR formNum = '732434341' OR formNum = '732434342' OR
    formNum = '73243435' OR formNum = '73243436' OR formNum =
    '73243439' OR formNum = '73243440' OR formNum = '73243441' OR
    formNum = '73243442' OR formNum = '73243443' OR formNum = '7324359'
    OR formNum = '7324360' OR formNum = '7324370' OR formNum =
    '7324560' OR formNum = '7324959' OR formNum = '7326411ptreg' OR
    formNum = '7326599' OR formNum = '7326600' OR formNum = '7326620'
    OR formNum = '7326707' OR formNum = '7326931' OR formNum =
    '7328410' OR formNum = '732851031TOP' OR formNum = '7328512' OR
    formNum = '7328548' OR formNum = '7328548P2' OR formNum =
    '7328548P3' OR formNum = '7328548P4' OR formNum = '73289400' OR
    formNum = '73290D' OR formNum = '7329154' OR formNum =
    '73291544JHS' OR formNum = '73291545JHS' OR formNum =
    '73291546JHSMH' OR formNum = '73291547JHSMH' OR formNum = '7329174'
    OR formNum = '7329308' OR formNum = '7329402' OR formNum =
    '7329424' OR formNum = '7329455' OR formNum = '7329520' OR formNum
    = '7329539' OR formNum = '73297701JH' OR formNum = '73298273' OR
    formNum = '73298400' OR formNum = '73298403' OR formNum =
    '73298404' OR formNum = '7329883' OR formNum = '73298860' OR
    formNum = '7329887' OR formNum = '73298974' OR formNum = '7329899'
    OR formNum = '7329899S' OR formNum = '73299190' OR formNum =
    '7329987' OR formNum = '7329999PTO' OR formNum = '732AV5160' OR
    formNum = '732CMHFRAZ' OR formNum = '732HIPAA' OR formNum =
    '732HIPAAFLYERS' OR formNum = '734HEART' OR formNum = '7444711' OR
    formNum = '7449230' OR formNum = '744HR4991' OR formNum =
    '7538014MI' OR formNum = '77511044' OR formNum = '77511045' OR
    formNum = '775stampnochange' OR formNum = '80851001BLUE' OR formNum
    = '80MR4200' OR formNum = '80MR4273' OR formNum = '80MR4274' OR
    formNum = '80MR4300' OR formNum = '80MR9934' OR formNum =
    '80MR9935' OR formNum = '80SHC100' OR formNum = '80SHC4301' OR
    formNum = '80SHC9830' OR formNum = '80SHC9832') ORDER BY
    tblForms.formNum, tblForms.formCustNum

    AWFrueh1808 wrote:
    > OK, that's simple enough. But then I'm really confused
    as to why the query in
    > my original post/example didn't work.
    >
    > The only single quotes in my #whereClause# variable were
    wrapped around each
    > varchar value in the WHERE clause (well, HAVING) as in
    HAVING formNum = '12345'
    > OR formNum = '54321'
    >
    > I never used a single quote within the value itself. And
    yet
    > preservesinglequotes fixed it. So what was CF doing? Why
    did the single
    > quotes still show up in the error msg - and in the right
    place?
    >
    As I said the default behavior is to escape the quotes in
    your variables
    as data. So the default output of your SQL statement, before
    preserveSingleQuotes() would be like this.
    HAVING formNum = ''12345'' OR formNum = ''54321''
    As you can see that is not the desired results in your case.
    In your
    case you have the proper number of single quotes in your
    string and you
    do not want any added. You want to preserve them so to say.
    Thus
    adding preserveSingleQuotes() around your whereClase
    variable, i.e.
    preserveSingleQuotes(whereClause) says do not add any quotes,
    keep them
    all single.

  • Syntax error in a query

    Hello all
    I have a query, and i got this error , any idea ?
    Error starting at line 1 in command:
    WITH continent_table  AS
    SELECT     en.country,en.continent
            ,ROW_NUMBER() OVER (PARTITION BY en.country ORDER BY en.percent DESC) ran
         FROM     encompasses en
         where ran=1
    select co.name,con.continent,co.population/co.area as pop_density,ec.GDP,pop.Population_Growth,pop.infant_mortality,pol.government
    from country co
    join economy ec
    on co.code=ec.country
    join population pop
    on co.code=pop.country
    join politics pol
    on co.code=pol.country
    join continent_table  con
    on co.code=con.country
    Error at Command Line:6 Column:8
    Error report:
    SQL Error: ORA-00904: "RAN": invalid identifier
    00904. 00000 -  "%s: invalid identifier"
    *Cause:   
    *Action:im using oracle 11g
    thank you in advance
    best,
    david

    >
    So is it still possible to use this selection as a view? because i can run it but i can not use it to create a view
    i think because i have with xx as structure, i don't know
    >
    I don't know either since you didn't post your 4 digit Oracle version. You probably just have an error in your query.
    This works for me using vanilla 11.2.0.1.0:
    create view v_emp as
    WITH q AS
    SELECT empno, deptno, ename
            ,ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY deptno) r_id
        FROM    emp
    q1  AS
    SELECT * from q where r_id < 3
    SELECT * from q1
    select * from v_emp
    EMPNO     DEPTNO     ENAME     R_ID
    7782     10     CLARK     1
    7934     10     MILLER     2
    7369     20     SMITH     1
    7902     20     FORD     2
    7499     30     ALLEN     1
    7521     30     WARD     2

  • Alias a field name in a join query

    I have a database with spaces in the field names (not my fault).
    I am having a problem with the query because one of the fileds I am joining on has a space in its name. See bolded text.
    SELECT *
    FROM employee_passwords
    INNER JOIN employee_general_info
    ON employee_passwords.Employee_ID=employees.[Employee ID]
    WHERE username = '#username#' AND password = '#password#'  
    So I get this error message
    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid object name 'employees.Employee ID'.
    Is there a way to alias the employees.[Employee ID] field?

    Should be
    ON employee_passwords.Employee_ID=employee_general_info.[Employee ID]

  • Join query help

    hi
    i am encountering error like the values not getting populated in internal table though values are in dbtable...so if u can help me out in the join query it will be of gr8 help
    SELECT a1~guid a1~posting_date a1~process_type
           b1~sales_org b1~division b1~dis_channel
           INTO CORRESPONDING FIELDS OF TABLE it_ordel
           FROM ( ( crmd_orderadm_h AS a1 INNER JOIN crmd_link AS c1 ON a1~guid  = c1~guid_hi )
                    INNER JOIN crmd_orgman AS b1 ON c1~guid_hi = b1~guid )
           WHERE c1~objtype_hi = '05'
           AND   c1~objtype_set = '21'.
        AND   a1~process_type IN so_prst
           AND   a1~posting_date IN so_podt
           AND   b1~division     IN so_div.
    thnx

    SELECT a1~guid a1~posting_date a1~process_type
           b1~sales_org b1~division b1~dis_channel
           INTO CORRESPONDING FIELDS OF TABLE it_ordel
           FROM ( ( crmd_orderadm_h AS a1 INNER JOIN crmd_link AS c1 ON a1~guid  = c1~guid_hi )
                    INNER JOIN crmd_orgman AS b1 ON c1~guid_hi = b1~guid )
           WHERE c1~objtype_hi = '05'
           AND   c1~objtype_set = '21'.
        AND   a1~process_type IN so_prst
           AND   a1~posting_date IN so_podt
           AND   b1~division     IN so_div.
    SELECT a1~guid a1~posting_date a1~process_type
           b1~sales_org b1~division b1~dis_channel
           INTO CORRESPONDING FIELDS OF TABLE it_ordel
           FROM ( ( crmd_orderadm_h AS a1 INNER JOIN crmd_link AS c1 ON a1~guid  = c1~guid_hi )
                    INNER JOIN crmd_orgman AS b1 ON c1~guid_hi = b1~guid )
           WHERE c1~objtype_hi = '05'
           AND   c1~objtype_set = '21'    ".              delete that period its wrong
        AND   a1~process_type IN so_prst
           AND   a1~posting_date IN so_podt
           AND   b1~division     IN so_div.

  • Error after upgrade  "Error Executing Database Query.  "

    I have set up a new server with CF MX 6.1. I have moved code
    from a CF 5 server. Now I am getting a lot of errors like this one.
    They all vary somewhat but seem to be related to two things. The
    problems seem to occur with CFINSERT to an access database. I have
    been trying to fix this for some time now and would appreciate any
    input. I have installed both the cf 'service pack' and a hot fix
    that I thought was related directly to this.
    Error Occurred While Processing Request
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    INSERT INTO statement.
    The error occurred in
    C:\Inetpub\vhosts\mysite.com\httpdocs\Ezedit\act_insert.cfm: line
    14
    Called from
    C:\Inetpub\vhosts\mysite.com\httpdocs\Ezedit\index.cfm: line 53
    Called from
    C:\Inetpub\vhosts\mysite.com\httpdocs\Ezedit\act_insert.cfm: line
    14
    Called from
    C:\Inetpub\vhosts\mysite.com\httpdocs\Ezedit\index.cfm: line 53
    12 : <CFELSEIF #ProductScan.Recordcount# IS 0>
    13 :
    14 : <CFINSERT DATASOURCE="mysite" TABLENAME="#Table#"
    username="admin" password="">
    15 :
    16 : <CFQUERY datasource="mysite">
    SQL insert into Products
    (WIDTH,HOTBUY,RETAIL1,REPEAT,HEIGHT,PRODUCTTITLE,JOIN,AJOIN,MATERIAL,OBJECTGROUP_ID,BOOKN AME,OBJECTGROUP_ID2,VJOIN,PRODUCTDESCRIPTION1,LENGTH,SAMPLE,MANUFACTURERPARTNO)
    values ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5)
    , (param 6) , (param 7) , (param 8) , (param 9) , (param 10) ,
    (param 11) , (param 12) , (param 13) , (param 14) , (param 15) ,
    (param 16) , (param 17) )
    DATASOURCE mysite
    VENDORERRORCODE -3502
    SQLSTATE 42000
    Please try the following:

    <CFINSERT DATASOURCE="mysite" TABLENAME="#Table#">
    Probably an error. The tag assumes implicitly that a form has
    been submitted. In fact, one of its attributes is "formfields".
    Since you leave out the attribute, Coldfusion assumes it has to
    insert all the fields of a submitted form. You should put the tag
    within the block
    <cfif isDefined("form.someFormField")>
    </cfif>

  • Error in dmx query for association rules to get list of products likely to be bought next

    Hello
    I have a created and train an association model with the following structure:
    SELECT PredictAssociation( [dbo].[AssociationV] , 5)
    FROM  [Association]
    PREDICTION JOIN
    (SELECT (SELECT 'Road-150 Red' AS [col1]
      UNION SELECT 'Mountain-100' AS [col2]) AS [AssociationV]) AS t
    In this specific example I’m getting this error:
    Executing the query ...
    Parser: The end of the input was reached.
    Execution complete
    Thanks in advance
    Rama

    Try this :
    http://social.technet.microsoft.com/Forums/en-US/38fde948-c7f2-4b40-8777-a283cc5f0d06/parser-the-end-of-the-input-was-reached?forum=ppsmonitoringandanalytics
    http://social.msdn.microsoft.com/Forums/en-US/64fa39b9-9c2e-4a3d-a999-c2e9d2d75f00/parser-the-end-of-the-input-was-reached-msmgdsrv

  • MV Incremental Refresh on join query of remote database tables

    Hi,
    I am trying to create a MV with incremental refresh option on a join query with 2 tables of remote database.
    Created MV logs on 2 tables in the remote database.
    DROP MATERIALIZED VIEW LOG ON emp;
    CREATE MATERIALIZED VIEW LOG ON emp WITH ROWID;
    DROP MATERIALIZED VIEW LOG ON dept;
    CREATE MATERIALIZED VIEW LOG ON dept WITH ROWID;
    Now, trying to create the MV,
    CREATE MATERIALIZED VIEW mv_emp_dept
    BUILD IMMEDIATE
    REFRESH FAST
    START WITH SYSDATE
    NEXT SYSDATE1/(24*15)+
    WITH PRIMARY KEY
    AS
    SELECT e.ename, e.job, d.dname FROM emp@remote_db e,dept@remote_db d
    WHERE e.deptno=d.deptno
    AND e.sal>800;
    Getting ORA-12052 error.
    Can you please help me.
    Thanks,
    Anjan

    Primary Key is on EMPNO for EMP table and DEPTNO for DEPT table.
    Actually, I have been asked to do an feasibility test whether incremental refresh can be performed on MV with join query of 2 remote database tables.
    I've tried with all combinations of ROWID and PRIMARY KEY, but getting different errors. From different links, I found that it's possible, but cannot create any successful testcase anyway.
    It will be very much helpful if you can correct my example or tell me the restrictions in this case.
    Thanks,
    Anjan

  • Join query problem

    Hi all,
    I'm new to Berkeley DB and apologise if the answer to my question has been covered elsewhere.
    I've been using the 'Getting Started Guide' (BerkeleyDB-Core-Cxx-GSG.pdf) to familiarise myself with the C++ API. The document has been vastly useful, but it has left me stranded on the subject of join queries. I have used the example in the guide (p 57) carefully to construct my join query between two secondary databases, but I get a segmentation fault that doesn't seem to originate from within my code. The GDB backtrace shows:
    (gdb) backtrace
    #0 0x007fbffb in __db_c_count () from /nfs/acari/dta/bdb/lib/libdb_cxx-4.4.so
    #1 0x00807aef in __db_join_cmp () from /nfs/acari/dta/bdb/lib/libdb_cxx-4.4.so
    #2 0x0013c1af in msort_with_tmp () from /lib/libc.so.6
    #3 0x0013c0a7 in msort_with_tmp () from /lib/libc.so.6
    #4 0x0013c360 in qsort () from /lib/libc.so.6
    #5 0x00806de6 in __db_join () from /nfs/acari/dta/bdb/lib/libdb_cxx-4.4.so
    #6 0x00804384 in __db_join_pp () from /nfs/acari/dta/bdb/lib/libdb_cxx-4.4.so
    #7 0x0079070b in Db::join () from /nfs/acari/dta/bdb/lib/libdb_cxx-4.4.so
    #8 0x0804a9fe in show_join ()
    #9 0x0804a165 in main ()
    The code that I have written to perform the join query looks like:
    int show_join(MyDb &itemnameSDB, MyDb &catnameSDB,
         std::string &itemName, std::string &categoryName)
    std::cout << "Have item : " << itemName << " and category : "
         << categoryName << std::endl;
    // Position cursor at item
    int ret;
    Dbc *item_curs;
    Dbt key, data;
    try {
    itemnameSDB.getDb().cursor(NULL, &item_curs, 0);
    char * c_item = (char *)itemName.c_str();
    key.set_data(c_item);
    key.set_size(strlen(c_item) + 1);
    if ((ret = item_curs->get(&key, &data, DB_SET)) != 0)
         std::cout << "Did not find any records matching item ["
              << c_item << "]" << std::endl;
    catch(DbException &e) {        
    itemnameSDB.getDb().err(e.get_errno(), "Error!");
    } catch(std::exception &e) {
    itemnameSDB.getDb().errx("Error! %s", e.what());
    // Position cursor at category
    Dbc *category_curs;
    try {
    catnameSDB.getDb().cursor(NULL, &category_curs, 0);
    char c_category = (char )categoryName.c_str();
    key.set_data(c_category);
    key.set_size(strlen(c_category) + 1);
    if ((ret = category_curs->get(&key, &data, DB_SET)) != 0)
         std::cout << "Did not find any records matching category ["
              << c_category << "]" << std::endl;
    catch(DbException &e) {        
    catnameSDB.getDb().err(e.get_errno(), "Error!");
    } catch(std::exception &e) {
    catnameSDB.getDb().errx("Error! %s", e.what());
    // Set up an array of cursors ready for the join
    Dbc *carray[3];
    carray[0] = item_curs;
    carray[1] = category_curs;
    carray[3] = NULL;
    // Perform the join
    Dbc *join_curs;
    try {
    if ((ret = itemnameSDB.getDb().join(carray, &join_curs, 0)) != 0)
         std::cout << "Successful query results should go here." << std::endl;
    catch(DbException &e) {        
    itemnameSDB.getDb().err(e.get_errno(), "Error!");
    } catch(std::exception &e) {
    itemnameSDB.getDb().errx("Error! %s", e.what());
    // Iterate through results using the join cursor
    while ((ret = join_curs->get(&key, &data, 0)) == 0)
    std::cout << "Iterating through cursors" << std::endl;
    // If we exited the loop because we ran out of records,
    // then it has completed successfully.
    if (ret == DB_NOTFOUND)
    item_curs->close();
    category_curs->close();
    join_curs->close();
    return(0);
    The seg fault occurs at the line in the final try/catch block where the Db.join() call is made.
    It seems highly likely that I am making a simple mistake due to inexperience (both with Berkeley DB and C++) and am hoping that the problem glares out at someone with deeper knowledge.
    I'm running this under linux if this makes any difference.
    Many thanks for reading this far,
    Dan

    Hi Keith,
    The following test program isn't pretty, but should produce the seg fault that I'm seeing. Much of the code is copy-and-pasted from the C++ API guide. It will need some input data to run - and presumably create the correct error. Save the following as ./small_inventory.txt (this is also just hacked from the guide):
    Oranges#OranfruiRu6Ghr#0.71#451#fruits#TriCounty Produce
    Spinach#SpinvegeVcqXL6#0.11#708#vegetables#TriCounty Produce
    Banana Split#Banadessfif758#11.07#14#desserts#The Baking Pan
    Thanks for your help,
    Dan
    Code follows:
    #include <db_cxx.h>
    #include <iostream>
    #include <fstream>
    #include <cstdlib>
    class InventoryData
    public:
    inline void setPrice(double price) {price_ = price;}
    inline void setQuantity(long quantity) {quantity_ = quantity;}
    inline void setCategory(std::string &category) {category_ = category;}
    inline void setName(std::string &name) {name_ = name;}
    inline void setVendor(std::string &vendor) {vendor_ = vendor;}
    inline void setSKU(std::string &sku) {sku_ = sku;}
    inline double& getPrice() {return(price_);}
    inline long& getQuantity() {return(quantity_);}
    inline std::string& getCategory() {return(category_);}
    inline std::string& getName() {return(name_);}
    inline std::string& getVendor() {return(vendor_);}
    inline std::string& getSKU() {return(sku_);}
    /* Initialize our data members */
    void clear()
    price_ = 0.0;
    quantity_ = 0;
    category_ = "";
    name_ = "";
    vendor_ = "";
    sku_ = "";
    // Default constructor
    InventoryData() { clear(); }
    // Constructor from a void *
    // For use with the data returned from a bdb get
    InventoryData(void *buffer)
    char buf = (char )buffer;
    price_ = *((double *)buf);
    bufLen_ = sizeof(double);
    quantity_ = *((long *)(buf + bufLen_));
    bufLen_ += sizeof(long);
    name_ = buf + bufLen_;
    bufLen_ += name_.size() + 1;
    sku_ = buf + bufLen_;
    bufLen_ += sku_.size() + 1;
    category_ = buf + bufLen_;
    bufLen_ += category_.size() + 1;
    vendor_ = buf + bufLen_;
    bufLen_ += vendor_.size() + 1;
    * Marshalls this classes data members into a single
    * contiguous memory location for the purpose of storing
    * the data in a database.
    char *
    getBuffer()
    // Zero out the buffer
    memset(databuf_, 0, 500);
    * Now pack the data into a single contiguous memory location for
    * storage.
    bufLen_ = 0;
    int dataLen = 0;
         dataLen = sizeof(double);
         memcpy(databuf_, &price_, dataLen);
         bufLen_ += dataLen;
         dataLen = sizeof(long);
         memcpy(databuf_ + bufLen_, &quantity_, dataLen);
         bufLen_ += dataLen;
    packString(databuf_, name_);
    packString(databuf_, sku_);
    packString(databuf_, category_);
    packString(databuf_, vendor_);
    return (databuf_);
    * Returns the size of the buffer. Used for storing
    * the buffer in a database.
    inline size_t getBufferSize() { return (bufLen_); }
    /* Utility function used to show the contents of this class */
    void
    show() {
    std::cout << "\nName: " << name_ << std::endl;
    std::cout << " SKU: " << sku_ << std::endl;
    std::cout << " Price: " << price_ << std::endl;
    std::cout << " Quantity: " << quantity_ << std::endl;
    std::cout << " Category: " << category_ << std::endl;
    std::cout << " Vendor: " << vendor_ << std::endl;
    private:
    * Utility function that appends a char * to the end of
    * the buffer.
    void
    packString(char *buffer, std::string &theString)
    size_t string_size = theString.size() + 1;
    memcpy(buffer+bufLen_, theString.c_str(), string_size);
    bufLen_ += string_size;
    /* Data members */
    std::string category_, name_, vendor_, sku_;
    double price_;
    long quantity_;
    size_t bufLen_;
    char databuf_[500];
    //Forward declarations
    void loadDB(Db &, std::string &);
    int get_item_name(Db dbp, const Dbt pkey, const Dbt pdata, Dbt skey);
    int get_category_name(Db dbp, const Dbt pkey, const Dbt pdata, Dbt skey);
    int show_join(Db &item_index, Db &category_index,
         std::string &itemName, std::string &categoryName);
    int main (){
    Db primary_database(NULL, 0); // Primary
    Db item_index(NULL, 0); // Secondary
    Db category_index(NULL, 0); // Secondary
    // Open the primary database
    primary_database.open(NULL,
                   "inventorydb.db",
                   NULL,
                   DB_BTREE,
                   DB_CREATE,
                   0);
    /* // Setup the secondary to use sorted duplicates.
    // This is often desireable for secondary databases.
    item_index.set_flags(DB_DUPSORT);
    category_index.set_flags(DB_DUPSORT);
    // Open secondary databases
    item_index.open(NULL,
              "itemname.sdb",
              NULL,
              DB_BTREE,
              DB_CREATE,
              0);
    category_index.open(NULL,
              "categoryname.sdb",
              NULL,
              DB_BTREE,
              DB_CREATE,
              0);
    // Associate the primary and the secondary dbs
    primary_database.associate(NULL,
                   &item_index,
                   get_item_name,
                   0);
    primary_database.associate(NULL,
                   &category_index,
                   get_category_name,
                   0);
    // Load database
    std::string input_file = "./small_inventory.txt";
    try {
    loadDB(primary_database, input_file);
    } catch(DbException &e) {
    std::cerr << "Error loading databases. " << std::endl;
    std::cerr << e.what() << std::endl;
    return (e.get_errno());
    } catch(std::exception &e) {
    std::cerr << "Error loading databases. " << std::endl;
    std::cerr << e.what() << std::endl;
    return (-1);
    // Perform join query
    std::string itemName = "Spinach";
    std::string categoryName = "vegetables";
    show_join(item_index, category_index, itemName, categoryName);
    // Close dbs
    item_index.close(0);
    category_index.close(0);
    primary_database.close(0);
    return(0);
    } // End main
    // Used to locate the first pound sign (a field delimiter)
    // in the input string.
    size_t
    getNextPound(std::string &theString, std::string &substring)
    size_t pos = theString.find("#");
    substring.assign(theString, 0, pos);
    theString.assign(theString, pos + 1, theString.size());
    return (pos);
    // Loads the contents of the inventory.txt file into a database
    void
    loadDB(Db &inventoryDB, std::string &inventoryFile)
    InventoryData inventoryData;
    std::string substring;
    size_t nextPound;
    std::ifstream inFile(inventoryFile.c_str(), std::ios::in);
    if ( !inFile )
    std::cerr << "Could not open file '" << inventoryFile
    << "'. Giving up." << std::endl;
    throw std::exception();
    while (!inFile.eof())
    inventoryData.clear();
    std::string stringBuf;
    std::getline(inFile, stringBuf);
    // Now parse the line
    if (!stringBuf.empty())
    nextPound = getNextPound(stringBuf, substring);
    inventoryData.setName(substring);
    nextPound = getNextPound(stringBuf, substring);
    inventoryData.setSKU(substring);
    nextPound = getNextPound(stringBuf, substring);
    inventoryData.setPrice(strtod(substring.c_str(), 0));
    nextPound = getNextPound(stringBuf, substring);
    inventoryData.setQuantity(strtol(substring.c_str(), 0, 10));
    nextPound = getNextPound(stringBuf, substring);
    inventoryData.setCategory(substring);
    nextPound = getNextPound(stringBuf, substring);
    inventoryData.setVendor(substring);
    void buff = (void )inventoryData.getSKU().c_str();
    size_t size = inventoryData.getSKU().size()+1;
    Dbt key(buff, (u_int32_t)size);
    buff = inventoryData.getBuffer();
    size = inventoryData.getBufferSize();
    Dbt data(buff, (u_int32_t)size);
    inventoryDB.put(NULL, &key, &data, 0);
    inFile.close();
    int
    get_item_name(Db dbp, const Dbt pkey, const Dbt pdata, Dbt skey)
    * First, obtain the buffer location where we placed the item's name. In
    * this example, the item's name is located in the primary data. It is the
    * first string in the buffer after the price (a double) and the quantity
    * (a long).
    u_int32_t offset = sizeof(double) + sizeof(long);
    char itemname = (char )pdata->get_data() + offset;
    // unused
    (void)pkey;
    * If the offset is beyond the end of the data, then there was a problem
    * with the buffer contained in pdata, or there's a programming error in
    * how the buffer is marshalled/unmarshalled. This should never happen!
    if (offset > pdata->get_size()) {
    dbp->errx("get_item_name: buffer sizes do not match!");
    // When we return non-zero, the index record is not added/updated.
    return (-1);
    /* Now set the secondary key's data to be the item name */
    skey->set_data(itemname);
    skey->set_size((u_int32_t)strlen(itemname) + 1);
    return (0);
    int
    get_category_name(Db dbp, const Dbt pkey, const Dbt pdata, Dbt skey)
    * First, obtain the buffer location where we placed the item's name. In
    * this example, the item's name is located in the primary data. It is the
    * first string in the buffer after the price (a double) and the quantity
    * (a long).
    u_int32_t offset = sizeof(double) + sizeof(long);
    char itemname = (char )pdata->get_data() + offset;
    offset += strlen(itemname) + 1;
    char sku = (char )pdata->get_data() + offset;
    offset += strlen(sku) + 1;
    char category = (char )pdata->get_data() + offset;
    // unused
    (void)pkey;
    * If the offset is beyond the end of the data, then there was a problem
    * with the buffer contained in pdata, or there's a programming error in
    * how the buffer is marshalled/unmarshalled. This should never happen!
    if (offset > pdata->get_size()) {
    dbp->errx("get_item_name: buffer sizes do not match!");
    // When we return non-zero, the index record is not added/updated.
    return (-1);
    /* Now set the secondary key's data to be the item name */
    skey->set_data(category);
    skey->set_size((u_int32_t)strlen(category) + 1);
    return (0);
    int
    show_join(Db &itemnameSDB, Db &catnameSDB,
         std::string &itemName, std::string &categoryName)
    std::cout << "Have item : " << itemName << " and category : "
         << categoryName << std::endl;
    // Position cursor at item
    int ret;
    Dbc *item_curs;
    Dbt key, data;
    try {
    itemnameSDB.cursor(NULL, &item_curs, 0);
    char * c_item = (char *)itemName.c_str();
    key.set_data(c_item);
    key.set_size(strlen(c_item) + 1);
    if ((ret = item_curs->get(&key, &data, DB_SET)) != 0)
         std::cout << "Did not find any records matching item ["
              << c_item << "]" << std::endl;
    // while (ret != DB_NOTFOUND)
    //      printf("Database record --\n");
    //     std::cout << "Key : " << (char *)key.get_data() << std::endl;
    //      ret = item_curs->get(&key, &data, DB_NEXT_DUP);
    catch(DbException &e) {        
    itemnameSDB.err(e.get_errno(), "Error!");
    } catch(std::exception &e) {
    itemnameSDB.errx("Error! %s", e.what());
    // Position cursor at category
    Dbc *category_curs;
    try {
    catnameSDB.cursor(NULL, &category_curs, 0);
    char c_category = (char )categoryName.c_str();
    key.set_data(c_category);
    key.set_size(strlen(c_category) + 1);
    if ((ret = category_curs->get(&key, &data, DB_SET)) != 0)
         std::cout << "Did not find any records matching category ["
              << c_category << "]" << std::endl;
    //!! Debug, print everything
    // Dbt temp_key, temp_data;
    // while ((ret = category_curs->get(&temp_key, &temp_data, DB_NEXT)) == 0) {        
    // std::cout << "Key : " << (char *)temp_key.get_data() << std::endl;
    catch(DbException &e) {        
    catnameSDB.err(e.get_errno(), "Error!");
    } catch(std::exception &e) {
    catnameSDB.errx("Error! %s", e.what());
    // Set up an array of cursors ready for the join
    Dbc *carray[3];
    carray[0] = item_curs;
    carray[1] = category_curs;
    carray[3] = NULL;
    // Perform the join
    Dbc *join_curs;
    try {
    if ((ret = itemnameSDB.join(carray, &join_curs, 0)) != 0)
         std::cout << "Successful query results should go here." << std::endl;
    catch(DbException &e) {        
    itemnameSDB.err(e.get_errno(), "Error[3]!");
    } catch(std::exception &e) {
    itemnameSDB.errx("Error! %s", e.what());
    // Iterate through results using the join cursor
    while ((ret = join_curs->get(&key, &data, 0)) == 0)
    std::cout << "Iterating through cursors" << std::endl;
    // If we exited the loop because we ran out of records,
    // then it has completed successfully.
    if (ret == DB_NOTFOUND)
    item_curs->close();
    category_curs->close();
    join_curs->close();
    return(0);
    }

  • Can i join a list in sub-site using Join query?

    Hi all,
    I'm newbie and i have tried to join a list in parent site with a list in sub-site using Join query but i always get the error. How can i do this action? Thanks!

    You could try using SPSiteDataQuery or a DataTable.
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery%28v=office.14%29.aspx
    http://sharepoint.stackexchange.com/questions/75713/is-it-possible-to-populate-result-by-joining-two-lists-throughout-the-site-colle
    --Cheers

  • How to get Hierarchical XML File from a Database Join Query !

    Hi,
    How can i get a Hierarchical XML File from a Database Join Query ?
    Any join query returns repeated values as below:
    BD17:SQL>select d.dname, e.ename, e.sal
    2 from dept d
    3 natural join
    4 emp e
    5 /
    DNAME ENAME SAL
    ACCOUNTING CLARK 2450
    ACCOUNTING KING 5000
    ACCOUNTING MILLER 1300
    RESEARCH SMITH 800
    RESEARCH ADAMS 1100
    RESEARCH FORD 3000
    RESEARCH SCOTT 3000
    RESEARCH JONES 2975
    SALES ALLEN 1600
    SALES BLAKE 2850
    SALES MARTIN 1250
    SALES JAMES 950
    SALES TURNER 1500
    SALES WARD 1250
    14 rows selected.
    We tried use DBMS_XMLQUERY to generate a xml file, but it was unable to get xml in Hierarchical format.
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <ROWSET>
    - <ROW num="1">
    <DNAME>ACCOUNTING</DNAME>
    <ENAME>CLARK</ENAME>
    <SAL>2450</SAL>
    </ROW>
    - <ROW num="2">
    <DNAME>ACCOUNTING</DNAME>
    <ENAME>KING</ENAME>
    <SAL>5000</SAL>
    </ROW>
    - <ROW num="3">
    <DNAME>ACCOUNTING</DNAME>
    <ENAME>MILLER</ENAME>
    <SAL>1300</SAL>
    </ROW>
    - <ROW num="4">
    <DNAME>RESEARCH</DNAME>
    <ENAME>SMITH</ENAME>
    <SAL>800</SAL>
    </ROW>
    - <ROW num="5">
    <DNAME>RESEARCH</DNAME>
    <ENAME>ADAMS</ENAME>
    <SAL>1100</SAL>
    </ROW>
    - <ROW num="6">
    <DNAME>RESEARCH</DNAME>
    <ENAME>FORD</ENAME>
    <SAL>3000</SAL>
    </ROW>
    - <ROW num="7">
    <DNAME>RESEARCH</DNAME>
    <ENAME>SCOTT</ENAME>
    <SAL>3000</SAL>
    </ROW>
    - <ROW num="8">
    <DNAME>RESEARCH</DNAME>
    <ENAME>JONES</ENAME>
    <SAL>2975</SAL>
    </ROW>
    - <ROW num="9">
    <DNAME>SALES</DNAME>
    <ENAME>ALLEN</ENAME>
    <SAL>1600</SAL>
    </ROW>
    - <ROW num="10">
    <DNAME>SALES</DNAME>
    <ENAME>BLAKE</ENAME>
    <SAL>2850</SAL>
    </ROW>
    - <ROW num="11">
    <DNAME>SALES</DNAME>
    <ENAME>MARTIN</ENAME>
    <SAL>1250</SAL>
    </ROW>
    - <ROW num="12">
    <DNAME>SALES</DNAME>
    <ENAME>JAMES</ENAME>
    <SAL>950</SAL>
    </ROW>
    - <ROW num="13">
    <DNAME>SALES</DNAME>
    <ENAME>TURNER</ENAME>
    <SAL>1500</SAL>
    </ROW>
    - <ROW num="14">
    <DNAME>SALES</DNAME>
    <ENAME>WARD</ENAME>
    <SAL>1250</SAL>
    </ROW>
    </ROWSET>
    Thank you for some help.
    Nelson Alberti

    Hi,
    I wrote a general ABAP program which can be configured to grab contrent from an URL and post that content as a new PI message into the integration adapter .... from that point on normal PI configuration can be used to route it to anywhere ...
    It can be easily scheduled as a background job to grab content on a daily basis etc ...
    Regards,
    Steven

  • Deciphering column names in a join query using jdbc

    hi all....
    I am making a database adapter for a generic report generater. This adapter would be forming queries involing various tables. There are two ways of doing it . I fire an sql on parent table to get the keys and then go to child table for each one of them or i form a join query to get desired result.
    i want to go with the later approach where my query would be forming a join. The problem comes when table involved in this join has columns with the same name. for eg if a column "NOTE" is there in table A as well as table B on which i have a join. Resultset returns me with two "NOTE" columns and i cannot recognize which one belongs to which table.
    all API calls including getString("Note") seems to be referring to the first occurence of "Note" column.
    Also getTableName() and getSchemaName() APIs on resultsetMetadata doesnt return in anything in case of joins.
    Any pointers would be most appreciated.
    cheers
    vivek

    thanks for suggesting this solution ... though i had thought of the same onece .... unfortunately i cannot implement something like this coz out of the result set i have to instantiate an object hierarchy depending on the schema ....
    this also puts me in a doubt whether i can use join in my case.
    for eg ... .
    lets say we have a customer talbe and and address table which has one to many relationship .... one contact can have multiple addresses.
    Assuming a contanct "Joe Bloggs" having 3 addresses ...a query like following
    select contact.firstname contactfirstname , address.streetname addressstreetname from contact , address where contact.contactid = address.contactid
    this would return me 3 rows and i can also recognize various columns with their aliases ..
    but i would lose an important fact that i have to create one java object for contact class and 3 instances for addresses which i have to return finally.
    this means that i would like to return an object hierarchy with one contact object and 3 address object underneath it linked with contactid.
    Any other suggestions after reading the complete requirement are most welcome ...sorry for not puting the entire thing at first.
    i guess the only soln left is to visit contact and address table separately. :(

  • Web Analysis Error -- Error while executing query and retrieving data

    Regarding Web Analysis:
    We have a number of reports that we created. yesterday they were all working fine. today we try to open them and most are generating an error.
    The error is:
    Error while executing query and retrieving data.; nested exception is:
    com.hyperion.ap.APException: [1033] Native:
    1013033[Thu Oct 22 09:08:17
    2009]server name/application name/database name/user name/Error91013033)
    ReportWriter exit abnormally
    Does anyone have any insight into what is going on?
    My version information is:
    Hyperion System 9 BI+ Analytic Administration Services 9.3.0.1.1 Build 2
    Web Analysis 9.3.0.0.0.286
    Thanks in advance for your help.
    DaveW

    Hi,
    And also click on check option by opening the query in Query designer,as Mr . Arun suggested.
    And if you get any error in checking, see the long message(detail).
    With rgds,
    Anil Kumar Sharma .P

  • Error while running query in BI Answer

    Hi All,
    I am getting this error while executing a query in BI Answer.
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1114, message: ORA-01114: IO error writing block to file %s (block # %s) at OCI call OCIStmtExecute
    Do anyone have any idea about this error. The query was running and i was able to see the output but suddenly it throws this error.
    Awaiting for response.
    Thanks
    Ashok

    Its an Oracle database error, possibly caused because your file system has filled up, or because the disk device is no longer available. Possibly caused by a Sort operation on your query causing the TEMP segment to auto extend and fill up the filesystem, but I'm guessing at the last bit.
    You need to contact your DBA to investigate further.
    Edited by: Matt T on Dec 16, 2008 10:38 AM

Maybe you are looking for

  • Oracle Calendar not showing in Outlook

    I have tried installing both 9.0.4.2 and 10.1.2.08 on this machine with the same issue. Product installs just fine, or at appears so, but when you open Outlook (2003) and go to the Calendar, there is no option for Oracle Calendar. When 9.0.4.2 was in

  • Populating a PDF programmatically

    We have a VB6 application from which we wish to programmatically distribute PDF documents. Before distributing the document we need to pre-populate certain fields so that we can identify the document when it is returned. The document needs to be save

  • URGENT - please help (externalInterface usage if Flash is an asset)

    Hi! Old 'liveConnect' object is ot working in Firefox. This renders using 'EvalScript()' JavaScript function useless while communicating from browser to embedded Macromedia Shockwave (Director not Flash !) movie. Seems the only solution for this prob

  • Copy AppSet failed

    Hi, I am trying to copy an Application Set but when the process goes to the "Copy database" step I have the following error message: bold Error message: MODIFY FILE failed. File "NewELAMA_lo' does not exist. MODIFY FILE failed. File 'NewELAM' does no

  • Giving JAVA(nullpointException) error while viewing offering details

    Hi, I have created the offering uing API (OTA_OFFERING_API). It got created successfully, but while viewing newly created offering's details from Apllication it is giving a java error as below. Please suggest if any setup or role is needed or it is t