Inserting million of Ids in a single row and make use of them in a Query

Hi ,
we are using Oracle10g. I need to have a table structure like this,
User_Holdings     
User_ID (Number)
Pattern_Number (Number)
Holding_List (CLOB ??)
Eg. Row:
User_ID Patt_No Holding_List
01**********101*********** 98675600,87009922,23965565,10076800,…
02**********96************ 10000011,34564423,22789674,23232232,...
This table contains unique user_ids as rows.
Here each user would have list of Holding_Ids(8-digits) those are seperated by comma.
My problem is, in real time each User will be having around 0.5 to 1.0 million Holding Ids. At that point of time, will this column(Holding_List) able to hold all Holding ids? If yes, which datatype will rightly support that column?
FYI, in the application I need to display the Holding details pertaining to that User_Id. The proposed sample query will be like this,
     >      select col1, col2, col3,...
          from     Holding
          where      Holding_Id IN (select Holding_List
                    from      User_Holding
                    where      user_id = 01);                    
Awaiting your earlier reply.
Thanks.

SQL> select * from User_Holdings;
    USERID PATTERN_NUMBER HOLDING_LIST
         1            101 98675600 87009922 23965565 10076800
         2             96 10000011 34564423 22789674 23232232
SQL> create index User_Holdings_tix on User_Holdings (holding_list) indextype is ctxsys.context;         
Index created.
SQL> select * from User_Holdings where contains(holding_list,'98675600',1) > 0;
    USERID PATTERN_NUMBER HOLDING_LIST
         1            101 98675600 87009922 23965565 10076800Message was edited by:
Laurent Schneider
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2040 | 4 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| USER_HOLDINGS | 1 | 2040 | 4 (0)| 00:00:01 |
|* 2 | DOMAIN INDEX | USER_HOLDINGS_TIX | | | 4 (0)| 00:00:01 |
well, it uses an index...
HTH

Similar Messages

  • I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me?

    I see people from different ages at my work and every month I need to count how many people from each age I've seen that month. How can I do to give the entries to numbers in a single cell and make numbers count them for me? The final result would be a spreadsheet telling there were 8 people from 20 to 39 years old, 14 peolple from 40 to 59 and so on...

    jpqcampos wrote:
    This appears to be an 'input form' using 'Radio Buttons' to select the category. Neither of these features are supported in Numbers '09.
    You can input the data on one table and summarize it on a second table, but the input table will continue to hold data for each event.
    And by using the Reorganize button, you can hide all but two rows of that table to approximate the appearance and performance of an input form.
    Here are the two tables, Data on the left and Summary on the right. Notes below.
    The grey-filled columns in both tables are 'working' columns, and may be hidden (as shown in the image below).
    Data table:
    D1 contains the word "TRUE" (in capital letters). (This row is always shown.)
    D2 is empty, or may contain any value except "TRUE" (This row is always hidden under the Reorganize rule.)The rest of Row 2 of this table requires the data shown: a number outside the range to be counted (999), and two checkboxes, both checked.
    D3 (and filled down the rest of column D):   =AND(OR(B2,C2),NOT(OR(B3,C3)))
    The formula returns TRUE only for the first unused row in the table (ie. the first row for which neither checkbox has been checked)
    Summary table:
    Column A contains labels for the age ranges to be counted.
    Column B contains the same information in the form necessary for the formulas in columns C and D. They need a numeric value, and that value must be the largest acceptable value in the range to be counted.
    C2 (and filled right to column D, then both filled down to row 5):
        =COUNTIFS(Data :: $A,"<="&$B,Data :: B,TRUE)-SUM(C$1:C1)
    Two changes from the previous example:
    COUNTIFS is used to separate the Native and Foreign counts as well as the age range to be counted.
    The amount subtracted from each result is the SUM of the earlier results, and includes the text value in the first cell of the column (which is interpreted by SUM as a zero).
    See note below regarding my earlier formula.
    When the greyed columns are hidden and the checkbox in the Reorganize pane is checked, the two tables will appear as shown below:
    Close the reorganize pane, and the 'data entry form' is ready to use.
    To use, enter the age first, then check one of the boxes.
    As soon as one box is checked, the row will be hidden, and the next (unused) row will be shown.
    Regards,
    Barry
    Note regarding formula in my earlier post:
    The earlier formula will give erroneous results as it subtracts only the count directly above it from its count of persons in the age range 0-n.
    In E2 of that table, replace "-E1" with "-SUM(E1:E$1)
    Fill down to E8.
    Ignore the instructions (in that post) following "Fill down to E8."
    B

  • Want to be able to open tabs in multiple rows, rather than in a single row. I used tab mix plus before, but it says it is not compatible with New tab Homepage. The older version of Firefox allowed this very easily.

    Want to be able to open tabs in multiple rows, rather than in a single row. I used tab mix plus before, but it says it is not compatible with New tab Homepage. The older version of Firefox allowed this very easily.

    Your plugins list shows outdated plugin(s) with known security and stability risks.
    *Java Plug-in 1.5.0_06 for Netscape Navigator (DLL Helper)
    Update the [[Java]] plugin to the latest version.
    *http://java.sun.com/javase/downloads/index.jsp (Java Platform: Download JRE)

  • PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list

    Hi,
    I have a requirement to send a table data through mail,
    so am using execute statement after opening the connection and am using the following PLSQL code, which am failing to execute successfully.
    My code goes like this.
        0            10            20           30           40            50
    1  CREATE OR REPLACE PROCEDURE SEND_TABLE_DATA( FROMAD IN VARCHAR2,
    2   TOAD IN VARCHAR2,
    3   SUBJECT IN VARCHAR2,
    4   MESSAGE IN VARCHAR2,
    5   DOCID IN VARCHAR2,
    6   DOCDT IN DATE,
    7   PRODOAID IN NUMBER )
    8   AS
    9   BATCHNO  VARCHAR2(32767);
    10  PCSBOX  NUMBER;
    11  AMOUNT  NUMBER;
    12  SMTPHOST VARCHAR2(255) := 'XXX.XXX.X.XXX' ;
    13  A UTL_SMTP.CONNECTION ;
    14  BEGIN
    15  A :=UTL_SMTP.OPEN_CONNECTION(SMTPHOST,25);
    16  UTL_SMTP.HELO(A,SMTPHOST);
    17  UTL_SMTP.MAIL(A,FROMAD);
    18  UTL_SMTP.RCPT(A,TOAD);
    19  UTL_SMTP.OPEN_DATA(A);
    20  UTL_SMTP.WRITE_DATA(A, CHR(13) ||CHR(13) || CHR(13) );
    21  UTL_SMTP.WRITE_DATA (A,'Date: '|| TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI:SS') || CHR(13) );
    22  UTL_SMTP.WRITE_DATA(A,'From: '||FROMAD|| CHR(13) );
    23  UTL_SMTP.WRITE_DATA(A, 'To: '||TOAD|| CHR(13) );
    24  UTL_SMTP.WRITE_DATA(A, 'Subject: '|| SUBJECT || CHR(13) );
    25  UTL_SMTP.WRITE_DATA(A,MESSAGE||DOCID||' Documented on '||DOCDT||CHR(13) );
    26  UTL_SMTP.WRITE_DATA(A,CHR(13) || CHR(13) || CHR(13) );
    27  UTL_SMTP.WRITE_DATA(A,'This is for your information'||CHR(13) );
    28  UTL_SMTP.WRITE_DATA (A,' BATCHNO '|| ' -- '||' PCSBOX '||' -- '||' AMOUNT '||CHR(13) );
    29  EXECUTE IMMEDIATE
    30         'SELECT
    31       A.BATCHNO,B.PCSBOX,B.AMOUNT
    32        FROM
    33      SCHEMA1.TABLEX A,SCHEMA2.TABLEY B
    34        WHERE
    35       A.BATCHID=B.BATCHNO AND B.PRODOAID='|| PRODOAID
    36     BULK COLLECT INTO BATCHNO,PCSBOX,AMOUNT;
    37  FOR indx IN 1..BATCHNO.COUNT
    38   LOOP
    39    UTL_SMTP.WRITE_DATA (A,BATCHNO(indx)|| ' -- '||PCSBOX(indx)||' -- '||AMOUNT(indx)||CHR(13) );
    40   END LOOP;
    41  UTL_SMTP.WRITE_DATA( A,CHR(13) || CHR(13) || CHR(13) );
    42  UTL_SMTP.CLOSE_DATA(A);
    43  UTL_SMTP.QUIT(A);
    44  EXCEPTION
    45  WHEN OTHERS THEN
    46  UTL_SMTP.QUIT(A);
    47  RAISE;
    48  END;
    49  /
    SELECT * FROM USER_ERRORS
    NAME                       TYPE             SEQUENCE    LINE         POSITION        TEXT                                                                                                             ATTRIBUTE                 MESSAGE_NUMBER
    SEND_TABLE_DATA
    PROCEDURE
    3
    37
    1
    PL/SQL: Statement ignored
    ERROR
    0
    SEND_TABLE_DATA
    PROCEDURE
    2
    37
    24
    PLS-00487: Invalid reference to variable 'BATCHNO'
    ERROR
    487
    SEND_TABLE_DATA
    PROCEDURE
    1
    36
    25
    PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list
    ERROR
    497
    Thanks In Advance
    Regards
    Pradeep.

    > 29  EXECUTE IMMEDIATE
    > 30         'SELECT
    > 31       A.BATCHNO,B.PCSBOX,B.AMOUNT
    > 32        FROM
    > 33      SCHEMA1.TABLEX A,SCHEMA2.TABLEY B
    > 34        WHERE
    > 35       A.BATCHID=B.BATCHNO AND B.PRODOAID='|| PRODOAID
    > 36     BULK COLLECT INTO BATCHNO,PCSBOX,AMOUNT;
    The variables BATCHNO, PCSBOX and AMOUNT are defined as scalar variables. Check there definition
    > 9   BATCHNO  VARCHAR2(32767);
    > 10  PCSBOX  NUMBER;
    > 11  AMOUNT  NUMBER;
    You cannot use BULK COLLECT on scalar variables. The variables must be defined as a COLLECTION TYPE in order to perform bulk collect.

  • Single Row and colum resultset

    Hi,
    I have a scenarios like this,
    VIEW_A;
    col1 number,
    col2 number,
    col3 clob.
    I need to create an sql which will get me the list of col3 values based on the filter values on col1 and col2.
    The atual need is i need the col3 resultser to be concatenated into a single row and column value like
    RESULT SET:
    value1
    Val2
    Val3
    what i need is
    Val1 ||' - '||Val2||' - '||Val3
    into a single clob so that i get the result set instead of iterating and concating the same manuall using plsql.
    Help on this
    Thanks in Advance,
    Ramesh.R

    It looks like you are after what's called "String Aggregation."
    Check out this link as it highlights many techniques:
    String Aggregation Techniques
    An Re: Concat rows values into single column of Michael's
    A Re: Multiple rows into a single line in 'Single Column Table' followed by Billy's reason on doing a stragg in the first place.
    In addition 11gR2 has the LISTAGG function.

  • Multiple rows Converge to Single row and join

    Hi Folks,
    I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
    Table 1: DTL_TABLE (id, period, course, names, title, type)
    1 2010 mat john null null
    1 2010 mat jim null null
    1 2010 cam null officer null
    1 2010 cam null Prof null
    1 2010 phy null null Inclass
    1 2010 phy null null Online
    Join with
    Table 2: ID_TABLE(id, period, Loc, Dept, Code)
    1 2010 nj 101 CC.
    Output format (id, period, course, names, title, type, Loc, Dept, Code)
    result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
    I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
    Thank you,
    Aj
    CREATE TABLE DTL_TABLE
       ids      VARCHAR2 (10),
       period   VARCHAR2 (10),
       course   VARCHAR2 (10),
       names    VARCHAR2 (10),
       title    VARCHAR2 (10),
       TYPE     VARCHAR2 (10)
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'jim',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'john',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'kale',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'cam',
                 NULL,
                 'officer',
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'cam',
                 NULL,
                 'prof',
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'phy',
                 NULL,
                 NULL,
                 'inclass');
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'phy',
                 NULL,
                 NULL,
                 'online');
    COMMIT;
    CREATE TABLE id_table
       ids      VARCHAR2 (10),
       period   VARCHAR2 (10),
       loc      VARCHAR2 (10),
       dept     VARCHAR2 (10),
       code     VARCHAR2 (10)
    INSERT INTO id_table
         VALUES ('1',
                 '2010',
                 'nj',
                 '101',
                 'cc');
    COMMIT;

    Aj09 wrote:
    Hi Folks,
    I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
    Table 1: DTL_TABLE (id, period, course, names, title, type)
    1 2010 mat john null null
    1 2010 mat jim null null
    1 2010 cam null officer null
    1 2010 cam null Prof null
    1 2010 phy null null Inclass
    1 2010 phy null null Online
    Join with
    Table 2: ID_TABLE(id, period, Loc, Dept, Code)
    1 2010 nj 101 CC.
    Output format (id, period, course, names, title, type, Loc, Dept, Code)
    result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
    I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
    SELECT TBL.id,
           DTLperiod,
           course,
           names,
           title,
           TYPE,
           Loc,
           Dept,
           Code
    FROM   ID_TABLE TBL,
           DTL_TABLE DTL
    WHERE  TBL.ID = DTL.ID
           AND TBL.PERIOD = DTL.PERIOD; it not good to use RESERVED WORDS like "ID" or "TYPE" as column names

  • SQL Update a Single Row Multiple Times Using 2 Data Sets

    I'm working in tsql and have an issue where I need to do multiple updates to a single row based on multiple conditions. 
    By Rank_
    If the column is NULL I need it to update no matter what the Rank is.
    If the Ranks are the same I need it to update in order of T2_ID.
    And I need it to use the last updated output.
    I've tried using the update statement below but it only does the first update and the rest are ignored. Here is an example of the data sets i'm working w/ and the Desired results. Thanks in advance!
    update a
    set Middle = case when a.Rank_> b.Rank_ OR a.Middle IS NULL then ISNULL(b.Middle,a.Middle) end,
    LName = case when a.Rank_> b.Rank_ OR a.Lname IS NULL then ISNULL(b.LName,a.LName) end,
    Rank_ = case when a.Rank_> b.Rank_ then b.Rank_ end
    from #temp1 a
    inner join #temp2 b on a.fname = b.fname
    where b.T2_ID in (select top 100% T2_ID from #temp2 order by T2_ID asc)

    The Merge clause actually errors because it attempt to update the same record.  I think this CTE statement is the closest I've come but I'm still working through it as I'm not too familiar w/ them.  It returns multiple rows which I will have to
    insert into a temp table to update since the resulting row I need is the last in the table.
    ;WITH cteRowNumber
    AS(
    Select DISTINCT
    Row_Number() OVER(PARTITION BY a.LName ORDER BY a.LName ASC, a.Rank_ DESC,b.T2ID ASC) AS RowNumber
    ,a.FName
    ,a.LName
    ,b.LName as xLname
    ,a.MName
    ,b.MName AS xMName
    ,a.Rank_
    ,b.Rank_ AS xRank
    ,b.T2ID
    FROM #temp1 a
    inner join #temp2 b
    ON a.fname = b.fname
    ), cteCursor
    AS(
    Select a.RowNumber,
    a.Fname
    ,a.LName
    ,a.xLname
    ,a.MName
    ,a.xMName
    ,a.xRank
    ,a.T2ID
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xRank,a.Rank_) else ISNULL(a.Rank_,a.xRank) end AS Alt_Rank_
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xMName,a.MName) else ISNULL(a.MName,a.xMName) end AS Alt_MName
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xLName,a.lname) else ISNULL(a.LName,a.xlname) end as Alt_Lname
    FROM cteRowNumber a
    where a.RowNumber = 1
    UNION ALL
    Select crt.RowNumber
    ,crt.FName
    ,crt.LName
    ,crt.xLname
    ,crt.MName
    ,crt.xMName
    ,crt.xRank
    ,crt.T2ID
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xRank,Prev.Alt_Rank_) else ISNULL(Prev.Alt_Rank_,crt.xRank) end AS Alt_Rank
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xMName,Prev.Alt_MName) else ISNULL(Prev.Alt_MName,crt.xMName) end AS Alt_MName
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xLName,Prev.Alt_Lname) else ISNULL(Prev.Alt_Lname,crt.xLName) end as Alt_Lname
    FROM cteCursor prev
    inner join cteRowNumber crt
    on prev.fname = crt.fname and prev.RowNumber + 1 = crt.RowNumber
    SELECT cte.*
    FROM cteCursor cte

  • How to store array of data into a single row of  table ,using any of Stmts

    HI Friends,
    Based on my requirements ,i have retrived a set of data from a XXX.jsp page using a request.getParameter() and stored into single dimenssional array . Now i am paassing that array to JAVA class to store a into some table .
    In JSP page users can add text boxes dynamically based on his intrest then those attributes will store in table .it means table attributes are not conatant , it table attributes may change at any time when user adds any textboxs or any fields on JSP page ....thats my module ..
    Now i wanted to store all array of data into Table in a single row .......thats is my requirements .
    How can we use prepareStatement and Statement to store array of results intoo table row ...on each iteration i wanted to store array of results into table atributes ..It means entire array of results should to into table row at time .....coule any one write sytax ,how we do this...
    could any one suggest me stps that i can impliment ......?....please reply ASAP

    Well ..you code can be works for constant number of attributes in table .oopss here my requirement is table attributes not fixed ,we cant put constant number of place holder(? ) in a statement ,because those are not fixed ,
    Let me explain here :
    i am doing in that way only. As i mentioned you Table attributes are not constant .It may very if users add any fields dynamically on JSP page .If users have option to add any text box on Jsp page ,then that attribute will store in table as a attribute .
    Now i amable fetching the all dyamic form data and stored in a Result Array below ...in this iteration all form result data are from jsp page as suggestion form ,it should stored in table in single row on corrsponding attribtes ......next time when users fills FROM ,then those data i am fetching and storing in a Result Array as below and need to store in corrsponding table attributes in a single row ....
    for(int i=0;i<result.length;i++)
                   System.out.println(result);
                   pst3=connection.prepareStatement("insert into *emprecord* values(?)");
                   if(!result[i].equals(""))
                        System.out.println(result[i]);
                             pst3.setString(1,result[i]);
                             pst3.executeUpdate();
    Thnks in advance ....let me know the the way we can store dynamic form data into dyanamic table ...

  • BI-IP - Bex Analyser - select excel single row and aplly planning function

    Hi experts,
    In BI-IP (BW 7) with Bex Analyser, is it possible to select a single excel row (or a range of rows) and then apply a planning function? I know that in WAD it's possible with the binding option to select a single web item.
    The purpose is to apply a revaluation factor to selected (by the user) cost elements rows in the workbook.
    Thanks and regards,
    MA

    Hi
    It is possibel in WAD to select one or many rows while executing Functions such as--Reposting; Revaluation etc.
    However, you should be in a position to select the rows based on....unique identifier such as Require ID; Request #; Serial #; ....this is more so in case of multiple entries for the same cost element for different combinations.
    Regards
    Srinivas

  • UNLOCKING single row in ALV using Funtions

    hai,
    Actually i am displaying a table in ALV USING FUNCTIONS and i am locking key values.
    Now my reqment is , if i press (NEW, COPY )button then i have to add one new row and that row should be Unlocked to insert values.
    Is it possible USING FUNCTIONS(I have a solution using CLASSES)

    Hi ramesh,
    it is possible with the LVC FM.i gave the sample yesterday did you check that..
    if not check it to day..
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV..
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    "{ FOR DISABLE
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    "} FOR DISABLE
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    "{FOR DISABLE HERE 6ROW IS DISABLED
    SY-TABIX = 6.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 10.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    LS_EDIT-FIELDNAME = 'POSNR'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 6.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                      HANDLE_STYLE .
    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    "} UP TO HERE
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      EXCEPTIONS
        PROGRAM_ERROR      = 1
        OTHERS             = 2.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    vijay

  • Table name input. and output i need  all rows and columns  using procedures

    hi,
    question: table name input. and output i need all rows and columns by using procedures.
    thanks,
    To All

    An example of using DBMS_SQL package to execute dynamic SQL (in this case to generate CSV data in a file)...
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.

  • Dynamically creating table and inserting rows and columns using JSP

    Hi,
    I'm using mysql and JSP to create web interface for my forms/tables. I wanna create the table dynamically depending on the data in the table and for each particualar record. and these values shud be loaded on the form after loading from the databaes as soon as the form loads.
    also i want to have a button which shud add new rows dynamically. and same one for columns.
    how do i calculate the values across the rows on the forms
    I'm new to JSP. Please point me in the right direction...any tutorials or code will be helpful.
    Any help is appreciated.
    Thanks
    Ayesha

    u write the code in sequence:
    1 write jdbs to select count(* )from table
    2 put in array e.g. String doc_no=new String[count];
    3 write jdbs to select * from table with condition
    //for no. of records just write
    for(int j=0;j<(count);j++){
    <% while(rs4.next()){
         doc_no=rs4.getString(2);
                        date1[i]=rs4.getString(3);
         doc_type[i]=rs4.getString(4);
         location[i]=rs4.getString(5);
         cheque[i]=rs4.getString(6);
         rate[i]=rs4.getInt(7);
         deb_qty[i]=rs4.getInt(8);
         cre_qty[i]=rs4.getInt(9);
         deb_amt[i]=rs4.getInt(10);
         cre_amt[i]=rs4.getInt(11);
         i++;
         //rs4.close();
                   for(int j=0;j<(count);j++){
                   System.out.println("Data count= "+j);
                   %>
    <tr>
    <td width="15%"><font size="1"><%=doc_no[j] %></font></td>
    <td width="10%"><font size="1"><%=date1[j] %></font></td>
    <td width="12%"><font size="1"><%=doc_type[j] %></font></td>
    <td width="9%"><font size="1"><%=location[j] %></font></td>
    <td width="9%">
    <div align="left"><font size="1"><%=cheque[j] %></font></div>
    </td>
    <td width="8%">
    <div align="right"><font size="1"><%=deb_qty[j] %></font></div>
    </td>
    <td width="8%">
    <div align="right"><font size="1"><%=cre_qty[j] %></font></div>
    </td>
    <td width="9%">
    <div align="right"><font size="1"><%=deb_amt[j] %></font></div>
    </td>
    <td width="10%">
    <div align="right"><font size="1"><%=cre_amt[j] %></font></div>
    </td>
    </tr>
    write if there is any specific problem
    bye,
    Samir

  • How to get last row and sum of all columns in one query

    Hi ,
    is there a way to get last record for a column and sum of all record for another column in the same query.
    Best Regards ,

    You should define your requirements properly for volunteers to help here..
    Your data is not good enough to provide you accurate solution. Reason being you dont have a proper column which differentiates between first and last entry.
    The solution becomes easy based on your desgin.
    I have introduced a grouping column called "id" and a time column called "time_of_insert" (only this way you can confidently say that you can differentiate between first and last (also a fool proof solution) --- you may optionally use sequence(instead of date though if you say you may end up inserting two rows at the same time, then probably sequence would be a better choice to differentiate rather than a timestamp field) etc...)
    With your sample data something like this can be done to achieve your desired result.
    WITH dataset AS
            (SELECT 1 id,10 used, 8 remain,systimestamp+1/24 time_of_insert FROM DUAL
             UNION ALL
             SELECT 1 id, 1, 7,systimestamp+2/24 FROM DUAL
             UNION ALL
             SELECT 1 id,2, 5,systimestamp+3/24 FROM DUAL
             UNION ALL
             SELECT 1 id,1, 0,systimestamp+4/24 FROM DUAL
             UNION ALL
             SELECT 1 id,0, 0,systimestamp+5/24 FROM DUAL
             UNION ALL
             SELECT 1 id,1, 4,systimestamp+6/24 FROM DUAL)
    SELECT *
      FROM (SELECT SUM (used) OVER () sum_all,
                   FIRST_VALUE (remain)
                      OVER (PARTITION BY id ORDER BY time_of_insert DESC)
                      last_row
              FROM dataset)
    WHERE ROWNUM = 1;
    Output:
    SUM_ALL       LAST_ROW
    15                  4
    Cheers,
    Manik.

  • Calling rows and columns using a script

    I have a file as such
    1 2 PX
    0.446E+00 0.867E+00-0.123E+00-0.372E+00 0.285E+00-0.640E+00-0.163E+01-0.658E+00
    -0.173E+00-0.845E+00-0.446E+00-0.366E+00-0.194E+01-0.194E+01-0.214E-01-0.400E-01
    -0.151E+01-0.167E+01-0.173E+01-0.232E+01-0.173E+01-0.121E+01-0.234E+01-0.277E+01
    -0.126E+01 0.940E+00 0.404E+01 0.659E+01 0.513E+01 0.198E+01 0.237E+01 0.518E+01
    2 2 PX
    0.315E+00 0.909E+00 0.104E+00-0.475E+00 0.141E+00-0.449E+00-0.156E+01-0.751E+00
    0.553E-01-0.626E+00-0.640E+00-0.494E+00-0.189E+01-0.213E+01-0.125E+00 0.285E+00
    -0.132E+01-0.180E+01-0.172E+01-0.232E+01-0.187E+01-0.103E+01-0.193E+01-0.268E+01
    -0.130E+01 0.974E+00 0.370E+01 0.610E+01 0.516E+01 0.218E+01 0.232E+01 0.522E+01
    3 2 PX
    0.217E+00 0.116E+01 0.552E+00-0.490E+00-0.892E-01-0.303E+00-0.125E+01-0.512E+00
    0.315E+00-0.672E+00-0.104E+01-0.559E+00-0.162E+01-0.222E+01-0.476E+00 0.166E+00
    -0.131E+01-0.167E+01-0.142E+01-0.234E+01-0.225E+01-0.901E+00-0.123E+01-0.218E+01
    -0.107E+01 0.994E+00 0.320E+01 0.551E+01 0.516E+01 0.225E+01 0.193E+01 0.502E+01
    4 2 PX
    0.110E+01 0.169E+01 0.538E+00-0.103E+01-0.487E+00 0.154E+00 0.134E+00 0.176E+01
    0.325E+01 0.179E+01-0.308E+00-0.155E+01-0.361E+01-0.457E+01-0.233E+01-0.505E+00
    -0.111E+01-0.130E+01-0.128E+01-0.288E+01-0.374E+01-0.274E+01-0.232E+01-0.160E+01
    0.147E+01 0.459E+01 0.612E+01 0.683E+01 0.511E+01 0.116E+01 0.203E+00 0.348E+01
    Where each section (1,2,3,4...) represents a different spring element.  The data is the force in the spring at time t reading from left to right and then on to the next row (i.e.  row1 col1 is time t(1), row1 col2 is time t(2), etc going across)
    I would like to sum the forces in each spring at time t (ie call the force at time t(1) for all elements and add them together.  So that in the end I have the sum of the forces in all elements at each time t.  I would then like to find the time t with the greatest sum and return to a file the force at that time for each element.
    Any help would be appreciated:)

    And now let's see what every part does (before I forget) and you want this right?
    Command 1:
    's/.*\([0-9][0-9]*\).*[0-9][0-9]* PX.* <-- matches the PX lines. "....1-inf numbers (Remember)...1-inf numbers space PX ....."
    /\nSPRING: \1/' < change to SPRING: the number above and an extra newline to make paragraphs which is useful for awk below.
    's/\([^E:]\)\([ -]\)/ <-- match a space or minus and the character before it (see NB 4 above)
    \1\n\2/g' <-- and put a new line between them. This way all the numbers are on a separate line
    'BEGIN { RS="";FS="\n"} <-- RS="" will match paragraphs.
    {for (i=2; i<NF+1; i++) { record[(i-1)]=record[(i-1)]+$i}} <-- Field 1 is SPRING: 9, otherwise record everything by adding up. awk can handle scientific notation.
    There is a i-1 with record because time starts at 1 and i at 2. This could all make more sense without the spring line.
    END {for (times in record) {print record[times] "\tt=" times}}'  <-- print the totals and the time that belongs with it.
    Command 2:
    grep 999t= <-- the output of the spring data will be of the form -999 just because it will be at the bottom of sort -rn.
    $(sed -e 's/.*\([0-9][0-9]*\).*[0-9][0-9]* PX.*/\nSPRING: \1/' -e 's/\([^E:]\)\([ -]\)/\1\n\2/g' file | awk 'BEGIN { RS="";FS="\n"} {for (i=2; i<NF+1; i++) { record[(i-1)]=record[(i-1)]+$i}  <-- identical as above.
    for (i=2; i<NF+1; i++) {data[(i-1)]=data[(i-1)] $i}} <-- this will append the actual string data as opposed to adding it up and losing the original data.
    END {for (times in record) {print record[times] "\tt=" times} <-- identical
    for (times in data) {print "-999t=" times " " data[times]}}'  <-- -999t= prepended because see above
    | tee tempfile.txt  <-- tee copies the data because we will match the top total force with the data of the spring
    | sort -nr | head -n 1 | cut -d= -f2  <-- gives the single highest force
    ) tempfile.txt  <-- Command becomes: grep '999t=high_number' tempfile
    | sed 's/[^ ]* *//' <-- get rid of garbage at the start.

  • Place multiple titles on a single clip and then manually place them?

    Hi all,
    Is it possible to place multiple titles on the same clip in iMovie 09?
    I would also like to manually place those titles to where I want them to be on the frame.
    I know it's possible to "trick" iMovie by adding a title to a clip, exporting it, and then importing it again to add another title but this seems to degrade the quality of the video.
    Thanks very much!
    Mike

    mac shy wrote:
    .. I would also like to manually place those titles to where I want them to be on the frame.
    I guess, that kills iMs built in title features.
    so, Plan B)
    export a still form your project (=just as reference for following procedure)
    use any pic processor (Photoshop Elements/Pixelmator/..) which allows 'layers'.
    use exported still as background
    add as many titles where you want .. (keep in mind, video! no small fonts, no serifs, no too bright colors...)
    replace background layer by pure Green
    export as jpeg
    import to iMovie, use Greenbox effect to add video.

Maybe you are looking for

  • HOW TO INSERT NEW INFOOBJECTS IN THE WORKING DSO

    RESPECTED ALL I WOULD LIKE TO INSERT TWO INFOOBJECTS IN MY DSO WHICH IS CURRENTLY WORKING IN THE PRODUCTION SERVER AND GIVING REPORTS SUCCESSFULLY. I HAVE TESTED THOSE TWO INFOOBJECTS IN THE DEVELOPMENT AND FOUND CORRECT. MY FEAR IS IF I CREATE THE I

  • Made to Order Scenario

    Hi All, Q1)What customisation settings are needed for a made to order scenario. Q2) What do you mean by the terms Requirement Class and Req Type  please do not  give me notes from  SAP help menu. Do explain in Simple language and with good examples s

  • SGA Sizing + OEM Issue+AWR reports

    Hi Techies, There is small application(Billing Application) running on Laptop. (Windows Vista 32 bit , RDBMS 10.2.0.3.0.) 1- We have increased the SGA_MAX_SIZE. Thought of Increase 700 M. Once we did the changes it has taken effect as 702 MB Allocate

  • [CS4] Updating Only AE to CS5 from CS4

    Hoping to get some experienced guidance about the value of update to AE CS5 from the Production Premium of CS4. Would there be snafus involved when say premier from CS4 interacts with AE updated to CS5. Would there be any serious advantages to making

  • PO data to be sorted in bespoke table

    What i'm trying to do is, for certain purchasing groups we need to sort the information in a bespoke table. I am looking for a user exit accessed at PO save that will collect the PO info and sort it in a given table. I have looked at EXIT_SAPMM06E_01