Query and update collections

Hi all,
Following :
CREATE TABLE TSET
ID NUMBER(10)
Insert into PER.TSET
(ID)
Values
(1);
Insert into PER.TSET
(ID)
Values
(2);
Insert into PER.TSET
(ID)
Values
(3);
COMMIT;
CREATE OR REPLACE FORCE VIEW V_ID (ID,FLAG)
AS
(SELECT ID, 0
FROM TEST1);
SELECT * FROM V_ID
ID FLAG
1 0
2 0
3 0
CREATE OR REPLACE TYPE OBJ_ID IS OBJECT
ID NUMBER(10),
FLAG NUMBER(5)
CREATE OR REPLACE TYPE T_ID AS TABLE OF OBJ_ID
I want pass VIEW V_ID to table T_ID
select * from table(T_ID)
Excpect output
ID FLAG
1 0
2 0
3 0
and i want to update FLAG to any ID in table(T_ID)
Thanks in advance

RJ wrote:
and i want to update FLAG to any ID in table(T_ID)T_ID is type, not a table. You need to create table:
SQL> DROP TYPE T_ID
  2  /
Type dropped.
SQL> CREATE TABLE T_ID OF OBJ_ID
  2  /
Table created.
SQL> INSERT
  2    INTO T_ID
  3    SELECT  *
  4      FROM  V_ID
  5  /
3 rows created.
SQL> SELECT  *
  2    FROM  T_ID
  3  /
        ID       FLAG
         1          0
         2          0
         3          0
SQL> And if you want to create table of objects:
SQL> CREATE OR REPLACE TYPE T_ID AS TABLE OF OBJ_ID
  2  /
Type created.
SQL> CREATE TABLE T_ID_TBL(
  2                        OBJ_ID_TBL T_ID
  3                       )
  4    NESTED TABLE OBJ_ID_TBL
  5    STORE AS OBJ_ID_TBL
  6  /
Table created.
SQL> INSERT
  2    INTO T_ID_TBL
  3    SELECT  CAST(COLLECT(OBJ_ID(ID,FLAG)) AS T_ID)
  4      FROM  V_ID
  5  /
1 row created.
SQL> SELECT  *
  2    FROM  T_ID_TBL
  3  /
OBJ_ID_TBL(ID, FLAG)
T_ID(OBJ_ID(1, 0), OBJ_ID(2, 0), OBJ_ID(3, 0))
SQL> SY.

