Fetches more values into one variable

Hi, inside a cursor loop I'd like to assign, each fetch, a value to a variable, in order, at the end to have a collection of all the values fetched into the same variable.
The code is the following:
CREATE OR REPLACE procedure APPS.AAA as
v_pino varchar2(64);
CURSOR tks_opened_range IS
SELECT incident_number AS YP_TKS_OPENED_WITHIN_RANGE FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
AND c.language = 'EL'
AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) BETWEEN 1 AND 11111111111
AND incident_attribute_2 IN ('ΓΕΝΙΚΗ ΔΙΕΥΘΥΝΣΗ ΤΕΧΝΟΛΟΓΙΑΣ')
ORDER BY incident_number;
rec_tks_opened_range tks_opened_range%ROWTYPE;
begin
FOR rec_tks_opened_range IN tks_opened_range
LOOP
v_pino := rec_tks_opened_range.YP_TKS_OPENED_WITHIN_RANGE;
DBMS_OUTPUT.PUT_LINE('v_pino: ' || v_pino);
end loop;
end AAA;
This works with the variable v_pino!....but at the end, the value of the variable v_pino is ONLY the last fetched by the cursor.
Is there a way to declare a variable (or better a collection) or a new type in order to have all the data fetched into this variable and the end of the fetching ?
I need to know this trick because, after, I have to assign this variable to a pipelined table function.
Thanks in advance
Alex
/

