How to look up a random key value

I'm importing some data in a flat file. That data is going to be loaded into a fact table. That fact table connects to some dimension tables and I need to the keys out of those tables. The problem is, this isn't a look up. There is no key value in the
source file to match against. What I need to do is to go into the dimension table, pull out some existing keys at random and then drop them into the data flow. I have NO idea how to do that. Ideas?

Never mind. I just put in a hack solution. Not awesome but does what I need it to do.

Similar Messages

  • How to update a parent (primary key) value?

    hello...can anybody give me a hint that how to update a primary key value in master table through forms as well as update all child records keeping in mind that "ALTER TABLE" and constraint disabling is not permitted by DBA. Parent Records are being displayed in form in a database block while child records are not displayed on form.

    See
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:914629004506
    and
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteupdatecascade.html
    cheers

  • How can we export the Primary key values (along with other data) from an Advantage database?

    One of our customers is moving from our application (which uses Advantage Database Server) to another application (which uses other database technology). They have asked us to help export their data, so that they can migrate it to another database system. So far, we have used the Advantage Data Architect (ARC32) "Export Table Structures as Code" functionality to generate SQL. We used the "Include existing data" option. The SQL contains the necessary code to recreate the tables and indexes. The customer's IT staff will alter the SQL statements as necessary for their new system.
    However, there is an issue with the Primary Keys in these table. The resulting INSERT statements use AutoInc as the type for the Primary Key in each Table. These INSERT statements contains "DEFAULT" for the value of each of these AutoInc fields. The customer would like to output an integer value for each of these Primary Key values in order to maintain referential integrity in their new system.
    So far, I have not found any feature of ARC32 that allows us to export the Primary Key values. We had been using an older version of ARC32, since our application does not use the latest version of ADS. I did download the latest version of ARC32 (11.10), but it does not appear to include any new functionality that would facilitate doing this sort of export.
    Can somebody tell me if there is such a feature in ARC32?
    Or, is there is another Advantage tool to facilitate what we are trying to accomplish?
    If there are no Advantage tools to provide such functionality, what else would you suggest?

    George,
      It sounds like the approach you are using is the correct one. This seems to be the cleanest solution to me especially since the customer is able to modify the generated SQL statements for their new system.
      In order to preserve the AutoInc values I would recommend altering the table and changing the field datatype from AutoInc to Integer. Then export the table as code which will export the actual values. After the tables have been created on the new system they can change the field datatype back to an AutoInc type if necessary.
    Regards,
    Chris Franz

  • How to combine large number of key-value pair tables into a single table?

    I have 250+ key-value pair tables with the following characteristics
    1) keys are unique within a table but may or may not be unique across tables
    2) each table has about 2 million rows
    What is the best way to create a single table with all the unique key-values from all these tables? The following two queries work till about 150+ tables
    with
      t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select coalesce(t1.key, t2.key, t3.key) as key
    ,      max(t1.val) as val1
    ,      max(t2.val) as val2
    ,      max(t3.val) as val3
    from t1
    full join t2 on ( t1.key = t2.key )
    full join t3 on ( t2.key = t3.key )
    group by coalesce(t1.key, t2.key, t3.key)
    with
      master as ( select rownum as key from dual connect by level <= 5 )
    , t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select m.key as key
    ,      t1.val as val1
    ,      t2.val as val2
    ,      t3.val as val3
    from master m
    left join t1 on ( t1.key = m.key )
    left join t2 on ( t2.key = m.key )
    left join t3 on ( t3.key = m.key )
    /

    A couple of questions, then a possible solution.
    Why on earth do you have 250+ key-value pair tables?
    Why on earth do you want to consolodate them into one table with one row per key?
    You could do a pivot of all of the tables, without joining. something like:
    with
      t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select key, max(t1val), max(t2val), max(t3val)
    FROM (select key, val t1val, null t2val, null t3val
          from t1
          union all
          select key, null, val, null
          from t2
          union all
          select key, null, null, val
          from t3)
    group by keyIf you can do this in a single query, unioning all 250+ tables, then you do not need to worry about chaining or migration. It might be necessary to do it in a couple of passes, depending on the resources available on your server. If so, I would be inclined to create the table first, with a larger than normal percent free, then do the first set as a straight insert, and the remaining pass or passes as a merge.
    Another alternative might be to use the approach above, but limit the range of keys in each pass. So pass one would have a predicate like where key between 1 and 10 in each branch of the union, pass 2 would have key between 11 and 20 etc. That way everything would be straight inserts.
    Having said all that, I go back to my second question above, why on earth do you want/need to do this? What is the business requirement you are trying to solve. There might be a much better way to meet the requirement.
    John

  • Retrieving random key-value pair

    I am storing a large number of items I want to randomly select from. Say for example I want to store a massive list of competition entrants (10-100 million) and I want to keep randomly pulling out winners (and removing them ideally).
    At the moment I'm using a cursor on a DH_HASH database (I have tried a BTREE too) as follows:
    g_db.cursor(NULL, &dbc, 0);
    int res = dbc->get(&key, &data, DB_LAST); // tried DB_FIRST too
    This works somewhat ok, depending how I'm adding entries in the first place. If I add names very randomly it works fine. If, however, I add names perfectly in order (say I'm entering them from a pre-sorted list) I consistently get similar results back, say a lot of entries beginning "John".
    I tried reversing the stored keys, which again helps with randomisation, but then I end up with a lot of senoJ (Jones) entries.
    What I really want is completely randomized retrieval, but google hasn't helped me.
    Any help gratefully received!
    Cheers.
    (Note: my example is purely fictitious!)

    Hello,
    Perhaps making use of the set_h_hash method to set a user-defined hash function documented in the Reference Guide at:
    http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/C/dbset_h_hash.html
    Or setting your own Btree comparison via the set_bt_compare method documented in the Reference Guide at:
    http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/bt_conf.html#am_conf_bt_compare
    would help achieve the desired results.
    Thanks,
    Sandra

  • How can we create a look-up in Enterprise Gateway.. like key value pair..???

    How can we create a look-up in Enterprise Gateway.. like key value pair..???

    Hi,
    You want to have a look at KPS, Key Property Store. Link: Key Property Stores
    Cheers,
    Stefan

  • How to get the KEY VALUE of sales order

    Hello friends,
                          iam adding a sales order through DI-SERVER to the SAP db.after adding iam getting a key value (i,e Doc no)..i want it to display it in my frontend....can u please tell me how to display the return key value of my sales order
    regards,
    shangai.

    Dear Shangai,
    To retrieve the last Doc/Object added through DI API (DI Server is based on DI API) there is a method called "GetNewObjectCode" which can be used to retrieve the last DocCode which was added into the B1.
    Please try the function for more help please look at the help files RefDI.chm which is installed with the SDK installation for B1.
    Regards
    Arshdeep

  • How to create a PDF with substituted key-value and table-values using a template language

    I have about 50 key-values and 10 table-values that I want to substitute into a formatted report template (language can be anything standard, would create a small number of these templates) and then use an Adobe tool to substitute the values into the template and produce a PDF. Preferably the template language would permit some basic conditional logic (if <key #> has value <value> then <show key label here> and <key value here> in close spatial proximity on the form) and permit embedding of a static graphic logo, text with fonts/styles, etc. to produce a polished report but also handle pagination (e.g. enable page breaks or numbering) to be handled automatically.
    What is a recommended template language and product to accomplish this?

    Are you thinking of something like a blank form that you can enter information into, save, and send to another user? If so, what you want is possible. If you want more information, post again and include more details about how you want to use it and how the recipient will use it.

  • Hi my name is steve arsenault  i am looking for a short keys for  apple and if someone has one i like to know how to use it please e-mail me has soon has posible thank you

    hi my name is steve arsenaulti am looking for a short keys for  apple and if someone has one i like to know how to use it please e-mail me has soon has posible thank you
    <E-mail Edited by Host>

    It sounds like you are looking for a program like Typinator.
    It isn't free, and the site doesn't specify compatibility with any OS above 10.7.
    As of today, the latest release is dated May 29th, 2012.

  • How to populate the dropdown key values as shown in the below screen shot

    Hi
    i am trying to populate the drop down by key value for trader , for Trader we  have few values i need to populate the Those values in values columns . as shown in the below screen shot .

    Hi,
    Follow below steps
    Step 1 - Create basic wdp table
    Step 2 - Create context to store dropdown values Within your web dynpro application table
    Now you need to create a context node to store the dropdown values, but this needs to be within the context node of your table.
    For this example I will use fields CARRID and CARRNAME from structure SCARR to create the dropdown list within the table context.
    Choose the attributes to represent the id and the text values
    The finished context should now look like this
    Step 3 - Update context mapping within VIEW
    Within the Context tab of your view update the context node you have just modified (CARRIERS) right click and select 'Update Mapping'. Alternatively if this is a new context drag it from the right hand window and drop it onto the context node in the left window,
    Step 4 - Update table field
    Within the layout tab of the view, field the table field you want to replace with with a dropdown and remove the UI element associated with it
    Now insert new dropdownbyindex UI cell element
    Step 5 - Assign Dropdown Ui element to Context
    Click on your UI element within the Layout tab, you will now see all the properties for this element which can be changed. You now need to assign the field within the context which you want to be displayed in the drop down i.e. it will be the CARRNAME field within context element DROPDOWN_CARR. To do this simply click on the button at the end of the 'texts' property (the one with a yellow square and circle on it) and select the correct context field.
    Step 6 - ABAP code to populate dropdown list and set correct initial value
    Insert the following ABAP code into the appropriate place. For this example it will go within the WDDOMODIFYVIEW method of the view.
      Data: it_scarr type standard table of scarr, wa_scarr like line of it_scarr, context_node type ref to if_wd_context_node.  Data: it_ddcarr type STANDARD TABLE OF if_main=>element_DROPDOWN_CARR, wa_ddcarr like line of it_ddcarr, lr_element TYPE REF TO if_wd_context_element, ld_tabix type sy-tabix, ld_index type sy-index, it_carriers type STANDARD TABLE OF if_main=>element_CARRIERS, wa_carriers like line of it_ddcarr.  select * from scarr into table it_scarr. sort it_scarr by carrid.  * select * from scarr into table it_scarr. context_node = wd_context->get_child_node( name = 'CARRIERS' ).  * Get all rows of table and values stored in each cell currently displayed to user context_node->get_static_attributes_table( importing table = it_carriers ).  if sy-subrc eq 0. loop at it_carriers into wa_carriers. free lr_element. ld_tabix = ld_tabix + 1.  *     assign context_node to table context context_node = wd_context->get_child_node( name = 'CARRIERS').  *     assign lr_element to row of table lr_element = context_node->get_element( ld_tabix ).  *     assign data to dropdown of the row  context_node = lr_element->get_child_node( name = 'DROPDOWN_CARR'). context_node->BIND_TABLE( it_scarr ).  *     Set correct initial value read table it_scarr into wa_scarr with key carrid = wa_carriers-carrid. ld_index = sy-tabix. context_node->set_lead_selection_index( index = ld_index ).  endloop. endif.
    Step 6 - Save, Activate and Run
    Save and activate your abap web dynpro, now when you execute it you should see a drop down object similar to the following:

  • How to get the auto increment integer primary key value of a new record

    I have a DB table that has a auto increment integer primary key, if I insert a new record into it by SQL statement "INSERT INTO...", how can I get the integer primary key value of that newly created record?

    Well maybe someone knows a better method, but one workaround would be to add a dummy field to your table. When a new record is inserted this dummy field will be null. Then you can select your record with SELECT keyField FROM yourTable WHERE dummyField IS NULL. Once you've got the key number, you then update the record with a non-null value in the dummyField. Bit of a bodge, but it should work...
    Another alternative is, instead of using an Autonumbered key field, you could assign your own number by getting the MAX value of the existing keys (with SELECT MAX(keyField) FROM yourTable) and using that number + 1 for your new key. Might be a problem if you have lots of records and frequent deletions though.

  • How to ceate a new Country key,currency ,version and value type for report

    hi,
    can you please let me know How to ceate a new Country key,currency ,version and value type for report
    along with tables and tcodes.
    thanking you

    Not clear on your comments
    How to ceate a new Country key,currency,
       version and value type for report
    because in one line you are saying you want to create Country Key, which means your requirement is in some transaction whereas at the end, you say for report.
    Can you let us know you want to develop a report and if so, from which transactions, you want to take datas.  You have to be clear on this.
    thanks
    G. Lakshmipathi

  • How to Create process of Type : Get Next or Previous Primary Key Value

    Hi,
    Can anybody give the steps how to create the page process for type Get Next or Previous Primary Key Value in oracle Express database
    Ramesh j c.

    Hi Justin,
    In oracle 10g XE , we have sample application v2.0
    1. Do you have any Document to create step by step the sample application v2.0 and Is it possible to create all the pages of this sample application v2.0 b by wizard. To recreate or create the demo app, start from the home area,
    next go to application builder,
    then click the create button,
    next choose "demonstration application"
    and then you can choose "Run | Edit | Re-install" the "Sample Application" along with a few other apps.
    2. When we install this sample application v2.0 , which is the sql script is executed or how it is installed. If you want the sample application you can export it after you create it if you want the SQL associated with it.
    3. Whenever the sample application v2.0 is installed, how the encrypted pass word is created for the user demo and admin. This is setup with the application install. I don't believe it is encrypted either. If your wanting SSL there are some threads on here that talk about encrypting content.
    Justin thanks for to create process Get Next or Previous Primary Key Value

  • How to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method.

    how to transfer database table contain null values, primary key, and foreign key to the another database in same server. using INSERT method.  thanks

    INSERT targetdb.dbo.tbl (col1, col2, col3, ...)
       SELECT col1, col2, col3, ...
       FROM   sourcedb.dbo.tbl
    Or what is your question really about? Since you talke about foreign keys etc, I suspect that you want to transfer the entire table definition, but you cannot do that with an INSERT statement.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Apex Form - how to enter primary key value manually?

    Hi
    Whenever I am creating Apex form using wizard, it asks me to specify trigger/sequence/pl/sql function for populating primary key value.
    However, if I want to specify primary key myself (ie. not auto generated number), how I can specify that?
    Thanx

    Hello,
    By Yourself you mean : by hand or by a pl/sql?
    If you say by trigger, the system doesn't care about what number is send. So you can give it "manually"
    May I ask what is the reason of that?
    Cheers,
    Arnaud

Maybe you are looking for

  • [FIX] Yoga 13 Windows 8.1 Touchpad and Pixelated Windows.

    Hello everybody! This would be my first post in this forum. I thought that I had to share this since I wasn't able to find a fix for the Touchpad. And since I was also able to solve the pixelated windows issue, I thought I might want to share it.  [I

  • Headstart utilities (Find Window)

    I have used the HeadStart Utilities - Create Find Windows on my module, which has only one module component (SOT). I run the Create Find Windows utility and get the following error: "CDA-01151: Bound Item (Module Unit 25549716430479028155400636439131

  • Help for J2ME MIDP

    Hello, I'm working for a project on MIDP. And i wish to call another MIDlet from the main MIDlet. But while calling it gives a Security exception. Can anybody suggest me any way to do it. Also i wish to get the Text to Speech conversion. How can this

  • Strange charaters in vi's

    I don't know when but my vi's have strange characters... How do I fix this? I tried various fonts in environment option but made no difference.. Attachments: labview.jpg ‏57 KB labview.jpg ‏57 KB

  • How do I switch tabs in fullscreen mode in Safari iOS?

    I like FS mode in Safari, but seems to be unable to switch tabs while in fullscreen?