COMMENTS  on TABLE/TABLE COLUMNS - Problem with - ' -

Hi,
Generated COMMENTS on table by,
select dbms_metadata.get_dependent_ddl( 'COMMENT', table_name, user ) DDL from (select table_name from user_tab_comments where comments is not null);
Generated COMMENTS on table's columns like,
select dbms_metadata.get_dependent_ddl( 'COMMENT', table_name, user ) DDL
from (select table_name from user_col_comments where comments is not null);
But I am facing problem,
Eg: Sample COMMENT generated.
COMMENT ON TABLE "MHUBADMIN"."FUNCTION" IS 'The Function table stores information on the functions that the user's or the org's role has access to';
Please use the word - user's - and - org's
This gives error when I execute thie above statement in SQL prompt.
If I execute like,
COMMENT ON TABLE "MHUBADMIN"."FUNCTION" IS 'The Function table stores information on the functions that the user''s or the org''s role has access to';
Works fine.
I generated COMMENT script for nearly 1000 tables. The scipt contains nearly 10000 statements. How can I replace - ' - with - '' - .
If I replace this manually it will take some time.
Any automated method available? Please help me to solve this.
regards,
Mathew

If you have spooled output.. any text editor can do this.
Since you have a pattern like
FUNCTION" IS 'The
You can replace - IS ' - with - IS # -
and - to'; - with - to#; -
then replace all occurances of - ' - with - '' -.
Then restore # to '.
HTH...

