List of common column name in a table
I had an urgent request to check for common column name in a table. The table that I can currently have select privelge is ALL_TAB_COLUMNS. I need to list all column_name, table_name, and owner. Thanks.
SQL> sho user
USER is "SCOTT"
SQL> select * from tab
2 where tname like '%EMP';
TNAME TABTYPE CLUSTERID
EMP TABLE
V_EMP VIEW
SQL> select distinct owner, table_name
2 from all_tab_columns
3 where table_name like '%EMP';
OWNER TABLE_NAME
SCOTT EMP
SCOTT V_EMP
SYS EXU7COL_TEMP
SYS EXU8COL_TEMP
SQL>
Similar Messages
-
How can I list all the column names of a table by programming?
Hi,
Now I want to write an function which has the following features:
Firstly, The function was given a parameter as table name.
Then, it will lists all the columns names of the table.
e.g
table: person
---firstName------lastName----+
Michale Jackson
We can get the columns 'firstname' and 'lastName' by calling the function with table name 'person'.
And I also wonder that where I can get reference book or any other materials?
Thanks.
Edited by: wenjing wang on Feb 15, 2008 6:42 AM
Edited by: wenjing wang on Feb 15, 2008 6:57 AMhi,
hope the below code helps u. Just take the headee which contains the field name and split it like below and compare it with the field name u want here 'last name'.
here,
'First name' will be in wt_filedata1 and remaining field names in wt_filedata2, so 'do' continues.
c_tab must be the separator, either , or + or tab etc..
CODE:
read table person into wl_header index 1.
do.
split wl_header at c_tab into: wt_filedata1 wt_filedata2.
if wt_filedata1 <> 'lastname'.
cnt1 = cnt1 + 1.
wl_header = wt_filedata2.
else.
exit.
endif.
enddo.
Please reward if it is useful.
regards,
sri -
Set the column name of a table in a list box
is there any code to set the column name of a table in a list box at oracle devloper 6i?
pls help.I dont want to go for pl/sql . It should work any table.You want Dynamic SQL without using PL/SQL? Tricky. I'm sure there's a possible way using some very complex and convoluted XML functionality of SQL but in reality you are asking for something that isn't natural to SQL queries, especially if you are expecting a dynamic number of columns to be produced for each row of data. SQL expects a table structure, including output formats, to be a defined number of columns with any number of rows, not a defined number of rows with any number of columns.
Perhaps if you explain why you need this sort of functionality then we may be able to offer a better solution.
;) -
How to rename a column name in a table? Thanks first!
I tried to drop a column age from table student by writing the
following in the sql plus environment as :
SQL> alter table student drop column age ;
but I found the following error
ORA-00905: 缺少关键字 (Lack of Key word)
I have oracle enterprise edition 8.0.5 installed at windows 2000
thank you
And I want to know how to rename a column name in a table?
thanksIn Oracle 8i, your syntax would have worked. However, if I
recall correctly, in Oracle 8.0, you can't rename or drop a
column directly. One way to get around that problem is to
create another table based on a select statement from your
original table, providing the new column name as an alias if you
want to change the column name, or omitting that column from the
select statement if you just want to drop it. Then drop the
original table. Then re-create the original table based on a
select statement from the other table. Then you can drop the
other table. Here is an example:
CREATE TABLE temporary_table_name
AS
SELECT age AS new_column_name,
other_columns
FROM student
DROP TABLE student
CREATE TABLE student
AS
SELECT *
FROM temporary_table_name
DROP TABLE temporary_table_name
Something that you need to consider before doing this is
dependencies. You need to make a list of all your dependecies
before you do this, so that you can re-create them afterwards.
If there are a lot of them, it might be worthwhile to do
something else, like creating a view with an alias for the
column or just providing an alias in a select. It depends on
what you need the different column name for. -
How to select even the column names of a table?
Hello All,
Is there a way to select even the column names of a table in the select statement?
My select from a table (say X) is in a SQL* Plus script that gets invoked by application tier and displays data in the application tier window. User's can then copy the data into a spreadsheet and do their processing. However, I need to give them the column names too along with the data.
Thanks,
ChiruIf there is a middle tier that is selecting and
displaying the data, and that's what the users are
copying from, the middle tier would have to address
its presentation of the data to allow users to
include column names. If this is a common task, the
application should probably be modified to give users
the option of downloading the data in a spreadsheet
directly rather than forcing them to copy and paste
data.Thanks for the reply.
The users don't have to copy paste. The application tier has an options in the "Tools" menu item which allows them to copy the entire output to a file (in my case a txt file which is a pipe delimited). Then they have to do text to columns to get the data into each column of the spreadsheet. I could have directly called the stored procedures from the application tier and created ".csv" files and FTP'd them to the user's folders. However, I am having to go this round about because, I am not getting enough support from the LAN team in FTP'ing etc.
OK I'll think of another workaround.
Thanks,
Chiru -
Search for column name in DB tables
Hi Guys
Is it possible to search column name when we do not know the corresponding table in the databse
Cheers
shabarYou can use the data dictionary to search though a list of all column names. The <strike>table</strike> data dictionary view is ALL_TAB_COLUMNS.
Lets assume you want to search for ID columns:
example
select owner, table_name, column_name
from all_tab_columns
where column_name = 'ID';Edited by: Sven W. on Jun 21, 2011 1:47 PM -
How to get only column names from different tables as single table columns
Hi All,
I have one requirement in which we want only column names from different tables.
for example :
I have three tables T1 ,T2, T3 having
col1 clo2 clo3 --> T1 ,
col3 col5 ,clo6 --> T2 ,
Clo6 col8 col9 --> T3
columns i want to get only all Column names from all table as single Resultset not any data from that how can i get that empty resultset
because this empty result i want to bind in datagridview(front end) as Empty resultset
Please tell me anyways to do this
Niraj SevalkarIf I understand you want an empty result set, just with metadata. SET FMTONLY do the trick:
SET FMTONLY ON
SELECT Col1, Col2, Col3, ....., Coln
FROM
T1 CROSS JOIN T2 CROSS JOIN T3
SET FMTONLY OFF
Another alternative is to include an imposible contition
SELECT Col1, Col2, Col3, ....., Coln
FROM
T1 CROSS JOIN T2 CROSS JOIN T3
WHERE 1 = 0
If you are using a SqlDataAdapter in your client application. You can use the FillSchema method. the select command may be any select statement that returns the columns you want. Under the covers FillSchema will call SET FMTONLY ON.
If you are using SqlCommand.ExecuteReader you can pass SchemaOnly to CommandBehavior argument. SET FMTONLY ON is called under the covers. Again the select command may be any select statement that returns the columns you want.
"No darás tropezón ni desatino que no te haga adelantar camino" Bernardo Balbuena -
What is the use of Position Column Name in USER_CONS_COLUMNS Table
Please let me know the purpose of POSITION Column Name in USER_CONS_COLUMNS Table.
Example :
Created this below Table having two constraints 1.Primary Key 2.Check Constraint
CREATE TABLE A(ID NUMBER PRIMARY KEY,NAME VARCHAR2(30),SAL NUMBER CHECK (SAL > 0))
When i execute the below query
SELECT POSITION,CONSTRAINT_NAME FROM USER_CONS_COLUMNS WHERE TABLE_NAME = 'A'
it displays the data :
POSITION CONSTRAINT_NAME
1 SYS_C005488
SYS_C005487
Only for the first record it displays the POSITION but not for the second row.
Kindly help me on this.SQL> CREATE TABLE A(
2 ID1 NUMBER
3 , ID2 NUMBER
4 , NAME VARCHAR2(30)
5 , SAL NUMBER CONSTRAINT A_SAL_POSITIVE CHECK (SAL > 0)
6 , CONSTRAINT A_PRIMARY_KEY PRIMARY KEY (ID1, ID2)
7 )
8 /
Table created.
SQL> SELECT CONSTRAINT_NAME, POSITION, COLUMN_NAME
2 FROM USER_CONS_COLUMNS
3 WHERE TABLE_NAME = 'A'
4 ORDER BY CONSTRAINT_NAME, POSITION
5 /
CONSTRAINT_NAME POSITION COLUMN_NAME
A_PRIMARY_KEY 1 ID1
A_PRIMARY_KEY 2 ID2
A_SAL_POSITIVE SALA primary key constraint can have multiple columns - the position shows the order the columns are in the primary key definition (and thus also in the pk supporting index.)
A check constraint does not have any such ordering of the columns involved, so therefore position is null. -
How to read the column name of a table from sap system using C#?
Hi!!
I am using SAP .NET connector and creating a windows application.
Now I wanna read the column name when a table name is given....
Connection is done, but I don't know the code to read the column names alone...
Can anyone help me with the code??fine!!
So if i give the table name, which the RFC_READ_TABLE function module have, will it run properly? or i wanna change all the codes in order to support RFC_READ_TABLE function module?
Because from the beginning I was using BAPI_CUSTOMER_GETLIST function, but my client requirement is to use ERP function module RFC_READ_TABLE, he didn't give any table name also..
This is my code: What I have to change in this???
ECCDestinationConfig ECCDestination = new ECCDestinationConfig();
RfcDestinationManager.RegisterDestinationConfiguration(ECCDestination);
RfcDestination rfcDest = null;
rfcDest = RfcDestinationManager.GetDestination(a);
RfcRepository repo = rfcDest.Repository;
IRfcFunction customerList = repo.CreateFunction("BAPI_CUSTOMER_GETLIST");
IRfcTable addressData = customerList.GetTable("AddressTable"));
int j = addressData.Metadata.LineType.FieldCount;
for (int i = 0; i < j; i++)
RfcElementMetadata metadata = addressData.GetElementMetadata(i);
listallcolumn.Items.Add(metadata.Name);
Message was edited by: Jeswin Rebil -
How to get the column names of the table into the Dashboard prompt
how to get the column names of the table into the Dashboard prompt
Thanks & Regards
Kishore PHey john,
My requirement is as follows
I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
My pivot table looks like this
COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
---------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK REGION DOLLARS DOLLARS DOLLARS DOLLARS
1 CENTRAL 10 20 30 40
2 SOUTHERN 10 30 30 70
3 EASTERN 20 20 20 60
4 WESTERN 10 20 30 40
When i select the District in column selector
Report has to display rank based on Total Sales by District. i.e
------------------------------------------------- JAN 2009 FEB 2009 MAR 2009
RANK DISTRICT DOLLARS DOLLARS DOLLARS DOLLARS
for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
do you have any solution for this?
http://rapidshare.com/files/402337112/Presentation1.jpg.html
Thanks & Regards
Edited by: Kishore P on Jun 24, 2010 7:24 PM
Edited by: Kishore P on Jun 24, 2010 7:28 PM -
Characters not allowed in column names in Siebel table
Hello,
I am trying to find out the characters or symbols which are not allowed to be a part of column names in Siebel tables. For instance, I checked and found out ( and ) along with all numbers and alphabets are allowed to be part of column name of tables in Siebel. I am looking for some character or character sequence which are not allowed to be used as part of column names.
RegardsWhy do you need to know?
Here you can read something for Oracle: http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm -
How to know primary key column name form a table name in sql query
Suppose I only know the table name. How to get its primary key column name from the table name?
ThanksViews don't have primary keys though their underlying tables might. You'd need to pick apart the view to determine where it's columns are coming from.
You can select the text of the view in question from user_views. -
Hi Guys,
I want to rename the column name of a table. Lets say I have table employee:
SQL> desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
STARS VARCHAR2(8)
I want to change the name of the cloumn name of ENAME to EMPNAME so that structure looks like this:
SQL> desc emp;
Name Null? Type
EMPNO NOT NULL NUMBER(4)
EMPNAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
STARS VARCHAR2(8)
Can anyone tell me any statement or way to solve this problem. Please keep in mind that I will not delete the table or create another column name of EMPNAME and copy the data from ENAME to EMPNAME.
Regds,
DebabrataALTER TABLE DEPT2 RENAME COLUMN ENAME TO EMPNAME
Regards,
Raj -
How to get the constraintlist and column name in a table?
Hi,
can anyone please tell me how to get the constraint type ,and it's imposed on columns names in a table.
Thanks,
DeekayDeekay wrote:
can anyone please tell me how to get the constraint type ,and it's imposed on columns names in a table.To get constraint type:
select constraint_type from user_constraints where constraint_name = 'YOUR CONSTRAINT NAME';To get constraint columns:
SELECT column_name from user_cons_columns where constraint_name = 'YOUR CONSTRAINT NAME';SY. -
Finding a column name from all tables
i have 85 tables in my user, i forget a column name and its table name. how to find that particular column amongst all tables i have.
hi
You can use User_tab_columns or All_tab_columns
SQL>Select Table_Name,Column_Name From user_tab_columns
where lower(table_name) like '%emp%' or
lower(column_name) like '%dept%'
Khurram Siddiqui
[email protected]
Message was edited by:
pcbyte12
Maybe you are looking for
-
Security Manager/Access problem
(WWC-00000) An unexpected error has occurred in portlet instances: wwpob_api_portlet_inst.create_inst (WWC-44846) The following error occurred during the call to Web provider: java.lang.NullPointerException at oracle.portal.provider.v2.security.URLSe
-
Hi, Iam trying posting entry using f-90,but showing an error message . System response In the standard system, the system rejects the posting to the asset and issues an error message. However, this error message can be changed in Customizing so that
-
Placing .pdf into InDesign CC
How do I place a multiple page .pdf document into Adobe Indesign CC?
-
Content not Launching in Firefox ESR on Ubuntu
We are currently experiencing issues launching content in OLM using FireFox ESR 31 on Ubuntu 14.04 LTS using JDK 1.7.0_67. This is currently affecting over 15000 users. Please help with advice
-
Google Chrome will not install on MacBookPro OS 10.7.5
I had to remove Google Chrome from my laptop because it kept crashing and now it will not install. I am using OS version 10.7.5. In the Application folder this is the image I get. This looks like it is not supported. I need to use Chrome for work and