Need help on cursors

Hi,
I am having issue with my cursor.
My cursor declartion looks like below:
Declare
cursor c1 is
select job_id,delayed_time
from mail_test;
Begin
open c1;
Loop
Fetch c1 into m_job_id, m_delayed_time;
IF c1%FOUND THEN
--Exit when c1%NOTFOUND;
dbms_output.put_line('hai');
dbms_output.put_line(' Job '||m_job_id||' is delayed by '||m_delayed_time||' minutes, ');
EXIT;
END IF;
END LOOP;
close c1;
End;
In mail_test table only one row is there for job 1151, but the above code snippet is displaying 3 rows. Any problem with my looping because I want to display only one row.
O/p
hai
Job 1151 is delayed by 184 minutes,
hai
Job 1151 is delayed by 184 minutes,
hai
Job 1151 is delayed by 184 minutes,
Desired o/p:
hai
Job 1151 is delayed by 184 minutes,
Please help me on this. Thanks

I dont want to use any predicate for job_id bcoz I want to select all the records from that table.Strange, that sounds contradictionary: do you want to select all records or just one?
Anyway:
Your other options are changing the query to either:
select distinct job_id
               ,      delayed_time
               from   mail_testor (dirty one)
select job_id
               ,      delayed_time
               from   mail_test
               where  rownum=1Or, if you just want the output once, but loop through all records, you can do something like:
declare
  prev_id number;
