New to Discoverer have join/query question

I have the following query; I am trying to import it but when I do, discoverer only brings in one of the two OUTAGE_FACTOR fields. Can I not just import this? I have the other joins set up ie fiscal year, plan id and unit. Do I need to set up the outer joins in the business area first? I'm assuming that is why it is not importing both fields.
SELECT prev_y.OUTAGE_FACTOR LY,
curr_y.OUTAGE_FACTOR FYTD,
outage.unit_nme,
outage.jul,
outage.aug,
outage.sep,
outage.oct,
outage.nov,
outage.dec,
outage.jan,
outage.feb,
outage.mar,
outage.apr,
outage.may,
outage.jun
FROM OUTAGE_MONTH_MX outage, OUTAGE_YEAR_MV curr_y, OUTAGE_YEAR_MV prev_y WHERE outage.l_year_fiscal_year = 2006 and outage.plant_id = 'FPP' and outage.l_year_fiscal_year = curr_y.L_YEAR_FISCAL_YEAR and outage.plant_id = curr_y.PLANT_ID and
outage.UNIT_NME = curr_y.UNIT_NME and outage.l_year_fiscal_year - 1 = prev_y.L_YEAR_FISCAL_YEAR(+) and outage.plant_id = prev_y.PLANT_ID(+) and
outage.UNIT_NME = prev_y.UNIT_NME(+)

Disco is also stripping the outer joins when I import the sql.
From sql inspector:
SELECT O100494.UNIT_NME, O100494.JUL, O100494.AUG, O100494.SEP, O100494.OCT, O100494.NOV, O100494.DEC, O100494.JAN, O100494.FEB, O100494.MAR, O100494.APR, O100494.MAY, O100494.JUN, O100535.OUTAGE_FACTOR
FROM STAR.OUTAGE_MONTH_MX O100494, STAR.OUTAGE_YEAR_MV O100535
WHERE ( ( O100494.L_YEAR_FISCAL_YEAR = O100535.L_YEAR_FISCAL_YEAR ) AND ( O100494.PLANT_ID = O100535.PLANT_ID ) ) AND ( O100494.UNIT_NME = O100535.UNIT_NME ) AND ( O100494.PLANT_ID = O100535.PLANT_ID ) AND ( O100494.L_YEAR_FISCAL_YEAR-1 = O100535.L_YEAR_FISCAL_YEAR ) AND ( O100494.UNIT_NME = O100535.UNIT_NME ) AND ( O100494.PLANT_ID = 'FPP' ) AND ( O100494.L_YEAR_FISCAL_YEAR = 2006 )
;

