Interrogate the columns of all tables
HelloI called A, B, C... upto z. of these 26 paintings of paintings, 15 tables have the column common name "AAA". Now, I want to find the names of the tables in which there is a column name "AAA". for example, if this column name 'AAA' is present in the tables B, F, G,... Y(15 tables). The query should display all the table names. Here, in this example we donot know what table is the name of the column "AAA". We find the tables where is the name of the column "AAA"?
Thanks in advance...
Let me know if you have any confusion with my question.
SQL> select * from user_tab_columns where column_name = 'AAA';
Tags: Database
Similar Questions
-
Find the name of the column in all tables
How to find the name of the column in all tables in the database for any column to reveal the name of the person?
We have over 1000 tables looking for.and in some places, the name column FNAME LNAME, First_NAME, DNAMEFor example we have Customer table, Table EMPLOYEE and the ORDER Table
--------------------------------
Customer table
--------------------------------LNMAE
EMPLOYEE table
EMP_ID
DEPT_NAME (we don't want this column as it is not a name column)
Last_name (he must propose this column because it is named)----------------------------
CONTROL Panel
-----------------------------
ORDER_ID
ORDER_NAME (we don't want this column as it is not a name column)
Last_name (he must propose this column because it is named)-------------------------
Dept table
-------------------------
Dept_ID
DEPT_NAME (we don't want this column as it is not a name column)Please advise...
Thank you.
Hello
What exactly do you do?
If you want to display the tables containing these columns, you can query the view data dictionary USER_TAB_COLS (or ALL_TAB_COLS, or, if you have privileges, DBA_TAB_COLS).
For example:
SELECT table_name, column_name
Of user_tab_cols
WHERE nom_de_colonne IN ('DNAME', 'FNAME', 'FIRST_NAME', 'LAST_NAME', 'LNAME') - or else
ORDER BY table_name, column_name
;
-
Select all the values of column except the specific columns in all tables
Hello
I want to display all the column values for all tables in the database, with the exception of 3 columns that exist in all tables...
Can someone give some advice?
See you soon,.Jin
How are you going to display all columns of all tables?
Thank you
Baskar.l -
Deactivation of the column in a table based on the setting in the search box
Hi all
I use Oracle Apex 4.1. I have two region
1. search box
2. in the form of a table
In the search box, I have a LOV field where the user can select the value. Based on this LOV in the search box, tabular column f06 must disable or read-only.
For example if I select THREE in LOV then only column f06 is expected on the other it must disable. How to get there.
Thanks in advance
Ravi
Hi Bobo,
Hope link below will solve your query.
Disable the column in a table.
BR,
Patrick
-
How to search all columns of all tables in a database
I need to search all columns of all tables in a database, I already write the code below, but I got the below error message when running this script
DECLARE
The CNT number;
v_data VARCHAR2 (20);
BEGIN
v_data: = "5C4CA98EAC4C";
FOR t1 IN (SELECT table_name, column_name FROM all_tab_cols where owner = 'admin' and DATA_TYPE = 'VARCHAR2') LOOP
RUN IMMEDIATELY "SELECT COUNT (*) FROM" | T1.table_name | 'WHERE ' | T1.column_name | ' =: 1' IN cnt USING v_data;
IF cnt > 0 THEN
dbms_output.put_line (t1.table_name |) » '|| T1.column_name | | » '|| CNT);
END IF;
END LOOP;
END;
/
Error report:
ORA-00933: SQL not correctly completed command.
ORA-06512: at line 7
00933 00000 - "not correctly completed SQL command.
* Cause:
* Action:
Any help pleaseIf you are running this as a different user than the ADMIN you will also need to add the schema name.
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' ||t1.owner||'.'||t1.table_name|| ' WHERE ' ||t1.column_name || ' = :1' INTO cnt USING v_data;
The error could be any strange names of tables or columns. For example, if they contain spaces in the name.
If you have names, then all identifieres must be placed in "."+ untested example +.
{code}
RUN IMMEDIATELY "SELECT COUNT (*) FROM" ' | "" T1. Owner: ' ». » ' || T1.table_name | " » OÙ « ' || T1.column_name | "" =: 1' IN cnt USING v_data;
{code} -
How can I know the Position of the column in a table
Hi all
How can I know the position of the column in a table...
For example: -.
I have a table
DESC EMPLOYEES
EmpID
Ename
SAL
I want to know the Empid is in 1st position, ename is 2nd and sal is in 3rd place.
is this possible?SELECT *.
Of user_tab_cols
WHERE table_name = 'EMP ';Concerning
Arun -
Inventory of the data of all Tables in a database
Hello
We do the analysis of the existing data base (Oracle 10 g) and I want to prepare an inventory of the data of all tables in a database that is
1. total number of records in a table
2. total number of records that have null values in a column
3. total number of standalone tables IE have no connection with other tables
etc...
Please let me know if there are tools or query that can do these tasks.
Thank you and best regards,
Lokeshselect owner "Owner", table_name "Table_Name", column_name "Column_Name", initcap(data_type) || decode(data_type, 'CHAR', '('|| char_length ||')', 'VARCHAR', '('|| char_length ||')', 'VARCHAR2', '('|| char_length ||')', 'NCHAR', '('|| char_length ||')', 'NVARCHAR', '('|| char_length ||')', 'NVARCHAR2', '('|| char_length ||')', 'NUMBER', '('|| nvl(data_precision,data_length)|| decode(data_scale,null,null, ','||data_scale)||')', null) "Type", nullable "Nullable", decode(to_char(num_distinct), 0,'No', 'YES') "Have Data", owner sdev_link_owner, table_name sdev_link_name, 'TABLE' sdev_link_type from sys.dba_tab_columns where (:OWNER is null or instr(owner,upper(:OWNER)) > 0) and (:TABLE_NAME is null or instr(upper(table_name),upper(:TABLE_NAME)) > 0) and (:COLUMN_NAME is null or instr(upper(column_name),upper(:COLUMN_NAME)) > 0) and substr(table_name,1,4) != 'BIN$' and substr(table_name,1,3) != 'DR$' order by owner, table_name, column_id
I added a new column with an alias "get data". This new column will display "NO" is the entire column is zero and 'YES' if there is even a value not null in the column. But caution is that statistics table must be updated to get the correct results.
Thus, it may be useful to gather current statistics before executing the query.
Exec dbms_stats.gather_schema_stats or even dbms_stats.gather_database_stats.
-
Update the value of the column based on another value of the column to another table
Hi all
I have something very confused me and need your help.
Having two tables A and B.
Table A have 2 column (+ id + and desc1)
Table B have column 2 also (+ transnum + and desc2)
Now, I want to update the column desc2 of table B identical desc1 of table was where transnum of Table B same as the id of the table has.
I use this SQL
update of a2 set a2.desc2 = a1.desc1 of a2 on a2.transnum = a1.id inner join a1
but this error occurs
Error from line 5 in order:
update of a2 set a2.desc2 = a1.desc1 of a2 on a2.transnum = a1.id inner join a1
Error in the command line: 5 column: 35
Error report:
SQL error: ORA-00933: SQL not correctly completed command
* 00933. 00000 - "command not properly ended SQL."
* Question: *.
* Action. *
Hope someone can help me. TQ for help...SQL> create table a1 (id number(2),des varchar2(10)); Table created. SQL> create table b1 (transnum number(2),des varchar2(10)); Table created. SQL> insert into a1 values (1,'maran'); 1 row created. SQL> insert into b1 values (1,'ram'); 1 row created. SQL> commit; Commit complete. SQL> update b1 set des=(select des from a1 where b1.transnum=a1.id); 1 row updated. SQL> select * from b1; TRANSNUM DES ---------- ---------- 1 maran
-
How can I get number of columns for all tables in a schema?
HelloCan someone help me with the code to retrieve any of the columns in each table of a master plan? I'm sorry if it sounds simple. I'm a newbie...
Thank you
Maybe:
Select table_name
count (*) col_count
of user_tab_cols
Table_name group
order of table_name;
-
Get the DDL for all tables in a schema;
Hello
I tried to get the DDL for all tables under my own diagram "A". Here are the steps I've tried, but in vain I
1. logged in as a user A 2. And the ran query SELECT DBMS_METADATA.get_ddl ('TABLE', 'XYZ') FROM user_tables o/p (HugecloB) {code} Any idea how i can get the DDL for all the tables under my own schema ? Thank you so much! Edited by: user642297 on Feb 4, 2011 12:05 PM Edited by: user642297 on Feb 4, 2011 12:05 PM Edited by: user642297 on Feb 4, 2011 12:05 PM Edited by: user642297 on Feb 4, 2011 12:07 PM
Your idea is good, you missed only to use the correct table name:
SELECT DBMS_METADATA.get_ddl ('TABLE', table_name) FROM user_tables;
Concerning
-
Single request for the display of all, but the values of 1 column for all tables
Hello
All tables have the column SYS_CREATION_DATE.
But I don't want to not display the value of this column
Can anyone suggest a way in which I could achieve this?
Oracle version: 11 GR 1 material
OS: SunOS
See you soon,.
Malika
Published by: user9131570 on July 6, 2010 19:57user9131570 wrote:
@TubbyI * table-wise display the values of all but 1 columns (SYS_CREATION_DATE) in my database.*
I need it to compare to another data base for all these values.
I would like to make a wild guess at what you are getting.
In view of these two tables
create table emp (empid number, empname varchar2(15), empaddr varchar2(15), sys_creation_date date); -- create table dept (deptid number, deptmgr varchar2(10), sys_creation_date date);
you want to combine somehow
select empid, empname, empaddr from emp;
with
select deptid, deptmgr from dept;
in a single sql statement?
-
How to hide the column in a table in the adf.
I created the table of the ADF and surround it in the collection of panels, the data in the table from the bean to support variable. Depending on the State, there are a few columns that must hide with the user. I used visible = "false", where the false value will come from backing bean. However the user to the table always have the ability to display the column. Is there any one to hide the column with the user at all times. Fixing the code example:
< af:column sortable = "false" headerText = "column1" id = "c13" visible = "false" >
"" < af:outputText value = "{row.columns1} ' id ="ot13"/ >
< / af:column >
Hello
Use the rendered property?
Concerning
-
Select the column in a table that is defined in the select previous in the statement
Hello
I want to write a procedure that selects all the data in a table has then records them in the text file. I tested on table hr.countries.
My code is like this:
echo off newpage 0 space 0 pagesize 0 feed head off trimspool check out serveroutput on the value
coil countries.txt
define dtable = COUNTRY;
declare
col_num NUMBER;
no_lig NUMBER;
line VARCHAR2 (100);
Col VARCHAR2 (100);
Start
Select count (COLUMN_ID) in the col_num USER_TAB_COLUMNS WHERE table_name = '& dtable';
Select count (*) in no_lig of & dtable;
because me in 1.row_num
loop
1.col_num j
loop
Select column_name from col FROM USER_TAB_COLUMNS WHERE table_name = '& dtable' and column_id = j;
Select the pass in the row (select col, rownum: nurse of (select col from & dtable)) where rn = i;
IF (j! = col_num) THEN
DBMS_OUTPUT. PUT(Row ||) ', ');
ON THE OTHER
DBMS_OUTPUT. PUT (Row);
END IF;
end loop;
DBMS_OUTPUT. NEW_LINE;
end loop;
end;
/
spool off
I have had no error, but the result is like this:
COUNTRY_ID, COUNTRY_NAME, REGION_ID
COUNTRY_ID, COUNTRY_NAME, REGION_ID
COUNTRY_ID, COUNTRY_NAME, REGION_ID
.. and so on for the whole table.
I want to have results with data not only the names of columns. No idea what is the problem? I thought that select col online would do the thing, but the line is identical to the col variable...
Thank you
Honza
Set serveroutput on;
define dtable = COUNTRY;
declare
col_num NUMBER;
no_lig NUMBER;
line VARCHAR2 (100);
Col VARCHAR2 (100);
Start
Select count (COLUMN_ID) in the col_num USER_TAB_COLUMNS WHERE table_name = '& dtable;
Select count (*) in the no_lig argument of &dtable;
because me in 1.row_num
loop
1.col_num j
loop
Select column_name from col FROM USER_TAB_COLUMNS WHERE table_name = '& dtable' and column_id = j;
run immediately 'select'. Col | "from (select ' |) Col |', rownum: nurse from (select ' |) Col |' of & dtable)) where rn =' | I have
Online;
IF (j! = col_num) THEN
DBMS_OUTPUT. PUT(Row ||) ', ');
ON THE OTHER
DBMS_OUTPUT. PUT (Row);
END IF;
end loop;
DBMS_OUTPUT. NEW_LINE;
end loop;
end;
/
Output
anonymous block filled
AR, Argentina, 2
To, Australia, 3
BEING, Belgium, 1
BR, Brazil, 2
CA, Canada, 2
CH, Switzerland, 1
CN, China, 3
OF (Germany), 1
DK, Denmark, 1
For example, Egypt, 4
FR, France, 1
HE, Israel, 4
IN, India, 3
IT, Italy, 1
JP, Japan, 3
KW, Kuwait, 4
ML, Malaysia, 3
MX, Mexico, 2
NG, Nigeria, 4
NL, Netherlands, 1
SG, Singapore, 3
UK, United Kingdom, 1
WE, United States of America, 2
ZM Zambia, 4
ZW, Zimbabwe, 4
-
Can be parallelized Alter the dimensions of the column to change tables
Hi all
Can be parallelized Alter tables to the dimensions of the column to change.
I was able to set the explain plan of parallelized command CREATE INDEX and CREATE TABLE STATEMENTS and view the plan of the explain command.
But when I try to apply the market in PARALLEL for an ALTER TABLE to change column size, explain the plan is a failure.
Ex:
EXPLAIN THE PLAN TO ALTER / * + PARALLEL (10) * / EMP_BLKP_1 TABLE MODIFY ENAME VARCHAR2 (40);
ORA-00900: invalid SQL statement
But when I run the alter even outside the plan to explain that it works very well. But I don't know if parallelism is applied for that change the order.
Receive your answer.
Thank you
NKMhttp://docs.Oracle.com/CD/E11882_01/server.112/e26088/sql_elements006.htm#SQLRF50801
>
The PARALLEL indicator tells the optimizer to use the specified number of concurrent servers for parallel operation. The indication applies to SELECT it, INSERT, MERGE, update, and DELETE portions of a declaration, as well as for the table scan part. If no parallel restriction is violated, the flag is ignored. -
InStr/substr logic to update the column in a table db 9i / 10g / 11g
Hi all
I have a table Test_table with email_address column.
Please update the table and remove
[email protected] and
[email protected]
email_address column.
Current values of the Email_address column
[email protected], ken. [email protected], [email protected], [email protected]
2.Ken. [email protected], [email protected], [email protected]; [email protected]
3 ken. [email protected], [email protected], [email protected], [email protected]
The new value must be
1 ken. [email protected], [email protected]
Ken 2. [email protected], [email protected], [email protected]
3 ken. [email protected], [email protected]
If email_address to remove is the first email address in the column
Then, remove the first comma too, otherwise delete the comma above and email address.
I created a C1 cursor, but I know is not the logic to use to get the new value
Any help will be greately appreciated.
Declare
Cursor c1 is select rowid, email_address
From Test_table
Where (at the top (email_address) like ('% [email protected]%'))
GOLD (superior (email_address) like '% [email protected]%');
V_new_email varchar2 (200);
BEGIN
FOR rec IN C1 LOOP
-do not know how to handle V_new_email to be able to update the table with the current values.
V_new_email: = - some function instr/substr here
Update Test_table
Define email_address = V_new_email
Where rowid = rec.rowid;
END OF LOOP
END;
Thank youYou needn't PL/SQL for such a thing. A SQL should be sufficient.
with data as ( select '[email protected], [email protected], [email protected], [email protected]' col from dual union all select '[email protected], [email protected],[email protected]; [email protected]' from dual union all select '[email protected], [email protected], [email protected], [email protected]' from dual ) select col, trim(replace(replace(replace(col, '[email protected],'), '[email protected]'), ', ,', ',')) rep_col from data; COL REP_COL -------------------------------------------------------------- -------------------------------------------------------------- [email protected], [email protected], [email protected], [email protected] [email protected], [email protected] [email protected], [email protected],[email protected]; [email protected] [email protected], [email protected],[email protected]; [email protected], [email protected], [email protected], [email protected] [email protected], [email protected], [email protected]
Maybe you are looking for
-
Why is the new update let me not convert to aac
There was no change to the creation, but it shows only not the AAFC in the drop-down list. Need to convert files from mp3 music...
-
Satellite Pro A60 video Capture problems
I have the following system: Toshiba A60 laptop Pro satelliteCPU - AMD 2.8 GhzRAM - 768 MBOS - XP Pro SP2 All other system requirements as indicated by the Dazzle DVC90 USB 2.0 capture card are met. I use Pinnacle Studio 9.4 update to capture VCR. Pr
-
WE made the Notebook G71-340 have TWO hard drive bays
My mother has the laptop mentioned in this topic. She had all kinds of issues with her past. Runs slowly. Crashes. Stop randomly. I ran all virus scan and malware known to man and it found nothing. It's either something that is on the hard drive is n
-
Outlook Express 6.0 message is sent, but remains in the Outbox.
Outlook Express 6.0 - create a message. Send message Some errors occurred while processing the requested tasks. Please see the list of errors below for more details. NO DETAILS SHOWN. MESSAGE IS SENT, BUT REMAINS IN THE OUTBOX. MULTIPLE COPIES OF THE
-
Samsung Galaxy 2, which is not recognized by my windows 7
I have a Samsung Galaxy 2, which is not recognized by my computer Windows 7. It says driver installation failed. Tried again and a troubleshooting and still not recognized. I've had this phone for 2 years and you never know. Went to the Sprint stor