MetaData For Database View Columns How ??

SELECT * FROM user_tabs_columns WHERE table_name = 'EMPLOYEES';
The above query will return column information like data_type, lenght etc for the columns in the EMPLOYEE table, how can one retrieve such information on the columns / fields in a view instead of a table. I have views built from several tables, and I use the data returned from quering the views as records displayed to the user in an AJAX application, using the data-grid widget in the said AJAX library. If the user has rights to edit the records, I need to use specific ajax widgets (like a date widget) to edit a field if the datatype information provided by the database is DATE or DATETIME, if the field is nullable, I can permit the user to enter nothing, and I can restrict input length to the lenght of the column. But since the record is spread across several tables and pulled out from a view, I therfore need a way to get the column information on the said view.
How can this be achieved.
Thanks.
Charles Odili.

You should still be able to use the USER_TAB_COLUMNS view to obtain this information. I did a quick test below:
SQL> create view test as select * from all_objects;
View created.
SQL> select table_name,column_name from user_tab_columns where table_name='TEST';
TABLE_NAME                     COLUMN_NAME
TEST                           OWNER
TEST                           OBJECT_NAME
TEST                           SUBOBJECT_NAME
TEST                           OBJECT_ID
TEST                           DATA_OBJECT_ID
TEST                           OBJECT_TYPE
TEST                           CREATED
TEST                           LAST_DDL_TIME
TEST                           TIMESTAMP
TEST                           STATUS
TEST                           TEMPORARY
TEST                           GENERATED
TEST                           SECONDARY
13 rows selected.
SQL> spool off;

