Syntax of DDL options and related (table) column names

Hi,
where can I find something like a mapping between DDL options and related table column names?
For example I do have the table options PCTFREE, FREELISTS and NOCOMPRESS. The related table columns out of user_tables are PCT_FREE, FREELIST and COMPRESS.
PCT(_)FREE wins an Underscore, FREELIST(S) wins an "S" and it is "NOCOMPRESS" if COMPRESS has a value "Y(es)".
Hope somebody can help.

So far I didn't find any information that is not in
the DDL script gernerated from
DBMS_METADATA.get_DDL.Alright, I give you an example:
I create a table with the following DDL:
"CREATE TABLE IntBuch (
int_bunr integer NOT NULL,
int_sdat double precision NOT NULL,
int_hblz char(8) NOT NULL,
int_hkto char(7) NOT NULL,
int_hdat double precision NOT NULL,
KtoNr char(7) NOT NULL,
BLZ char(8) NOT NULL,
CONSTRAINT PK_IntBuch PRIMARY KEY (int_bunr)
USING INDEX
PCTFREE 10
STORAGE (
INITIAL 1000
NEXT 500
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 4096
PCTFREE 20
LOGGING
CREATE UNIQUE INDEX intid
ON IntBuch (int_bunr DESC)
CREATE INDEX hkto
ON IntBuch (int_hblz,int_hkto)
COMMENT ON TABLE IntBuch
IS 'Kommentar zu DB-Tabelle InBuch'
COMMENT ON COLUMN IntBuch.int_sdat IS 'Kommentar zu DB-Spalte int_sdat'
ALTER TABLE IntBuch
ADD CONSTRAINT Gutschrift FOREIGN KEY (int_hkto,int_hblz) REFERENCES Konto
ON DELETE CASCADE
ADD FOREIGN KEY (KtoNr,BLZ) REFERENCES Konto
ADD FOREIGN KEY (int_bunr) REFERENCES Buchung
ON DELETE CASCADE
After that I read the DDL with DBMS_METADATA.get_DDL and I get
" CREATE TABLE "UOENDE"."INTBUCH"
(     "INT_BUNR" NUMBER(*,0) NOT NULL ENABLE,
     "INT_SDAT" FLOAT(126) NOT NULL ENABLE,
     "INT_HBLZ" CHAR(8) NOT NULL ENABLE,
     "INT_HKTO" CHAR(7) NOT NULL ENABLE,
     "INT_HDAT" FLOAT(126) NOT NULL ENABLE,
     "KTONR" CHAR(7) NOT NULL ENABLE,
     "BLZ" CHAR(8) NOT NULL ENABLE,
     CONSTRAINT "PK_INTBUCH" PRIMARY KEY ("INT_BUNR")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 16384 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE,
     CONSTRAINT "GUTSCHRIFT" FOREIGN KEY ("INT_HKTO", "INT_HBLZ")
     REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ON DELETE CASCADE ENABLE,
     FOREIGN KEY ("KTONR", "BLZ")
     REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ENABLE,
     FOREIGN KEY ("INT_BUNR")
     REFERENCES "UOENDE"."BUCHUNG" ("BU_NR") ON DELETE CASCADE ENABLE
) PCTFREE 20 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
If there are no more DDLOptions possible than that, it is fine for me. If not, but all kinds of options are to find in only one or two tables of the database ( user_tables for table options, dba_constraints and dba_segments for column options, primary and foreign keys, user_indexes and user_segments for indexes ...), that is fine for me, too. (As long as I get to know which tables are "sufficient" for that.) If it is different than both of that, that's bad.
However if you want to use defaults instead of
absolut values, it is better to remove certain parts,
like the storage clause, from the generated output.I understand this, but I am more interested to have all and not leaving out some of them in order to have the defaults in the database after running the DDL.
A totally different approach could be to
a) create a database link from one DB to another.
b) create table <new_table> as select * from
<old_table@dbLink> where 1=2;I keep that in mind, thanks for that hint.

