How could I drop temporary table in preserve rows?

Hi,
I created a global temporary table test with the option, on commit preserve rows.
I try to drop it with another session but I can't, I always have the error message :
ORA-14452. So what can I do?
Thanks.

We cannot drop a temporary table if a session is using it. This means once a session has inserted data into it we cannot drop the table until that session either commits or exits (depending on whether the table is of the type PRESERVE ROWS). You can see this by looking in v$lock.
If you quit out of your first session the second session will be able to drop the table.
Cheers, APC

Similar Messages

  • How could I know which table the synonym points to now?

    I have two tables with the same structure, TableA and TableB
    I create a synonym which points to TableA. In some senario, the synonym should be switched to point to the other table.
    How could I know which table the synonym points to right now? So that I can switch the synonym to the other table.
    Thanks a lot!!!!!!

    How could I know which table the synonym points to right nowSee all_synonyms view.
    So that I can switch the synonym to the other tableNot without drop synonym. You need to drop and recreate the synonym to point to the new table.
    Nicolas.

  • How to Create a Temporary Table with SQL Server

    I know you can create a temporary table in SQL Server 2000, but not quite sure how to do it in CFMX 7, i.e., does the SQL go inside a <CFQUERY dbtype="query"> tag?
    I'm pulling the main set of records from an Oracle server (1st data source), but it does not contain employee names, only employee IDs.  Since I need to show the employee name along with the Emp ID, I'm then pulling a list of "current" employee names from a SQL Server (2nd data source), which is the main database on our CF server.
    I've got a QofQ that works fine, except it only matches EmpIDs that exist in both result sets.  Employees who are no longer employed, don't match, and don't display.  Since I can't do a LEFT OUTER JOIN with a QofQ, what I need to do is get the records from the Oracle server into the SQL Server.  Preferably in a temporary table.
    I was hoping if I could get those Oracle records written to a temp table on the main SQL Server, in same database as the Employee Name table, I could then write a normal <CFQUERY> that uses a LEFT OUTER JOIN.
    I think I could probably write a Stored Procedure that would execute the SQL to create the temporary table, but am trying to avoid having to write the SP, and do it the simplest way.
    This query will be a program that can be run hundreds of times per day, with a form that allows users to select date ranges, locations, and other options.  That starts the queries, which creates the report.  So I just need the temp table to exist only until all the SQL has run, and the <CFOUTPUT> has generated a report.
    If the premise is right, I just need some help with the syntax for creating a SQL Server temp table, when you want to write records to it from an external data source.  I'm trying the following, but getting an error:
    <CFQUERY name="ITE_Temp" datasource="SkynetSQL">
    CREATE TABLE #MyTemp
    (   INSERT INTO #MyTemp
    ITE2.TrueFile char (7) NOT NULL,
    ITE2.CountOfEmployee int NULL,
    ITE2.DTL_SUBTOT decimal NULL,
    ITE2.EMPTYPE char (3) NULL,
    ITE2.ARPT_CD char (3) NULL
    </CFQUERY>
    So I actually created a permanent table on the SQL Server, and wrote the below SQL, which does work, and does write the records to table.  I can then write another CFQUERY with a LEFT OUTER JOIN, and get all the records, including those that don't have matching employee name:
    <CFQUERY datasource="SkynetSQL">
    <CFLOOP index="i" from="1" to = "#ITE2.RecordCount#">
    INSERT INTO ITE_Temp
       (FullFile,
       EmployeeCount,
       DTL_Amount,
       EmployeeType,
       station)
    VALUES  ('#ITE2.TrueFile[i]#',
       #ITE2.CountOfEmployee[i]#,
       #ITE2.DTL_SUBTOT[i]#,
       '#ITE2.EMPTYPE[i]#',
       '#ITE2.ARPT_CD[i]#')
    </CFLOOP>
    </CFQUERY>
    But, I hate to have to create a table and physically write to it.  For one, it seems slower, and doing it in temp would be in memory, and probably much faster, correct?  Is there some way to code the above, so that it does something similar, but in a TEMPORARY TABLE?   If I can figure out how to do this, I can pull data from multiple data sources and servers, and using SQL Server temp tables, work with the data as if it was all on the same SQL Server, and do some cool reports.
    Everything I've done for the past few years, has all been from data from a single source, whether SQL Server, or another server.  Now I need to start writing reports where data can come from 3 or 4 different servers, and be able to do joins (inner and outer).  Thanks for any advice/help.  Much appreciated.
    Gary

    While waiting to hear back, I was able to write the query results from an outside Oracle server, to a table on the local SQL Server, and do the LEFT OUTER JOIN required for the final query and report to work.  That was with this syntax:
    <CFQUERY name="AddTableRecords" datasource="MyTable">
    TRUNCATE TABLE ITE_Temp
    <CFOUTPUT query="ITE2">
    INSERT INTO ITE_Temp
    (FullFile,EmployeeCount,DTL_Amount,EmployeeType,station)
    VALUES
    ('#TrueFile#', #CountOfEmployee#, #DTL_SUBTOT#, '#EMPTYPE#', '#ARPT_CD#')
    </CFOUTPUT>
    </CFQUERY>
    However, I was not able to write to a temporary table AND read the results. I got the syntax to run to write the above results to a temporary table.  But when I tried to read and output the results from the temp table, I got an error.  Also, it wouldn't take the single "#" (local) only the global "##" table var, using this syntax.  Note that if I didn't have the DROP TABLE in the beginning, the 2nd time you run this query, you get an error telling you the table already exists.
    <CFQUERY name="ITE_Temp2" datasource="MyTable">
    DROP TABLE ##MyTemp2
    CREATE TABLE ##MyTemp2
    FullFile char (7) NOT NULL,
    EmployeeCount int NULL,
    DTL_Amount decimal NULL,
    EmployeeType char (3) NULL,
    station char (3) NULL
    <CFOUTPUT query="ITE2">
    INSERT INTO ##MyTemp2 VALUES
    '#ITE2.TrueFile#',
    #ITE2.CountOfEmployee#,
    #ITE2.DTL_SUBTOT#,
    '#ITE2.EMPTYPE#',
    '#ITE2.ARPT_CD#'
    </CFOUTPUT>
    </CFQUERY>
    So even though the above works, I could use some help in reading/writing the output.  I've tried several things similar to below, but they don't work.  It't telling me ITE_Temp2 does not exist.  It's not easy to find good examples of creating temporary tables in SQL Server.
    <CFQUERY name="QueryTest2" datasource="SkynetSQL">
    SELECT *
    FROM ITE_Temp2
    </CFQUERY>
    <CFOUTPUT query="ITE_Temp2">
    Output from Temp Table<br>
    <p>FullFile: #FullFile#, EmployeeCount: #EmployeeCount#</p>
    </CFOUTPUT>
    Thanks for any help/advice.
    Gary.

  • How to use Oracle temporary table and verify if it exists

    1. I got two errors on the following code.
    ORA-06550: line 13, column 4:
    PLS-00428: an INTO clause is expected in this SELECT statement
    ORA-06550: line 17, column 3:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    2. Can I include this code in the create view statement?
    Thanks ahead, I am new to oracle dev world.
    ===========================================================
    DECLARE
    l_count NUMBER;
    BEGIN
    select count(*)
    into l_count
    from all_tables
    where table_name like 'TEMP_SHOW_STAFF_2%';
    if l_count > 0 then
    select * from TEMP_SHOW_STAFF_2;
    else
    create global temporary table TEMP_SHOW_STAFF_2
    (employee_id Number,
    last_name varchar(10),
    first_name varchar(10),
    salary_amount varchar(10))
    on COMMIT delete rows;
    end if;
    END;

    The PL/SQL User's Guide will have much more information, but as a quick example (new_dept is an empty table with the same structure as the DEPT table in the SCOTT schema).
      1  declare
      2    -- Create the type & declare a variable of that type
      3    type dept_arr_typ is table of dept%rowtype;
      4    dept_arr dept_arr_typ;
      5  begin
      6    -- Populate the type in memory
      7    select *
      8      bulk collect into dept_arr
      9      from dept;
    10    -- Manipulate the data
    11    for i in 1..dept_arr.count
    12    loop
    13      select 'foo'
    14        into dept_arr(i).dname
    15        from dual;
    16    end loop;
    17    -- Write the data back
    18    for i in 1..dept_arr.count
    19    loop
    20      insert into new_dept( deptno, dname, loc )
    21        values( dept_arr(i).deptno, dept_arr(i).dname, dept_arr(i).loc );
    22    end loop;
    23* end;
    SCOTT @ nx102 Local> /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SCOTT @ nx102 Local> select * from new_dept;
        DEPTNO DNAME          LOC
            10 foo            NEW YORK
            20 foo            DALLAS
            30 foo            CHICAGO
            40 foo            BOSTONOf course, for this sort of thing, we could do everything in a single SQL statement
    INSERT INTO new_dept( deptno, dname, loc )
      SELECT deptno, 'foo', loc
        FROM dept;Collections can be handy if you need to apply a bit more conditional logic, though.
    Justin

  • How Create a Global Temporary Table inside a Stored Procedure?

    Hi...
    I need to create a Global Temporary Table inside a Stored
    Procedure....
    I have no idea how to do that....
    Please....if u can send me a sample, send to me....
    Thanks a lot

    there are many ways to do this..
    one u can use dbms_utility package to run ddl statements like
    for ex:
    declare
    t varchar2(200):='order_no';
    v number;
    begin
    --dbms_utility.exec_ddl_statement('select '||t||' into '||v||'
    from
    --ordermaster where rownum=1');
    dbms_utility.exec_ddl_statement('create table cvt(t number)');
    dbms_output.put_line(v);
    end;
    but the actual method(recommended) involves a bit coding using
    dbms_sql package you will find examples on technet or metalink
    to use this package..
    I hope this helps
    Narendra

  • How to create a TEMPORARY table in memory?

    Hi,
    Is there any way to create a temporary table in memory other than in tablespce?

    A cursor should do the job for you, I reckon.
    Regards,
    Raymond.

  • How do i drop my table

    Hi guys ,
    am trying to drop my table . but it is used by another user . am getting error message.
    can give a suggession .
    Edited by: Balajiraam on Mar 2, 2011 1:33 AM

    Hi,
    You cannot drop the table without the other user completing the transaction on the table. So the user's transaction has to be completed before you drop the table. As hoek said the user should either commit or rollback the transaction.
    cheers
    VT

  • Global Temporary Table not deleting Rows

    why is my Global temp table not deleting the rows after commit see below,
    CREATE GLOBAL TEMPORARY T_CHG
    TBE VARCHAR2(7),
    ABC VARCHAR2(8),
    EFDA VARCHAR2(6),
    ABD VARCHAR2(9),
    A_ID VARCHAR2(128),
    C_DATE,
    ON COMMIT DELETE ROWS;

    Quite a few syntax issues with your create statement. It would have helped if you had posted a SQL*Plus session showing your results. Here is mine which works just fine:
    sql>create global temporary table t_chg
      2  (
      3  tbe varchar2(7),
      4  abc varchar2(8),
      5  efda varchar2(6),
      6  abd varchar2(9),
      7  a_id varchar2(128),
      8  c_date date
      9  )
    10  on commit delete rows;
    Table created.
    sql>insert into t_chg values ('1', '2', '3', '4', '5', sysdate);
    1 row created.
    sql>select count(*) from t_chg;
    COUNT(*)
            1
    1 row selected.
    sql>commit;
    Commit complete.
    sql>select count(*) from t_chg;
    COUNT(*)
            0
    1 row selected.

  • How could i updated a table created with 5 tables.

    Hi everyone,
    This is my problem. I have five "tables" and each one contains one row and 7 columns. In the other hand, I have one table(Ireland1) that it retrieves the values of these 5 "tables" through of " insert into" statement.
    How would be I able to update of "Ireland1" data, when one of this "tables" (Remenber, I have 5 tables)  has changed?
    I have been searching information about this but  all my search has been fruitless.
    Thanks in advance,
    From Ireland

    Hi Eric,
    Thank you for your quick reply and solution. I have run your statement and appear this error:
    Msg 156, Level 15, State 1, Procedure Non_current_assets_Historic_View, Line 426
    Incorrect syntax near the keyword 'SELECT'.
    I dont know why this error appear
    I leave my Sript practically full
    USE Aerospace
    GO
    --TABLE NON-CURRENT ASSETS
    IF OBJECT_ID('Non_current_assets_Historic') IS NOT NULL
    DROP TABLE Non_current_assets_Historic
    GO
    CREATE TABLE Non_current_assets_Historic
    [IdCuenta] [float] NOT NULL,
    [NameCuenta] [nvarchar](255) NULL,
    Year_2006 decimal (14,2) NULL,
    Year_2007 decimal (14,2) NULL,
    Year_2008 decimal (14,2) NULL,
    Year_2009 decimal (14,2) NULL,
    Year_2010 decimal (14,2) NULL,
    Year_2011 decimal (14,2) NULL,
    Year_2012 decimal (14,2) NULL,
    Year_2013 decimal (14,2) NULL,
    Year_2014 decimal (14,2) NULL,
    Dif_2007_2006 decimal (14,2) NULL,
    Dif_2008_2007 decimal (14,2) NULL,
    Dif_2009_2008 decimal (14,2) NULL,
    Dif_2010_2009 decimal (14,2) NULL,
    Dif_2011_2010 decimal (14,2) NULL,
    Dif_2012_2011 decimal (14,2) NULL,
    Dif_2013_2012 decimal (14,2) NULL,
    Dif_2014_2013 decimal (14,2) NULL,
    AHP_2007_2006 decimal (14,2) NULL,
    AHP_2008_2007 decimal (14,2) NULL,
    AHP_2009_2008 decimal (14,2) NULL,
    AHP_2010_2009 decimal (14,2) NULL,
    AHP_2011_2010 decimal (14,2) NULL,
    AHP_2012_2011 decimal (14,2) NULL,
    AHP_2013_2012 decimal (14,2) NULL,
    AHP_2014_2013 decimal (14,2) NULL,
    GO
    ALTER TABLE Non_current_assets_Historic
    ADD CONSTRAINT PK_Non_current_assets_Historic PRIMARY KEY (IdCuenta)
    GO
    UPDATE Non_current_assets_Historic SET Year_2006=0 WHERE Year_2006 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2007=0 WHERE Year_2007 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2008=0 WHERE Year_2008 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2009=0 WHERE Year_2009 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2010=0 WHERE Year_2010 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2011=0 WHERE Year_2011 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2012=0 WHERE Year_2012 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2013=0 WHERE Year_2013 IS NULL
    UPDATE Non_current_assets_Historic SET Year_2014=0 WHERE Year_2014 IS NULL
    GO
    INSERT INTO Non_current_assets_Historic
    SELECT *
    FROM Property_plant_equipment_Historic
    INSERT INTO Non_current_assets_Historic
    SELECT *
    FROM Intangible_assets_Historic
    INSERT INTO Non_current_assets_Historic
    SELECT *
    FROM Available_financial_assets_Historic
    INSERT INTO Non_current_assets_Historic
    SELECT *
    FROM Deferred_tax_assets_Historic
    INSERT INTO Non_current_assets_Historic
    SELECT *
    FROM Deposits_restricted_12M_Historic
    GO
    --SUMATORIO YEAR 2006
    Declare @Cantidad20061 decimal (14,2)
    Declare @Cantidad20062 decimal (14,2)
    Declare @Cantidad20063 decimal (14,2)
    Declare @Cantidad20064 decimal (14,2)
    Declare @Cantidad20065 decimal (14,2)
    Select @Cantidad20061 = Year_2006 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad20062 = Year_2006 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad20063 = Year_2006 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad20064 = Year_2006 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad20065 = Year_2006 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2007
    Declare @Cantidad20071 decimal (14,2)
    Declare @Cantidad20072 decimal (14,2)
    Declare @Cantidad20073 decimal (14,2)
    Declare @Cantidad20074 decimal (14,2)
    Declare @Cantidad20075 decimal (14,2)
    Select @Cantidad20071 = Year_2007 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad20072 = Year_2007 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad20073 = Year_2007 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad20074 = Year_2007 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad20075 = Year_2007 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2008
    Declare @Cantidad20081 decimal (14,2)
    Declare @Cantidad20082 decimal (14,2)
    Declare @Cantidad20083 decimal (14,2)
    Declare @Cantidad20084 decimal (14,2)
    Declare @Cantidad20085 decimal (14,2)
    Select @Cantidad20081 = Year_2008 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad20082 = Year_2008 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad20083 = Year_2008 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad20084 = Year_2008 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad20085 = Year_2008 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2009
    Declare @Cantidad20091 decimal (14,2)
    Declare @Cantidad20092 decimal (14,2)
    Declare @Cantidad20093 decimal (14,2)
    Declare @Cantidad20094 decimal (14,2)
    Declare @Cantidad20095 decimal (14,2)
    Select @Cantidad20091 = Year_2009 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad20092 = Year_2009 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad20093 = Year_2009 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad20094 = Year_2009 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad20095 = Year_2009 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2010
    Declare @Cantidad200101 decimal (14,2)
    Declare @Cantidad200102 decimal (14,2)
    Declare @Cantidad200103 decimal (14,2)
    Declare @Cantidad200104 decimal (14,2)
    Declare @Cantidad200105 decimal (14,2)
    Select @Cantidad200101 = Year_2010 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad200102 = Year_2010 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad200103 = Year_2010 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad200104 = Year_2010 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad200105 = Year_2010 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2011
    Declare @Cantidad200111 decimal (14,2)
    Declare @Cantidad200112 decimal (14,2)
    Declare @Cantidad200113 decimal (14,2)
    Declare @Cantidad200114 decimal (14,2)
    Declare @Cantidad200115 decimal (14,2)
    Select @Cantidad200111 = Year_2011 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad200112 = Year_2011 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad200113 = Year_2011 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad200114 = Year_2011 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad200115 = Year_2011 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2012
    Declare @Cantidad200121 decimal (14,2)
    Declare @Cantidad200122 decimal (14,2)
    Declare @Cantidad200123 decimal (14,2)
    Declare @Cantidad200124 decimal (14,2)
    Declare @Cantidad200125 decimal (14,2)
    Select @Cantidad200121 = Year_2012 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad200122 = Year_2012 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad200123 = Year_2012 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad200124 = Year_2012 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad200125 = Year_2012 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2013
    Declare @Cantidad200131 decimal (14,2)
    Declare @Cantidad200132 decimal (14,2)
    Declare @Cantidad200133 decimal (14,2)
    Declare @Cantidad200134 decimal (14,2)
    Declare @Cantidad200135 decimal (14,2)
    Select @Cantidad200131 = Year_2013 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad200132 = Year_2013 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad200133 = Year_2013 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad200134 = Year_2013 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad200135 = Year_2013 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO YEAR 2014
    Declare @Cantidad200141 decimal (14,2)
    Declare @Cantidad200142 decimal (14,2)
    Declare @Cantidad200143 decimal (14,2)
    Declare @Cantidad200144 decimal (14,2)
    Declare @Cantidad200145 decimal (14,2)
    Select @Cantidad200141 = Year_2014 from Non_current_assets_Historic where IdCuenta ='7'
    Select @Cantidad200142 = Year_2014 from Non_current_assets_Historic where IdCuenta ='8'
    Select @Cantidad200143 = Year_2014 from Non_current_assets_Historic where IdCuenta ='9'
    Select @Cantidad200144 = Year_2014 from Non_current_assets_Historic where IdCuenta ='10'
    Select @Cantidad200145 = Year_2014 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2007_2006
    Declare @DIF_2007_20061 decimal (14,2)
    Declare @DIF_2007_20062 decimal (14,2)
    Declare @DIF_2007_20063 decimal (14,2)
    Declare @DIF_2007_20064 decimal (14,2)
    Declare @DIF_2007_20065 decimal (14,2)
    Select @DIF_2007_20061 = Dif_2007_2006 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2007_20062 = Dif_2007_2006 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2007_20063 = Dif_2007_2006 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2007_20064 = Dif_2007_2006 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2007_20065 = Dif_2007_2006 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2008_2007
    Declare @DIF_2008_20071 decimal (14,2)
    Declare @DIF_2008_20072 decimal (14,2)
    Declare @DIF_2008_20073 decimal (14,2)
    Declare @DIF_2008_20074 decimal (14,2)
    Declare @DIF_2008_20075 decimal (14,2)
    Select @DIF_2008_20071 = Dif_2008_2007 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2008_20072 = Dif_2008_2007 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2008_20073 = Dif_2008_2007 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2008_20074 = Dif_2008_2007 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2008_20075 = Dif_2008_2007 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2009_2008
    Declare @DIF_2009_20081 decimal (14,2)
    Declare @DIF_2009_20082 decimal (14,2)
    Declare @DIF_2009_20083 decimal (14,2)
    Declare @DIF_2009_20084 decimal (14,2)
    Declare @DIF_2009_20085 decimal (14,2)
    Select @DIF_2009_20081 = Dif_2009_2008 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2009_20082 = Dif_2009_2008 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2009_20083 = Dif_2009_2008 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2009_20084 = Dif_2009_2008 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2009_20085 = Dif_2009_2008 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2010_2009
    Declare @DIF_2010_20091 decimal (14,2)
    Declare @DIF_2010_20092 decimal (14,2)
    Declare @DIF_2010_20093 decimal (14,2)
    Declare @DIF_2010_20094 decimal (14,2)
    Declare @DIF_2010_20095 decimal (14,2)
    Select @DIF_2010_20091 = Dif_2010_2009 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2010_20092 = Dif_2010_2009 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2010_20093 = Dif_2010_2009 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2010_20094 = Dif_2010_2009 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2010_20095 = Dif_2010_2009 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2011_2010
    Declare @DIF_2011_20101 decimal (14,2)
    Declare @DIF_2011_20102 decimal (14,2)
    Declare @DIF_2011_20103 decimal (14,2)
    Declare @DIF_2011_20104 decimal (14,2)
    Declare @DIF_2011_20105 decimal (14,2)
    Select @DIF_2011_20101 = Dif_2011_2010 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2011_20102 = Dif_2011_2010 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2011_20103 = Dif_2011_2010 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2011_20104 = Dif_2011_2010 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2011_20105 = Dif_2011_2010 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2012_2011
    Declare @DIF_2012_20111 decimal (14,2)
    Declare @DIF_2012_20112 decimal (14,2)
    Declare @DIF_2012_20113 decimal (14,2)
    Declare @DIF_2012_20114 decimal (14,2)
    Declare @DIF_2012_20115 decimal (14,2)
    Select @DIF_2012_20111 = Dif_2012_2011 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2012_20112 = Dif_2012_2011 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2012_20113 = Dif_2012_2011 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2012_20114 = Dif_2012_2011 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2012_20115 = Dif_2012_2011 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2013_2012
    Declare @DIF_2013_20121 decimal (14,2)
    Declare @DIF_2013_20122 decimal (14,2)
    Declare @DIF_2013_20123 decimal (14,2)
    Declare @DIF_2013_20124 decimal (14,2)
    Declare @DIF_2013_20125 decimal (14,2)
    Select @DIF_2013_20121 = Dif_2013_2012 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2013_20122 = Dif_2013_2012 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2013_20123 = Dif_2013_2012 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2013_20124 = Dif_2013_2012 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2013_20125 = Dif_2013_2012 from Non_current_assets_Historic where IdCuenta ='11'
    --SUMATORIO DIF_2014_2013
    Declare @DIF_2014_20131 decimal (14,2)
    Declare @DIF_2014_20132 decimal (14,2)
    Declare @DIF_2014_20133 decimal (14,2)
    Declare @DIF_2014_20134 decimal (14,2)
    Declare @DIF_2014_20135 decimal (14,2)
    Select @DIF_2014_20131 = Dif_2014_2013 from Non_current_assets_Historic where IdCuenta ='7'
    Select @DIF_2014_20132 = Dif_2014_2013 from Non_current_assets_Historic where IdCuenta ='8'
    Select @DIF_2014_20133 = Dif_2014_2013 from Non_current_assets_Historic where IdCuenta ='9'
    Select @DIF_2014_20134 = Dif_2014_2013 from Non_current_assets_Historic where IdCuenta ='10'
    Select @DIF_2014_20135 = Dif_2014_2013 from Non_current_assets_Historic where IdCuenta ='11'
    insert into Non_current_assets_Historic (IdCuenta,NameCuenta,Year_2006 , Year_2007,Year_2008 ,Year_2009 ,Year_2010,Year_2011 ,Year_2012 ,Year_2013 ,
    Year_2014,Dif_2007_2006,Dif_2008_2007, Dif_2009_2008, Dif_2010_2009,Dif_2011_2010,Dif_2012_2011,Dif_2013_2012,Dif_2014_2013,
    AHP_2007_2006, AHP_2008_2007 , AHP_2009_2008, AHP_2010_2009, AHP_2011_2010, AHP_2012_2011 , AHP_2013_2012,AHP_2014_2013 )
    Values (1, 'Non-current assets', NULL,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll),
    (19, '', NULL,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll,NUll),
    (20, 'Total Non-current assets',
    --Year_2006
    (@Cantidad20061 +@Cantidad20062 +@Cantidad20063 +@Cantidad20064 +@Cantidad20065),
    --Year_2007
    (@Cantidad20071+ @Cantidad20072 + @Cantidad20073+ @Cantidad20074+ @Cantidad20075),
    --Year_2008
    (@Cantidad20081 + @Cantidad20082 + @Cantidad20083 + @Cantidad20084 + @Cantidad20085),
    --Year_2009
    (@Cantidad20091 + @Cantidad20092 + @Cantidad20093+ @Cantidad20094 + @Cantidad20095),
    --Year_2010
    (@Cantidad200101 + @Cantidad200102 + @Cantidad200103 + @Cantidad200104 + @Cantidad200105),
    --Year_2011
    (@Cantidad200111 + @Cantidad200112 + @Cantidad200113 + @Cantidad200114 + @Cantidad200115),
    --Year_2012
    (@Cantidad200121 + @Cantidad200122 + @Cantidad200123 +@Cantidad200124 + @Cantidad200125),
    --Year_2013
    (@Cantidad200131 + @Cantidad200132 +@Cantidad200133 + @Cantidad200134 + @Cantidad200135),
    --Year_2014
    (@Cantidad200141 + @Cantidad200142 + @Cantidad200143 + @Cantidad200144 + @Cantidad200145),
    --Diferencia Numeria 2007-2006
    (@DIF_2007_20061 + @DIF_2007_20062 + @DIF_2007_20063 + @DIF_2007_20064 + @DIF_2007_20065),
    --Diferencia Numeria 2008-2007
    (@DIF_2008_20071 + @DIF_2008_20072 + @DIF_2008_20073 + @DIF_2008_20074 + @DIF_2008_20075),
    --Diferencia Numeria 2009-2008
    (@DIF_2009_20081 + @DIF_2009_20082 + @DIF_2009_20083 + @DIF_2009_20084 + @DIF_2009_20085 ),
    --Diferencia Numeria 2010-2009
    (@DIF_2010_20091 + @DIF_2010_20092 + @DIF_2010_20093 + @DIF_2010_20094 + @DIF_2010_20095),
    --Diferencia Numeria 2011-2006
    (@DIF_2011_20101 + @DIF_2011_20102 + @DIF_2011_20103 +@DIF_2011_20104 + @DIF_2011_20105 ),
    --Diferencia Numeria 2012-2011
    (@DIF_2012_20111+@DIF_2012_20112+@DIF_2012_20113+@DIF_2012_20114+@DIF_2012_20115),
    --Diferencia Numeria 2013-2012
    (@DIF_2013_20121 + @DIF_2013_20122 +@DIF_2013_20123 +@DIF_2013_20124 + @DIF_2013_20125),
    --Diferencia Numeria 2014-2013
    (@DIF_2014_20131+@DIF_2014_20132+@DIF_2014_20133+@DIF_2014_20134+@DIF_2014_20135),
    --Diferencia Porcentual 2007-2006
    (@DIF_2007_20061+@DIF_2007_20062+@DIF_2007_20063+@DIF_2007_20064+@DIF_2007_20065)/(@Cantidad20061 +@Cantidad20062 +@Cantidad20063 +@Cantidad20064 +@Cantidad20065),
    --Diferencia Porcentual 2008-2007
    (@DIF_2008_20071 + @DIF_2008_20072 + @DIF_2008_20073 + @DIF_2008_20074 + @DIF_2008_20075)/(@Cantidad20071+ @Cantidad20072 + @Cantidad20073+ @Cantidad20074+ @Cantidad20075),
    --Diferencia Porcentual 2009-2008
    (@DIF_2009_20081 + @DIF_2009_20082 + @DIF_2009_20083 + @DIF_2009_20084 + @DIF_2009_20085 )/(@Cantidad20081 + @Cantidad20082 + @Cantidad20083 + @Cantidad20084 + @Cantidad20085),
    --Diferencia Porcentual 2010-2009
    (@DIF_2010_20091 + @DIF_2010_20092 + @DIF_2010_20093 + @DIF_2010_20094 + @DIF_2010_20095)/(@Cantidad20091 + @Cantidad20092 + @Cantidad20093+ @Cantidad20094 + @Cantidad20095),
    --Diferencia Porcentual 2011-2010
    (@DIF_2011_20101 + @DIF_2011_20102 + @DIF_2011_20103 +@DIF_2011_20104 + @DIF_2011_20105)/(@Cantidad200101 + @Cantidad200102 + @Cantidad200103 + @Cantidad200104 + @Cantidad200105),
    --Diferencia Porcentual 2012-2011
    (@DIF_2012_20111+@DIF_2012_20112+@DIF_2012_20113+@DIF_2012_20114+@DIF_2012_20115)/(@Cantidad200111 + @Cantidad200112 + @Cantidad200113 + @Cantidad200114 + @Cantidad200115),
    --Diferencia Porcentual 2013-2012
    (@DIF_2013_20121 + @DIF_2013_20122 +@DIF_2013_20123 +@DIF_2013_20124 + @DIF_2013_20125)/(@Cantidad200121 + @Cantidad200122 + @Cantidad200123 +@Cantidad200124 + @Cantidad200125),
    --Diferencia Porcentual 2014-2013
    (@DIF_2014_20131+@DIF_2014_20132+@DIF_2014_20133+@DIF_2014_20134+@DIF_2014_20135)/(@Cantidad200131 + @Cantidad200132 +@Cantidad200133 + @Cantidad200134 + @Cantidad200135))
    GO
    SELECT IdCuenta ,NameCuenta ,Year_2006 ,Year_2007 ,Year_2008 ,Year_2009 ,Year_2010 ,Year_2011 ,Year_2012 , Year_2013 ,Year_2014
    FROM Non_current_assets_Historic
    Maybe the error is in the design
    of this table
    Regards
    Francisco
    I work with SQL 2014 Management Studio

  • How to change colors of table col and row header?

    Could I change table header colors when run vi ? Is such a thing possible?
    ex: Header words color from black changed to green in column 2 of table.

    cloud a écrit:
    ...But I mean is "How to change header words color" not changed cell words color.
    tst gave you the answer ! A header cell is just a cell with a -1 value as index...
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to set all af:table with banding="row" and bandingInterval="1"

    i need all af:table in my project with two attribute banding="row" and bandingInterval="1", how to implement it
    by skin or css? pls give me a clue. thx

    Hi,
    skinning is for the look and feel (e.g. the color of the banding). The banding and banding interval is a component property that needs to be set on the page source
    Frank

  • How to display data in table with dynamic rows, section wise in a page.

    Hello all,
    I work on report creation in BI Publisher where I need to display data from xml in a table in pdf format.The output page is divided into two vertical sections , containing tables, with exactly same columns on left and right sections. The number of rows in table depends on the output of the fetching query. The page is to be populated in such a way that, at first, the left table is populated, then the next rows fill up the table on the right section of the page, if more rows are left, they fill up the tables on next page[first the left table, and then the right one, in a similar fashion as in page 1]
    On a bird's eye view, the data needs to be simply mapped to a table, with dynamic number of rows, and so can span number of pages depending on size of data. On a implementation level, I am stuck in getting the left section of the page populated first, then the right section[in place of the right page], and then the next page.
    Please guide me if someone has any idea in getting this achieved.
    Thanks in advance.

    Thanks for the response...
    I am able to get the desired functionality. I just need the tables to be inside a bigger table, that also has a dividing line between the two columns. This is was is intended in the req. provided to me. The column formatting option provides me a line ,but that is not further modifiable .Please help me in getting a perpendicular line between the two columns, which I need to be of a specified width and color.

  • How to auto scroll a table to last row when using Active Data Service?  11g

    Hi all,
    Has anyone got any experience with the ADF Active Data Service?
    I am using an af:table in combination with the ADF Active Data Service and I want the table to scroll to the latest row when new data arrives.
    It is basically a simple setup:
    The value attribute of my table points to a bean that extends CollectionModel and implements ActiveDataModel. This works perfectly. A soon as I receive new data in my bean, the table is automatically updated (e.g. a new row is inserted). I use JDev version: 11.1.1.3
    The problem is that I can not get the scroll bar to move down to the last row automatically when new data arrives. The auto scroll only works for the client that actually performs a submit. In other words the person that submits the new data, will see his scrollbar move down, this is because I added the following code:
    RowKeySet rowkeysset = chatTableBinding.getSelectedRowKeys();
    rowkeysset.clear();
    rowkeysset.add(getRowKey());
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.chatTableBinding);
    This does not work for the clients that receive the new data via the Active data model. Apparently the active data service partially refreshes the table, but not in such a way that it sets the selected row to the last row?
    My table definition:
    <af:table value="#{pageFlowScope.chatBean.instantMessagingChatwindowBean}" var="row"
    id="t1" columnStretching="last" rows="10"
    styleClass="AFStretchWidth" autoHeightRows="10" contentDelivery="immediate"
    horizontalGridVisible="false"
    verticalGridVisible="false"
    disableColumnReordering="true" displayRow="last"
    rowSelection="single"
    binding="#{pageFlowScope.chatBean.instantMessagingChatwindowBean.chatTableBinding}"
    inlineStyle="height:80px;">
    p.s.
    The table is used to show incoming chat message.
    I am building a chat client (taskflow) in a Webcenter application. The concept is similar of that presented by Lucas Jellemain in his blogpost on building a Google Talk Client http://www.oracle.com/technetwork/articles/jellema-googletalk-094343.html

    Dan,
    This is a thanks for posting your findings. You saved me quite some time.
    <af:selectBooleanCheckbox id="showOnlyActiveSubscriptions" selected="true"
    label="Show only active services:"
    value="#{servicePortfolioBean.showOnlyActiveSubscriptions}"
    autoSubmit="true" />
    <af:table binding="#{servicePortfolioBean.serviceTable}" ...
    partialTriggers="showOnlyActiveSubscriptions">
    Of course, when I add a "ValueChangeListener" to the selectBooleanCheckbox, the PPR stops working. :( I wonder why?

  • How can I query a table based on row numbers?

    select numberofmonths  from traveldays_president where row_number= 55;
    How can I go about filtering records based on row number?

    Use a query like
    select numberofmonths from traveldays_president where row_number=@rownumber
    Create a dataset with above query in SSRS and on refreshing it after execution SSRS will add field information and parameter information for you. Then when you try to run report it will ask you for value of rownumber and based on value you pass it will give
    you corresponding row(s) in output
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How create temporary table from list of values

    Can you anybody advise me how can I create temporary table from list of values? I have list of values and need create temporary table for next use with command JOIN etc.
    Thank you for help

    NO, you can not create temporary table in oracle on the fly ( Like #Tabels in SQl Server or Sybase ) , you will have to use the GTT i.e Global Temporary Tables
    check the following link GTT :
    to flush the tables after commit
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT DELETE ROWS;In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
    so to keep rows in Table after commit
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT PRESERVE ROWS;

Maybe you are looking for