Exporting column and table comments
I need to be able to create an external "data dictionary" to show to database users. I am currently exporting to a reporting schema, and then writing SQL against the reporting schema to get table, column, datatype, etc... information. I also need to be able to get the column and table comments that I entered into data modeler. I can't find those anywhere in the reporting schema. Are they included in the reporting schema? If not, how do I export those comments from data modeler?
Thanks,
Jonathan
That's perfect. Thanks!
For anyone interested, here is my "Data dictionary" select statement from the exported reporting schema:
select table_name, sequence as seq, column_name, cast(ccom.text as varchar2(4000)) as description,
native_type as column_type,
case when native_type='NUMBER' then t_precision when native_type='DATE' then null else t_size end column_length,
cast(cnote.text as varchar2(4000)) as valid_values,
mandatory as required,
case when native_type='DATE' then 'DATE' else native_type||'('||case when native_type='NUMBER' then t_precision else t_size end||')' end column_spec
from dmrs_columns, (select * from dmrs_large_text where type='Comments') ccom, (select * from dmrs_large_text where type='Note') cnote
where dmrs_columns.ovid = ccom.ovid (+)
and dmrs_columns.object_id = cnote.ovid (+)
order by table_name, sequence
Similar Messages
-
Doubt in export, import and table para when creating Function Module
Dear fellow ABAPers,
I have a doubt in defining export, import and table parameter while creating a function module.
I am calling a function module inside a user exit. Now in the user exit the SAP fills an internal table called i_lfa1 with all the data user has eneterd.
Now I want to pass this whole internal table to function module and the perform some checks on the values of internal table.
After that function module fills an error structure with values depending on some check.
1)
How do I pass this internal table to function module ?
When I am creating function module in se37 where do I define this iternal table type ? Is it in Import or Table parameter during function module creation?
2)
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Please clear my doubt..
Relevant points will be awarded.
Regards,
Tushar.Hi Tushar,
1. How do I pass this internal table to function module ?
I assume u are creating your own Y/Z FM.
Pass it thru TABLES parameter.
2. When I am creating function module in se37 where do I define this iternal table type
Define this in TABLES interface.
What Type ?
THE SAME TYPE WHICH HAS BEEN DEFINED
WHILE PASSING IN THE USER-EXIT FUNCTION MODULE.
IF U SEE THE FM OF THE USER-EXIT,
U WILL COME TO KNOW.
3.
Where do I define error structure type (which is returned by function module to main program)? Is it in Export or table parameter during function module creation?
Define it in TABLES interace. (not in export, import)
(Since what u are going to return is an internal table)
U can take for eg. BDCMSGCOLL.
OR u can create your own Y/Z structure
for the same purpose.
(or u can use the structure type T100)
I hope it helps.
Regards,
Amit M. -
How to know columns and table name whose column size are modified
Hi guys
I want to know which all columns in the tables are modify
i.e. list of columns and table name whose column size are modified
Step1 :
CREATE TABLE employees
( employee_number number(5) ,
employee_name varchar2(50) ,
department_id number(10)
CREATE TABLE Supplier
( Supplier_number number(5) ,
Supplier_name varchar2(50) ,
CREATE TABLE customers
( customer_id number(10) not null,
customer_name varchar2(50),
address varchar2(50),
city varchar2(50),
state varchar2(25),
zip_code varchar2(10),
Step2 :
Alter table employees
MODIFY employee_number number(10)
ALTER TABLE supplier
MODIFY supplier_name varchar2(100)
step3
query to dispaly
columnname table name
employee_number employees
supplier_name supplier
How to know columns and table name whose column size are modified
could you please provide query
Thanks in Advance09:35:50 SQL> desc dba_objects
Name Null? Type
OWNER VARCHAR2(30)
OBJECT_NAME VARCHAR2(128)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED DATE
LAST_DDL_TIME DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
NAMESPACE NUMBER
EDITION_NAME VARCHAR2(30)LAST_DDL_TIME can be utilized -
Hi,
I need to find out that '101c_0000000018' value is which column and table of database.
Is there a way to find it? I am looking for table and column which is storing this data.
Thanks
SandyIt's possible but performance is going to be horrible.
Assuming the data is stored in a CHAR or VARCHAR2 column, something like
DECLARE
l_value VARCHAR2(100) := '101c_0000000018' ;
l_cnt PLS_INTEGER;
l_sql VARCHAR2(1000);
BEGIN
FOR x IN (
SELECT table_name, column_name
FROM dba_tab_cols
WHERE owner = <<name of schema>>
AND data_type IN ('CHAR', 'VARCHAR2' )
LOOP
l_sql := 'SELECT COUNT(*) FROM ' || x.owner || '.' || x.table_name || ' WHERE ' || x.column_name || ' = :1';
EXECUTE IMMEDIATE l_sql
INTO l_cnt
USING l_value;
IF( l_cnt > 0 )
THEN
dbms_output.put_line( 'Found the value ' || l_value || ' in owner = ' || x.owner || ' table name = ' || x.table_name || ' column name = ' || x.column_name );
END IF;
END LOOP;
END;Justin
Edited by: Justin Cave on Dec 8, 2011 12:20 PM -
How to find the columns and tables used in a stored procedure?
Hi,
Can someone suggest how to find the columns and tables used within a stored procedure?
Thanks
VBKFor example:
SQL> create or replace
2 procedure p1
3 is
4 cnt number;
5 begin
6 select count(*) into cnt from emp;
7 end;
8 /
Procedure created.
SQL> select referenced_owner,
2 referenced_name
3 from dba_dependencies
4 where owner = 'SCOTT'
5 and name = 'P1'
6 and referenced_type = 'TABLE'
7 /
REFERENCED_OWNER REFERENCED_NAME
SCOTT EMP
SQL> SY. -
How to add a comment on column and table
I would like to have a comment for each column, I know this is possible in oracle we can have comment for each column.
can I have the same in SQL Server, can you provide me a simple example.
I created a table as in attached screen, and tried using the extended properties, to do this. however I've few questions
1. How can I retrieve this info using query
2. here in point 4 of attached image I see Name and Value, do I have to give name and value for each column
3. Do I have to rt click each column and go and update this info their, I have a table with 100+ column :(
Thanks!
NeilI saw these examples below, however how to associate and see them this to a table and a column?
exec sp_addextendedproperty
@name = ‘SQL Server Rider’,
@value = ‘This is a test’
GO
2. Updating extended property
exec sp_updateextendedproperty
@name = ‘SQL Server Rider’,
@value = ‘Property Updated’
GO
3. Delete extended property
exec sp_dropextendedproperty
@name = ‘SQL Server Rider’
GO
select * from fn_listextendedproperty(null,null,null,null,null,null,null)
NO Records output
Neil -
Translation of Columns and Table Names
Hi,
We are starting a large migration project and we have a mix of dutch and english developers.
I was wondering if there is any clever ways to translate column names and table names.
Not physically translate the text but store the english column name against the dutch column name?
I know I could write a view which overlays the table with the english version but I was wondering if there was something a bit cleverer?
Anyway to store multiple meta data against a physical table?
Thanks
RichardI'd tend to agree with Nicolas that you'd generally want all the developers to agree on what a particular object was called rather than having half of them think of it in Dutch and half in English.
On the other hand, it would make sense to me that the comments you create on your objects and tables should be multilingual, i.e.
SQL> create table my_emp (
2 name varchar2(100)
3 );
Table created.
SQL> comment on table my_emp is 'Table containing employee information.
2 Lijst die werknemersinformatie bevat.';
Comment created.(The translation is from babelfish.yahoo so I apologize if it butchers the Dutch).
The developers should be able to see the table and column comments in their IDE of choice and should be able to see what the object represents in their language.
Justin -
Hi Experts,
I just want to ask is there any procedure to know the table name and the corrosponding column name when you have only data with you.
Suppose you have a string say "India". Now i want to know the name of the column and corrosponding tablename
which holds the value "India".
Thanks
RajatSolutions previously provided by michaels...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
'Exists in Hierarchy' column and table name
Hi All
In Position hierarchy form .we all find exists in hierarchy flag ..when checking for
hierarchies , can any one help me ..what is the table and column name which will tell whether position exists in hierarchy or notHi,
I doubt where the exists flag is stored.
But you can derive it very easily by checking the position_id exists in (SUBORDINATE_POSITION_IS or PARENT_POSITION_ID) in table PER_POS_STRUCTURE_ELEMENTS for given structure_id.
Hope it helps.
Thanks,
Sanjay -
Blanks, spetial characters in column and table names
Is there any posibility, which i have overseen to change the sugested table and column names to something with mixed case, blanks, spetial characters, which often occurs in the MS World. It's uggly but 1000 times better then rewriting code, or changing create table scrips like this:
CREATE TABLE "BDProjection"
"ID" NUMBER(11) DEFAULT 0 NOT NULL,
"Name" VARCHAR2(4000),
"Semi-major axis" NUMBER(20,5) DEFAULT 0,
"Semi-minor axis" NUMBER(20,5) DEFAULT 0,
"Latitude origin" NUMBER(20,5) DEFAULT 0,
"Longitude" NUMBER(20,5) DEFAULT 0,
"False easting" NUMBER(20,5) DEFAULT 0,
"False northing" NUMBER(20,5) DEFAULT 0,
"Scale factor at origin" NUMBER(20,5) DEFAULT 0,
"scale Coords" NUMBER(11) DEFAULT 0,
"default" NUMBER(1) DEFAULT 0,
"MinEasting" NUMBER(20,5) DEFAULT 0,
"MaxEasting" NUMBER(20,5) DEFAULT 0,
"MinNorthing" NUMBER(20,5) DEFAULT 0,
"MaxNorthing" NUMBER(20,5) DEFAULT 0
This may be a sugestion for a future relaese.
UweTo query your table, as is:
SQL> SELECT *
2 FROM cst_customer
3 WHERE "#_CUST" = 10030;
To get rid of the #'s in the column names of your table:
SQL> CREATE TABLE new_cst_customer
2 AS
3 SELECT "#_CUST" no_cust,
4 "#_PH_BUS" no_ph_bus,
5 "#_PH_HOME" no_ph_home,
6 n_cust_surname
7 FROM cst_customer;
Table created.
SQL> DROP TABLE cst_customer;
Table dropped.
SQL> CREATE TABLE cst_customer
2 AS
3 SELECT *
4 FROM new_cst_customer;
Table created.
Then, you can query your table as follows:
SQL> SELECT *
2 FROM cst_customer
3 WHERE no_cust = 10030;
You will need to recreate any constraints associated with the table and recompile any procedures, functions, triggers, and packages associated with the table, and change any code to use the new column names. It would be a good idea to make a list of all the changes to be made and make a backup copy of the table before you start. In your code, just replace all #_ with no_. If you are just getting started, it would be worth your while to make the changes now and save a lot of hassles later. If you have a lot of dependencies, it might be better just to use the quotes everywhere. I have seen posts by someone else with a similar situation and everything he tries to do has to be done specially because of it; Creating a simple procedure becomes "procedure agony".
null -
Column and table formatting challenges
Am switching form microsoft word to pages and experiencing some challenge:
1.
how do I format specific text only to be in 2,3 or 4 columns but not the entire page?
2.
how do I insert a table in a table cell, or text box in a table cell, or if that's possible how do I format specific text in a table cell (not everything) to display over 2 columns? I remember doing all of this formatting manually back in the days of wordstar for DOS, and pages 09 ought to offer some improvement I would hope.sgendry wrote:
Am switching form microsoft word to pages and experiencing some challenge:
1. how do I format specific text only to be in 2,3 or 4 columns but not the entire page?
+Menu > Insert > Layout Break+
…before and after the change
2. how do I insert a table in a table cell,
Can't
or text box in a table cell
Can't
or if that's possible how do I format specific text in a table cell (not everything) to display over 2 columns?
Click in a cell:
+Inspector > Table > Table > Edit Rows & Columns > Split row/Column+
I remember doing all of this formatting manually back in the days of wordstar for DOS, and pages 09 ought to offer some improvement I would hope.
You can use tabs. Pages is mostly simpler than Word, with some extra features, and a whole lot cheaper. There is some comfort that Pages can do things that Word can't and in some cases, not all, do the same tasks simpler.
Peter -
Hi,
I was wondering if any of you know how to do the following:
I have two tables (A & B).
The columns on these two tables are similar in name in some cases eg: name and visit. So for table A I created an alias such as tb1 and for table2 tb2.
This means now that my fields are referenced as: tb1.name and tb2.name.
Now, I've got that sql code in an INLINE VIEW. I want to now reference those inline columns, how do I do it?
I've got this as an example and would like to know if someone can shed some light on this:
select re.name,re.visit from (select tb1.name,tb2.name,tb1.visit from table1 tb1, table2 tb2 where some_criteria_here) re
where rownum <10;
Thanks for your help.
-JJust give those two name columns aliases in the inline view:
select name1, name2, visit
from (select tb1.name name1, tb2.name name2, tb1.visit
from table1 tb1,
table2 tb2
where some_criteria_here)
where rownum < 10;I'm assuming there is an order by clause in that inline view that you are not showing here - that is the only reason you would need to use an inline view, otherwise it should just be:
select tb1.name name1, tb2.name name2, tb1.visit
from table1 tb1,
table2 tb2
where some_criteria_here
and rownum < 10; -
JKM DB2 400 column and table name 10 character limit
I am trying to set up CDC on an iSeries. I have successfully loaded data with the LKM SQL to Oracle, and now I want to set up CDC for the table and am trying to use "JKM DB2 400" . I get invalid token errors when I try to start journalizing, and it appears to be the table and column names, used to set up CDC, which are more than the 10 character limit. Tables like SNP_JRN_SUBSCRIBER seem to come from the getJrnInfo function and other table and column names are hard coded. I want to copy the JKM and reduce all of the names to less than 10 characters.
Where else are these names used? How does the interface know which table names to use when set to use only journalized data and how can I change it to use the new shorter names? Is there a better solution?Thanks to all for assistance. It turns out that the 10 character limit, about which the server people warned me, isn't an issue with my ODBC connection. The invalid token error was being caused by some missing qualifiers in the generated sql which caused appearances of ".tablename" rather than "tablename" and other similar. I was able to modify the knowledge module to eliminate this issue and the CDC worked correctly on my first test.
-
Export, Import and Table declaration in custom function module
I am creating a custom function module. Parameters needed are export internal table and one data field from the internal table.
What do i need to fill for 'associated type' for these export parameters since size of the internal table and type for the data field from the internal table vary.Hello Albert
If the function module need not be RFC-enabled then you have many ways to define such dynamic parameters, e.g.:
FUNCTION ZUS_SDN_DYNAMIC_PARAMS.
*"*"Local Interface:
*" EXPORTING
*" REFERENCE(ET_ITAB) TYPE TABLE
*" REFERENCE(ET_ITAB_1) TYPE ANY
*" REFERENCE(ET_ITAB_2)
*" REFERENCE(ED_DATA) TYPE CLIKE
*" REFERENCE(ED_DATA_1) TYPE ANY
*" REFERENCE(ED_DATA_2)
ENDFUNCTION.
See also: How to return back a structure of dynamic tables in a Function Module
Regards
Uwe -
Hello All,
I need to know the new created tables on my database and the added columns:
I used the below query so i can get the NEW created tables
select * from dba_objects d where to_date(d.created,'dd/mm/yyyy') = to_Date(sysdate-1,'dd/mm/yyyy') and d.object_type = 'TABLE'and owner = 'MyOwner';
Is there any way to know what are the new added columns to a table, in the below i can know the last DDL, but what i need is to know the added colums
select * from dba_objects d where to_date(d.Last_Ddl_Time,'dd/mm/yyyy') = to_Date(sysdate -1 ,'dd/mm/yyyy') and owner = 'MyOwner';
Thanks in Advance.consider:
SQL> alter system set audit_trail='db_extended' scope=spfile;
System altered.
SQL> startup force
ORACLE instance started.
Total System Global Area 431038464 bytes
Fixed Size 1375088 bytes
Variable Size 301991056 bytes
Database Buffers 121634816 bytes
Redo Buffers 6037504 bytes
Database mounted.
Database opened.
SQL> audit alter table;
Audit succeeded.
SQL> conn ami/ami
Connected.
SQL> create table a as select * from dual;
Table created.
SQL> alter table a add b date;
Table altered.
SQL> select sql_text from dba_audit_trail where sql_text is not null;
SQL_TEXT
alter table a add b dateAmiel Davis
Maybe you are looking for
-
16 mo young Mac Pro will not turn on. Dead. Why. No problems ever! Installed Yosemite and did not boot up after. Did that kill it? To young to die. What happened?what do I do now??????? Help!
-
Hard Drive dead? - Failed to Issue COM RESET successfully after 3 attempts.
Hello, i think my 13" 2.53Ghz Unibody (mid2009) MBP's hard drive has had it's last spin. I was using it normally in bootcamp, when windows7 froze, so I rebooted holding the power button....windows wouldnt start any more...ok, so i tried to boot into
-
Hello Gurus, We are in SCM 4.0 and currently we are facing an issue in safety stock calculation. We run a macro to calculate the safety stock. The safety stock for a particular bucket is calculated by the sum of total demand of next consecutive 4 buc
-
Hi I want to have the "Edit in place" functionality in an ALV. Do you have an URL or example of how to do this? Thanx in advance
-
Compilation error in Jdevelopoer 10.1.3
Hi, when I try to compilate some class, always appear this error Compiling... Internal compilation error, terminated with a fatal exception I have installed the jdk1.5.0_06, but it's impossible work. thanks