Similar Messages

  • New mac user have a few questions

    Hi everyone i made the switch to mac today and i have a few questions
    1. How easy is it for me to update the Nvidia graphics drivers when Nvidia releases them ?
    2. Should i bother with Antivirus software ?
    3. what are some good sites for wallpapers and stuff - (wants to make his make look good)
    4. Any tips for a new mac user please feel free
    thank you for your time and help
    mike

    Hi mike and welcome to Discussions and the world of Apple,
    4) have a read/look at the following for a better feeling for your Mac
    http://www.apple.com/support/mac101/
    http://www.apple.com/support/switch101/
    http://www.apple.com/findouthow/mac/
    Was a 'switcher' myself 4 years back and learned alot from them.
    Regards
    Stefan

  • Left Join Query Question

    Version 10.2.0.4.0
    I have a question on the expected behavior of the query below.
    When I run the query below with the constraint on t1.partid = 789,  I get the query result t2.Indicator showing "SPECIAL" as expected.
    However, if I remove the constraint, and return all orders and parts, for the "789" part, the Indicator column is null.
    select t1.orderid, t1.partid, t2.Indicator
    from Orders a left outer join
    select partid, 'SPECIAL' as Indicator
    from vendors
    where vendorname like '%ABC%'
    ) t2
    on t1.partid = t2.partid
    where t1.partid = '789'
    I can address the issue with a case statement (below) or likely restructuring into a better statement. 
    But I'm just curious if this is expected or if there is some SQL rule being violated in the first example.
    I tried to search for this to see if it was already addressed but didn't have much luck.
    This works:
    select t1.orderid, t1.partid,
    case when t1.partid is not null then "SPECIAL" else null end as Indicator
    from Orders a left outer join
    select partid, 'SPECIAL' as Indicator
    from vendors
    where vendorname like '%ABC%'
    ) t2
    on t1.partid = t2.partid

    Sorry, it's been a while since I posted and should have read the rules.  And I didn't properly reference the alias.  So Post #1 was bad. 
    When I mockup a small set of data (shown below), I don't get the error.  The original query actually joins to a few other (seemingly) irrelevant tables and I tried to simplify it here  So I guess if I can't replicate it, then there might not be much assistance that can be provided.
    This was more of a curiousity than anything else to see if perhaps someone came across this before.
    For what it's worth:
    create table t1 (orderid number,
                 partid varchar2(20)
    create table t2
            (vendorid varchar2(20),
             partid varchar2(20)
    insert into t1 values(1, '123');
    insert into t1 values(2, '456');
    insert into t1 values(3, '789');
    insert into t2 values ('ABC','789');
    insert into t2 values ('DEF','123');
    insert into t2 values ('EFG','456');
    insert into t2 values ('ABC','7891');
    insert into t2 values ('DEF','1231');
    insert into t2 values ('EFG','4561');
    select t1.orderid, t1.partid, t2.Indicator
    from t1 left outer join
    select partid, 'SPECIAL' as Indicator
    from t2
    where vendorid like '%ABC%'
    ) t2
    on t1.partid = t2.partid
    the query that gives unexpected behavior is (although I can't replicate on this simplified version):
    select t1.orderid, t1.partid, t2.Indicator
    from t1 left outer join
    select partid, 'SPECIAL' as Indicator
    from t2
    where vendorid like '%ABC%'
    ) t2
    on t1.partid = t2.partid

  • New to IPhone and have a few Questions?

    To start I want to say that I am a long time (25+ years) veteran of technology but am new the the IPhone. My IPhone is not Jailbroken and would like to keep it that way if I can. Allthgouh I did jailbrake it with blackra1n for about 30mins then I did a factory reload and let it be as it started acting stupid once I started installing apps from unofficial sources.;) Im a x86 nerd and NOT a MAC guy. I haven't sat down at a MAC/Apple in about 15/20 years.
    I just got my first IPhone 3Gs/16GB. (Coming from a BlackBerry Curve 8310) the other day and although it is taking some time getting used to, I think I will like it more then I do once I get used to it.
    Anyhow I have a few questions to start off with. I did some googleing already but just want to make sure I understand a few things.
    All though I did the BlackRa1n jail break thing and installed a few apps then it locked up and failed to turn on or something so I did the whole reload from itunes and now its all good. Anyhow.....
    1.) It appears as if one can not run a program from the home sreen and have it run in the background while doing other things? Take the many SIP Clients I have played with in the last 48 hours. Once I open the SIP Client and connect if I hit the physical button below the screen the program closes, thus the sip client no longer works. Pretty much most if not all apps iv installed from the App Store act like this. Is this the case? Does the IPhone not mutitask at all or verywell?
    2.) Are there any SIP Clients that work over 3G? All the ones iv tried say they are for WIFI only. The SIP Clients work fine when on WIFI. It sounds like this is Apples way of controlling/monopolizing the voice/data/voip aspect of the platform/device. Im sure they would lose a lot of money if everyone did what I am trying to do.Just my opinion.
    3.) Maybe I play with it to much but **** the battery dies fast. Is there anyway to optimize the battery at all other then for me not to use it as much?
    4.) How can I remote lock it if I lose it or it gets stolen? I read somewhere this could be done.
    5.) Are there any other Shells/HomeScreens/Themes that can replace the standard 4x4x4 row icons?
    6.) The speaker phone (when on a call) seems kinda low even when turned all the way up. Is there any way to make it louder?
    7.) I am using the built in VPN client to connect to my works PPTP Windows 2003 VPN server but the client randomly disconnects through out the day. Is there any way to have some type of keep alive set or are there any other VPN Clients that I can use?
    Sorry for all this just thought I would ask for feedback.
    Many thanks for any help anyone can provide,
    SomeOneOnLine

    1.) It appears as if one can not run a program from the home sreen and have it run in the background while doing other things? Does the IPhone not mutitask at all or verywell?
    The iPhone SDK does not permit ANY 3rd party apps from running in the background or multitasking. It does provide for push notifications which can simulate certain background activity in terms of receiving external notifications while the app is actually closed. This works reasonably well with IM apps, news, sports, weather, travel updates and some peer-to-peer games.
    2.) Are there any SIP Clients that work over 3G? All the ones iv tried say they are for WIFI only.
    Just how would the SIP server connect to the cell carrier 3G network? Do you know of ANY that do??
    3.) Maybe I play with it to much but **** the battery dies fast. Is there anyway to optimize the battery at all other then for me not to use it as much?
    3G voice and data connections are culprits. Avoid email push and frequent fetching. See this Apple article for detailed suggestions.
    http://www.apple.com/batteries/iphone.html
    4.) How can I remote lock it if I lose it or it gets stolen? I read somewhere this could be done.
    MobileMe Find My iPhone will locate, set a passcode lock and optionally wipe all data from your iPhone. You have to be a MobileMe subscriber.
    5.) Are there any other Shells/HomeScreens/Themes that can replace the standard 4x4x4 row icons?
    No. Apple does not permit this.
    6.) The speaker phone (when on a call) seems kinda low even when turned all the way up. Is there any way to make it louder?
    You can troubleshoot your iPhone as described in the User Guide - restart, reset, reset settings, restore. Or, get hearing aids
    7.) I am using the built in VPN client to connect to my works PPTP Windows 2003 VPN server but the client randomly disconnects through out the day. Is there any way to have some type of keep alive set or are there any other VPN Clients that I can use?
    See this Apple support article:
    http://support.apple.com/kb/HT1980
    BTW, discussion of "unauthorized modifications" such as jailbreaking is prohibited under the forum Terms of Use you agreed to when joining. Best not to even mention it or risk getting your post deleted.

  • I have bought a new airport express and using it with my macbook (iTunes 10.2.2). I have joined an existing network for internet in my home and with that i am trying to play the music via itunes but there is audio dropouts every 60 secs or so. any soln ?

    I have bought a new airport express and using it with my macbook (iTunes 10.2.2). I have joined an existing wireless network for internet in my home and with that i am trying to play the music via itunes but there is audio dropouts every 60 secs or so. I am using a set of speakers from kenwood connected to the airport express. The operating system on my macbook is mac os X 10.5.8. i am sure it is not a problem of streaming music online because i have even tried playing music which are stored in my macbook.
    Is there any problem with the setting in itunes or quicktime ? Kindly reply...... I am waiting for your valuable suggestion.
    Thank you a lot in advance.

    I am shocked to have found this same AX audio dropout problem starting TODAY, every few seconds the audio just drops for a couple seconds and then resumes:  Latest software versions of everything.  No iPad, iPhone or Touch.  Internet hardwired to D-Link DES1105 (1000baseT Switch) hardwired to new 80211N AX, AX optical to stereo, AX Wi-Fi internet to basic 1st-gen MacBook operating at 80211G, and an older 'G' AX extender at the far end of the house, away from all this.  The MacBook streaming iTunes is usually 12 feet from AX.  I've used this setup for years of trouble-free AirTunes / Airplay until today.  Today I also found 2 very reliable fixes and 1 way to force a dropout, but first, I read some posts and tried ALL following settings one-at-a-time and restored them ALL because NONE of them helped:  Turned off IPV6.  Streamed to multiple speakers 'Computer' and 'AX' (restored to just AX).  Turned off 'Ask to Join new (WiFi) Networks'.  Turned off Bluetooth (can't live without Magic Trackpad, so glad that wasn't it).  Here's my discoveries:  Lo and behold, each time I click the Airport icon in the Menu (you know it shows you've got 4 bars from AX) when the status switches to 'Looking for Networks' for a second it CAUSES the AX audio to drop out for a couple seconds (it never did that before today.)  iTunes still playing, streaming, AX laser still lit, but the 'PCM' light on stereo and the sound GOES OUT EVERY time I click the Airport icon in the menubar, just like the regular, annoying dropouts.  So, to reduce traffic I quit Safari (3 tabs, no streaming, just Gmail, Google, and Netflix browsing).  Lo and behold, the dropouts stopped altogether.  No other Web apps going (not iTunes Store, Genius, Ping, nothing), so I launched Chrome to the same 3 tabs and the dropouts HAVE NOT RETURNED.  That's right, not only did simply QUITTING SAFARI cure it, and Chrome doesn't contribute to it, but I can demonstrate it just by forcing my Airport to re-scan.  Works for me, written using Chrome.  The other reliable fix is to hardwire MacBook to the Switch.  This is obviously not ideal, but Airplay audio doesn't drop out over Ethernet.  Also, in all my tests, it made no difference whether iTunes did the streaming, or Airfoil did.

  • I just got a new iPad 2 and I have lot of questions. I was able to wirelessly link my iPad and iTunes on my PC. I was able to SYNC my email and calendar (new only no history), however I have not been able to SYNC Outlook contacts.

    I just got a new iPad 2 and I have lot of questions. I was able to wirelessly link my iPad and iTunes on my PC. I was able to SYNC my email and calendar (new entries only no history), however I have not been able to SYNC Outlook contacts. Outlook has multiple contact lists. Only one has any data. I can't find a way to delete the others and I can't keep the one I want to use at the top of the list. Any ideas?
    I have a question about email. I have several thousand emails in 10 or so days. How can I select multiple emails for deletion in stead of one at a time? How do I designate emails from a given sender as junk or block certain senders?
    Ron

    the spcs page on this site state which video formats the ipad supports
    I'd suggest converting your old videos to one of those formats
    handbrake is a free program which does this for you
    itunes used to be able to too when I right clicked incompatible media but don't see the option any more
    or maybe it only show when one right click incompatible media and currently my lib don't have any
    about the music then it's odd what formats are they?
    if they are acc protected have you tried to remove the DRM this can be don using itunes as
    apple don't use DRM for music any more

  • I currently have an old version of Photoshop Elements, it is version 5.0.  I recently upgraded from my old Windows XP computer to a new Windows 7 computer.  My question is:  Can I install this version 5.0 on my new windows 7 computer without any problems?

    I currently have an old version of Photoshop Elements, it is version 5.0.  I recently upgraded from my old Windows XP computer to a new Windows 7 computer.  My question is:  Can I install this version 5.0 on my new Windows 7 computer without any problems?  my email is:  [email protected]  Thank you!

    Do not know about 5, but, just installed PE 6 on I7 64 bit and it works.

  • I see that i have a problem after installing my new hard drive on my macbook pro mid 2009 version. I put a new hard drive, with all of my information from my old drive installed on it, into the computer. but now have the blinking question mark folder

    i see that i have a problem after installing my new hard drive on my macbook pro mid 2009 version. I put a new hard drive, with all of my information from my old drive installed on it, into the computer. but now have the blinking question mark folder. I see that it means that it isn't reading the new hard drive.
    did i miss a step between transferring all of my information from my old hard drive to the new hard drive and installing the new hard drive into the computer. I believe that i installed properly. it was quite easy.
    thanks for your help

    It means there is no bootable system on the drive. If you still have access to the old drive, then I suggest you boot from it then clone it to the new internal drive. Use OPTION boot to boot from the Recovery HD on the old drive:
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
         1. Select Disk Utility from the main menu then press the Continue
             button.
         2. Select the destination volume from the left side list.
         3. Click on the Restore tab in the DU main window.
         4. Select the destination volume from the left side list and drag it
             to the Destination entry field.
         5. Select the source volume from the left side list and drag it to
             the Source entry field.
         6. Double-check you got it right, then click on the Restore button.
    Source means the external old drive. Destination means the new internal drive.

  • Deafult search engine on a new tab-this thread was closed but I have a related question. Once you put the new url in, what then? Close? When tried, did not work

    "deafult search engine on a new tab" - this thread was closed but I have a related question. [the word “default” is spelled as it on the thread] Once you put the new url in, what then? Close it? When tried, it did not work. The closest answer is noted here. Instructing to go to about:fig. Specifically, I installed the accuweather add=on and it took over my tab home page - the one that comes up when you click for a new tab. I didn't like it so I clicked the button to remove it and the page went blank. I searched to see out to restore the tab page, tired the reply at this page :
    http://support.mozilla.org/en-US/questions/753256?s=install+search+box+on+new+tabs&r=3&as=s
    But it did not work. Can some on help me? Just want to know how to make google or some page open on a new tab.
    Many thanks

    Thanks so much for your support. As I said I am not a professional, so I by chance saw a friend who is and this is what he suggested and it worked.
    We googled for an answer and found this site: http://www.guidingtech.com/8004/have-new-tab-page-open-specific-website-firefox-chrome/
    It says to Download and install Download and install''' NewTabURL''' and gives instructions on how to. Now when I open the tab it goes to my preferred search page!

  • I have just got new wireless fibre broadband for my home network. all my devices have joined fine, except my daughter's iphone 4s. Its just spinning!!!!!

    I have just got new wireless fibre broadband for my home network. all my devices have joined fine, except my daughter's iphone 4s. Its just spinning!!!!! Any ideas?

    Hello Noddy1964,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/ts1398
    Be sure you're in range of your Wi-Fi router (access point).
    Tap Settings > Wi-Fi and turn Wi-Fi off and on. If your Wi-Fi setting is dimmed, follow these steps.
    Restart your iOS device.
    Tap Settings > Wi-Fi and locate the Wi-Fi network to which you're connected.
    Tap and Forget this Network.
    Try to connect to your desired Wi-Fi network.
    Note: You may need to enter your Wi-Fi password again if your network requires one.
    Update your device to the latest version of software.
    Best of luck,
    Mario

  • I have a old firefox account and I cannot sign on too. I made new account just to ask a question. I tried to sign in with old emails, but did not get any reset information back. How can I recover old information?

    I have a old firefox account and I cannot sign on too. I made new account just to ask a question. I tried to sign in with old emails, but did not get any reset information back. How can I recover old information?

    Backing up and restoring your Profile should have included your bookmarks.
    https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles
    https://support.mozilla.org/en-US/kb/recovering-important-data-from-an-old-profile
    That looks like a JSON bookmarks backup file, from 11-01-2012. Did you try '''restoring''' that file?
    https://support.mozilla.org/en-US/kb/restore-bookmarks-from-backup-or-move-them#w_using-a-bookmark-backup-file
    Never messed with JSON files other than viewing them on a few occasions out of curiosity. There are no line breaks which make them very difficult to read.
    As far as working with that file in {like} NotePad goes:
    A. use Find / Search for each indecent of a '''"uri"''' string, then "copy and paste" the uri into another text file, and then move on to the next "uri" string.
    B. use a text program where a filter can be set for the "uri" field in the JSON file for a line break or to "scrape out" the "uri"s only for display or export to a list of uri's.
    Or try using an online JSON editor like this, to try to display only the "uri" field.
    https://www.jsoneditoronline.org/

  • Totally new to external hard drives and have a few questions

    Since beginning my search for an external hard drive this morning I have learned that I know very little about this subject. I really have very little knowledge of all the computer lingo used when looking at these devices. I have a few questions regarding this, if someone could help me.
    1. Are all external hard drives compatible with my mac?
    2. Do I need time machine if I have an external hard drive?
    3. I have two PCs in addition to my mac. Can I use the same external hard drive for all three or would I need a separate one?
    Thanks for helping!

    Use a Firewire not a USB drive.
    I have had many reliability issues, and compatibility issues with USB over the years (starting with the original iMac), right up to the PowerMac G5 and Mac Pro - devices not working properly with hubs, needing to be plugged directly into ports on the computer (even though there aren't enough), etc, etc.
    For me Firewire devices cause fewer of these sorts of problems.
    Firewire is "isochronous", basically meaning that you can pump "clocked" data though it in real time. USB works more like TCPIP, with the data chopped up into packets and later reassembled. (Thus, at a minimum, you have latency, that is, the wait for the data to be "put back together".) Second, the Firewire protocol allows more direct address to memory (including mass storage) with minimal intervention of the CPU.
    No collisions, no glitches. Firewire is rock-solid.

  • New to iOS, have a upload download question

    New to iOS have a 5s, need to download music from websites and files also need to upload files is this possible on iOS devices

    Music on the iPhone is handled through iTunes, either on the computer or on the iPhone itself. You do not have access to the file system on the iPhone to upload files to it. Since you say you are new to the phone, you may want to take a look at this. http://manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf

  • Join Query in Object Oriented Programming

    Hi,
    I am trying to understand better how OO programming should work in CFC context.  For example, I have two database tables: Customer and Order.  So I create two CFCs, one for Customer and another for Order.  In the CFCs I have query functions (select, insert, update) to access and manipulate data in the underlying tables.
    Now, I need to create a new CFC, OrderReport.  This CFC takes in customerID and returns data pulled from both Customer and Order tables.  I can just have a join query that pulls data from these two tables.  However, I have been wondering whether this method is within the spirit of Object Oriented programming.  Should this CFC be able to access directly to the two tables?  Or should I pull data separately using Customer CFC and Order CFC, and join them locally (ie. in OrderReport CFC)?  This latter method would be a lot slower to run than the first method.
    Can you advise me as to what the best practice is in the context of OO programming?  Thank you.

    This is a common question for those new to OO programming. Here are some of
    my thoughts on the topic.
    OO programming has nothing to do with tables. Your tables are essentially a
    relational storage of one part of a business concept. It just so happens
    that most of the data you need to support the business concept of Customer
    and the business concept of Order are stored in tables named Customer and
    Order. This is because database tables often relate to a business concept. I
    think you'd find that to get the entire customer, you'd have to get data
    from other tables, like State and Gender and other such tables.
    The reason why I bring this up is to begin to separate your thinking.
    Databases are concerned with efficient storage and retrieval of data.
    Objects (CFCs) are not concerned at all with storage of data. Objects are
    concerned with encapsulating business logic relating to a business concept.
    Just like your database may have columns not needed by your CFCs, your CFCs
    likely have methods not needed by your database.
    For example, if you wanted to know, in your application, whether to show an
    In Store Pickup option, you may wish to add an isLocal() method to your
    customer object. This would ( we'll pretend) get the customer's zip code,
    and look it up in  GeographicalPostalServiceMapper object to tell us how far
    away the customer is.
    The point is, the right OO (CFC) design has nothing to do with how your
    tables are organized in the database. You would do well to concern yourself
    with the needs of the application and what sort of questions you need your
    customer object to be able to answer to the other parts of your application.
    Like, isLocal(), isOver21(), isBadCreditRisk() and so on.
    As to your question about joins, you would do well to use joins in your
    application. Do not be afraid of using queries to get the information you
    need. Especially for reporting queries. In these cases, I often make an
    object called a xxxList. My CustomerList.cfc would have the different ways
    to list customer data, like CustomerOrders and CustomerOrderReturns. I'd
    hide this join relationship inside of the CustomerList object so only the
    CustomerList object has the SQL. That's usually enough encapsulation for the
    needs of my application.
    Truly, it doesn't matter what the name of the object is, just that you
    assign it the responsibility of managing a business concept and keep that
    business concept inside that object. You seem to have suggested
    CustomerReport.cfc and that would be a fine name for an object that can
    return numerous Customer Reports.
    Happy Coding
    DW

  • 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);
    }

Maybe you are looking for

  • Outbound IDoc setting through ACC_GL_POSTING

    Dear Members, I am willing to post an IDOC ( Msg type : ACC_GL_POSTING or any other) for FI Transaction G/L Posting without using any user exits. Is there any way to post it with standard setting??? Thanks in advance, Audy.

  • Firefox 3.6.8 asks to update each time it is opened

    3.6.8. was installed and now when I open Firefox it wants to update each time. Also after installing 3.6.8 I have had BSOD 3 times times, so I don't allow it to update and so far no more BSOD. Windows 7 ultimate. == This happened == Every time Firefo

  • Changing a document name opens the file

    I was wondering if this was a new issue with Leopard... or just my mouse. In Tiger, if you needed to change the name of a file, or folder on the desktop... or anywhere, you could click, and it would highlight the words to change the name. Now, if you

  • How do I remove a trailing blank page

    This is my first day using Adobe Acrobat Pro.  I was given a document and it last page (page 3) is blank.  How do I remove the blank page. I've look on the internet and it talks about something called "preflight" which I have no idea what that is.  I

  • Cannot install elements 9 on my new computer

    I have just bought a new computer and cannot install my photoshop elements 9 and  premiere elements 9. The program starts to roll back during installation. I have de-installed both programs from my other computer. My old PC is running window xp and m