Need help with correcting the select statement

I have two tables mkt & error.
The fields of mkt are
app_id (xxx)
c_mkt_id
app_mkt_id
The fields of error table are
mkt_id
intr_id (its in format xxx.yyy or xxx)
xyz
abc
pqr
I have to select * fields from error table such that
->mkt.app_id = error.intr_id (here i am using combination of sbstr & instr to get the part before "." if present)
->mkt.c_mkt_id=error.mkt_id
Where ever the above two conditions match i have to replace the mkt_id field in my select * from error table query with the
app_mkt_id field from mkt table. If the above two condtions dont match my select * from error table should return the original mkt_id present in the error table.
I have presently developed a query(*) which selects the app_mkt_id from mkt table where ever the two conditions match.
How should i go about using this to get my actual requirement.
(*)=select app_mkt_id from mkt where app_id in (select case when case_when=1 then substr(intr_id, 1, instr(intr_id,'.')-1) else substr(intr_id, 1) end from (select intr_id, case when instr(intr_id,'.',1)=0 then 0 else 1 end case_when from error)) and
c_mkt_id in (select mkt_id from error)

you wrote:
(*)=select app_mkt_id from mkt where ....What is this?
If you are writing PL/SQL the syntax is:
SELECT ....
INTO ....
FROM ....
WHERE ....This seems to be school work and thus you really need to puzzle this out for yourself.