Great Devang !! Thanks a lot ! It works ! Now I am able to retrieve all the values I need and store them into my variable gino
I searched on the note you mentioned in your mail in order to pass an array as a variable to a table function (PIPE ROW call), but I didn't find nothing about it.
Now I explain to you my situation.
I already implemented a table function that works perfectly. I have 2 cursors declared and 2 PIPE ROW calls.
FUNCTION statistic_report_2_1 (p_resolv_time_ll varchar2, p_resolv_time_ul varchar2, p_ypiresia varchar2)
RETURN xxi_statistic_rep_2_1_tab PIPELINED
IS
-- CURSORS FOR THE FIRST SHEET - Tickets opened per group and per duration
-- Cursor for tickets opened within 1 hour --
CURSOR tks_opened_1_h IS
SELECT incident_number AS YP_TKS_OPENED_WITHIN_1_HOUR
FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
AND c.language = 'EL'
AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) < 60
AND incident_attribute_2 IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.ypiresia_values(p_ypiresia) AS xxi_ypiresia_list_tab)))
ORDER BY incident_number;
rec_tks_opened_1_h tks_opened_1_h%ROWTYPE;
-- Cursor for tickets opened between 1 hour and 3 hours --
CURSOR tks_opened_1_3_h IS
SELECT incident_number AS YP_TKS_OPENED_BE_1_3_HOURS FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
AND c.language = 'EL'
AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) BETWEEN 60 AND 179
AND incident_attribute_2 IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.ypiresia_values(p_ypiresia) AS xxi_ypiresia_list_tab)))
ORDER BY incident_number;
rec_tks_opened_1_3_h tks_opened_1_3_h%ROWTYPE;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
-- FIRST SHEET OPEN CURSORS --
TICKETS NUMBER OPENED WITHIN 1 HOUR
FOR rec_tks_opened_1_h IN tks_opened_1_h
LOOP
PIPE ROW(stat_rep_2_1_type(
rec_tks_opened_1_h.YP_TKS_OPENED_WITHIN_1_HOUR
END LOOP;
-- TICKETS NUMBER OPENED BETWEEN 1 HOUR AND 3 HOURS --
FOR rec_tks_opened_1_3_h IN tks_opened_1_3_h
LOOP
PIPE ROW(stat_rep_2_1_type(
,rec_tks_opened_1_3_h.YP_TKS_OPENED_BE_1_3_HOURS));
END LOOP;
RETURN;
END statistic_report_2_1;
But, in this way and with this syntax, I obtain for each PIPE ROW call only one field filled each time, because I can’t call 2 cursors in a nested loop together (data duplication);
For example:
1st PIPE ROW call : only the first field is filled and into the second I have to put ‘’
2nd PIPE ROW call : only the second field is filled and into the first I have to put ‘’
….and I cant’ call with a single PIPE ROW call two cursor variables…..
Into a Discoverer report this data layout is really bad (you can imagine with thousand
of records).
For this reason I thought to use an array variable (gino) to pass to a single PIPE ROW call outside the cursor loop……but it doesn’t work !!!
Can you suggest me how to resolve this problem….if it possible ?
Did I have to declare other TYPE or collection ?
Thanks you so much
Alex

Similar Messages

  • READING INTO ONE VARIABLE

    HI
    HOW CAN I READ VALUE INTO ONE VARIABLE.???
    ie,
           IN RUNTIME IF IM ENTERING VALUE TO VARIABLE 'A'  MEANS   HW CAN I TAKE THE VALUE TO 'A'.

    DYFIELDS-FIELDNAME ='<Parameter Name>'.
    APPEND DYFIELDS.
    DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
    CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
    DYNAME = SY-CPROG
    DYNUMB = SY-DYNNR
    TABLES
    DYNPFIELDS = DYFIELDS .
    READ TABLE DYFIELDS INDEX 1.
    This function module will read out the values into Internal table DYNFIELDS.
    Use this function module at  " On value request for <parameter>.

  • Store multiple values into a variable

    I was wondering if it was possible to store multiple values into one varaible. Something along the lines of...
    Oracle: 10g
    --Table xSample (this is obviously a dumbed down version of the table for the sake of showing what I want to accomplish
    S_ID   YEAR
    1         2009
    2         2009
    3         2009
    4         2009
    --Query
    select     s_id
    into       pID
    from      xSample
    where    year = 2009;Basically the reason I was trying to figure out how to store multiple values into a variable is b/c I was going to use that variable (pID) as a parameter and have it's values passed dynamically when the proc was called. The values would go into a query that would look something like:
    select *
    from cust_data
    where person_id in (pID)
    aka
    select *
    from cust_data
    where person_id in (1,2,3,4)Not sure if this is possible, but if anyone knows of a way I could accomplish this that would be great.
    Edited by: user652714 on Dec 23, 2009 9:37 AM

    Here's a basic idea building a comma seperated list, then consuming it in another query (taking the in list approach from Tom's post, linked earlier).
    create table xsample (s_id number not null, year number);
    insert into xsample select level, 2009 from dual connect by level <=4;
    commit;
    declare
       --4000 should be lots ... hopefully?
       v_parameter_list varchar2(4000);
    begin
      --create the comma seperated list
      select
        substr(max(sys_connect_by_path(s_id, ',') ), 2, 4000)
      into
        v_parameter_list
      from
        select s_id, row_number() over(order by 1) as rn
        from xsample
        where year = 2009
      start with rn = 1
      connect by prior rn = rn - 1;
      --consume the comma seperated list
      for x in
        with data as
          select
            trim( substr (txt,
            instr (txt, ',', 1, level  ) + 1,
            instr (txt, ',', 1, level+1)
            - instr (txt, ',', 1, level) -1 ) ) as token
          from
            select ','||v_parameter_list||',' txt
            from dual
          connect by level <= length(v_parameter_list)-length(replace(v_parameter_list,',',''))+1
        select *
        from xsample
        where s_id in (select * from data) 
      loop
        dbms_output.put_line('next item = ' || x.s_id);
      end loop;
    end;
    /

  • Retriving values into a variable

    hi,
    I'm novice to calcscripts...
    i have declared one variable within a fix cmd.
    I want to retrieve data into this variable combination whatever mentioned in the fix cmd some members also need prior.
    var LyBase;
    LyBase=@Prior(FY11,Base);
    i'm getting error-1200329:ivalid assignment of base
    i want to know
    "LyBase"="Can i give member combination here to retrieve data into this variable";

    variables need to be used in a calc block, here are some examples as it has been covered in the past
    Re: Temporary Variable Issue: Invalid Member Name
    Re: Using variables in Calc scripts and Business Rules
    Cheers
    John
    http://john-goodwin.blogspot.com/
    Hi john,
    thanks for ur reply,i have declared the variable inside the fix cmd,but when i'm trying to retrieve a value into this variable it is throwing error,
    *Error: 1012038 The constant [FY10->Actuals->Locked->Base] assigned to variable [LyBase] is not a number*.
    calc script is as follows
    fix(my sparse dim mbrs)
    var LyBase;
    LyBase=FY10->Actuals->Locked->Base;
    when executing this script i'm getting the above error.how can i fix it?

  • Add values to one variable in a loop

    Hello,
    I have a while loop where I read a counter and get values.
    Now I want to add all values to one variable. I think an array won't be good because
    the loop can run a long time and an array is limited.
    And the end I want to have the sum of all values.
    I tried to use shift registers.
    But how can I store the value of the first loop-cycle in a variable and on
    the second loop-cycle take this stored value and add the new value and so on?
    Another problem that is maybe more difficult, is that I need the max and min value
    of all values that has been read.
    That means I need a variable which stores the current value. Then I have to compare the stored
    with the next value and maybe exchange both.
    I would be thankful fo
    r any hints.
    best regards Thomas

    Attached is a picture of a code that does what you want; it calculates the sum of each value, it finds the minimum and maximum (and average)...and it does not create any arrays.
    The value source and the condition to stop the loop is what you need to change...In addition you might want to see preliminary values...if so then add indicators inside the loop.
    MTO
    Attachments:
    sum_min_max.gif ‏27 KB

  • Problem in Showing multiple values into one text box.

    Hi all,
    How can show i multiple row values into one text box. here text box is multi line type.
    i have one table it has content column, it has number of rows. i need to show those data into one text box in form. how can i solve it?
    my sample code here,
    egin
    --:block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
    -- go_item('txt_from');
    insert into chat(fromid,toid,content)values(:block3.fromid,:block3.toid,:block3.txt_From);
    :block3.txt_From:= null;
    commit;
    :block3.txt_to := :parameter.p_current_user||''||':'||:block3.txt_From;
    go_item('txt_from');
    declare
    cursor c4 is select content from chat where toid = :block3.fromid;
    rec1 c4%rowtype;
    begin
    open c4;
    loop
    fetch c4 into rec1;
    exit when c4%notfound;
    null;
    end loop;
    end;
    --select content into :block3.txt_to from chat where toid= :block3.fromid;
    end;
    please give me some tips to solve it.
    thanks
    gurus

    Hi,
    Try giving CHR(10) for line feed.
    DECLARE
         CURSOR C4 IS SELECT CONTENT FROM CHAT WHERE TOID = :BLOCK3.FROMID;
         Str_Temp VARCHAR2(20);
    BEGIN
         :BLOCK3.TXT_TO := '';
         OPEN C4;
         LOOP
              FETCH C4 INTO Str_Temp;
              EXIT WHEN C4%NOTFOUND;
              :BLOCK3.TXT_TO := :BLOCK3.TXT_TO || CHR(10) || Str_Temp;
         END LOOP;
         CLOSE C4;
    END;Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Can we assign jython variable value into ODI variable?

    Hi Team,
    We are trying to save jython variable value into ODI variable so that ODI variable can use in later steps.
    we are facing failure regards same.
    Please suggest us so that we can use ODI variable value in later steps.
    Thanks
    Ankush.

    See if this post help you :- How to assign value for a ODI variable from Jython Script
    Doc id 424579.1 on metalink should help.

  • How do I combine two or more pictures into one?

    How do I combine two or more pictures into one?

    I found out how to do what I wanted and I'm giving my steps in hopes that it might help someone else.  I wanted to put several photos from a file onto a new blank image.  This is what I did.
    1.  Create a blank page.    File/New/ Blank File.   Put in the size.  I used 8x10.
    2.  Bring the photo  you want to use into Elements as you always do. It will list along the top next to the blank sheet.
    3.  Choose SELECT (top of screen)/ Select All.
    4.  Choose Edit/Copy   or Command "C"
    5.  Click on the Blank File.   Chose Edit/Paste  or Command "V"
    6.  Click on Image/ Transform or Command "T".  There should be a dotted line around your pasted image.  You can then move and adjust the image to how you want it.  When finished, press the check-mark on lower right of photo.
    7.   Repeat this with all the photos you want on the new blank file.
    8.  You will see on lower right of Elements,  the background layer and as many layers as you have photos.  These layers need to be permanently placed on the background layer. Go to Layers and press Merge Visible.  This will merge all layers to the background.
    9.  Save as and you are done.

  • Multiple values for one variable?

    I've created my first set of variables (using Form Properties>Variables), tweeked some XML sourcecode  and they're working .
    What I'm now trying to figure out is how to have one variable that has 2 values that pop up in 2 different text fields.
    Simple form at this point:
    Item, Model and Service Tag.
    The user selects the item from the drop down list and the Service Tag field is autopopulated from the variables I set.
    How do I get the Model to appear based on the Item selection?
    I tried putting the two values for one variable together but both values appear in the same field.
    Variable info that works: Scan (variable) = MC3090BT (value)
    I also need this particular variable to = Handheld scanner (try to ignore the redundancy).
    I attempted to make MC3090BT as it's own variable with Handheld scanner as it's value, and add to the code below but it didn't work.
    Here's some of the code if it helps:
    <event activity="change" name="event__change">
                   <script contentType="application/x-javascript">if(xfa.event.newText == "Handheld scanner"){
        servicetag.rawValue = scan.value;
    }else if(xfa.event.newText == "Latitude X1"){
        servicetag.rawValue = X1.value;

    Hi, I am trying to do the same thing..passing multiple values to receiving query variable through RRI.  Right now if I assign a query variable of type multiple single values it does not take any value.  It works only if I assign variable of type Single Value.
    In my assignment details the sender query has Generic for type and * for selection type. 
    If any one knows how to pass multiple values to receiving RRI query,  please give the details.
    Thanks

  • Storing and retrieving multiple values into one cookie.

    Hi Everyone,
    I am wondering if anybody knows of any good tutorials involving storing multiple values into one cookie. Any URLs will be greatly apprecated. Thanks heaps.
    Regards
    Davo

    These are normally delimted in HTTP by a semicolon. You can concatenate the string yourself and on the reverse trip use StringTokenizer to get the values back out.
    - Saish

  • How to integrate existing value into one in hierarchy char.

    I have a char. hierarchy call ZCOMP_CODE. ZLEADER is compounding with ZCOUNTRY.
    The master data in ZCOMP_CODE looks like
    ZLEADER;ZCOMP_CODE;
    010;1000;
    010;1001;
    010;1002;
    020;1000;
    021;1000;
    In query  I have char. ZCOMP_CODE in row and one KF ZREVENUE in column. Previously we calculated ZLEADER 010,020,021 separately. But, now I want to calculated ZLEADER 020 and 021 together. Does anyone know how to integrate two existing value into one and display it in query? Do I need to create a new hierarchy node for including 020,021?
    Thanks!
    rajatina.

    don't know how you can achieve this in the query...
    but in the workbench there's a solution. Just add a routine in the transformation to change 021 to 020.
    if you need to have still the 021 info somewhere, create a ZCOMPANY_CODE2 where you store only the values needed (010, 020)... use this company code as hierarchy in the report, and use the other company code for displaying the 021...
    hope it's clear,
    M.

  • How to scan more pages into one PDF file using hP inkjet 2515

    Dear friend 
    How to scan more pages into one PDF file using hP inkjet 2515 

    Dear friend 
    How to scan more pages into one PDF file using hP inkjet 2515 

  • All values from associative array into one variable

    Hello! Please:
    I have, for example:
    DECLARE
      TYPE tb1 IS TABLE OF INTEGER INDEX BY PLS_INTEGER;
      v4 tb1;
      variable1 myType; --varray of integers
    BEGIN
      v4(1)   := 34;
      v4(2)   := 46456;
      v4(100) := 54217:
      ...  --shortly -lot of values
    END;
    /How can I get all v4(x) values into variable1?
    something like:
    FOR i IN 1..v4.COUNT
    variable1 :=...don't know
    --to have this in the variable1: variable1:= myType(34, 46456, ..., 54217, ...);
    END LOOP;Thank You for answer!

    Is this you are looking for?
    create or replace type myType is varray(500) of number;
    DECLARE
    TYPE tb1 IS TABLE OF INTEGER INDEX BY PLS_INTEGER;
    v4 tb1;
    variable1 myType:=myType(); --varray of integers
    BEGIN
    v4(1) := 34;
    v4(2) := 46456;
    v4(3) := 54217;
    FOR i IN 1..v4.COUNT loop
    variable1.extend();
    variable1(i) := v4(i);
    END LOOP;
    FOR i IN 1..variable1.COUNT loop
    dbms_output.put_line(variable1(i));
    end loop;
    END;
    /

  • How to get value od one variable baesd on another variable

    Hi Gurus,
         Is this thing possible?My problem is  i have one variable on "0calmonth2" based on this variable i want to populated the values in another object (0calquarter).i.e.
    If i select " Jan or Feb or Mar" it should populate 1  in 0calquarter similarly, for other month

    Hello Deepak
    Try a function module like this:
    FUNCTION Z_YOUR_FM.
    ""Interfase local
    *"  IMPORTING
    *"     VALUE(I_AREA) TYPE  UPC_Y_AREA
    *"     VALUE(I_VARIABLE) TYPE  UPC_Y_VARIABLE
    *"     VALUE(I_CHANM) TYPE  UPC_Y_CHANM OPTIONAL
    *"     VALUE(ITO_CHANM) TYPE  UPC_YTO_CHA
    *"  EXPORTING
    *"     REFERENCE(ETO_CHARSEL) TYPE  UPC_YTO_CHARSEL
    *"  EXCEPTIONS
    *"      FAILED
    clear export table
      CLEAR eto_charsel.
      data: i TYPE i value 1,
            ls_charsel TYPE upc_ys_charsel,
            l_periv type periv value 'K1',
            l_calmonth2 type UMC_Y_ICHAVAL,
            l_buffer_call TYPE boole-boole VALUE ' ',
            l_subrc LIKE sy-subrc,
            ls_return LIKE bapiret2,
            l_type LIKE upc_var-vartype,
            lto_varsel_all TYPE upc_yto_charsel,
            lto_varsel TYPE upc_yto_charsel,
            lto_chanm TYPE upc_yto_cha,
            wa_varsel like line of lto_varsel,
            l_quarter(1),
            l_quarterc(5).
    Read value of CALMONTH2 variable
      CALL FUNCTION 'Z_VARIABLE_GET_DETAIL'
        EXPORTING
          i_area         = <YOUR PLANNING AREA>
          i_variable     = <YOUR CALMONTH2 VARIABLE>
          i_buffer       = l_buffer_call
        IMPORTING
          e_subrc        = l_subrc
          es_return      = ls_return
          e_type         = l_type
          eto_varsel_all = lto_varsel_all
          eto_varsel     = lto_varsel
          eto_chanm      = lto_chanm.
      IF l_subrc eq 0.
        loop at lto_varsel into wa_varsel.
          move wa_varsel-low to l_calmonth2.
        endloop.
      ENDIF.
    calculate quarter
      CASE l_calmonth2.
        WHEN '01' OR '02' OR '03'.
          l_quarter = '1'.
        WHEN '04' OR '05' OR '06'.
          l_quarter = '2'.
        WHEN '07' OR '08' OR '09'.
          l_quarter = '3'.
        WHEN '10' OR '11' OR '12'.
          l_quarter = '4'.
      ENDCASE.
    passing QUARTER to variable value
      CLEAR ls_charsel.
      ls_charsel-CHANM = I_CHANM.
      ls_charsel-SEQNO = i.
      ls_charsel-sign  = 'I'.
      ls_charsel-opt   = 'EQ'.
      ls_charsel-low   = l_quarter.
      INSERT ls_charsel INTO TABLE eto_charsel.
      add 1 to i.
    ENDFUNCTION.
    Hope this helps...
    regards,
    Ibrahim.

  • How to fill more values in one field (JSP / HTMLX)

    When I want to fill one value in a field on a JSP page, I enter:
    value="<%=someClass.getSomeValue() %>"
    How should I enter more values (e.g. street, city, postal code, country) in one field?
    I tried to put those fields together, so I do one getAddress() call, but the output is (initial screen - supposed to be empty) null null null null
    When I enter a customer, the field works ok (no null values).
    TIA,
    Mylene

    JSP:
    <hbj:inputField     
    id="CustomerAddressInputField"     
    type="STRING"     
    maxlength="10"     
    value="<%=quotationHeader.getCustomer().getAddress().getAddress() %>"
    design="STANDARD"
    ... %>"
    getAddress():
    @return String (complete address / positioning
    pCode unsure!)
    public final String getAddress()
    return (street + " " + pCode + " " + city + " " + cCode);
    This is what returns null null null null
    What I want (if possible) is to change the getAddress() in the JSP in subsequent getStreet() - add space - getPCode() - add space - getCity() - add space - getCCode()
    That will not result in null values - I hope.
    But just putting those calls in the string between the
    value ="<%= and the %>" tags doesn't seem to work!
    TIA,
    Mylene

Maybe you are looking for

  • Incompatability with Samsung Digimax 350SE digital camera

    After my original G5 imac going to the wall within the warranty period - I was offered a new 17in Mac Intel as a replacement. I paid I traded in the extended warranty and paid a little bit extra and purchased the 20ins 2MB model. Unfortunately I did

  • Help with SQL function

    Hi all, I have a table with Purchase Order Receipts and Invoice data in it. The problem I have is that the invoice number only appers on one of the receipted lines and the rest of the lines are Null value. What SQL could I use so that it will only sh

  • APD-Issue with Decimals

    hi, I am using APD to get the report results as CSV file. I have restircted not to show the decimal places for the values in the report  but the file that is genarated always comes with two decimals. The business  does not wants the value with decima

  • Abap SQL question

    Hi, I need to select the set of records only in Table A, but not in Table B. I think that the correct SQL is: select k~vbeln into data from vbak as k inner join vbfa as f on kvbeln = fvbelv where f~vbelv is null. But the following message appears: u2

  • ALE Idoc s

    Hi sap experts I am working on ALE Idoc Interfaces.    -Client1 Sender    -Client2 Reciever I am able to send IDOCs MATMAS from Client1 to Client2. My requirement is to 1) Send an outbound IDOC data(MATMAS) to a flat file on client1(SENDER). 2) Uploa