How to write a cursor for mutiple columns in forms urgent required.........

i created one table rk with 8 columns and that i designed in forms.
but i have another table grk with 4 columns.
this grk contains data.
this grk 4 columns data i have to retrive in rk table in froms by multiple records.
the both column names are same in the both tables.
because by seeing this 4 columns data i will insert remaining 4 column by entering in rk table in form.
i known that i have to write cursor to retrive the 4 columns data for multiple record from grk table and in trigger i have to produce to rk table.
i have worked but it is not working.
can any body help me out how to write a cursor for 4 column to retrive multple records in form

Hi,
Try,
DECLARE
        CURSOR Cur_Test IS SELECT <field_1>, <field_2>, <field_3>, ... <field_n> FROM <table_name> WHERE <condition>;
BEGIN
        OPEN Cur_Test;
        LOOP
                FETCH Cur_Test INTO <items_or_variables>;
                EXIT WHEN Cur_Test%NOTFOUND;
        END LOOP;
        CLOSE Cur_Test;
END;Regards,
Manu.

Similar Messages

  • How to write nested cursor for Adv. Collections dunning letter query

    I am trying to write a query for Advanced Collections duninng letters. Some accounts for this customer have invoices for more than one currency. In order to find all of the invoices this query works:
    select to_char(sysdate, 'MM/DD/YYYY') currsysdate,
    decode((per.person_first_name || per.person_last_name), null, ARPT_SQL_FUNC_UTIL.get_lookup_meaning('RESPONSIBILITY', 'APS'), per.person_first_name) first_name,
    per.person_last_name last_name,
    org.party_name org_name,
    loc.address1 address1,
    loc.address2 address2,
    loc.city city,
    loc.state state,
    loc.postal_code postal_code,
    per.person_first_name first_name1,
    (select sum(aps.amount_due_remaining)
    from
    iex_delinquencies_all dd,
    ar_payment_schedules_all aps
    where
    dd.payment_schedule_id = aps.payment_schedule_id and
    dd.party_cust_id = org.party_id and
    dd.cust_account_id = 255849 and
    dd.customer_site_use_id = 13071) total_amount_due_remaining,
    to_char(sysdate+7, 'MM/DD/YYYY') required_pay_date,
    rs.source_email collector_email,
    arc.alias collector_name,
    arc.telephone_number collector_phone,
    ar.account_number,
    cursor
    (select
    ct.trx_number invoice_number,
    to_char(ar.due_date, 'MM/DD/YYYY') due_date,
    ar.amount_due_remaining amount_due_remaining,
    ar.invoice_currency_code invoice_currency_code
    from
    iex_delinquencies_all d,
    ar_payment_schedules_all ar,
    ra_customer_trx_all ct
    where
    d.party_cust_id = org.party_id
    and d.cust_account_id = 255849
    and d.customer_site_use_id = 13071
    and d.payment_schedule_id = ar.payment_schedule_id
    and d.status = 'DELINQUENT'
    and ar.customer_trx_id = ct.customer_trx_id
    and ar.amount_due_remaining <> 0
    ) as payment_history
    from
    HZ_LOCATIONS loc
    ,hz_parties org
    ,hz_parties per
    ,jtf_rs_resource_extns rs
    ,ar_collectors arc
    ,hz_cust_accounts ar
    where
    loc.location_id = 11600
    and org.party_id= 255849
    --and per.party_id = nvl(:CONTACT_ID, org.party_id)
    and per.party_id = 255849
    and arc.resource_id = rs.resource_id
    and rs.RESOURCE_ID = 100022224
    and ar.cust_account_id = 182399
    But this assumes there is only one invoice currency but there isn't. Now I need to loop through all the distinct currencies in the ar_payment_schedules table so I was trying something like this:
    select to_char(sysdate, 'MM/DD/YYYY') currsysdate,
    decode((per.person_first_name || per.person_last_name), null, ARPT_SQL_FUNC_UTIL.get_lookup_meaning('RESPONSIBILITY', 'APS'), per.person_first_name) first_name,
    per.person_last_name last_name,
    org.party_name org_name,
    loc.address1 address1,
    loc.address2 address2,
    loc.city city,
    loc.state state,
    loc.postal_code postal_code,
    per.person_first_name first_name1,
    (select sum(aps.amount_due_remaining)
    from
    iex_delinquencies_all dd,
    ar_payment_schedules_all aps
    where
    dd.payment_schedule_id = aps.payment_schedule_id and
    dd.party_cust_id = org.party_id and
    dd.cust_account_id = 255849 and
    dd.customer_site_use_id = 13071) total_amount_due_remaining,
    to_char(sysdate+7, 'MM/DD/YYYY') required_pay_date,
    rs.source_email collector_email,
    arc.alias collector_name,
    arc.telephone_number collector_phone,
    ar.account_number,
    cursor
    (select distinct ar.invoice_currency_code invoice_currency_code
    from
    iex_delinquencies_all d,
    ar_payment_schedules_all ar,
    ra_customer_trx_all ct
    where
    d.party_cust_id = org.party_id
    and d.cust_account_id = 255849
    and d.customer_site_use_id = 13071
    and d.payment_schedule_id = ar.payment_schedule_id
    and d.status = 'DELINQUENT'
    and ar.customer_trx_id = ct.customer_trx_id
    and ar.amount_due_remaining <> 0
    cursor
    (select
    ct.trx_number invoice_number,
    to_char(ar.due_date, 'MM/DD/YYYY') due_date,
    ar.amount_due_remaining amount_due_remaining,
    --ar.invoice_currency_code invoice_currency_code
    from
    iex_delinquencies_all d,
    ar_payment_schedules_all ar,
    ra_customer_trx_all ct
    where
    d.party_cust_id = org.party_id
    and d.cust_account_id = 255849
    and d.customer_site_use_id = 13071
    and d.payment_schedule_id = ar.payment_schedule_id
    and d.status = 'DELINQUENT'
    and ar.customer_trx_id = ct.customer_trx_id
    and ar.amount_due_remaining <> 0
    and ar.invoice_currency_code = invoice_currency_code
    ) as payment_history
    ) as g_currency
    from
    HZ_LOCATIONS loc
    ,hz_parties org
    ,hz_parties per
    ,jtf_rs_resource_extns rs
    ,ar_collectors arc
    ,hz_cust_accounts ar
    where
    loc.location_id = 11600
    and org.party_id= 255849
    --and per.party_id = nvl(:CONTACT_ID, org.party_id)
    and per.party_id = 255849
    and arc.resource_id = rs.resource_id
    and rs.RESOURCE_ID = 100022224
    and ar.cust_account_id = 182399
    But I am getting missing right parenthesis error which leads me to think I am writing this correctly.

    Note the name of this forum is "SQL Developer *(Not for general SQL/PLSQL questions)*", so only for issues with the SQL Developer tool. Please post these questions under the dedicated SQL And PL/SQL forum (you've posted there before).
    Regards,
    K.

  • How to write  complex sql for this

    Hi ALL,
    I have a requirement like this
    I have 5 tables which i have to join to get the result
    but there no join column to 2 other table.
    I want to get all the applications using cobal,running on UNIX.
    How to write the query for this
    1.APP
    APP_i DESC
    1 Accounts
    2 Payments
    3 order transfer
    4 Order processing
    2.Techgy
    techid techdesc
    1 cobal
    2 Java
    3.APP_Techgy
    APP_I Techid
    1 1
    2 1
    3 1
    4 2
    4.Pltfrm
    pltfmid pltfrmdesc
    1 Windows NT
    2 UNIX
    5.APP_Pltfrm
    APP_I pltfrmid
    1 1
    2 1
    3 2
    4 2
    ouput must be
    APP_i Desc techDESC pltfrmdesc
    3 ordertranfer Cobal UNIX
    Thanks in advance

    This ('descr' in place of 'desc')?
    SQL> select a.app_i, a.descr, t.techdesc, p.pltfrmdesc
    from app_techgy atc,
       app a,
       techgy t,
       app_pltfrm ap,
       pltfrm p
    where atc.techid = t.techid
    and atc.app_i = a.app_i
    and atc.app_i = ap.app_i
    and ap.pltfrmid = p.pltfmid
    order by a.app_i
         APP_I DESCR                TECHDESC             PLTFRMDESC         
             1 accounts             cobal                windows nt         
             2 payments             cobal                windows nt         
             3 order transfer       cobal                unix               
             4 order processing     java                 unix               
    4 rows selected.

  • How to set default values for boolean columns

    I'm trying to deploy some content types and columns into a site with a feature. All it's ok, except that I'm trying to set a default value for boolean columns with no success.
    I've tried to set default value at column level:
    <Field ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DisplayName="Se publican noticias en español"
    Type="Boolean" Hidden="FALSE" Group="Columnas ShaCon" >
    <Default>TRUE</Default>
    </Field>
    and at content type level:
    <FieldRef ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DefaultValue="TRUE" Required="TRUE" />
    But in any case, when i create a new item with this content type, default value is applied.
    Can anyone tell how to set default values for boolean columns?
    Thanks in advance,
    Regards,
    Sergio

    In the field definition you can set
    <Default>1</Default>
    or
    <Default>0</Default>
    How to set the default value Null?

  • How to write conversion routine for key figure?

    Our customer has this requirment:
    we need to know the last time of some TV program in BEx report, If a TV program last 500 seconds, we need show the key figure like this:  00:08:20, If a TV program last 100000 seconds, we need show the key figure like 27:46:40 (27 hours and 46 minitues and 27 seconds), If we define a key figure as time,  BW system will report a error that say it is not acceptable time.  If we want to define a integer, but we need display it like hhmmss format.  We know we can write conversion routine for char.  but I don't how to write conversion routine for key figure.   Please give me any hint if any other solutions?
    Edited by: SY DONG on Dec 2, 2010 3:36 AM

    If you want to do in Transformation Layer :
    You can use routine ...break up the seconds into minute hour and seconds
    you will have to handle few cases in this:
    let say your variable lv_seconds holds the number of seconds you want to convert to hour min and seconds
    DATA: lv_seconds type i,
               lv_hrs  type  i,
              lv_sec type i,
              lv_min type i.
    lv_hrs = lv_seconds / 3600
    if lv_hrs >= 1.
    lv_min = (lv_hrs - trunc(lv_hrs))*60
    here again handle seconds if min >60.
    else.
    lv_hrs = '00'.
    lv_min = lv_hrs*60
    It is just hint ..how you can manipulate the seconds to get it...you will have to think about the complete algorithm
    Regards,
    RK

  • How to write a code for  open new txt file in swing

    hai all,
    now i do one project in java.that project's GUI is Swing. But i don't known swing (basic).So how to write a code for open new txt file and "Open window " in menu item on swing.that means when i click the "New" on menu that time open a new txt file. open also like that type.
    plz give me that code ! very urgent
    Advance Thanks !
    RSK

    Swing Tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    Since you don't know the basic of swing read the tutorial, it is for your own good because it is useless if we provide you with a code you don't even understand and how it works.
    If you want a menu read the tutorial about using menus and for opening a file read using JFileChooser.
    note: don't use the word urgent because it implies that your problem is more important than others.

  • How to write Select statement for this codition

    I need to check whether SGTXT contains BELNR value.
    SGTXT is a text field and It should be matched with BELNR
    How to write select statement for this.
    Select AUGBL AUGDT into t_BSAD
    from BSAD
    where SGTXT should have the given BELNR Value.
    Plz note : Here I cannot give as SGTXT = BELNR as coz BELNR have only 10 digits.

    Hi,
    data temp(12).
    concatenate '%' belnr '%' into temp.
    Select AUGBL AUGDT into t_BSAD
    from BSAD
    where SGTXT like temp.
    If belnr is having multiple values,just create a internal table as follows.
    types : begin of ty,
            belnr....
            temp(12),
            end of ty.
    data itab_ type standard table of ty.
    data wa type ty.
    loop at itab into wa.
    concatenate '%' wa-belnr '%' into wa-temp.
    modify itab from wa index sy-tabix transporting temp.
    endloop.
    Change your select statement accordingly.
    Kindly reward poits if it helps.

  • How to boldface the header for ONE column

    hi,
    I want to know how to boldface the header for ONE column. The following will boldface the header for all the columns in the table
    table.getTableHeader().setFont(new java.awt.Font("Dialog", 1, 12));
    Thanks.
    Jrabi

    jtable.getColumnModel().getColumn( indexOfBoldColumn ).setHeaderRenderer( TableCellRenderer aRenderer )

  • How to write sql query for counting pairs from below table??

    Below is my SQL table structure.
    user_id | Name | join_side | left_leg | right_leg | Parent_id
    100001 Tinku Left 100002 100003 0
    100002 Harish Left 100004 100005 100001
    100003 Gorav Right 100006 100007 100001
    100004 Prince Left 100008 NULL 100002
    100005 Ajay Right NULL NULL 100002
    100006 Simran Left NULL NULL 100003
    100007 Raman Right NULL NULL 100003
    100008 Vijay Left NULL NULL 100004
    It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
    I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains  both left_leg and right_leg id, then it is called pair.)
    I know there are three pairs under id "100001" :-
    1.  100002 and 100003
    2.  100004 and 100005
    3.  100006 and 100007
        100008 will not be counted as pair because it does not have right leg..
     But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
    Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005

    Sounds like this to me
    DECLARE @ID int
    SET @ID = 100001--your passed value
    SELECT left_leg,right_leg
    FROM table
    WHERE (user_id = @ID
    OR parent_id = @ID)
    AND left_leg IS NOT NULL
    AND right_leg IS NOT NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to write professional documentation for java

    Hi, I have few application I need to write documentation for. Im ok with the user and serwer technical stuff. But how to write proper documentation for source code? Any tutorial or howto?
    Best regards.

    Phenom7 wrote:
    Hi, I have few application I need to write documentation for. Im ok with the user and serwer technical stuff. But how to write proper documentation for source code? Any tutorial or howto?A pointer: be explicit and specific when writing Javadocs. If your method never returns null, make sure you say so. If it can't accept null as a parameter, be sure to say what the consequence will be if it happens (but it's OK to say the result is undefined!). A well-written method Javadoc will make users of any API you make a lot more happy, rather than keeping them guessing or making them inspect your source code.
    It's expected that while the implementation of a method will change, its pre and post-conditions will not. Therefore, having a good method-level Javadoc is critical to both the people counting on your code and the people maintaining your code.

  • How to write a PCR for this ?

    Hi SAP-HR Experts .
    Dear friends , My Company Requires a specific requiremnt that at the date of any Employee's
    B'day his one day salary should get doubled and he is entitled to get one leave on his B'day .
    I do not know how to write a PCR for this ?
    May some Body tell me how to meet this requirement Please .
    tell me please step by step how to go through ...
    It will be great help for me .
    Best regards : rajneeesh

    I think you can make it with something like this:
    Write a PCR in schema, you can call the rule with "actio";
    000860 ACTIO 9BIR AR               Birthday
    Rule 9BIR
    9BIR Rule for Birthday
            NUM=FG C   Set                   " F (fixed indicator for deadline calculation); G (Birth date from infotype 0002);C (complete months)
            NUM/12     División              " Number of completed months divided by  12
            NUMV0O2L   Off.Lng en arg.var.   " the last two places of the number are entered in the variable argument.
                                " if the rest is not 00, there is nothing to do
              00                             " if the rest is 00
                ZERO= N    AmtNumRteZeit = 0 "
                AMT=  1002 Set               " wagetype of  salary
                AMT/TKDIVI División          " divides the amount by  Partial Period Parameter Whole Month
                ADDWTI1002 Input table       " accumulates into 1002
    Example: an employee with birthday 01.01.1977 in IT0002
    Payrroll in january 08
    wagetype 1002 before rule 9BIR:
    3 1002 Salario Bas01                           30,33  30,00              909,90
    Rule 9BIR
    NUM=FG C   Set; NUM= 372
    NUM/12        ; 372/12= 31 rest=00
    AMT=1002      ; AMT= 909,90
    AMT/TKDIVI    ; 909,90/31= 29,35
    ADDWTI1002    ; 909,90 + 29,35= 939,25
    wagetype 1002 before rule 9BIR:
    3 1002 Salario Bas01                           30,33  30,00              939,25
    Hope this helps. Manuel

  • How to write a code for cumulative values..

    Hi
    Can any one proivde the Sudo code for Customer exit at Reports.
    I need to write a code for when ever user input Calaender month then querry calucalate the cumulative values also.
    How to write a code for cumulative values..
    Example:
    Customer -Sales.Quantity(CalMonth)---   Sales.quantity(Cumulative Month)  
    1000--223--
    2200
    Regards
    mannev.

    hi mannev,
    to get an idea, search in SDN
    for example
    customer exit code
    with hopes,
    Raja Singh

  • Can any one please tell me how to write labview program for data logging in electric motor bike.

    Can any one please tell me how to write labview program for data logging in electric motor bike. I am going to use CompactRIO for getting wide range of data from various sensors in bike. I need to write labview program for data logging of temperature, voltage and speed of the bike. Can any one help me?

    Yes, we can.   
    I think the best place for you to start for this is the NI Developer Zone.  I recommend beginning with these tutorials I found by searching on "data log rio".  There were more than just these few that might be relevant to your project but I'll leave that for you to decide.
    NI Compact RIO Setup and Services ->  http://zone.ni.com/devzone/cda/tut/p/id/11394
    Getting Started with CompactRIO - Logging Data to Disk  ->  http://zone.ni.com/devzone/cda/tut/p/id/11198
    Getting Started with CompactRIO - Performing Basic Control ->  http://zone.ni.com/devzone/cda/tut/p/id/11197
    These will probably give you links to more topics/tutorials/examples that can help you design and implement your target system.
    Jason
    Wire Warrior
    Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!

  • How to write the logic for extending Idocs...

    Hi,
          Can anybody pls explain how to write the logic for extending IDOCs with an example...
          Good suggestions can be appreciated..
    Regards,
    Ram

    Hi Ram,
    Generally the IDoc user exit is called at the following places:
      1) When the control record is read.
      2) After each and every segment in the data record
      3) At the end of the data segment processing.
    The IDoc user exit interface generally imports IDOC_DATA (data record internal table) table. Now the data records in the internal table should appear in the same order as maintained while defining IDoc structure (WE30 transaction). For SAP standard segment SAP code will take care of this. For extended segment you will have to take care of this aspect by appending the Z-segment in the IDOC_DATA table.
    You can do this by:
             looping at IDOC_DATA table:
                 - Do a case-endcase fo IDOC_DATA-SEGNAM (This stores the segment 
                   structure as per the hierarchy).
                 - Within the case for "Z-segment" you can write the logic for appending
                   the Z-segment to IDOC_DATA-SDATA.
    Hope this gives some clue.
    Regards,
    Gajendra.

  • How to write Error message for select options?

    Hi
    i have this select option statement
    SELECT-OPTIONS: s_fevor FOR afko-fevor.
    how to write error message for this?
    Regards
    Smitha

    Error messages are displayed for Select-options mostly on two conditions:
    1) You needs to check wether a value is entered or not its done by:
    a)
    Select-options:SELECT-OPTIONS: s_fevor FOR afko-fevor Obligatory.
       In this case error message is automatically throwed by system.
    b) You can do this in Selection Screen events.
    Ex:
    AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
    IF S_FEVOR-LOW IS INITIAL.
    MESSAGE 'XXXXX' TYPE 'E'.
    ENDIF.
    2) You need to Validate the entered value:
    You can do this in Selection Screen events.
    Ex:
    AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
    SELECT FEVOR
                 FROM AFKO
                 INTO AFKO-FEVOR
                 UP TO 1 ROWS
    ENDSELECT.        
    IF SY-SUBRC NE 0.
    MESSAGE 'XXXXX' TYPE 'E'.
    ENDIF.
    Regards,
    Gurpreet

Maybe you are looking for

  • NDS Gateway Active Sync Listing All users on each poll

    When Sun Identity Manager 6.0 sp1 runs an active sync poll event with the NDS Resource Adapter against the Gateway the following behaviour is exhibited within both the customer environment and the Lab environment. The Gateway will list all the users

  • Validation for Custom document over internet -Protocol

    Hi all, Could you please help me , what to configure in B2B In protocols tab while configuring custom document over internet , do we need to swithc ON the validation or its SWITCH OFF the validation. For both inbound and outbound transactions(PROCES

  • Lead to Opportunity Error

    Hi all, When I tried to Qualify the lead to opportunity I was getting error like

  • Where is the Contacts Search feature?

    I have over 4,000 contacts in my list. I need to be able to search for contacts based on information in other fields besides first and last name. Where can I find the Contacts Search/Spotlight input field or equivalent?

  • Find all Connector Space Objects That Were Provisioned

    I'm trying to run a query on the FIM Synchronization Database to find all of the objects in a connectorspace that were created there via provisioning rules. Some objects in the connectorspace have joined and some have been created via provisioning bu