Similar Messages

  • Need to know base table and base column name for Oracle view columns

    I am trying to load metadata for some views and that requires me to know what the final table and column name would be corresponding to the view column.
    For example, if I have a view x_v that is select a,b from x_v2; and x_v2 is a view that is select a,b,c from x;
    I need to get the following information.
    View View Col Base Table Base Col
    X_V A X A
    X_V B X B
    and so on.
    Is it possible to get this programmatically using any SYS schema tables or Dependency tables?
    I tried an indirect approach wherein I lock tables using LOCK TABLE or FOR UPDATE OF. But I'm not too sure if I can go down to the level of individual view columns.
    Can you help me with this?

    Thanks. I was looking at some indirect approaches.
    I came up with this script that does it faster than dependencies but thats just for tables and not column mapping.
    declare
    cursor bt(cp_sid number) is
    select u.name uname, o.name oname
    from sys.obj$ o, sys.user$ u
    where o.obj# in (select id1
    from v$lock
    where sid=cp_sid)
    and u.user# =o.owner#;
    cursor c_sid is
    select sid
    from v$session
    where audsid =userenv('sessionid');
    l_sid number;
    l_view varchar2(100):= 'PER_PEOPLE_V';
    l_schema varchar2(10):= 'APPS';
    begin
    open c_sid;
    fetch c_sid into l_sid;
    close c_sid;
    dbms_output.put_line('SID: '||l_sid);
    execute immediate 'lock table '||l_schema||'.'||l_view||' in row share mode nowait';
    for i in bt(l_sid) loop
    dbms_output.put_line(i.uname||'.'||i.oname);
    execute immediate 'alter table '||i.uname||'.'||i.oname||' disable table lock';
    execute immediate 'alter table '||i.uname||'.'||i.oname||' enable table lock';
    end loop;
    end;
    It basically uses locks on views to verify locks on the base tables.
    Just wondering, can we use FOR UPDATE OF statements to get to the columns?

  • Error deploying data tier application to SQL Azure at "Registering metadata for database" step ... should I care?

    I'd like to move an on-premesis SQL Server Database to SQL Azure. I've used SQL Mgmt Studio to Extract Data Tier Application and save my db as a dacpac file. Now I'm connected to my Azure server and I've chosen to Deploy Data Tier Application. I select my
    dacpac and the deploy starts but then on the last step "Registering metadata for database" it times out. I've tried it a couple of times and each time the deployed database is there and appears to be fully populated, but I'm not sure if I can ignore
    that error and continue. What is supposed to happen in that step, and should I expect it to fail when deploying to SQL Azure? 
    I'm following the steps here http://msdn.microsoft.com/en-us/library/hh694043.aspx in the Using Migration Tools > Data-tier Application DAC Package section, except that to deploy there's no SQL Mgmt Studio > Object Explorer [server]
    > Management >"Data Tier Applications" node, so I'm deploying by right-clicking on the server name and choosing "Deploy Data-tier Application". 
    My (total) guess here is that it's deployed the database fine and it's doing whatever magic happens when you register a data tier application, except that it's not working for SQL Azure. 
    I'm running against a server created for the new Azure service tiers, not against a Web/Business edition server. 
    The full details of error I get are below. 
    thanks, 
    Rory
    TITLE: Microsoft SQL Server Management Studio
    Could not deploy package.
    Warning SQL0: A project which specifies SQL Server 2008 as the target platform may experience compatibility issues with SQL Azure.
     (Microsoft.SqlServer.Dac)
    ADDITIONAL INFORMATION:
    Unable to register data-tier application: Unable to reconnect to database: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft.Data.Tools.Schema.Sql)
    Unable to reconnect to database: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft.Data.Tools.Schema.Sql)
    Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft SQL Server, Error: -2)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.9213&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476
    The wait operation timed out
    BUTTONS:
    OK

    Hello,
    The registration process creates a DAC definition that defines the objects in the database, and register the DAC definition in the master system database in Windows Azure SQL Database.
    Based on the error message, there is timeout error when connect to SQL Database. Did you deploy a large database? When move large data to Azure SQL Database, it is recommended to use SQL Server Integration Services (SSIS) and BCP utility.
    Or you can try to create a client application with the Data-Tier Application Framework (DACFx) client tool to import database and handle connection loss it by re-establish the connection.
    Reference: http://sqldacexamples.codeplex.com/
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • Can we poll for database view

    Can we poll for database view using Datbase Adapter?
    Thanks
    Vivek.

    It is recommended NOT to use triggers, without going into too much detail this link provides a very good examples of why not to use triggers
    http://www.oracle.com/technology/oramag/oracle/08-sep/o58asktom.html
    The reason the adapter provides functionality for polling is for the very reason of no dependency in the source system.
    cheers
    James

  • Can do explict join for database view?

    Hi all,
    I would like to ask whether there is a way to specify the join condition to be outer join for database view. It is because I need to map 2 tables in the view and I want to be able to find the record in the view table if the record exists in Table A but not Table B.

    Hi Jaya,
    A Maintenance View helps you to maintain data that is distributed across different or multiple database tables. So, it becomes an easy way to update data and without any programing effort. You can create a Maintenance View across multiple tables with one Table as Primary Table and others as Secondary Tables. But the tables must be related with each other with a Foreign Key Relationship.
    Have a look at the following link which tell you about the procedure of creating the Maintenance Views :
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21ed2d446011d189700000e8322d00/frameset.htm
    Hope this helps.
    Thanks,
    Samantak.

  • How to change the Access for Database views

    Hello Experts,
    My requirement is to copy the records of a standard database view BDCPV (which is a combination of BDCP & BDCPS) to a custom view and then compare the records with a new table BDCP2.
    I copied the BDCPV view to a table and used the custom view in the program. While executing the program, I'm getting an error message like "The database view <View Name> is write protected, so it cannot be changed".
    I'm unable to change the Access under Maintenance Status Tab from Read only to "Read and Change". Could anyone help me how to resolve this issue".
    Also please share teh sample code if you have any for the above requirement. We are using it in a SP upgrade to one of the systems.
    Regards,
    Rajesh.

    Hi,
    Change the status in the given way.
    Choose Extras ® Maintenance status. A dialog box appears, in which you can select the maintenance status for the view. If more than one table is involved in the view, the maintenance status read only cannot be altered.
    Regards,
    Srinivas.

  • Determine if database view column is foreign key in underlying table

    Hi,
    I have posted this same question to the General Database Discussions and JDBC forums.
    I am using Oracle database 10g (10.1.0.4.0 - 64 bit production) standard edition on Red Hat Enterprise Linux AS release 3, JDK 1.4.2 and the latest Oracle JDBC (thin) driver.
    We have a java GUI application that is a front-end for our database. Some of the data entry screens display data from database views. If a column in the view is a foreign key in the underlying table, we want to display a combo-box with the valid values so that the user can choose a correct value.
    Is there some way to know whether a column in a view is a foreign key in the view's underlying table?
    Thanks,
    Avi.

    I take that back.. I did figure something out for ya.. After reading some elses post I wrote this code... but its time to go home... I believe this will show you all the constraints and constraint types for the underlying tables of all the views for a user. You can mess with it and get it to return only FK (constraint_type = 'R') and only for a single view if ya like... The all_dependencies data dictionary view is the key to this whole operation...
    select con.table_name, ucc.column_name, con.constraint_name, con.constraint_type
    from all_constraints con, all_cons_columns ucc
    where con.owner = user and
    con.owner = ucc.owner and
    con.table_name = ucc.table_name and
    con.table_name in
    (SELECT referenced_name
    FROM all_dependencies
    WHERE referenced_owner = USER
    AND referenced_type = 'TABLE'
    AND type = 'VIEW');

  • Explanation for V$ view columns....

    Hi All,
    Is there any data dictionary table or third party tool which explains or has comments on the columns of the V$ views ? i.e. what column shows what info in the V$ views.
    The Dict & Dict_columns tables have comments for all the data dictionay tables but not for V$ views.
    If anyone knows, please enlighten.
    Regards,
    Azhar.

    The Oracle Database Reference has a chapter on the various dynamic performance views.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/toc.htm
    This, along with all the other Oracle documentation, is available online at http://tahiti.oracle.com
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com/askDDBC

  • SSCR for database view

    Dear Guru's,
    M_MCH1M = Generated view for matchcode ID MCH1        -M
    Actually I want to add some fields in this database view .
    So I applied in key values for SSCR.
    PgmID Type Object name:       
    Basis release *       : 700 R3TR
    PgmID *       : R3TR
    Type *       :  VIEW
    Object name * : M_MCH1M
    But I am not getting the Access key for this object.
    Please advice me is there any missing from my end?
    Thanks and B/R
    Bishnu
    04/11

    Dear Krishnendu,
    Thanks for your advice.
    From you first quote:
    Help me to find the access key. is there any mistake in my SSCR request fields.
    Second:
    I need to change in this help view because I am using MIGO.
    Please advice me.
    Thanks and B/R
    Bishnu
    06/11

  • Data type size for the view column

    I am creating a view from base table using substr() for some fields. The data type size of the column in the view becomes twice the size of the corresponding column in the base table. Example
    SQL> create table temp_sat(name varchar2(20));
    Table created.
    SQL> create view temp_view as select substr(name,1,10) name from temp_sat;
    View created.
    SQL> desc temp_view
    Name Null? Type
    NAME VARCHAR2(40)
    Can i specify the size of the column while creating view

    satish asnani wrote:
    I am creating a view from base table using substr() for some fields. The data type size of the column in the view becomes twice the size of the corresponding column in the base table. Example
    SQL> create table temp_sat(name varchar2(20));
    Table created.
    SQL> create view temp_view as select substr(name,1,10) name from temp_sat;
    View created.
    SQL> desc temp_view
    Name                                      Null?    Type
    NAME                                               VARCHAR2(40)Can i specify the size of the column while creating viewHi,
    Which platform and Oracel DB version?
    I had try to replicate, but I can't:
    SQL> create table t_v
      2  (id varchar2(20));
    Tabla creada.
    SQL> desc t_v
    Nombre                                                            ┐Nulo?   Tipo
    ID                                                                         VARCHAR2(20)
    SQL> r
      1  create view v_t_v
      2  as
      3  select substr(id,1,10) id
      4* from t_v
    Vista creada.
    SQL> desc v_t_v
    Nombre                                                            ┐Nulo?   Tipo
    ID                                                                         VARCHAR2(10)John

  • Where can I find metadata for Power View reports created in sharepoint 2013.

    I am looking for what I would assume is the sql server tables that would hold the MDX (DAX) Queries for the power view reports.  Example my customers may create say 30 reports and I need to know quickly if an attribute I am changing is in those reports. 
    How can I find out what report(s) are using that attribute/measure?  Not sure that it matters but using sharepoint 2013 on premise and connecting to Analysis Services (molap).
    Ken Craig

    P.S.  if this is still not making sense create a power view report in SharePoint from a SSAS cube.  Save that power view report in SharePoint.  The power view report should
    have a couple of measures and 1 or 2 dimension.  Open the report just to confirm it is saved correctly.  Now go to SSAS and rename 1 of the measures or dimensions that you used, Save and rebuild your olap .  If it’s a calculated measure
    you just need to save olap.    Now open your power view report and notice that that measure/dimension you changed is no longer in the report. 
    IN one hand it is great that reports do not error and break; however, on the other hand the users might not know what measure/dimension changed and then be lost/mad because the report no longer
    works like they want.  In my opinion it would have been better if the power view broke with an error message that it cannot load because measure x does not exist than to just load fine. 
    In any case I need a method to know when a dimension/measure is modified what reports are using it.   Another example is this could even be a case where the dimension values are getting
    modified and we need to potentially make a update to any power view/pivot using this dimension as a filter? 
    Ken Craig

  • How capture Form Details in XML for a View and how to retrieve in 2nd View

    Hi all
    I have one typical requirement
    in a View i have a form when i submit the form then those form details i need to store (capture) in one form and retrieve the same values from the XML file into another View.
    if anybody worked on this requirement then can you please share the output.
    can anybody have the documents or related sample codes then can please share to me?
    Thanks
    Sunil

    Hi,
    For this you have to create an XML file with the data from your view1 and in form2 call that XML file and read data from the XML file and display...
    below links helps you in reading and creating XML files...
    Reading XML file in web dynpro
    Regards,
    Srinivas

  • How to set "Maximum Lenght" column property for database block at RUNTIME?

    Hi folks,
    Is it possible to somehow set a "Maximum Length" property for database block column at runtime?
    I have a dynamic form, which maintains mostly "STATIC DATA" within all application which are stored in different static data tables (which have similar structure). But now, description column in some of those tables was extended (not in all at this stage). I would like to avoid truncating form error while reading data from those extended tables, so I would like to set an MAXIMUM SIZE to accurate value at the time when I'm specifying TABLE NAME for that database block.
    What property should I use to set it?
       -- before executing query in "MAIN_BLOCK" I always set QUERY_DATA_SOURCE_NAME to user defined value => STATIC DATA TABLE name
       Set_block_Property('MAIN_BLOCK',QUERY_DATA_SOURCE_NAME,:control.table_name);
       Set_block_Property('MAIN_BLOCK',DML_DATA_TARGET_NAME,:control.table_name);
       -- here I would like to set also MAXIMUM LENGHT for particular column (based on some condition, etc.. correct value I can get from ALL_TAB_COLS dictionary
       SET_ITEM_PROPERTY('MAIN_BLOCK.DESCRIPTION', <<XXXXXXX>>, 300);What should I use instead of "<<XXXXXXX>>" if I want to overwrite MAIN_BLOCK.DESCRIPTION column's maximum length to 300?
    Thanks,
    Tomas

    Hi Magoo, thanks for reply.
    Yes, but then user can get other errors while trying to set description with value longer than in database (for all not extended tables).
    Aby idea how to implement SET_CUSTOM_PROPERTY like mentioned here?
    Oracle Forms - "maximum length" property.
    Thanks,
    Tomas

  • Column definition for a specific column in a view

    Is there a way to query the metadata to get the definition of a single column in a view? I can see the complete DDL for a view from USER_VIEWS.TEXT, and I can see the column listing in USER_TAB_COLUMNS to give the datatype etc. However, what I'm looking for is the DDL that defined a specific column.
    So, given:
    create table PERSON (
    SSN VARCHAR2(12),
    FIRST_NAME VARCHAR2(25),
    LAST_NAME VARCHAR2(25),
    STREET VARCHAR2(40),
    CITY VARCHAR2(30),
    STATE VARCHAR2(30),
    ZIP VARCHAR2(15),
    COUNTRY VARCHAR2(35))
    create view PERSON_VW as
    select SSN,
    FIRST_NAME,
    LAST_NAME,
    FIRST_NAME || ' ' || LAST_NAME FULL_NAME
    from PERSON
    I expect the query might look something like:
    select DDL from metadata where table_name = 'PERSON_VW' and column_name = 'FULL_NAME'
    and the result would be: "PERSON.FIRST_NAME || ' ' || PERSON.LAST_NAME"
    or select DDL from metadata where table_name = 'PERSON_VW' and column_name = 'FIRST_NAME'
    and the result would be: "PERSON.FIRST_NAME"
    Thanks!

    >
    Hi again Barry,
    When I queried user_tab_columns (or dba_tab_columns or all_tab_columns), I have the following list of columns:
    TABLE_NAME
    COLUMN_NAME
    DATA_TYPE
    DATA_LENGTH
    DATA_PRECISION
    DATA_SCALE
    NULLABLE
    COLUMN_ID
    DEFAULT_LENGTH
    DATA_DEFAULT
    I don't see anything resembling the DDL for the view column. Somewhere underneath some
    cover I haven't peeked under, Oracle must be keeping track of what it is supposed to be giving
    for, in my example, FULL_NAME.Unless I'm very much mistaken, these columns' data (per table) looks pretty much like DDL to me.
    Maybe what you need is just SQL Developer (great tool, if you don't have it, get it!).
    And it's free (as in beer - not as in speech! :( )
    Beside the connections tab is a "Reports" tab with various, as you might expect ;), reports.
    One of them is on the Tables - with (some) DDL. This will work as a once-off if that's what
    you need?
    Otherwise there's the SQL tab if you open a table under connections - it's very complete - sample
    at bottom of post.
    HTH,
    Paul...
    (Ultimately, I'm diagnosing problems in existing databases that have views already created so
    I don't have the option of considering virtual columns.)Quelle surprise ;(
    Paul...
    -Barry
    CREATE TABLE "HR"."COUNTRIES"
        "COUNTRY_ID"   CHAR(2 BYTE) CONSTRAINT "COUNTRY_ID_NN" NOT NULL ENABLE,
        "COUNTRY_NAME" VARCHAR2(40 BYTE),
        "REGION_ID"    NUMBER,
        CONSTRAINT "COUNTRY_C_ID_PK" PRIMARY KEY ("COUNTRY_ID") ENABLE,
        CONSTRAINT "COUNTR_REG_FK" FOREIGN KEY ("REGION_ID") REFERENCES "HR"."REGIONS" ("REGION_ID") ENABLE
      ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE
        INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
      TABLESPACE "USERS" PCTTHRESHOLD 50;
    COMMENT ON COLUMN "HR"."COUNTRIES"."COUNTRY_ID"
    IS
      'Primary key of countries table.';
      COMMENT ON COLUMN "HR"."COUNTRIES"."COUNTRY_NAME"
    IS
      'Country name';
      COMMENT ON COLUMN "HR"."COUNTRIES"."REGION_ID"
    IS
      'Region ID for the country. Foreign key to region_id column in the departments table.';
      COMMENT ON TABLE "HR"."COUNTRIES"
    IS
      'country table. Contains 25 rows. References with locations table.';

  • In user_tab_cols the data_type is 'undefined' for view columns

    Can anyone please confirm if this is the correct behaviour ?
    select table_name, column_name, data_type from user_tab_cols
    where table_name = 'AR_RCT_CUST_H_V'
    AR_RCT_CUST_H_V     RCT_CUST_ACCOUNT_NUMBER     UNDEFINED     
    AR_RCT_CUST_H_V     RCT_CUST_TYPE     UNDEFINED     
    AR_RCT_CUST_H_V     RCT_CUST_ACCOUNT_ID     UNDEFINED
    This view ( AR_RCT_CUST_H_V ) is created using force view command.
    Also which table can I query to see the correct datatype for the view columns ?
    database version : 11.1.0.6.0
    Thanks,
    Debraj.

    NVL (data_precision, 0) PRECISION
    nvl function replaces all nulls with what ever your given value.
    Thanks,
    surya

Maybe you are looking for

  • PCMCIA firewire adapter not working ....

    with my LACie 40GB USB/Firewire mobile hard drive.. I previously posted that my TiBook 550 firewire port & the Lacie firewire port are fried. I was hinted that the Tibook firewire port may have been the culprit but not certain. I bought a 3rd party P

  • ATI HD5770 Performance Issue

    I have a HD5770 card driving an Acer 22" monitor and my old HD2600XT powering another 17" IBM monitor. Everything works well, I think. I do alot of FCP and Logic stuff and play World of Warcraft, but I im not really seeing any performance increase fr

  • Buget Upload, Planned values-KP06

    Hi  Eeveryone, I posted budget ( planned values) for a cost center in KP06, and used version 1,its for year 2011 .I can see  all the values in report KSBP which is planned  line  item report. My problem is I have created a report painter report using

  • Portal Session Expiration after 10 minutes.

    Hello Experts, We are running on EP 7.0 ABAP+JAVA stack.The UME has been configured on ABAP stack. We have a requirement to auto logoff the portal if no activity is done for 10 minutes. I have gone through SAP Notes and came to know this is not possi

  • HT1331 cant see disks in the airport extreme setup

    cant see disks in the airport extreme "partions" to set up, tried different disks, cables, restart, etc, bottom line the extreme does not see any attached external hard drives, any ideas? Cheers Michael