Similar Messages

  • Function with for loop and parameter table/column names ... syntax help

    I'm trying to create a function that returns the distinct values and counts from a user defined schema/table/column.
    The code below defines an object type [stats_on_column_obj] and creates a single table of this type [stats_on_column_tab].
    The function is supposed to take three input variables: p_schema_name, p_table_name, p_column_name and return a table (above).
    I can hard code a SELECT statement into the () ... but once I try to convert it to parameters & exec immediate I am stuck. The red section is where the issue is (i think).
    Oracle 10g.
    CREATE TYPE stats_on_column_obj IS OBJECT(
      COL_VAL      VARCHAR2(500),
      COL_VAL_CNT  NUMBER    (7)
    CREATE TYPE stats_on_column_tab IS TABLE OF stats_on_column_obj;
    CREATE OR REPLACE FUNCTION get_STATS_ON_COLUMN
       p_schema_name IN varchar2,
       p_table_name IN varchar2,
       p_column_name IN  varchar2
       RETURN STATS_ON_COLUMN_tab
    IS
       l_STATS_ON_COLUMN_tab   STATS_ON_COLUMN_tab := STATS_ON_COLUMN_tab ();
       n                       INTEGER := 0;
       str_select_tbl          varchar2(5000);
    BEGIN
       str_select_tbl := 'SELECT '||p_column_name||' as col_val, count(*) as col_val_cnt FROM '||p_schema_name||'.'||p_table_name||' group by '||p_column_name;
       FOR r IN (str_select_tbl)
       LOOP
          l_STATS_ON_COLUMN_tab.EXTEND;
          n := n + 1;
          l_STATS_ON_COLUMN_tab (n) := STATS_ON_COLUMN_obj (r.col_val, r.col_val_cnt);
       END LOOP ;
       RETURN l_STATS_ON_COLUMN_tab;
    END;
    [Error] PLS-00103 (124: 4): PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:   * & - + / at mod remainder rem .. <an exponent (**)> ||   multiset year DAY_
    [Error] PLS-00103 (126: 9): PLS-00103: Encountered the symbol "=" when expecting one of the following:   constant exception <an identifier>   <a double-quoted delimited-identifier> table LONG_ double ref   char time timestam
    [Error] PLS-00103 (127: 29): PLS-00103: Encountered the symbol "(" when expecting one of the following:   constant exception <an identifier>   <a double-quoted delimited-identifier> table LONG_ double ref   char time timestam
    [Error] PLS-00103 (128: 4): PLS-00103: Encountered the symbol "END" when expecting one of the following:   begin function package pragma procedure subtype type use   <an identifier> <a double-quoted delimited-identifier> form
    SELECT * FROM TABLE (get_STATS_ON_COLUMN('SCHEMAS_X','TABLE_X','COLUMN_X'));

    SCOTT@orcl > CREATE OR REPLACE
      2    FUNCTION get_STATS_ON_COLUMN(
      3                                 p_schema_name IN varchar2,
      4                                 p_table_name IN varchar2,
      5                                 p_column_name IN  varchar2
      6                                )
      7      RETURN STATS_ON_COLUMN_tab
      8      IS
      9          v_STATS_ON_COLUMN_tab STATS_ON_COLUMN_tab := STATS_ON_COLUMN_tab ();
    10          v_n                   INTEGER := 0;
    11          v_str_select_tbl      VARCHAR2(5000);
    12      BEGIN
    13          v_str_select_tbl := 'SELECT stats_on_column_obj(' || p_column_name || ',count(*)) FROM ' ||
    14                              p_schema_name || '.' || p_table_name || ' group by ' || p_column_name;
    15      EXECUTE IMMEDIATE v_str_select_tbl
    16        BULK COLLECT
    17        INTO v_STATS_ON_COLUMN_tab;
    18       RETURN v_STATS_ON_COLUMN_tab;
    19  END;
    20  /
    Function created.
    SCOTT@orcl > select  *
      2            from  table(
      3                        get_STATS_ON_COLUMN(
      4                                            'SCOTT',
      5                                            'EMP',
      6                                            'JOB'
      7                                           )
      8                       )
      9  /
    COL_VAL              COL_VAL_CNT
    CLERK                          4
    SALESMAN                       4
    PRESIDENT                      1
    MANAGER                        3
    ANALYST                        2
    SCOTT@orcl >
    Or better change it to pipelined function.
    SY.

  • Object Tables and Relational Tables

    the statement below are they true for both Object and Relational tables?
    Rows are stored in extents
    can rows can be made up of one column
    collection types can be used in a column
    Thanks!

    >
    Rows are stored in extents
    >
    Yes - in the sense that rows are stored in 'blocks' and extents are comprised of one or more blocks. So since rows are in blocks and blocks are in extents then rows are in extents.
    >
    can rows can be made up of one column
    >
    Yes
    CREATE TABLE ONE_COLUMN_TABLE (NAME VARCHAR2(30));collection types can be used in a column
    >
    yes
    CREATE TYPE num_varray AS VARRAY(10) OF NUMBER(12, 2)
    CREATE TABLE varray_table (col1 num_varray)
    INSERT INTO varray_table VALUES (num_varray(100, 200))

  • How to save and retrive table column values added via view enhancement

    Hi,
    I want to enhance standard webdynpro component FITE_VC_REVIEW.
    I want to add new column to Fight Info Table and also to Hotel Info table.I can do UI changes via view enhancement .
    First Approach: I add new fields to Flight Info and Hotel Info structure.
    Create an additional Coolum in Flight Info and Hotel Info Table and Bind it to newly created field in structures.
    Question :
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    Second Approach: I create a new table/structure for my requirement and bind table column to these fields.
    Question:
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    And which approach will be good.
    Regards,
    Madhvika

    no ans yet

  • How to save and retrieve table column values added via view enhancement

    Hi,
    I want to enhance standard webdynpro component FITE_VC_REVIEW.
    I want to add new column to Fight Info Table and also to Hotel Info table.
    First Approach: I add new fields to Flight Info and Hotel Info structure.
    Create an additional Coolum in Flight Info and Hotel Info Table and Bind it to newly created field in structures.
    Question
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    Second Approach: I create a new table/structure for my requirement and bind table column to these fields.
    Question:
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    And which approach will be good.
    Regards,
    Madhvika
    Moderator message: please have a look in the dedicated "Web Dynpro ABAP" forum.
    Edited by: Thomas Zloch on Feb 16, 2011 3:02 PM

    no ans yet

  • Passing SELECT-OPTIONS and Internal Tables to SUBROUTINES

    Hi Guys
    In the code below my colleague has created her own table types in order to pass a select option and internal tables to her subroutine. Is there an easier way of making them known to the subroutine.
    data : v_vbeln type vbeln_vf,
          it_bdoc type table of vbrp,
          it_t006 type table of t006a,
          wa_bdoc type vbrp,
          wa_t006 type t006a,
          it_bdoc2 type table of zsswathi_st_vbeln,
          wa_bdoc2 type zsswathi_st_vbeln
    select-options s_vbeln for v_vbeln matchcode object zswathi_vbeln obligatory.
    start-of-selection.
    perform bdoc using s_vbeln[]
                 changing it_bdoc
                          it_bdoc2
                          it_t006.
      loop at it_bdoc2 into wa_bdoc2.
    form bdoc using f_s_vbeln type ZSWATHI_ST_SELECT_OPTION_TA_TY       " all these are table types. for select options, a structure is created and then a table type for it is created.
            changing f_it_bdoc type zswathi_vbrp_ty_ta
                     f_it_bdoc2 type zswathi_vbeln_ty_ta
                      f_it_t006 type ZSWATHI_T006_TA_TY.
    select * from vbrp into table f_it_bdoc where vbeln in f_s_vbeln.
          if f_it_bdoc is not initial.
          select  vbeln sum( netwr ) prsdt from vbrp into table f_it_bdoc2 where vbeln in f_s_vbeln group by vbeln prsdt.
          sort f_it_bdoc2 by vbeln.
          "select * from t006a into table it_t006 for all entries in it_bdoc where msehi = it_bdoc-vrkme.
          select * from t006a into table f_it_t006 for all entries in f_it_bdoc where msehi = f_it_bdoc-vrkme.
       endif.
        endform.

    Hi Brett,
    1. you can use a select-options-range in a FORM subroutine also without passing it as a parameter because parameters and select-option range tables are global fields in their program.
    2. If you need a parameter, declare it as type table or type standard table or type any table. You do not need any special table type.
    Regards
    Clemens

  • I need the "Real" Table / Table Column names from a sql view

    Firstly, we have a system with ~1000 tables and ~250 views.  We have field level security on the table columns (in our code)
    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view. 
    I know there are view columns that is not linked to a specific table column, (or concatenation of columns) so those columns can just return NULL.
    From the sample you will see there is a view selecting data from another view.  I know it is not the best sql performance (execution path) but that is another topic on its own.
    I went through a lot of the sys.* stored procs or sys.* views to try and figure out if there is a view that we can use to get the expected results.
    here is the sql code:
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'AliasView2')
    drop view dbo.AliasView2
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'AliasView1')
    drop view dbo.AliasView1
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table4')
    BEGIN
    alter table dbo.Table4
    DROP CONSTRAINT [FK_T4_T3]
    alter table dbo.Table4
    DROP CONSTRAINT [PK_T4_Constraint]
    drop table dbo.Table4
    END
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table3')
    BEGIN
    alter table dbo.Table3
    DROP CONSTRAINT [FK_T3_T2]
    alter table dbo.Table3
    DROP CONSTRAINT [PK_T3_Constraint]
    drop table dbo.Table3
    END
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table2')
    BEGIN
    alter table dbo.Table2
    DROP CONSTRAINT [FK_T2_T1]
    alter table dbo.Table2
    DROP CONSTRAINT [PK_T2_Constraint]
    drop table dbo.Table2
    END
    if
    Exists (select
    * from
    sys.all_objects
    where name =
    'Table1')
    BEGIN
    alter table dbo.Table1
    DROP CONSTRAINT [PK_T1_Constraint]
    drop table dbo.Table1
    END
    create
    Table dbo.Table1
    T1_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T1_Constraint]
    PRIMARY KEY (T1_PK),
    T1_Field1    varchar
    NULL,
    T1_Field2    varchar
    NULL,
    create
    Table dbo.Table2
    T2_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T2_Constraint]
    PRIMARY KEY (T2_PK),
    T2_Field1    varchar
    NULL,
    T2_Field2    varchar
    NULL,
    T2_FK        int
    NOT NULL
    CONSTRAINT [FK_T2_T1]
    FOREIGN KEY (T2_FK)
    REFERENCES dbo.Table1
    (T1_PK)
    create
    Table dbo.Table3
    T3_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T3_Constraint]
    PRIMARY KEY (T3_PK),
    T3_Field1    varchar
    NULL,
    T3_Field2    varchar
    NULL,
    T3_FK        int
    NOT NULL
    CONSTRAINT [FK_T3_T2]
    FOREIGN KEY (T3_FK)
    REFERENCES dbo.Table2
    (T2_PK)
    create
    Table dbo.Table4
    T4_PK        int
    NOT NULL
    Identity(1, 1)
    CONSTRAINT [PK_T4_Constraint]
    PRIMARY KEY (T4_PK),
    T4_Field1    varchar
    NULL,
    T4_Field2    varchar
    NULL,
    T4_FK        int
    NOT NULL
    CONSTRAINT [FK_T4_T3]
    FOREIGN KEY (T4_FK)
    REFERENCES dbo.Table3
    (T3_PK)
    GO
    --Create a basic view to select some data
    CREATE
    VIEW dbo.AliasView1
    AS
    select
    t2.T2_FK as Table2_ForeignKey,
    t1.T1_Field1 as Table1_FieldOne,
    t2.T2_Field1 as Table2_FieldOne
    FROM Table1 t1
    Left outer
    join Table2 t2 on t2.T2_FK
    = t1.T1_PK;
    GO
    --Create another view that select basic data, and also selecting data from view 1
    CREATE
    VIEW dbo.AliasView2
    AS
    select
    v1.Table1_FieldOne
    as Table1_FieldOne,     
    v1.Table2_FieldOne
    as Table2_FieldOne,  
    t3.T3_Field1 as Table3_FieldOne,
    t3.T3_Field2 
    FROM Table3 t3
    Left outer
    join AliasView1 v1 on v1.Table2_ForeignKey
    = t3.T3_PK;
    GO
    --My attempt to get the desired output, but no luck
    SELECT 
    col.COLUMN_NAME as AliasColumnName, col.DATA_TYPE, col.CHARACTER_MAXIMUM_LENGTH
    as max_length, colu.*
    FROM
    information_schema.COLUMNS col
    left
    outer join
    (SELECT 
    VIEW_SCHEMA, VIEW_NAME, COLUMN_NAME,
    min(TABLE_NAME)
    as TABLE_NAME
    FROM information_schema.VIEW_COLUMN_USAGE colu
    WHERE VIEW_NAME =
    'AliasView2'
    Group by VIEW_SCHEMA, VIEW_NAME, COLUMN_NAME
    ) COLU ON colU.VIEW_NAME
    = col.TABLE_NAME
    and colu.COLUMN_NAME
    = col.COLUMN_NAME
    left
    outer join
    (select a.name
    as TableName, c.name
    as FieldName
    from sys.foreign_key_columns fk
    join sys.all_objects a
    on a.object_id
    = fk.parent_object_id
    join sys.all_columns c
    on c.object_id
    = a.object_id
    and c.column_id
    = fk.parent_column_id
    join sys.all_objects ar
    on ar.object_id
    = fk.referenced_object_id
    join sys.all_columns cr
    on cr.object_id
    = ar.object_id
    and cr.column_id
    = fk.referenced_column_id
    join sys.schemas scr
    on scr.schema_id
    = ar.schema_id
    ) fks on fks.TableName
    = colu.TABLE_NAME
    and fks.FieldName
    = colu.COLUMN_NAME
    WHERE COL.TABLE_NAME
    = 'AliasView2'
    order
    by col.ORDINAL_POSITION
    This is the results being returned: (That is not 100% what I am looking for)
    AliasColumnName
    DATA_TYPE
    max_length
    VIEW_SCHEMA
    VIEW_NAME
    COLUMN_NAME
    TABLE_NAME
    Table1_FieldOne
    varchar
    1
    dbo
    AliasView2
    Table1_FieldOne
    AliasView1
    Table2_FieldOne
    varchar
    1
    dbo
    AliasView2
    Table2_FieldOne
    AliasView1
    Table3_FieldOne
    varchar
    1
    NULL
    NULL
    NULL
    NULL
    T3_Field2
    varchar
    1
    dbo
    AliasView2
    T3_Field2
    Table3
    The desired results must be like the following:
    AliasColumnName
    DATA_TYPE
    max_length
    VIEW_SCHEMA
    VIEW_NAME
    COLUMN_NAME
    TABLE_NAME
    Table1_FieldOne
    varchar
    1
    dbo
    AliasView2
    T1_Field1
    Table1
    Table2_FieldOne
    varchar
    1
    dbo
    AliasView2
    T2_Field1
    Table2
    Table3_FieldOne
    varchar
    1
    dbo
    AliasView2
    T3_Field1
    Table3
    T3_Field2
    varchar
    1
    dbo
    AliasView2
    T3_Field2
    Table3
    NOTE:  the COLUMN_NAME and TABLE_NAME must the REAL field of the TABLE it belongs to and not only ONE LEVEL Higher’s ALIAS View Name

    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view.
    If you are using SQL Server 2012/2014, then you can use
    sys.dm_exec_describe_first_result_set (Transact-SQL) to gte the informations.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Please help me I am not seeing Database table column names in field explorer view

    Hi,
    I am developing a crystal report using eclipse and sql server. After creating connection, when i drag and drop tables, The table name and its columns should apper in field explorer view. Then we drag the columns onto crystal report. Unfortunately I am just  seeing only table names but not column names in field explorer view. Could anyone help me?
    After downloading eclipse I have plugged in the crystal report using the following instructions
    1. Click on the Help menu, and then Software Updates > Find and Install... to open the Install/Update wizard.
    2. Select Search for new features to install and click Next.
    3. Click the New Remote Site button. This will launch the New Update Site wizard
    4. Type the Business Objects Updsate Site for the Name field and the following for the URL: http://www.businessobjects.com/products/dev_zone/eclipse/
    5. Click OK to complete the wizard.
    6. Enable the newly created Business Objects Update Site checkbox as well as the Callisto Discovery Site (which should appear by default with Eclipse 3.2) and click Finish.
    Expand the Business Objects Update Site node and enable the Crystal Reports for Eclipse 1.0.0v555 checkbox.
    8. Expand the Callisto Discovery Site and click the button "Select Required". This will automatically select the required Eclipse features necessary to successfully install Crystal Reports for Eclipse.
    Thank You
    Rajavardhan Sarkapally

    Now we have a lot of views which select data from the tables, but I need to get the "Table Column Name" that is linked in the view.
    If you are using SQL Server 2012/2014, then you can use
    sys.dm_exec_describe_first_result_set (Transact-SQL) to gte the informations.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Finding source database table/column name for a column in a view

    Hi i need to be able to identify the original database table/column name for a column in a view.
    e.g. say i have a view like this
    create v1 as select a.name fname, b.name bname, c.name cname,......
    from u1.names a, u2.names b. u3.names c
    where .....
    Now I want to find out that the database table/column name for the fname, bname and cname columns in the view v1, which in this instance is u1.name.name, u2.names.name, u3.names.name.
    But i need to be able to do it for any view. Short of parsing the SQL is there an easy way of doing this?
    Now obviusly I can't do this for virtual columns but I will know my column is not virtual as it has an index on it.

    But i need to be able to do it for any view. Short of
    parsing the SQL is there an easy way of doing this?No, parsing the SQL is the only way. Good luck it is not something I would want to attempt.

  • Remain case for table column name

    Hello, i am a java developer. I had helped my company to develop a java application all the while and before this we are using ms sql server database. Recently, we want to migrate the database to oracle database. The problem is, in our application, we use the resultsetmetadata to retrieve all the table column name and respective data and store in hashtable, but in ms sql server the table column name is not all in uppercase. When our application try to get the data using hashtable.get("aColumnName"), it will fail because in oracle the column name is all in uppercase. There are more than 1000 jsp page and java code that used the same method to get data, so if i want to change all the code to uppercase, it will consume a lot of unproductive time, is there any way to solve this?

    I assume that your code builds an SQL statement like "select * from ??? where table_name = '????';".
    If this is correct just wrap the table_name in UPPER(table_name).
    If my assumption is incorrect then please give more information.
    James.

  • Transpose Distinct Date and Use as Column name

    All,
    I am trying to transpose a distinct date and use it as a column name and list the data below it. My version of Oracle does not have the pivot function. Plus I am having trouble with figuring out how to alter the table name to the distinct date. Can someone provide me with logic that will dynamically take the current format (see below) and transpose it to the needed format (see below)?
    Current format:
    WEEK_END_DATE     RD     STORE_NUMBER     RANK
    09-19-2009     R0011     00505     6
    09-19-2009     R0028     00097     97
    09-19-2009     R0057     01801     72
    09-19-2009     R0061     04775     72
    09-19-2009     R0068     03920     66
    09-26-2009     R0011     00505     8
    09-26-2009     R0028     00097     50
    09-26-2009     R0057     01801     120
    09-26-2009     R0061     04775     30
    09-26-2009     R0068     03920     1
    nth date
    The format I need:
    RD     STORE_NUMBER     09-19-2009 09-26-2009 nth date....
    R0011     00505     6 8
    R0028     00097     97 50
    R0057     01801     72 120
    R0061     04775     72 30
    R0068     03920     66 1

    I apprreciate your help. I have tried to implement the dynamic pivot logic. I can create the correct case statement and change the column name to the name I need.
    However, when I try to use @@dynamic_pivot.sql I get the following error:
    ORA-04054: database link ORAEDW@DYNAMIC_PIVOT_SUBSCRIPT does not exist
    I have tried it three ways...
    @@dynamic_pivot
    and @@dynamic_pivot.sql
    and @@c:\dynamic_pivot_subscript.sql
    I don't have direct access to the database. I have to run my queries from toad. When I cut and paste the generated case statements, It works. I am just not able to dynamiclly insert those case statements into a select. Do you have any suggestion?
    -- ***** Start of dynamic_pivot.sql *****
    -- Suppress SQL*Plus features that interfere with raw output
    set feedback off;
    set heading off;
    SPOOL     c:\dynamic_pivot_subscript.sql
    SELECT
    DISTINCT',max(CASE WHEN week_end_date = '''|| week_end_date || ''' THEN rank END) AS '|| 'DATE_AS_OF_' ||
    to_char(week_end_date,'MM_DD_YYYY') AS case
    FROM
    test_ptw_bottom_10;
    SPOOL OFF
    -- Restore SQL*Plus features suppressed earlier
    What I need:
    SELECT     
    rd,
    store_number
    @@c:\dynamic_pivot_subscript.sql
    FROM     
    test_ptw_bottom_10
    where
    week_end_date in ('19-SEP-09','26-sep09')
    group by
    rd,store_number
    ORDER BY     
    rd;
    What works:
    SELECT     
    rd,
    store_number
    ,max(CASE WHEN week_end_date = '26-SEP-09' THEN rank END) AS DATE_AS_OF_09_26_2009
    ,max(CASE WHEN week_end_date = '19-SEP-09' THEN rank END) AS DATE_AS_OF_09_19_2009
    FROM     
    test_ptw_bottom_10
    where
    week_end_date in ('19-SEP-09','26-sep09')
    group by
    rd,store_number
    ORDER BY     
    rd;
    Edited by: user10609947 on Oct 5, 2009 2:36 PM
    Edited by: user10609947 on Oct 5, 2009 2:38 PM

  • Why do I get a class conflict between the Prepare SQL.vi and the Get Column Name.vi with the SQL Toolkit compatibility vis from the Database Connectivity Toolkit?

    I have done extensive programming with the SQL Toolkit with LabVIEW versions through 6.1. My customer now wants to upgrade to Windows 7, so I am trying to upgrade to LabVIEW 2009 (my latest purchased version) using the Database Connectivity Toolkit, and the SQL Toolkit Compatibility vis. Everything seemed to be going okay with the higher level SQL operations, but I ran into trouble with the Get Column Name.vi. 
    The pictures below show the problem. The original SQL Toolkit connected the Prepare SQL.vi with the Get Column Name.vi with a cluster of two references, one for connection, and one for sql. The new compatibility vis have a class conflict in the wire because the Prepare SQL.vi contains a cluster with connection, and command references, but the Get Column Name.vi expects a cluster with connection and recordset references. 
    How do I resolve this conflict?
    Thank You.
    Dan

    I've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
    I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
    Try to take over the world!

  • How to modify a table column name

    Hi all,
    How to modify a table column name...
    Thanks

    could type the command here... but will not do that..because you are supposed to read the docs.
    You can find the command here..
    http://www.faqs.org/docs/ppbook/r22871.htm
    Regards,
    G.

  • How to use simple types for table column names ?

    Hi,
    can any one tell how to to use simple types for table column names?
    It is required in internationalizing of webdynpro applications.
    Regards,
    Rajesh

    Hi,
    1: define required column names in <SimpleType>
    2:use the following code to get those values
    3:bind 'text' property of Column headers to context attributes
    4:take a context attribute 'Value' as type of <SimpleType>
    5:set these values to context attributes
    IWDAttributeInfo objAttrInfo=wdContext.getNodeInfo().getAttribute(IPrivate<ViewName>View.IContextElement.VALUE);
    ISimpleTypeModifiable simple=objAttrInfo.getModifiableSimpleType();
    Map m=simple.getEnumerationTexts();
    Collection c=m.values();
    Iterator it=c.iterator();
    if(it.hasNext())
    wdContext.currentContextElement.set<att1>(it.next().toString);
    if(it.hasNext())
    wdContext.currentContextElement.set<att2>(it.next().toString);
    if(it.hasNext())
    wdContext.currentContextElement.set<att3>(it.next().toString);
    Regards
    LakshmiNarayana

  • Data Model: Relational Tables/Columns Naming Options

    Hello,
    My design consists of several Relational models.
    1. Using Logical model properties, I defined Naming Options (Max. Name Length, Character Case, Valid Characters) applicable to all Entities, Attributes and Views.
    2. But for Relational models, Tables/Columns/Views Naming Options (Max. Name Length, Character Case, Valid Characters) can only be defined per Relational model and not for all the models.
    Question: Is it possible to define Tables/Columns/Views Naming Options (Max. Name Length, Character Case, Valid Characters) applicable to all Relational models? If yes, please inform me.
    Thanks
    Chiedu

    Andrey,
    When You select all the columns, you need to hold the Shift key to select all. Don't let it go to do the copy. So, still holding the shift key, right click for the context menu. The menu only has 2 items, Copy and Delete. Now Copy. Then you can go to the diagram and select paste, to paste them in each of the tables you want those columns to appear in.
    Sue

Maybe you are looking for

  • Send me these qutions of answers

    1. Strengths in technical subject ? 2. Explain best report which u did ? 3. Major events of reports ? 4. Difference between interactive and classical reports ? 5. Types of BDC’s 6. If you say session than why ? 7. If you say call transaction why? 8.

  • EJB jar

    I have a web app with 2 components: 1) servlet and some jsp 2) Stateless Session bean in ejb jar In the jar are two packages 1 contains bean classes (home, remote, bean) the other helper classes. I the helper class package I'm unable to parse an xml

  • How to play dvd on tv

    Have the correct adaptor and lead and can play commercially produced dvd on Mac but tv only shows Mac start-up screen. How do I get the dvd to play on tv please?

  • Has anyone used (or is knowledgeable on) ISG feature? (Intelligent Services Gateway)

    Hi, I am trying to obtain more information about the ISG feature on 7200 and 7600 platforms and finding it very difficult to obtain answers from distributors or even Cisco representatives. The main questions are: - How many subscribers include the 72

  • Document splitting generates lines with alternating +/- signs

    Hi, While trying to post GR through MIRO, I am getting a message like "Document splitting generates lines with alternating +/- signs", please clarify why this error is coming. But I am able to post the moment I am deleting a small amount from planned