Inserting rows in cursor and breaking up when effect date matches

Hi
I have created a table cadreinc (empno varchar2(8), pay number(5), da number(5) , scale varchar2(11), effectdate date , flag varchar2(1)) with values as shown below.
04485816      12800     4200     09300-34800      1-Jan-2006     Y
04485816      13000     4200     09300-34800      1-Jul-2006     Y
04485816      13450     4600     09300-34800      27-Sep-2006     Y
04485816      13675     4600     09300-34800      1-Jul-2007     Y
04485816      14200     4600     09300-34800      1-Jul-2008     Y
04485816      14650     4600     09300-34800      1-Jul-2009     Y
I just want to manipulate data into another table by using this data and i want the result as
04485816 12800 4200 09300-34800 01-jan-2006
04485816 12800 4200 09300-34800 01-feb-2006
04485816      13000     4200 09300-34800 1-Jul-2006     
04485816 13000 4200 09300-34800 1-aug-2006
like data reproduced on every month and get changes in value based on the effect date.
how to write pl sql program for this??
I have tried some what like
DECLARE
EMP VARCHAR2(8);
PAY NUMBER(5);
GP NUMBER(5);
SCALE VARCHAR2(11);
INC date;
PAD VARCHAR2(11);
FL VARCHAR2(1);
CURSOR A IS SELECT EMPNO,VIPAY,GRADEPAY,VISCALE,INCDATE,FLAG FROM CADREINC;
BEGIN
<<i_loop>> FOR I IN A LOOP
INC:=I.INCDATE;
FL:='Y';
<<j_loop>> FOR K IN 1..12 LOOP
INSERT INTO CADREFIX ( EMPNO,VIPAY,GRADEPAY,VISCALE,INCDATE) VALUES
(I.EMPNO,I.VIPAY,I.GRADEPAY,I.VISCALE,I.INCDATE);
I.incdate:=LAST_DAY(I.INCDATE)+1;
EXIT j_loop WHEN pay>i.vipay and inc=i.incdate and fl='Y';
--EXIT WHEN INC='01-JUL-2010'; 
END LOOP;
-- i.INCdate:=LAST_DAY(I.INCDATE)+1;
EXIT i_loop WHEN pay>i.vipay and inc=i.incdate and fl='Y' ;
END LOOP;
COMMIT;
END;
but unable to get the desired results. The pay comes for every 12 months instead of upto effect date.
Please help.

Hi,
Welcome to the forum!
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If you're asking about a DML statement, such as INSERT, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
Always say which version of Oracle you're using.
See the forum FAQ {message:id=9360002}
Here's one way to do what you want in pure SQL. Since I don't have your table, I'll use scott.emp to show the way:
WITH     data_by_month     AS
     SELECT       TRUNC (hiredate, 'MONTH')     AS hiremonth
     ,       COUNT (*)                  AS cnt
     FROM       scott.emp
     GROUP BY  TRUNC (hiredate, 'MONTH')
,     got_repeat_num     AS
     SELECT     hiremonth, cnt
     ,     MONTHS_BETWEEN ( LEAD (hiremonth) OVER (ORDER BY hiremonth)
                      , hiremonth
                      )     AS repeat_num
     FROM    data_by_month
SELECT       ADD_MONTHS ( r.hiremonth
                 , c.column_value - 1
               )                 AS report_month
