PIVOT LOGIC NEEDED

Hi All,
I need to pass the condition as sysdate , sysdate -1 in 'for ' in pivot clause in oracle but am geting the error as 'ORA-56901: non-constant expression is not allowed for pivot|unpivot values' . I need to pass condition as sysdate only not any hard code vlaue. is it possible?
create table pivot_eg ( due_dt date);
insert into pivot_eg values ('16-mar-11');
insert into pivot_eg values ('15-mar-11');
insert into pivot_eg values ('14-mar-11');
insert into pivot_eg values ('13-mar-11');
insert into pivot_eg values ('12-mar-11');
select * from pivot_eg
pivot (count(due_dt) for due_dt in (sysdate as dt ,sysdate-1 as dt1))
is it possible i can use sysdate in for or else i shud go for case kinda pivot example? Please help me

Hi,
Convert the pivot column into fixed values first, like this:
WITH     got_days_ago     AS
     SELECT     TRUNC (SYSDATE) - TRUNC (due_dt)     AS days_ago
     FROM     pivot_eg
     WHERE     due_dt     >= TRUNC (SYSDATE) - 1
     AND     due_dt     <  TRUNC (SYSDATE) + 1
SELECT     *
FROM     got_days_agO
PIVOT     (   COUNT (*)
     FOR days_ago IN     ( 0     AS dt
               , 1     AS dt1
;The WHERE clause is for efficiency only. Filter out unwanted rows as early as possible.
Sorry, I'm not at an Oracle 11 database now, so I can't test it.
user2639048 wrote:
... create table pivot_eg ( due_dt date);
insert into pivot_eg values ('16-mar-11'); ...Due_dt is a DATE. Trying to insert2 VARCHAR2 values into a DATE column is asking for trouble. Sometimes we get what we ask for,
Insert DATEs into DATE columns, like this
INSERT INTO pivot_eg (due_dt) VALUES  (TO_DATE ('16-mar-2011', 'DD-mon-YYYY')); or this:
INSERT INTO pivot_eg (due_dt) VALUES  (DATE '2011-03-16');

Similar Messages

  • Why does logic need to be "warmed up"?

    Whenever I start logic pro 7.1.1 and load up my most recent song, I always have to go through a series of core overloads. Most of my softsynths ( I typically use around 25 ) are EXS24 samples, and it seems as though whenever I load up an instrument I have a huge spike in CPU when a new note is played for the first time, and then it plays fine after that. The problem is when I load up a song and press play, I have to go through an annoying and tedious series of core overloads every time a new note is played until logic cashes all of the notes and I can actualy get to work. Is there any settings that I should change so logic will play the song the first time?
    My core audio settings
    256mb buffer
    larger disk buffer
    medium process buffer range
    power book g4 1.5ghz 512mb ram logic 7.1.1 pro

    512mb ram
    That's problem #1
    larger disk buffer
    Not a good idea, in view of your low RAM.
    Are you using an external drive for your projects?
    Having said that, I know this has been mentioned here before, so you might want to search for EXS24+missing notes. I think it was iSchwartz that had a theory about this - but I know that even with plenty of memory it seems that Logic needs its pump primed sometimes.

  • Things that Logic needs to be #1!!!!

    I think Logic needs to do some work on the waveform edit.
    More like Pro Tools.
    Right now, the main thing i miss is not to be able to quantize an Apple Loop. I mean, some parts of the loop that are offbeat are impossible to quantize.
    Message was edited by: Bob Antis

    Yes,i mean the blue apple loops.
    I wouldn't even mind if i could tweak the normal aiff loops like Ableton Live or Pro Tools, to be able to quantize by yourself with precision!
    I think Apple should include that in their next update, it's so important for waveform editing. My self, i edit a loop in Pro Tools,then export it and work it in Logic, it's so frustrating!!!

  • Fail safe logic needed for purchase order upload program

    Hello all,
    i am working on creating PO's by reading data from a text file. I need to implement fail safe logic in it, which is to make sure this program uploads all the records in the text file successfully. For example, i have 1000 records in my text file and while running the upload program if the program times out while creating the 500th PO or if SAP is down at that time, then we have 499 PO's created and 501 yet to be created. But if we run the same program again, we will generate duplicate PO's for 499 again. I want to avoid this kind of problem.
    How do i implement this idea?
    Kindly guide me on this.
    Thanks.

    Ok ..
    Then I would suggest you use Application Log to keep the success and error messages of PO processing.
    You can check trsnaction SLG0 and create your own application log object.
    Then you need to use FMs BAL_LOG_* to crate and add messages to it.
    This way you will have a facility to check as which of your records are converted to PO for a run.
    In case SAP gets down in between , still you can find the details using Xn SLG1 and then accordingly remove the records from your file which are already converted to PO.
    Thanks,
    Ram

  • Logic needed to print blank line in alv report

    hi experts,
    can anyone please tell me the logic for this
    i want to logic one is
    1) in alv report contains
    a set of data contains 100 (5 datas)
    and a set of data contain 200(5 datas)
    i want to have one coloum containing serial no
    ex for 100 i want to move no '5' to one coloumn ,but it should display only ones not for all 5 records.
    same for 200 also i want to move 7 to this ,it should b displayed ones
    i used for at new command alos its not working
    2)suppose for particular date, 200 related records is not there
    it should conatin blank line,displaying 'NIL'.
    SO THE OPT FROMAT MUST BE
    MATNR            DOCNO
    100                  1000
    100                  1000
    100                    "
    100                     "
    100                    "
    200                   2000
    200                      "
    200                     "
    200                    "
    200                    "
    SUPPOSE 200 RECORD IS NOT THERE THE OPT SHLD B
    100           1000
    100            1000
    200           NIL

    Arun,
    1)
    If you are using the  function module REUSE_ALV_GRID_DISPLAY, then use the internal table it_sort with a row for the column where you want the suppression of repeated values.
    2)
    If you are using the  function module REUSE_ALV_GRID_DISPLAY, then simply ensure that your internal table t_outtab has the rows that you need containing 'NIL'.
    John

  • Logic needed in selection screen

    hi experts,
       in  a selection screen i have one field S_budat ( it contains the range ) the user enters the date in it .the problum is we need to check the following condition .
    if sy-datum> s_budat+13 months if it is ok we need get the values from the archive db else r/3 data .but in the mean while we have to check residency limit ( for ex: the data is archived till 22-03-2007. but in the selection screen  the user entered the range 20-2-2006 to 24-5-2007 this falls in the both .so for this how to write the logic .till 22-03-2007 we have to take the data from the archive DB after thatwe have to take online data )
    points will be reworded.

    You can check whether the Achive date lies between the range.
    If it does, then create 2 records in the select-option table
    1) from s_budat-low to arcive date
    2) from archive date to s_budat-high.
    Now you can do 2 selects 1 on archived tables , other on R/3 data using these 2 date ranges.
    For the 2nd select , you can use the "appending" addition in the select statement

  • With out using pivot function need a Query

    Hi
    I am having table which has 7 columns
    data in table:
    ID,Region,area, year-month,  sales_target, actual_sales,
    1, abc,    xyz,   200907,       1000,          500
    2, abc,    pqr,   200908,       2000,         1500
    3, mnr,   xyz,   200907,       3000,          2000
    I need the data in year and  month with out using pivot funtion
    intial
    region, area,    jul,   aug, sep, oct .......jun
    abc,     xyz,    1000,0,     0,    0...         0
    actual
    region, area,    jul,   aug, sep, oct .......jun
    abc,     xyz,    500,   0,     0,    0...         0Thanks

    Here it is
    with d as ( select 1 ID, 'abc' Region, 'xyz' area, 200907 yearmonth,  1000 sales_target, 500 actual_sales from dual
    union all   select 2, 'abc',    'pqr',   200908,       2000,         1500 from dual
    union all   select 3, 'mnr',   'xyz',   200907,       3000,          2000 from dual
    select  region, area,
    max(case extract(month from to_date(yearmonth,'yyyymm')) when 7 then sales_target
    else 0 end ) TGT_JUL
    max(case extract(month from to_date(yearmonth,'yyyymm')) WHEN 8 then sales_target
    else 0 end ) TGT_AUG
    max(case extract(month from to_date(yearmonth,'yyyymm')) WHEN 9 then sales_target
    else 0 end ) TGT_SEP
    from d
    group by  region, area
    REG ARE    TGT_JUL    TGT_AUG    TGT_SEP
    abc pqr          0       2000          0
    mnr xyz       3000          0          0
    abc xyz       1000          0          0You can copy and replicate the results for another one - actual_sales.

  • Soundtrack Pro making a LOT of files - used to working in Logic, need help

    So I'm used to working with Logic Studio/7.2/etc, and it's my first foray into working with Soundtrack Pro at work. My questions are this: When I use the razorblade tool (since I can't find an equivalent to the split tool in logic) in soundtrack to cut up a sequence, it seems to be creating a LOT of extra files:
    http://www.1217design.com/pics/stp_question.png is an example of what I mean. Is this supposed to happen? The recorded files themselves were done in FCP and sent to Soundtrack Pro via the Send to STP Multitrack session function.
    What I'm trying to find out is: Is this supposed to be happening? How can I stop this from happening? Are all of these extra files necessary in order to export the final project? And what will happen if I delete them?
    I just want to know because the folder is now 4.71gb for a 30 second audio file (the final aif export is roughly 30mb), and there's over 200 of these extra files that have been created in the process of working on this project.
    If this is what is necessary to work in Final Cut then I won't be able to work with FCP due to size issues (which is a shame as I feel so much more comfortable working within that environment than I do working in FCP).
    Thanks for the help in advance,
    Sean

    Sean A wrote:
    By doing this, will it still create all of those extra files? That's what I'm trying to figure out. Is it just from the blade tool being used?
    For all edits, yeah, baby, STP will generate more files than cows create methane.
    First, I know what works for me, but I'm still learning, so I strongly encourage you to keep a COMPLETE BACKUP of all projects until you know your workflow. Also, you may have Preferences set up differently than I do, so you may not find the same paths as what I describe here.
    When you have an audio file the way you want it, and you're confident that you won't need those edit files again (be SURE) Process > Flatten All Actions (or Audible Actions) and Save that audio file. Then -- as I understand it so far -- you can safely trash all the edits related to that file. (If you use Photoshop or similar visual programs, it's the same idea.)
    During my first few weeks of intensive STP work, my drive grew more and more sluggish, for no reasons known to me. I saw disk space shrinking rapidly. Finally I figured it had to have something to do with STP, so I started searching and eventually I found my edits piling up in home/Documents/Soundtrack Pro Documents, especially (for me) in Edited Media. Since they all came from projects I'd finished and exported to AAC and MP3, I was comfortable trashing them all. Suddenly, whoa, I had an extra 12 GB of disk space available.
    Just keep those edit files until you are CERTAIN that you know what you're doing and that you're DONE. Otherwise, when some project needs one precious little 3MB turn of a phrase, you may find yourself confronting suicidal or homicidal tendencies.
    I welcome further clarification and/or correction from people who know more and can explain it better.
    Best,
    chuck

  • Logic needed on general abap

    Hi Experts
    I am having a list of TAXCODES like.
    "CA" "CC" "CD" "DA" "DE" "WS"
    Now in purchase orders if  i am having different line items having the above TAX CODES.
    i need to pass a variable &XXX& which is having text to sap script form.
    And if the Purchase order having line items which is having one of the taxcode above for one line item and the other line item having diifferent  taxcode like V0 etc { for these case i dont need to send text data }
    and if the PO  having one tax code for all line items.{ i need to send the data }
    how to achive this
    i am trying in this way
        SELECT ebeln
               ebelp
               mwskz          "Tax code
          FROM ekpo
          INTO TABLE lt_ekpo
          WHERE ebeln = v_ebeln
         AND   mwskz in r_mwskz
          AND loekz = ''.
        DESCRIBE TABLE lt_ekpo LINES lv_count.
        lt_ekpo1[] = lt_ekpo[].
        SORT lt_ekpo1 BY ebelp DESCENDING.
        READ TABLE lt_ekpo1 INTO wa_ekpo INDEX 1.
        v_ebelp1 = wa_ekpo-ebelp.
        CLEAR wa_ekpo.
    LOOP AT lt_ekpo INTO wa_ekpo.
          IF sy-tabix = 1.
            lv_taxcode = wa_ekpo-mwskz.
         ELSE.
            IF lv_taxcode NE wa_ekpo-mwskz.
              lv_diff_tax = 'X'.
           if  lv_taxcode EQ 'CA' or lv_taxcode EQ 'CC' or lv_taxcode EQ 'CD' OR lv_taxcode EQ 'DA' OR lv_taxcode EQ 'DE' or  lv_taxcode EQ 'WS'.
             ELSE.
           ENDIF.
          ENDIF.
    please provide the logic for the above case.
    Edited by: suribabu124 on Apr 26, 2010 4:13 PM

    hi
    this can be done using rages
    Regards
    Suresh

  • Logic needed urgent

    Hi Friends,
    I need logic (code for the following requirement.
    1. Bank guarantees received are entered by F-57 transaction as a noted item in system and the following data will be captured in the respective field.
    Document date: Bank Guarantee date
    Posting date: Date of entry         
    Reference field: BG Number
    Document header text: Bank guarantee type
    Assignment: Bank name
    Special G/L Assignment: Bank account number
    Text: Bank address
    Due date: Claim end date
    2. Posting keys (BSEG-BSCHL) 39 & 29 are used in F-57 transaction with special G/L Indicator (BSEG-UMSKZ) at time of Entering statistical postings and Reversal respectively
    3. Cross check the period of validity of bank guarantee by comparing the due date (BSEG-ZFBDT) at the time of entering statistical postings and Document date (BKPF-BLDAT) at the time of Reversal.
    4. If the bank guarantee cancels or reversed before due date (BSEG-ZFBDT) cancellation date i.e. Document date of reversal is to be populated in the report and in other case the due date is to be populated in the report.
    Selection screen has the fields
    BKPF-BUKRS   Mandatory
    LFA1/BSEG-LIFNR     Optional
    BSEG-ZFBDT     Optional
    BKPF-BLADT     Optional
    The o/p structure has the following fields
    BKPF-XBLNR     BG NO(Reference)
    BSEG-LIFNR     Vendor code
    LFA1-NAME1     Vendor Name
    BKPF-BLDAT     Start date(Document date)
    BSEG-ZFBDT     End date(Due date)
    BSEG-WRBTR     Amount
    BKPF-WAERS     Currency
    BSEG-ZUONR     Bank Name(Assignment)
    BSEG-SGTXT     Bank Address
    BSEG-HZUON     Account Number
    BKPF-BKTXT     BG Type
    BSEG-ZFBDT     Claim end date

    Hi,
    define internal table
    It_bseg with fields BURKS, BELNR,GJAHR, BUZEI and other field (look the output fields).
    it_bkpf with fields BURKS, BELNR,GJAHR anmd other required fields.
    it_lfa1 with fields LIFNR and NAME1.
    NOw
    SELECT BURKS, BELNR,GJAHR ,<other required fileds>
             into table it_bkpf  from BKPF
    where BUKRS  in/= <selectionscreen-burks>
    and bladt in/= <selectionscreen--bladt>.
    If it_bkpf[] is not initial.
    select BURKS, BELNR,GJAHR, BUZEI and other fields
       into  table it_bseg from bseg
    for all entries in it_bkpf
    where burks = it_bkpf-burks
    and belnr = it_bkpf-belnr
    and gjahr = it_bkpf-gjahr
    and ZFBDT in/= <selection screen ZFBDT>
    endif.
    Now
    select lifnr name1 from lfa1 into it_lfa1
    where lifnr in <selection scfreen lifnr>.
    YOu have three tables now..
    you can loop at 1st table get the output fields put in into work area
    read 2nd table relevant to first one and then read IT_LFA1 table with lifnr same as lifnr in BSEG and fill the final internal table.
    Any doubts in retrieving please feel free to post your question
    rewards if useful,
    regards,
    nazeer
    Message was edited by:
            'Nazeer'

  • Internal Table Logic Needed

    Hi all,
    I have a requirement regarding data processing in a internal table,
    internal table consists of filelds Vendor,Material and Scheduling Dates and Total Qty.
    Here i need to fill the field Total Quantity, individual addition of quanties of that material for a particular vendor .
    Let us consider intitially my internal table consists of data like this with these fields.
                      Vendor ,           Material  ,            qty(individual),   Total qty   ,  Schedule dates
                       v1        ,           m1       ,                 10          
                       v1        ,           m1        ,                10
                       v1       ,             m1       ,                  20
                       v1       ,              m2      ,                    5
                       v1       ,             m2        ,                 10
                       v2        ,            m2         ,                20
                      v2        ,             m2        ,                  15
                      v2        ,            m3         ,                  20
                      v2        ,            m3           ,                10
        Initiall the total qty field is empty i need to fill tht field for the last item for a particular material Like M1
      for vendor v1 and total qty of m2 for vendor v1, total qty of m1 for v2, total qty of m2 for v2 and so on.
    Requied output should be like this.
                     Vendor     ,          Material       ,    qty(individual)            Total qty   Schedule dates
                      v1         ,                m1         ,         10           ,               0        
                       v1          ,              m1          ,        10           ,                 0
                       v1         ,                m1         ,         20          ,                40(101020)
                       v1        ,                 m2          ,         5           ,               0
                       v1          ,               m2           ,      10            ,              15(5+10)
                       v2          ,               m2          ,        20            ,             0    
                       v2          ,               m2           ,       15             ,              35(20+15)
                      v2           ,              m3          ,        20              ,             0
                      v2            ,              m3           ,       10              ,           30(20+10)
    Here i made one thing , i calculated the total qty of material for particular vendor.
    Like              
             Vendor                           Material                     Total Qty      
                     v1        ,                        m1            ,             40
                     v1        ,                       m2              ,            15
                     v2         ,                     m2                ,           35
                     v2          ,                    m3                 ,           30
    Finally i need the logic by using Control Events(At New   , At End of )  to adjust that total qty of a material for a particular vendor by Modifying the internal table.
    i hope my problem is clear , pls let me know if any clarifications needed. and
    code for the same .
    Thannks in advance,
    Niranjan.

    Hi,
    Solution is here.
    sort itab by vendor material.
    field-symbols: <itab> like line of itab.
    loop at itab assigning <itab>.
    on change of vendor.
    clear flag.
    endon.
    add <itab>-quanity to lw_quantiy.
    *--here pdate internal table end of each similar kind of record
    at end of.
    flag = 'x'.
    <itab>-totalqty =  lw_quantiy.
    clear  lw_quantiy
    endat.
    *--rest of record update zero by checking flag
    if flag is initial.
    <itab>-totalqty = 0.
    endif.
    endloop.
    close this thread if you got solution.
    Regards,
    Peranandam

  • Rank on column-level Grand total column in pivot table  -  Need help

    Hi ,
    I have developed the report, which is having a pivot view. In pivot view i have a column level grand total. I need to apply the rank for the grand total column..
    will that be possible.. if possible let me know..
    Thanks
    Kishore

    MAY BE IT IS NOT POSSIBLE IN PIVOT VIEW< AS WE DONT HAVE FORMULA EDIT OPTION FOR COLUMNS IN PIVOT VIEW.......
    Thanks & Regards
    Rushi

  • Logic needed in query

    Hi all
    i have a table with columns
    SUN MON TUE WED THU FRI SAT
    Y................ ........Y..................
    i need to selected the column SUN which is Sunday,
    along with this i need to select the columns MON,TUE
    THU is having value so i don't needed that
    if i select WED then i needed THU, FRI, SAT also
    can u pls help on this.
    Edited by: 881121 on Apr 5, 2013 11:13 PM

    user648773 wrote:
    You need to return the name of days? or you need to return the values of the colum?
    You have onley two cases? or could be more? could you describe the logic in general?
    one query always return the same number of colums. So, in your case you should return one column and concatenate the values as you need.
    here is an example with concatenate, and return the correspondig values:
    select out
    from
    select case
    when SUN = 'Y' THEN SUN||MON||TUE
    WHEN WED = 'Y' THEN WED||THU||FRI
    END out
    from table
    here is an example that return the name of days:
    select out
    from
    select case
    when SUN = 'Y' THEN 'SUN,MON,TUE'
    WHEN WED = 'Y' THEN 'WED, THU, FRI'
    END out
    from table
    May be you could do these things to describe us what you need:
    - make a desc of you table to know the structure.
    - describe each case with an imput and it corresponding outpu.Maybe everything would be easy if you would post:
    1) CREATE TABLE and INSERT statement
    2) Expected output.
    You question is vague and not clear. Please read SQL and PL/SQL FAQ
    This will avoid people here trying to guess what you are trying to say.
    Also keep in mind: when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Regards.
    Al
    Edited by: Alberto Faenza on Apr 8, 2013 2:09 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Date selection in query : logic needed!

    Hi,
    we have one calendar day depending on which the query result is displayed!
    Now the requirement is such that when user enters one date the query has to generate the result for the multiple date ranges including the one which he has entered.
    example: if user has entered 15/9/2007 then query should not only display the result of the date 15/9/2007 but also the results of  -5 to +2 ( means 10/9,11/9,12/9,13/9 and 14/9 plus 16/9 and 17/9 )
    simlarly other ranges like -8 to + 7 and so on
    How to define this in query?
    Thanks,
    Ravi

    Hello ,
    I need to make a graph conveying the information of the deliveries by comparing the goods issue date and promised date !
    report also requires how many deliveries were on time, how many were late and how many were early!
    for this requirement, i had thought of making a date selection field which is promised date and make furthur more date ranges selections by query it self so that late deliveries and early deliveries also covered in these date ranges.
    -5 to + 2 is that one range which is on time delivery range
    if the delivery is more eally than the -5 days then it is early delivery. even in ealry delivery i want to make how early it is.
    and suppose the delivery has crossed the promised date 2 days more then it is late delivery.
    all has to be acheived by single date selection and there after the logic which takes care of all the date ranges i had explained.
    i am looking for that logic which i am not finding
    Hope this is clear now
    Thanks,
    Ravi

  • New To Logic need help using drum samples.

    Hey guys im extremly new to logic actually this is my first trip into a mac doing pro audio. Ive been using windows in my studio for years and im trying to learn the ins and outs of Logic right now. My question is im using a set of samples (trigger thru middi usually scored out in staff view) call the steven slate samples usually in windows im using the dr008 to load and trigger them. What would be the equivilent in Logic can i load those samples into ultra beat and trigger them off the staff view?? Again very new to logic but i like what im seeing and i just need come exp. help to get started and cought up to where i was on a PC/Sonar System. Thanx for the help in advance

    Isn't the dr-008 great? I wish they had a Mac version.
    If you're using midi, yes you could configure either UB or the ESX24 with your samples etc.
    The closest thing to the dr-008 that I've found for Mac is either iDrum or Battery - it's fun to play with either in the same way as the DR.

Maybe you are looking for

  • Downloaded iPhoto from app store and crashes as soon as I try to open

    Please someone help!! I purchased iPhoto and downloaded it from the app store.  Haven't been able to use it.  It crashes and I get the crash report below.  I've looked on all the forums and I deleted the plist or whatever from the library.  I tried r

  • ITunes Artwork Screensaver displays only one album at a time...

    ...and it changes every time I shut down the computer. I have a lot of album art, how come it only chooses to show one album? Nothing changes if I change the number of rows. Before, System Prefs used to quit unexpectedly but then I did that plist thi

  • Installation was interrupted message for a routine upgrade

    Right after "Publishing product information": "The iTunes for Windows installer has completed. The installation was interrupted before iTunes could be completely installed. The System has not been modified. To install this program at a later time, ru

  • Firewire 400 to firewire 800 adaptor

    Hello everyone, I just recentley upgraded from my 1.6 GHz PowerPC G5 to a Mac Pro 3.2 GHz Quad-Core Intel Xeon, with 8 gigs of ram. Now my problem is that I'm trying to figure out if there is an option for my firewire 400 Lacie harddrives to be conne

  • Apexir_REPORT_ID

    Hello, I've an urgent question concerning interactive reports: How can I get and use the apexir_REPORT_ID in a dynamic action with "Action-type" = "Execute PL/SQL-Code"? If I choose "Action type" = "Execute JavaScript Code" I can get the apexir_REPOR