begin
  for rec in ( select job_id
               ,      delayed_time
               from   mail_test
  loop
    if prev_id != rec.job_id
    then
      dbms_output.put_line('hai');
      dbms_output.put_line(' Job '||rec.job_id||' is delayed by '||rec.delayed_time||' minutes ');
    end if;
    prev_id := rec.job_id;
  end loop;
end; 

Similar Messages

  • Need help in cursor.....!

    hi,
    I am working in oracle 8i. I am creating cursor in my pl/sql block for the following requirement.
    I need to update the ex_duty_cb amt and simultaneously i need to assign the ex_duty_cb amt
    for the opening_amt column.
    For ex..
    Below is the actual record
    ENTRY_NO OPENING_AMT EXCISE_DUTY EXCISE_DUTY_CB
    1626 2000 50 2200
    1627 3000 250 3300
    1628 4000 200 4400
    1629 5000 100 5500
    This is my requirement
    ENTRY_NO OPENING_AMT EXCISE_DUTY EXCISE_DUTY_CB
    1626 2000 50 2050
    1627 2050 250 2300
    1628 2300 200 2500
    1629 2500 100 2600
    Please help me.........!
    Below is the query....Please guide me....?
    declare
    cursor cur
    is select entry_no,excise_duty_ob + cess_on_ed_ob + hecess_on_ed_ob as
    opening_amt, excise_duty_cb
    from cenvat_trans
    where transaction_type = 'I'
    and to_date(to_char(bill_date,'MON'),'MON') = '01-jul-2007';
    begin
    open cur;
    for fr in cur loop
    update cenvat_trans
    set excise_duty_cb = fr.opening_amt;
    exit when cur%notfound;
    end loop;
    close cur;
    end;
    regards,
    jame

    SQL> select * from cenvat_trans;
      ENTRY_NO OPENING_AMT EXCISE_DUTY EXCISE_DUTY_CB
          1626        2000          50           2200
          1627        3000         250           3300
          1628        4000         200           4400
          1629        5000         100           5500
    SQL> merge into cenvat_trans c
      2  using (select entry_no,
      3         first_value(opening_amt) over(order by entry_no)+
      4         sum(prev_ex) over(order by entry_no) sm1,
      5         first_value(opening_amt) over(order by entry_no)+
      6         sum(excise_duty) over(order by entry_no) sm2
      7         from(
      8          select rowid,entry_no,opening_amt,
      9            excise_duty,excise_duty_cb,
    10            lag(excise_duty,1,0) over(order by entry_no) prev_ex
    11          from cenvat_trans)) v
    12  on (c.entry_no=v.entry_no)
    13  when matched then
    14  update set c.opening_amt = v.sm1,
    15      c.excise_duty_cb = v.sm2;
    4 rows merged.
    SQL> select * from cenvat_trans;
      ENTRY_NO OPENING_AMT EXCISE_DUTY EXCISE_DUTY_CB
          1626        2000          50           2050
          1627        2050         250           2300
          1628        2300         200           2500
          1629        2500         100           2600
    Message was edited by:
            jeneesh
    Oh..!
    Its too late..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help in Cursor exception

    Hi,
    I have a small code with implicit cursor to fetch rows from table unreadable_cards and then for each value fetched I lookup another table card_acnt for some values and update data in unreadable cards table. The code is as below
    declare
    v1 number;
    begin
    for v1 in (select engravedid from unreadable_cards where case_resolved=1)
    loop
    update unreadable_cards set serial_number = (select serial_number from card_account
    where ticketid = v1.engravedid)
    where engravedid = v1.engravedid;
    update unreadable_cards set case_resolved=2
    where case_resolved=1
    and serial_number is not null;
    end loop;
    exception
    when no_data_found then
    update unreadable_cards set case_resolved=22
    where ticketid = v1.engravedid;
    when too_many_rows then
    update unreadable_cards set case_resolved=23
    where ticketid = v1.engravedid;
    when others then
    update unreadable_cards set case_resolved=24
    where ticketid = v1.engravedid;
    end;
    Here I have problem writing values to the table as this error pops up for every reference to V1 in exception
    PLS-00487: Invalid reference to variable 'V1'
    I need to be able to raise all three exceptions within the loop so that v1 can be referenced and loop does not exit on encountering the exception and completes for every row fetched by cursor, so that I can track the status of each record on the basis of case_resolved value.
    Any help would be highly appreciated
    Thanks
    Saurabh

    Let me get that out of me.. I don't like your code
    First thing you need to know is, you are not going to hit NO_DATA_FOUND exception in a UPDATE statement. If a update did not modify any row it will not raise NO_DATA_FOUND exception. Check this out
    SQL> begin
      2    update emp set sal = sal+ 10 where 1=2;
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    No exception there. So that is one thing you need to look at.
    Second thing I don't like the way you have used WHEN OTHERS exception. What are the exception you are looking at? You should not be having a when others without RAISE. It a bug in the code. You need to fix that.
    Assuming your logic behind assigning CASE_RESOLVED is like this.
    CASE_RESOLVED = 2   means you have found an exact match for your UNREADABLE_CARDS.ENGRAVEDID in CARD_ACCOUNT.TICKETID
    CASE_RESOLVED = 22 means you don't have a match for your UNREADABLE_CARDS.ENGRAVEDID in CARD_ACCOUNT.TICKETID
    CASE_RESOLVED = 23 means you have multiple match for your UNREADABLE_CARDS.ENGRAVEDID in CARD_ACCOUNT.TICKETID
    CASE_RESOLVED = 24 This does not make any sense. You need to drop this part.
    You can do this, You don't need all that PL/SQL. Just a simple SQL like this will do.
    merge into unreadable_cards x
    using (
            select a.engravedid
                 , max(b.serial_number) serial_number
                 , case when count(b.serial_number) = 1 then 2
                        when count(b.serial_number) = 0 then 22
                        when count(b.serial_number) > 1 then 23
                   end case_resolved
              from unreadable_cards a
              left
              join card_account b
                on a.engravedid = b.eticketid
             where a.case_resolved = 1
             group
                by a.engravedid
          ) y
       on (
            x.engravedid = y.engravedid
    when matched then
    update set x.serial_number = nvl(y.serial_number, x.serial_number)
              , x.case_resolved = y.case_resolved;
    Above is a untested code. But should work. If any minor error fix it and you should be good to go.

  • Need help with cursor selection in control panels

    I can't get my cursor to work in the control panel at the top of the screen, for example, when I select text and want to change the font size, etc.  It won't even select to change from font to paragraph mode.  Other issues are trying to choose the selection tool, which I can only do with the "V" shortcut tool--escape doesn't work, nor does the cursor choose the  icons.  Help!

    Windows? see InDesign tools and panels don't respond to mouse clicks (Windows 7/Vista)

  • Need help with cursor def

    Hi I have seen some where in the code
    .what I could not understand is
    1.what does the e with clause in this code will do? where it is used frequently and what is the advantage?
    2.the temp_holding is a table with only one column.So is it like we can use with caluse in the cursor with only one columned tables?
    3.why is the AS keyword used in this?
    4.If I want to write a select staement for a cursor like this and see what is the data contained in the cursor ,how to write it ?
    thanks in adavnce for your help..
    OPEN lv_refcur FOR
    WITH TEMP_HOLDINGS AS
    SELECT A1.VENDOR_INSTRUMENT_ID,A1.DATA_SOURCE_CD FROM FI_IDX_BENCHMARK_HOLDINGS A1, FI_IDX_BENCHMARK B1, FI_IDX_SOURCE C1
    WHERE
    A1.PRICING_DT = pv_in_dt AND A1.DATA_SOURCE_CD = pv_in_data_src_cd AND A1.INDEX_CD = B1.INDEX_CD
    AND B1.INDEX_CD = C1.INDEX_CD AND C1.DATA_SOURCE_CD = A1.DATA_SOURCE_CD AND B1.IS_PA_REQUIRED = 'Y'
    UNION
    SELECT A2.VENDOR_INSTRUMENT_ID,A2.DATA_SOURCE_CD FROM FI_IDX_FORWARD_HOLDINGS A2, FI_IDX_BENCHMARK B2, FI_IDX_SOURCE C2
    WHERE
    A2.PRICING_DT = pv_in_dt AND A2.DATA_SOURCE_CD = pv_in_data_src_cd AND A2.INDEX_CD = B2.INDEX_CD
    AND B2.INDEX_CD = C2.INDEX_CD AND C2.DATA_SOURCE_CD = A2.DATA_SOURCE_CD AND B2.IS_PA_REQUIRED = 'Y'
    -- MDR START MC IGAR Disclosure change
    UNION
    SELECT
    A1.VENDOR_INSTRUMENT_ID,
    A1.DATA_SOURCE_CD
    FROM
    FI_IDX_BENCHMARK_HOLDINGS A1,
    FI_IDX_BENCHMARK B1,
    FI_IDX_SOURCE C1,
    fi_group_member GM
    WHERE
    A1.PRICING_DT = pv_in_dt
    AND GM.group_cd = 'BCGLBIDXPA'
    AND GM.purpose_cd = 'GLOBALIDX'
    AND A1.DATA_SOURCE_CD = GM.character_val
    AND A1.INDEX_CD = B1.INDEX_CD
    AND B1.INDEX_CD = C1.INDEX_CD
    AND C1.DATA_SOURCE_CD = pv_in_data_src_cd
    AND B1.IS_PA_REQUIRED = 'N'
    UNION
    SELECT
    A2.VENDOR_INSTRUMENT_ID,
    A2.DATA_SOURCE_CD
    FROM
    FI_IDX_FORWARD_HOLDINGS A2,
    FI_IDX_BENCHMARK B2,
    FI_IDX_SOURCE C2,
    fi_group_member GM
    WHERE
    A2.PRICING_DT = pv_in_dt
    AND GM.group_cd = 'BCGLBIDXPA'
    AND GM.purpose_cd = 'GLOBALIDX'
    AND A2.DATA_SOURCE_CD = GM.character_val
    AND A2.INDEX_CD = B2.INDEX_CD
    AND B2.INDEX_CD = C2.INDEX_CD
    AND C2.DATA_SOURCE_CD = pv_in_data_src_cd
    AND B2.IS_PA_REQUIRED = 'N'
    -- MDR END
    SELECT
    INSTRUMENT_ID,
    FUND_OR_INDEX_CD,
    PRICING_DT,
    FI_INSTRUMENT_ID,
    ISSUE_DESCRIPTION,
    TICKER,
    ISSUE_DT,
    STATED_MATURITY_DT,
    COUPON,
    STATE_CD,
    COUNTRY_CD,
    CURRENCY_CD,
    CALLABLE_FLAG,
    PUTABLE_FLAG,
    INSURED_FLAG,
    AMT_CD,
    REVENUE_SOURCE_CD,
    ISSUER_ID,
    NON_2A7_DIVER_ISSUER_ID,
    BLOOMBERG_MBS_TYPE,
    MBS_AGENCY_CD,
    ORIGINAL_TERM,
    DS_CLASS1_CD,
    DS_CLASS2_CD,
    DS_CLASS3_CD,
    MAX(LB_CLASS1_CD) LB_CLASS1_CD,
    MAX(LB_CLASS2_CD) LB_CLASS2_CD,
    MAX(LB_CLASS3_CD) LB_CLASS3_CD,
    MAX(LB_CLASS4_CD) LB_CLASS4_CD,
    GENERIC_INSTRUMENT_ID,
    MAX(SC_CLASS1_CD) SC_CLASS1_CD,
    MAX(SC_CLASS2_CD) SC_CLASS2_CD,
    MAX(SC_CLASS3_CD) SC_CLASS3_CD,
    MAX(SC_CLASS4_CD) SC_CLASS4_CD
    FROM (
    SELECT
    DISTINCT
    PV_FND_IDX_CD AS FUND_OR_INDEX_CD,
    IAI.FI_INSTRUMENT_ID AS FI_INSTRUMENT_ID,
    -- MC IGAR Disclosure
    decode( pv_in_data_src_cd, 'LBG', decode (I.INSTRUMENT_DOMAIN_CD, 'MBS', I.cusip, IAI.ALTERNATE_ID), IAI.ALTERNATE_ID) AS INSTRUMENT_ID,
    -- MC IGAR Disclosure
    pv_in_dt AS PRICING_DT,
    I.ISSUE_DESC AS ISSUE_DESCRIPTION,
    I.BLOOMBERG_TICKER AS TICKER,
    DECODE(pv_in_data_src_cd,'LBG',I.ISSUE_DT,NULL) AS ISSUE_DT,
    I.STATED_MATURITY_DT AS STATED_MATURITY_DT,
    I.COUPON AS COUPON,
    I.STATE_CD AS STATE_CD,
    I.COUNTRY_CD AS COUNTRY_CD,
    I.CURRENCY_CD AS CURRENCY_CD,
    I.CALLABLE_IND AS CALLABLE_FLAG,
    I.PUTABLE_IND AS PUTABLE_FLAG,
    DECODE(pv_in_data_src_cd,'LBG',I.INSURED_IND,NULL) AS INSURED_FLAG,
    I.AMT_CD AS AMT_CD,
    I.REVENUE_SOURCE_CD AS REVENUE_SOURCE_CD,
    I.MASTER_ISSUER_ID AS ISSUER_ID,
    I.NON_2A7_DIVER_ISSUER_ID AS NON_2A7_DIVER_ISSUER_ID,
    MBS.BLOOMBERG_MBS_TYPE AS BLOOMBERG_MBS_TYPE,
    MBS.MBS_AGENCY_CD AS MBS_AGENCY_CD,
    MBS.ORIGINAL_TERM AS ORIGINAL_TERM,
    NULL AS DS_CLASS1_CD,
    NULL AS DS_CLASS2_CD,
    NULL AS DS_CLASS3_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'LBCC', S.CLASSIFICATION_LEVEL1_CD)
    AS LB_CLASS1_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'LBCC', S.CLASSIFICATION_LEVEL2_CD)
    AS LB_CLASS2_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'LBCC', S.CLASSIFICATION_LEVEL3_CD)
    AS LB_CLASS3_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'LBCC', S.CLASSIFICATION_LEVEL4_CD)
    AS LB_CLASS4_CD,
    NULL AS GENERIC_INSTRUMENT_ID,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'SCIS', S.CLASSIFICATION_LEVEL1_CD)
    AS SC_CLASS1_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'SCIS', S.CLASSIFICATION_LEVEL2_CD)
    AS SC_CLASS2_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'SCIS', S.CLASSIFICATION_LEVEL3_CD)
    AS SC_CLASS3_CD,
    DECODE (S.CLASSIFICATION_SCHEME_CD, 'SCIS', S.CLASSIFICATION_LEVEL4_CD)
    AS SC_CLASS4_CD
    FROM
    INSTRUMENT I,
    INSTRUMENT_SECTOR S,
    TEMP_HOLDINGS H,
    INSTRUMENT_ALTERNATE_ID IAI,
    INSTRUMENT_MBS MBS,
    FI_IDX_INSTRUMENT FII
    WHERE
    H.DATA_SOURCE_CD = FII.DATA_SOURCE_CD
    AND H.VENDOR_INSTRUMENT_ID = FII.VENDOR_INSTRUMENT_ID
    AND FII.FMR_CUSIP = IAI.ALTERNATE_ID
    AND IAI.FI_INSTRUMENT_ID = I.FI_INSTRUMENT_ID
    AND IAI.FI_INSTRUMENT_ID = S.FI_INSTRUMENT_ID(+)
    AND IAI.FI_INSTRUMENT_ID = MBS.FI_INSTRUMENT_ID(+)
    AND IAI.ALTERNATE_ID_TYPE_CODE = 'FMR_CUSIP'
    GROUP BY INSTRUMENT_ID, FUND_OR_INDEX_CD, PRICING_DT, FI_INSTRUMENT_ID,
    ISSUE_DESCRIPTION, TICKER, ISSUE_DT, STATED_MATURITY_DT, COUPON, STATE_CD,
    COUNTRY_CD, CURRENCY_CD, CALLABLE_FLAG, PUTABLE_FLAG, INSURED_FLAG, AMT_CD,
    REVENUE_SOURCE_CD, ISSUER_ID, NON_2A7_DIVER_ISSUER_ID, BLOOMBERG_MBS_TYPE,
    MBS_AGENCY_CD, ORIGINAL_TERM, DS_CLASS1_CD, DS_CLASS2_CD, DS_CLASS3_CD,
    GENERIC_INSTRUMENT_ID;
    Edited by: 953115 on Dec 5, 2012 2:04 AM

    953115 wrote:
    1.what does the e with clause in this code will do? where it is used frequently and what is the advantage?The WITH clause is called subquery factoring, not easy to find in the manual if you don't know that
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#i2161315
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#i2077142
    >
    subquery_factoring_clause
    The WITH query_name clause lets you assign a name to a subquery block. You can then reference the subquery block multiple places in the query by specifying query_name. Oracle Database optimizes the query by treating the query name as either an inline view or as a temporary table.
    >
    Simply, it is like creating a view local to the query that can be used one or more times in the rest of the query. It has added benefits such as the potential to materialize the results, explicitly push predicates into the subquery, and perform hierarchical queries using the recursive feature.
    >
    2.the temp_holding is a table with only one column.So is it like we can use with caluse in the cursor with only one columned tables?No you can put any query in the WITH clause
    >
    3.why is the AS keyword used in this?Developer preference? It is optional when specifying a column alias, it seems many of the aliases in your query are unnecessary since they just duplicate the existing column name.
    4.If I want to write a select staement for a cursor like this and see what is the data contained in the cursor ,how to write it ?You can view the results from the cursor the same way as any select query, e.g.
    SQL> var c refcursor
    SQL> begin
      2    open :c for
      3      with test_data as
      4      (
      5      select 1 n, 'a' s from dual union all
      6      select 2 n, 'b' s from dual union all
      7      select 5 n, 'x' s from dual
      8      )
      9      select n, s, case when n > 2 then 'High' else 'Low' end y
    10      from test_data;
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    SQL> print c
             N S Y
             1 a Low
             2 b Low
             5 x High

  • Need help for cursor

    Hi
    I have a pl/sql block..which is having one cursor with a select statement. This select statement will return values when proper values passed..sometimes it will return null. When it return null, I have to insert "invalid code " value into a table. Please find below pl/sql ..
    Please let me know any syntax errors....!!
    Begin
    v_sqlstmt:= ' select  distinct (oip.item_number) from
    ODM_ITEM_PARTS_PRDLINE_MAP map, ITEM_PRODU_292_D dim, odm_item_parts oip, listentry le
    where map.entry_id = dim.entry_id
    and le.entryid = dim.entry_id
    and map.object_id = oip.id
    and oip.subclass_id = 267726
    and le.entryvalue = '''|| v_pa||'''' ;
    dbms_output.put_line('v_sqlstmt' || v_sqlstmt);
    OPEN P_OUT_RESULT for v_sqlstmt ;
    v_out:=NULL;
                   LOOP
                    BEGIN
                     FETCH P_OUT_RESULT INTO v_item_number; --  already declared
                     exit when p_out_result%notfound;
                        IF  v_item_number is null then
                     insert into AIC_PPA_INFO (ITEM_NO,PPA_VAL,model_name) Values('Invalid Code',v_pa,v_modelname);
                      Commit;
                    END if;
                           end loop;
               close cursor;
    end ;
                  Thanks & Regards
    SA

    Wrong.
    Wrong using dynamic SQL (there's nothing dynamic about it).
    Wrong using literals and not bind variables.
    Wrong using a ref cursor.
    Wrong using an insert in a cursor fetch loop and not a single INSERT..SELECT cursor.
    There's nothing right about this code.

  • Need help moving cursor from MacBook to iBook G4 together...

    using my mouse. I bought a new MacBook, but still use my old iBook G4 and it works great too.
    I just can't figure out how to have the cursor go from one to another. I tried Synergy, but it became confusing when I tried to install and have now given up.
    Anyone have any solutions to this?
    Thanks.
    MacBook   Mac OS X (10.6.4)    

    I use Teleport between 3 Macs (similar to synergy)
    <http://www.versiontracker.com/dyn/moreinfo/macosx/22339>
    In my case I use my iMac's keyboard and mouse to tell my PowerMac G5 and my MacBook what to do.
    The PowerMac G5 and MacBook Teleports are configured to share, and the iMac is setup to control the other 2. It works very well for me. At worse, when I move my MacBook out of the office and back, I sometimes have to tell the iMac to stop using Teleport and then start again to re-acquire the MacBook. Otherwise it is great.

  • Need Help with cursor features

    I just got my first job at a media buying place in NYC, and I'm loving it! my daily tasks include entering data, creating tons and tons of spreadsheets, and interpreting data. I know, sounds boring, but I like it.
    Only problem I've been having deals with Excel. I have a type of dyslexia that makes it difficult to see the white space between lines. Contrary to the norm, I have no problem following left to right- or vice versa- however it is difficult to distinguish
    one line from the next because of it's vertical proximity. 
    For example when I read, I often re-read the line I just finished because I lose my spot when I shift my eyes.
    I was wondering if anyone knew of cursor features on excel that follows my cursor using dotted lines- sort of an X,Y coordinate feature- from the top and side tab. It'd make my life a whole lot easier especially if the dotted lines are a different color
    from the background.
    Any input would be great. I'm sure there's a feature, I just cant find it.
    Greatly Appreciated,
    -JS

    Unfortunately there is no feature in Excel to do what you describe, not sure if Windows provides something like that as a general utility.
    However it should be possible to develop an Excel macro to draw a line that follows the cursor. I have in mind something like press and keep depressed a key (say F9),and if/as the cursor moves a trail will follow, release the key and the macro terminates.
    Optionally the trail could be cleared when the key is released, or cleared next time the key is depressed. That's all subject to developing and testing but would something along those lines be useful? If so explain anything else that's relevant or would be
    useful.

  • Need help with cursor ...

    Hi there,
    I don't know what I did wrong, but the cursor in my project became an horizontal arrow with which I can't no longer highlight clips ...
    I can't point anything...
    The cursor still looks fine on the top of the TL
    How can I go back ?
    Many thanks
    Ivan

    It sounds like you activated the Select Track Forward Tool. If you pressed t while editing, it turns this on. Simply press a or click on the normal pointer in the Tool Palette on the right.

  • Need help about ref cursor using like table

    Hi Guys...
    I am devloping package function And i need help about cursor
    One of my function return sys_refcursor. And the return cursor need to be
    join another table in database . I don't have to fetch all rows in cursor
    All i need to join ref cursor and another table in sql clause
    like below
    select a.aa , b.cc form ( ref_cursor ) A, table B
    where A.dd = B.dd
    I appeciate it in advance

    My understanding is that you have a function that returns a refcursor and is called by a java app.
    Because this is a commonly used bit of code, you also want to reuse this cursor in other bits of sql and so you want to include it like table in a bit of sql and join that refcursor to other tables.
    It's not as easy as you might hope but you can probably achieve this with pipelined functions.
    Is it a direction that code should be going down? yes, eventually. I like the idea of pulling commonly used bits of code into a SQL statement especially into the WITH section, provided it could be used efficiently by the CBO.
    Is it worth the effort given what you have to do currently to implement it? possibly not.
    what else could you do? construct the sql statement independently of the thing that used it and reuse that sql statement rather than the refcursor it returns?
    Message was edited by:
    dombrooks

  • I need help with shooting in my flash game for University

    Hi there
    Ive tried to make my tank in my game shoot, all the code that is there works but when i push space to shoot which is my shooting key it does not shoot I really need help with this and I would appriciate anyone that could help
    listed below should be the correct code
    //checking if the space bar is pressed and shooting is allowed
    if(evt.keyCode == 32 && shootAllow){
        //making it so the user can't shoot for a bit
        shootAllow = false;
        //declaring a variable to be a new Bullet
        var newBullet:Bullet = new Bullet();
        //changing the bullet's coordinates
        newBullet.y = tank_mc.y + tank_mc.width/2 - newBullet.width/2;
        newBullet.x = tank_mc.x;
        //then we add the bullet to stage
        addChild(newBullet);
    listed below is my entire code
    import flash.display.MovieClip;
        //declare varibles to create mines
    //how much time before allowed to shoot again
    var cTime:int = 0;
    //the time it has to reach in order to be allowed to shoot (in frames)
    var cLimit:int = 12;
    //whether or not the user is allowed to shoot
    var shootAllow:Boolean = true;
    var minesInGame:uint;
    var mineMaker:Timer;
    var cursor:MovieClip;
    var index:int=0;
    var tankMine_mc:MovieClip;
    var antiTankmine_mc:MovieClip;
    var maxHP:int = 100;
    var currentHP:int = maxHP;
    var percentHP:Number = currentHP / maxHP;
    function initialiseMine():void
        minesInGame = 15;
        //create a timer fires every second
        mineMaker = new Timer(6000, minesInGame);
        //tell timer to listen for Timer event
        mineMaker.addEventListener(TimerEvent.TIMER, createMine);
        //start the timer
        mineMaker.start();
    function createMine(event:TimerEvent):void
    //var tankMine_mc:MovieClip;
    //create a new instance of tankMine
    tankMine_mc = new Mine();
    //set the x and y axis
    tankMine_mc.y = 513;
    tankMine_mc.x = 1080;
    // adds mines to stage
    addChild(tankMine_mc);
    tankMine_mc.addEventListener(Event.ENTER_FRAME, moveHorizontal);
    function moveHorizontal(evt:Event):void{
        evt.target.x -= Math.random()*5;
        if (evt.target.x >= stage.stageWidth)
            evt.target.removeEventListener(Event.ENTER_FRAME, moveHorizontal);
            removeChild(DisplayObject(evt.target));
    initialiseMine();
        //declare varibles to create mines
    var atmInGame:uint;
    var atmMaker:Timer;
    function initialiseAtm():void
        atmInGame = 15;
        //create a timer fires every second
        atmMaker = new Timer(8000, minesInGame);
        //tell timer to listen for Timer event
        atmMaker.addEventListener(TimerEvent.TIMER, createAtm);
        //start the timer
        atmMaker.start();
    function createAtm(event:TimerEvent):void
    //var antiTankmine_mc
    //create a new instance of tankMine
    antiTankmine_mc = new Atm();
    //set the x and y axis
    antiTankmine_mc.y = 473;
    antiTankmine_mc.x = 1080;
    // adds mines to stage
    addChild(antiTankmine_mc);
    antiTankmine_mc.addEventListener(Event.ENTER_FRAME, moveHorizontal);
    function moveHorizontal_2(evt:Event):void{
        evt.target.x -= Math.random()*10;
        if (evt.target.x >= stage.stageWidth)
            evt.target.removeEventListener(Event.ENTER_FRAME, moveHorizontal);
            removeChild(DisplayObject(evt.target));
    initialiseAtm();
    function moveForward():void{
        bg_mc.x -=10;
    function moveBackward():void{
        bg_mc.x +=10;
    var tank_mc:Tank;
    // create a new Tank and put it into the variable
    // tank_mc
    tank_mc= new Tank;
    // set the location ( x and y) of tank_mc
    tank_mc.x=0;
    tank_mc.y=375;
    // show the tank_mc on the stage.
    addChild(tank_mc);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onMovementKeys);
    //creates the movement
    function onMovementKeys(evt:KeyboardEvent):void
        //makes the tank move by 10 pixels right
        if (evt.keyCode==Keyboard.D)
        tank_mc.x+=5;
    //makes the tank move by 10 pixels left
    if (evt.keyCode==Keyboard.A)
    tank_mc.x-=5
    //checking if the space bar is pressed and shooting is allowed
    if(evt.keyCode == 32 && shootAllow){
        //making it so the user can't shoot for a bit
        shootAllow = false;
        //declaring a variable to be a new Bullet
        var newBullet:Bullet = new Bullet();
        //changing the bullet's coordinates
        newBullet.y = tank_mc.y + tank_mc.width/2 - newBullet.width/2;
        newBullet.x = tank_mc.x;
        //then we add the bullet to stage
        addChild(newBullet);
    if (tank_mc.hitTestObject(antiTankmine_mc))
            //tank_mc.gotoAndPlay("hit");
            currentHP -= 10;
            // remove anti tank mine
            removeChild(antiTankmine_mc);
    if (tank_mc.hitTestObject(tankMine_mc))
            //tank_mc.gotoAndPlay("hit");
            currentHP -= 10;
            // remove anti tank mine
            removeChild(tankMine_mc);
        //var maxHP:int = 100;
    //var currentHP:int = maxHP;
    //var percentHP:Number = currentHP / maxHP;
        //Incrementing the cTime
    //checking if cTime has reached the limit yet
    if(cTime < cLimit){
        cTime ++;
    } else {
        //if it has, then allow the user to shoot
        shootAllow = true;
        //and reset cTime
        cTime = 0;
    function updateHealthBar():void
        percentHP = currentHP / maxHP;
        healthBar.barColor.scaleX = percentHP;
        if(currentHP <= 0)
            currentHP = 0;
            trace("Game Over");
        updateHealthBar();

    USe the trace function to analyze what happens and what fails to happen in the code you showed.  trace the conditional values to see if they are set up to allow a shot when you press the key

  • Need help in using sleep function in pl/sql

    Hi,
    need help:
    I have a condition where i want to validate total_pass=total_fail and
    I want to use the sleep function in a pl/sql where i want to wait for 2 minutes ie.checking
    whether total_pass=total_fail based upon class_id .
    I have the data in the table as:
    CLASS_ID TOT_PASS TOT_FAIL
    1 10 10
    2 5 4
    3 6 6
    4 7 5
    Any help will be needful for me

    I'm not quite sure what you are lookg for here, but whatever it is, your code as posted won't do it. You will never break out of the WHILE r_Class.Tot_Pass = r_Class.Tot_Fail loop, since these values will never change because you never get the next record form the cursor.
    From your original data, it looks like your cursor will return multiple rows which implies to me that you want to fetch the first row from the cursor, check if tot_pass = tot_fail, if they are equal, sleep for two minutes then get the next row. This does not make sense to me. Once the select in the cursor is executed, the data it returns will not change due to Oracle's read consistency model, so there seems to me no point in the sleep.
    The other alternative I can see is that you want to check all the returned rows, and if tot_pass = tot_fail for one of the rows (or possibly for all of the rows), then you want to sleep and try again.
    If you can explain in words what it is you are trying to accomplish, someone will be able to point you to a solution.
    John

  • Spry Menu Bar issue, NEED HELP...???

    Here is the coding for a menu bar that i created with CS3, for some reason i am having an issue when i open the web page in IE, on firefox and safari it looks fine, the menu drops down to sub menu's fine, but for some reason when i open it in IE, the submenu's show on the very top of the page rather than right below the menu itself, please check my coding and see if there is an issue???
    i ran compatability and there are no issues shown.
    @charset "UTF-8";
    /* SpryMenuBarHorizontal.css - Revision: Spry Preview Release 1.4 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    LAYOUT INFORMATION: describes box model, positioning, z-order
    /* The outermost container of the Menu Bar, an auto width box with no margin or padding */
    ul.MenuBarHorizontal
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        cursor: default;
        width: auto;
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
        z-index: 1000;
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        position: relative;
        text-align: left;
        cursor: pointer;
        width: 10.4em;
        float: left;
        background-image: url(tab2.png);
    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        z-index: 1020;
        cursor: default;
        width: 8.2em;
        position: absolute;
        left: -1000em;
        text-decoration: underline;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto;
        background-image: url(../tab1.png);
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
        width: 8.2em;
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
        position: absolute;
        margin: -5% 0 0 95%;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
        left: auto;
        top: 0;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal a
        display: block;
        cursor: default;
        padding: 0.5em 0.75em;
        color: #FFFFFF;
        text-decoration: none;
        border-left-color: #0063bd;
        border-right-color: #0063bd;
        border-right-width: 3px;
        border-left-width: thin;
        font-family: Calibri;
        font-weight: bold;
        font-size: 19px;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
        color: #000000;
    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
        color: #000000;
    SUBMENU INDICATION: styles if there is a submenu under a given menu item
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenu
        background-image: url(SpryMenuBarDown.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
        background-image: url(SpryMenuBarRight.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
        background-image: url(SpryMenuBarDownHover.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
        background-image: url(SpryMenuBarRightHover.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
        position: absolute;
        z-index: 1010;
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
        ul.MenuBarHorizontal li.MenuBarItemIE
        display: inline-block;
        f\loat: left;
        position: relative;

    Hey gramps, thanks for the info, i have updated my spry framework to 1.6.1 but the problem is still the same, i recreated my menu with the new 1.6 and it still doing the same thing, the submenu's are like vertically reversed... ugh need help.
    here the new code
    @charset "UTF-8";
    /* SpryMenuBarHorizontal.css - version 0.6 - Spry Pre-Release 1.6.1 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    LAYOUT INFORMATION: describes box model, positioning, z-order
    /* The outermost container of the Menu Bar, an auto width box with no margin or padding */
    ul.MenuBarHorizontal
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        cursor: default;
        width: auto;
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
        z-index: 1000;
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        position: relative;
        text-align: left;
        cursor: pointer;
        width: 10.4em;
        float: left;
    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        z-index: 1020;
        cursor: default;
        width: 8.2em;
        position: absolute;
        left: -1000em;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto;
        background-image: url(../tab1.png);
        line-height: 18px;
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
        width: 8.2em;
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
        position: absolute;
        margin: -5% 0 0 95%;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
        left: auto;
        top: 0;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
        border: 1px solid #CCC;
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal a
        display: block;
        cursor: pointer;
        padding: 0.5em 0.75em;
        color: #FFFFFF;
        text-decoration: none;
        font-size: 19px;
        font-family: Calibri;
        font-weight: bolder;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
        color: #000000;
    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
        color: #000000;
    SUBMENU INDICATION: styles if there is a submenu under a given menu item
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenu
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
        background-repeat: no-repeat;
        background-position: 95% 50%;
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
        position: absolute;
        z-index: 1010;
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
        ul.MenuBarHorizontal li.MenuBarItemIE
        display: inline;
        f\loat: left;

  • Need Help to re-download my Photoshop Elements 12+Premiere Elements 12 to a new laptop Win-8 64-bit

    When I purchased the special deal of Photoshop Elements 12+Premiere Elements 12, I owned a Windows Vista (32-bit) laptop. When I downloaded my purchase, all went smoothly, no problems w/Photoshop when I used the mouse's wheel-scroll feature, it helped me zoom in to specifically pinpoint areas in pictures t/b fixed, etc.
    I now have a NEW laptop ... Windows 8 (64-bit). I re-downloaded my Photoshop Elements 12+Premiere Elements 12 onto my new one. Options to download the Premiere Elements showed I should use the "bottom" option to download for Win-8/64-bit - did that w/no problem. There were NO OPTIONS showing that the Photoshop Elements 12 had to ALSO be using a specific way to be downloaded? Consequently, I think (?), the problem that I'm having in using the mouse's wheel-scrolling feature may have been affected by using the "normal" format to download???
    So here's my question:  Because I bought this combined deal, should I have ALSO used the bottom option showing installation for 64-bit Premiere Elements 12??? I WOULD APPRECIATE A TIMELY RESPONSE - NEED HELP ON GETTING MY PHOTOSHOP WORKING PROPERLY, NOW!
    Thank you in advance for any help/suggestions that can resolve my frustrating experience on this!
    Léona Buckner
    [email protected]

    Oops!!!! I accidentally found my answer within my Photoshop Elements 12 "Preferences" folder! Only one part of my question remains --- what about how to download it as a 64-bit option, or does it matter at all?
    Sorry to have panicked about this, but when I started using it, the cursor movements seemed unstable so I thought it was because of downloading for a 32-bit instead of my current OS-64bit!

  • Gurus...Need help....extract data from BKPF header table and BSEG line item

    Gurus,
    I have to write the logic to fetch data from bkpf and bseg. Need help on how can i do that..
    I have to get bukrs  belnr gjahr ldgrp from BKPF for a given date and company code. For all these documents, then i have to get the line items from BSEG if the ldgrp is I1 or SPACE.
    If the ldgrp is not I1 or SPACE then i have to fetch the records from BSEG_ADD and then generate a ALV report with all the data including the data that was fetched from BKPF.
    So, it wil be a combined ALV report that displays header as well as LINE item data together...
    Can u please help me with the code...I am not sure how can everything go all together in one internal table....Becoz once its there in one table then only a ALV list can be generated.......
    Cheers:
    Sam

    hi Sam, this may be of some similar thing.
    Use this program, I got this prog from a source and we added a small conditional check in the program which checks document numbers in BSEG and also comapres in BKPF and sees if the output from BSEG falls under the posting data range specified in the initial selection.
    Now just so you know, this output is kinda messed up, so you will have to play with it in Excel to extract the document numbers, if that is what you want.
    ============================
    PROGRAM....... ZFI_BSEG_DOWNLOAD
    TITLE......... Download BSEG
    PROGRAM TYPE.. Download
    ======================================================================
    GENERAL DOCUMENTATION AND COMMENTS
    <...>
    ======================================================================
    ASSOCIATED PROGRAMS
    <Program>..... <Description>
    ======================================================================
    CHANGE HISTORY
    Date By Ticket Description
    REPORT zfi_bseg_download.
    TABLES: bseg, bkpf.
    TYPES: BEGIN OF ty_output,
    line(6000) TYPE c,
    END OF ty_output.
    TYPES: ty_tab_output TYPE TABLE OF ty_output,
    ty_tab_nametab TYPE TABLE OF x031l.
    CONSTANTS: c_delimiter(04) TYPE c VALUE '"%%"',
    c_records TYPE i VALUE 10000.
    SELECTION-SCREEN
    SELECT-OPTIONS: p_bukrs FOR bseg-bukrs,
    p_belnr FOR bseg-belnr,
    p_buzei FOR bseg-buzei,
    p_gjahr FOR bseg-gjahr,
    p_budat for bkpf-budat.
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN SKIP.
    PARAMETERS: p_append AS CHECKBOX DEFAULT 'X'.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM get_records.
    *& Form get_records
    FORM get_records.
    DATA: l_cursor TYPE cursor,
    lt_bseg TYPE TABLE OF bseg,
    ls_bseg LIKE LINE OF lt_bseg,
    lt_output TYPE ty_tab_output,
    ls_output LIKE LINE OF lt_output,
    lt_nametab TYPE ty_tab_nametab,
    ls_nametab LIKE LINE OF lt_nametab,
    l_field(30) TYPE c,
    l_output(50) TYPE c,
    l_date(10) TYPE c,
    l_len TYPE i.
    FIELD-SYMBOLS: <field>.
    IF p_append NE space.
    OPEN DATASET p_file FOR APPENDING IN TEXT MODE.
    ELSE.
    OPEN DATASET p_file FOR OUTPUT IN TEXT MODE.
    ENDIF.
    Retrieve BSEF fieldnames and data types
    PERFORM get_fields CHANGING lt_nametab.
    OPEN CURSOR l_cursor FOR
    SELECT * FROM bseg
    WHERE bukrs IN p_bukrs
    AND belnr IN p_belnr
    AND buzei IN p_buzei
    AND gjahr IN p_gjahr.
    Write out fieldnames
    IF p_append IS INITIAL.
    LOOP AT lt_nametab INTO ls_nametab.
    CONCATENATE ls_output ls_nametab-fieldname
    INTO ls_output SEPARATED BY c_delimiter.
    ENDLOOP.
    IF ls_output+0(4) = c_delimiter.
    SHIFT ls_output LEFT BY 4 PLACES.
    ENDIF.
    l_len = strlen( ls_output ).
    TRANSFER ls_output TO p_file LENGTH l_len.
    ENDIF.
    Process BSEG records
    DO.
    CLEAR lt_bseg.
    FETCH NEXT CURSOR l_cursor
    INTO TABLE lt_bseg
    PACKAGE SIZE c_records.
    IF sy-subrc 0.
    EXIT.
    ENDIF.
    LOOP AT lt_bseg INTO ls_bseg.
    SELECT single * FROM BKPF
    WHERE BUKRS = ls_bseg-BUKRS
    AND BELNR = ls_bseg-BELNR
    AND GJAHR = ls_bseg-GJAHR
    AND BUDAT in p_budat.
    if syst-subrc 0.
    continue.
    endif.
    CLEAR ls_output.
    Process individual fields of BSEG record
    LOOP AT lt_nametab INTO ls_nametab.
    CONCATENATE 'LS_BSEG-' ls_nametab-fieldname INTO l_field.
    ASSIGN (l_field) TO <field>.
    CLEAR l_output.
    Process by field data types
    CASE ls_nametab-exid.
    WHEN 'C' OR 'N' OR 'I'.
    Character, Numeric & Integer
    l_output = <field>.
    WHEN 'D'.
    Dates
    WRITE <field> TO l_date DD/MM/YYYY.
    l_output = l_date.
    WHEN 'P'.
    Packed decimals
    WRITE <field> TO l_output.
    WHEN OTHERS.
    MESSAGE a000(zs) WITH 'Data type error - ' ls_nametab-exid.
    ENDCASE.
    SHIFT l_output LEFT DELETING LEADING space.
    CONCATENATE ls_output l_output
    INTO ls_output SEPARATED BY c_delimiter.
    ENDLOOP.
    IF ls_output+0(4) = c_delimiter.
    SHIFT ls_output LEFT BY 4 PLACES.
    ENDIF.
    l_len = strlen( ls_output ).
    TRANSFER ls_output TO p_file LENGTH l_len.
    ENDLOOP.
    IF sy-subrc = 0.
    ENDIF.
    ENDDO.
    CLOSE CURSOR l_cursor.
    CLOSE DATASET p_file.
    ENDFORM. " get_records
    *& Form get_fields
    FORM get_fields CHANGING pt_nametab TYPE ty_tab_nametab.
    CALL FUNCTION 'RFC_GET_NAMETAB'
    EXPORTING
    tabname = 'BSEG'
    TABLES
    nametab = pt_nametab
    EXCEPTIONS
    table_not_active = 1
    OTHERS = 2.
    IF sy-subrc 0.
    ENDIF.
    ENDFORM. " get_fields
    hope this helps.
    cheers,
    Hema.

Maybe you are looking for

  • Error while adding a attribute to the the Custom view through a wizard

    Hi , I have created a new custom view with value node through wizard  succesfully. Now I want to add a new attribute to that node.I am trying to do that by a wizard. But i am getting the follwing error " Error during analysis of Source Code" although

  • Apple TV and .mac photos

    I'm having problems connecting my AppleTV to my .mac account. All of our albums or protected and require you to login to view the images. Does AppleTV only support public photo albums on .mac?

  • After adding datafile with OEM a trace file genarating in alertSID.log file

    Hi to All, I have added a datafile with OEM but while adding its taking some time so terminated that program and added the datafile with command prompt but after some time i seen that datafile in datafile list and after this thing Im getting error an

  • [SOLVED] Hostname lost

    Hello all, I tried all what I could, impossible to get my hostname back ! I made an upgrade on a machine and lost the hostname !! This computer should be named crystal, but now I have : $ uname -n (none) $ echo $HOSTNAME Here is /etc/hosts : #<ip-add

  • Retrieve data from oracle table

    hi, i have uploaded a piece of xml format data in oracle and successfully uploaded but when trying to retrieve data it reterieve 0 records. Oracle version is given below: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL