Is it posible a query that builds dynamically the number of columns?

Hi experts!
I have a query that shows amounts in 12 columns corresponding on the calendar months of the year.   Now,  I need to change that getting in a previous screen how many months the user wants to see.   The query has to build dynamically the number of columns to show.    Can I do that with query designer?  How?
I am working in V7.0.
I appreciate your help.
Thanks!
Ada.

Hi experts!
I have a query that shows amounts in 12 columns corresponding on the calendar months of the year.   Now,  I need to change that getting in a previous screen how many months the user wants to see.   The query has to build dynamically the number of columns to show.    Can I do that with query designer?  How?
I am working in V7.0.
I appreciate your help.
Thanks!
Ada.

Similar Messages

  • Run a query that will determine the number of parts to produce

    I have the task that I have to determine the number of parts that need to be produced based on the number of products sold for the day (each product consists of many parts).
    I am using SQL 11g Express.
    I have stared at this for so long and tried so many different ways. Below are a few of what I have tried, with the error messages. I'm not sure where I'm going wrong to get this calculation. Any help here is greatly appreciated!
    Here's my info:
    /**PRODUCT**/
    CREATE table Product
        SKU       VARCHAR2(10) NOT NULL,
        ProdDesc   VARCHAR2(50) NOT NULL,
        Price      NUMBER(5,2),
        PRIMARY KEY(SKU)
    /**PART**/
    CREATE table Part
        PartID     NUMBER(6) NOT NULL,
        PartDesc   VARCHAR2(50) NOT NULL,
        PRIMARY KEY(PartID)
    /**PRODUCTPART**/
    CREATE table ProductPart
        SKU        VARCHAR2(10) NOT NULL CONSTRAINT fk_ProductPart_Product REFERENCES Product (SKU),
        PartID     NUMBER(6) NOT NULL CONSTRAINT fk_ProductPart_Part REFERENCES Part (PartID),
        NumOfParts NUMBER(3),
        CONSTRAINT pk_ProductPart PRIMARY KEY (SKU, PartID)
    CREATE table Customer
        CustID     NUMBER(6) NOT NULL,
        CustFname  VARCHAR2(20) NOT NULL,
        CustLname  VARCHAR2(20) NOT NULL,
        Company    VARCHAR2(40),
        Address    VARCHAR2(40) NOT NULL,
        City       VARCHAR2(30)NOT NULL,
        State      VARCHAR2(2)NOT NULL,
        Zip        NUMBER(5)NOT NULL,
        Phone      NUMBER(10)NOT NULL,
        PRIMARY KEY (CustID)
    CREATE table CustOrder
        OrderID    NUMBER(6) NOT NULL,
        Qty        NUMBER(3) NOT NULL,
        OrderDate  Date NOT NULL,
        SKU        VARCHAR(10) NOT NULL CONSTRAINT fk_CustOrder_Product REFERENCES Product (SKU),
        CustID     Number(6) NOT NULL CONSTRAINT fk_CustOrder_Customer REFERENCES Customer (CustID),
        PRIMARY KEY (OrderID)
    Here are some of the queries:
    SELECT ProductPart.Qty
    SELECT CustOrder.SKU,
    sum(CustOrder.qty)
    FROM CustOrder
        GROUP BY CustOrder.SKU;)
    FROM ProductPart
    WHERE ProductPart.Qty * sum(CustOrder.Qty)
    ORA-00936: missing expression
    SELECT o.OrderDate AS "Date Ordered",
           o.OrderDate + 5 AS "Date Due",
           pp.PartID AS "Part No.",
        pp.NumOfParts * COUNT(o.SKU) AS "Qty"
    FROM CustOrder o
    JOIN ProductPart pp
      ON o.SKU = pp.SKU
        GROUP BY pp.PartID, o.OrderDate, COUNT(o.SKU)
    ORDER BY o.OrderDate
    ORA-00934: group function is not allowed here
    SELECT ProductPart.Qty,
           ProductPart.PartID,
           ProductPart.PartDesc
    (SELECT COUNT(CustOrder.SKU)
    FROM CustOrder
    GROUP BY CustomerOrder.SKU)TotalProducts,
    ProductPart.Qty * TotalProducts AS "Qty"
    FROM ProductParty
    WHERE CustOrder.SKU = Product.SKU
    AND Product.SKU = ProductPart.SKU
    ORA-00936: missing expression
    SELECT ProductPart.Qty,
           ProductPart.PartID,
           ProductPart.PartDesc
    (SELECT sum(CustOrder.qty)
    FROM CustOrder
    GROUP BY CustOrder.SKU)TotalProducts
        ProductPart.Qty * TotalProducts
        FROM ProductPart
    ORA-00936: missing expression

    Hi,
    893443 wrote:
    ... CREATE table CustOrder
    OrderID NUMBER(6) NOT NULL,
    Qty NUMBER(3) NOT NULL,
    OrderDate Date NOT NULL,
    SKU VARCHAR(10) NOT NULL CONSTRAINT fk_CustOrder_Product REFERENCES Product (SKU),
    CustID Number(6) NOT NULL CONSTRAINT fk_CustOrder_Customer REFERENCES Customer (CustID),
    PRIMARY KEY (OrderID)
    INSERT INTO CustOrder(OrderID, Qty, OrderDate, SKU, CustID)
    VALUES(2101, 2, '10-26-2011', 'DVCK1212', 1101);You're still trying to put a VARCHAR2 into a DATE column. Depending on your NLS settings, that may work on your system (at least today), but it definiely doesn't work on mine.
    Don't use a VARCHAR2 where a DATE is expected. Use TO_DATE to convert a string into a DATE:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/functions203.htm#sthref1662
    Ideally The report would look something like this:Why not like this?
    ORDERDATE      PARTID PARTDESC                        TOTAL_QTY
    10-24-2011       1003 12" X 24" Ventilated Shelf             42
    10-24-2011       2001 12" X 12" Solid Shelf                 108
    10-24-2011       3001 12" X 96" Side Panel                   50
    10-25-2011       1004 12" X 30" Ventilated Shelf             72
    10-25-2011       2001 12" X 12" Solid Shelf                  54
    10-25-2011       2002 12" X 18" Solid Shelf                   6
    10-25-2011       3001 12" X 96" Side Panel                   44
    10-26-2011       1001 12" X 12" Ventilated Shelf             42
    10-26-2011       1004 12" X 30" Ventilated Shelf              6
    10-26-2011       2003 12" X 24" Solid Shelf                  12
    10-26-2011       3001 12" X 96" Side Panel                   20Did you make some mistakes in your results? If not, explain how to get the correct results in the places where the ouput above is wrong. For example, how do you get the row for orderdate of Oct 26 and partid=2001?
    {OrderDate    PartID    PartDesc NumOfParts(Total for that day)
    10-24-2011    2001    12" X 12" Solid Shelf 108
    10-24-2011    2003    12" X 24" Solid Shelf 32
    10-24-2011    3001    96" Side Panel 50
    10-25-2011    2002    12" X 18" Solid Shelf 6
    10-25-2011    2001    12" X 12" Solid Shelf 54
    10-25-2011    1004    12" X 30" Ventilated Shelf 72
    10-25-2011    3001    96" Side Panel 44
    10-26-2011    2001    12" X 12" Solid Shelf 12
    10-26-2011    2004    12" X 30" Solid Shelf 6
    10-26-2011    2003    12" X 24" Solid Shelf 12
    10-26-2011    1001    12" X 12" Ventilated Shelf 30
    10-26-2011    3011    96" Side Panel 20}Use \ tags, as described in my last message, before and after formatted text, to preserve spacing.
    My issue is, I can't get the equation right to produce the total number of parts. I think I need to multiply ProductPart.NumOfParts by SUM(CustOrder.Qty) Group by CustOrder.SKU.More likely that you need to multiply numofparts * qty, and then take the SUM of the result.
    Why would you GROUP BY sku?  Does each row of output represent a different product (and therefore a different sku), or does each row of output represent a different part. regardless of which product(s) that part is related to?
    If you want a separate total for each orderdate, you'll have to include orderdate in the GROUP BY clause, too.
    To get partdesc in the output, you'll either need to include partdesc in the GROUP BY clause, or wrap it in an aggregate fucntion.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • OTL I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?

    Hi
    I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?
    I basically need person name who submitted, date - time it was submitted for approval, then the person who approved it and the date - time that it was approved
    Thanks
    Ruby

    Ruby,
    you can start with HXC_TIMECARD_SUMMARY table for submitter detail. But for approver details, i think you need WF tables to get the data for item type HXCEMP.

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • How to find the number of columns in an internal table DYNAMICALLY ?

    Hi,
    How to find the number of columns in an internal table DYNAMICALLY ?
    Thanks and Regards,
    saleem.

    Hi,
    you can find the number of columns and their order using
    the <b>'REUSE_ALV_FIELDCATALOG_MERGE'</b>
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = sy-repid
      changing
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif
    now describe your fieldcat . and find no of columns.
    and their order also..
    regards
    vijay

  • SQL Query - The number of columns specified in "SQL Query" does not match t

    I am creating new UDM for tablespace alert, below is my query,however its failing with error
    SQL Query - The number of columns specified in "SQL Query" does not match the value specified in "SQL Query Output"
    I selected Metric type is number
    SQL Query Format : Two columns
    Query:
    SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2)
    used_pct FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    Any clues why i am getting error.

    SQL> SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2) used_pct
    2 FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    3 WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    4 AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    TABLESPACE_NAME USED_PCT
    MGMT_TABLESPACE .82
    SYSAUX 1.52
    UNDOTBS1 .32
    RMAN .02
    CORRUPT_TS 10.63
    USERS 0
    SYSTEM 2.26
    MGMT_ECM_DEPOT_TS .04
    MGMT_AD4J_TS 0

  • Can I have a product formula in an entire column that will multiply the previous two columns?

    Trying to enter a product formula for an entire column that will multiply the previous two columns without having to select each row of two cells and clicking on "product".  This is tedious.  Thanks.

    My own tip to apply fill down to a column :
    click the tab at top of the column to select the entire column
    press command then click the header cells to unselect them
    Trigger Table > Fill > Fill Down
    It's the kind of info which is available in Numbers User Guide.
    It's always good practice to Read The Free Manual.
    Yvan KOENIG (VALLAURIS, France) mercredi 21 septembre 2011 21:07:53
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • Count the number of columns return in an user-input sql query

    I need to do something like this
    I let an user input a sql query and then execute it
    assuming the sql query is always correct, it will return a Resultset
    then a table will pop up to accomodate the number of columns the resultset will produce
    i'm stuck at the part on how to check how many columns of data will be return in the resultset

         ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
         ResultSetMetaData rsmd = rs.getMetaData();
         int numberOfColumns = rsmd.getColumnCount();

  • Items in project report(query) are listed under the "not assigned" (column)

    Hi All,
    Items in project reports (query) are listed under the "not assigned" (column name) Why it is so ?
    Start query : project reports & ask for period April 2008 (Period from/to). .
    You will see items listed under  Not assigned WBS Element (column name)
    If you choose for a period of April until June 2008 then you see more items under u201Cnot assignedu201D .
    Items should be under Assigned (column name) & not under the Not assigned (column name )
    Any suggestions highly appreciable.
    Thanks.

    Hi,
    How are you displaying the ITEM field in the BEx query designer? Is it displayed with "Key and Text"? If so and if the text is not loaded for this master, this may happen.
    Regards,
    Yogesh.

  • Dynamically change number of columns in report

    all,
    I am trying to change the number of columns in a report dynamically as in this sample(http://actionet.homelinux.net/htmldb/f?p=LSPDEMO:60:11041263091189::NO:::) , can somebody who has this code kindly send it to me or make reference...i'll appreciate

    But Howards solution is easier to follow and works perfectly with a shuttle.
    Define a function like this:
    create or replace FUNCTION item_in_list(p_num IN NUMBER, p_shuttle_name in VARCHAR2)
    RETURN NUMBER
    IS
        l_vc_arr2   APEX_APPLICATION_GLOBAL.VC_ARR2;
        TYPE number_list is TABLE OF NUMBER;
        num_list number_list := number_list();
        x_ret NUMBER;
    BEGIN
        /* checks if p_num exists in the colon delimited list p_shuttle_name */
            l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(p_shuttle_name);
            FOR i IN 1..l_vc_arr2.COUNT LOOP
                num_list.EXTEND;
                num_list(i):= CAST(l_vc_arr2(i) AS NUMBER);
            END LOOP;
            IF p_num MEMBER OF num_list then
                return 1;
            else
                return 0;
            end if;
    END;
    And then for every column put a condition (Function returning boolean) like this:
    begin
    if item_in_list(1, : p10_shuttle) = 1 then
    return true;
    else
    return false;
    end if;
    end;
    where 1 in my case is the return lov value.
    This is if your shuttle's return value is numeric and display value is varchar2. If both are varchar2 use instr as Howard suggested.
    Its probably not as fancy as the Jquery one but gets the job done.

  • How to clone data with in Table with dynamic 'n' number of columns

    Hi All,
    I've a table with syntax,
    create table Temp (id number primary key, name varchar2(10), partner varchar2(10), info varchar2(20));
    And with data like
    insert itno temp values (sequence.nextval, 'test', 'p1', 'info for p1');
    insert into temp values (sequence.nextval, 'test', 'p2', 'info for p2');
    And now, i need to clone the data in TEMP table of name 'test' for new name 'test1' and here is my script,
    insert into Temp  select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test1';
    this query executed successfully and able to insert records.
    The PROBLEM is,
    if some new columns added in TEMP table, need to update this query.
    How to clone the data with in the table for *'n' number of columns and*
    some columns with dynamic data and remaining columns as source data.
    Thanks & Regards
    PavanPinnu.
    Edited by: pavankumargupta on Apr 30, 2009 10:37 AM

    Hi,
    Thanks for the quick reply.
    My Scenario, is we have a Game Details table. When ever some Game get cloned, we need to add new records in to that Table for the new Game.
    As, the id will be primary key, this should populate from a Sequence (in our system, we used this) and Game Name will be new Game Name. And data for other columns should be same as Parent Game.
    when ever business needs changes, there will be some addition of new columns in Table.
    And with the existing query,
    insert into Temp (id, name, partner, info) select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test'_
    will successfully add new rows but new added columns will have empty data.
    so, is there any way to do this, i mean, some columns with sequence values and other columns with existing values.
    One way, we can do is, get ResultSet MetaData (i'm using Java), and parse the columns. prepare a query in required format.
    I'm looking for alternative ways in query format in SQL.
    Thanks & Regards
    PavanPinnu.
    Edited by: pavankumargupta on Apr 30, 2009 11:05 AM
    Edited by: pavankumargupta on Apr 30, 2009 11:05 AM

  • ABAP Query - Want to limit the number of records to 5

    I have a query based on a a table join (MKPF with MSEG) infoset. I want to limit the number of records to first five.
    How to deal with it?

    select data from tables using join and where conditions....into internal table....
    now move the first 5 records to second internal table and use them...
    or else in ur select statement u can use...
    select  data from tables <join condition> upto 5 rows.
    Message was edited by:
            Ramesh Babu Chirumamilla

  • Mapping Query : Can I get the Number Occurance of a segment

    Can I get the Number Occurance of a segment
    Source MSG
    Tree             Occurence
    **File_Message    (1..1)
    .....Name         (1..1)
    .....Sal          (1..1)
    .....**Details    (1..Unbound)   
    .........MailID   (1..1) 
    .........MobileNO (1..1)     
    Target MSG
    **CountDetails   (1..1)
    .....Count       (1..1)
    In Target MSG, I want the number of occurance of the FileDeatils-->Details 
    if source file is like follow
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:File_Message xmlns:ns0="urn:test:ns:ns">
       <Nam>John</Nam>
       <Sal>2342</Sal>
       <Details>
          <MailID>[email protected]</MailID>
          <TelNo>345345345</TelNo>
       </Details>
       <Details>
          <MailID>[email protected]</MailID>
          <TelNo>888888888</TelNo>
       </Details>
    </ns0:File_Message>
    I need to get the taget Message as follow
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:CountDetails xmlns:ns0="urn:test:ns:ns">
       <Count>2</Count>
    </ns0:CountDetails>
    in Count Tag I should get the number of occurance of Details Tag in source MSG
    Can any one help regard this
    Thanks is advance

    Hai Mohan,
       My Real Problem is
    I am Using the Scenario File--> XI --IDoc (Using BPM)
    File is having the following value
    Header Details (one Occurance)
    PO(1..Unbound)
    for Example that file having 2 PO (Purchase Order) Then I have to split that file in to two files..
    and I have to pass that two files to Post Idoc(0rders02) for create sal Order.
    That file may have more than one PO
    Please give Ur Suggest me on this
    Thanks in advance
    Dhanabal T

  • How can I add the number of columns/row starting with the build in "Text Report" example in the LabVIEW

    Hi All,
    I am wondering how can I add the numbers of row and column from the existing build-in "text report"
    VI ? If possible, would you mind showing me step-by-step because I am a new user and I am not familiar with the labview software.
    Thanks

    Hi,
    Easy text Report is for saving to a file. Do you mean you just want to add the totals of two arrays and write that? In that case I would just append the totals before writing to file.
    Jeff | LabVIEW Software Engineer

  • Using orcl:query-database to return a number of Columns

    I have a BPEL process that is pulling data from some Database tables everything is working fine.
    I now need to perform a lookup on the database to pull in some additional information (3 additional attributes) within the stylesheet, where each attribute comes from a separate table.
    i.e.
    select a.col1, b.col1, c.col1
    from tab1 a
    ,tab2 b
    , tab3 c
    where a.col2 = b.col2
    and .......blah blah blah....
    I have used the orcl:database-query successfully to retrieve a single column and a single row and it works great.
    However i'd like to run the above query as one statement, rather than 3 separate queries.
    I've googled the fucntion for examples where it returns a nodelist or XML snippet, but to no avail.
    I've tried it before and couldn't get it to work.
    Does anyone have any examples.
    Thanks in advance.
    Stuart

    I have a BPEL process that is pulling data from some Database tables everything is working fine.
    I now need to perform a lookup on the database to pull in some additional information (3 additional attributes) within the stylesheet, where each attribute comes from a separate table.
    i.e.
    select a.col1, b.col1, c.col1
    from tab1 a
    ,tab2 b
    , tab3 c
    where a.col2 = b.col2
    and .......blah blah blah....
    I have used the orcl:database-query successfully to retrieve a single column and a single row and it works great.
    However i'd like to run the above query as one statement, rather than 3 separate queries.
    I've googled the fucntion for examples where it returns a nodelist or XML snippet, but to no avail.
    I've tried it before and couldn't get it to work.
    Does anyone have any examples.
    Thanks in advance.
    Stuart

Maybe you are looking for

  • Cannot send emails from my yahoo account.,but can from internet explorer.Why?

    Hi, I can receive emails on my yahoo account;read them and so on,but cannot reply to them.A message comes which states that they are trying to re-load the original mail ,but fail to.I went into the yahoo help page and was told if it worked on a diffe

  • Error while opening EBS Forms....

    I am getting error while opening EBS 12.0.6 forms.The error we are getting is: FRM-92150 Web client version too new How to fix this issue?? Regards, Rupdipt

  • IDoc - File simple scenario using XI

    Good day everyone, As I remember when using IDocs on ABAP system it is possible to create a txt\xml file from the outbound Idoc in a specific library in the FS using just the ABAP system\IE. My question is:  when using XI how can I achieve the same r

  • Adobe Premiere CC 2014 not Project Managing properly

    I need to be able to Project Mange my Premiere Pro CC 2014 project and send it to the east coast by morning and it is giving me the old " An Unknown Error Occurred during the Project Manager operation. Please save your project and retry the operation

  • Has anyone an Intermittent Problem sending mail from Mac OS X (10.6.8)?

    I have a Mac mini operating on Mac OS X(10.6.8) Snow Leopard. In the last couple of weeks I have been having intermittent problems sending mail from Mac MAIL, especially if I hit the reply button.  It whirls around for ever and then tells me to 'Try