Similar Messages

  • Need Help in correcting the sql statement

    H Experts,
    I am not if I can post this query in this section, but as I am executing this statement on repository DB , I assumed to post here.
    I have a requirement to calculate the database sizes from the tables in repository.
    table 1 : MGMT$DB_TABLESPACES_ALL : has the information on all the tablespace information from each database. and it has information of all the databases.
    table 2: MGMT$DB_REDOLOGS_ALL : has the information on all the redolog files information from each database. and it has information of all the databases.
    Now to calculate the size of each database , we need to collect the sizes from both tables and then need to add.
    below is the sql i prepared and sql didn't return and systax error , but the final output is completely wrong. Seems like its multiplying the data somewhere and getting the wrong information.
    please help me in doing the required modifications.
    =================================================================================================
    select a.TARGET_NAME "DATABASE_NAME" ,sum(a.TABLESPACE_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE ALLOCATED SPACE(GB)",
    sum(a.TABLESPACE_USED_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE USED SPACE(GB)",
    sum(a.TABLESPACE_SIZE/1024/1024/1024)-sum(a.TABLESPACE_USED_SIZE/1024/1024/1024) "DATABASE FREE SPACE(GB)"
    from MGMT$DB_TABLESPACES_ALL a ,MGMT$DB_REDOLOGS_ALL b
    where a.TARGET_NAME=b.TARGET_NAME and a.TARGET_Name like '%d2oem%'
    group by a.target_name;
    ====================================================================================================
    Note: There are multiple records having the same TARGET_NAME value in both the tables.
    please Help me in correcting the sql statement

    H Experts,
    I am not if I can post this query in this section, but as I am executing this statement on repository DB , I assumed to post here.
    I have a requirement to calculate the database sizes from the tables in repository.
    table 1 : MGMT$DB_TABLESPACES_ALL : has the information on all the tablespace information from each database. and it has information of all the databases.
    table 2: MGMT$DB_REDOLOGS_ALL : has the information on all the redolog files information from each database. and it has information of all the databases.
    Now to calculate the size of each database , we need to collect the sizes from both tables and then need to add.
    below is the sql i prepared and sql didn't return and systax error , but the final output is completely wrong. Seems like its multiplying the data somewhere and getting the wrong information.
    please help me in doing the required modifications.
    =================================================================================================
    select a.TARGET_NAME "DATABASE_NAME" ,sum(a.TABLESPACE_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE ALLOCATED SPACE(GB)",
    sum(a.TABLESPACE_USED_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE USED SPACE(GB)",
    sum(a.TABLESPACE_SIZE/1024/1024/1024)-sum(a.TABLESPACE_USED_SIZE/1024/1024/1024) "DATABASE FREE SPACE(GB)"
    from MGMT$DB_TABLESPACES_ALL a ,MGMT$DB_REDOLOGS_ALL b
    where a.TARGET_NAME=b.TARGET_NAME and a.TARGET_Name like '%d2oem%'
    group by a.target_name;
    ====================================================================================================
    Note: There are multiple records having the same TARGET_NAME value in both the tables.
    please Help me in correcting the sql statement

  • Question: Need help with overcoming the following message:  "Nothing was imported.

    Need help with overcoming the following message:  “Nothing was imported.  The file(s) or folder(s) selection to import did not contain any supported file types, or the files are already in this catalogue”.
    The photos being scanned are old film shots.  They have NOT been previously scanned.  I am using Photoshop Elements 9 software.
    QUESTION:  how do I override this STOP and or circumvent the photo comparison option????
    Thanks for the help. Bob K ---  [email protected]

      Are you scanning as jpeg, tiff or some other format?
    Are you using continuous numbering for files names as by definition scanned files have no exif data.
     

  • Need to fetch only the select statement

    Hi ,
    I am able to fetch all the select statements from my program if program name as my input.
    I want only the select statement where we fetch the field entries like
    select single from mara
    select * from mara
    select count(*)
    select matnr from mara
    like this i want to fetch i dont want to display the select-options or start-of-selection .

    Hello Shwetha
    If the function module <b>RS_PROGRAM_TABLES</b> (function group <b>SEA1</b>) is available on your system you can run this fm with the following parameters:
    - OBJECT_TYPE = 'TRAN'   " transaction
    - OBJECT_NAME = 'VA03'  " example
    - OBJECT_TYPE = 'PROG'   " report
    - OBJECT_NAME = 'SAPMV45A'  " example: report executed by VA03
    The fm returns you a list of tables that are accessed.
    Regards,
      Uwe

  • I just bought my MacBook Pro 13" and I tried to install an anti virus but then it went into a grey folder with a question mark I need help with restoring the iOS please

    I need help taking out the grey folder with the question mark and I've try everything except the CD thing because my MacBook didn't come with one so I really need help please

    What anti-virus software did you install? Although there's a lot of bad anti-virus software out there, no anti-virus software should cause such a problem. A gray screen with a flashing question mark on a folder means that no bootable system could be found, which means that the system was badly damaged or corrupt. Even installing bad software would not normally cause that, so either there was something badly wrong with the system already or the anti-virus software you tried to install was really, really bad!
    As mende1 says, you need to reinstall the system at this point. After your system is back up and running, read my Mac Malware Guide. If, after reading that, you want anti-virus software, use one of the programms recommended in that guide.

  • Need help with accessing the program.

    I need help with accessing my adobe creative cloud on my windows 8.1 laptop. I have an account but do not have an app. I need this for my online classes. Please help!

    Link for Download & Install & Setup & Activation may help
    -Chat http://www.adobe.com/support/download-install/supportinfo/

  • Help with a update,select statement

    Hi all please can you help me with a update statement i am struggling with.
    I have 2 tables
    Holiday and data
    In the Holiday table i have columns for
    Machine_ID NUMBER,
    date_from DATE,
    date_to DATE,
    ID NUMBER
    Machine column represents a type of machine, the two dates represent the start and end date of a holiday and ID represents the ID of the machines that the holiday effects (as you can have many machines that are the same, so the ID unique field to seperate them.
    i.e.
    996     25-DEC-08 00:00:00     27-DEC-08 00:00:00     91     
    996     25-DEC-08 00:00:00     27-DEC-08 00:00:00     92     
    100     28-DEC-08 00:00:00     29-DEC-08 00:00:00     1
    100     28-DEC-08 00:00:00     29-DEC-08 00:00:00     2
    In the data table i have the following columns:
    DATE DATE
    Machine NUMBER
    SHIFT1S DATE
    SHIFT1F DATE
    SHIFT2S DATE
    SHIFT2F DATE
    CALS DATE
    CALF DATE
    CAP NUMBER
    CALCAP NUMBER
    total_hrs_up NUMBER
    In here i have data for every date in the calendar. The machines are cross references with the machine in holidays table.
    I run two shifts so have shift 1 start, finish. shift 2 start, finish. These are dates with times, so shift1s could be 01-01-08 09:00:00 shift1f could be 01-01-08 17:00:00.
    shift2S could be 01-01-08 21:00:00 shift2f could be 01-01-08 23:59:00.
    so that machine would be up between them hours of the day.
    Other columns include
    CALS, ,CALF = calendar start, finish, - This needs to be populated from the holiday table. currently null. So if the date is the 26 DEC and the machine is the same as what is in the holiday table then these two columns should be populated with them data
    CAP is the total number of these machines i have available.
    CALCAP is the no of machines the holiday affects -currently null
    total_hrs_up is the number of hours this machine is up and running -currently null.
    So what i need to do is populate the cals, calf calcap, total_hrs_up columns.
    total_hrs_up is the important one, this needs to work out based on the two shift patterns the number of hours that the machine is available and then take off the holiday hours to give a final value.
    so current data example in data is
    date machine shifts shiftf shift2s shift2f cals, calf, cap, calcap, total_hrs
    16-JUL-08     100 09:00:00     17:00:00     12:00:00     00:00:00               '','','',1     ,''     
    16-JUL-08     105 09:00:00     17:00:00     12:00:00     00:00:00               '','','',1     ,''
    16-JUL-08     107 09:00:00     17:00:00     12:00:00     00:00:00               '','','',1     ,''
    id like to see based on the holiday table if there is a holiday then this data is updated as such and a total_hrs machine is available populated on that date.
    Any help is very much appreciated!
    Thanks

    Hi,
    The following query does what you requested.
    It makes the following assumptions:
    (a) in data, shift1start <= shift1finish
    (b) in holiday, hol_start <= hol_finish
    (b) in data, the combination (machine, shift1start) is unique
    (c) in holiday, hol_start <= hol_finish
    (d) in holiday, rows for the same machine and id never have overlapping dates (including times). For example:
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 07:00:00', '26-DEC-08 09:59:59');
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 09:00:00', '26-DEC-08 09:59:59');will cause a probem. Multiple rows for the same machine and day are okay, however, if the times do not overlap, like the following:
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 07:00:00', '26-DEC-08 08:59:59');
    INSERT INTO holiday (machine, id, date_from, date_to)
    VALUES (200, 1, '26-DEC-08 09:00:00', '26-DEC-08 09:59:59');Here's the UPDATE statement:
    UPDATE     data     m
    SET     (     hol_start
         ,     hol_finish
         ,     no_of_available_minutes
         ) =
    (     SELECT     MIN (date_from)
         ,     MAX (date_to)
         ,     (     MAX (shift1finish - shift1start)     -- Total from data
              -     ( NVL     ( SUM     ( LEAST (date_to, shift1finish)
                             - GREATEST (date_from, shift1start)
                        , 0
                        )                    -- Total from holiday
                   / MAX (total_no_of_machines)          -- Average
              ) * 24 * 60                         -- Convert days to minutes
         FROM          data     d
         LEFT OUTER JOIN     holiday     h     ON     h.machine     = d.machine
                             AND NOT     (     date_from     > shift1finish
                                  OR      date_to          < shift1start
         WHERE          d.machine     = m.machine
         AND          d.shift1start     = m.shift1start
    );The subquery has to use its own copy of data (that is, in needs d, not m), since the subquery has to return a non-NULL number of minutes when no rows in h match m.

  • Need help with changing the name.

    I got my palm pre from an uncle who lives in the states. The problem is I can't call tech support to ask them because I live in belize. The proble I have with my pre is that I have added my email account to the phone, but when I send an email, they receive it in my uncles name, my name is lanny and they receive an email form cesar, I think you can see where the problem lies. Is there anyway I can change it to my name? Please help!
    Post relates to: Pre p100eww (Sprint)

    Hello and thank you for using the Palm Help Forums!
    I would create a new Palm Profile. To do this you will need to go to the Device Info app, Reset Options, then select Full Erase. All pictures, videos, and anything else stored in the USB side of the device will be erased. I recommend that if you want to keep any of that to connect your device to a computer then click and drag everything you want to keep off of the device and onto your computer.
    After you perform the Full Erase the device is going to reboot. It is going to come up with a screen to sign in to a Palm Profile or Create a New Palm Profile. NOTE*** You will need a data connection to do this. Select Create a New Palm Profile and fill in the blanks. Once you are back into the device you can set up your email accounts again and it should display the name you created the Palm Profile with.
    I hope this helps,
    -Pat

  • Need Help with Creating the SQl query

    Hi,
    SQL query gurus...
    INFORMATION:
    I have two table, CURRENT and PREVIOUS.(Table Defs below).
    CURRENT:
    Column1 - CURR_PARENT
    Column2 - CURR_CHILD
    Column3 - CURR_CHILD_ATTRIBUTE 1
    Column4 - CURR_CHILD_ATTRIBUTE 2
    Column5 - CURR_CHILD_ATTRIBUTE 3
    PREVIOUS:
    Column1 - PREV_PARENT
    Column2 - PREV_CHILD
    Column3 - PREV_CHILD_ATTRIBUTE 1
    Column4 - PREV_CHILD_ATTRIBUTE 2
    Column5 - PREV_CHILD_ATTRIBUTE 3
    PROBLEM STATEMENT
    Here the columns 3 to 5 are the attributes of the Child. Lets assume that I have two loads, One Today which goes to the CURRENT table and one yesterday which goes to the PREVIOUS table. Between these two loads there is a CHANGE in the value for Columns either 3/4/5 or all of them(doesnt matter if one or all).
    I want to determine what properties for the child have changed with the help of a MOST efficient SQL query.(PARENT+CHILD is unique key). The Database is ofcourse ORACLE.
    Please help.
    Regards,
    Parag

    Hi,
    The last message was not posted by the same user_name that started the thread.
    Please don't do that: it's confusing.
    Earlier replies give you the information you want, with one row of output (maximum) per row in current_tbl. There may be 1, 2 or 3 changes on a row.
    You just have to unpivot that data to get one row for every change, like this:
    WITH     single_row  AS
         SELECT     c.curr_parent
         ,     c.curr_child
         ,     c.curr_child_attribute1
         ,     c.curr_child_attribute2
         ,     c.curr_child_attribute3
         ,     DECODE (c.curr_child_attribute1, p.prev_child_attribute1, 0, 1) AS diff1
         ,     DECODE (c.curr_child_attribute2, p.prev_child_attribute2, 0, 2) AS diff2
         ,     DECODE (c.curr_child_attribute3, p.prev_child_attribute3, 0, 3) AS diff3
         FROM     current_tbl    c
         JOIN     previous_tbl   p     ON  c.curr_parent     = p.prev_parent
                                AND c.curr_child     = p.prev_child
         WHERE     c.curr_child_attribute1     != p.prev_child_attribute1
         OR     c.curr_child_attribute2     != p.prev_child_attribute2
         OR     c.curr_child_attribute3     != p.prev_child_attribute3
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 3
    SELECT     s.curr_parent     AS parent
    ,     s.curr_child     AS child
    ,     CASE     c.n
              WHEN  1  THEN  s.curr_child_attribute1
              WHEN  2  THEN  s.curr_child_attribute2
              WHEN  3  THEN  s.curr_child_attribute3
         END          AS attribute
    ,     c.n          AS attribute_value
    FROM     single_row     s
    JOIN     cntr          c     ON     c.n IN ( s.diff1
                                    , s.diff2
                                    , s.diff3
    ORDER BY  attribute_value
    ,            parent
    ,            child
    ;

  • Task Scheduling Script - Need help with passing the scheduled command (variables are not being evaluated)

    Hi Everyone,
    I'm trying to get a simple task scheduler script to work for me and can't get the command I need passed to the scheduler to evaluate properly.
    Here's the script:
    ###Create a new task running $Command and execute it Daily at 6am.
    $TaskName = Read-Host 'What would you like this job to be named?'
    $Proto = Read-Host 'What is the protocol? (FTP/FTPS/SFTP)'
    $User = Read-Host 'What is the user name?'
    $Pwd = Read-Host 'What is the password?'
    $Server = Read-Host 'What is the server address?'
    $NetworkDir = Read-Host 'Please input the network location of the file(s) you wish to send. Refer to documentation for more details.'
    $RemoteDir = Read-Host 'Please input the REMOTE directory to which you will upload your files. If there is none please input a slash'
    $Command = 'winscp.com /command "option batch abort" "option confirm off" "open $Proto://$User:$Pwd@$Server" "put $NetworkDir $RemoteDir" "exit"'
    $TaskAction = New-ScheduledTaskAction -Execute "$Command"
    $TaskTrigger = New-ScheduledTaskTrigger -Daily -At 6am
    Register-ScheduledTask -Action $TaskAction -Trigger $Tasktrigger -TaskName "$TaskName" -User "Administrator" -RunLevel Highest
    Write-Host "$TaskName created to run Daily at $TaskStartTime"
    What's messing up is the $Command creation, the command needs to have the quotes around "option blah blah", but if I wrap the whole line in single quotes the variables that are evaluated for the "open blah blah" strings (which also need
    to be inside quotes) and the "put blah blah" string are not being evaluated properly.
    I've dorked about with different bracketing and quoting but can't nail the syntax down, could someone point me in the right direction? My Google-fu seems to be lacking when it comes to nailing down this issue.
    Thanks

    Hmmn, closer. I'm getting this error now:
    + $Command = $tmpl -f  $User, $Pwd, $Server, $NetworkDir, $RemoteDir
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (winscp.com /com...t {4} {5}" exit:String) [], RuntimeException
        + FullyQualifiedErrorId : FormatError
    And the command being added to the new task looks like this:
    winscp.com /command "option batch abort" "option confirm off" "open ($Proto)://($User):($Pwd)@($Server)" "put $NetworkDir $RemoteDir" "exit"
    Here's the current state of the script. I get what you're doing to try to bypass the quotes issue, using an array. I'm just not awesome at this yet sooooooo...
    $TaskName = Read-Host 'What would you like this job to be named?'
    $Proto = Read-Host 'What is the protocol? (FTP/FTPS/SFTP)'
    $User = Read-Host 'What is the user name?'
    $Pwd = Read-Host 'What is the password?'
    $Server = Read-Host 'What is the server address?'
    $NetworkDir = Read-Host 'Please input the network location of the file(s) you wish to send. Refer to documentation for more details.'
    $RemoteDir = Read-Host 'Please input the REMOTE directory to which you will upload your files. If there is none please input a slash'
    $tmpl = 'winscp.com /command "option batch abort" "option confirm off" "open {0}://{1}:{2}@{3}" "put {4} {5}" exit'
    $Command = $tmpl -f $User, $Pwd, $Server, $NetworkDir, $RemoteDir
    $TaskAction = New-ScheduledTaskAction -Execute $Command
    $TaskTrigger = New-ScheduledTaskTrigger -Daily -At 6am
    Register-ScheduledTask -Action $TaskAction -Trigger $Tasktrigger -TaskName "$TaskName" -User "Administrator" -RunLevel Highest
    Write-Host "$TaskName created to run Daily at $TaskStartTime"

  • Need help with correction inscript for duplication on regular basis

    Hi,
    I am using Oracle 10.2.0.4 on Win 2008 R2. We have Archive mode enabled and no rman catalog is used. I have a requirement where i have to duplicate prod sevrer on regular basis to development server.
    I have created few batch files so that the entire process in automated. Stored all the scripts in c:\script\clone\ directory.+
    I have taken the backup copy of password and spfile from prod server and copied to the development server in same location.
    These are the scripts i run in order:
    *1_clone.bat*
    set ORACLE_SID=orcl
    sqlplus / as sysdba @c:\script\clone\2_test.bat
    *2_test.bat*
    shutdown immediate
    startup nomount
    host rman target sys/oracle@live nocatalog auxiliary / @c:\script\clone\3_rman.rcv
    *3_rman.rcv*
    run {
    allocate auxiliary channel d1 type disk;
    duplicate target database to ORCL NOFILENAMECHECK;
    exit
    When the duplication process in about to finish, i get below error:
    contents of memory script:
    shutdown clone;
    startup clone nomount;
    executing Memory Script
    RMAN-03002: failure of duplicate DB command at 07/31/2012 08:02:21
    RMAN-03015: error occured in stored script memory script
    RMAN-06136: Oracle error from auxiliary database: ORA-01013: user requested cancel of current operation
    Recovery Manager complete
    SQL>
    When i press exit, this window closes and i can run the alter database open resetlogs;+ command from a new sql prompt. I check online and some suggest there might be a window open with system user connected. Please suggest any changes in the script.
    Best Regards,

    Hello;
    Having another session with system user will cause rman to throw this error. For example another session used to start up database in nomount mode still being active.
    Duriing the cloning process the rman session needs to be exclusively connected to the auxiliary instance (no other session are allowed).
    Duplicate post
    request for help with rman cloning script
    Best Regards
    mseberg
    Edited by: mseberg on Jul 31, 2012 5:02 AM

  • Help with a simple select statement

    $x = oci_parse($c, "select quantity from balance where item_num=101");
    oci_execute($x);
    echo "the quant is: ".$x;
    I try to run this select statement without success
    then I tried...
    $x = oci_parse($c, "select quantity from balance where item_num=101");
    $y= oci_execute($x);
    echo "the quant is: ".$y;
    and it didn't work either...
    What should I change?
    thanks!

    The Oracle library operates a bit differently from some other PHP libraries, notably MySQL/MySQLi. With Oracle (OCI8), you have to execute the statement, and then afterward use an oci_fetch...() function to pull things from your $statement variable. Here's a small example that hopefully will illustrate the basic usage:
    <?php
         $conn = oci_connect('hr','hr','xe');
         if(!$conn) {
              echo 'Could not connect!';
              exit;
         $sql = 'select * from jobs';
         $stmt = oci_parse($conn, $sql);
         if(!$stmt) {
              echo 'Could not parse query.';
              exit;
         $result = oci_execute($stmt, OCI_DEFAULT);
         if(!$result) {
              echo 'Could not execute query.';
              exit;
         echo "Query ran successfully.\n";
         // Fetch rows as associative arrays, so
         // we can ask for values by column name.
         // Other options include oci_fetch_row(),
         // oci_fetch_array(), and oci_fetch_object().
         // Note that oci_fetch_assoc() will create
         // an associative array using upper-case
         // column names for the keys.
         while(($row = oci_fetch_assoc($stmt)) != null)
              echo $row['JOB_ID'] . ': ' . $row['JOB_TITLE'] . "\n";
         echo "All data returned.\n";
         oci_close($conn);
    ?>When I run this, I get the following:
    C:\workspace\php>php select.php
    Query ran successfully.
    AD_PRES: President
    AD_VP: Administration Vice President
    AD_ASST: Administration Assistant
    FI_MGR: Finance Manager
    FI_ACCOUNT: Accountant
    AC_MGR: Accounting Manager
    AC_ACCOUNT: Public Accountant
    SA_MAN: Sales Manager
    SA_REP: Sales Representative
    PU_MAN: Purchasing Manager
    PU_CLERK: Purchasing Clerk
    ST_MAN: Stock Manager
    ST_CLERK: Stock Clerk
    SH_CLERK: Shipping Clerk
    IT_PROG: Programmer
    MK_MAN: Marketing Manager
    MK_REP: Marketing Representative
    HR_REP: Human Resources Representative
    PR_REP: Public Relations Representative
    All data returned.
    C:\workspace\php>For more information, take a look at the OCI8 library documentation in the PHP manual online:
    OCI8
    http://us.php.net/manual/en/book.oci8.php
    Some other examples
    http://us.php.net/manual/en/oci8.examples.php
    Kind regards,
    Christopher L. Simons

  • Need help with SQL for selecting ID where the sequence does not match..

    I have the following dilemma:
    Database contains IDs as follows:
    Incident#, Case#, & Part Sequence#
    example
    Record 1
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 1
    Record 2
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 2
    Sometimes the user will delete (let's say) Record 2 after creating a new Record 3
    So now the sequencing goes as follows:
    Record 1
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 1
    Record 2
    Incident_Number = 123456
    Case_Number = 1
    Part_sequence = 3
    Now there will no longer be a Part_Sequence 2
    Need a SQL to select all records where the maximum part sequence > than the count of Incident_number||'-'||Case_number
    I tried the following:
    select a.incident_number||'-'||a.case_number||'-'||a.part_sequence
    from chsuser.a_compl_summary a
    where a.entry_date >= '01-may-2011'
    and max(a.part_sequence) > count(distinct a.incident_number||'-'||a.case_number)I end up getting a ORA-00934: group function is not allowed here (highlighting on the Max(a.part_sequence) portion.
    Any suggestions/hints
    Thanks

    select  incident_number || '-' || case_number || '-' || part_sequence
      from  (
             select  incident_number,
                     case_number,
                     part_sequence,
                     max(part_sequence) over(partition by incident_number,case_number) max_seq,
                     count(*) over(partition by incident_number,case_number) cnt
               from  chsuser.a_compl_summary
               where entry_date >= DATE '2011-05-01'
      where cnt != max_seq
    /SY.

  • Need help in correcting the BW Delta loads

    Hi All,
    I have deleted entire data of the data targets and the init request of that data target,
    but I need to correct that now, please guide me with ur suggestions:
    I have tried with the following options, but it is not bringing the old data from the r3 system.
    1) I ran the init without data transfer and then the delta, but it didn't bring any records.
    2)I ran the init without data trnafer and then did the fullload, but I am unable to activate the full load request as it gave the error message indicating there is init, so full request can't be activated.\
    I am using 3.5 system.
    Please give ur suggestion.
    Thanks,
    Vinay

    Hi,
    Since you are using an AP (A/c Payable) extractor, it is FI related & do as one of the fellow users has suggested.
    Kindly go through the Notes mentioned above.
    You need to fill the setup tables only if its Logistics data (LO).
    Also, try doing a fresh INIT with Data Trasnfer. And, then setup your Delta InfoPackage in the Process Chain.
    Hope this helps.
    Regards
    Vishal

  • Need help in giving the selection criteria

    Hi Guyz,
    I have a table with to fields, From_field and to_field and i have a selection screen field s_input.
    Now i need to fetch the row where s_input is between from_field and to_field.
    I have written the logic as from_field >= s_input AND
                                               to_field <= s_input.
    It is not giving the correct results.
    Can you suggest an alternative way to giving the condition.
    Regards,
    Chitrasen

    Hi Chitrasen,
    can you please bit clear about your requirement.
    your input field is S_INPUT , Is It between FROM_DATE and TO_DATE  or You need to fetch the data based on input passed in Selection screen ( LOW and HIGH value ) ?
    Logic :
    If your Input is a select option , try to write a logic like below.
    Where FROM_DATE IN S_INPUT and TO_DATE in S_INPUT.
    Edited by: Prasath Arivazhagan on May 27, 2010 2:41 PM

Maybe you are looking for

  • IView not found error when excuting ABAP Web Dynpro iView

    Hi Experts, I have created one ABAP Web Dynpro iView for an existing Application. Parameters I have passed for iView creation. Namespace : sap Application Name: SampleApp System Name: R3_SYS. Can any one please pass on me the details what are the man

  • Pulling video from dvd at highest quality for use in Final Cut

    i am a high school bb coach and i got a couple tv games on DVD from the TV station. i want to add them into my highlight video - but the quality is poor when i use hand brake then convert with mpeg streamclip... am i doing something wrong - or is the

  • Printing a PDF document to Adobe PDF rotates 90degrees clockwise

    When I print a PDF document (scanned) to the Adobe PDF printer the resulting document is rotated 90 degrees clockwise. Regardless what settings are in Pro or the Adobe PDF writer. How do I prevent Acrobat Pro or Adobe PDF from rotating documents? (CS

  • Multiple user entities in OIM?

    Hi, everyone, Just getting my feet wet with OIM 11g, and I have a situation where I need different categories of users to have different user attributes associated with them. The Oracle docs don't seem to tell me how to set this up. Can I define more

  • No Display - Target disk mode to PC

    the display went dead on my ibook. Nothing displays on an external monitor either. I don't have access to another Mac computer, only a PC. Is it possible to use target disk mode with firewire to my PC? Any ideas for getting data off my hard drive, wo