Similar Messages

  • ORA-20001: Unable to create query and update page.

    I am using the wizard: Form on a table with report 2 pages. I do not change any of the values when using the wizard (just taking all default values)
    I created over 10 pages successfully already.
    When creating the one page, I received this error on clicking the 'Finish' button
    Error creating query and update.
    Return to Application
    ORA-20001: Unable to create query and update page. ORA-12899: value too large for column "FLOWS_010500"."WWV_FLOW_PAGE_PLUGS"."PLUG_QUERY_COL_ALLIGNMENTS" (actual: 269, maximum: 255)
    Seems like it might be table related since I can continue and create more forms/reports on other tables.
    Any help would be appreciated.

    336554,
    Looks like there is a 127-column limit on the number of report columns supported when using that wizard. Do you have more than that?
    57434

  • Memory leak/overload when looping by index over a large query and updating each DB record

    I am importing a CSV file into a temporary table and then running a select query that joins my actual database table with the temporary table, looking for any changes in the data. If changes exist, the select query is looped from 1 to #recordCount# and an update is applied to each record via cfquery. It runs very quickly (much more quickly than looping the query itself), but my memory spikes and overloads after about 1500 updates are completed. I need to be able to do upwards of 20000 at a time, without killing my system. I have tried manually setting the runtime garbage collection to trigger after X number of loops, but that doesn't seem to help. I am running CF8. See below for loop example:
    <cfloop from="1" to="#updatedRecordsQuery.recordCount#" index="a">
    <cftry>
                    <cfquery datasource="#db#" name="doUpdate">
                        UPDATE
                            CI
                        SET
                            firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.firstname[a]#" />,
                            lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.lastname[a]#" />,
                            etc, for about 15 various fields
                        FROM
                            client_info CI
                        WHERE
                            CI.client_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#updatedRecordsQuery.client_id[a]#" />
                    </cfquery>
                    <cfcatch type="database">
                        <cfset local.updateErrorList = listappend(local.updateErrorList,updatedRecordsQuery.client_id[a]) />
                        <cfset local.error = true />
                    </cfcatch>
               </cftry>
    </cfloop>

    I would suggest to use select update instead of looping over query object and update each row one-by-one.
    Procedure:
    - Insert your CSV data into temp table.
    - Use a select update SQL query to update the changed data instead of looping over a select query.
    Example:
    UPDATE
       Table
    SET
       Table.col1 = other_table.col1,
       Table.col2 = other_table.col2
    FROM
       Table
    INNER JOIN
      other_table
    ON
       Table.id = other_table.id
    NOTE: You can put all your scripts in a Procedure.

  • Query and Device Collection by Department

    Hi all,
      I am trying to figure out how to build a query and a device collection that is by department.
    In the administration of sccm 2012 sp1 I added the attribute "department" but I do not see a way to build a query that shows:
    user name/computer name/department/etc
    It seems the users and system resourses of the query are split up. Not sure how to join them to get the query I am after. Any help would be great. Thanks

    Hi,
    please examine the Active Directory System Discovery log (adsysdis.log) to confirm that discovery is running properly.
    For more information, please review the link below:
    Discover additional Active Directory attributes with SCCM 2007/2012 discovery
    http://deployos.com/blog/2013/01/05/discovery-additional-active-directory-attributes-with-sccm-20072012-discoveries
    Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Query and update a table/view

    What is the best & fastest way to do this?
    1) Put up a query input region for users to enter parameters.
    2) Run a query on a table/view using those parameters.
    3) Allow the output in (2) to be modified by user (multiple rows at a time) and then Submit the updates back to update th table/view
    I can do (1) and (2) easily. How can I do (3)?
    Thanks

    Make a report on the table. Go to the definition of
    the report column and change the "Display As" type to
    text field or select list or whcih ever is
    applicable. Write a process on submit to insert these
    values back to the table. You will have control over
    which columns the user can modify.Thats a good idea and I was able to start on it. But how can my after submit process tell which rows to modify? i.e. what will my after submit process look like?
    for rec in (....)
    loop
    update my_table set
    end loop;
    Help? Thanks

  • How to Query and Update/Insert Large Tables ...

    I have the following 2 tables:
    Table 1: Pricing
    This table holds pricing details of all Items (roughly 150,000 items). One Item has three types of prices Standard, Promotion, and Discounted. Therefore the table contains roughly 150,000 * 3 records. Also the prices may get updated frequently every day.
    Item#---Type------------FromDate---ToDate-----Price
    ===================================
    AAA-----Standard------01/01/05---31/12/05---1.50
    AAA-----Promotion----16/12/05---20/12/05---1.40     
    AAA-----Discounted---10/12/05---15/12/05---1.20
    BBB-----Standard------01/01/05---31/12/05---1.60
    BBB-----Promotion----17/12/05---18/12/05---1.30
    BBB-----Discounted---10/12/05---15/12/05---1.50
    Table 2: BestPrice
    At a given date, this table contains the best price (lowest price) of each item for the following 21 days (including the current date). The POS system is accessing this table to get the daily best price for billing customers.
    Item#----Date--------BestPrice
    =====================
    AAA------17/12/05----1.40
    AAA------18/12/05----1.40     
    AAA------19/12/05----1.40
    AAA------20/12/05----1.40
    AAA------21/12/05----1.50
    BBB------17/12/05----1.30
    BBB------18/12/05----1.30
    BBB------19/12/05----1.60
    BBB------20/12/05----1.60
    BBB------21/12/05----1.60
    Problem Statement:
    Table 2 (BestPrice) needs to get updated from Table 1 (Pricing) at least once every day with the best price for each item for the next 21 days (including the current day). What’s the most efficient method to perform this job?

    I don't know really why your application needs to use BestPrice table!
    It is not clear what it does for it because querying will not be better than querying the pricing table. This will be very fast with an index on intem#
    On the other hand, why do you use three rows per item in Pricing table? it could be one row per item.
    Any way, to populate the table for the first time :
    insert into bestprice
    select item#
         , dte
         , min(price) bestprice
    from pricing, (select trunc(sysdate) + rownum - 1 dte from dual connect by rownum <= 21) t
    where  dte  between fromdate and todate
    group by dte, item#Now, you can have a row trigger (update) on Pricing table which can change BestPrice table according to a change in Pricing tabe.
    Then you have to use a daily job that can be based on the following statement:
    update BestPrice B
    set dte = trunc(sysdate) + 20
      , BestPrice =
             select min(price)
             from Pricing P
             where P.item# = B.item#
                and B.dte between P.FromDate and P.ToDate
    where dte = trunc (sysdate) - 1Message was edited by:
    Michel SALAIS
    I forgot to say that that if your periods in the pricing table don't covere a desired date in the BestPrice table then my insert statement will not treat it and my update will put it to NULL

  • SCCM Report for Applicable and Installed Updates Collection Wise

    Hi All, I was looking for a report on Applicable and Installed Updates Collection Wise and got this below query on the Internet and want to create a SCCM report with this below query. How to make this query working in SCCM report?
    Do I need to add prompts, if yes please guide me on adding prompts.
    SELECT
    DISTINCT
    SYS.Name0
    AS [Server Name], SIS.SMS_Installed_Sites0 AS [Site Code], UCS.Status AS [Patch Status Code],
    CASE WHEN UCS.Status = '2' THEN 'Applicable' WHEN UCS.Status = '3' THEN 'Installed' ELSE '' END AS 'Patch Status', UI.BulletinID AS [Bulletin ID],
    UI
    .ArticleID AS [Article ID], UI.
    Title
    FROM
    v_R_System AS SYS LEFT OUTER
    JOIN
    v_Update_ComplianceStatusAll
    AS UCS ON SYS.ResourceID = UCS.ResourceID INNER
    JOIN
    v_UpdateInfo
    AS UI ON UCS.CI_ID = UI.CI_ID INNER
    JOIN
    v_RA_System_SMSInstalledSites
    AS SIS ON SYS.ResourceID = SIS.
    ResourceID
    WHERE
    (UCS.Status IN ('2', '3')) AND (UI.ArticleID IN ('972270', '974392', '973904', '969947')) AND (SYS.Name0
    IN
    (SELECT DISTINCT v_FullCollectionMembership.
    Name
    FROM v_FullCollectionMembership INNER
    JOIN
    v_R_System
    ON v_R_System.ResourceID = v_FullCollectionMembership.ResourceID AND v_R_System.Active0 = 1 AND
    v_FullCollectionMembership
    .CollectionID IN ('Collection ID'
    ORDER
    BY
    [Patch Status Code]

    Yes it can be done and please run the query which i have shared in the thread
    I again pasted the query for you below..
    SELECT DISTINCT
    SYS.Name0 AS [Server Name], CASE WHEN UCS.Status = '2' THEN 'Applicable' WHEN UCS.Status = '3' THEN 'Installed' ELSE '' END AS 'Patch Status',
    UI.BulletinID AS [Bulletin ID], UI.ArticleID AS [Article ID], UI.Title
    FROM         v_R_System AS SYS LEFT OUTER JOIN
                          v_Update_ComplianceStatusAll
    AS UCS ON SYS.ResourceID = UCS.ResourceID INNER JOIN
                          v_UpdateInfo AS UI ON UCS.CI_ID
    = UI.CI_ID
    WHERE     (UCS.Status IN ('2', '3')) AND (SYS.Name0 IN (SELECT DISTINCT v_FullCollectionMembership.Name
    FROM v_FullCollectionMembership INNER JOIN
         v_R_System ON v_R_System.ResourceID = v_FullCollectionMembership.ResourceID AND v_R_System.Active0 = 1 AND
                                                       v_FullCollectionMembership.CollectionID
    IN ('XXX00000')))
    Kamala kannan.c| Please remember to click “Mark as Answer” or Vote as Helpful if its helpful for you. |Disclaimer: This posting is provided with no warranties and confers no rights

  • Insert and update query to calculate the opening and closing balance

    create table purchase(productid number(5) ,dateofpurchase date,
    qty number(5));
    create table inventory(invid number(5),productid number(5),
    idate date,openingqty number(5),closingqty number(5));
    Records in inventory:
    1,1,'01-jan-2009', 10, 20
    2,1,'03-jan-2009', 20, 30
    3,1,'04-jan-2009', 40, 50
    when I enter the purchase invoice for 15 qty on 02-jan-2009
    after say '15-jan-09' , a new record should get inserted
    with opening balance = (closing balance before 02-jan-2009)
    and all the opening and closing balance for that product should
    get affected.
    If the invoice for 20 qty is entered for the existing date say
    '03-jan-2009' in inventory , then the closing balance
    for 03-jan-2009 should get updated and all the following records
    should get affected.
    I need the insert for the first one and update query for the
    second one.
    Vinodh

    <strike>You can do this in one statement by using the merge statement</strike>
    Hmm, maybe I spoke too soon.
    Edited by: Boneist on 25-Sep-2009 13:56
    Thinking about it, why do you want to design your system like this?
    Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
    If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
    Edited by: Boneist on 25-Sep-2009 13:59

  • Record has already been updated by another user. Please re-query and retry

    Hi,
    I want to uncheck the option Send e-mails for canceled notifications in Workflow mailer but getting error in fouth step in workflow Notification mailer:-
    1. Connect to Oracle Applications Manager with SYSADMIN.
    2. select Workflow manager.
    3. Click on EDIT button-->Advanced(Step 1)--->next(step 2)--->next(step 3)---"ERROR"
    This record has already been updated by another user. Please re-query and try again. ORA-06512: at "APPS.FND_SVC_COMP_PARAM_VALS_PKG", line 288 ORA-06512: at line 1
    Regards,

    Pl see if MOS Doc 286418.1 (ORA-06512: At Fnd_svc_comp_param_vals_pkg When Configuring The Java Mailer) can help
    HTH
    Srini

  • Isssue when collecting the transport request for a query and its elements

    Dear All,
    When collecting a query and its elements, only the query is getting collected in to the request and not the elements and I an error is getting displayed as You can not use request xxxxx and elements could not be saved. This is in bw 3.5.
    Can anyone suggest?
    Regards,
    Ram

    Hi,
    In the transport connection make sure that all the elements for the query which you need are manually checked.
    Just drop down the menu and see the elements of the query and check if they all are selected or not.
    Here you can also see if the elements are already present in some other TR.
    Just delete all those TR's before creating this new TR.So that these objects are unlocked or it will not added to your new TR niether it will give an error.
    Also make sure that all the elements have same data package and none of the query elements are assigned to temp package or any other package.
    Once you are sure that all the elements are checked and above told issues are corrected then only create the transport and release them.
    Thanks
    Ajeet

  • TFS 2010: Query over all Collections and Team Projects

    Hi,
    is it possible to generate a query which queries all collections and team project on a TFS?
    For example if I want to know all work items assigned to me. Actually I can only query over a collection and not over the complete TFS.
    How can I do this?
    Thanks,
    Mat

    Hi Mat,
    Thank you for your post.
    You may need write a TFS API to list all team project collections in server. For detail information, you can refer to Taylaf's blog
    Retrieve the List of Team Project Collections from TFS 2010 Client APIs and Paul's blog
    List all TFS Project Collections and Projects.
    I hope this information will help resolve this issue.
    If anything is unclear, please free feel to let me know.
    Regards,
    Lily Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • FM : to call collective Search help and update two fields in SSCR

    Hi Experts,
         I have problem while using collective serach help.
        My scenario is using Collective Search help thru that i want to update 2 fields in my selection screen.
    Thru this function module F4IF_INT_TABLE_VALUE_REQUEST  i can mapping and update two fields using DYNP_VALUE_UPDATE but using this function module i can't able to call my Collective Search help
    in other way
    Thru F4IF_FIELD_VALUE_REQUEST  i can able to call the collective search help but _i can't mapping field and can't updated the
    selection screen field_
    Is any otherway to do it, Please help me ASAP.
    Regards,
    Florian.

    Hi Friends,
    I have the similar kind of requirement. Upon click on a Button on screen i need to call a search help, and collect one or more selected material numbers.
    The search help is working fine and i am getting the entries with the following code.
    The problem is i am finding extra popup on screen.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    tabname         =  space
    fieldname       =  space
    SEARCHHELP      =  'MAT1'
    MULTIPLE_CHOICE =  'X'
    STEPL           =  0
    value           = 'MATNR'
    *dynpprog        =  progname
    *dynpnr          =  dynnum
    *dynprofield     = 'CARRIER'
    CALLBACK_PROGRAM          = 'ZTEST_1_PRA'
    CALLBACK_FORM             = 'F4CALLBACK'
    TABLES
    RETURN_TAB                = RETURN_TAB
    EXCEPTIONS
    FIELD_NOT_FOUND           = 1
    NO_HELP_FOR_FIELD         = 2
    INCONSISTENT_HELP         = 3
    NO_VALUES_FOUND           = 4
    OTHERS                    = 5.

  • Query,insert,update and delete in forms6i

    Hi
    i am new to forms6i, when i tried to update or delete the record it is giving error "FRM-40508 Oracle error: unable to insert record". when i hardcode the update statement it is executing fine. i have checked my sql statement at alert box, it is fine.
    is there any demo programes with insert, delete and update the database records. i have't find the these in forms6i demos. can refer some sites to check.
    thanks

    Hi,
    Before inserting be sure that you are in the correct block. Tables are tied to blocks. You can issue the code
    GO_BLOCK('insert blockname here');
    insert ...
    Hope this helps.
    Regards.
    Bob DJ

  • SCCM2012: Can you create a Query-based "User Collection" using an IP Subnet (or IP Address range) in the Query?

    The topic says it all (I hope).  I am new to 2012 and I have tried to accomplish this feat all day, which includes researching online, but I have had zero success in finding anything helpful.
    Obviously I can create "Device Collections" based on the IP Subnets, and I can do a "Direct Rule" in "User Collections" for the desired IP Subnet, but I do not want to do this because I need the results to update if/when
    any changes occur during a "scheduled/incremental update".
    The only thing I could find for the "User Collections" was this:
    select *  from  SMS_R_User where SMS_R_User.FullUserName = SMS_R_User.UserName and SMS_R_System.IPAddresses like "111.11.1%"
    EXAMPLE (Query for Devices):
    select *  from  SMS_R_System where SMS_R_System.IPAddresses like "111.11.1%"
    Is there a way to Query SCCM (2012) and display the Usernames of computers that login to the (sole) Domain through a specified (or desired) IP Subnet?

    Why do you want to install software by location for a user? Why do you care?
    Why would you want to create a collected of Users with software installed? PCs have the SW install not users so how would you use it?
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ
    I was asked to setup these (Device and User Collections) in this manner so we can limit future distributions/deployments of Applications (and/or Packages) and (OS) Images by these groupings.  Apparently there will be occasions where deployments will need
    to be segmented as such because the company wants to have them grouped in this manner.  If there is a better option available than this, which I would not doubt since I am new to SCCM 2012, then I would appreciate the information.
    IMO, you need to go back to the person asking and get and better understand of exactly what they want and more importantly why.  Making a collection, just in case doesn't make sense.
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Update collection

    I am new to htmldb and collections.....but something is just not clicking for me.
    I have a collection created and it is populated correctly. I am trying to update a record (or is it called member??) in this collection.
    The query to retrieve collection is:
    select distinct htmldb_item.hidden(01,seq_id) seq_id,c001,c002,c003,c004, c005, c006,c007,c008,c009,s.common_name, r.last_name||', '||r.first_name Fisherman
    from htmldb_collections,
    permits p, participants r, species_qc s
    where collection_name = 'ALLOCATE'
    and c007 = p.permit_id
    and p.participant_id = r.participant_id and
    c006 = s.species_itis
    order by fisherman
    the process to update (multiple rows) the collection is:
    declare
    l_status varchar2(10);
    l_cnt number;
    l_county number;
    begin
    -- these records can only be updated. No new records can be added.
    l_status := 'U';
    select count(*) into l_cnt from htmldb_collections where collection_name = 'ALLOCATE';
    FOR i IN 1..l_cnt LOOP
    htmldb_collection.update_member_attribute(
    p_collection_name => 'ALLOCATE',
    p_seq => htmldb_application.g_f01(i),
    p_attr_number => 5,
    p_attr_value=> htmldb_application.g_f05(i) );
    end loop;
    I receive the following error:
    ORA-20103: Member sequence 1641 does not exist in application collection "ALLOCATE"
    the value 1641 seems to be refering to CATCH_SEQ (c004), not SEQ_ID.
    Any help is appreciated!
    thanks, Karen

    Hi Vikas...thanks again for your time on this.
    I am using DISTINCT because my earlier query was pulling in duplicates...of species.
    I have created a new region, with the query SELECT * FROM HTMLDB_COLLECTIONS where COLLECTION_NAME = 'ALLOCATE'. It pulls up 2 records (as did the previous region) with SEQ_ID = 1 and 2.
    I update the column C005 (reported quantity) and then press SAVE. The process UPDATE_COLLECTION runs and I receive an error.
    declare
    l_status varchar2(10);
    l_cnt number;
    l_county number;
    begin
    -- these records can only be updated. No new records can be added.
    l_status := 'U';
    select count(*) into l_cnt from htmldb_collections where collection_name = 'ALLOCATE';
    FOR i IN 1..l_cnt LOOP
    htmldb_collection.update_member_attribute(
    p_collection_name => 'ALLOCATE',
    p_seq => htmldb_application.g_f01(i),
    p_attr_number => '5',
    p_attr_value=> 100 );
    end loop;
    commit;
    end;
    error:
    ORA-20103: Member sequence 1521 does not exist in application collection "ALLOCATE"
    once again, 1521 refers to the value in C003 or the collection. hmm.
    I am certain that this will be an obvious fix...but have been looking at this for the past couple of weeks with no resolve.
    thanks again!

Maybe you are looking for

  • F9IG not showing Payment Item option to reverse it

    Hello Gurus, I have an user who was facing an issue to reverse the payment item, some how I found F9IG tcode to reverse the payment item.But when the user is trying the tcode F9IG to put the payment item and reverse , he is not finding the payment it

  • Need to delete /usr/bin without using terminal

    In a bit of a bind. All how-tos detailing how to delete or alter the /usr/bin file involve terminal, but terminal won't work b/c of this error login: PAM Error (line 396): System error login: Could not determine audit condition [Process completed] I

  • Finding my published site

    When I publish a site and try to find it from another computer I can't. I am using the address as it appears after publishing it. Am I missing something. I do have a .mac account.

  • UNSPSC categorization

    Hi We are using classic scenario. We need to migrate source system(Oracle based) material master data to SRM product master. In source system materials are maintained as UNSPSC. How we map UNSPSC categorization from source system to SRM product maste

  • How to use break&skip to skip in certain condition?

    Hi there, I have a question as following. drop table tbl; create table tbl ( field1 varchar2(10), field2 varchar2(10), field3 number, field4 varchar2(10), field5 varchar2(10) insert into tbl values('1','aaa','111','AAA','!!!!'); insert into tbl value