,       cnt
FROM          got_repeat_num  r
CROSS JOIN     TABLE ( CAST ( MULTISET ( SELECT  LEVEL
                                              FROM        dual
                           CONNECT BY     LEVEL     <= r.repeat_num
                     AS sys.odcinumberlist
                )  c
ORDER BY  report_month
;You can use a query like this in an INSERT or MERGE statement.
If you need to use PL/SQL, then you can use an INSERT or MERGE statement, with a sub-query like the one show above, in PL/SQL.

Similar Messages

  • Runtime error when inserting rows in hrp1018 and hrt1018 tables

    Hi All,
    I have a requirement to insert row in hrp1018 and hrt1018 tables.These tables are interlinked.So, I have used FM 'RH_INSERT_INFTY'. The exact code which I have used is as follows.
    *****************************************code***************************************************************
    << Please post only the relevant portion of the code >>
    The runtime error which is coming is as follows:
    Error analysis
        An internal error in the database interface occurred during access to
        the data of table "HRT1018 ".
        The situation points to an internal error in the SAP software
        or to an incorrect status of the respective work process.
        For further analysis the SAP system log should be examined
        (transaction SM21).
        For a precise analysis of the error, you should supply
        documents with as many details as possible.
    Please let me know why this error is coming.I am not able to find out mistake in the FM and form used in the code.
    Thanks in advance,
    BBKrishna.
    Edited by: Rob Burbank on Jun 9, 2009 1:31 PM

    I am adding the code once again.Please let me know why the error is coming up.
    lv_mproj = 'BLDNG'.
      wa_p1018-mandt = sy-mandt.
      wa_p1018-otype = '9M'.
      wa_p1018-objid = '50009650'.
      wa_p1018-begda = '20090608'.
      wa_p1018-endda = '99991231'.
      wa_p1018-infty = '1018'.
      wa_p1018-plvar = '01'.
      wa_p1018-otype = '9M'.
      wa_p1018-istat = '1'.
      append wa_p1018 to it_p1018.
      repid = sy-repid.
    *Updating hrp1018 and hrt1018 tables
      CALL FUNCTION 'RH_INSERT_INFTY'
        EXPORTING
        FCODE                     = 'INSE'
        VTASK                     = 'D'
         AUTHY                    = ' '
          REPID                   =  repid
          FORM                    = 'FILL_TABS'
        TABLES
          INNNN                   = it_p1018
    EXCEPTIONS
       NO_AUTHORIZATION          = 1
       ERROR_DURING_INSERT       = 2
       REPID_FORM_INITIAL        = 3
       CORR_EXIT                 = 4
       BEGDA_GREATER_ENDDA       = 5
       OTHERS                    = 6
      IF SY-SUBRC <> 0.
        CALL FUNCTION 'BALW_BAPIRETURN_GET'
          EXPORTING
            TYPE                             = SY-MSGTY
            CL                               = sy-msgid
            NUMBER                           = SY-MSGNO
      PAR1                             = ' '
      PAR2                             = ' '
      PAR3                             = ' '
      PAR4                             = ' '
      LOG_NO                           = ' '
      LOG_MSG_NO                       = ' '
         IMPORTING
           BAPIRETURN                        = return_rec
    EXCEPTIONS
      ONLY_2_CHAR_FOR_MESSAGE_ID       = 1
      OTHERS                           = 2
        IF SY-SUBRC <> 0.
            lv_mproj = text-011
                      ELSE.
                      ii_return = return_rec.
                      CONCATENATE                  ii_return-type '-' ii_return-message
                      INTO lv_err_msg SEPARATED BY SPACE.
        ENDIF.
      ENDIF.
    *RHCD_TAB-PROZT
       FORM fill_tabs TABLES ins_tab
                   USING ins_set ins_index.
      DATA : BEGIN OF set.
              INCLUDE STRUCTURE wplog.
      DATA : END   OF set.
      DATA: BEGIN OF h_pt1018.             "to initialize INS_TAB
              INCLUDE STRUCTURE pt1018.
      DATA: END OF h_pt1018.
      REFRESH ins_tab.
      set = ins_set.
      CASE set-infty.
        WHEN '1018'.
          h_pt1018-posnr = lv_mproj.
          h_pt1018-prozt = '100.00'.
          IF NOT ( h_pt1018 IS INITIAL ).
            CLEAR ins_tab.
            ins_tab+36(8) = lv_mproj. "h_pt1018.
            ins_tab+134(5) = '100.00'.
            APPEND ins_tab.
          ENDIF.
      ENDCASE.
    ENDFORM.

  • How to include new inserted row in cursor

    Hi ...
    Is there anyway to include new inserted row into opened cursor ?
    consider the following code:
    declare
    cursor tbl_cur is select * from table1;
    -- table1 has two fields: no and name --
    begin
    for tbl_rec in tbl_cur
    loop
    -- if I insert some records here into table1, is there anyway that those just inserted records be included in tbl_cur so that can be proceed in for loop ? or anyway to include new inserted rows into opened cursor ?
    end loop;
    end;
    anyone response is highly appreciated.
    Thank You,
    SK.
    null

    If you re-open the cursor in another loop, the rows that you inserted in the previous loop will be included, along with the original rows.
    DECLARE
    CURSOR tbl_cur
    IS
    SELECT *
    FROM table1;
    BEGIN
    FOR tbl_rec IN tbl_cur
    LOOP
    INSERT INTO table1 (no, name)
    VALUES (tbl_rec.no + 1, 'test');
    END LOOP;
    FOR tbl_rec IN tbl_cur
    LOOP
    -- the rows you inserted in the loop
    -- above will be included here
    -- with the original rows
    END LOOP;
    END;
    null

  • Need help with inserting rows in ResultSet and JTable

    hello Guru!
    i have inserted a row in my result set and i want that my table shows this row promptly after i have inserted it in my result set...
    but when i use following code for my resultset:
    rs.moveToInsertRow();
    rs.updateInt(1,nr);
    rs.updateString(2, name);
    rs.insertRow();
    Record are inserted in resultset and database but not shown in my JTable??
    Anyone a Clue to without reexecuting the query how can i display inserted row in JTable
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.h
    I have refrered the following links but still clue less help Guruuuuuuu
    i m really in trobble??????

    i am just near by the Solution using the Database Metadata
    by couldn't get the ideaaaa
    ==================================================
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.htm
    Seeing Database Changes Made Internally and Externally
    This section discusses the ability of a result set to see the following:
    its own changes (DELETE, UPDATE, or INSERT operations within the result set), referred to as internal changes
    changes made from elsewhere (either from your own transaction outside the result set, or from other committed transactions), referred to as external changes
    Near the end of the section is a summary table.
    Note:
    External changes are referred to as "other's changes" in the Sun Microsystems JDBC 2.0 specification.
    Seeing Internal Changes
    The ability of an updatable result set to see its own changes depends on both the result set type and the kind of change (UPDATE, DELETE, or INSERT). This is discussed at various points throughout the "Updating Result Sets" section beginning on , and is summarized as follows:
    Internal DELETE operations are visible for scrollable result sets (scroll-sensitive or scroll-insensitive), but are not visible for forward-only result sets.
    After you delete a row in a scrollable result set, the preceding row becomes the new current row, and subsequent row numbers are updated accordingly.
    Internal UPDATE operations are always visible, regardless of the result set type (forward-only, scroll-sensitive, or scroll-insensitive).
    Internal INSERT operations are never visible, regardless of the result set type (neither forward-only, scroll-sensitive, nor scroll-insensitive).
    An internal change being "visible" essentially means that a subsequent getXXX() call will see the data changed by a preceding updateXXX() call on the same data item.
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean ownDeletesAreVisible(int) throws SQLException
    boolean ownUpdatesAreVisible(int) throws SQLException
    boolean ownInsertsAreVisible(int) throws SQLException
    Note:
    When you make an internal change that causes a trigger to execute, the trigger changes are effectively external changes. However, if the trigger affects data in the row you are updating, you will see those changes for any scrollable/updatable result set, because an implicit row refetch occurs after the update.
    Seeing External Changes
    Only a scroll-sensitive result set can see external changes to the underlying database, and it can only see the changes from external UPDATE operations. Changes from external DELETE or INSERT operations are never visible.
    Note:
    Any discussion of seeing changes from outside the enclosing transaction presumes the transaction itself has an isolation level setting that allows the changes to be visible.
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean othersDeletesAreVisible(int) throws SQLException
    boolean othersUpdatesAreVisible(int) throws SQLException
    boolean othersInsertsAreVisible(int) throws SQLException
    Note:
    Explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from this discussion of visibility. For example, even though external updates are "invisible" to a scroll-insensitive result set, you can explicitly refetch rows in a scroll-insensitive/updatable result set and retrieve external changes that have been made. "Visibility" refers only to the fact that the scroll-insensitive/updatable result set would not see such changes automatically and implicitly.
    Visibility versus Detection of External Changes
    Regarding changes made to the underlying database by external sources, there are two similar but distinct concepts with respect to visibility of the changes from your local result set:
    visibility of changes
    detection of changes
    A change being "visible" means that when you look at a row in the result set, you can see new data values from changes made by external sources to the corresponding row in the database.
    A change being "detected", however, means that the result set is aware that this is a new value since the result set was first populated.
    With Oracle8i release 8.1.6 and higher, even when an Oracle result set sees new data (as with an external UPDATE in a scroll-sensitive result set), it has no awareness that this data has changed since the result set was populated. Such changes are not "detected".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException
    It follows, then, that result set methods specified by JDBC 2.0 to detect changes--rowDeleted(), rowUpdated(), and rowInserted()--will always return false with the 8.1.6 Oracle JDBC drivers. There is no use in calling them.
    Summary of Visibility of Internal and External Changes
    Table 12-1 summarizes the discussion in the preceding sections regarding whether a result set object in the Oracle JDBC implementation can see changes made internally through the result set itself, and changes made externally to the underlying database from elsewhere in your transaction or from other committed transactions.
    Table 12-1 Visibility of Internal and External Changes for Oracle JDBC
    Result Set Type Can See Internal DELETE? Can See Internal UPDATE? Can See Internal INSERT? Can See External DELETE? Can See External UPDATE? Can See External INSERT?
    forward-only
    no
    yes
    no
    no
    no
    no
    scroll-sensitive
    yes
    yes
    no
    no
    yes
    no
    scroll-insensitive
    yes
    yes
    no
    no
    no
    no
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    Notes:
    Remember that explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from the concept of "visibility" of external changes. This is discussed in "Seeing External Changes".
    Remember that even when external changes are "visible", as with UPDATE operations underlying a scroll-sensitive result set, they are not "detected". The result set rowDeleted(), rowUpdated(), and rowInserted() methods always return false. This is further discussed in "Visibility versus Detection of External Changes".
    Oracle Implementation of Scroll-Sensitive Result Sets
    The Oracle implementation of scroll-sensitive result sets involves the concept of a window, with a window size that is based on the fetch size. The window size affects how often rows are updated in the result set.
    Once you establish a current row by moving to a specified row (as described in "Positioning in a Scrollable Result Set"), the window consists of the N rows in the result set starting with that row, where N is the fetch size being used by the result set (see "Fetch Size"). Note that there is no current row, and therefore no window, when a result set is first created. The default position is before the first row, which is not a valid current row.
    As you move from row to row, the window remains unchanged as long as the current row stays within that window. However, once you move to a new current row outside the window, you redefine the window to be the N rows starting with the new current row.
    Whenever the window is redefined, the N rows in the database corresponding to the rows in the new window are automatically refetched through an implicit call to the refreshRow() method (described in "Refetching Rows"), thereby updating the data throughout the new window.
    So external updates are not instantaneously visible in a scroll-sensitive result set; they are only visible after the automatic refetches just described.
    For a sample application that demonstrates the functionality of a scroll-sensitive result set, see "Scroll-Sensitive Result Set--ResultSet5.java".
    Note:
    Because this kind of refetching is not a highly efficient or optimized methodology, there are significant performance concerns. Consider carefully before using scroll-sensitive result sets as currently implemented. There is also a significant tradeoff between sensitivity and performance. The most sensitive result set is one with a fetch size of 1, which would result in the new current row being refetched every time you move between rows. However, this would have a significant impact on the performance of your application.
    how can i implement this using
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException

  • Erratic cursor and track pad when using 220v on MBA

    Hello
    I am travelling in Europe with my MBA, and I have noticed that when it is plugged into a 220v outlet the whole case has a slight electric charge (and a very slight vibration), this apparently makes the track pad very erratic, with the cursor jumping all over when I try to move it.  I have resorted to unplugging the MBA when I want to use.
    Any thoughts/solutions on this?
    Thank you,
    Peter

    3 prong grounded extension cord may help.
    Best.

  • DVD movie skips and breaks up when playing on tv

    Ok, I have made a DVD using iDVD 08 and it works perfect for all my movies and slideshows (in my dvd player) except one.
    There is one movie that breaks up or skips forward when I try and play it.
    The movie seems fine in imovie and plays on my Mac with no errors!
    I am at a loss what to do to fix this? Any suggestions?
    Thanks in advance.

    My guess is you can't fix this type of issue. It depends largely on the dvd player and secondly on your media and the burn speed you chose.
    You can try burning a disc image from the file menu in iDvd and then lowering the burn speed to 4x or lower. Use verbatim and Maxell for best results. A third option would be to try a quality DVD Lens Cleaner kit from either Maxell or 3M. (don't use less expensive brands since they can actually cause more issues than they solve).
    Btw .... Disc Images burned with Roxio Toast (as opposed to iDvd) to quality media such as those already mentioned above often play well on a wider variety of set tops under these circumstances ....
    Good luck on this.

  • SSRS 2008: how to show an empty chart with legend and x and y axis when no data available

    Hi,
    I am using SSRS 2008, I generated one chart in report designer with the data from Analysis Services (Cube).
    According to the dataset, there is no data returned when I run the query. so when I preview the chart, there is nothing but "no data available" showing on the chart.
    Here I want to know is there any possible to show an empty chart with legend and x and y axis?
    If it is possible, can you tell me how can I make it?
    Best Regards.
    Connie Zhu

    Hi,
    When there is no data, the chart displays the message "no data available". But using a little work around, you can display an empty chart.
    Please find the below steps given to achieve this
    1. Create a new dataset using TSQL to return 1 row of data having the category field and value field set to 0. Add the fields that are necessary for the category fields, series fields and datafields.
       A simple example would be like
       SELECT 'abc' as Category, 0 as Amount
    2. Add a new chart, set the category field to 'Category' and set the data field to Amount from above dataset created in step 1.
    3. In the new chart, right click the category axis and select axis properties, Click on the labels tab, check on
    'Hide axis labels' and then click ok
    4. Now set the Visibility property of both the charts depending on the rows returned from your main dataset
       a. click on your main chart and set its Hidden property to :
    =iif(CountRows("MainDataSet"),false,true) 
       b. click on the new blank chart added and set its Hidden proprety to (the opposite) :
    =iif(CountRows("MainDataSet"),true,false) 
       Note : Please change the dataset name in above expression "MainDataset" to the name of your chart's dataset
    5. Resize the new chart to the same size as your main chart, then position the new chart on the place as the main chart.
       (Note : You can set the position of new chart to be same by copying the location property from the main chart) 
    6. Now run and observe the result. When there are no rows returned by your main dataset, the new chart (the blank chart) should be displayed.
    I've added a working sample of this kind of a report
    here.
    Hope this helps. Please feel free to discuss if you have any questions.
    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
    BH

  • [nQSError: 17020] and  [nQSError: 17001] when Populating Data

    Hi All,
    I am getting the following error under when Populating Caching Tables for Marketing.
    *An Error is displayed as [nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist .*
    *[nQSError: 17020] A bulkInsert statement has successfully inserted 0 rows but failed in batch 1. Maximum batch size 43.*
    Current batch size 43. (HY000)
    Please Advise.
    Thanks
    Yuvaraj

    Hi Yuvaraj,
    Is this issue resolved?
    It is related to Marketing Cache tables, seems the table that your Segment trying to insert cache values is not available in DB or it is not cofigured.
    If it is already resolved, please share the steps that how you could resolve the issue?
    Thanks,
    Viswanath K M

  • Play sound in specified duration and desired file when reading data with VISA functions ?

    Hi.
    I read data with VISA read function and then I use functions like multiple for showing data on Chart. every thing is OK.
    now I want play a specified sound (like a 3s song in my desired folder) when signal amplitude cross over from specified value. then after desired time, it will be wait for new cross over from specified value and this procedure repeat again until I stop the program. 
    Data comes from MCU and it doesn't stop when system play sound and when system play sound, incoming data for this part (play sound) will be ignore them until specified expired.
    I use this VI for reading data and mentioned part which is sound part is empty and I don't know what I must done ?
    altougth I use another while loop for sound apart because I want save CPU time.
    Thanks.
    Solved!
    Go to Solution.

    I would recommend making the data type of the notifier a cluster that contains a path and a numeric (double).  The path tells the player which file to play.  The numeric is the duration.
    Now for a slightly complicated, but really neat, way to stop your second loop.  Do not use a second notifier.  Instead, send the normal notification but use Not A Path for the path in the cluster.  Your second loop can do a check for the Not A Path and stop when that is recieved.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Has anyone else experienced InDesign CC and 2014 crashing when using Data Merge?

    I have already tried the Shift+Ctrl+Alt+Cmd keystroke upon start-up and saying "yes" to clearing the preferences, but unlike previously where this solved the issue (a few months back, until Adobe released an update which meant this was no longer needed) this hasn't worked. I have also tried using both a CSV and a TXT file as the source file, same crash.
    Anyone found a solution? I am using Mac OSX.9. Same thing happens on a colleagues Mac, so isn't my machine.

    This is about all the information I could provide, hence why I was asking a general question. If I'd known what steps to take I wouldn't be asking. I have solved the problem, it seemed to be the InDesign file, not the data file.

  • Gets a created but not inserted row passivated?

    Hi,
    I'm facing a problem concerning that a VO looses its created but not inserted row after passivateState --> activateState.
    The result is that the VO has another row a current row after activateState.
    Any comments?
    Is there a solution? Implement passivateState() and activateState() for that VO Class?
    Configuation problem?
    Thanks,
    Markus

    Hi Steve,
    sorry, I tried, but I can' t reproduce the problem with a sample application. This means that a created (yes, build-in operation) but not inserted row gets passivated and activated!
    There is something fishy with my application because I can't set the state token validation to false. When it is set to false than the new row don't get passivated and activated. :-(
    Thanks,
    Markus

  • Programming insert row VO,but inner-table no data show?

    We have Master-Detail-Detail ViewObject,when programming insert row three ViewObject,why inner-table UI no data show?
    [Source Code ZIP files|http://docs.google.com/leaf?id=0B1l5uiKPTIr_ZTQwYTQ1MTMtZWFlMS00YWQ1LWFiZWQtYzNmODIwNDRlZWJk&hl=zh_TW]
    1.SmpTest0PG.xml click button.
    2.SmpTest0CO.java call MyTestAMImpl.java create Method insert row three ViewObject.
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("Test") != null)
    String key = "1";
    Serializable aserializable1[] = { key };
    String quote_id = (String)am.invokeMethod("create", aserializable1);
    if (!quote_id.equals(null))
    pageContext.setForwardURL("OA.jsp?page=/smp/oracle/apps/pos/test/webui/SmpTestPG&Key="+key,
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
    OAWebBeanConstants.IGNORE_MESSAGES);
    3.SmpTest0CO.java Forward SmpTestPG.xml.
    4.SmpTestPG.xml Show Data.
    MyTestAMImpl.java
    public String create(String key)
    int vendor_id = 0;
    String vendor_name = null;
    int contact_id = 0;
    int site_id = 0;
    String quote_id = null;
    OADBTransaction trx = (OADBTransaction)((OAApplicationModuleImpl)this).getDBTransaction();
    SmpPoHdVOImpl hdvo = getSmpPoHdVO();
    SmpPoDlVOImpl dlvo = getSmpPoDlVO();
    SmpPoDkVOImpl shvo = getSmpPoDkVO();
    if (!hdvo.isPreparedForExecution())
    hdvo.setWhereClause("1 = 0");
    hdvo.setMaxFetchSize(0);
    hdvo.executeQuery();
    if (!dlvo.isPreparedForExecution())
    dlvo.setWhereClause("1 = 0");
    dlvo.setMaxFetchSize(0);
    dlvo.executeQuery();
    if (!shvo.isPreparedForExecution())
    shvo.setWhereClause("1 = 0");
    shvo.setMaxFetchSize(0);
    shvo.executeQuery();
    String s = key;
    Serializable aserializable[] = { s };
    SmpViewPoHdVOImpl quhdvo = getSmpViewPoHdVO();
    if(quhdvo != null)
    quhdvo.invokeMethod("initQuery", aserializable);
    SmpViewPoDlVOImpl qudlvo = getSmpViewPoDlVO();
    // insert hd
    quhdvo.setRangeSize(-1);
    Row quhdrow[] = quhdvo.getAllRowsInRange();
    for(int i = 0; quhdrow != null && i < quhdrow.length; i++)
    Row hdrow = hdvo.createRow();
    hdrow.setAttribute("DocNum","200");
    hdvo.insertRow(hdrow);
    hdrow.setNewRowState(Row.STATUS_NEW);
    quote_id = hdrow.getAttribute("HEADER_ID").toString();
    // insert dl
    RowIterator dlIter = (RowIterator)quhdrow.getAttribute("SmpViewPoDlVO");
    dlIter.setRangeSize(-1);
    Row qudlrow[] = dlIter.getAllRowsInRange();
    int line_seq = 0;
    for(int j = 0; qudlrow != null && j < qudlrow.length; j++)
    Row dlrow = dlvo.createRow();
    line_seq ++;
    dlrow.setAttribute("LineNum",String.valueOf(line_seq));
    dlrow.setAttribute("ItemNo",qudlrow[j].getAttribute("ItemNo"));
    dlrow.setAttribute("Qty",qudlrow[j].getAttribute("Qty"));
    dlvo.insertRow(dlrow);
    dlrow.setNewRowState(Row.STATUS_NEW);
    // insert shipment
    RowIterator shipIter = (RowIterator)qudlrow[j].getAttribute("SmpViewPoDkVO");
    shipIter.setRangeSize(-1);
    Row shipRow[] = shipIter.getAllRowsInRange();
    int ship_seq = 0;
    for(int k = 0; shipRow != null && k < shipRow.length; k++)
    ship_seq ++;
    Row shrow = shvo.createRow();
    shrow.setAttribute("ShipmentNum",String.valueOf(ship_seq));
    shrow.setAttribute("Qty",shipRow[k].getAttribute("Qty"));
    shvo.insertRow(shrow);
    shrow.setNewRowState(Row.STATUS_NEW);
    return quote_id;
    Edited by: Tony_Huang on Apr 10, 2010 3:59 PM

    public class SmpTestCO extends OAControllerImpl
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OATableBean oatablebean = (OATableBean)webBean.findChildRecursive("SmpPoDlVORN");
    OATableBean oatablebean1 = (OATableBean)webBean.findChildRecursive("SmpPoDkVORN");
    if (oatablebean != null)
    oatablebean.setAttributeValue(UIConstants.ALL_DETAILS_ENABLED_ATTR, ((Object) (Boolean.TRUE)));
    oatablebean.setAttributeValue(OAWebBeanConstants.VIEW_LINK_NAME, "SmpPoDlDkVL1");
    if (oatablebean1 != null)
    oatablebean1.setAttributeValue(OAWebBeanConstants.VIEW_LINK_NAME, "SmpPoDlDkVL1");
    oatablebean1.setInsertable(true);
    oatablebean1.setAutoInsertion(true);
    }

  • Error FAGL_SKF008 when loading data from 0FI_GL_8 infosource

    Hi,
    I am loading data into an infocube, from 0FI_GL_8 infosource.
    We have connected ECC-P with BI-D and BI-P.
    When loading data into BI-D works Ok, but when loading data into BI-P, the next error message appears:
    "No authorization for displaying statistical key figures in General Ledger"
    "FAGL_SKF  8"
    I cheked ST22 and SM21 in ECC-P and there is no error message.
    I cheked rfcuser in ECC-P and it has SAP_ALL.
    any ideas???

    Do a comparison of the Authorization Objects assigned to the account for your BI-D extractions and that for BI-P. Since the source system is the same and the authorizations are there for BI-D, it sounds as if there's gaps in the Authorization Object assignements for one or more of the Profiles assigned to the system account for BI-P.
    The other thing would be to create a test account that looks like the system account for BI-P, logon with that account, do an RSA3 extraction test and if it fails get a screenshot from tcode SU53 to see what Authorization Objects are missing to be authorized to hit that data.
    Edited by: Dennis Scoville on Jul 17, 2009 12:43 PM

  • How can I use a date/time from a cursor and insert it into a table later?

    I have a cursor which retrieves data from a table which includes a date column, which has date and time.
    I want to insert this value into a table which has another date column but when I do, it is dropping off the time data and putting in 00:00:00.
    I am using execute immediate and trapped the SQL I am executing:
    insert into ifsapp.GSCDB_TRANS_DTL_TAB values (
    'GSCDB_COMPANY',to_date('01-DEC-06',3,0 )
    and so you can see the date has no time.
    The plsql is:
    v_sql := 'insert into ifsapp.GSCDB_TRANS_DTL_TAB values ( '''||r_gscdbio.name||''','''||r_gscdbio.last_exec_time||''','||v_count||',0 )';
    Any help appreciated, I feel I need to use to_date and/or to_char but my head is spinning!
    Thank you

    Why are you using EXECUTE IMMEDIATE for this? And why are you not using bind variables? It'll be much easier (and more efficeint, easier to debug, etc) to just have static SQL
    INSERT INTO table_name
      VALUES( r_gscdbio.name, r_gscdbio.last_exec_time, v_count, 0 );Additionally, you'll want to explicitly specify the column list for your INSERT statement. Otherwise, if you add another column to the table, your code will break.
    Justin

  • Insert multiple rows using Cursors.

    I am trying to insert rows into a table based on information from another table.
    For example:
    When Table 1: Num_Rows = 100 my proc will insert 100 rows into Table 2 with relevent data.
    Do I need to use a Cursor and iterate through Num_Rows doing an INSERT each time? Is there a better way to do it other than using Cursors?
    Rob.

    It is not about using cursors or not using cursors. All SQLs wind up as cursors in the Oracle Shared Pool. So there is no such concept as not using cursors. Oracle needs to parse and compile and execute SQLs as cursors.
    The issue is WHERE* you do the work?
    Do you use the cursor (SQL) to do it for you? Or do you pull the data into another language, like PL or Java and process it there?
    And the performance mantra in this case is a very fundemantal Maximize SQL and minimize PL/Java/etc+.
    So do not do in PL/SQL what you can do in SQL only. It is a lot slower to pull data from the SQL engine into the PL engine. And then push that very same data from the PL engine back to the SQL engine. Like the following for example:
    -- poor design, poor performance
    for employee in (select e.* from emp e where e.deptid = 123 )
    loop
      insert into tab2 values( employee.empid, employee.name );
    end loop;You do not need to use PL (or Java) in this case. The SQL language is more than able to do this better and faster than any other language... as it is closer to the data.
    So the following is far more optimal code. Instead of the above PL/SQL code, we can simply do it as:
    -- optimal design: maximizing SQL and letting it to as much of the work as possible
    insert into tab2 select e.empid, e.name from emp e where e.deptid = 123;

Maybe you are looking for

  • Ink system failed photosmart c5180 error oxc18a0206

    have done the following: installed 5 new ink cartridges performed printer diagnostics reseated cables direct connected to wall outlet reinstalled software downloaded from hp checked port setup (2 settings: virtual printer port & a DOT port) unplugged

  • Overly Excited New User Needs Advice on Windows for Mac

    As of Christmas day, I am a proud owner of a new MBP 17" beautiful piece of machinery! I'm coming from a PC so you can imagine my excitement when I opened this gift from my parents. Also, I'm 33 years old so getting a gift this amazing from your pare

  • Material type - maintainance by qty and value

    Dear All Guru, Yesterday I had copied the plant from the plant belong to same company and maintained the same val Gr Code. But i found that I am not able to make GR posting and the error was Plant and material type is not matching and then over SDN i

  • New Photoshop Fonts not showing

    mark leroy kilwinning Hi im looking for little help and or advice, i recently upgraded to Adobe Photoshop CS5 but I appear to have lost all my downloaded fonts from the CS4 version of the software, when I had CS4 and wanted to add new fonts I just in

  • BTDF - Web services deployment (Orch publishing as WCF service)

    I wanted to include my WCF published Orch deployed  in btdf.proj way. (BTDF 6.0) I followed the instructions by adding :  and set Virtual Directory to True When I deploy it, receiving error as : error : The VDirList ItemGroup is no longer supported.