Similar Messages

  • XML Standard for Comments on Tables, Columns?

    We are creating a new application and plan to store comments inside Oracle using the comment on table / column commands, but would like to store them in a manner that XML tools could understand. Is there some standard naming convention for things like Name, purpose, creator, etc? I know several metadata standards like FGDC have this, but I would like a more generic one if it exists.

    i looked, and noone is answering the question in the xml db forum. That is where I expected help to come from.

  • I can't comment on foxnews. Same problem with IE, FF and Chrome.

    I can't comment on foxnews. Same problem with all three browsers IE, FF and Chrome. The login does not appear on the right hand corner and the comment link does not appear on any article. I already checked to ensure cookies and 3rd party cookies were enabled. I've gone to DISQUS, but it won't let me login there either...doesn't recognize my ID or email addy. Suggestions?.

    It appears they've shut down all commenting due to the troll antics on the site. The pornographic images they were posting and the racial attacks (among other things) when posing as conservatives may well have caused this. The Disqus filter wasn't effective in that it is easy to get around. Too bad as it was a great place to vent.

  • Span columns problem with Table of Contents order

    Hello,
    I'm having a strange issue with headings that span columns and Table of contents order. My document has a heading paragraph in a coloured box, which is then inserted in-line into a 2-column text box. The paragraph style for the box (set to in-line) is set to span all columns, so that the 2-columned text doesn't get messed up.
    When I create a table of contents, the Heading style that is inside the coloured box is being picked up fine, but even though it is inserted before the headings below it, it is showing up after the level 2 headings, instead of before.
    I have confirmed that the insertion of the blue bar is before the text below it, as when I remove the span columns option, the TOC works as it is supposed to. Is this a bug?

    Hi there, thanks for the reply.
    The only way I could move the inline box to the left was to make a custom anchor and change the X value, this did not affect the TOC unfortunately. I also checked the location of the invisible marker indicating the location of the inline text box, and it is definitely before the heading that follows. I confirmed this by removing the span columns option for that paragraph, and the TOC displayed properly after doing that, meaning there is likely some problem with the span columns option not properly recognizing the order of content.
    Regards,

  • Table editor problem with default value for column

    Hi there,
    I'm trying to use SQL Developer 1.2.1 on Ubuntu 7.10 (though I don't think the OS is relevant) and I'm running into a snag when trying to update table structures. If you go to edit the table to say modify a column name, and that column has a default value set, SQL Developer is encapsulating the value with brackets and quotes. When trying to save the changes, it complains about the default value being 4 chars too many for the column width. An example of this would be a currency code column of varchar2 (3) set with EUR as the default. SQL Developer changes the value to ('EUR') hence the error.
    Is there anyway to prevent this from happening?
    Cheers,
    Chris

    Could you please be more specific? In 1.2.1.32.40 I
    added the column COL1 VARCHAR2(3) with default value
    'EUR'. The data display field refreshed to show the
    default value, so I edited it in a couple of entries
    and comitted the change without problem. Then I
    renamed the column from the "Edit table" popup menu.
    Finally, I renamed the column from the "Rename
    column" popup menu, no problem either.Ah, you are correct. That does work. What I was trying is select tablename in the object browser, then right click on it and select "Edit" from the contextual menu. You are then presented with edit table dialog box. If you then select a column in that box you will see a column properties box. In that section you can change the name, default value, datatype et cetera. Note that your default column value which should just be EUR (or 'EUR' to denote that it's a string) is now ('EUR'). Once you try changing the name to of the column to something else and then click OK, you should then get an error complaining of "Invalid varchar2 default value" with a more specific message of "Default values size 7 is greater than the allowed 3"
    You have provided a work around, and thanks for that, but it would be nice to edit everything in the Edit table dialog box if you're modifying more than one column name. I'm tasked with cleaning up a bit of a messy database, and there are a good deal of columns to be renamed.
    Cheers,
    Chris

  • Sliding Window Table Partitioning Problems with RANGE RIGHT, SPLIT, MERGE using Multiple File Groups

    There is misleading information in two system views (sys.data_spaces & sys.destination_data_spaces) about the physical location of data after a partitioning MERGE and before an INDEX REBUILD operation on a partitioned table. In SQL Server 2012 SP1 CU6,
    the script below (SQLCMD mode, set DataDrive  & LogDrive variables  for the runtime environment) will create a test database with file groups and files to support a partitioned table. The partition function and scheme spread the test data across
    4 files groups, an empty partition, file group and file are maintained at the start and end of the range. A problem occurs after the SWITCH and MERGE RANGE operations, the views sys.data_spaces & sys.destination_data_spaces show the logical, not the physical,
    location of data.
    --=================================================================================
    -- PartitionLabSetup_RangeRight.sql
    -- 001. Create test database
    -- 002. Add file groups and files
    -- 003. Create partition function and schema
    -- 004. Create and populate a test table
    --=================================================================================
    USE [master]
    GO
    -- 001 - Create Test Database
    :SETVAR DataDrive "D:\SQL\Data\"
    :SETVAR LogDrive "D:\SQL\Logs\"
    :SETVAR DatabaseName "workspace"
    :SETVAR TableName "TestTable"
    -- Drop if exists and create Database
    IF DATABASEPROPERTYEX(N'$(databasename)','Status') IS NOT NULL
    BEGIN
    ALTER DATABASE $(DatabaseName) SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    DROP DATABASE $(DatabaseName)
    END
    CREATE DATABASE $(DatabaseName)
    ON
    ( NAME = $(DatabaseName)_data,
    FILENAME = N'$(DataDrive)$(DatabaseName)_data.mdf',
    SIZE = 10,
    MAXSIZE = 500,
    FILEGROWTH = 5 )
    LOG ON
    ( NAME = $(DatabaseName)_log,
    FILENAME = N'$(LogDrive)$(DatabaseName).ldf',
    SIZE = 5MB,
    MAXSIZE = 5000MB,
    FILEGROWTH = 5MB ) ;
    GO
    -- 002. Add file groups and files
    --:SETVAR DatabaseName "workspace"
    --:SETVAR TableName "TestTable"
    --:SETVAR DataDrive "D:\SQL\Data\"
    --:SETVAR LogDrive "D:\SQL\Logs\"
    DECLARE @nSQL NVARCHAR(2000) ;
    DECLARE @x INT = 1;
    WHILE @x <= 6
    BEGIN
    SELECT @nSQL =
    'ALTER DATABASE $(DatabaseName)
    ADD FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';
    ALTER DATABASE $(DatabaseName)
    ADD FILE
    NAME= ''$(TableName)_f' + CAST(@x AS CHAR(5)) + ''',
    FILENAME = ''$(DataDrive)\$(TableName)_f' + RTRIM(CAST(@x AS CHAR(5))) + '.ndf''
    TO FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';'
    EXEC sp_executeSQL @nSQL;
    SET @x = @x + 1;
    END
    -- 003. Create partition function and schema
    --:SETVAR TableName "TestTable"
    --:SETVAR DatabaseName "workspace"
    USE $(DatabaseName);
    CREATE PARTITION FUNCTION $(TableName)_func (int)
    AS RANGE RIGHT FOR VALUES
    0,
    15,
    30,
    45,
    60
    CREATE PARTITION SCHEME $(TableName)_scheme
    AS
    PARTITION $(TableName)_func
    TO
    $(TableName)_fg1,
    $(TableName)_fg2,
    $(TableName)_fg3,
    $(TableName)_fg4,
    $(TableName)_fg5,
    $(TableName)_fg6
    -- Create TestTable
    --:SETVAR TableName "TestTable"
    --:SETVAR BackupDrive "D:\SQL\Backups\"
    --:SETVAR DatabaseName "workspace"
    CREATE TABLE [dbo].$(TableName)(
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_scheme(Partition_PK)
    ) ON $(TableName)_scheme(Partition_PK)
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_GUID_PK] DEFAULT (newid()) FOR [GUID_PK]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateServer] DEFAULT (@@servername) FOR [CreateServer]
    -- 004. Create and populate a test table
    -- Load TestTable Data - Seconds 0-59 are used as the Partitoning Key
    --:SETVAR TableName "TestTable"
    SET NOCOUNT ON;
    DECLARE @Now DATETIME = GETDATE()
    WHILE @Now > DATEADD(minute,-1,GETDATE())
    BEGIN
    INSERT INTO [dbo].$(TableName)
    ([Partition_PK]
    ,[RandomNbr])
    VALUES
    DATEPART(second,GETDATE())
    ,ROUND((RAND() * 100),0)
    END
    -- Confirm table partitioning - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber
    --=================================================================================
    -- SECTION 2 - SWITCH OUT
    -- 001 - Create TestTableOut
    -- 002 - Switch out partition in range 0-14
    -- 003 - Merge range 0 -29
    -- 001. TestTableOut
    :SETVAR TableName "TestTable"
    IF OBJECT_ID('dbo.$(TableName)Out') IS NOT NULL
    DROP TABLE [dbo].[$(TableName)Out]
    CREATE TABLE [dbo].[$(TableName)Out](
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)Out] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_fg2;
    GO
    -- 002 - Switch out partition in range 0-14
    --:SETVAR TableName "TestTable"
    ALTER TABLE dbo.$(TableName)
    SWITCH PARTITION 2 TO dbo.$(TableName)Out;
    -- 003 - Merge range 0 - 29
    --:SETVAR TableName "TestTable"
    ALTER PARTITION FUNCTION $(TableName)_func()
    MERGE RANGE (15);
    -- Confirm table partitioning
    -- Original source of this query - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber  
    The table below shows the results of the ‘Confirm Table Partitioning’ query, before and after the MERGE.
    The T-SQL code below illustrates the problem.
    -- PartitionLab_RangeRight
    USE workspace;
    DROP TABLE dbo.TestTableOut;
    USE master;
    ALTER DATABASE workspace
    REMOVE FILE TestTable_f3 ;
    -- ERROR
    --Msg 5042, Level 16, State 1, Line 1
    --The file 'TestTable_f3 ' cannot be removed because it is not empty.
    ALTER DATABASE workspace
    REMOVE FILE TestTable_f2 ;
    -- Works surprisingly!!
    use workspace;
    ALTER INDEX [PK_TestTable] ON [dbo].[TestTable] REBUILD PARTITION = 2;
    --Msg 622, Level 16, State 3, Line 2
    --The filegroup "TestTable_fg2" has no files assigned to it. Tables, indexes, text columns, ntext columns, and image columns cannot be populated on this filegroup until a file is added.
    --The statement has been terminated.
    If you run ALTER INDEX REBUILD before trying to remove files from File Group 3, it works. Rerun the database setup script then the code below.
    -- RANGE RIGHT
    -- Rerun PartitionLabSetup_RangeRight.sql before the code below
    USE workspace;
    DROP TABLE dbo.TestTableOut;
    ALTER INDEX [PK_TestTable] ON [dbo].[TestTable] REBUILD PARTITION = 2;
    USE master;
    ALTER DATABASE workspace
    REMOVE FILE TestTable_f3;
    -- Works as expected!!
    The file in File Group 2 appears to contain data but it can be dropped. Although the system views are reporting the data in File Group 2, it still physically resides in File Group 3 and isn’t moved until the index is rebuilt. The RANGE RIGHT function means
    the left file group (File Group 2) is retained when splitting ranges.
    RANGE LEFT would have retained the data in File Group 3 where it already resided, no INDEX REBUILD is necessary to effectively complete the MERGE operation. The script below implements the same partitioning strategy (data distribution between partitions)
    on the test table but uses different boundary definitions and RANGE LEFT.
    --=================================================================================
    -- PartitionLabSetup_RangeLeft.sql
    -- 001. Create test database
    -- 002. Add file groups and files
    -- 003. Create partition function and schema
    -- 004. Create and populate a test table
    --=================================================================================
    USE [master]
    GO
    -- 001 - Create Test Database
    :SETVAR DataDrive "D:\SQL\Data\"
    :SETVAR LogDrive "D:\SQL\Logs\"
    :SETVAR DatabaseName "workspace"
    :SETVAR TableName "TestTable"
    -- Drop if exists and create Database
    IF DATABASEPROPERTYEX(N'$(databasename)','Status') IS NOT NULL
    BEGIN
    ALTER DATABASE $(DatabaseName) SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    DROP DATABASE $(DatabaseName)
    END
    CREATE DATABASE $(DatabaseName)
    ON
    ( NAME = $(DatabaseName)_data,
    FILENAME = N'$(DataDrive)$(DatabaseName)_data.mdf',
    SIZE = 10,
    MAXSIZE = 500,
    FILEGROWTH = 5 )
    LOG ON
    ( NAME = $(DatabaseName)_log,
    FILENAME = N'$(LogDrive)$(DatabaseName).ldf',
    SIZE = 5MB,
    MAXSIZE = 5000MB,
    FILEGROWTH = 5MB ) ;
    GO
    -- 002. Add file groups and files
    --:SETVAR DatabaseName "workspace"
    --:SETVAR TableName "TestTable"
    --:SETVAR DataDrive "D:\SQL\Data\"
    --:SETVAR LogDrive "D:\SQL\Logs\"
    DECLARE @nSQL NVARCHAR(2000) ;
    DECLARE @x INT = 1;
    WHILE @x <= 6
    BEGIN
    SELECT @nSQL =
    'ALTER DATABASE $(DatabaseName)
    ADD FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';
    ALTER DATABASE $(DatabaseName)
    ADD FILE
    NAME= ''$(TableName)_f' + CAST(@x AS CHAR(5)) + ''',
    FILENAME = ''$(DataDrive)\$(TableName)_f' + RTRIM(CAST(@x AS CHAR(5))) + '.ndf''
    TO FILEGROUP $(TableName)_fg' + RTRIM(CAST(@x AS CHAR(5))) + ';'
    EXEC sp_executeSQL @nSQL;
    SET @x = @x + 1;
    END
    -- 003. Create partition function and schema
    --:SETVAR TableName "TestTable"
    --:SETVAR DatabaseName "workspace"
    USE $(DatabaseName);
    CREATE PARTITION FUNCTION $(TableName)_func (int)
    AS RANGE LEFT FOR VALUES
    -1,
    14,
    29,
    44,
    59
    CREATE PARTITION SCHEME $(TableName)_scheme
    AS
    PARTITION $(TableName)_func
    TO
    $(TableName)_fg1,
    $(TableName)_fg2,
    $(TableName)_fg3,
    $(TableName)_fg4,
    $(TableName)_fg5,
    $(TableName)_fg6
    -- Create TestTable
    --:SETVAR TableName "TestTable"
    --:SETVAR BackupDrive "D:\SQL\Backups\"
    --:SETVAR DatabaseName "workspace"
    CREATE TABLE [dbo].$(TableName)(
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_scheme(Partition_PK)
    ) ON $(TableName)_scheme(Partition_PK)
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_GUID_PK] DEFAULT (newid()) FOR [GUID_PK]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
    ALTER TABLE [dbo].$(TableName) ADD CONSTRAINT [DF_$(TableName)_CreateServer] DEFAULT (@@servername) FOR [CreateServer]
    -- 004. Create and populate a test table
    -- Load TestTable Data - Seconds 0-59 are used as the Partitoning Key
    --:SETVAR TableName "TestTable"
    SET NOCOUNT ON;
    DECLARE @Now DATETIME = GETDATE()
    WHILE @Now > DATEADD(minute,-1,GETDATE())
    BEGIN
    INSERT INTO [dbo].$(TableName)
    ([Partition_PK]
    ,[RandomNbr])
    VALUES
    DATEPART(second,GETDATE())
    ,ROUND((RAND() * 100),0)
    END
    -- Confirm table partitioning - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber
    --=================================================================================
    -- SECTION 2 - SWITCH OUT
    -- 001 - Create TestTableOut
    -- 002 - Switch out partition in range 0-14
    -- 003 - Merge range 0 -29
    -- 001. TestTableOut
    :SETVAR TableName "TestTable"
    IF OBJECT_ID('dbo.$(TableName)Out') IS NOT NULL
    DROP TABLE [dbo].[$(TableName)Out]
    CREATE TABLE [dbo].[$(TableName)Out](
    [Partition_PK] [int] NOT NULL,
    [GUID_PK] [uniqueidentifier] NOT NULL,
    [CreateDate] [datetime] NULL,
    [CreateServer] [nvarchar](50) NULL,
    [RandomNbr] [int] NULL,
    CONSTRAINT [PK_$(TableName)Out] PRIMARY KEY CLUSTERED
    [Partition_PK] ASC,
    [GUID_PK] ASC
    ) ON $(TableName)_fg2;
    GO
    -- 002 - Switch out partition in range 0-14
    --:SETVAR TableName "TestTable"
    ALTER TABLE dbo.$(TableName)
    SWITCH PARTITION 2 TO dbo.$(TableName)Out;
    -- 003 - Merge range 0 - 29
    :SETVAR TableName "TestTable"
    ALTER PARTITION FUNCTION $(TableName)_func()
    MERGE RANGE (14);
    -- Confirm table partitioning
    -- Original source of this query - http://lextonr.wordpress.com/tag/sys-destination_data_spaces/
    SELECT
    N'DatabaseName' = DB_NAME()
    , N'SchemaName' = s.name
    , N'TableName' = o.name
    , N'IndexName' = i.name
    , N'IndexType' = i.type_desc
    , N'PartitionScheme' = ps.name
    , N'DataSpaceName' = ds.name
    , N'DataSpaceType' = ds.type_desc
    , N'PartitionFunction' = pf.name
    , N'PartitionNumber' = dds.destination_id
    , N'BoundaryValue' = prv.value
    , N'RightBoundary' = pf.boundary_value_on_right
    , N'PartitionFileGroup' = ds2.name
    , N'RowsOfData' = p.[rows]
    FROM
    sys.objects AS o
    INNER JOIN sys.schemas AS s
    ON o.[schema_id] = s.[schema_id]
    INNER JOIN sys.partitions AS p
    ON o.[object_id] = p.[object_id]
    INNER JOIN sys.indexes AS i
    ON p.[object_id] = i.[object_id]
    AND p.index_id = i.index_id
    INNER JOIN sys.data_spaces AS ds
    ON i.data_space_id = ds.data_space_id
    INNER JOIN sys.partition_schemes AS ps
    ON ds.data_space_id = ps.data_space_id
    INNER JOIN sys.partition_functions AS pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.partition_range_values AS prv
    ON pf.function_id = prv.function_id
    AND p.partition_number = prv.boundary_id
    LEFT OUTER JOIN sys.destination_data_spaces AS dds
    ON ps.data_space_id = dds.partition_scheme_id
    AND p.partition_number = dds.destination_id
    LEFT OUTER JOIN sys.data_spaces AS ds2
    ON dds.data_space_id = ds2.data_space_id
    ORDER BY
    DatabaseName
    ,SchemaName
    ,TableName
    ,IndexName
    ,PartitionNumber
    The table below shows the results of the ‘Confirm Table Partitioning’ query, before and after the MERGE.
    The data in the File and File Group to be dropped (File Group 2) has already been switched out; File Group 3 contains the data so no index rebuild is needed to move data and complete the MERGE.
    RANGE RIGHT would not be a problem in a ‘Sliding Window’ if the same file group is used for all partitions, when they are created and dropped it introduces a dependency on full index rebuilds. Larger tables are typically partitioned and a full index rebuild
    might be an expensive operation. I’m not sure how a RANGE RIGHT partitioning strategy could be implemented, with an ascending partitioning key, using multiple file groups without having to move data. Using a single file group (multiple files) for all partitions
    within a table would avoid physically moving data between file groups; no index rebuild would be necessary to complete a MERGE and system views would accurately reflect the physical location of data. 
    If a RANGE RIGHT partition function is used, the data is physically in the wrong file group after the MERGE assuming a typical ascending partitioning key, and the 'Data Spaces' system views might be misleading. Thanks to Manuj and Chris for a lot of help
    investigating this.
    NOTE 10/03/2014 - The solution
    The solution is so easy it's embarrassing, I was using the wrong boundary points for the MERGE (both RANGE LEFT & RANGE RIGHT) to get rid of historic data.
    -- Wrong Boundary Point Range Right
    --ALTER PARTITION FUNCTION $(TableName)_func()
    --MERGE RANGE (15);
    -- Wrong Boundary Point Range Left
    --ALTER PARTITION FUNCTION $(TableName)_func()
    --MERGE RANGE (14);
    -- Correct Boundary Pounts for MERGE
    ALTER PARTITION FUNCTION $(TableName)_func()
    MERGE RANGE (0); -- or -1 for RANGE LEFT
    The empty, switched out partition (on File Group 2) is then MERGED with the empty partition maintained at the start of the range and no data movement is necessary. I retract the suggestion that a problem exists with RANGE RIGHT Sliding Windows using multiple
    file groups and apologize :-)

    Hi Paul Brewer,
    Thanks for your post and glad to hear that the issue is resolved. It is kind of you post a reply to share your solution. That way, other community members could benefit from your sharing.
    Regards.
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Table cells - Problem with merged cells

    Hi
    I was experiencing very weird behavior with my tables until I realized that it was caused by merged cells
    My script gives a dialog which allows the user to choose from which column to start and from which row.
    As the script iterates through the cells in the selection I was getting weird results
    Through using .select() function I was able to see that depending on the column, some times row 5 could be which seems to be row 3!
    The reason was because of merged cells in that row
    I.e., when some cells are merged together, only the first column of those merged cells is recognized - the others are not
    so it comes out that when merging cells from column 3 to 5, column 3 has a cell in that row, columns 4 and 5 do not, and column 6 does!
    Is there a way to get around this behavior?
    Thanks
    Davey

    I don't understand the point of your post.
    If you're trying to report a problem or "bug" with Pages, that is not the purpose of this user-to-user forum. You should leave feedback for the Pages team on this page.
    I've not had a problem opening Word files with tables in Pages. If you're saying Word can't handle tables with merged cells, then don't use merged cells in files you are going to export as Word. Word & Pages must handle merged table cells differently, as I know both can do that. As far as RTF, Pages can open & export as RTF. Again, if you are going to export as RTF, don't use tables. Neither of these is a fault of Pages, just limitations of the formats/programs.

  • Table Filter Problem with Operators And ,Or

    Hi ,
    Version : Jdeveloper 11.1.1.5
    I Created one view object based on query( Select Empno,Ename From Emp)
    Based on View Object - I created adf table .
    In Emp table data is as shown below
    Empno Ename
    1 Hari
    2 Ramu and Hari
    I made "Filterable" Property true and FilterFeature is CaseInsensitive
    When i query 'Ramu a' it will retrive correctly,if i query 'Ramu and' it will show no data to display
    Please suggest me how to solve
    Note : What i noticed is and ,or are treating as operators
    Thanks
    Sk

    Hi,
    tried the same with JDeveloper 11.1.1.6 and it works without problems. The only problem that will arise is if you search for e.g. "Mickey and" to find Mickey and Mouse. Here "and" is recognized as a reserved keyword. However, you work around this by using "Mickey an". Note that you can intercept the table query using a QueryListener to handle cases where key words are used within a string
    Frank
    Edited by: Frank Nimphius on Apr 27, 2012 7:55 AM

  • How to add round image inside the table column? with different background color, column value should appear in the middle of the round portion.

    Hi
    This question is related to table component implementation.
    I want to display the column values inside the small round image with different colors and value should appear in the middle.

    Hi,
    >>1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
    2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
    3.how to make my column headers in bold?<<
    I’m sorry for the issue that you are hitting now.
    This itextsharp is third party control, for this issue, I recommended to consult the control provider directly, I think they can give more precise troubleshooting.
    http://sourceforge.net/projects/itextsharp/
    Thanks for your understanding.
    Regards,
    Marvin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Temp Tables space problem with ORA-01114 and  ORA-27072:

    RDBMS :Oracle:9.2.0
    OS: Linux AS3
    Storage: SAND arrray (RAID 5)
    Problem on exeuting dml statement
    SQL> select * from myview ;
    select * from myview
    ERROR at line 1:
    ORA-01114: IO error writing block to file 201 (block # 3977)
    ORA-27072: skgfdisp: I/O error
    Linux Error: 28: No space left on device
    Additional information: 3976
    ORA-01114: IO error writing block to file 201 (block # 3977)
    ORA-27072: skgfdisp: I/O error
    Linux Error: 28: No space left on device
    Additional information: 3976
    With Regards
    Joy

    Hello joy,
    So, still looking for solution. I suggest you a sloution and it works well only if as you mentioned (in your previous post) that file causing error is temp file. So, get rid of this better you create new temporary table space and drop old one and then delete the old files manually.
    But this will work only for Temp Tablespace not for normal tablespaces and datafiles. Prepare new temporary tablespace at different location from the previous one, try to make it on different disk beacuse it may be due to corruption of physical medium too.
    Try this. If it works... you are through... otherwise i have no other options...
    Please update.....

  • Table/div problem with IE

    I am building a 'planner' in a table and it looks okay in
    Firefox but not in IE. It's a work in progress but IE doesn't allow
    the table to align properly and help would be appreciated.
    Also, the table and left menu reside in a div (container2)
    which I set at 1900px width. Is there another way to determine its
    size or do I just add the components (menu plus centrebody).
    The page is located at
    http://members.optuszoo.com.au/csteed/4R%20Conference/3day-program.html
    Thanks, Chris
    Disregard - fixed the problem.

    csteed posted in macromedia.dreamweaver:
    > I am building a 'planner' in a table and it looks okay
    in Firefox but
    > not in IE. It's a work in progress but IE doesn't allow
    the table to
    > align properly and help would be appreciated.
    I'm not seeing the problem in IE7. Perhaps if you add the
    missing closing
    </div> tags and fix the other errors, it will help.
    Enter your URL into this page to see the errors:
    http://validator.w3.org/
    > Also, the table and left menu reside in a div
    (container2) which I set
    > at 1900px width. Is there another way to determine its
    size or do I
    > just add the components (menu plus centrebody).
    With the page as it is now, I don't think you need to specify
    the width at
    all. I didn't see any difference in FF when I deleted that
    line in your CSS,
    anyway.
    > The page is located at
    >
    http://members.optuszoo.com.au/csteed/4R%20Conference/3day-program.html
    Mark A. Boyd
    Keep-On-Learnin' :)

  • Possible Corruption in old Oracle 9i table - Fixed problem with WinXP Mode

    EDIT: This was not a corruption in my database. It was a communication problem between Windows 7 (where my app runs) and Windows XP Mode (where my Oracle 9i database runs). Skip to the bottom of page 2 to see the solution I found.
    I have an old program that I use constantly. It connects to an Oracle 9i database (version 9.2.0.5). Within the past month, one of the processes has slowed to a crawl. This process saves an Excel file to an Oracle table. The files are no larger than 6MB. The field that holds the spreadsheet is a LONG RAW data type. I cannot figure out why the process is taking to long now. It takes up to an hour to save the file to the table. The code has not changed. Here's what I've tried so far. I'm not an Oracle DBA.
    1. Tried running VALIDATE STRUCTURE on table and all indexes. No corruption found.
    2. Tried truncating the table to remove all existing data. No change.
    3. Tried running DBMS_REPAIR on table. No corruption found.
    4. Tried running DB_VERIFY on all data files. No corruption found.
    5. Tried dropping and recreating the table with no data in it. No change.
    I'm not sure that this is a corruption problem, but I can't think of what else has changed. Nothing has happened recently that should have caused this.
    What else can I look for?
    Thank you for your help.
    EDIT: Changed title to help other people using Oracle in WinXP Mode find this solution.

    JavaUser wrote:
    I figured out how to turn on tracing for my Java program at the point where it is taking a very long time. The trace shows that it takes 205.66 second to execute my INSERT statement. Here is the trace output translated by TKProf for this INSERT statement:
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      2.18     205.66          0         75        508           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      2.18     205.66          0         75        508           1
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSEI'm seeing how long the query is taking, but I'm not seeing why. What else should I be looking for?
    Thanks for your help!
    Edited by: JavaUser on Apr 18, 2012 2:32 PMtwo different ways below
    DBMS_SESSION.SESSION_TRACE_ENABLE(TRUE,TRUE,'ALL_EXECUTIONS');
    alter session set events '10046 trace name context forever, level 12';
    -- invoke the SQL code
    DBMS_SESSION.SESSION_TRACE_ENABLE(FALSE,FALSE,NULL);
    DBMS_MONITOR.SESSION_TRACE_ENABLE(
        session_id   IN  BINARY_INTEGER DEFAULT NULL,
        serial_num   IN  BINARY_INTEGER DEFAULT NULL,
        waits        IN  BOOLEAN DEFAULT TRUE,
        binds        IN  BOOLEAN DEFAULT FALSE,
        plan_stat    IN  VARCHAR2 DEFAULT NULL);

  • LOV table column filter with bind variable

    Greetings everyone,
    I am using JDev version: 11.1.2.3.0
    I have a table which has all it's columns with filterable property set to 'true'. I have already created a filter for the first one which displays the total list of users registered in the system. But the second one is a bit more complex.
    I want to display a LOV which takes it's values from a VO with a bind variable. In a normal situation there is a another VO which links one of it's properties to this bind var in the View Accessor section of the LOV configuration dialog just like this:
    http://2.bp.blogspot.com/_OSq71i5oy0c/SUa6qdnkkoI/AAAAAAAABnY/QnBPmGFgLI4/s400/3.PNG
    But i want to be able to display this LOV in a column filter, the code i used is this:
    <f:facet name="filter">
                             <af:selectOneChoice value="#{vs.filterCriteria.Debtor}"
                                    label="Debtor" unselectedLabel=""
                                     id="soc104">
                                                                            <af:forEach items="#{bindings.ContractPartiesView1.rangeSet}"
                                                                                        var="debtors">
                                                                                <f:selectItem id="si104"
                                                                                              itemLabel="#{debtors.Name}"
                                                                                              itemValue="#{debtors.PartyNumber}"/>
                                                                            </af:forEach>
                                                                        </af:selectOneChoice>
                                                                    </f:facet>
    Where Name is the name of the items to display, and PartyNumber is the value by which the table property (column) Debtor is connected to ContractPartiesView1 (the DC of the first VO).
    It doesn't display nothing, and i suppose this is due the fact that ContractPartiesView1 has that bind variable which stays uninitialized.
    I need to find a way to initialize this bind variable to get the filtered values for the LOV. I've tried to use a listOfValue binding insted of a tree, but with no result. Am i missing something?
    Thanks in advance

    I had resolved this, the very next day, but i didn't have chance to reply.
    I've simply created another VO, which didn't have a bind variable to get that ID, it was simply linked with a master detail relationship with the one it should get the ID from (via FK). I've created this other VO because the first one was already in use for some other requirement.

  • Globle table  data  problem with pragma autonomous_tranaction

    hi gurus,
    i have  two globle table both having   preserve  row on commit
    g_emp ;
    g_hop_brk ;
    in  procedure
       i m populating   g_emp  then  on this table  doing some manipulation
       loop
    i m calling function  which  have  pragma autonomous_tranaction;
                   this function is
                  is now referring  g_emp ;
                   inserting into  g_hop_brk  ;
               commit ;
    loop end
      now fetching data from  g_hop_brk   ;
    end procedure ;
    with this logic i m not  getting value  when loop runs first time but from 2nd time i m getting value ,
    please tell me why its happening ,
    how to make work
    thanks

    On the second iteration of the loop, the parent transaction has committed after the first iteration, so some data will be visible.
    If you are merely trying to log the value the function is going to return, the function itself should not be an autonomous transaction. A separate procedure should be created to log the return value, that procedure should be an autonomous transaction, and the procedure should be called just before you return, i.e.
    CREATE OR REPLACE PROCEDURE log_something( p_return_val IN NUMBER )
      PRAGMA autonomous_transaction
    IS
    BEGIN
      INSERT INTO log_table ...
      commit;
    END;
    CREATE OR REPLACE FUNCTION your_function( some_parameters )
      RETURN something
    IS
      l_ret_val number;
    BEGIN
      log_something( l_ret_val );
      RETURN l_ret_val;
    END;The procedure never has to query any tables, so the fact that it can't see the parent's uncommitted changes is irrelevent.
    Justin

  • Trying to list table column names with data type

    I have a list of table names and need to output the fields and their type.  So I tried the code below but getName() returns string even when I know the field is an int.  So I'm assuming I'm using the wrong function.  I looked at the output from getMethods() but I didn't see anything else that would return the information I want.  TIA.
    <cfset TableList = "accountingsettings,address,area,areasettings">
    <cfloop from="1" to="#Listlen(TableList)#" index="i">
    <cfquery datasource="axxerion" name="getTablename">
    select * from #Listgetat(TableList, i)#
    where 0<>0
    </cfquery>
    <cfset colHeaderNames = ArrayToList(getTablename.getColumnList())/>
    <cfoutput>
    <p><b>#Listgetat(TableList, i)# #getTablename.getMetaData().getColumnCount()#</b></p>
    <ul>
    <cfloop from="1" to="#Listlen(colHeaderNames)#" index="x">
    <cfdump var="#getMetaData(Listgetat(colHeaderNames,x)).getmethods()#">
    <li>#Listgetat(colHeaderNames,x)# #getMetaData(Listgetat(colHeaderNames,x)).getName()# </li>
    </cfloop>
    </ul>
    </cfoutput>
    </cfloop>
    Returns
    accountingsettings 22
    ID java.lang.String
    BINENTRYID java.lang.String
    CLIENTID java.lang.String
    CREATESYSTEMUSERID java.lang.String
    CREATETIME java.lang.String
    DEPRECIATIONYEARS java.lang.String
    POSTNOTAPPROVED java.lang.String
    REGIONID java.lang.String
    RESIDUALVALUE java.lang.String
    REVISION java.lang.String
    UPDATESYSTEMUSERID java.lang.String
    UPDATETIME java.lang.String
    DUPLICATEREFERENCES java.lang.String
    STRICTMODE java.lang.String
    CONSOLIDATEINVOICEITEMS java.lang.String
    AUTOACCOUNTINGPERIOD java.lang.String
    INVOICEDESCRIPTION java.lang.String
    POSTREQUIRED java.lang.String
    CONSOLIDATEOUTINVOICEITEMS java.lang.String
    PAYMENTDIFFERENCECATALOGITEMID java.lang.String
    ACCOUNTINGPERIODLENGTHCODE java.lang.String
    CREDITPAYMENTS java.lang.String

    So I'm assuming I'm using the wrong function. 
    You are using GetMetaData() incorrectly. It returns an array of structures. Cfloop through the returned array, and output the #name# and #typeName# keys.
    But .. if you only need the column metadata. Dan's suggestion of using cfdbinfo would seem more appropriate here.

Maybe you are looking for

  • APEX and CLOB value in trigger

    Hi, I am using APEX 3.2.1 with Oracle 11gR1. I have two tables: CREATE TABLE "TSI"."ATT_TEST2" (     "ID" NUMBER NOT NULL ENABLE,      "TITLE" VARCHAR2(250 BYTE),      "TOPIC" CLOB and CREATE TABLE "TSI"."ATT_TEST2" (     "ID" NUMBER NOT NULL ENABLE,

  • Unlocking windows files doesn't work

    Hi, I went to print some projects yesterday and my usb drive got a virus or two. Usually I would just unlock the files in Leopard and trash them, but I can't unlock the files with Snow Leopard. Any help? Thanks, Jaco

  • Syncing removes purchased apps from iPhone

    Can anyone tell me how to stop purchased apps just disappearing from my iPhone when I sync with my laptop? Thanks!

  • Vertical spacing between paragraphs

    Hello experts, I am having trouble closing up the space between a title and a subtitle that needs to have a different style. I am usingCSS. Line spacing seems to work only on the vertical space between lines within a paragraph, not between paragraphs

  • Account disabled by Apple

    My account was disabled due to fraudulent charges. How do I get it back on?