Data needed from emp and dept tables

Wondering if somebody can querry the emp table and dept table that comes with some versions of oracle already built in.
I need the data produced from these two querries
select * from emp
select * from dept

If you look in ORACLE_HOME/sqlplus/demo you'll find demobld.sql which contains the script the build all the scott tables.

Similar Messages

  • Emp and Dept table from JDeveloper tutorial

    Hi all,
    Under the tutorial for JDeveloper, I was going through the section 'Creating a Java Form Applet Using Wizard'. In one step, it asks to select 'Tables' - 'Emp' and 'Dept', but, the steps prior to that doesn't tell you how to add those tables in the database since I'm using my own database. Does anybody know where I can find the SQLScript to add these tables?
    Regards,
    AR

    The samples are based on the EMP and DEPT tables, which are typically owned by Scott (password tiger). Check first to see if this user exists in the database (it is created automatically when you do a default database creation). Otherwise, you can find the script in ORACLE_HOME\rdbms\admin\scott.sql.
    -- Brian

  • Emp and Dept Table Dropped

    Hi ,
    I have mistakenly altered and dropped the Employee and Department Table.
    Can anybody help me with the Structure and Data of these tables ?
    Or provide me with a procedure to re-create the Emp and Dept table ?
    Thanks,
    Nisha

    Thank you very much !! That really helped.
    You just have to execute that file.
    For Eg in SQLPLUS : Just say ---> @D:\oracle\ora92\sqlplus\demo\demobld.sql

  • How to get emp and dept tables of scott schema if they acdientally deleted

    Hii I accedentally modifiled emp and dept tables in scott schema.... Can you please tell how to recreate fresh emp and dept tables ? is there any way to get emp and dept tables? please help regarding this

    If you are on Oracle 10g version...
    The demo tableds under scott schema can be created using oracle supplied script.
    http://www.oracle.com/technology/sample_code/tech/sql_plus/htdocs/demobld.html
    Alternatively, this script exists in $ORACLE_HOME/sqlplus/demo directory.
    vr,
    Sudhakar B.

  • Emp and Dept tables

    Hi,
    I believe that when the database is installed, a few tables are created which all users have access to, i.e. emp and dept.
    Can anyone explain to me a bit more about where they are stored and particually where I can locate the scripts for these tables.
    Cheers,
    Nick

    run $ORACLE_HOME\sqlplus\demo\demobld.sql as the user in which you want to install these test tables. Historically, this has been in the SCOTT schema.
    HTH-Kevin

  • Fetching data slow from MSEG and BSEG table

    Dear Experts,
    Out  MSEG and BSEG are major tables which are very slow and taking 5-10 minutes in fetching just 20/30 records.
    Why this table taking more time and how I can fatch fast  data from these table.
    regards

    > Out  MSEG and BSEG are major tables which are very slow and taking 5-10 minutes in fetching just 20/30 records.
    > Why this table taking more time and how I can fatch fast  data from these table.
    Do you select on key fields or on indexed fields? How do you select?
    If not, then the database must read the full table and check which of the entries are valid for your selection.
    Do an SQL trace using ST05, run the command, stop the trace and check the explain.
    Markus

  • Data retrieval from proj and prps  tables

    I want to retrieve the data from proj & prps by giving selection parameter as
    project defination (proj-pspid). Please give me an idea about this. Is there any common field i  between these two.
    regards

    Hello,
    Check this:
    *--- Selektion von PSP-Elemente
      SELECT PRPS~PSPNR  PROJ~PSPID  PRPS~POSID  PRPS~POST1
             PRPS~OBJNR  PRPS~PSPHI
         INTO TABLE G_T_PSP
         FROM PRPS
         JOIN PROJ   ON PRPS~PSPHI = PROJ~PSPNR
         WHERE PROJ~PSPID IN SO_PROJ
           AND PROJ~LOEVM EQ SPACE
           AND POSID      IN SO_PSP
           AND PRART      IN SO_PRART
           AND PRPS~LOEVM EQ SPACE
           AND PRPS~PBUKR IN SO_PBUKR.
    Regards,
    Vasanth

  • Data recovery from BSIS and BSAS tables

    Hi all,
    The records in the tables BSIS and BSAS are deleted due to adhoc circumstances.
    How do I recover this data in SAP?
    Please help!!!
    Thanks,
    Raghav

    Hello Raghav,
    two possibilities without a complete restore (in a standard SAP environment):
    1) Flashback Query (but it only works if your UNDO tablespace still contains all the data - parameter undo_retention):
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_flashback.htm#ADFNS01003
    2) LogMiner
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/logminer.htm#i1005553
    Regards
    Stefan

  • Problem in Selecting the data from EKPO and KONV tables

    Hi Experts,
    Presently I am working on Report with Comparision-Sheet Between the vendor's Quotations. I have to display the Discount, Freight, Packing and Forwarding, Vat in Item level data based on the conditions made in PO.
    As per my Knowledge, Condition Types are stored in KONV Table. But there is no relation between KONV and EKPO tables.  So, I am unable to print the data for Discount, Freight, Packing and Forwarding, Vat... How can I get the values from EKPO and KONV tables?
    Thanks in Advance.
    Thanks n Regards,
    Muralikrishna.

    Don't recall if this is correct, but you may need the condition number from the header (EKKO) combined with EKPO-EBELP or other field as you key to access KONV (KNUMH and KPOSN).  My site doesn't run PP, so can't verify if the data is actually stored that, so just a possibility.

  • How To UPLOAD a DATA (.DAT) fiel from PC to internal table and then split it into the data different columns

    Hi all,
    I am new to ABAP Development. I need to upload a .DAT file (the file doesn#t have any proper structure-- Please find the .DAT file in the attachment). After uploading the DATA (.DAT) fiel I need to split in into different columns. Refering the attached .DAT fiel the fields in bracets like:
    [Arbeitstag],  [Pecunia], [Mita], [Kunde], [Auftrag] and  [Position] are different fields that need to be arranged in columns in an internal table. this .DAT fiel which I want to upload and then SPLIT it into various fields will will treated as MASTER DATA table for further programming. The program that I had written is as below. Also please refer the attached .DAT table.
    Please if any one could help me. i searched a lot in different forums but couldn't find me  a solution. Also note that the attached fiel is in text (.txt) format here but in real situation the same fiel is in DATA (.DAT) format.
    *& Report  ZDEMO_ZEITERFASSUNG9
    REPORT  ZDEMO_ZEITERFASSUNG9.
    Types: Begin of ttab,
            Rec(1000) type c,
           End of ttab.
    DATA: itab  type table of ttab.
    DATA: wa_tab type ttab.
    DATA: file_str type string.
    Parameters: p_file type localfile.
    At selection-screen on value-request for p_file.
                                           CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
                                            EXPORTING
    *                                          PROGRAM_NAME        = SYST-REPID
    *                                          DYNPRO_NUMBER       = SYST-DYNNR
    *                                          FIELD_NAME          = ' '
                                               STATIC              = 'X'
    *                                          MASK                = ' '
                                             CHANGING
                                               file_name           = p_file.
    *                                        EXCEPTIONS
    *                                          MASK_TOO_LONG       = 1
    *                                          OTHERS              = 2
    Start-of-Selection.
      file_str = P_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = '\\10.10.1.92\Volume_1\_projekte\Zeiterfassung-SAP\BUP_ZEIT.DAT'   " This the file  source address
          FILETYPE                      = 'DAT'
          HAS_FIELD_SEPARATOR           = ';'
    *     HEADER_LENGTH                 = 0
    *     READ_BY_LINE                  = 'X'
    *     DAT_MODE                      = ' '
    *     CODEPAGE                      = ' '
    *     IGNORE_CERR                   = ABAP_TRUE
    *     REPLACEMENT                   = '#'
    *     CHECK_BOM                     = ' '
    *     VIRUS_SCAN_PROFILE            =
    *     NO_AUTH_CHECK                 = ' '
    *   IMPORTING
    *     FILELENGTH                    =
    *     HEADER                        =
        tables
          data_tab                      = itab
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4
         INVALID_TYPE                  = 5
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      LOOP at itab into wa_tab.
            WRITE: / wa_tab.
      ENDLOOP.
    I will be grateful to all you experts for ur inputs
    regards
    Chandan Singh

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • BAPI FOR Deleting a Schedule Line Item from EKES and EKET tables

    Dear All,
    I would like to for deleting one of the line item from EKES (Po Confirmation ) and the respective line item from the EKET(PO Schedule Line Item Table).
    Assume that am allowing the user to select the lineitem from zprogram screen and collecting the PO and Its LIne Item details in an internal table.
    Can i Use
    <b>BAPI_PO_Change</b> , if so , can anybody tell me the steps to follow to use this bapi for deleting the PO lineItems, since i m going to try BAPI for First time.
    pls help me out
    Message was edited by: Raja K.P

    Hi raja ,
    loop at iekko1.
        w_index = sy-tabix.
        item-po_item   = itemx-po_item   = iekko1-ebelp.
        item-quantity  = iekko1-mng01.
        itemx-quantity = iekko1-mng01.
        if iekko1-wamng = iekko1-wemng.
        itemx-no_more_gr = item-no_more_gr = 'X'.
        else.
        itemx-no_more_gr = item-no_more_gr = ''.
        endif.
        append item.
        append itemx.
          clear return[].
          call function 'BAPI_PO_CHANGE'
               exporting
                    purchaseorder = iekko1-ebeln
               tables
                    return        = return
                    poitem        = item
                    poitemx       = itemx.
          if return[] is initial.
          commit work and wait.
          call function 'DEQUEUE_ALL'.
    search for deletion fields which u have to mark 'X'.
    before calling  this BAPi u have to lock the PO by using ENQUEUE.
    <b>
    FU BAPI_PO_CHANGE
    Text
    Change purchase order
    Functionality
    Function module BAPI_PO_CHANGE enables you to change purchase orders. The Change method uses the technology behind the online transaction ME22N.
    Alternatively, the IDoc type PORDCH1 is available. The data from this IDoc populates the interface parameters of the function module BAPI_PO_CHANGE.
    Functionality in Detail
    Authorization
    When you create (activity 02) an Enjoy purchase order, the following authorization objects are checked:
    M_BEST_BSA (document type in PO)
    M_BEST_EKG (purchasing group in PO)
    M_BEST_EKO (purchasing organization in PO)
    M_BEST_WRK (plant in PO)
    Controlling adoption of field values via X bar
    For most tables, you can use your own parameters in the associated X bar (e.g. PoItemX) to determine whether fields are to be set initial, values inserted via the interface, or default values adopted from Customizing or master records, etc. (for example, it is not mandatory to adopt the material group from an underlying requisition - you can change it with the BAPI).
    Transfer
    Purchase order number
    The PurchaseOrder field uniquely identifies a purchase order. This field must be populated in order to carry out the Change method.
    Header data
    The header data of the Enjoy purchase order is transferred in table PoHeader.
    Item data
    The item data of the Enjoy purchase order is stored in the tables PoItem (general item data). Changes regarding quantity and delivery date are to be made in the table PoSchedule.
    Use the table PoAccount to change the account assignment information.
    Services and limits
    Changes to existing items cannot be carried out with the Change method. It is only possible to create new items.
    Conditions
    Conditions are transferred in the table PoCond; header conditions in the table PoCondHeader. A new price determination process can be initiated via the parameter CALCTYPE in the table PoItem.
    Vendor and delivery address
    The vendor address in the table PoAddrVendor and the delivery address in the table PoAddrDelivery can only be replaced by another address number that already exists in the system (table ADRC). Changes to address details can only be made using the method BAPI_ADDRESSORG_CHANGE.
    Partner roles
    You can change all partners except the partner role "vendor" via the table PoPartner.
    Export/import data
    Export/import data can be specified per item in the table PoExpImpItem. Foreign trade data can only be transferred as default data for new items. Changes to the export/import data of existing items are not possible.
    Texts
    Header and item texts can be transferred in the tables PoTextHeader and PoTextItem. Texts for services are imported in the table PoServicesText. Texts can only be replaced completely.
    Version Management
    You can make use of the Version Management facility via the table AllVersions.
    Return
    If the PO was changed successfully, the header and item tables are populated with the information from the PO.
    Return messages
    Messages are returned in the parameter Return. This also contains information as to whether interface data has been wrongly or probably wrongly (heuristical interface check) populated. If a PO has been successfully created, the PO number is also placed in the return table with the appropriate message.
    Restrictions
    With this function module, it is not possible to:
    Create subcontracting components (you can only use existing ones)
    Create configurations (you can only use existing ones)
    Change message records (table NAST) and additional message data (this data can only be determined via the message determination facility (Customizing))
    Attach documents to the purchase order
    Change foreign trade data
    Change service data
    Change or reexplode BOMs
    A firewall prevents the manipulation of data that is not changeable in Purchasing according to the business logic of the purchase order (e.g. PO number, vendor, etc.).
    PO items with an invoicing plan cannot be created or changed using the BAPIs
    In this connection, please refer to current information in Note 197958.
    To change addresses with numbers from Business Address Services (cantral address management), please use the function module BAPI_ADDRESSORG_CHANGE.
    To change variant configurations, please use the function module BAPI_UI_CHANGE. More information is available in the BAPI Explorer under the Logistics General node.
    In the case of changes that are to be made via the BAPI_PO_CHANGE, a firewall first checks whether the relevant fields are changeable. This approach follows that of the online transaction. Here it is not possible to change the vendor or the document type, for example.
    Example
    Example of changes made to a purchase order with:
    1. Change in header data
    2. Change in item
    3. Change in delivery schedule
    4. Change in account assignment
    5. Change in conditions
    6. Change in partners
    Parameter: PURCHASEORDER 4500049596
    Parameter: POHEADER
    PMNTTRMS = 0002
    PUR_GROUP = 002
    Parameter: POHEADERX
    PMNTTRMS = X
    PUR_GROUP = X
    Parameter: POITEM
    PO_ITEM = 00001
    CONF_CTRL = 0001
    Parameter: POITEMX
    PO_ITEM = 00001
    PO_ITEMX = X
    CONF_CTRL =  X
    Parameter: POSCHEDULE
    PO_ITEM = 00001
    SCHED_LINE = 0001
    QUANTITY = 10.000
    PO_ITEM = 00001
    SCHED_LINE = 0003
    DELETE_IND =  X
    Parameter: POSCHEDULEX
    PO_ITEM =  00001
    SCHED_LINE =  0001
    PO_ITEMX =  X
    SCHED_LINEX =  X
    QUANTITY =  X
    PO_ITEM =  00001
    SCHED_LINE =  0003
    PO_ITEMX =  X
    SCHED_LINEX =  X
    DELETE_IND = X
    Parameter: POACCOUNT
    PO_ITEM = 00001
    SERIAL_NO = 01
    GL_ACCOUNT = 0000400020
    Parameter: POACCOUNTX
    PO_ITEM = 00001
    SERIAL_NO = 01
    PO_ITEMX = X
    SERIAL_NOX = X
    GL_ACCOUNT = X
    Parameter: POCOND
    ITM_NUMBER = 000001
    COND_TYPE = RA02
    COND_VALUE = 2.110000000
    CURRENCY = %
    CHANGE_ID = U
    Parameter: POCONDX
    ITM_NUMBER = 000001
    COND_ST_NO = 001
    ITM_NUMBERX = X
    COND_ST_NOX = X
    COND_TYPE = X
    COND_VALUE = X
    CURRENCY = X
    CHANGE_ID = X
    Parameter: POPARTNER
    PARTNERDESC =  GS
    LANGU =  EN
    BUSPARTNO = 0000001000
    Help in the Case of Problems
    1. Note 197958 lists answers to frequently asked questions (FAQs). (Note 499626 contains answers to FAQs relating to External Services Management.)
    2. If you have detected an error in the function of a BAPI, kindly create a reproducible example in the test data directory in the Function Builder (transaction code SE37). Note 375886 tells you how to do this.
    3. If the problem persists, please create a Customer Problem Message for the componente MM-PUR-PO-BAPI, and document the reproducible example where necessary.
    Customer Enhancements
    The following user exits (function modules) are available for the BAPI BAPI_PO_CREATE1:
    EXIT_SAPL2012_001 (at start of BAPI)
    EXIT_SAPL2012_003 (at end of BAPI)
    The following user exits (function modules) are available for the BAPI BAPI BAPI_PO_CHANGE:
    EXIT_SAPL2012_002 (at start of BAPI)
    EXIT_SAPL2012_004 (at end of BAPI)
    These exits belong to the enhancement SAPL2012 (see also transaction codes SMOD and CMOD).
    There is also the option of populating customer-specific fields for header, item, or account assignment data via the parameter EXTENSIONIN.
    Further Information
    1. Note 197958 contains up-to-date information on the purchase order BAPIs.
    2. If you test the BAPIs BAPI_PO_CREATE1 or BAPI_PO_CHANGE in the Function Builder (transaction code SE37), no database updates will be carried out. If you need this function, please take a look at Note 420646.
    3. The BAPI BAPI_PO_GETDETAIL serves to read the details of a purchase order. The BAPI cannot read all details (e.g. conditions). However, you can use the BAPI BAPI_PO_CHANGE for this purpose if only the document number is populated and the initiator has change authorizations for purchase orders.
    4. Frequently used BAPIs for purchase orders are BAPI_PO_CREATE, BAPI_PO_CREATE1, BAPI_PO_CHANGE, BAPI_PO_GETDETAIL, BAPI_PO_GETITEMS, BAPI_PO_GETITEMSREL, and BAPI_PO_GETRELINFO.
    5. For more information on purchase orders, refer to the SAP library (under MM Purchasing -> Purchase Orders) or the Help for the Enjoy Purchase Order, or choose the path Tools -> ABAP Workbench -> Overview -> BAPI Explorer from the SAP menu.
    Parameters
    PURCHASEORDER
    POHEADER
    POHEADERX
    POADDRVENDOR
    TESTRUN
    MEMORY_UNCOMPLETE
    MEMORY_COMPLETE
    POEXPIMPHEADER
    POEXPIMPHEADERX
    VERSIONS
    NO_MESSAGING
    NO_MESSAGE_REQ
    NO_AUTHORITY
    NO_PRICE_FROM_PO
    EXPHEADER
    EXPPOEXPIMPHEADER
    RETURN
    POITEM
    POITEMX
    POADDRDELIVERY
    POSCHEDULE
    POSCHEDULEX
    POACCOUNT
    POACCOUNTPROFITSEGMENT
    POACCOUNTX
    POCONDHEADER
    POCONDHEADERX
    POCOND
    POCONDX
    POLIMITS
    POCONTRACTLIMITS
    POSERVICES
    POSRVACCESSVALUES
    POSERVICESTEXT
    EXTENSIONIN
    EXTENSIONOUT
    POEXPIMPITEM
    POEXPIMPITEMX
    POTEXTHEADER
    POTEXTITEM
    ALLVERSIONS
    POPARTNER
    Exceptions
    Function Group
    2012
    </b>
    regards
    prabhu
    Message was edited by: Prabhu Peram

  • Create a continuous data stream from C++, and read it in LabView

    Hello all.
    I'm working on a project which involves connecting to a motion tracker and reading position and orientation data from it in realtime. The code to get the data is in c++, so I decided that the best way to do this would be to create a c++ DLL file which contains all the necessary functions to first connect to the device and read the data from it, and use the Call Library Function node to feed this data into Labview. 
    I'm having trouble though, since ideally I would like a continuous stream of data from the c++ code into Labview, and I'm not sure how to achieve this. Putting the call library function node in a while loop seems like an obvious solution, but if I do it this way I would have to reconnect to the device every time I get the data, which is quite a bit too slow. 
    So my question is, if I created c++ function which created a data stream, could I read this into Labview without having to continually call a function? I'd prefer to only have to call a function once, and then read the data stream until a stop command is given.
    I'm using Labview 2010, version 10.0.
    Apologies if the question is poorly phrased, many thanks for your help.
    Dave
    Solved!
    Go to Solution.

    dr8086 wrote:
    This method sounds like an excellent suggestion, but I do have a few questions where I dont think I've understood fully.
    From what I understand the basic premise is to use one call library function node to access a DLL which creates an instance of the device object, and passes a pointer too it into labview. Then a seperate call library function node would pass this pointer to another DLL which could access the device object, update it and read the data. This part could be in a while loop and carry on reading the data until a stop command is given.
    That's it. I'm including some skeleton code as an example. I'm also including the code because I don't know how much you have experience with multi threading, so I'm showing how you'd have to use critical sections to guard the interactions between threads so that they don't lead to issues.
    // exported function to access the devices
    extern "C" __declspec(dllexport) int __stdcall init(uintptr_t *ptrOut)
    *ptrOut= (uintptr_t)new CDevice();
    return 0;
    extern "C" __declspec(dllexport) int __stdcall get_data(uintptr_t ptr, double vals[], int size)
    return ((CDevice*)ptr)->get_data(vals, size);
    extern "C" __declspec(dllexport) int __stdcall close(uintptr_t ptr, double last_vals[], int size)
    int r= ((CDevice*)ptr)->close();
    ((CDevice*)ptr)->get_data(last_vals, size);
    delete (CDevice*)ptr;
    return r;
    // h file
    // Represents a device
    class CDevice
    public:
    virtual ~CDevice();
    int init();
    int get_data(double vals[], int size);
    int close();
    // only called by new thread
    int ThreadProc();
    private:
    CRITICAL_SECTION rBufferSafe; // Needed for thread saftey
    vhtTrackerEmulator *tracker;
    HANDLE hThread;
    double buffer[500];
    int buffer_used;
    bool done; // this HAS to be protected by critical section since 2 threads access it. Use a get/set method with critical sections inside
    //cpp file
    DWORD WINAPI DeviceProc(LPVOID lpParam)
    ((CDevice*)lpParam)->ThreadProc(); // Call the function to do the work
    return 0;
    CDevice::~CDevice()
    DeleteCriticalSection(&rBufferSafe);
    int CDevice::init()
    tracker = new vhtTrackerEmulator();
    InitializeCriticalSection(&rBufferSafe);
    buffer_used= 0;
    done= false;
    hThread = CreateThread(NULL, 0, DeviceProc, this, 0, NULL); // this thread will now be saving data to an internal buffer
    return 0;
    int CDevice::get_data(double vals[], int size)
    EnterCriticalSection(&rBufferSafe);
    if (vals) // provides a way to get the current used buffer size
    memcpy(vals, buffer, min(size, buffer_used));
    int len= min(size, buffer_used);
    buffer_used= 0; // Whatever wasn't read is erased
    } else // just return the buffer size
    int len= buffer_used;
    LeaveCriticalSection(&rBufferSafe);
    return len;
    int CDevice::close()
    done= true;
    WaitForSingleObject(hThread, INFINITE); // handle timeouts etc.
    delete tracker;
    tracker= NULL;
    return 0;
    int CDevice::ThreadProc()
    while (!bdone)
    tracker->update();
    EnterCriticalSection(&rBufferSafe);
    if (buffer_used<500)
    buffer[buffer_used++]= tracker->getRawData(0);
    LeaveCriticalSection(&rBufferSafe);
    Sleep(100);
    return 0;
    dr8086 wrote:
    My main concern is that the object may go out of memory or be deallocated, since it wouldnt be held in any namespace or anything.
    Since you create the object with new, the object won't expire until either the dll is unloaded or the process (LabVIEW) closes. So the object will stay valid between dll calls provided LabVIEW didn't unload the dll (which it does if the VIs are closed). When that happens, I'm not exactly sure what happens to live objects (i.e. if you forgot to call close), I imagine the system reclaims the memory but the device might still be open.
    What I do to make sure that everything gets closed when the dll unloads before I could call close and delete the object is to everytime I create a new object in the dll I add it to a list, when the dll unloads, if the object is still on the list I delete it.
    dr8086 wrote:
    I also have a more general programming question about the purpose of the buffer. Would the buffer basically be a big table of position values, which are stored until they can be read into the rest of the VI? 
    Yes, see the example code.
    However, depending on the frequency with which you need to collect data from the device you might not need this buffer at all. I.e. if you collect a sample about every 100ms then you could remove all threading and buffer related functions and instead read the data from the read function itself like this:
    double CDevice::get_data()
    tracker->update();
    return tracker->getRawData(0);
     Because you'd only need a buffer and a seperate thread if you collect data at a high frequency and you cannot lose any data.
    Matt

  • Matching EMP and DEPT

    Hi all,
    11.2.0.1
    I have departments in table DEPT which are  10 and 20. Department 10 has 100 employees in EMP while Department 20 has none in EMP, so it has no matching rows.
    How can I create a query such that all dept with no EMP will be displayed:
    DEPT      EMP
    ====      ====
    10         100
    20           0
    30          20
    Thanks,
    pK

    select d.deptno
    ,      (select count(*) from emp e where e.deptno = d.deptno) emps
    from   dept d;
    -- or:
    select *
    from ( select d.deptno
           ,      (select count(*) from emp e where e.deptno = d.deptno) emps
           from   dept d
    where emps = 0;

  • EMP and DEPT sampledata query (SOLVED)

    I don't have access to create tables at work - just to run selects on existing tables.
    I've used the SQL below to use the 2 standard Oracle test dept and emp tables for testing, but - is it possible to use SQL to join the tables, or can the GET table WITH table AS ... SQL only ever work on one table at a time, rather than allowing joins to be done?
    Thanks
    GET dept
    WITH dept AS
         (SELECT 10 deptno
               , 'ACCOUNTING ' dname
               , 'NEW YORK' loc
            FROM DUAL
          UNION ALL
          SELECT 20 deptno
               , 'RESEARCH   ' dname
               , 'DALLAS' loc
            FROM DUAL
          UNION ALL
          SELECT 30 deptno
               , 'SALES      ' dname
               , 'CHICAGO' loc
            FROM DUAL
          UNION ALL
          SELECT 40 deptno
               , 'OPERATIONS ' dname
               , 'BOSTON' loc
            FROM DUAL)
    SELECT *
      FROM dept;
    GET emp
    WITH emp AS
         (SELECT 7369 empno
               , 'SMITH' ename
               , 'CLERK' job
               , 7902 mgr
               , '17-Dec-80' hiredate
               , 800 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7499 empno
               , 'ALLEN' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '20-Feb-81' hiredate
               , 1600 sal
               , 300 comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7521 empno
               , 'WARD' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '22-Feb-81' hiredate
               , 1250 sal
               , 500 comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7566 empno
               , 'JONES' ename
               , 'MANAGER' job
               , 7839 mgr
               , '02-Apr-81' hiredate
               , 2975 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7654 empno
               , 'MARTIN' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '28-Sep-81' hiredate
               , 1250 sal
               , 1400 comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7698 empno
               , 'BLAKE' ename
               , 'MANAGER' job
               , 7839 mgr
               , '01-May-81' hiredate
               , 2850 sal
               , NULL comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7782 empno
               , 'CLARK' ename
               , 'MANAGER' job
               , 7839 mgr
               , '09-Jun-81' hiredate
               , 2450 sal
               , NULL comm
               , 10 deptno
            FROM DUAL
          UNION ALL
          SELECT 7788 empno
               , 'SCOTT' ename
               , 'ANALYST' job
               , 7566 mgr
               , '19-Apr-87' hiredate
               , 3000 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7839 empno
               , 'KING' ename
               , 'PRESIDENT' job
               , NULL mgr
               , '17-Nov-81' hiredate
               , 5000 sal
               , NULL comm
               , 10 deptno
            FROM DUAL
          UNION ALL
          SELECT 7844 empno
               , 'TURNER' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '08-Sep-81' hiredate
               , 1500 sal
               , NULL comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7876 empno
               , 'ADAMS' ename
               , 'CLERK' job
               , 7788 mgr
               , '23-May-87' hiredate
               , 1100 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7900 empno
               , 'JAMES' ename
               , 'CLERK' job
               , 7698 mgr
               , '03-Dec-81' hiredate
               , 950 sal
               , NULL comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7902 empno
               , 'FORD' ename
               , 'ANALYST' job
               , 7566 mgr
               , '03-Dec-81' hiredate
               , 3000 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7934 empno
               , 'MILLER' ename
               , 'CLERK' job
               , 7782 mgr
               , '23-Jan-82' hiredate
               , 1300 sal
               , NULL comm
               , 10 deptno
            FROM DUAL)
    SELECT *
      FROM emp;

    is it you requirement.
    WITH dept AS
         (SELECT 10 deptno
               , 'ACCOUNTING ' dname
               , 'NEW YORK' loc
            FROM DUAL
          UNION ALL
          SELECT 20 deptno
               , 'RESEARCH   ' dname
               , 'DALLAS' loc
            FROM DUAL
          UNION ALL
          SELECT 30 deptno
               , 'SALES      ' dname
               , 'CHICAGO' loc
            FROM DUAL
          UNION ALL
          SELECT 40 deptno
               , 'OPERATIONS ' dname
               , 'BOSTON' loc
            FROM DUAL),
    emp AS
         (SELECT 7369 empno
               , 'SMITH' ename
               , 'CLERK' job
               , 7902 mgr
               , '17-Dec-80' hiredate
               , 800 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7499 empno
               , 'ALLEN' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '20-Feb-81' hiredate
               , 1600 sal
               , 300 comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7521 empno
               , 'WARD' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '22-Feb-81' hiredate
               , 1250 sal
               , 500 comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7566 empno
               , 'JONES' ename
               , 'MANAGER' job
               , 7839 mgr
               , '02-Apr-81' hiredate
               , 2975 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7654 empno
               , 'MARTIN' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '28-Sep-81' hiredate
               , 1250 sal
               , 1400 comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7698 empno
               , 'BLAKE' ename
               , 'MANAGER' job
               , 7839 mgr
               , '01-May-81' hiredate
               , 2850 sal
               , NULL comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7782 empno
               , 'CLARK' ename
               , 'MANAGER' job
               , 7839 mgr
               , '09-Jun-81' hiredate
               , 2450 sal
               , NULL comm
               , 10 deptno
            FROM DUAL
          UNION ALL
          SELECT 7788 empno
               , 'SCOTT' ename
               , 'ANALYST' job
               , 7566 mgr
               , '19-Apr-87' hiredate
               , 3000 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7839 empno
               , 'KING' ename
               , 'PRESIDENT' job
               , NULL mgr
               , '17-Nov-81' hiredate
               , 5000 sal
               , NULL comm
               , 10 deptno
            FROM DUAL
          UNION ALL
          SELECT 7844 empno
               , 'TURNER' ename
               , 'SALESMAN' job
               , 7698 mgr
               , '08-Sep-81' hiredate
               , 1500 sal
               , NULL comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7876 empno
               , 'ADAMS' ename
               , 'CLERK' job
               , 7788 mgr
               , '23-May-87' hiredate
               , 1100 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7900 empno
               , 'JAMES' ename
               , 'CLERK' job
               , 7698 mgr
               , '03-Dec-81' hiredate
               , 950 sal
               , NULL comm
               , 30 deptno
            FROM DUAL
          UNION ALL
          SELECT 7902 empno
               , 'FORD' ename
               , 'ANALYST' job
               , 7566 mgr
               , '03-Dec-81' hiredate
               , 3000 sal
               , NULL comm
               , 20 deptno
            FROM DUAL
          UNION ALL
          SELECT 7934 empno
               , 'MILLER' ename
               , 'CLERK' job
               , 7782 mgr
               , '23-Jan-82' hiredate
               , 1300 sal
               , NULL comm
               , 10 deptno
            FROM DUAL)
    SELECT *
      FROM emp,dept
      where emp.deptno =dept.deptno

  • SEM-BCS data extractor from ECC general ledger table(s)

    We are a utility company working on an SEM-BCS implementation and use the FERC solution.  We do not use the new GL.  We are trying to extract the transaction data from ECC to a BI virtual remote cube.  We cannot use the profit center extractor (0EC_PCA_3) as the profit center tables do not contain any ferc data.  We need to be able to extract the transaction data from a general ledger table.  We have run into several issues with various extractors we have tried because they donu2019t allow direct access (0FI_GL_4) or are at a summary level and we canu2019t extract group account, trading partner, and transaction type detail (0FI_GL_1).  Would you have any suggestions on how to extract general ledger data with the detail information required from ECC to be able to load to a BI virtual remote cube?

    We are going forward with getting the natural account detail data using the profit center extractor 0EC_PCA_3, and getting the ferc summary data using the general ledger extractor 0FI_GL_1.  With our testing so far, this combination will provide us the data we need in BCS.

Maybe you are looking for