Help need in Update query

Hi friends,
os
id
ot_id
ot
ot
os_id
I will be having more records for ot_id in the table os, now i want to update the max(id) from os for each ot_id in that table to the os_id in the ot table
help me in this please

Use MERGE :
merge into os a
using (select max(rowid) keep (dense_rank last order by id) rwd from os group by ot_id) b
on    (a.rowid=b.rwd)
when matched then update set a.id = (select os_id from ot c where a.ot_id=c.ot);But maybe with a concret example we will be able to give you a better answer.
Nicolas.

Similar Messages

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • Help needed I updated my ipad2 with iOS5 but few of my dashbaords are not working now can any one let me know how to downgrade the OS

    Help needed I updated my ipad2 with iOS5 but few of my dashbaords (HTML5) are not working now ,can any one let me know how to downgrade the OS as we have a meeting coming up .. its urgent

    Downgrading the iOS is not supported. If you are using Safari this try clearing its cache via Settings > Safari.
    If that doesn't work then try closing Safari completely and then re-open it : from the home screen (i.e. not with Safari 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Safari app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    A third option is a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Help needed with Update statements.

    Hello All,
    I am trying to learn Berkeley XMLDB and facing problem to query the inserted XML file. I have a small XML file with the following contents:
    <?xml version="1.0" standalone="yes"?>
    <Bookstore>
    <Book>
    <book_ID>1</book_ID>
    <title>Harry Potter and the Order of the Phoenix</title>
    <subtitle>A Photographic History</subtitle>
    <author>
    <author_fname>J.K.</author_fname>
    <author_lname>Rowling</author_lname>
    </author>
    <price>9.99</price>
    <year_published>2004</year_published>
    <publisher>Scholastic, Inc.</publisher>
    <genre>Fiction</genre>
    <quantity_in_stock>28997</quantity_in_stock>
    <popularity>20564</popularity>
    </Book>
    </Bookstore>
    When I try to update the TITLE of this node I have the following error message:
    C:\Users\Chandra\Desktop\BDB>javac -classpath .;"C:\Program Files\Sleepycat Soft
    ware\Berkeley DB XML 2.1.8\jar\dbxml.jar";"C:\Program Files\Sleepycat Software\B
    erkeley DB XML 2.1.8\jar\db.jar" bdb.java
    bdb.java:75: illegal start of expression
    public static final String STATEMENT1 = "replace value of node collection("twopp
    ro.bdbxml")/Bookstore/Book/bookid/title with 'NEWBOOK'";
    ^
    bdb.java:80: ')' expected
    System.out.println("Done query: " + STATEMENT1);
    ^
    2 errors
    But when I remove the update statements and just try to display the TITLE of this node, I dont see any outputs. Please help me to catch up with my mistakes. Below is source code I am using to run this functionality.
    Thanks.
    import java.io.File;
    import java.io.FileNotFoundException;
    import com.sleepycat.db.DatabaseException;
    import com.sleepycat.db.Environment;
    import com.sleepycat.db.EnvironmentConfig;
    import com.sleepycat.dbxml.XmlContainer;
    import com.sleepycat.dbxml.XmlException;
    import com.sleepycat.dbxml.XmlInputStream;
    import com.sleepycat.dbxml.XmlManager;
    import com.sleepycat.dbxml.XmlUpdateContext;
    import com.sleepycat.dbxml.XmlDocument;
    import com.sleepycat.dbxml.XmlQueryContext;
    import com.sleepycat.dbxml.XmlQueryExpression;
    import com.sleepycat.dbxml.XmlResults;
    import com.sleepycat.dbxml.XmlValue;
    public class bdb{
    public static void main(String[] args)
    Environment myEnv = null;
    File envHome = new File("D:/xmldata");
    try {
    EnvironmentConfig envConf = new EnvironmentConfig();
    envConf.setAllowCreate(true); // If the environment does not
    // exits, create it.
    envConf.setInitializeCache(true); // Turn on the shared memory
    // region.
    envConf.setInitializeLocking(true); // Turn on the locking subsystem.
    envConf.setInitializeLogging(true); // Turn on the logging subsystem.
    envConf.setTransactional(true); // Turn on the transactional
    envConf.setRunRecovery(true);
    // subsystem.
    myEnv = new Environment(envHome, envConf);
    // Do BDB XML work here.
    } catch (DatabaseException de) {
    // Exception handling goes here
    } catch (FileNotFoundException fnfe) {
    // Exception handling goes here
    } finally {
    try {
    if (myEnv != null) {
    myEnv.close();
    } catch (DatabaseException de) {
    // Exception handling goes here
    XmlManager myManager = null;
    XmlContainer myContainer = null;
    // The document
    String docString = "D:/xmldata/test.xml";
    // The document's name.
    String docName = "cia";
    try {
    myManager = new XmlManager(); // Assumes the container currently exists.
    myContainer =
    myManager.createContainer("twoppro.bdbxml");
    myManager.setDefaultContainerType(XmlContainer.NodeContainer); // Need an update context for the put.
    XmlUpdateContext theContext = myManager.createUpdateContext(); // Get the input stream.
    XmlInputStream theStream =
    myManager.createLocalFileInputStream(docString); // Do the actual put
    myContainer.putDocument(docName, // The document's name
    theStream, // The actual document.
    theContext, // The update context
    // (required).
    null); // XmlDocumentConfig object
    theStream.delete();
    // Update the title
    public static final String STATEMENT1 = "*replace value of node collection("twoppro.bdbxml")/Bookstore/Book/[bookid=1]/title with 'NEWBOOK'";*
    XmlQueryContext context = myManager.createQueryContext();
    XmlQueryExpression queryExpression1 = myManager.prepare(STATEMENT1, context);
    System.out.println("Try to execute query: " +
    System.out.println("Done query: " + STATEMENT1);
    queryExpression1.execute(context);
    // Get a query context
    XmlQueryContext context = myManager.createQueryContext();
    // Set the evaluation type to Lazy.
    context.setEvaluationType(XmlQueryContext.Lazy);
    // Declare the query string
    String queryString =
    "for $u in collection('twoppro.dbxml')/Bookstore/Book/[bookid=1]"
    + "*return $u/title";*
    // Prepare (compile) the query
    XmlQueryExpression qe = myManager.prepare(queryString, context);
    XmlResults results = qe.execute(context);
    System.out.println("ok");
    System.out.println(results);
    } catch (XmlException e) {
    // Error handling goes here. You may want to check
    // for XmlException.UNIQUE_ERROR, which is raised
    // if a document with that name already exists in
    // the container. If this exception is thrown,
    // try the put again with a different name, or
    // use XmlModify to update the document.
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } finally {
    try {
    if (myContainer != null) {
    myContainer.close();
    if (myManager != null) {
    myManager.close();
    } catch (XmlException ce) {
    // Exception handling goes here

    Thanks Rucong. The change you suggested did helped me to run the program correct. But I also have the display function to retrive the results and my program is parsed without any output.
    C:\Users\C\Desktop\BDB>Clientbuild.bat
    C:\Users\C\Desktop\BDB>javac -classpath .;"C:\Program Files\Sleepycat Soft
    ware\Berkeley DB XML 2.1.8\jar\dbxml.jar";"C:\Program Files\Sleepycat Software\B
    erkeley DB XML 2.1.8\jar\db.jar" bdb.java
    C:\Users\C\Desktop\BDB>Client.bat
    C:\Users\C\Desktop\BDB>java -classpath .;"C:\Program Files\Sleepycat Softw
    are\Berkeley DB XML 2.1.8\jar\dbxml.jar";"C:\Program Files\Sleepycat Software\Be
    rkeley DB XML 2.1.8\jar\db.jar" bdb
    See there is no OUPUT displayed. Is there somethinglike a 'print' I have to use in this java code.
    Any ideas ? Below is the code I am using now
    import java.io.File;
    import java.io.FileNotFoundException;
    import com.sleepycat.db.DatabaseException;
    import com.sleepycat.db.Environment;
    import com.sleepycat.db.EnvironmentConfig;
    import com.sleepycat.dbxml.XmlContainer;
    import com.sleepycat.dbxml.XmlException;
    import com.sleepycat.dbxml.XmlInputStream;
    import com.sleepycat.dbxml.XmlManager;
    import com.sleepycat.dbxml.XmlUpdateContext;
    import com.sleepycat.dbxml.XmlDocument;
    import com.sleepycat.dbxml.XmlQueryContext;
    import com.sleepycat.dbxml.XmlQueryExpression;
    import com.sleepycat.dbxml.XmlResults;
    import com.sleepycat.dbxml.XmlValue;
    public class bdb{
    public static void main(String[] args)
    Environment myEnv = null;
    File envHome = new File("D:/xmldata");
    try {
    EnvironmentConfig envConf = new EnvironmentConfig();
    envConf.setAllowCreate(true); // If the environment does not
    // exits, create it.
    envConf.setInitializeCache(true); // Turn on the shared memory
    // region.
    envConf.setInitializeLocking(true); // Turn on the locking subsystem.
    envConf.setInitializeLogging(true); // Turn on the logging subsystem.
    envConf.setTransactional(true); // Turn on the transactional
    envConf.setRunRecovery(true);
    // subsystem.
    myEnv = new Environment(envHome, envConf);
    // Do BDB XML work here.
    } catch (DatabaseException de) {
    // Exception handling goes here
    } catch (FileNotFoundException fnfe) {
    // Exception handling goes here
    } finally {
    try {
    if (myEnv != null) {
    myEnv.close();
    } catch (DatabaseException de) {
    // Exception handling goes here
    XmlManager myManager = null;
    XmlContainer myContainer = null;
    // The document
    String docString = "D:/xmldata/test.xml";
    // The document's name.
    String docName = "cia";
    try {
    myManager = new XmlManager(); // Assumes the container currently exists.
    myContainer =
    myManager.createContainer("twoppro.bdbxml");
    myManager.setDefaultContainerType(XmlContainer.NodeContainer); // Need an update context for the put.
    XmlUpdateContext theContext = myManager.createUpdateContext(); // Get the input stream.
    XmlInputStream theStream =
    myManager.createLocalFileInputStream(docString); // Do the actual put
    myContainer.putDocument(docName, // The document's name
    theStream, // The actual document.
    theContext, // The update context
    // (required).
    null); // XmlDocumentConfig object
    theStream.delete();
    // Update the title
    String STATEMENT1 = "for $n in collection('twoppro.bdbxml')/Bookstore/Book[book_ID=1]/title return replace value of node $n with 'NEWBOOK'";
    XmlQueryContext context = myManager.createQueryContext();
    XmlQueryExpression queryExpression1 = myManager.prepare(STATEMENT1, context);
    System.out.println("Done query: " + STATEMENT1);
    queryExpression1.execute(context);
    // Get a query context
    XmlQueryContext thiscontext = myManager.createQueryContext();
    // Set the evaluation type to Lazy.
    context.setEvaluationType(XmlQueryContext.Lazy);
    // Declare the query string
    String queryString =
    "for $u in collection('twoppro.dbxml')/Bookstore/Book/[bookid=1]"
    + "return $u/title";
    // Prepare (compile) the query
    XmlQueryExpression qe = myManager.prepare(queryString, thiscontext);
    XmlResults results = qe.execute(thiscontext);
    System.out.println("ok");
    System.out.println(results);
    } catch (XmlException e) {
    // Error handling goes here. You may want to check
    // for XmlException.UNIQUE_ERROR, which is raised
    // if a document with that name already exists in
    // the container. If this exception is thrown,
    // try the put again with a different name, or
    // use XmlModify to update the document.
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } finally {
    try {
    if (myContainer != null) {
    myContainer.close();
    if (myManager != null) {
    myManager.close();
    } catch (XmlException ce) {
    // Exception handling goes here
    Thanks.

  • Help with a update query from a subquery

    Hello All,
    I wanted to see if someone can help me with an update query.
    I need to grab a latitude & longitude from a the same user that is in two accounts. therefore i am trying to update lat/long in a users table for one account based off of the same user in another account. I am matching the users up by phone number and last name. I tried a subquery but am having difficulty.
    I was thinking of something like the following:
    update users
    set lat = getlat, long = getlong
    inner join (select lat as getlat, long as get long from users where account_id = '1')
    on phone = phone and last name = lastname
    where account_id = '2' and lat IS NULL and long IS NULL
    Am I going in the right direction???
    Thanks in advance for any assistance!!!!

    What difficulty are you having? Have you tried what you posted and get an error?
    Although someone may be able to give you sql advice here, I would try posting this over at Stack Overflow as its not really related to Coldfusion.

  • Help with an update query

    I have two tables, one is sierra_price, which just has a part_number and a sierra_list
    I have another table called products which is already populated with the parts from sierra_price, just no prices. It also has other products in it that are not included in sierra_price
    What I need to do is update products with the base_price where products.sku is the same as sierra_price.part_number
    I'm using db 10.2
    I'm having trouble with this query...
    UPDATE products
    SET base_price = (select sierra_list from sierra_price where products.sku = sierra_price.part_number)
    WHERE products.mfg_account_id = 4
    I get the error:
    ORA-01427: single-row subquery returns more than one row
    Edited by: user10785816 on Jan 16, 2009 9:18 AM

    I got it to run with the query:
    Update
    (Select base_price bp, sierra_list sp from products p, sierra_price s where p.sku = s.part_number and p.mfg_account_id = 4)
    SET bp = sp
    I also had to set the primary key in sierra_price to the part_number to get it to work.
    I'm quite new to SQL, but cheers for trying to help me!

  • Help needed for SQL query

    hello ,
    I am a beginner in terms of writing sql queries. I hope some body can help me out.
    I have two tables
    mysql> desc user_group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | userAccountId | char(8) | | PRI | | |
    | groupId | char(8) | | PRI | | |
    ---------------------------------------------------+
    2 rows in set (0.00 sec)
    mysql> desc group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | id | char(8) | | PRI | | |
    | name | char(50) | YES | | NULL | |
    | email | char(100) | YES | | NULL | |
    | description | char(254) | YES | | NULL | |
    | parentId | char(8) | YES | | NULL | |
    | creatorId | char(8) | YES | | NULL | |
    | createDate | char(20) | YES | | NULL | |
    | updateDate | char(20) | YES | | NULL | |
    | updatorId | char(8) | YES | | NULL | |
    ---------------------------------------------------+
    9 rows in set (0.00 sec)
    what I want is list of all groups with id,name and #of members(which is the # of rows in the user_group_t for any given id). Importantly I need the groups with 0 members also to be listed. In short my output should contain exactly the same number of rows as in group_t table with an additional column indicating # of members for that group.
    Any help would be greatly appreciated.
    Thanks in Advance.
    -Vasanth

    Thanks Donald,
    Actually I figured it out, with the following query:
    select id,name,sum(if(groupid is not null,1,0)) as members from group_t left join user_group_t on id=groupid group by id;
    I tried your solution, but mysql says there is an error at '+' . Anyway I modified your solution to the one below and it worked.
    select a.id, a.name, count(b.groupid) from group_t a left join user_group_t b on a.id=b.groupid group by a.id, a.name;
    I tried that before but then I used Count(*) instead of count on groupid. Your solution is elagant and I will go with yours.
    Thanks again.
    Vasanth

  • Urgent help needed on 1 query

    Hello All,
    I have just started working in PL/SQL,
    I need some help on 1 urgent issue.
    i have a table lets say which has structure and values like below:
    ID Data Key Data Value
    1 Firstname X
    2 Lastname Y
    3 Middlename Z
    but my query shd return me data having firstname ,middlenale and last name as column names and lvalues like lsited below:
    Firstname Middlename Lastname
    X Y Z
    Please help and i really appreciate for your time and help!!!!!!!!!!
    Thanks and Regards

    Urgent? I don't think so.
    However, as others have mentioned, what groups the items together so that the relationship is known between them?
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, 'Firstname' as data_key, 'Fred' as data_val from dual union all
      2             select 2, 'Surname', 'Bloggs' from dual union all
      3             select 3, 'Middlename', 'J' from dual union all
      4             select 4, 'Firstname', 'John' from dual union all
      5             select 5, 'Surname', 'Doe' from dual union all
      6             select 6, 'Middlename', 'D' from dual)
      7  --
      8  select id-decode(data_key,'Surname',1,'Middlename',2,0) as id
      9        ,max(decode(data_key,'Firstname',data_val)) as Firstname
    10        ,max(decode(data_key,'Middlename',data_val)) as Middlename
    11        ,max(decode(data_key,'Surname',data_val)) as Surname
    12  from t
    13* group by id-decode(data_key,'Surname',1,'Middlename',2,0)
    SQL> /
            ID FIRSTN MIDDLE SURNAM
             1 Fred   J      Bloggs
             4 John   D      Doe
    SQL>This example assumes that a Firstname, Surname and Middlename appear in that order with sequential ID's, such that the ID for Surname is always 1 more than the ID for it's associated Forename and the ID for Middlename is always 2 more than the associated Forename.

  • Help needed in select query

    Hi,
    I need to select the max time for the transaction using the below query. I’m able to get the o/p. Here the problem is I need to fetch the corrletorid (primary key) as well. if try to get that I’m getting the o/p like case2.
    I want the o/p to be like case 1 with the corrleator id . plz help me to get the o/p.
    Case 1: select b.TransactionName, max(to_char(b.duration, 'mm/dd/yyyy hh24:mi:ss.ff')) as average from trandetails a,subtrandetails b where a.CORRELATORID=b.PCORRELATORID and b.PCORRELATORID='11' group by b.transactionname
    TRANSACTIONNAME MAXTIME
    FINT3 12/10/2007 19:53:09.042000
    FINT 12/10/2007 19:31:07.042000
    FINT2 12/10/2007 19:31:07.042000
    SQL> /
    Case 2: select b.TransactionName,b.correlatorid, max(to_char(b.duration, 'mm/dd/yyyy hh24:mi:ss.ff')) as average from trandetails a,subtrandetails b where a.CORRELATORID=b.PCORRELATORID and b.PCORRELATORID='11' group by b.transactionname,b.correlatorid
    SQL> /
    TRANSACTIONNAME CORRELATORID AVERAGE
    FINT2 102 12/10/2007 19:31:07.042000
    FINT3 108 12/10/2007 19:53:09.042000
    FINT3 103 12/10/2007 19:31:07.042000
    FINT 101 12/10/2007 19:31:07.042000
    in the above output i should have only record(max time) for FINT3.
    Thank

    Sharma,
    Please find the below sample data(insert stmt and create table):
    ======================================
    create table trandetails(
    correlatorid varchar2(20) CONSTRAINT correlatorid_FKey REFERENCES Subtrandetails(correlatorid),
    username varchar2(25) NOT NULL,
    applicationname varchar2(25) NOT NULL,CONSTRAINT composite1_pkey1 PRIMARY KEY(correlatorid ,applicationname));
    create table Subtrandetails(
    correlatorid varchar2(20) PRIMARY KEY,
    PCORRELATORID      varchar2(20),
    TransactionName varchar2(25) NOT NULL,
    Machinename varchar2(15) NOT NULL,
    STARTDATE timestamp NOT NULL,
    ENDDATE timestamp NOT NULL,
    SourceName varchar2(25),
    FunctionName varchar2(25),
    LOC number(5),
    CONTEXTPROPERTY1 varchar2(25),
    CONTEXTPROPERTY2 varchar2(25),
    CONTEXTPROPERTY3 varchar2(25),
    TransactionStatus varchar2(25) NOT NULL CONSTRAINT Transaction1_Status_chk Check (TransactionStatus in ('Success', 'Failure', 'Abort')));
    INSERT INTO trandetails VALUES ('11','FINAPP','ANUAPP1');
    INSERT INTO trandetails VALUES ('13','FINTEST','ANUAPP2');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('10','1','ARM','blrkec95931d','10-DEC-07 03.24.07.042000 PM','10-DEC-07 03.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('11','1','ARM1','blrkec95931d','10-DEC-07 04.24.07.042000 PM','10-DEC-07 04.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('12','1','ARM2','blrkec95931d','10-DEC-07 05.24.07.042000 PM','10-DEC-07 05.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('13','1','ARM3','blrkec95931d','10-DEC-07 06.24.07.042000 PM','10-DEC-07 06.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('14','1','ARM4','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('101','11','FINT','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('102','11','FINT2','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('103','11','FINT3','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('104','13','SAP1','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('105','13','SAP2','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('106','13','SAP3','blrkec95931d','10-DEC-07 07.24.07.042000 PM','10-DEC-07 07.31.07.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('107','13','SAP2','blrkec95931d','10-DEC-07 07.2.10.042350 PM','10-DEC-07 07.50.10.042050 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('108','11',' FINT3 ','blrkec95931d','10-DEC-07 07.16.07.042000 PM','10-DEC-07 07.53.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('109','108','FINT3','blrkec95931d','10-DEC-07 07.20.07.042000 PM','10-DEC-07 07.59.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('110','108','FINT3','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('111','108','FINT4','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('112','108','FINT5','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('113','108','FINT6','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    INSERT INTO
    Subtrandetails(correlatorid,PCORRELATORID ,TransactionName,Machinename,STARTDATE,ENDDATE ,TransactionStatus )
    VALUES ('114','108','FINT7','blrkec95931d','10-DEC-07 07.18.07.042000 PM','10-DEC-07 07.57.09.042000 PM','Success');
    ======================================
    Thanks.

  • Help needed in a Query

    I have a table TAB that has two colums. COL1 and COL2. Both are composite Primary key.
    The data is as
    COL1 COL2
    1 C
    2 C
    3 C
    4 G
    5 G
    1 G
    3 G
    6 G
    7 G
    I need to find out those COL1 values whose COL2 values are C and G. Ex
    COL1 COL2
    1 C
    3 C
    1 G
    3 G
    So i need the following op
    COL1
    1
    3
    Please help me to solve this query.
    Regards.
    Message was edited by:
    SID

    and what have you tried ????
    SQL> With t As
      2    (
      3    Select 1 c1, 'C' c2 From DUAL Union All
      4    Select 2,     'C'   From DUAL Union All
      5    Select 3,     'C'   From DUAL Union All
      6    Select 4,     'G'   From DUAL Union All
      7    Select 5,     'G'   From DUAL Union All
      8    Select 1,     'G'   From DUAL Union All
      9    Select 3,     'G'   From DUAL Union All
    10    Select 6,     'G'   From DUAL Union All
    11    Select 7,     'G'   From DUAL
    12    )
    13    Select t.c1, t.c2
    14    From
    15    t,
    16    (
    17    Select c1, c2
    18    From t
    19    Where c2 = 'C'
    20    ) c,
    21    (Select c1, c2
    22     From t
    23     Where c2 = 'G'
    24     ) g
    25  Where t.c1 = c.c1
    26  And   t.c1 = g.c1
    27  --And   c.c2 = g.c2;
            C1 C2
             1 C
             1 G
             3 C
             3 G
    SQL>
    /*using analytical functons*/
    SQL>
    SQL> With t As
      2    (
      3    Select 1 c1, 'C' c2 From DUAL Union All
      4    Select 2,     'C'   From DUAL Union All
      5    Select 3,     'C'   From DUAL Union All
      6    Select 4,     'G'   From DUAL Union All
      7    Select 5,     'G'   From DUAL Union All
      8    Select 1,     'G'   From DUAL Union All
      9    Select 3,     'G'   From DUAL Union All
    10    Select 6,     'G'   From DUAL Union All
    11    Select 7,     'G'   From DUAL
    12    )
    13   select c1, c2
    14         from ( select c1,c2, case when c2 = 'C' then count(decode(c2,'G',1)) over (partition by c1)
    15                                    when c2 = 'G' then count(decode(c2,'C',1)) over (partition by c1)
    16                               else 0 end count                           
    18                from t
    19            )
    20      where Count != 0
    21  /
            C1 C2
             1 C
             1 G
             3 C
             3 GMessage was edited by:
    Nicloei W

  • Help needed with update from 3GS

    I have an iPhone 3GS and am trying to update the software to ISO 4.. I have followed all the usual steps and connected my iPhone to iTunes and clicked update and all it says is that my iTunes software is up to date at 9.1.. But on the summary page it stills says that my iPhone software is 3.1.. How am I meant to update it? Help!

    You need to click on your device in iTunes to bring up the iPhone summary page. It if from there that you update your iPhone software.
    Message was edited by: gdgmacguy

  • Help needed on update rules Coding

    Hi BW Gurus.
    Please help me out.
    I am working on BI 7.0
    This is my scenario.I need to take a project cost report.
    There are some projects in cProjects and some projects in R/3 (Project System).
    Each project in cProjects is linked with one or more projects in R/3.
    They are linked by means of GUID.Now I need to pull out a report from a infocube(Z infocube) which has information both from R/3 and cProjects.I built a Z infocube.
    Here comes my problem.
    I need to write update rule for the requirement explained below.
    For all the projects(in cProjects) I need to find its GUID from the table-DPR_PROJECT . These GUIDs are contained in this table under the field name GUID.
    The same GUID numbers I can find it in another table-DPR_OBJLINK under the field PROJECT_GUID. For this PROJECT_GUID numbers, I need to identify the corresponding EXTERNAL_ID(this field is in the table-DPR_OBJLINK) of the projects(These projects are R/3 projects). These EXTERNAL_ID values has to be pulled out in the report.
    I am using the extractor 0CO_OM_WBS_1.
    Please help me out with the update rule code.
    Please help me out as soon as possible.
    Its really urgent my dear friends
    Thanks in Advance,
    Have a nice day
    Regards,
    Sam Mathew

    Hi Raogovind,
    For which state are you customising this Professional Tax? Professional Tax wage type is /422.
    The system determines the professional tax payable by an employee, based on the following factors:
    Professional tax basis u2013 Comprises those salary components on which a professional tax is applicable. The salary components to be included for calculating the professional tax basis depend on the state. The different components are:
    Basic pay
    Dearness allowance
    Medical reimbursement perquisite
    Housing
    Profits in lieu of salary
    Other remuneration that an employee receives regularly
    Bonus
    It is depending on the combination of the Personnel Area, Personnel sub area and the professional tax grouping of the employee, that the system identifies factors such as the:
    Components of the professional tax basis.
    Method and the frequency of calculating and deducting professional tax.
    Hope this information helps you solve the issue.
    Edited by: chandra.saphr on Aug 6, 2009 7:10 AM

  • Help on tuning update query

    Hi,
    I work on below version of oracle.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Productio
    NLSRTL Version 10.2.0.5.0 - ProductionI have below the table structure and index created on the table. I have given the update and it's execution plan also. Can you please suggest a way to tune this query
    Table has close to 50 million records in it.
    Thanks much in advance for helping
    SQL> CREATE TABLE TABLE1
      2  (
      3    COL1    CHAR(6 BYTE)                        NOT NULL,
      4    COL2    NUMBER(13)                          NOT NULL,
      5    COL3    CHAR(2 BYTE),
      6    COL4    CHAR(3 BYTE),
      7    COL5    CHAR(5 BYTE),
      8    COL6    CHAR(7 BYTE),
      9    COL7    NUMBER(4),
    10    COL8    NUMBER(6),
    11    COL9    NUMBER(9),
    12    COL10    NUMBER(6),
    13    COL11    CHAR(1 BYTE),
    14    COL12    CHAR(2 BYTE)
    15  )
    16  TABLESPACE AGGREGNAT_DAT_2012T4
    17  PCTUSED    0
    18  PCTFREE    5
    19  INITRANS   1
    20  MAXTRANS   255
    21  STORAGE    (
    22              INITIAL          80K
    23              NEXT             1M
    24              MINEXTENTS       1
    25              MAXEXTENTS       2147483645
    26              PCTINCREASE      0
    27              BUFFER_POOL      DEFAULT
    28             )
    29  NOLOGGING
    30  COMPRESS
    31  NOCACHE
    32  NOPARALLEL
    33  MONITORING;
    Table created.
    SQL> CREATE INDEX IND_TABLE1 ON TABLE1
      2  (COL1, COL3, COL4, COL5, COL6,COL7)
      3  NOLOGGING
      4  TABLESPACE AGGREGNAT_IDX_2012T4
      5  PCTFREE    5
      6  INITRANS   2
      7  MAXTRANS   255
      8  STORAGE    (
      9              INITIAL          64K
    10              NEXT             256K
    11              MINEXTENTS       1
    12              MAXEXTENTS       2147483645
    13              PCTINCREASE      0
    14              BUFFER_POOL      DEFAULT
    15             )
    16  NOPARALLEL
    17  COMPRESS 6;
    Index created.
    SQL> explain plan for UPDATE TABLE1 o1
      2        SET o1.COL12 = 1
      3        WHERE COL4 <> 'MDD'
      4         AND EXISTS
      5        ( SELECT 'E' FROM TABLE1 o2
      6        WHERE o2.COL3 = o1.COL3 AND o2.COL4 = o1.COL4
      7                    AND o2.COL6 = o1.COL6 AND o2.COL7 = o1.COL7 AND o2.COL1 = o1.COL1
      8        AND  ( o2.COL9 < o1.COL9 OR ( o2.COL9 = o1.COL9 AND o2.rowid < o1.rowid))AND o2.COL5 = o1.COL5);
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3057860847
    | Id  | Operation                     | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT              |           |  9868K|   705M|   126M  (1)|422:03:56 |
    |   1 |  UPDATE                       | TABLE1    |       |       |            |          |
    |*  2 |   FILTER                      |           |       |       |            |          |
    |*  3 |    TABLE ACCESS FULL          | TABLE1    |    25M|  1808M| 87011   (4)| 00:17:25 |
    |*  4 |    TABLE ACCESS BY INDEX ROWID| TABLE1    |     1 |    71 |     5   (0)| 00:00:01 |
    |*  5 |     INDEX RANGE SCAN          | IND_TABLE1 |     1 |       |     4   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - filter( EXISTS (SELECT 0 FROM "TABLE1" "O2" WHERE "O2"."COL7"=:B1 AND
                  "O2"."COL6"=:B2 AND "O2"."COL5"=:B3 AND "O2"."COL4"=:B4 AND "O2"."COL3"=:B5 AND
                  "O2"."COL1"=:B6 AND ("O2"."COL9"<:B7 OR "O2"."COL9"=:B8 AND "O2".ROWID<:B9)))
       3 - filter("COL4"<>'MDD')
       4 - filter("O2"."COL9"<:B1 OR "O2"."COL9"=:B2 AND "O2".ROWID<:B3)
       5 - access("O2"."COL1"=:B1 AND "O2"."COL3"=:B2 AND "O2"."COL4"=:B3 AND
    PLAN_TABLE_OUTPUT
                  "O2"."COL5"=:B4 AND "O2"."COL6"=:B5 AND "O2"."COL7"=:B6)
    Note
       - dynamic sampling used for this statement
    27 rows selected.Thank you very much for guiding
    Edited by: user12869307 on Feb 6, 2013 8:52 PM
    Edited by: user12869307 on Feb 6, 2013 9:09 PM
    Edited by: user12869307 on Feb 6, 2013 9:11 PM

    Well,
    it depends. The query is still a bit confusing to me.
    You are trying to update rows having col4 different than 'MDD' if exists another row having same value for (COL1, COL3, COL4, COL5, COL6,COL7) and having a lower or equal value of col9.
    What are the business requirements? Do you have some sample data and can explain the logic of this update?
    This one:
    ( o2.COL9 < o1.COL9 OR ( o2.COL9 = o1.COL9 AND o2.rowid < o1.rowid))can actually be written in this way
    (o2.COL9 <= o1.COL9 AND o2.rowid < o1.rowid)but why using o2.rowid < o1.rowid?
    .>
    You should not trust on rowid order.
    Check what Tom Kyte is saying in Fetching last record from a table
    the rowid is not "generated" in as much as "derived"
    The rowid is the address of the row on disk.
    Since space can and will be reused, rowids can and will be "reused"
    A rowid implies NOTHING other than the location of the row physically. It does not imply age, order of insertion, or anything like that. Regards.
    Al
    Edited by: Alberto Faenza on Feb 6, 2013 5:10 PM

  • Help need on Update rules

    Hi BW Gurus.
    Please help me out.
    I am working on BI 7.0
    This is my scenario.I need to take a project cost report.
    There are some projects in cProjects and some projects in R/3 (Project System).
    Each project in cProjects is linked with one or more projects in R/3.
    They are linked by means of GUID.Now I need to pull out a report from a infocube(Z infocube) which has information both from R/3 and cProjects.I built a Z infocube.
    Here comes my problem.
    I need to write update rule for the requirement explained below.
    For all the projects(in cProjects) I need to find its GUID from the table-DPR_PROJECT . These GUIDs are contained in this table under the field name GUID.
    The same GUID numbers I can find it in another table-DPR_OBJLINK under the field PROJECT_GUID. For this PROJECT_GUID  numbers, I need to identify the corresponding EXTERNAL_ID(this field is in the table-DPR_OBJLINK) of the projects(These projects are R/3 projects). These EXTERNAL_ID values has to be pulled out in the report.
    I am using the extractor 0CO_OM_WBS_1.
    I am not sure if I am giving enough information with my question.
    Please help me out with the update rule code.
    Thanks in Advance,
    Have a nice day
    Regards,
    Sam Mathew

    try this one:
    tables  /BI0/MROUTE.
    if COMM_STRUCTURE-route is initial.
    RESULT = 0.
    else.
    SELECT single * from /BI0/MROUTE
    where route = COMM_STRUCTURE-ROUTE and
      OBJVERS = 'A'.
    if sy-subrc = 0.
    RESULT = /BI0/MROUTE-/BIC/ZLEADDAYS.
    endif.
    ENDIF.
    Hope it helps!
    Bye,
    Roberto

  • Help needed on updating

    My Ipod crashed, tried everything on the help site, but it didnt work so i sent it in for a service. A new Ipod arrived today so I tried to update the settings. On getting to the IPOD updater screen, when I connect the IPOd it says iPod updater 2004-08-06 cannot install firmware on connected Ipod. The Ipod s hardware and and the updater firmware are incompatible. I have been to the download updater page, but I cant find an icon to let me update. Please help

    Emma,
    I'm sorry for all the trouble you are having. I am fairly new here in the discussions so I don't know all the trick.
    I do have open another page with the link address I gave you. The page is headed "Get new ipod updater". Below that is a section asking for apple id & password followed by an area to open account if you have not already and finally below that is the download box to check. If that doesn't work then we will have to wait for one with better knowlege than mine to help. There are a lot of great people on the discussions. They helped me in my time of need.
    Good Luck Again!

Maybe you are looking for

  • TS2972 I have done all of these things and the sharing is still not working. Please help

    I have shared itunes on my other computers, but for some reason it is not working on mynew one.  I have turned the firewall off on both and have done everything else, and it still won't work. Please help!

  • Button not working into a movieClip

    Hi i have made a movieclip and there is 2 buttons into that movieClips I have added Events on those buttons but those are not working. here my code links.demoButton.addEventListener(MouseEvent.CLICK.democlick) links.livelinkButton.addEventListener(Mo

  • 500-Internal server error on saving release template

    Hi Team, I am facing this issue while saving the release template. I have added a new stage in this template, copied another stage to the new one and started editing the values. On saving the template this error is showing, please see the error messa

  • MAJOR PROBLEMS!!!! pleassee help me :'(

    Last night at 11:30 I went to go sync my iPod (8 GB touch) becuase I wanted to update teh photos. I walked away for 1 : 00 minute. I come back....it says that it's done, but only 108 photos have been transfered/are on the device, there should have be

  • Indesign CS5 Crash on load

    Can you help me with this? Process:         Adobe InDesign CS5.5 [3199] Path:            /Applications/Adobe InDesign CS5.5/Adobe InDesign CS5.5.app/Contents/MacOS/Adobe InDesign CS5.5 Identifier:      com.adobe.InDesign Version:         7.5.3.333 (7